diff --git a/modules/auth/package.json b/modules/auth/package.json index 85e6e32a0..b76759b6e 100644 --- a/modules/auth/package.json +++ b/modules/auth/package.json @@ -37,7 +37,7 @@ "ts-loader": "8.0.7", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.5", "webpack": "4.44.2", "webpack-cli": "4.1.0" } diff --git a/modules/browser-node/package.json b/modules/browser-node/package.json index b74613817..4db9accb5 100644 --- a/modules/browser-node/package.json +++ b/modules/browser-node/package.json @@ -21,12 +21,12 @@ "@connext/vector-engine": "0.2.5-beta.21", "@connext/vector-types": "0.2.5-beta.21", "@connext/vector-utils": "0.2.5-beta.21", - "@ethersproject/address": "5.2.0", - "@ethersproject/bignumber": "5.2.0", - "@ethersproject/constants": "5.2.0", - "@ethersproject/providers": "5.2.0", - "@ethersproject/solidity": "5.2.0", - "@ethersproject/wallet": "5.2.0", + "@ethersproject/address": "5.4.0", + "@ethersproject/bignumber": "5.4.1", + "@ethersproject/constants": "5.4.0", + "@ethersproject/providers": "5.4.3", + "@ethersproject/solidity": "5.4.0", + "@ethersproject/wallet": "5.4.0", "@sinclair/typebox": "0.12.7", "ajv": "6.12.6", "axios": "0.21.1", @@ -52,7 +52,7 @@ "ts-mocha": "8.0.0", "ts-node": "9.1.1", "ts-nats": "1.2.15", - "typescript": "4.2.4", + "typescript": "4.3.5", "webpack": "4.44.2", "webpack-cli": "4.1.0" } diff --git a/modules/browser-node/src/services/store.ts b/modules/browser-node/src/services/store.ts index dab02f356..5f1959f2f 100644 --- a/modules/browser-node/src/services/store.ts +++ b/modules/browser-node/src/services/store.ts @@ -391,7 +391,7 @@ export class BrowserStore implements IEngineStore, IChainServiceStore { attempts.push({ // TransactionResponse fields (defined when submitted) gasLimit: response.gasLimit.toString(), - gasPrice: response.gasPrice.toString(), + gasPrice: (response.gasPrice ?? 0).toString(), transactionHash: response.hash, createdAt: new Date(), diff --git a/modules/contracts/deploy/deploy.ts b/modules/contracts/deploy/deploy.ts index a2453d7d2..c07dc4db1 100644 --- a/modules/contracts/deploy/deploy.ts +++ b/modules/contracts/deploy/deploy.ts @@ -1,5 +1,5 @@ import { BigNumber } from "@ethersproject/bignumber"; -import { EtherSymbol, Zero } from "@ethersproject/constants"; +import { EtherSymbol, One, Zero } from "@ethersproject/constants"; import { formatEther, parseEther } from "@ethersproject/units"; import { deployments, ethers, getNamedAccounts, getChainId, network } from "hardhat"; import { DeployFunction } from "hardhat-deploy/types"; @@ -58,7 +58,7 @@ const func: DeployFunction = async () => { log.info(`Sent transaction to deploy ${name}, txHash: ${deployment.transactionHash}`); log.info( `Success! Consumed ${receipt?.gasUsed ?? "unknown"} gas worth ${EtherSymbol} ${formatEther( - (receipt?.gasUsed || Zero).mul(tx.gasPrice), + (receipt?.gasUsed ?? Zero).mul(tx.gasPrice ?? One), )} deploying ${name} to address: ${deployment.address}`, ); }; diff --git a/modules/contracts/hardhat.config.ts b/modules/contracts/hardhat.config.ts index c43cfa879..461ca90fc 100644 --- a/modules/contracts/hardhat.config.ts +++ b/modules/contracts/hardhat.config.ts @@ -52,7 +52,7 @@ const config: HardhatUserConfig = { networks: { hardhat: { accounts: { - accountsBalance: "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + accountsBalance: "57896044618658097711785492504343953926634992332820282019728792003956564819967", mnemonic, }, chainId, @@ -61,7 +61,7 @@ const config: HardhatUserConfig = { }, localhost: { accounts: { - accountsBalance: "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + accountsBalance: "57896044618658097711785492504343953926634992332820282019728792003956564819967", mnemonic, }, chainId, diff --git a/modules/contracts/ops/entry.sh b/modules/contracts/ops/entry.sh index 1868c387a..9733d5d5b 100644 --- a/modules/contracts/ops/entry.sh +++ b/modules/contracts/ops/entry.sh @@ -21,7 +21,7 @@ rm -f "$chain_addresses" ## Start hardhat testnet echo "Starting hardhat node.." -hardhat node --hostname 0.0.0.0 --port 8545 --no-deploy --as-network localhost > /tmp/hardhat.log & +hardhat node --hostname 0.0.0.0 --port 8545 --no-deploy --network hardhat > /tmp/hardhat.log & pid=$! echo "Waiting for testnet to wake up.." wait-for -q -t 60 localhost:8545 2>&1 | sed '/nc: bad address/d' @@ -29,11 +29,11 @@ echo "Good morning!" echo "Deploying contracts..." mkdir -p deployments -hardhat deploy --network localhost --no-compile --export-all "$ADDRESS_BOOK" | pino-pretty --colorize --translateTime --ignore pid,level,hostname,module +hardhat deploy --network hardhat --no-compile --export-all "$ADDRESS_BOOK" | pino-pretty --colorize --translateTime --ignore pid,level,hostname,module # jq docs: https://stedolan.github.io/jq/manual/v1.5/#Builtinoperatorsandfunctions jq ' - .["'"$CHAIN_ID"'"].localhost.contracts + .["'"$CHAIN_ID"'"].hardhat.contracts | map_values(.address) | to_entries | map(.key = "\(.key)Address") diff --git a/modules/contracts/ops/package.json b/modules/contracts/ops/package.json index 9ddcfae44..2a2372bca 100644 --- a/modules/contracts/ops/package.json +++ b/modules/contracts/ops/package.json @@ -2,8 +2,8 @@ "name": "ethprovider", "description": "This is only used to install a few packages into the ethprovider docker container", "dependencies": { - "ethers": "5.2.0", - "hardhat": "2.2.0", + "ethers": "5.4.3", + "hardhat": "2.5.0", "pino-pretty": "4.6.0" } } diff --git a/modules/contracts/package.json b/modules/contracts/package.json index 7daa37bed..47282168c 100644 --- a/modules/contracts/package.json +++ b/modules/contracts/package.json @@ -31,24 +31,24 @@ "@connext/pure-evm-wasm": "0.1.4", "@connext/vector-types": "0.2.5-beta.21", "@connext/vector-utils": "0.2.5-beta.21", - "@ethersproject/abi": "5.2.0", - "@ethersproject/abstract-provider": "5.2.0", - "@ethersproject/abstract-signer": "5.2.0", - "@ethersproject/address": "5.2.0", - "@ethersproject/bignumber": "5.2.0", - "@ethersproject/constants": "5.2.0", - "@ethersproject/contracts": "5.2.0", - "@ethersproject/hdnode": "5.2.0", - "@ethersproject/keccak256": "5.2.0", - "@ethersproject/providers": "5.2.0", - "@ethersproject/solidity": "5.2.0", - "@ethersproject/units": "5.2.0", - "@ethersproject/wallet": "5.2.0", + "@ethersproject/abi": "5.4.0", + "@ethersproject/abstract-provider": "5.4.0", + "@ethersproject/abstract-signer": "5.4.1", + "@ethersproject/address": "5.4.0", + "@ethersproject/bignumber": "5.4.1", + "@ethersproject/constants": "5.4.0", + "@ethersproject/contracts": "5.4.1", + "@ethersproject/hdnode": "5.4.0", + "@ethersproject/keccak256": "5.4.0", + "@ethersproject/providers": "5.4.3", + "@ethersproject/solidity": "5.4.0", + "@ethersproject/units": "5.4.0", + "@ethersproject/wallet": "5.4.0", "@openzeppelin/contracts": "3.2.1-solc-0.7", "evt": "1.9.12", - "hardhat": "2.2.0", - "hardhat-deploy": "0.7.5", - "hardhat-deploy-ethers": "0.3.0-beta.7", + "hardhat": "2.5.0", + "hardhat-deploy": "0.8.11", + "hardhat-deploy-ethers": "0.3.0-beta.10", "keccak": "3.0.1", "p-queue": "6.6.2", "pino": "6.11.1", @@ -56,11 +56,11 @@ }, "devDependencies": { "@nomiclabs/hardhat-ethers": "2.0.2", - "@nomiclabs/hardhat-etherscan": "2.1.1", + "@nomiclabs/hardhat-etherscan": "2.1.4", "@nomiclabs/hardhat-waffle": "2.0.1", - "@tenderly/hardhat-tenderly": "1.0.11", - "@typechain/ethers-v5": "6.0.5", - "@typechain/hardhat": "^1.0.1", + "@tenderly/hardhat-tenderly": "1.0.12", + "@typechain/ethers-v5": "7.0.1", + "@typechain/hardhat": "2.2.0", "@types/chai": "4.2.15", "@types/chai-subset": "1.3.3", "@types/mocha": "8.2.1", @@ -70,7 +70,7 @@ "babel-loader": "8.1.0", "chai": "4.3.1", "chai-subset": "1.6.0", - "ethereum-waffle": "3.3.0", + "ethereum-waffle": "3.4.0", "event-target-shim": "5.0.1", "hardhat-gas-reporter": "1.0.4", "mocha": "8.3.0", @@ -84,8 +84,8 @@ "ts-loader": "8.0.7", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typechain": "4.0.3", - "typescript": "4.2.4", + "typechain": "5.1.2", + "typescript": "4.3.5", "webpack": "4.44.2", "webpack-cli": "4.1.0" } diff --git a/modules/contracts/src.ts/commitments/withdraw.spec.ts b/modules/contracts/src.ts/commitments/withdraw.spec.ts index fa28807d6..76a4a463b 100644 --- a/modules/contracts/src.ts/commitments/withdraw.spec.ts +++ b/modules/contracts/src.ts/commitments/withdraw.spec.ts @@ -1,9 +1,9 @@ import { signChannelMessage, expect } from "@connext/vector-utils"; import { BigNumber } from "@ethersproject/bignumber"; import { AddressZero } from "@ethersproject/constants"; -import { Contract } from "@ethersproject/contracts"; import { parseEther } from "@ethersproject/units"; import { deployments } from "hardhat"; +import { ChannelMastercopy, ERC20 } from "../../typechain"; import { alice, bob, provider } from "../constants"; import { getContract, createChannel } from "../utils"; @@ -12,8 +12,8 @@ import { WithdrawCommitment } from "./withdraw"; describe("withdrawCommitment", function () { this.timeout(120_000); - let channel: Contract; - let token: Contract; + let channel: ChannelMastercopy; + let token: ERC20; const amount = "50"; beforeEach(async () => { diff --git a/modules/contracts/src.ts/constants.ts b/modules/contracts/src.ts/constants.ts index e48d991cd..afe4b8786 100644 --- a/modules/contracts/src.ts/constants.ts +++ b/modules/contracts/src.ts/constants.ts @@ -1,14 +1,15 @@ import { HDNode } from "@ethersproject/hdnode"; import { Wallet } from "@ethersproject/wallet"; import { JsonRpcProvider } from "@ethersproject/providers"; -import { network, ethers }from "hardhat"; +import { network, ethers, waffle } from "hardhat"; import pino from "pino"; // Get defaults from env const chainProviders = JSON.parse(process.env.CHAIN_PROVIDERS ?? "{}"); const chainId = Object.keys(chainProviders)[0]; const url = Object.values(chainProviders)[0]; -const mnemonic = process.env.SUGAR_DADDY ?? "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat"; +const mnemonic = + process.env.SUGAR_DADDY ?? "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat"; export const defaultLogLevel = process.env.LOG_LEVEL || "info"; export const logger = pino({ level: defaultLogLevel }); @@ -17,18 +18,11 @@ export const networkName = network.name; export const provider = url ? new JsonRpcProvider(url as string, parseInt(chainId)) - : ethers.provider as JsonRpcProvider; + : (ethers.provider as JsonRpcProvider); -const hdNode = HDNode.fromMnemonic(mnemonic).derivePath("m/44'/60'/0'/0"); +export const wallets = waffle.provider.getWallets(); -export const wallets: Wallet[] = Array(20) - .fill(0) - .map((_, idx) => { - const wallet = new Wallet(hdNode.derivePath(idx.toString()).privateKey, provider); - return wallet; - }); - -export const chainIdReq = provider.getNetwork().then(net => net.chainId); +export const chainIdReq = provider.getNetwork().then((net) => net.chainId); export const alice = wallets[0]; export const bob = wallets[1]; export const rando = wallets[2]; diff --git a/modules/contracts/src.ts/services/ethService.spec.ts b/modules/contracts/src.ts/services/ethService.spec.ts index 7bcc3ca44..08fd92282 100644 --- a/modules/contracts/src.ts/services/ethService.spec.ts +++ b/modules/contracts/src.ts/services/ethService.spec.ts @@ -84,6 +84,8 @@ const txReceipt: TransactionReceipt = { transactionHash: txResponse.hash, transactionIndex: 1, status: 1, + type: 0, + effectiveGasPrice: BigNumber.from(21000), }; const { log } = getTestLoggers("ethService"); diff --git a/modules/contracts/src.ts/services/ethService.ts b/modules/contracts/src.ts/services/ethService.ts index 8603f6689..1715496e4 100644 --- a/modules/contracts/src.ts/services/ethService.ts +++ b/modules/contracts/src.ts/services/ethService.ts @@ -126,7 +126,7 @@ export class EthereumChainService extends EthereumChainReader implements IVector channelAddress, reason, hash: response.hash, - gasPrice: response.gasPrice.toString(), + gasPrice: response.gasPrice?.toString() ?? "unknown", nonce: response.nonce, }, "Tx submitted.", @@ -428,7 +428,7 @@ export class EthereumChainService extends EthereumChainReader implements IVector this.log.info( { hash: response.hash, - gas: response.gasPrice.toString(), + gas: response.gasPrice?.toString() ?? "unknown", channelAddress, method, methodId, diff --git a/modules/contracts/src.ts/tests/channelFactory.spec.ts b/modules/contracts/src.ts/tests/channelFactory.spec.ts index e631b0841..5dc6c7f52 100644 --- a/modules/contracts/src.ts/tests/channelFactory.spec.ts +++ b/modules/contracts/src.ts/tests/channelFactory.spec.ts @@ -11,8 +11,9 @@ import { AddressZero, Zero } from "@ethersproject/constants"; import { Contract } from "@ethersproject/contracts"; import { deployments, ethers } from "hardhat"; import pino from "pino"; +import { ChannelFactory, ChannelMastercopy } from "../../typechain"; -import { ChannelMastercopy } from "../artifacts"; +import { ChannelMastercopy as ChannelMastercopyArtifact } from "../artifacts"; import { alice, bob, chainIdReq, provider } from "../constants"; import { VectorChainReader } from "../services"; import { createChannel, getContract } from "../utils"; @@ -23,8 +24,8 @@ describe("ChannelFactory", function () { const bobPubId = getPublicIdentifierFromPublicKey(bob.publicKey); let chainId: number; let chainReader: VectorChainReader; - let channelFactory: Contract; - let channelMastercopy: Contract; + let channelFactory: ChannelFactory; + let channelMastercopy: ChannelMastercopy; beforeEach(async () => { await deployments.fixture(); // Start w fresh deployments @@ -67,13 +68,11 @@ describe("ChannelFactory", function () { it("should create a channel with a deposit", async () => { // Use funded account for alice const value = BigNumber.from("1000"); - await (await (channelFactory.connect(alice).createChannelAndDepositAlice( - alice.address, - bob.address, - AddressZero, - value, - { value }, - ))).wait(); + await ( + await channelFactory + .connect(alice) + .createChannelAndDepositAlice(alice.address, bob.address, AddressZero, value, { value }) + ).wait(); const channelAddress = await channelFactory.getChannelAddress(alice.address, bob.address); const computedAddr = await getCreate2MultisigAddress( alicePubId, @@ -91,20 +90,23 @@ describe("ChannelFactory", function () { const code = await provider.getCode(channelAddress); expect(code).to.not.be.eq("0x"); - const totalDepositsAlice = await new Contract(channelAddress, ChannelMastercopy.abi, alice).getTotalDepositsAlice( - AddressZero, - ); + const channel = ((new Contract( + channelAddress, + ChannelMastercopyArtifact.abi, + ) as unknown) as ChannelMastercopy).connect(alice); + + const totalDepositsAlice = await channel.getTotalDepositsAlice(AddressZero); expect(totalDepositsAlice).to.be.eq(value); }); it("should create a different channel with a different mastercopy address", async () => { const channel = await createChannel(alice.address, bob.address); - const newChannelMastercopy = await (await ( - await ethers.getContractFactory("ChannelMastercopy", alice) - ).deploy()).deployed(); - const newChannelFactory = await (await ( - await ethers.getContractFactory("ChannelFactory", alice) - ).deploy(newChannelMastercopy.address, Zero)).deployed(); + const newChannelMastercopy = await ( + await (await ethers.getContractFactory("ChannelMastercopy", alice as any)).deploy() + ).deployed(); + const newChannelFactory = await ( + await (await ethers.getContractFactory("ChannelFactory", alice as any)).deploy(newChannelMastercopy.address, Zero) + ).deployed(); const newChannelAddress = await newChannelFactory.getChannelAddress(alice.address, bob.address); await (await newChannelFactory.createChannel(alice.address, bob.address)).wait(); expect(channel.address).to.not.eq(newChannelAddress); diff --git a/modules/contracts/src.ts/tests/channelMastercopy.spec.ts b/modules/contracts/src.ts/tests/channelMastercopy.spec.ts index d8ff97954..661248f25 100644 --- a/modules/contracts/src.ts/tests/channelMastercopy.spec.ts +++ b/modules/contracts/src.ts/tests/channelMastercopy.spec.ts @@ -1,14 +1,14 @@ import { expect } from "@connext/vector-utils"; import { AddressZero, HashZero, Zero } from "@ethersproject/constants"; -import { Contract } from "@ethersproject/contracts"; import { deployments } from "hardhat"; +import { ChannelMastercopy } from "../../typechain"; import { alice } from "../constants"; import { getContract } from "../utils"; describe("ChannelMastercopy", function () { this.timeout(120_000); - let mastercopy: Contract; + let mastercopy: ChannelMastercopy; beforeEach(async () => { await deployments.fixture(); // Start w fresh deployments @@ -66,7 +66,7 @@ describe("ChannelMastercopy", function () { { name: "disputeTransfer", args: [CoreTransferStateZero, []] }, { name: "defundTransfer", args: [CoreTransferStateZero, HashZero, HashZero, HashZero] }, ]) { - await expect(mastercopy[method.name](...method.args)).to.be.revertedWith("Mastercopy: ONLY_VIA_PROXY"); + await expect((mastercopy as any)[method.name](...method.args)).to.be.revertedWith("Mastercopy: ONLY_VIA_PROXY"); } }); diff --git a/modules/contracts/src.ts/tests/cmcs/adjudicator.spec.ts b/modules/contracts/src.ts/tests/cmcs/adjudicator.spec.ts index e991ef48f..e5df624d3 100644 --- a/modules/contracts/src.ts/tests/cmcs/adjudicator.spec.ts +++ b/modules/contracts/src.ts/tests/cmcs/adjudicator.spec.ts @@ -21,6 +21,7 @@ import { AddressZero, HashZero, Zero } from "@ethersproject/constants"; import { Contract } from "@ethersproject/contracts"; import { parseEther } from "@ethersproject/units"; import { deployments } from "hardhat"; +import { ChannelMastercopy, TestToken, TransferDefinition } from "../../../typechain"; import { bob, alice, defaultLogLevel, networkName, provider, rando } from "../../constants"; import { advanceBlocktime, createChannel, getContract } from "../../utils"; @@ -38,9 +39,9 @@ describe("CMCAdjudicator.sol", async function () { // with automining should be skipped const nonAutomining = networkName !== "hardhat"; - let channel: Contract; - let token: Contract; - let transferDefinition: Contract; + let channel: ChannelMastercopy; + let token: TestToken; + let transferDefinition: TransferDefinition; let channelState: FullChannelState; let transferState: FullTransferState; let aliceSignature: string; @@ -100,7 +101,7 @@ describe("CMCAdjudicator.sol", async function () { const disputeChannel = async (ccs: FullChannelState = channelState) => { const hash = hashChannelCommitment(ccs); const tx = await channel.disputeChannel( - ccs, + ccs as any, await aliceSigner.signMessage(hash), await bobSigner.signMessage(hash), ); @@ -122,7 +123,7 @@ describe("CMCAdjudicator.sol", async function () { // Helper to dispute transfers + bring to defund phase const disputeTransfer = async (cts: FullTransferState = transferState) => { - await (await channel.disputeTransfer(cts, getMerkleProof([cts], cts.transferId))).wait(); + await (await channel.disputeTransfer(cts as any, getMerkleProof([cts], cts.transferId))).wait(); }; // Helper to defund channels and verify transfers @@ -143,7 +144,7 @@ describe("CMCAdjudicator.sol", async function () { assetIds.map((assetId: string) => getOnchainBalance(assetId, bob.address)), ); // Defund channel - await (await channel.defundChannel(ccs, defundedAssets, indices)).wait(); + await (await channel.defundChannel(ccs as any, defundedAssets, indices)).wait(); // Withdraw all assets from channel for (let i = 0; i < assetIds.length; i++) { const assetId = assetIds[i]; @@ -241,31 +242,35 @@ describe("CMCAdjudicator.sol", async function () { describe("disputeChannel", () => { it("should fail if state.alice is incorrect", async function () { await expect( - channel.disputeChannel({ ...channelState, alice: getRandomAddress() }, aliceSignature, bobSignature), + channel.disputeChannel({ ...channelState, alice: getRandomAddress() } as any, aliceSignature, bobSignature), ).revertedWith("CMCAdjudicator: INVALID_CHANNEL"); }); it("should fail if state.bob is incorrect", async function () { await expect( - channel.disputeChannel({ ...channelState, bob: getRandomAddress() }, aliceSignature, bobSignature), + channel.disputeChannel({ ...channelState, bob: getRandomAddress() } as any, aliceSignature, bobSignature), ).revertedWith("CMCAdjudicator: INVALID_CHANNEL"); }); it("should fail if state.channelAddress is incorrect", async function () { await expect( - channel.disputeChannel({ ...channelState, channelAddress: getRandomAddress() }, aliceSignature, bobSignature), + channel.disputeChannel( + { ...channelState, channelAddress: getRandomAddress() } as any, + aliceSignature, + bobSignature, + ), ).revertedWith("CMCAdjudicator: INVALID_CHANNEL"); }); it("should fail if alices signature is invalid", async function () { await expect( - channel.disputeChannel(channelState, await aliceSigner.signMessage(getRandomBytes32()), bobSignature), + channel.disputeChannel(channelState as any, await aliceSigner.signMessage(getRandomBytes32()), bobSignature), ).revertedWith("CMCAdjudicator: INVALID_ALICE_SIG"); }); it("should fail if bobs signature is invalid", async function () { await expect( - channel.disputeChannel(channelState, aliceSignature, await bobSigner.signMessage(getRandomBytes32())), + channel.disputeChannel(channelState as any, aliceSignature, await bobSigner.signMessage(getRandomBytes32())), ).revertedWith("CMCAdjudicator: INVALID_BOB_SIG"); }); @@ -276,7 +281,7 @@ describe("CMCAdjudicator.sol", async function () { const shortTimeout = { ...channelState, timeout: "10" }; const hash = hashChannelCommitment(shortTimeout); const tx = await channel.disputeChannel( - shortTimeout, + shortTimeout as any, await aliceSigner.signMessage(hash), await bobSigner.signMessage(hash), ); @@ -290,22 +295,26 @@ describe("CMCAdjudicator.sol", async function () { const nextState = { ...shortTimeout, nonce: channelState.nonce + 1 }; const hash2 = hashChannelCommitment(nextState); await expect( - channel.disputeChannel(nextState, await aliceSigner.signMessage(hash2), await bobSigner.signMessage(hash2)), + channel.disputeChannel( + nextState as any, + await aliceSigner.signMessage(hash2), + await bobSigner.signMessage(hash2), + ), ).revertedWith("CMCAdjudicator: INVALID_PHASE"); }); it("should fail if nonce is lte stored nonce", async () => { - const tx = await channel.disputeChannel(channelState, aliceSignature, bobSignature); + const tx = await channel.disputeChannel(channelState as any, aliceSignature, bobSignature); const { blockNumber } = await tx.wait(); await verifyChannelDispute(channelState, blockNumber); - await expect(channel.disputeChannel(channelState, aliceSignature, bobSignature)).revertedWith( + await expect(channel.disputeChannel(channelState as any, aliceSignature, bobSignature)).revertedWith( "CMCAdjudicator: INVALID_NONCE", ); }); it("should work for a newly initiated dispute (and store expiries)", async () => { - const tx = await channel.disputeChannel(channelState, aliceSignature, bobSignature); + const tx = await channel.disputeChannel(channelState as any, aliceSignature, bobSignature); const { blockNumber } = await tx.wait(); // Verify dispute await verifyChannelDispute(channelState, blockNumber); @@ -315,14 +324,14 @@ describe("CMCAdjudicator.sol", async function () { if (nonAutomining) { this.skip(); } - const tx = await channel.disputeChannel(channelState, aliceSignature, bobSignature); + const tx = await channel.disputeChannel(channelState as any, aliceSignature, bobSignature); const { blockNumber } = await tx.wait(); await verifyChannelDispute(channelState, blockNumber); // Submit a new, higher nonced state const newState = { ...channelState, nonce: channelState.nonce + 1 }; const hash = hashChannelCommitment(newState); const tx2 = await channel.disputeChannel( - newState, + newState as any, await aliceSigner.signMessage(hash), await bobSigner.signMessage(hash), ); @@ -339,7 +348,7 @@ describe("CMCAdjudicator.sol", async function () { } await disputeChannel(); await expect( - channel.defundChannel({ ...channelState, alice: getRandomAddress() }, channelState.assetIds, []), + channel.defundChannel({ ...channelState, alice: getRandomAddress() } as any, channelState.assetIds, []), ).revertedWith("CMCAdjudicator: INVALID_CHANNEL"); }); @@ -349,7 +358,7 @@ describe("CMCAdjudicator.sol", async function () { } await disputeChannel(); await expect( - channel.defundChannel({ ...channelState, bob: getRandomAddress() }, channelState.assetIds, []), + channel.defundChannel({ ...channelState, bob: getRandomAddress() } as any, channelState.assetIds, []), ).revertedWith("CMCAdjudicator: INVALID_CHANNEL"); }); @@ -359,7 +368,11 @@ describe("CMCAdjudicator.sol", async function () { } await disputeChannel(); await expect( - channel.defundChannel({ ...channelState, channelAddress: getRandomAddress() }, channelState.assetIds, []), + channel.defundChannel( + { ...channelState, channelAddress: getRandomAddress() } as any, + channelState.assetIds, + [], + ), ).revertedWith("CMCAdjudicator: INVALID_CHANNEL"); }); @@ -368,19 +381,19 @@ describe("CMCAdjudicator.sol", async function () { this.skip(); } await disputeChannel(); - await expect(channel.defundChannel({ ...channelState, nonce: 652 }, channelState.assetIds, [])).revertedWith( - "CMCAdjudicator: INVALID_CHANNEL_HASH", - ); + await expect( + channel.defundChannel({ ...channelState, nonce: 652 } as any, channelState.assetIds, []), + ).revertedWith("CMCAdjudicator: INVALID_CHANNEL_HASH"); }); it("should fail if it is not in the defund phase", async function () { if (nonAutomining) { this.skip(); } - const tx = await channel.disputeChannel(channelState, aliceSignature, bobSignature); + const tx = await channel.disputeChannel(channelState as any, aliceSignature, bobSignature); const { blockNumber } = await tx.wait(); await verifyChannelDispute(channelState, blockNumber); - await expect(channel.defundChannel(channelState, channelState.assetIds, [])).revertedWith( + await expect(channel.defundChannel(channelState as any, channelState.assetIds, [])).revertedWith( "CMCAdjudicator: INVALID_PHASE", ); }); @@ -391,7 +404,7 @@ describe("CMCAdjudicator.sol", async function () { } const toDispute = { ...channelState, defundNonces: channelState.assetIds.map(() => "0") }; await disputeChannel(toDispute); - await expect(channel.defundChannel(toDispute, toDispute.assetIds, [])).revertedWith( + await expect(channel.defundChannel(toDispute as any, toDispute.assetIds, [])).revertedWith( "CMCAdjudicator: CHANNEL_ALREADY_DEFUNDED", ); }); @@ -445,7 +458,7 @@ describe("CMCAdjudicator.sol", async function () { // Deposit all funds into channel await fundChannel(multiAsset); await disputeChannel(multiAsset); - await expect(channel.defundChannel(multiAsset, [AddressZero], [BigNumber.from(1)])).revertedWith( + await expect(channel.defundChannel(multiAsset as any, [AddressZero], [BigNumber.from(1)])).revertedWith( "CMCAdjudicator: INDEX_MISMATCH", ); }); @@ -536,7 +549,7 @@ describe("CMCAdjudicator.sol", async function () { } await disputeChannel(); await expect( - channel.disputeTransfer({ ...transferState, channelAddress: getRandomAddress() }, getMerkleProof()), + channel.disputeTransfer({ ...transferState, channelAddress: getRandomAddress() } as any, getMerkleProof()), ).revertedWith("CMCAdjudicator: INVALID_TRANSFER"); }); @@ -546,7 +559,7 @@ describe("CMCAdjudicator.sol", async function () { } await disputeChannel(); await expect( - channel.disputeTransfer({ ...transferState, transferId: getRandomBytes32() }, getMerkleProof()), + channel.disputeTransfer({ ...transferState, transferId: getRandomBytes32() } as any, getMerkleProof()), ).revertedWith("CMCAdjudicator: INVALID_MERKLE_PROOF"); }); @@ -556,9 +569,9 @@ describe("CMCAdjudicator.sol", async function () { } // Don't use helper here because will automatically bring into // the defund phase - const tx = await channel.disputeChannel(channelState, aliceSignature, bobSignature); + const tx = await channel.disputeChannel(channelState as any, aliceSignature, bobSignature); await tx.wait(); - await expect(channel.disputeTransfer(transferState, getMerkleProof())).revertedWith( + await expect(channel.disputeTransfer(transferState as any, getMerkleProof())).revertedWith( "CMCAdjudicator: INVALID_PHASE", ); }); @@ -569,9 +582,9 @@ describe("CMCAdjudicator.sol", async function () { } const longerTimeout = { ...channelState, timeout: "4" }; await disputeChannel(longerTimeout); - const tx = await channel.disputeTransfer(transferState, getMerkleProof()); + const tx = await channel.disputeTransfer(transferState as any, getMerkleProof()); await tx.wait(); - await expect(channel.disputeTransfer(transferState, getMerkleProof())).revertedWith( + await expect(channel.disputeTransfer(transferState as any, getMerkleProof())).revertedWith( "CMCAdjudicator: TRANSFER_ALREADY_DISPUTED", ); }); @@ -581,7 +594,7 @@ describe("CMCAdjudicator.sol", async function () { this.skip(); } await disputeChannel(); - const tx = await channel.disputeTransfer(transferState, getMerkleProof()); + const tx = await channel.disputeTransfer(transferState as any, getMerkleProof()); const { blockNumber } = await tx.wait(); await verifyTransferDispute(transferState, blockNumber); }); @@ -604,7 +617,7 @@ describe("CMCAdjudicator.sol", async function () { const txs = []; for (const t of transfers) { - const tx = await channel.disputeTransfer(t, tree.getHexProof(hashCoreTransferState(t))); + const tx = await channel.disputeTransfer(t as any, tree.getHexProof(hashCoreTransferState(t))); txs.push(tx); } const receipts = await Promise.all(txs.map((tx) => tx.wait())); @@ -629,7 +642,7 @@ describe("CMCAdjudicator.sol", async function () { await prepTransferForDefund(); await expect( channel.defundTransfer( - { ...transferState, channelAddress: getRandomAddress() }, + { ...transferState, channelAddress: getRandomAddress() } as any, encodeTransferState(transferState.transferState, transferState.transferEncodings[0]), encodeTransferResolver(transferState.transferResolver!, transferState.transferEncodings[1]), HashZero, @@ -645,7 +658,7 @@ describe("CMCAdjudicator.sol", async function () { await disputeChannel(); await expect( channel.defundTransfer( - transferState, + transferState as any, encodeTransferState(transferState.transferState, transferState.transferEncodings[0]), encodeTransferResolver(transferState.transferResolver!, transferState.transferEncodings[1]), HashZero, @@ -660,7 +673,7 @@ describe("CMCAdjudicator.sol", async function () { await prepTransferForDefund(); await expect( channel.defundTransfer( - { ...transferState, initialStateHash: getRandomBytes32() }, + { ...transferState, initialStateHash: getRandomBytes32() } as any, encodeTransferState(transferState.transferState, transferState.transferEncodings[0]), encodeTransferResolver(transferState.transferResolver!, transferState.transferEncodings[1]), HashZero, @@ -676,7 +689,7 @@ describe("CMCAdjudicator.sol", async function () { const tx = await channel .connect(bob) .defundTransfer( - transferState, + transferState as any, encodeTransferState(transferState.transferState, transferState.transferEncodings[0]), encodeTransferResolver(transferState.transferResolver!, transferState.transferEncodings[1]), HashZero, @@ -686,7 +699,7 @@ describe("CMCAdjudicator.sol", async function () { channel .connect(bob) .defundTransfer( - transferState, + transferState as any, encodeTransferState(transferState.transferState, transferState.transferEncodings[0]), encodeTransferResolver(transferState.transferResolver!, transferState.transferEncodings[1]), HashZero, @@ -703,7 +716,7 @@ describe("CMCAdjudicator.sol", async function () { channel .connect(rando) .defundTransfer( - transferState, + transferState as any, encodeTransferState(transferState.transferState, transferState.transferEncodings[0]), encodeTransferResolver(transferState.transferResolver!, transferState.transferEncodings[1]), await bob.signMessage(getRandomBytes32()), @@ -720,7 +733,7 @@ describe("CMCAdjudicator.sol", async function () { channel .connect(bob) .defundTransfer( - transferState, + transferState as any, encodeTransferState( { ...transferState.transferState, lockHash: getRandomBytes32() }, transferState.transferEncodings[0], @@ -744,7 +757,7 @@ describe("CMCAdjudicator.sol", async function () { await channel .connect(bob) .defundTransfer( - transferState, + transferState as any, encodeTransferState(transferState.transferState, transferState.transferEncodings[0]), encodeTransferResolver({ preImage: HashZero }, transferState.transferEncodings[1]), HashZero, @@ -767,7 +780,7 @@ describe("CMCAdjudicator.sol", async function () { await channel .connect(bob) .defundTransfer( - transferState, + transferState as any, encodeTransferState(transferState.transferState, transferState.transferEncodings[0]), encodeTransferResolver(transferState.transferResolver, transferState.transferEncodings[1]), HashZero, @@ -792,7 +805,7 @@ describe("CMCAdjudicator.sol", async function () { await channel .connect(rando) .defundTransfer( - transferState, + transferState as any, encodeTransferState(transferState.transferState, transferState.transferEncodings[0]), encodeTransferResolver(transferState.transferResolver, transferState.transferEncodings[1]), await signChannelMessage(transferState.initialStateHash, bob.privateKey), @@ -819,7 +832,7 @@ describe("CMCAdjudicator.sol", async function () { await channel .connect(bob) .defundTransfer( - transferState, + transferState as any, encodeTransferState(transferState.transferState, transferState.transferEncodings[0]), encodeTransferResolver(transferState.transferResolver, transferState.transferEncodings[1]), HashZero, diff --git a/modules/contracts/src.ts/tests/cmcs/asset.spec.ts b/modules/contracts/src.ts/tests/cmcs/asset.spec.ts index ddf0c94a3..b7a17646f 100644 --- a/modules/contracts/src.ts/tests/cmcs/asset.spec.ts +++ b/modules/contracts/src.ts/tests/cmcs/asset.spec.ts @@ -2,26 +2,26 @@ import { Balance } from "@connext/vector-types"; import { BigNumber } from "@ethersproject/bignumber"; import { AddressZero, Zero } from "@ethersproject/constants"; -import { Contract } from "@ethersproject/contracts"; import { parseEther } from "@ethersproject/units"; import { expect } from "chai"; import { deployments } from "hardhat"; +import { CMCAsset, FailingToken, NonconformingToken, TestChannel, TestToken } from "../../../typechain"; import { alice, bob, rando } from "../../constants"; import { getContract, createChannel } from "../../utils"; describe("CMCAsset", function () { this.timeout(120_000); - let assetTransfer: Contract; - let channel: Contract; - let token: Contract; - let failingToken: Contract; - let nonconformingToken: Contract; + let assetTransfer: CMCAsset; + let channel: TestChannel; + let token: TestToken; + let failingToken: FailingToken; + let nonconformingToken: NonconformingToken; beforeEach(async () => { await deployments.fixture(); // Start w fresh deployments assetTransfer = await getContract("CMCAsset", alice); - channel = await createChannel(); + channel = (await createChannel()) as TestChannel; // Fund with all tokens token = await getContract("TestToken", alice); @@ -113,7 +113,7 @@ describe("CMCAsset", function () { }; const preTransferBob = await bob.getBalance(); const preTransferRando = await rando.getBalance(); - await channel.testMakeBalanceExitable(AddressZero, balance); + await channel.testMakeBalanceExitable(AddressZero, balance as any); expect(await bob.getBalance()).to.be.eq(preTransferBob); expect(await rando.getBalance()).to.be.eq(preTransferRando); expect(await channel.getTotalTransferred(AddressZero)).to.be.eq(Zero); diff --git a/modules/contracts/src.ts/tests/cmcs/core.spec.ts b/modules/contracts/src.ts/tests/cmcs/core.spec.ts index c90b44a5a..3c6b48893 100644 --- a/modules/contracts/src.ts/tests/cmcs/core.spec.ts +++ b/modules/contracts/src.ts/tests/cmcs/core.spec.ts @@ -3,6 +3,7 @@ import { AddressZero } from "@ethersproject/constants"; import { Contract } from "@ethersproject/contracts"; import { expect } from "chai"; import { deployments, ethers } from "hardhat"; +import { ChannelMastercopy } from "../../../typechain"; import { alice, bob } from "../../constants"; import { createChannel } from "../../utils"; @@ -10,9 +11,9 @@ import { createChannel } from "../../utils"; // NOTE: This will use a channel deployed by the `TestChannelFactory` that // has not been setup on deploy. Otherwise, the -describe("CMCCore.sol", function() { +describe("CMCCore.sol", function () { this.timeout(120_000); - let channel: Contract; + let channel: ChannelMastercopy; beforeEach(async () => { await deployments.fixture(); // Start w fresh deployments @@ -23,11 +24,10 @@ describe("CMCCore.sol", function() { const testFactory = await (ethers as any).getContract("TestChannelFactory", alice); const channelAddress = await testFactory.getChannelAddress(alice.address, bob.address); await (await testFactory.createChannelWithoutSetup(alice.address, bob.address)).wait(); - channel = new Contract( + channel = ((new Contract( channelAddress, (await deployments.getArtifact("TestChannel")).abi, - alice, - ); + ) as unknown) as ChannelMastercopy).connect(alice); }); it("should work", async () => { @@ -41,27 +41,19 @@ describe("CMCCore.sol", function() { it("should fail if it has already been setup", async () => { const setupTx = await channel.setup(alice.address, bob.address); await setupTx.wait(); - await expect( - channel.setup(alice.address, bob.address), - ).revertedWith("CMCCore: ALREADY_SETUP"); + await expect(channel.setup(alice.address, bob.address)).revertedWith("CMCCore: ALREADY_SETUP"); }); it("should fail to setup if alice is not supplied", async () => { - await expect(channel.setup(AddressZero, bob.address)).revertedWith( - "CMCCore: INVALID_PARTICIPANT", - ); + await expect(channel.setup(AddressZero, bob.address)).revertedWith("CMCCore: INVALID_PARTICIPANT"); }); it("should fail to setup if bob is not supplied", async () => { - await expect(channel.setup(AddressZero, bob.address)).revertedWith( - "CMCCore: INVALID_PARTICIPANT", - ); + await expect(channel.setup(AddressZero, bob.address)).revertedWith("CMCCore: INVALID_PARTICIPANT"); }); it("should fail if alice == bob", async () => { - await expect(channel.setup(alice.address, alice.address)).revertedWith( - "CMCCore: IDENTICAL_PARTICIPANTS", - ); + await expect(channel.setup(alice.address, alice.address)).revertedWith("CMCCore: IDENTICAL_PARTICIPANTS"); }); }); diff --git a/modules/contracts/src.ts/tests/cmcs/deposit.spec.ts b/modules/contracts/src.ts/tests/cmcs/deposit.spec.ts index e1742ad33..49fce6920 100644 --- a/modules/contracts/src.ts/tests/cmcs/deposit.spec.ts +++ b/modules/contracts/src.ts/tests/cmcs/deposit.spec.ts @@ -2,9 +2,9 @@ import { expect } from "@connext/vector-utils"; import { BigNumber } from "@ethersproject/bignumber"; import { AddressZero, One } from "@ethersproject/constants"; -import { Contract } from "@ethersproject/contracts"; import { parseEther } from "@ethersproject/units"; import { deployments } from "hardhat"; +import { ChannelMastercopy, FailingToken, ReentrantToken } from "../../../typechain"; import { alice, bob } from "../../constants"; import { getContract, createChannel } from "../../utils"; @@ -12,9 +12,9 @@ import { getContract, createChannel } from "../../utils"; describe("CMCDeposit.sol", function () { this.timeout(120_000); const value = One; - let channel: Contract; - let failingToken: Contract; - let reentrantToken: Contract; + let channel: ChannelMastercopy; + let failingToken: FailingToken; + let reentrantToken: ReentrantToken; beforeEach(async () => { await deployments.fixture(); // Start w fresh deployments diff --git a/modules/contracts/src.ts/tests/cmcs/withdraw.spec.ts b/modules/contracts/src.ts/tests/cmcs/withdraw.spec.ts index bcbb96a07..15f99920d 100644 --- a/modules/contracts/src.ts/tests/cmcs/withdraw.spec.ts +++ b/modules/contracts/src.ts/tests/cmcs/withdraw.spec.ts @@ -2,7 +2,6 @@ import { ChannelSigner, expect, getRandomAddress, getRandomBytes32 } from "@connext/vector-utils"; import { BigNumber } from "@ethersproject/bignumber"; import { AddressZero } from "@ethersproject/constants"; -import { Contract } from "@ethersproject/contracts"; import { parseEther } from "@ethersproject/units"; import { Wallet } from "@ethersproject/wallet"; import { deployments } from "hardhat"; @@ -10,17 +9,18 @@ import { deployments } from "hardhat"; import { alice, bob, provider } from "../../constants"; import { WithdrawCommitment } from "../../commitments"; import { getContract, createChannel } from "../../utils"; +import { ChannelMastercopy, FailingToken } from "../../../typechain"; -describe("CMCWithdraw.sol", function() { +describe("CMCWithdraw.sol", function () { this.timeout(120_000); const recipient = Wallet.createRandom().address; - let channel: Contract; - let failingToken: Contract; + let channel: ChannelMastercopy; + let failingToken: FailingToken; beforeEach(async () => { await deployments.fixture(); // Start w fresh deployments - channel = await createChannel(); + channel = (await createChannel()) as ChannelMastercopy; failingToken = await getContract("FailingToken", alice); await failingToken.mint(alice.address, parseEther("0.001")); @@ -60,15 +60,15 @@ describe("CMCWithdraw.sol", function() { const bobSig = await new ChannelSigner(bob.privateKey).signMessage(commitment.hashToSign()); const withdrawData = commitment.getWithdrawData(); - expect(await channel.getWithdrawalTransactionRecord(withdrawData)).to.be.false; + expect(await channel.getWithdrawalTransactionRecord(withdrawData as any)).to.be.false; - const tx = await channel.withdraw(withdrawData, aliceSig, bobSig); + const tx = await channel.withdraw(withdrawData as any, aliceSig, bobSig); await tx.wait(); expect(await provider.getBalance(recipient)).to.be.eq(preWithdrawRecipient.add(withdrawAmount)); expect(await provider.getBalance(channel.address)).to.be.eq(preWithdrawChannel.sub(withdrawAmount)); expect(await channel.getTotalTransferred(AddressZero)).to.be.eq(withdrawAmount); - expect(await channel.getWithdrawalTransactionRecord(withdrawData)).to.be.true; + expect(await channel.getWithdrawalTransactionRecord(withdrawData as any)).to.be.true; }); it("should work for standard-compliant tokens", async () => { @@ -90,15 +90,15 @@ describe("CMCWithdraw.sol", function() { const bobSig = await new ChannelSigner(bob.privateKey).signMessage(commitment.hashToSign()); const withdrawData = commitment.getWithdrawData(); - expect(await channel.getWithdrawalTransactionRecord(withdrawData)).to.be.false; + expect(await channel.getWithdrawalTransactionRecord(withdrawData as any)).to.be.false; - const tx = await channel.withdraw(withdrawData, aliceSig, bobSig); + const tx = await channel.withdraw(withdrawData as any, aliceSig, bobSig); await tx.wait(); expect(await failingToken.balanceOf(recipient)).to.be.eq(preWithdrawRecipient.add(withdrawAmount)); expect(await failingToken.balanceOf(channel.address)).to.be.eq(preWithdrawChannel.sub(withdrawAmount)); expect(await channel.getTotalTransferred(failingToken.address)).to.be.eq(withdrawAmount); - expect(await channel.getWithdrawalTransactionRecord(withdrawData)).to.be.true; + expect(await channel.getWithdrawalTransactionRecord(withdrawData as any)).to.be.true; }); it("should work for missing-return-value-bug tokens", async () => { @@ -127,15 +127,15 @@ describe("CMCWithdraw.sol", function() { const bobSig = await new ChannelSigner(bob.privateKey).signMessage(commitment.hashToSign()); const withdrawData = commitment.getWithdrawData(); - expect(await channel.getWithdrawalTransactionRecord(withdrawData)).to.be.false; + expect(await channel.getWithdrawalTransactionRecord(withdrawData as any)).to.be.false; - const tx = await channel.withdraw(withdrawData, aliceSig, bobSig); + const tx = await channel.withdraw(withdrawData as any, aliceSig, bobSig); await tx.wait(); expect(await nonconformingToken.balanceOf(recipient)).to.be.eq(preWithdrawRecipient.add(withdrawAmount)); expect(await nonconformingToken.balanceOf(channel.address)).to.be.eq(preWithdrawChannel.sub(withdrawAmount)); expect(await channel.getTotalTransferred(nonconformingToken.address)).to.be.eq(withdrawAmount); - expect(await channel.getWithdrawalTransactionRecord(withdrawData)).to.be.true; + expect(await channel.getWithdrawalTransactionRecord(withdrawData as any)).to.be.true; }); it("should fail for wrong channel address", async () => { @@ -155,7 +155,7 @@ describe("CMCWithdraw.sol", function() { const bobSig = await new ChannelSigner(bob.privateKey).signMessage(commitment.hashToSign()); const withdrawData = commitment.getWithdrawData(); - await expect(channel.withdraw(withdrawData, aliceSig, bobSig)).revertedWith("CMCWithdraw: CHANNEL_MISMATCH"); + await expect(channel.withdraw(withdrawData as any, aliceSig, bobSig)).revertedWith("CMCWithdraw: CHANNEL_MISMATCH"); }); it("should fail if it is a no-op (callTo == address(0) && amount == 0)", async () => { @@ -175,7 +175,7 @@ describe("CMCWithdraw.sol", function() { const bobSig = await new ChannelSigner(bob.privateKey).signMessage(commitment.hashToSign()); const withdrawData = commitment.getWithdrawData(); - await expect(channel.withdraw(withdrawData, aliceSig, bobSig)).revertedWith("CMCWithdraw: NO_OP"); + await expect(channel.withdraw(withdrawData as any, aliceSig, bobSig)).revertedWith("CMCWithdraw: NO_OP"); }); it("should fail if alice signature is invalid", async () => { @@ -195,7 +195,9 @@ describe("CMCWithdraw.sol", function() { const bobSig = await new ChannelSigner(bob.privateKey).signMessage(commitment.hashToSign()); const withdrawData = commitment.getWithdrawData(); - await expect(channel.withdraw(withdrawData, aliceSig, bobSig)).revertedWith("CMCWithdraw: INVALID_ALICE_SIG"); + await expect(channel.withdraw(withdrawData as any, aliceSig, bobSig)).revertedWith( + "CMCWithdraw: INVALID_ALICE_SIG", + ); }); it("should fail if bob signature is invalid", async () => { @@ -215,7 +217,7 @@ describe("CMCWithdraw.sol", function() { const bobSig = await new ChannelSigner(bob.privateKey).signMessage(getRandomBytes32()); const withdrawData = commitment.getWithdrawData(); - await expect(channel.withdraw(withdrawData, aliceSig, bobSig)).revertedWith("CMCWithdraw: INVALID_BOB_SIG"); + await expect(channel.withdraw(withdrawData as any, aliceSig, bobSig)).revertedWith("CMCWithdraw: INVALID_BOB_SIG"); }); it("should fail if the tx has already been executed", async () => { @@ -235,8 +237,8 @@ describe("CMCWithdraw.sol", function() { const bobSig = await new ChannelSigner(bob.privateKey).signMessage(commitment.hashToSign()); const withdrawData = commitment.getWithdrawData(); - await channel.withdraw(withdrawData, aliceSig, bobSig); - await expect(channel.withdraw(withdrawData, aliceSig, bobSig)).revertedWith("CMCWithdraw: ALREADY_EXECUTED"); + await channel.withdraw(withdrawData as any, aliceSig, bobSig); + await expect(channel.withdraw(withdrawData as any, aliceSig, bobSig)).revertedWith("CMCWithdraw: ALREADY_EXECUTED"); }); it("should fail if Ether transfer reverts", async () => { @@ -262,7 +264,7 @@ describe("CMCWithdraw.sol", function() { const bobSig = await new ChannelSigner(bob.privateKey).signMessage(commitment.hashToSign()); const withdrawData = commitment.getWithdrawData(); - await expect(channel.withdraw(withdrawData, aliceSig, bobSig)).revertedWith("ERC20: ETHER_REJECTED"); + await expect(channel.withdraw(withdrawData as any, aliceSig, bobSig)).revertedWith("ERC20: ETHER_REJECTED"); }); it("should fail if token transfer fails", async () => { @@ -286,7 +288,7 @@ describe("CMCWithdraw.sol", function() { const bobSig = await new ChannelSigner(bob.privateKey).signMessage(commitment.hashToSign()); const withdrawData = commitment.getWithdrawData(); - await expect(channel.withdraw(withdrawData, aliceSig, bobSig)).revertedWith("CMCAsset: TRANSFER_FAILED"); + await expect(channel.withdraw(withdrawData as any, aliceSig, bobSig)).revertedWith("CMCAsset: TRANSFER_FAILED"); }); it("should fail if token transfer reverts", async () => { @@ -310,7 +312,7 @@ describe("CMCWithdraw.sol", function() { const bobSig = await new ChannelSigner(bob.privateKey).signMessage(commitment.hashToSign()); const withdrawData = commitment.getWithdrawData(); - await expect(channel.withdraw(withdrawData, aliceSig, bobSig)).revertedWith("FAIL: Failing token"); + await expect(channel.withdraw(withdrawData as any, aliceSig, bobSig)).revertedWith("FAIL: Failing token"); }); it.skip("should call helper contract if given non-zero address", async () => {}); diff --git a/modules/contracts/src.ts/tests/integration/ethReader.spec.ts b/modules/contracts/src.ts/tests/integration/ethReader.spec.ts index 118a0f4ae..fe19bbe11 100644 --- a/modules/contracts/src.ts/tests/integration/ethReader.spec.ts +++ b/modules/contracts/src.ts/tests/integration/ethReader.spec.ts @@ -1,14 +1,13 @@ import { TransferNames, RegisteredTransfer } from "@connext/vector-types"; -import { expect } from "@connext/vector-utils"; -import { AddressZero, Zero } from "@ethersproject/constants"; -import { Contract } from "@ethersproject/contracts"; +import { expect, getTestLoggers } from "@connext/vector-utils"; +import { AddressZero } from "@ethersproject/constants"; import { deployments } from "hardhat"; -import pino from "pino"; -import { alice, bob, chainIdReq, provider } from "../../constants"; +import { alice, bob, chainIdReq, logger, provider } from "../../constants"; import { getContract, createChannel } from "../../utils"; import { EthereumChainReader } from "../../services/ethReader"; +import { ChannelFactory, ChannelMastercopy, TransferRegistry } from "../../../typechain"; // TODO: check whether result is valid, not just whether it exists #432 describe("EthereumChainReader", function () { @@ -17,9 +16,9 @@ describe("EthereumChainReader", function () { const transfer = {} as any; // TODO let chainId: number; let chainReader: EthereumChainReader; - let channel: Contract; - let factory: Contract; - let transferRegistry: Contract; + let channel: ChannelMastercopy; + let factory: ChannelFactory; + let transferRegistry: TransferRegistry; before(async () => { await deployments.fixture(); // Start w fresh deployments @@ -29,7 +28,7 @@ describe("EthereumChainReader", function () { channel = (await createChannel()).connect(alice); chainId = await chainIdReq; - chainReader = new EthereumChainReader({ [chainId]: provider }, pino()); + chainReader = new EthereumChainReader({ [chainId]: provider }, logger); }); it("getTotalDepositedA", async () => { diff --git a/modules/contracts/src.ts/tests/integration/ethService.spec.ts b/modules/contracts/src.ts/tests/integration/ethService.spec.ts index edf9eb6fd..e058d14e1 100644 --- a/modules/contracts/src.ts/tests/integration/ethService.spec.ts +++ b/modules/contracts/src.ts/tests/integration/ethService.spec.ts @@ -13,7 +13,6 @@ import { generateMerkleTreeData, } from "@connext/vector-utils"; import { AddressZero } from "@ethersproject/constants"; -import { Contract } from "@ethersproject/contracts"; import { parseEther } from "@ethersproject/units"; import { BigNumber } from "@ethersproject/bignumber"; import { deployments } from "hardhat"; @@ -22,18 +21,19 @@ import { alice, bob, chainIdReq, logger, provider, rando } from "../../constants import { advanceBlocktime, getContract, createChannel } from "../../utils"; import { EthereumChainService } from "../../services/ethService"; +import { ChannelFactory, ChannelMastercopy, TestToken, TransferDefinition } from "../../../typechain"; describe("ethService integration", function () { this.timeout(120_000); const aliceSigner = new ChannelSigner(alice.privateKey); const bobSigner = new ChannelSigner(bob.privateKey); - let channel: Contract; - let channelFactory: Contract; - let transferDefinition: Contract; + let channel: ChannelMastercopy; + let channelFactory: ChannelFactory; + let transferDefinition: TransferDefinition; let chainService: EthereumChainService; let channelState: FullChannelState; let transferState: FullTransferState; - let token: Contract; + let token: TestToken; let chainId: number; beforeEach(async () => { diff --git a/modules/contracts/src.ts/tests/lib/iterableMapping.spec.ts b/modules/contracts/src.ts/tests/lib/iterableMapping.spec.ts index 42057df0b..93fd3ea24 100644 --- a/modules/contracts/src.ts/tests/lib/iterableMapping.spec.ts +++ b/modules/contracts/src.ts/tests/lib/iterableMapping.spec.ts @@ -1,17 +1,17 @@ /* eslint-disable @typescript-eslint/no-empty-function */ import { RegisteredTransfer } from "@connext/vector-types"; import { BigNumber } from "@ethersproject/bignumber"; -import { Contract } from "@ethersproject/contracts"; import { expect } from "chai"; import { deployments } from "hardhat"; +import { TestLibIterableMapping, TransferDefinition } from "../../../typechain"; import { alice } from "../../constants"; import { getContract } from "../../utils"; describe("LibIterableMapping.sol", function () { this.timeout(120_000); - let mapping: Contract; - let transferDefs: Contract[]; + let mapping: TestLibIterableMapping; + let transferDefs: TransferDefinition[]; // Helper function to load data into registry const loadMapping = async () => { diff --git a/modules/contracts/src.ts/tests/transferDefinitions/hashlockTransfer.spec.ts b/modules/contracts/src.ts/tests/transferDefinitions/hashlockTransfer.spec.ts index 9d3053a37..269765ee5 100644 --- a/modules/contracts/src.ts/tests/transferDefinitions/hashlockTransfer.spec.ts +++ b/modules/contracts/src.ts/tests/transferDefinitions/hashlockTransfer.spec.ts @@ -17,16 +17,16 @@ import { } from "@connext/vector-utils"; import { BigNumber } from "@ethersproject/bignumber"; import { HashZero, Zero } from "@ethersproject/constants"; -import { Contract } from "@ethersproject/contracts"; import { sha256 as soliditySha256 } from "@ethersproject/solidity"; import { deployments } from "hardhat"; +import { HashlockTransfer } from "../../../typechain"; import { alice, provider } from "../../constants"; import { getContract } from "../../utils"; describe("HashlockTransfer", function () { this.timeout(120_000); - let transfer: Contract; + let transfer: HashlockTransfer; beforeEach(async () => { await deployments.fixture(); // Start w fresh deployments @@ -53,7 +53,7 @@ describe("HashlockTransfer", function () { const createTransfer = async (balance: Balance, initialState: HashlockTransferState): Promise => { const encodedState = encodeTransferState(initialState, HashlockTransferStateEncoding); const encodedBalance = encodeBalance(balance); - return transfer.functions.create(encodedBalance, encodedState); + return transfer.create(encodedBalance, encodedState); }; const resolveTransfer = async ( @@ -110,7 +110,7 @@ describe("HashlockTransfer", function () { const preImage = getRandomBytes32(); const { state, balance } = await createInitialState(preImage); const res = await createTransfer(balance, state); - expect((res as any)[0]).to.be.true; + expect(res).to.be.true; }); it("should fail create if sender balance is zero", async () => { @@ -146,7 +146,7 @@ describe("HashlockTransfer", function () { const { state, balance } = await createInitialState(preImage); state.expiry = (Date.now() + 30).toString(); const res = await createTransfer(balance, state); - expect((res as any)[0]).to.be.true; + expect(res).to.be.true; }); }); diff --git a/modules/contracts/src.ts/tests/transferDefinitions/withdraw.spec.ts b/modules/contracts/src.ts/tests/transferDefinitions/withdraw.spec.ts index 84dece8ed..346063cb9 100644 --- a/modules/contracts/src.ts/tests/transferDefinitions/withdraw.spec.ts +++ b/modules/contracts/src.ts/tests/transferDefinitions/withdraw.spec.ts @@ -19,15 +19,15 @@ import { } from "@connext/vector-utils"; import { BigNumber } from "@ethersproject/bignumber"; import { AddressZero, HashZero, Zero } from "@ethersproject/constants"; -import { Contract } from "@ethersproject/contracts"; import { deployments } from "hardhat"; +import { Withdraw } from "../../../typechain"; import { alice, bob } from "../../constants"; import { getContract } from "../../utils"; describe("Withdraw", function () { this.timeout(120_000); - let withdraw: Contract; + let withdraw: Withdraw; before(async () => { await deployments.fixture(); // Start w fresh deployments diff --git a/modules/contracts/src.ts/tests/transferRegistry.spec.ts b/modules/contracts/src.ts/tests/transferRegistry.spec.ts index 12613b55d..f114fbad9 100644 --- a/modules/contracts/src.ts/tests/transferRegistry.spec.ts +++ b/modules/contracts/src.ts/tests/transferRegistry.spec.ts @@ -7,10 +7,12 @@ import { deployments } from "hardhat"; import { alice, rando } from "../constants"; import { getContract } from "../utils"; +import { TransferRegistry, TransferDefinition } from "../../typechain"; + describe("TransferRegistry.sol", function () { this.timeout(120_000); - let transfer: Contract; - let registry: Contract; + let transfer: TransferDefinition; + let registry: TransferRegistry; let registryInfo: RegisteredTransfer; beforeEach(async () => { diff --git a/modules/contracts/src.ts/utils.ts b/modules/contracts/src.ts/utils.ts index 3793c49e8..9a4e81306 100644 --- a/modules/contracts/src.ts/utils.ts +++ b/modules/contracts/src.ts/utils.ts @@ -1,5 +1,5 @@ -import { Contract } from "@ethersproject/contracts"; import { ethers, run } from "hardhat"; +import { ChannelMastercopy, TransferDefinition } from "../typechain"; import { alice, bob, defaultLogLevel, provider } from "./constants"; @@ -12,16 +12,14 @@ export const registerTransfer = ( transferName: string, signerAddress: string = alice.address, logLevel = defaultLogLevel, -): Promise => - run("register-transfer", { transferName, signerAddress, logLevel }); +): Promise => run("register-transfer", { transferName, signerAddress, logLevel }); export const createChannel = ( aliceAddress: string = alice.address, bobAddress: string = bob.address, logLevel = defaultLogLevel, testMode = "yarp", -): Promise => - run("create-channel", { aliceAddress, bobAddress, logLevel, testMode }); +): Promise => run("create-channel", { aliceAddress, bobAddress, logLevel, testMode }); //////////////////////////////////////// // Other Utils diff --git a/modules/contracts/tsconfig.json b/modules/contracts/tsconfig.json index 87782a118..43a4b35db 100644 --- a/modules/contracts/tsconfig.json +++ b/modules/contracts/tsconfig.json @@ -25,6 +25,6 @@ "target": "es2017", "typeRoots": ["../../node_modules/@types"] }, - "exclude": ["dist", "node_modules"], + "exclude": ["dist", "node_modules", "typechain"], "include": ["hardhat.config.ts", "src.ts/**/*.ts", "deploy/*.ts"] } diff --git a/modules/engine/package.json b/modules/engine/package.json index 87f98dd30..d92fcd7ac 100644 --- a/modules/engine/package.json +++ b/modules/engine/package.json @@ -18,12 +18,12 @@ "@connext/vector-protocol": "0.2.5-beta.21", "@connext/vector-types": "0.2.5-beta.21", "@connext/vector-utils": "0.2.5-beta.21", - "@ethersproject/address": "5.2.0", - "@ethersproject/bignumber": "5.2.0", - "@ethersproject/bytes": "5.2.0", - "@ethersproject/constants": "5.2.0", - "@ethersproject/random": "5.2.0", - "@ethersproject/wallet": "5.2.0", + "@ethersproject/address": "5.4.0", + "@ethersproject/bignumber": "5.4.1", + "@ethersproject/bytes": "5.4.0", + "@ethersproject/constants": "5.4.0", + "@ethersproject/random": "5.4.0", + "@ethersproject/wallet": "5.4.0", "@sinclair/typebox": "0.12.7", "ajv": "6.12.6", "evt": "1.9.12", @@ -42,6 +42,6 @@ "nyc": "15.1.0", "sinon": "10.0.0", "ts-mocha": "8.0.0", - "typescript": "4.2.4" + "typescript": "4.3.5" } } diff --git a/modules/iframe-app/package.json b/modules/iframe-app/package.json index aafe12734..fdf3144de 100644 --- a/modules/iframe-app/package.json +++ b/modules/iframe-app/package.json @@ -6,14 +6,14 @@ "@connext/vector-browser-node": "0.2.5-beta.21", "@connext/vector-types": "0.2.5-beta.21", "@connext/vector-utils": "0.2.5-beta.21", - "@ethersproject/address": "5.2.0", - "@ethersproject/bytes": "5.2.0", - "@ethersproject/hdnode": "5.2.0", - "@ethersproject/keccak256": "5.2.0", - "@ethersproject/providers": "5.2.0", - "@ethersproject/random": "5.2.0", - "@ethersproject/strings": "5.2.0", - "@ethersproject/wallet": "5.2.0", + "@ethersproject/address": "5.4.0", + "@ethersproject/bytes": "5.4.0", + "@ethersproject/hdnode": "5.4.0", + "@ethersproject/keccak256": "5.4.0", + "@ethersproject/providers": "5.4.3", + "@ethersproject/random": "5.4.0", + "@ethersproject/strings": "5.4.0", + "@ethersproject/wallet": "5.4.0", "@metamask/detect-provider": "^1.2.0", "@types/node": "14.14.31", "@types/react": "16.9.53", @@ -22,7 +22,7 @@ "react": "17.0.1", "react-dom": "17.0.1", "react-scripts": "3.4.3", - "typescript": "4.2.4" + "typescript": "4.3.5" }, "scripts": { "start": "BROWSER=none PORT=3030 react-scripts start", diff --git a/modules/protocol/package.json b/modules/protocol/package.json index b0b2dac56..b96b20cc6 100644 --- a/modules/protocol/package.json +++ b/modules/protocol/package.json @@ -17,17 +17,16 @@ "@connext/vector-contracts": "0.2.5-beta.21", "@connext/vector-types": "0.2.5-beta.21", "@connext/vector-utils": "0.2.5-beta.21", - "@ethersproject/abi": "5.2.0", - "@ethersproject/bignumber": "5.2.0", - "@ethersproject/constants": "5.2.0", - "@ethersproject/contracts": "5.2.0", - "@ethersproject/keccak256": "5.2.0", - "@ethersproject/providers": "5.2.0", - "@ethersproject/units": "5.2.0", - "@ethersproject/wallet": "5.2.0", + "@ethersproject/abi": "5.4.0", + "@ethersproject/bignumber": "5.4.1", + "@ethersproject/constants": "5.4.0", + "@ethersproject/contracts": "5.4.1", + "@ethersproject/keccak256": "5.4.0", + "@ethersproject/providers": "5.4.3", + "@ethersproject/units": "5.4.0", + "@ethersproject/wallet": "5.4.0", "@sinclair/typebox": "0.12.7", "ajv": "6.12.6", - "ethers": "5.2.0", "evt": "1.9.12", "pino": "6.11.1", "tty": "1.0.1" @@ -45,6 +44,6 @@ "pino-pretty": "4.6.0", "sinon": "10.0.0", "ts-mocha": "8.0.0", - "typescript": "4.2.4" + "typescript": "4.3.5" } } diff --git a/modules/router/ops/package.json b/modules/router/ops/package.json index ce50758ac..a5b60f0cc 100644 --- a/modules/router/ops/package.json +++ b/modules/router/ops/package.json @@ -3,7 +3,7 @@ "description": "This is only used to install & pin versions for a few global packages in the prod-mode docker container", "dependencies": { "prisma": "2.22.0", - "hardhat": "2.2.0", + "hardhat": "2.4.3", "pg": "8.5.1", "pino-pretty": "4.6.0", "sqlite3": "5.0.2" diff --git a/modules/router/package.json b/modules/router/package.json index 085c68c60..c5d9d58c8 100644 --- a/modules/router/package.json +++ b/modules/router/package.json @@ -18,14 +18,14 @@ "@connext/vector-engine": "0.2.5-beta.21", "@connext/vector-types": "0.2.5-beta.21", "@connext/vector-utils": "0.2.5-beta.21", - "@ethersproject/abi": "5.2.0", - "@ethersproject/address": "5.2.0", - "@ethersproject/bignumber": "5.2.0", - "@ethersproject/constants": "5.2.0", - "@ethersproject/contracts": "5.2.0", - "@ethersproject/providers": "5.2.0", - "@ethersproject/units": "5.2.0", - "@ethersproject/wallet": "5.2.0", + "@ethersproject/abi": "5.4.0", + "@ethersproject/address": "5.4.0", + "@ethersproject/bignumber": "5.4.1", + "@ethersproject/constants": "5.4.0", + "@ethersproject/contracts": "5.4.1", + "@ethersproject/providers": "5.4.3", + "@ethersproject/units": "5.4.0", + "@ethersproject/wallet": "5.4.0", "@prisma/client": "2.22.0", "@sinclair/typebox": "0.12.7", "ajv": "6.12.6", @@ -64,7 +64,7 @@ "ts-loader": "8.0.7", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.5", "webpack": "4.44.2", "webpack-cli": "4.1.0" } diff --git a/modules/router/src/test/autoRebalance.spec.ts b/modules/router/src/test/autoRebalance.spec.ts index 6cfc17d6a..c1eb58458 100644 --- a/modules/router/src/test/autoRebalance.spec.ts +++ b/modules/router/src/test/autoRebalance.spec.ts @@ -7,7 +7,6 @@ import { JsonRpcProvider } from "@ethersproject/providers"; import { BigNumber } from "@ethersproject/bignumber"; import { parseEther } from "@ethersproject/units"; import axios from "axios"; -import PriorityQueue from "p-queue"; import { rebalanceIfNeeded } from "../services/autoRebalance"; import { getConfig } from "../config"; @@ -15,6 +14,7 @@ import * as metrics from "../metrics"; import { PrismaStore, RouterRebalanceStatus } from "../services/store"; import { _createQueueForSwap } from "../services/rebalanceQueue"; import { AutoRebalanceServiceError } from "../errors"; +import { One, Zero } from "@ethersproject/constants"; const config = getConfig(); @@ -79,16 +79,18 @@ const setupForRebalance = ( contractAddress: "", transactionIndex: 0, // root?: string, - gasUsed: BigNumber.from(0), + gasUsed: Zero, logsBloom: "", blockHash: "", transactionHash: "", logs: [], blockNumber: 0, confirmations: 10, - cumulativeGasUsed: BigNumber.from(0), + cumulativeGasUsed: Zero, byzantium: false, - status: 1 + status: 1, + effectiveGasPrice: One, + type: 0 }); }) diff --git a/modules/server-node/examples/eth-rpc.http b/modules/server-node/examples/eth-rpc.http index d49642d99..1beff87d8 100644 --- a/modules/server-node/examples/eth-rpc.http +++ b/modules/server-node/examples/eth-rpc.http @@ -1,4 +1,4 @@ -@ethNode = http://localhost:8545 +@ethNode = https://bsc-dataseed.binance.org/ @sugarDaddy = 0x627306090abaB3A6e1400e9345bC60c78a8BEf57 @alice = 0x119a11d0D1686C7330cA0650E26Fd6889Fbeb832 @bob = 0x95B7e93A3aF19AcAE95aD120d4D8307bF1a6Be63 @@ -55,4 +55,15 @@ Content-Type: application/json { "method":"eth_blockNumber", "params":[] +} + +### GET BALANCE +POST {{ethNode}} +Content-Type: application/json + +{ + "jsonrpc":"2.0", + "method":"eth_getBlockByNumber", + "params":["latest", false], + "id":1 } \ No newline at end of file diff --git a/modules/server-node/package.json b/modules/server-node/package.json index 8837198c5..d1b17b644 100644 --- a/modules/server-node/package.json +++ b/modules/server-node/package.json @@ -18,7 +18,7 @@ "@connext/vector-engine": "0.2.5-beta.21", "@connext/vector-types": "0.2.5-beta.21", "@connext/vector-utils": "0.2.5-beta.21", - "@ethersproject/wallet": "5.2.0", + "@ethersproject/wallet": "5.4.0", "@prisma/client": "2.22.0", "@sinclair/typebox": "0.12.7", "ajv": "6.12.6", @@ -51,7 +51,7 @@ "ts-loader": "8.0.7", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.5", "webpack": "4.44.2", "webpack-cli": "4.1.0" } diff --git a/modules/test-runner/package.json b/modules/test-runner/package.json index 2ecf8e266..148b8379c 100644 --- a/modules/test-runner/package.json +++ b/modules/test-runner/package.json @@ -25,14 +25,14 @@ "axios": "0.21.1", "babel-loader": "8.1.0", "copy-webpack-plugin": "6.2.1", - "ethers": "5.2.0", + "ethers": "5.4.3", "evt": "1.9.12", "fastify": "3.13.0", "p-queue": "6.6.2", "ts-loader": "8.0.7", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.5", "webpack": "4.44.2", "webpack-cli": "4.1.0" }, diff --git a/modules/test-ui/package.json b/modules/test-ui/package.json index 7a75fc864..9f93b89ae 100644 --- a/modules/test-ui/package.json +++ b/modules/test-ui/package.json @@ -11,13 +11,13 @@ "@types/react-dom": "16.9.8", "antd": "4.13.0", "axios": "0.21.1", - "ethers": "5.2.0", + "ethers": "5.4.3", "pino": "6.11.1", "react": "17.0.1", "react-dom": "17.0.1", "react-scripts": "3.4.3", "react-copy-to-clipboard": "5.0.3", - "typescript": "4.2.4" + "typescript": "4.3.5" }, "scripts": { "start": "react-scripts start", diff --git a/modules/types/package.json b/modules/types/package.json index 86df1e545..c0d0bb2e8 100644 --- a/modules/types/package.json +++ b/modules/types/package.json @@ -15,17 +15,16 @@ "build": "rm -rf dist && tsc && rollup -c" }, "dependencies": { - "@ethersproject/abstract-provider": "5.2.0", - "@ethersproject/abstract-signer": "5.2.0", - "@ethersproject/bignumber": "5.2.0", - "@ethersproject/providers": "5.2.0", + "@ethersproject/abstract-provider": "5.4.0", + "@ethersproject/abstract-signer": "5.4.1", + "@ethersproject/bignumber": "5.4.1", + "@ethersproject/providers": "5.4.3", "@sinclair/typebox": "0.12.7", "evt": "1.9.12" }, "devDependencies": { - "ethers": "5.2.0", "rollup": "2.40.0", "rollup-plugin-typescript2": "0.30.0", - "typescript": "4.2.4" + "typescript": "4.3.5" } } diff --git a/modules/utils/package.json b/modules/utils/package.json index 4efeabdb3..874d83c27 100644 --- a/modules/utils/package.json +++ b/modules/utils/package.json @@ -14,19 +14,19 @@ }, "dependencies": { "@connext/vector-types": "0.2.5-beta.21", - "@ethersproject/abi": "5.2.0", - "@ethersproject/abstract-provider": "5.2.0", - "@ethersproject/abstract-signer": "5.2.0", - "@ethersproject/address": "5.2.0", - "@ethersproject/bignumber": "5.2.0", - "@ethersproject/bytes": "5.2.0", - "@ethersproject/constants": "5.2.0", - "@ethersproject/providers": "5.2.0", - "@ethersproject/random": "5.2.0", - "@ethersproject/solidity": "5.2.0", - "@ethersproject/strings": "5.2.0", - "@ethersproject/units": "5.2.0", - "@ethersproject/wallet": "5.2.0", + "@ethersproject/abi": "5.4.0", + "@ethersproject/abstract-provider": "5.4.0", + "@ethersproject/abstract-signer": "5.4.1", + "@ethersproject/address": "5.4.0", + "@ethersproject/bignumber": "5.4.1", + "@ethersproject/bytes": "5.4.0", + "@ethersproject/constants": "5.4.0", + "@ethersproject/providers": "5.4.3", + "@ethersproject/random": "5.4.0", + "@ethersproject/solidity": "5.4.0", + "@ethersproject/strings": "5.4.0", + "@ethersproject/units": "5.4.0", + "@ethersproject/wallet": "5.4.0", "@ethereum-waffle/chai": "3.3.0", "ajv": "6.12.6", "async-mutex": "0.3.1", @@ -56,6 +56,6 @@ "nyc": "15.1.0", "sinon": "10.0.0", "ts-mocha": "8.0.0", - "typescript": "4.2.4" + "typescript": "4.3.5" } } diff --git a/modules/utils/src/test/chain.ts b/modules/utils/src/test/chain.ts index 6a329077a..e18ea7375 100644 --- a/modules/utils/src/test/chain.ts +++ b/modules/utils/src/test/chain.ts @@ -3,9 +3,7 @@ import { BigNumber } from "@ethersproject/bignumber"; import { mkAddress, mkHash } from "./util"; -export const createTestTxResponse = ( - overrides: Partial = {}, -): TransactionResponse => { +export const createTestTxResponse = (overrides: Partial = {}): TransactionResponse => { const to = overrides.to ?? mkAddress("0x1111"); const from = overrides.from ?? mkAddress("0x2222"); const hash = overrides.hash ?? mkHash("0xade134"); @@ -30,9 +28,7 @@ export const createTestTxResponse = ( }; }; -export const createTestTxReceipt = ( - overrides: Partial = {}, -): TransactionReceipt => { +export const createTestTxReceipt = (overrides: Partial = {}): TransactionReceipt => { return { transactionHash: mkHash("0xaecb"), to: mkAddress("0x1111"), @@ -45,6 +41,8 @@ export const createTestTxReceipt = ( gasUsed: BigNumber.from(1657639), logsBloom: "logs", logs: [], + type: 1, + effectiveGasPrice: BigNumber.from(1234678), cumulativeGasUsed: BigNumber.from(1657639), byzantium: true, confirmations: 15, diff --git a/package.json b/package.json index 1a3a6a2a2..5cec47129 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,6 @@ "node-ts": "5.1.1", "nodemon": "2.0.7", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.5" } }