Skip to content

Commit 7a56413

Browse files
chore: bump ethers & typechain (#288)
* chore: bump ethers & typechain Signed-off-by: james-a-morris <[email protected]> * improve: bump typechain Signed-off-by: james-a-morris <[email protected]> * improve: bump ethers hardhat Signed-off-by: james-a-morris <[email protected]> * improve: bump versions Signed-off-by: james-a-morris <[email protected]> * revert Signed-off-by: james-a-morris <[email protected]> * chore: bump versions Signed-off-by: james-a-morris <[email protected]> * fix: bump hubpool Signed-off-by: james-a-morris <[email protected]> * improve: bump eth waffle Signed-off-by: james-a-morris <[email protected]> * fix: modify tests Signed-off-by: james-a-morris <[email protected]> * chore: bump chai Signed-off-by: james-a-morris <[email protected]> * improve: resolve utils Signed-off-by: james-a-morris <[email protected]> * chore: revert dependency Signed-off-by: james-a-morris <[email protected]> * chore: bump version Signed-off-by: james-a-morris <[email protected]> --------- Signed-off-by: james-a-morris <[email protected]>
1 parent a231a21 commit 7a56413

8 files changed

+987
-234
lines changed

hardhat.config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import "hardhat-deploy";
1313
import "@openzeppelin/hardhat-upgrades";
1414

1515
// Custom tasks to add to HRE.
16+
// eslint-disable-next-line node/no-missing-require
1617
require("./tasks/enableL1TokenAcrossEcosystem");
1718

1819
dotenv.config();
@@ -162,6 +163,10 @@ const config: HardhatUserConfig = {
162163
},
163164
},
164165
namedAccounts: { deployer: 0 },
166+
typechain: {
167+
outDir: "./typechain",
168+
target: "ethers-v5",
169+
},
165170
};
166171

167172
export default config;

