From 92b99247eadf5146a57222ed3562f7718795f2a3 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Fri, 10 Dec 2021 01:02:08 +0530 Subject: [PATCH] fixed tests --- scripts/constant/addresses.ts | 2 +- test/mainnet/aave/v1.test.ts | 2 +- test/mainnet/aave/v2.test.ts | 2 +- test/mainnet/b.protocol/b.compound.test.ts | 2 +- test/mainnet/b.protocol/b.maker.test.ts | 2 +- .../mainnet/basic-ERC1155/ERC1155-transfer.ts | 2 +- test/mainnet/basic-ERC721/ERC721-transfer.ts | 2 +- test/mainnet/compound/compound.test.ts | 2 +- test/mainnet/instapool/instapool.test.ts | 2 +- test/mainnet/liquity/liquity.contracts.ts | 2 +- test/mainnet/liquity/liquity.helpers.ts | 55 +++++----- test/mainnet/liquity/liquity.test.ts | 102 ++++++++++-------- .../mainnet/pooltogether/pooltogether.test.ts | 2 +- test/mainnet/uniswap/uniswap.test.ts | 2 +- .../mainnet/uniswapStake/uniswapStake.test.ts | 2 +- test/mainnet/yearn/yearn.test.ts | 2 +- .../polygon/pooltogether/pooltogether.test.ts | 2 +- 17 files changed, 100 insertions(+), 87 deletions(-) diff --git a/scripts/constant/addresses.ts b/scripts/constant/addresses.ts index 591bcb8c..fd69c32b 100644 --- a/scripts/constant/addresses.ts +++ b/scripts/constant/addresses.ts @@ -1,4 +1,4 @@ -export const addresses: Record = { +export default { mainnet: { connectors: { basic: "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6", diff --git a/test/mainnet/aave/v1.test.ts b/test/mainnet/aave/v1.test.ts index 2a82f4e4..6af2ac78 100644 --- a/test/mainnet/aave/v1.test.ts +++ b/test/mainnet/aave/v1.test.ts @@ -1,7 +1,7 @@ import hre from "hardhat"; import { expect } from "chai"; import { abis } from "../../../scripts/constant/abis"; -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; diff --git a/test/mainnet/aave/v2.test.ts b/test/mainnet/aave/v2.test.ts index c85892b6..85d1fb18 100644 --- a/test/mainnet/aave/v2.test.ts +++ b/test/mainnet/aave/v2.test.ts @@ -1,7 +1,7 @@ import { expect } from "chai"; import hre from "hardhat"; import { abis } from "../../../scripts/constant/abis"; -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; diff --git a/test/mainnet/b.protocol/b.compound.test.ts b/test/mainnet/b.protocol/b.compound.test.ts index 1efa3073..d222a2d0 100644 --- a/test/mainnet/b.protocol/b.compound.test.ts +++ b/test/mainnet/b.protocol/b.compound.test.ts @@ -7,7 +7,7 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; import { ConnectV2BCompound__factory } from "../../../typechain"; diff --git a/test/mainnet/b.protocol/b.maker.test.ts b/test/mainnet/b.protocol/b.maker.test.ts index c460abd3..31e82d34 100644 --- a/test/mainnet/b.protocol/b.maker.test.ts +++ b/test/mainnet/b.protocol/b.maker.test.ts @@ -7,7 +7,7 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { tokens } from "../../../scripts/constant/tokens"; import { ConnectV2BMakerDAO__factory } from "../../../typechain"; diff --git a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts index 12324071..da0ab626 100644 --- a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts +++ b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts @@ -8,7 +8,7 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import { addresses } from "../../../scripts/constant/addresses" +import addresses from "../../../scripts/constant/addresses" import { abis } from "../../../scripts/constant/abis" import type { Signer, Contract } from "ethers"; diff --git a/test/mainnet/basic-ERC721/ERC721-transfer.ts b/test/mainnet/basic-ERC721/ERC721-transfer.ts index 4f87ca90..d4811879 100644 --- a/test/mainnet/basic-ERC721/ERC721-transfer.ts +++ b/test/mainnet/basic-ERC721/ERC721-transfer.ts @@ -8,7 +8,7 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import { addresses } from "../../../scripts/constant/addresses" +import addresses from "../../../scripts/constant/addresses" import { abis } from "../../../scripts/constant/abis" import type { Signer, Contract } from "ethers"; diff --git a/test/mainnet/compound/compound.test.ts b/test/mainnet/compound/compound.test.ts index be9b4f4e..ccb1c228 100644 --- a/test/mainnet/compound/compound.test.ts +++ b/test/mainnet/compound/compound.test.ts @@ -9,7 +9,7 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; import { ConnectV2Compound__factory } from "../../../typechain"; diff --git a/test/mainnet/instapool/instapool.test.ts b/test/mainnet/instapool/instapool.test.ts index 36e15551..7aab1b6c 100644 --- a/test/mainnet/instapool/instapool.test.ts +++ b/test/mainnet/instapool/instapool.test.ts @@ -9,7 +9,7 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells" import encodeFlashcastData from "../../../scripts/tests/encodeFlashcastData" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import type { Signer, Contract } from "ethers"; import { ConnectV2Compound__factory } from "../../../typechain"; diff --git a/test/mainnet/liquity/liquity.contracts.ts b/test/mainnet/liquity/liquity.contracts.ts index f6a6df74..7cee4a17 100644 --- a/test/mainnet/liquity/liquity.contracts.ts +++ b/test/mainnet/liquity/liquity.contracts.ts @@ -69,7 +69,7 @@ const COLL_SURPLUS_ABI = [ "function getCollateral(address _account) external view returns (uint)", ]; -module.exports = { +export default { TROVE_MANAGER_ADDRESS, TROVE_MANAGER_ABI, BORROWER_OPERATIONS_ADDRESS, diff --git a/test/mainnet/liquity/liquity.helpers.ts b/test/mainnet/liquity/liquity.helpers.ts index bab90124..0fd8f191 100644 --- a/test/mainnet/liquity/liquity.helpers.ts +++ b/test/mainnet/liquity/liquity.helpers.ts @@ -3,30 +3,31 @@ import { ethers } from "hardhat"; import hardhatConfig from "../../../hardhat.config"; // Instadapp deployment and testing helpers -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector" import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" // Instadapp instadappAddresses/ABIs -import { instadappAddresses } from "../../../scripts/important/addresses"; -import { instadappAbi } from "../../../scripts/constant/abis"; +import instadappAddresses from "../../../scripts/constant/addresses"; +import { abis } from "../../../scripts/constant/abis"; // Instadapp Liquity Connector artifacts import { ConnectV2Liquity__factory, ConnectV2Basic__factory } from "../../../typechain"; // Instadapp uses a fake address to represent native ETH -import { constants } from "../../../scripts/constant/constant.js"; -import type { Signer, Contract } from "ethers"; - +import { constants } from "../../../scripts/constant/constant"; +import type { Signer, Contract, BigNumber } from "ethers"; const LIQUITY_CONNECTOR = "LIQUITY-v1-TEST"; const LUSD_GAS_COMPENSATION = hre.ethers.utils.parseUnits("200", 18); // 200 LUSD gas compensation repaid after loan repayment const LIQUIDATABLE_TROVES_BLOCK_NUMBER = 12478159; // Deterministic block number for tests to run against, if you change this, tests will break. const JUSTIN_SUN_ADDRESS = "0x903d12bf2c57a29f32365917c706ce0e1a84cce3"; // LQTY whale address const LIQUIDATABLE_TROVE_ADDRESS = "0xafbeb4cb97f3b08ec2fe07ef0dac15d37013a347"; // Trove which is liquidatable at blockNumber: LIQUIDATABLE_TROVES_BLOCK_NUMBER -// const MAX_GAS = hardhatConfig.networks.hardhat.blockGasLimit; // Maximum gas limit (12000000) +// @ts-ignore +const MAX_GAS = hardhatConfig.networks.hardhat.blockGasLimit ?? 12000000; // Maximum gas limit (12000000) const INSTADAPP_BASIC_V1_CONNECTOR = "Basic-v1"; +const ETH = constants.native_address const openTroveSpell = async ( dsa: any, @@ -121,24 +122,26 @@ const resetHardhatBlockNumber = async (blockNumber: number) => { const deployAndConnect = async (contracts: any, isDebug = false) => { // Pin Liquity tests to a particular block number to create deterministic state (Ether price etc.) await resetHardhatBlockNumber(LIQUIDATABLE_TROVES_BLOCK_NUMBER); - let liquity = { + type Liquidity = { troveManager: Contract, - borrowerOperations: null, - stabilityPool: null, - lusdToken: null, - lqtyToken: null, - activePool: null, - priceFeed: null, - hintHelpers: null, - sortedTroves: null, - staking: null, - collSurplus: null, + borrowerOperations: Contract, + stabilityPool: Contract, + lusdToken: Contract, + lqtyToken: Contract, + activePool: Contract, + priceFeed: Contract, + hintHelpers: Contract, + sortedTroves: Contract, + staking: Contract, + collSurplus: Contract, }; + const liquity = {} as Liquidity + const masterSigner = await getMasterSigner(); const instaConnectorsV2 = await ethers.getContractAt( - instadappAbi.core.connectorsV2, - instadappAddresses.core.connectorsV2 + abis.core.connectorsV2, + instadappAddresses.mainnet.core.connectorsV2 ); const connector = await deployAndEnableConnector({ connectorName: LIQUITY_CONNECTOR, @@ -225,7 +228,7 @@ const deployAndConnect = async (contracts: any, isDebug = false) => { return liquity; }; -const getTroveInsertionHints = async (depositAmount, borrowAmount, liquity: any) => { +const getTroveInsertionHints = async (depositAmount: BigNumber, borrowAmount: BigNumber, liquity: any) => { const nominalCR = await liquity.hintHelpers.computeNominalCR( depositAmount, borrowAmount @@ -259,7 +262,7 @@ const getTroveInsertionHints = async (depositAmount, borrowAmount, liquity: any) let randomSeed = 4223; -const getRedemptionHints = async (amount, liquity) => { +const getRedemptionHints = async (amount: any, liquity: any) => { const ethPrice = await liquity.priceFeed.callStatic.fetchPrice(); const [ firstRedemptionHint, @@ -299,7 +302,7 @@ const getRedemptionHints = async (amount, liquity) => { }; }; -const redeem = async (amount, from, wallet, liquity) => { +const redeem = async (amount: any, from: any, wallet: { address: any; }, liquity: any) => { await sendToken(liquity.lusdToken, amount, from, wallet.address); const { partialRedemptionHintNicr, @@ -325,7 +328,7 @@ const redeem = async (amount, from, wallet, liquity) => { ); }; -module.exports = { +export default { deployAndConnect, resetInitialState, createDsaTrove, @@ -339,5 +342,5 @@ module.exports = { LIQUIDATABLE_TROVE_ADDRESS, MAX_GAS, INSTADAPP_BASIC_V1_CONNECTOR, - ETH_ADDRESS, + ETH, }; diff --git a/test/mainnet/liquity/liquity.test.ts b/test/mainnet/liquity/liquity.test.ts index fd5ccd69..5eae01a1 100644 --- a/test/mainnet/liquity/liquity.test.ts +++ b/test/mainnet/liquity/liquity.test.ts @@ -3,13 +3,14 @@ import { expect } from "chai"; // Instadapp deployment and testing helpers import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js"; +import { encodeSpells } from "../../../scripts/tests/encodeSpells"; // Liquity smart contracts import contracts from "./liquity.contracts"; // Liquity helpers import helpers from "./liquity.helpers"; +import { Contract, Signer } from "ethers"; describe("Liquity", () => { const { waffle, ethers } = hre; @@ -17,8 +18,8 @@ describe("Liquity", () => { // Waffle test account 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 (holds 1000 ETH) const userWallet = provider.getWallets()[0]; - let dsa = null; - let liquity = null; + let dsa: any; + let liquity: any; before(async () => { await hre.network.provider.request({ @@ -26,6 +27,7 @@ describe("Liquity", () => { params: [ { forking: { + // @ts-ignore jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber: 13300000, }, @@ -143,7 +145,7 @@ describe("Liquity", () => { const depositEthSpell = { connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, method: "deposit", - args: [helpers.ETH_ADDRESS, depositAmount, 0, depositId], + args: [helpers.ETH, depositAmount, 0, depositId], }; const openTroveSpell = { @@ -321,8 +323,9 @@ describe("Liquity", () => { } ); const receipt = await openTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; expect(castLogEvent.eventNames[0]).eq( "LogOpen(address,uint256,uint256,uint256,uint256[],uint256[])" ); @@ -541,7 +544,7 @@ describe("Liquity", () => { connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, method: "withdraw", args: [ - helpers.ETH_ADDRESS, + helpers.ETH, 0, // amount comes from the previous spell's setId dsa.address, collateralWithdrawId, @@ -612,8 +615,9 @@ describe("Liquity", () => { .cast(...encodeSpells([closeTroveSpell]), userWallet.address); const receipt = await closeTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256"], [dsa.address, 0] @@ -673,7 +677,7 @@ describe("Liquity", () => { const depositEthSpell = { connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, method: "deposit", - args: [helpers.ETH_ADDRESS, topupAmount, 0, depositId], + args: [helpers.ETH, topupAmount, 0, depositId], }; const upperHint = ethers.constants.AddressZero; @@ -725,8 +729,9 @@ describe("Liquity", () => { }); const receipt = await depositTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256"], [dsa.address, topupAmount, 0, 0] @@ -796,7 +801,7 @@ describe("Liquity", () => { const withdrawEthSpell = { connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, method: "withdraw", - args: [helpers.ETH_ADDRESS, 0, userWallet.address, withdrawId, 0], + args: [helpers.ETH, 0, userWallet.address, withdrawId, 0], }; const spells = [withdrawEthFromTroveSpell, withdrawEthSpell]; await dsa @@ -844,8 +849,9 @@ describe("Liquity", () => { .cast(...encodeSpells([withdrawEthSpell]), userWallet.address); const receipt = await withdrawTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256"], [dsa.address, withdrawAmount, 0, 0] @@ -973,8 +979,9 @@ describe("Liquity", () => { .cast(...encodeSpells([borrowSpell]), userWallet.address); const receipt = await borrowTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256"], [dsa.address, borrowAmount, 0, 0] @@ -1130,8 +1137,9 @@ describe("Liquity", () => { }); const receipt = await repayTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256"], [dsa.address, repayAmount, 0, 0] @@ -1295,7 +1303,7 @@ describe("Liquity", () => { const depositEthSpell = { connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, method: "deposit", - args: [helpers.ETH_ADDRESS, depositAmount, 0, ethDepositId], + args: [helpers.ETH, depositAmount, 0, ethDepositId], }; const depositLusdSpell = { @@ -1403,13 +1411,7 @@ describe("Liquity", () => { const withdrawEthSpell = { connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, method: "withdraw", - args: [ - helpers.ETH_ADDRESS, - 0, - userWallet.address, - ethWithdrawId, - 0, - ], + args: [helpers.ETH, 0, userWallet.address, ethWithdrawId, 0], }; const withdrawLusdSpell = { @@ -1484,8 +1486,9 @@ describe("Liquity", () => { }); const receipt = await adjustTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( [ "address", @@ -1645,8 +1648,9 @@ describe("Liquity", () => { ); const receipt = await claimTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256"], [dsa.address, claimAmount, setId] @@ -1768,7 +1772,7 @@ describe("Liquity", () => { // Fast forward in time so we have an LQTY gain await provider.send("evm_increaseTime", [600]); - await provider.send("evm_mine"); + await provider.send("evm_mine", []); // Create a Stability Pool deposit with a differen DSA so that LQTY gains can be calculated // See: https://github.com/liquity/dev/#lqty-reward-events-and-payouts @@ -1796,8 +1800,9 @@ describe("Liquity", () => { .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); const receipt = await depositAgainTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( [ "address", @@ -1992,7 +1997,7 @@ describe("Liquity", () => { // Fast forward in time so we have an LQTY gain await provider.send("evm_increaseTime", [600]); - await provider.send("evm_mine"); + await provider.send("evm_mine", []); // Create another Stability Pool deposit so that LQTY gains are realized // See: https://github.com/liquity/dev/#lqty-reward-events-and-payouts @@ -2034,8 +2039,9 @@ describe("Liquity", () => { ); const receipt = await withdrawTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( [ "address", @@ -2172,8 +2178,9 @@ describe("Liquity", () => { const receipt = await moveEthGainTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256"], [dsa.address, ethGainFromLiquidation] @@ -2293,8 +2300,9 @@ describe("Liquity", () => { const receipt = await stakeTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256", "uint256", "uint256"], [ @@ -2457,8 +2465,9 @@ describe("Liquity", () => { const receipt = await unstakeTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256", "uint256", "uint256"], [ @@ -2601,7 +2610,7 @@ describe("Liquity", () => { const withdrawEthSpell = { connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, method: "withdraw", - args: [helpers.ETH_ADDRESS, 0, userWallet.address, ethGainId, 0], + args: [helpers.ETH, 0, userWallet.address, ethGainId, 0], }; const withdrawLusdSpell = { @@ -2702,8 +2711,9 @@ describe("Liquity", () => { const receipt = await claimGainsTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256", "uint256"], [stakerDsa.address, ethGain, lusdGain, setEthGainId, setLusdGainId] diff --git a/test/mainnet/pooltogether/pooltogether.test.ts b/test/mainnet/pooltogether/pooltogether.test.ts index 0447c75c..94988ad3 100644 --- a/test/mainnet/pooltogether/pooltogether.test.ts +++ b/test/mainnet/pooltogether/pooltogether.test.ts @@ -8,7 +8,7 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; import { tokens } from "../../../scripts/constant/tokens"; diff --git a/test/mainnet/uniswap/uniswap.test.ts b/test/mainnet/uniswap/uniswap.test.ts index b123d87a..9b6761b3 100644 --- a/test/mainnet/uniswap/uniswap.test.ts +++ b/test/mainnet/uniswap/uniswap.test.ts @@ -8,7 +8,7 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import type { Signer, Contract } from "ethers"; diff --git a/test/mainnet/uniswapStake/uniswapStake.test.ts b/test/mainnet/uniswapStake/uniswapStake.test.ts index 3d704dcb..0a86080d 100644 --- a/test/mainnet/uniswapStake/uniswapStake.test.ts +++ b/test/mainnet/uniswapStake/uniswapStake.test.ts @@ -9,7 +9,7 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { abi } from "@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json" import type { Signer, Contract } from "ethers"; diff --git a/test/mainnet/yearn/yearn.test.ts b/test/mainnet/yearn/yearn.test.ts index 53a69406..055b22c9 100644 --- a/test/mainnet/yearn/yearn.test.ts +++ b/test/mainnet/yearn/yearn.test.ts @@ -8,7 +8,7 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { tokens } from "../../../scripts/constant/tokens"; import { Signer, Contract, BigNumber } from "ethers"; diff --git a/test/polygon/pooltogether/pooltogether.test.ts b/test/polygon/pooltogether/pooltogether.test.ts index 0b41934f..52b34073 100644 --- a/test/polygon/pooltogether/pooltogether.test.ts +++ b/test/polygon/pooltogether/pooltogether.test.ts @@ -10,7 +10,7 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { tokens } from "../../../scripts/constant/tokens"; import type { Signer, Contract } from "ethers";