Skip to content

Commit

Permalink
chore: bump ethers & typechain (#288)
Browse files Browse the repository at this point in the history
* chore: bump ethers & typechain

Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu>

* improve: bump typechain

Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu>

* improve: bump ethers hardhat

Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu>

* improve: bump versions

Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu>

* revert

Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu>

* chore: bump versions

Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu>

* fix: bump hubpool

Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu>

* improve: bump eth waffle

Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu>

* fix: modify tests

Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu>

* chore: bump chai

Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu>

* improve: resolve utils

Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu>

* chore: revert dependency

Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu>

* chore: bump version

Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu>

---------

Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu>
  • Loading branch information
james-a-morris authored May 17, 2023
1 parent a231a21 commit 7a56413
Show file tree
Hide file tree
Showing 8 changed files with 987 additions and 234 deletions.
5 changes: 5 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import "hardhat-deploy";
import "@openzeppelin/hardhat-upgrades";

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

dotenv.config();
Expand Down Expand Up @@ -162,6 +163,10 @@ const config: HardhatUserConfig = {
},
},
namedAccounts: { deployer: 0 },
typechain: {
outDir: "./typechain",
target: "ethers-v5",
},
};

export default config;
26 changes: 14 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@across-protocol/contracts-v2",
"version": "2.2.2",
"version": "2.2.3",
"author": "UMA Team",
"license": "AGPL-3.0-only",
"repository": {
Expand Down Expand Up @@ -33,7 +33,9 @@
},
"dependencies": {
"@defi-wonderland/smock": "^2.3.4",
"@eth-optimism/contracts": "^0.5.11",
"@eth-optimism/contracts": "^0.5.40",
"@ethersproject/abstract-provider": "5.7.0",
"@ethersproject/abstract-signer": "5.7.0",
"@openzeppelin/contracts": "4.8.3",
"@openzeppelin/contracts-upgradeable": "4.8.3",
"@uma/common": "^2.29.0",
Expand All @@ -43,21 +45,21 @@
"devDependencies": {
"@matterlabs/hardhat-zksync-solc": "^0.3.6",
"@matterlabs/zksync-contracts": "^0.2.4",
"@nomiclabs/hardhat-ethers": "^2.0.5",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-etherscan": "^3.1.7",
"@nomiclabs/hardhat-waffle": "^2.0.3",
"@nomiclabs/hardhat-waffle": "2.0.3",
"@openzeppelin/hardhat-upgrades": "^1.22.0",
"@pinata/sdk": "^2.1.0",
"@typechain/ethers-v5": "^7.0.1",
"@typechain/hardhat": "^2.3.0",
"@types/chai": "^4.2.21",
"@typechain/ethers-v5": "^10.2.1",
"@typechain/hardhat": "^6.1.6",
"@types/chai": "^4.3.5",
"@types/mocha": "^9.0.0",
"@types/node": "^12.0.0",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
"arb-bridge-eth": "^0.7.4",
"arb-bridge-peripherals": "^1.0.5",
"chai": "^4.2.0",
"chai": "^4.3.7",
"dotenv": "^10.0.0",
"eslint": "^7.29.0",
"eslint-config-prettier": "^8.3.0",
Expand All @@ -66,10 +68,10 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-promise": "^5.1.0",
"ethereum-waffle": "^3.4.0",
"ethereum-waffle": "3.4.0",
"ethereumjs-util": "^7.1.4",
"ethers": "^5.5.4",
"hardhat": "^2.12.1-ir.0",
"ethers": "5.7.2",
"hardhat": "^2.14.0",
"hardhat-deploy": "^0.11.12",
"hardhat-gas-reporter": "^1.0.8",
"husky": "^4.2.3",
Expand All @@ -80,7 +82,7 @@
"solhint": "^3.3.6",
"solidity-coverage": "^0.7.16",
"ts-node": "^10.1.0",
"typechain": "^5.1.2",
"typechain": "^8.1.1",
"typescript": "^4.5.2"
},
"husky": {
Expand Down
21 changes: 18 additions & 3 deletions test/HubPool.ExecuteRootBundle.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
import { toBNWei, SignerWithAddress, seedWallet, expect, Contract, ethers, randomAddress } from "../utils/utils";
import { MerkleTree } from "@uma/common";
import {
toBNWei,
SignerWithAddress,
seedWallet,
expect,
Contract,
ethers,
randomAddress,
BigNumber,
} from "../utils/utils";
import * as consts from "./constants";
import { hubPoolFixture, enableTokensForLP } from "./fixtures/HubPool.Fixture";
import { buildPoolRebalanceLeafTree, buildPoolRebalanceLeaves } from "./MerkleLib.utils";
import { buildPoolRebalanceLeafTree, buildPoolRebalanceLeaves, PoolRebalanceLeaf } from "./MerkleLib.utils";

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

// Construct the leaves that will go into the merkle tree. For this function create a simple set of leaves that will
// repay two token to one chain Id with simple lpFee, netSend and running balance amounts.
export async function constructSimpleTree() {
export async function constructSimpleTree(): Promise<{
wethToSendToL2: BigNumber;
daiToSend: BigNumber;
leaves: PoolRebalanceLeaf[];
tree: MerkleTree<PoolRebalanceLeaf>;
}> {
const wethToSendToL2 = toBNWei(100);
const daiToSend = toBNWei(1000);
const leaves = buildPoolRebalanceLeaves(
Expand Down
6 changes: 4 additions & 2 deletions test/SpokePool.ExecuteRootBundle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SignerWithAddress, seedContract, toBN, expect, Contract, ethers } from "../utils/utils";
import { SignerWithAddress, seedContract, toBN, expect, Contract, ethers, BigNumber } from "../utils/utils";
import * as consts from "./constants";
import { spokePoolFixture } from "./fixtures/SpokePool.Fixture";
import { buildRelayerRefundTree, buildRelayerRefundLeaves } from "./MerkleLib.utils";
Expand Down Expand Up @@ -56,7 +56,9 @@ describe("SpokePool Root Bundle Execution", function () {
expect(relayTokensEvents[0].args?.leafId).to.equal(0);
expect(relayTokensEvents[0].args?.chainId).to.equal(destinationChainId);
expect(relayTokensEvents[0].args?.amountToReturn).to.equal(consts.amountToReturn);
expect(relayTokensEvents[0].args?.refundAmounts).to.deep.equal([consts.amountToRelay, consts.amountToRelay]);
expect((relayTokensEvents[0].args?.refundAmounts as BigNumber[]).map((v) => v.toString())).to.deep.equal(
[consts.amountToRelay, consts.amountToRelay].map((v) => v.toString())
);
expect(relayTokensEvents[0].args?.refundAddresses).to.deep.equal([relayer.address, rando.address]);
expect(relayTokensEvents[0].args?.caller).to.equal(dataWorker.address);

Expand Down
5 changes: 3 additions & 2 deletions test/SpokePool.Relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe("SpokePool Relayer Logic", async function () {
relayData.depositor,
relayData.recipient,
relayData.message,
[relayData.recipient, relayData.message, relayData.relayerFeePct, false]
[relayData.recipient, relayData.message, relayData.relayerFeePct, false, "0"]
);

// The collateral should have transferred from relayer to recipient.
Expand Down Expand Up @@ -146,7 +146,7 @@ describe("SpokePool Relayer Logic", async function () {
relayData.depositor,
relayData.recipient,
relayData.message,
[relayData.recipient, relayData.message, relayData.relayerFeePct, false]
[relayData.recipient, relayData.message, relayData.relayerFeePct, false, "0"]
);

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

Expand Down
1 change: 1 addition & 0 deletions test/SpokePool.SlowRelay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ describe("SpokePool Slow Relay Logic", async function () {
erc20Message,
0, // Should not have an applied relayerFeePct for slow relay fills.
true,
"9000000000000000000",
]
);
});
Expand Down
5 changes: 4 additions & 1 deletion utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ export async function getParamType(contractName: string, functionName: string, p

export async function createFake(contractName: string, targetAddress: string = "") {
const contractFactory = await getContractFactory(contractName, new ethers.VoidSigner(ethers.constants.AddressZero));
return targetAddress !== "" ? smock.fake(contractFactory, { address: targetAddress }) : smock.fake(contractFactory);
return smock.fake(contractFactory.interface.fragments, {
address: targetAddress === "" ? undefined : targetAddress,
provider: contractFactory.signer.provider,
});
}

function avmL1ToL2Alias(l1Address: string) {
Expand Down
Loading

0 comments on commit 7a56413

Please sign in to comment.