package.json

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@across-protocol/contracts-v2",
3-
"version": "2.2.2",
3+
"version": "2.2.3",
44
"author": "UMA Team",
55
"license": "AGPL-3.0-only",
66
"repository": {
@@ -33,7 +33,9 @@
3333
},
3434
"dependencies": {
3535
"@defi-wonderland/smock": "^2.3.4",
36-
"@eth-optimism/contracts": "^0.5.11",
36+
"@eth-optimism/contracts": "^0.5.40",
37+
"@ethersproject/abstract-provider": "5.7.0",
38+
"@ethersproject/abstract-signer": "5.7.0",
3739
"@openzeppelin/contracts": "4.8.3",
3840
"@openzeppelin/contracts-upgradeable": "4.8.3",
3941
"@uma/common": "^2.29.0",
@@ -43,21 +45,21 @@
4345
"devDependencies": {
4446
"@matterlabs/hardhat-zksync-solc": "^0.3.6",
4547
"@matterlabs/zksync-contracts": "^0.2.4",
46-
"@nomiclabs/hardhat-ethers": "^2.0.5",
48+
"@nomiclabs/hardhat-ethers": "^2.2.3",
4749
"@nomiclabs/hardhat-etherscan": "^3.1.7",
48-
"@nomiclabs/hardhat-waffle": "^2.0.3",
50+
"@nomiclabs/hardhat-waffle": "2.0.3",
4951
"@openzeppelin/hardhat-upgrades": "^1.22.0",
5052
"@pinata/sdk": "^2.1.0",
51-
"@typechain/ethers-v5": "^7.0.1",
52-
"@typechain/hardhat": "^2.3.0",
53-
"@types/chai": "^4.2.21",
53+
"@typechain/ethers-v5": "^10.2.1",
54+
"@typechain/hardhat": "^6.1.6",
55+
"@types/chai": "^4.3.5",
5456
"@types/mocha": "^9.0.0",
5557
"@types/node": "^12.0.0",
5658
"@typescript-eslint/eslint-plugin": "^4.29.1",
5759
"@typescript-eslint/parser": "^4.29.1",
5860
"arb-bridge-eth": "^0.7.4",
5961
"arb-bridge-peripherals": "^1.0.5",
60-
"chai": "^4.2.0",
62+
"chai": "^4.3.7",
6163
"dotenv": "^10.0.0",
6264
"eslint": "^7.29.0",
6365
"eslint-config-prettier": "^8.3.0",
@@ -66,10 +68,10 @@
6668
"eslint-plugin-node": "^11.1.0",
6769
"eslint-plugin-prettier": "^3.4.0",
6870
"eslint-plugin-promise": "^5.1.0",
69-
"ethereum-waffle": "^3.4.0",
71+
"ethereum-waffle": "3.4.0",
7072
"ethereumjs-util": "^7.1.4",
71-
"ethers": "^5.5.4",
72-
"hardhat": "^2.12.1-ir.0",
73+
"ethers": "5.7.2",
74+
"hardhat": "^2.14.0",
7375
"hardhat-deploy": "^0.11.12",
7476
"hardhat-gas-reporter": "^1.0.8",
7577
"husky": "^4.2.3",
@@ -80,7 +82,7 @@
8082
"solhint": "^3.3.6",
8183
"solidity-coverage": "^0.7.16",
8284
"ts-node": "^10.1.0",
83-
"typechain": "^5.1.2",
85+
"typechain": "^8.1.1",
8486
"typescript": "^4.5.2"
8587
},
8688
"husky": {

test/HubPool.ExecuteRootBundle.ts

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
1-
import { toBNWei, SignerWithAddress, seedWallet, expect, Contract, ethers, randomAddress } from "../utils/utils";
1+
import { MerkleTree } from "@uma/common";
2+
import {
3+
toBNWei,
4+
SignerWithAddress,
5+
seedWallet,
6+
expect,
7+
Contract,
8+
ethers,
9+
randomAddress,
10+
BigNumber,
11+
} from "../utils/utils";
212
import * as consts from "./constants";
313
import { hubPoolFixture, enableTokensForLP } from "./fixtures/HubPool.Fixture";
4-
import { buildPoolRebalanceLeafTree, buildPoolRebalanceLeaves } from "./MerkleLib.utils";
14+
import { buildPoolRebalanceLeafTree, buildPoolRebalanceLeaves, PoolRebalanceLeaf } from "./MerkleLib.utils";
515

616
let hubPool: Contract, mockAdapter: Contract, weth: Contract, dai: Contract, mockSpoke: Contract, timer: Contract;
717
let owner: SignerWithAddress, dataWorker: SignerWithAddress, liquidityProvider: SignerWithAddress;
818
let l2Weth: string, l2Dai: string;
919

1020
// Construct the leaves that will go into the merkle tree. For this function create a simple set of leaves that will
1121
// repay two token to one chain Id with simple lpFee, netSend and running balance amounts.
12-
export async function constructSimpleTree() {
22+
export async function constructSimpleTree(): Promise<{
23+
wethToSendToL2: BigNumber;
24+
daiToSend: BigNumber;
25+
leaves: PoolRebalanceLeaf[];
26+
tree: MerkleTree<PoolRebalanceLeaf>;
27+
}> {
1328
const wethToSendToL2 = toBNWei(100);
1429
const daiToSend = toBNWei(1000);
1530
const leaves = buildPoolRebalanceLeaves(

test/SpokePool.ExecuteRootBundle.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SignerWithAddress, seedContract, toBN, expect, Contract, ethers } from "../utils/utils";
1+
import { SignerWithAddress, seedContract, toBN, expect, Contract, ethers, BigNumber } from "../utils/utils";
22
import * as consts from "./constants";
33
import { spokePoolFixture } from "./fixtures/SpokePool.Fixture";
44
import { buildRelayerRefundTree, buildRelayerRefundLeaves } from "./MerkleLib.utils";
@@ -56,7 +56,9 @@ describe("SpokePool Root Bundle Execution", function () {
5656
expect(relayTokensEvents[0].args?.leafId).to.equal(0);
5757
expect(relayTokensEvents[0].args?.chainId).to.equal(destinationChainId);
5858
expect(relayTokensEvents[0].args?.amountToReturn).to.equal(consts.amountToReturn);
59-
expect(relayTokensEvents[0].args?.refundAmounts).to.deep.equal([consts.amountToRelay, consts.amountToRelay]);
59+
expect((relayTokensEvents[0].args?.refundAmounts as BigNumber[]).map((v) => v.toString())).to.deep.equal(
60+
[consts.amountToRelay, consts.amountToRelay].map((v) => v.toString())
61+
);
6062
expect(relayTokensEvents[0].args?.refundAddresses).to.deep.equal([relayer.address, rando.address]);
6163
expect(relayTokensEvents[0].args?.caller).to.equal(dataWorker.address);
6264

test/SpokePool.Relay.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ describe("SpokePool Relayer Logic", async function () {
8383
relayData.depositor,
8484
relayData.recipient,
8585
relayData.message,
86-
[relayData.recipient, relayData.message, relayData.relayerFeePct, false]
86+
[relayData.recipient, relayData.message, relayData.relayerFeePct, false, "0"]
8787
);
8888

8989
// The collateral should have transferred from relayer to recipient.
@@ -146,7 +146,7 @@ describe("SpokePool Relayer Logic", async function () {
146146
relayData.depositor,
147147
relayData.recipient,
148148
relayData.message,
149-
[relayData.recipient, relayData.message, relayData.relayerFeePct, false]
149+
[relayData.recipient, relayData.message, relayData.relayerFeePct, false, "0"]
150150
);
151151

152152
// Repayment on another chain doesn't increment fill counter.
@@ -682,6 +682,7 @@ async function testfillRelayWithUpdatedDeposit(depositorAddress: string) {
682682
updatedMessage,
683683
consts.modifiedRelayerFeePct, // Applied relayer fee % should be diff from original fee %.
684684
false,
685+
"0",
685686
]
686687
);
687688

test/SpokePool.SlowRelay.ts

+1
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ describe("SpokePool Slow Relay Logic", async function () {
221221
erc20Message,
222222
0, // Should not have an applied relayerFeePct for slow relay fills.
223223
true,
224+
"9000000000000000000",
224225
]
225226
);
226227
});

utils/utils.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,10 @@ export async function getParamType(contractName: string, functionName: string, p
183183

184184
export async function createFake(contractName: string, targetAddress: string = "") {
185185
const contractFactory = await getContractFactory(contractName, new ethers.VoidSigner(ethers.constants.AddressZero));
186-
return targetAddress !== "" ? smock.fake(contractFactory, { address: targetAddress }) : smock.fake(contractFactory);
186+
return smock.fake(contractFactory.interface.fragments, {
187+
address: targetAddress === "" ? undefined : targetAddress,
188+
provider: contractFactory.signer.provider,
189+
});
187190
}
188191

189192
function avmL1ToL2Alias(l1Address: string) {

0 commit comments

Comments
 (0)