diff --git a/.changeset/shaggy-years-invite.md b/.changeset/shaggy-years-invite.md new file mode 100644 index 00000000..ffd0b590 --- /dev/null +++ b/.changeset/shaggy-years-invite.md @@ -0,0 +1,5 @@ +--- +'@protocolink/logics': patch +--- + +replace test-helpers mainnetTokens with common mainnetTokens diff --git a/test/logics/aave-v2/borrow.test.ts b/test/logics/aave-v2/borrow.test.ts index e750bb6d..e960e268 100644 --- a/test/logics/aave-v2/borrow.test.ts +++ b/test/logics/aave-v2/borrow.test.ts @@ -1,6 +1,6 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import * as aavev2 from 'src/logics/aave-v2'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -15,8 +15,8 @@ describe('mainnet-pb: Test AaveV2 Borrow Logic', function () { chainId = await getChainId(); const [, user1, user2] = await hre.ethers.getSigners(); users = [user1, user2]; - await claimToken(chainId, user1.address, mainnetTokens.USDC, '20000'); - await claimToken(chainId, user2.address, mainnetTokens.WETH, '100'); + await claimToken(chainId, user1.address, common.mainnetTokens.USDC, '20000'); + await claimToken(chainId, user2.address, common.mainnetTokens.WETH, '100'); }); snapshotAndRevertEach(); diff --git a/test/logics/aave-v2/deposit.test.ts b/test/logics/aave-v2/deposit.test.ts index 3fe8a765..0f896a08 100644 --- a/test/logics/aave-v2/deposit.test.ts +++ b/test/logics/aave-v2/deposit.test.ts @@ -1,6 +1,6 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import * as aavev2 from 'src/logics/aave-v2'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -14,8 +14,8 @@ describe('mainnet-pb: Test AaveV2 Deposit Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.USDC, '100'); - await claimToken(chainId, user.address, mainnetTokens.WETH, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '100'); }); snapshotAndRevertEach(); diff --git a/test/logics/aave-v2/flash-loan.test.ts b/test/logics/aave-v2/flash-loan.test.ts index 666dd811..c0ee17cc 100644 --- a/test/logics/aave-v2/flash-loan.test.ts +++ b/test/logics/aave-v2/flash-loan.test.ts @@ -1,6 +1,6 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import * as aavev2 from 'src/logics/aave-v2'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -15,10 +15,16 @@ describe('mainnet-pb: Test AaveV2 FlashLoan Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.WETH, '2'); - await claimToken(chainId, user.address, mainnetTokens.USDC, '2'); - await claimToken(chainId, user.address, mainnetTokens.USDT, '2'); - await claimToken(chainId, user.address, mainnetTokens.DAI, '2', '0x8A610c1C93da88c59F51A6264A4c70927814B320'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '2'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '2'); + await claimToken(chainId, user.address, common.mainnetTokens.USDT, '2'); + await claimToken( + chainId, + user.address, + common.mainnetTokens.DAI, + '2', + '0x8A610c1C93da88c59F51A6264A4c70927814B320' + ); }); snapshotAndRevertEach(); diff --git a/test/logics/aave-v2/repay.test.ts b/test/logics/aave-v2/repay.test.ts index 74013194..a5abb908 100644 --- a/test/logics/aave-v2/repay.test.ts +++ b/test/logics/aave-v2/repay.test.ts @@ -1,6 +1,6 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import * as aavev2 from 'src/logics/aave-v2'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -16,10 +16,10 @@ describe('mainnet-pb: Test AaveV2 Repay Logic', function () { chainId = await getChainId(); const [, user1, user2] = await hre.ethers.getSigners(); users = [user1, user2]; - await claimToken(chainId, user1.address, mainnetTokens.USDC, '40000'); - await claimToken(chainId, user1.address, mainnetTokens.WETH, '100'); - await claimToken(chainId, user2.address, mainnetTokens.USDC, '100'); - await claimToken(chainId, user2.address, mainnetTokens.WETH, '100'); + await claimToken(chainId, user1.address, common.mainnetTokens.USDC, '40000'); + await claimToken(chainId, user1.address, common.mainnetTokens.WETH, '100'); + await claimToken(chainId, user2.address, common.mainnetTokens.USDC, '100'); + await claimToken(chainId, user2.address, common.mainnetTokens.WETH, '100'); }); snapshotAndRevertEach(); diff --git a/test/logics/aave-v2/withdraw.test.ts b/test/logics/aave-v2/withdraw.test.ts index 14d9a902..d0cfd0a6 100644 --- a/test/logics/aave-v2/withdraw.test.ts +++ b/test/logics/aave-v2/withdraw.test.ts @@ -1,6 +1,6 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import * as aavev2 from 'src/logics/aave-v2'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -15,8 +15,8 @@ describe('mainnet-pb: Test AaveV2 Withdraw Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.WETH, '100'); - await claimToken(chainId, user.address, mainnetTokens.USDC, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '100'); }); snapshotAndRevertEach(); diff --git a/test/logics/aave-v3/borrow.test.ts b/test/logics/aave-v3/borrow.test.ts index 382866e5..9c3a873f 100644 --- a/test/logics/aave-v3/borrow.test.ts +++ b/test/logics/aave-v3/borrow.test.ts @@ -1,6 +1,6 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import * as aavev3 from 'src/logics/aave-v3'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -15,8 +15,8 @@ describe('mainnet-pb: Test AaveV3 Borrow Logic', function () { chainId = await getChainId(); const [, user1, user2] = await hre.ethers.getSigners(); users = [user1, user2]; - await claimToken(chainId, user1.address, mainnetTokens.USDC, '10000'); - await claimToken(chainId, user2.address, mainnetTokens.WETH, '100'); + await claimToken(chainId, user1.address, common.mainnetTokens.USDC, '10000'); + await claimToken(chainId, user2.address, common.mainnetTokens.WETH, '100'); }); snapshotAndRevertEach(); diff --git a/test/logics/aave-v3/flash-loan.test.ts b/test/logics/aave-v3/flash-loan.test.ts index 29890f2d..82ec7fd4 100644 --- a/test/logics/aave-v3/flash-loan.test.ts +++ b/test/logics/aave-v3/flash-loan.test.ts @@ -1,6 +1,6 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import * as aavev3 from 'src/logics/aave-v3'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -15,11 +15,17 @@ describe('mainnet-pb: Test AaveV3 FlashLoan Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.WETH, '2'); - await claimToken(chainId, user.address, mainnetTokens.USDC, '2'); - await claimToken(chainId, user.address, mainnetTokens.USDT, '2'); - await claimToken(chainId, user.address, mainnetTokens.DAI, '2', '0x8A610c1C93da88c59F51A6264A4c70927814B320'); - await claimToken(chainId, user.address, mainnetTokens.WBTC, '2'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '2'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '2'); + await claimToken(chainId, user.address, common.mainnetTokens.USDT, '2'); + await claimToken( + chainId, + user.address, + common.mainnetTokens.DAI, + '2', + '0x8A610c1C93da88c59F51A6264A4c70927814B320' + ); + await claimToken(chainId, user.address, common.mainnetTokens.WBTC, '2'); }); snapshotAndRevertEach(); diff --git a/test/logics/aave-v3/repay.test.ts b/test/logics/aave-v3/repay.test.ts index 296965bd..39386141 100644 --- a/test/logics/aave-v3/repay.test.ts +++ b/test/logics/aave-v3/repay.test.ts @@ -1,6 +1,6 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import * as aavev3 from 'src/logics/aave-v3'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -16,10 +16,10 @@ describe('mainnet-pb: Test AaveV3 Repay Logic', function () { chainId = await getChainId(); const [, user1, user2] = await hre.ethers.getSigners(); users = [user1, user2]; - await claimToken(chainId, user1.address, mainnetTokens.USDC, '20000'); - await claimToken(chainId, user1.address, mainnetTokens.WETH, '100'); - await claimToken(chainId, user2.address, mainnetTokens.USDC, '100'); - await claimToken(chainId, user2.address, mainnetTokens.WETH, '100'); + await claimToken(chainId, user1.address, common.mainnetTokens.USDC, '20000'); + await claimToken(chainId, user1.address, common.mainnetTokens.WETH, '100'); + await claimToken(chainId, user2.address, common.mainnetTokens.USDC, '100'); + await claimToken(chainId, user2.address, common.mainnetTokens.WETH, '100'); }); snapshotAndRevertEach(); diff --git a/test/logics/aave-v3/supply.test.ts b/test/logics/aave-v3/supply.test.ts index cfe4edb1..1ec4c3f7 100644 --- a/test/logics/aave-v3/supply.test.ts +++ b/test/logics/aave-v3/supply.test.ts @@ -1,6 +1,6 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import * as aavev3 from 'src/logics/aave-v3'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -14,8 +14,8 @@ describe('mainnet-pb: Test AaveV3 Supply Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.USDC, '100'); - await claimToken(chainId, user.address, mainnetTokens.WETH, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '100'); }); snapshotAndRevertEach(); diff --git a/test/logics/aave-v3/withdraw.test.ts b/test/logics/aave-v3/withdraw.test.ts index 9e4cb26c..b15a78a4 100644 --- a/test/logics/aave-v3/withdraw.test.ts +++ b/test/logics/aave-v3/withdraw.test.ts @@ -1,6 +1,6 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import * as aavev3 from 'src/logics/aave-v3'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -15,8 +15,8 @@ describe('mainnet-pb: Test AaveV3 Withdraw Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.WETH, '100'); - await claimToken(chainId, user.address, mainnetTokens.USDC, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '100'); }); snapshotAndRevertEach(); diff --git a/test/logics/balancer-v2/flash-loan.test.ts b/test/logics/balancer-v2/flash-loan.test.ts index 00352163..d0524908 100644 --- a/test/logics/balancer-v2/flash-loan.test.ts +++ b/test/logics/balancer-v2/flash-loan.test.ts @@ -1,6 +1,6 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import * as balancerv2 from 'src/logics/balancer-v2'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -15,19 +15,25 @@ describe('mainnet-pb: Test BalancerV2 FlashLoan Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.WETH, '2'); - await claimToken(chainId, user.address, mainnetTokens.USDC, '2'); - await claimToken(chainId, user.address, mainnetTokens.USDT, '2'); - await claimToken(chainId, user.address, mainnetTokens.DAI, '2', '0x8A610c1C93da88c59F51A6264A4c70927814B320'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '2'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '2'); + await claimToken(chainId, user.address, common.mainnetTokens.USDT, '2'); + await claimToken( + chainId, + user.address, + common.mainnetTokens.DAI, + '2', + '0x8A610c1C93da88c59F51A6264A4c70927814B320' + ); }); snapshotAndRevertEach(); const testCases = [ - { loans: new common.TokenAmounts([mainnetTokens.WETH, '1'], [mainnetTokens.USDC, '1']) }, - { repays: new common.TokenAmounts([mainnetTokens.WETH, '1'], [mainnetTokens.USDC, '1']) }, - { loans: new common.TokenAmounts([mainnetTokens.USDT, '1'], [mainnetTokens.DAI, '1']) }, - { repays: new common.TokenAmounts([mainnetTokens.USDT, '1'], [mainnetTokens.DAI, '1']) }, + { loans: new common.TokenAmounts([common.mainnetTokens.WETH, '1'], [common.mainnetTokens.USDC, '1']) }, + { repays: new common.TokenAmounts([common.mainnetTokens.WETH, '1'], [common.mainnetTokens.USDC, '1']) }, + { loans: new common.TokenAmounts([common.mainnetTokens.USDT, '1'], [common.mainnetTokens.DAI, '1']) }, + { repays: new common.TokenAmounts([common.mainnetTokens.USDT, '1'], [common.mainnetTokens.DAI, '1']) }, ]; testCases.forEach((params, i) => { diff --git a/test/logics/compound-v2/claim.test.ts b/test/logics/compound-v2/claim.test.ts index 6c3f091f..44634561 100644 --- a/test/logics/compound-v2/claim.test.ts +++ b/test/logics/compound-v2/claim.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as compoundv2 from 'src/logics/compound-v2'; import * as core from '@protocolink/core'; @@ -16,8 +16,14 @@ describe('mainnet-pb: Test CompoundV2 Claim Logic', function () { chainId = await getChainId(); const [, user1, user2] = await hre.ethers.getSigners(); users = [user1, user2]; - await claimToken(chainId, user1.address, mainnetTokens.USDC, '5000'); - await claimToken(chainId, user1.address, mainnetTokens.DAI, '5000', '0x8A610c1C93da88c59F51A6264A4c70927814B320'); + await claimToken(chainId, user1.address, common.mainnetTokens.USDC, '5000'); + await claimToken( + chainId, + user1.address, + common.mainnetTokens.DAI, + '5000', + '0x8A610c1C93da88c59F51A6264A4c70927814B320' + ); }); snapshotAndRevertEach(); @@ -27,26 +33,26 @@ describe('mainnet-pb: Test CompoundV2 Claim Logic', function () { { ownerIndex: 0, claimerIndex: 0, - supply: new common.TokenAmount(mainnetTokens.DAI, '1000'), - borrow: new common.TokenAmount(mainnetTokens.USDC, '100'), + supply: new common.TokenAmount(common.mainnetTokens.DAI, '1000'), + borrow: new common.TokenAmount(common.mainnetTokens.USDC, '100'), }, { ownerIndex: 0, claimerIndex: 0, - supply: new common.TokenAmount(mainnetTokens.USDC, '3000'), - borrow: new common.TokenAmount(mainnetTokens.DAI, '100'), + supply: new common.TokenAmount(common.mainnetTokens.USDC, '3000'), + borrow: new common.TokenAmount(common.mainnetTokens.DAI, '100'), }, { ownerIndex: 0, claimerIndex: 1, - supply: new common.TokenAmount(mainnetTokens.DAI, '1000'), - borrow: new common.TokenAmount(mainnetTokens.USDC, '100'), + supply: new common.TokenAmount(common.mainnetTokens.DAI, '1000'), + borrow: new common.TokenAmount(common.mainnetTokens.USDC, '100'), }, { ownerIndex: 0, claimerIndex: 1, - supply: new common.TokenAmount(mainnetTokens.USDC, '3000'), - borrow: new common.TokenAmount(mainnetTokens.DAI, '100'), + supply: new common.TokenAmount(common.mainnetTokens.USDC, '3000'), + borrow: new common.TokenAmount(common.mainnetTokens.DAI, '100'), }, ]; diff --git a/test/logics/compound-v2/repay.test.ts b/test/logics/compound-v2/repay.test.ts index 97aa62f5..fc72830d 100644 --- a/test/logics/compound-v2/repay.test.ts +++ b/test/logics/compound-v2/repay.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as compoundv2 from 'src/logics/compound-v2'; import * as core from '@protocolink/core'; @@ -16,28 +16,34 @@ describe('mainnet-pb: Test CompoundV2 Repay Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.WBTC, '10', '0x9ff58f4ffb29fa2266ab25e75e2a8b3503311656'); + await claimToken( + chainId, + user.address, + common.mainnetTokens.WBTC, + '10', + '0x9ff58f4ffb29fa2266ab25e75e2a8b3503311656' + ); }); snapshotAndRevertEach(); const testCases = [ { - supply: new common.TokenAmount(mainnetTokens.ETH, '100'), - borrow: new common.TokenAmount(mainnetTokens.WBTC, '1'), + supply: new common.TokenAmount(common.mainnetTokens.ETH, '100'), + borrow: new common.TokenAmount(common.mainnetTokens.WBTC, '1'), }, { - supply: new common.TokenAmount(mainnetTokens.WBTC, '1'), - borrow: new common.TokenAmount(mainnetTokens.ETH, '1'), + supply: new common.TokenAmount(common.mainnetTokens.WBTC, '1'), + borrow: new common.TokenAmount(common.mainnetTokens.ETH, '1'), }, { - supply: new common.TokenAmount(mainnetTokens.ETH, '100'), - borrow: new common.TokenAmount(mainnetTokens.WBTC, '1'), + supply: new common.TokenAmount(common.mainnetTokens.ETH, '100'), + borrow: new common.TokenAmount(common.mainnetTokens.WBTC, '1'), balanceBps: 5000, }, { - supply: new common.TokenAmount(mainnetTokens.WBTC, '1'), - borrow: new common.TokenAmount(mainnetTokens.ETH, '1'), + supply: new common.TokenAmount(common.mainnetTokens.WBTC, '1'), + borrow: new common.TokenAmount(common.mainnetTokens.ETH, '1'), balanceBps: 5000, }, ]; diff --git a/test/logics/compound-v2/supply.test.ts b/test/logics/compound-v2/supply.test.ts index 0a42d2e8..4f6bf429 100644 --- a/test/logics/compound-v2/supply.test.ts +++ b/test/logics/compound-v2/supply.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as compoundv2 from 'src/logics/compound-v2'; import * as core from '@protocolink/core'; @@ -14,28 +14,34 @@ describe('mainnet-pb: Test CompoundV2 Supply Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.WBTC, '10', '0x9ff58f4ffb29fa2266ab25e75e2a8b3503311656'); + await claimToken( + chainId, + user.address, + common.mainnetTokens.WBTC, + '10', + '0x9ff58f4ffb29fa2266ab25e75e2a8b3503311656' + ); }); snapshotAndRevertEach(); const testCases = [ { - input: new common.TokenAmount(mainnetTokens.ETH, '1'), - tokenOut: compoundv2.toCToken(mainnetTokens.ETH), + input: new common.TokenAmount(common.mainnetTokens.ETH, '1'), + tokenOut: compoundv2.toCToken(common.mainnetTokens.ETH), }, { - input: new common.TokenAmount(mainnetTokens.WBTC, '1'), - tokenOut: compoundv2.toCToken(mainnetTokens.WBTC), + input: new common.TokenAmount(common.mainnetTokens.WBTC, '1'), + tokenOut: compoundv2.toCToken(common.mainnetTokens.WBTC), }, { - input: new common.TokenAmount(mainnetTokens.ETH, '1'), - tokenOut: compoundv2.toCToken(mainnetTokens.ETH), + input: new common.TokenAmount(common.mainnetTokens.ETH, '1'), + tokenOut: compoundv2.toCToken(common.mainnetTokens.ETH), balanceBps: 5000, }, { - input: new common.TokenAmount(mainnetTokens.WBTC, '1'), - tokenOut: compoundv2.toCToken(mainnetTokens.WBTC), + input: new common.TokenAmount(common.mainnetTokens.WBTC, '1'), + tokenOut: compoundv2.toCToken(common.mainnetTokens.WBTC), balanceBps: 5000, }, ]; diff --git a/test/logics/compound-v2/withdraw.test.ts b/test/logics/compound-v2/withdraw.test.ts index 4f158437..dacf3546 100644 --- a/test/logics/compound-v2/withdraw.test.ts +++ b/test/logics/compound-v2/withdraw.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as compoundv2 from 'src/logics/compound-v2'; import * as core from '@protocolink/core'; @@ -15,28 +15,34 @@ describe('mainnet-pb: Test CompoundV2 Withdraw Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.WBTC, '10', '0x9ff58f4ffb29fa2266ab25e75e2a8b3503311656'); + await claimToken( + chainId, + user.address, + common.mainnetTokens.WBTC, + '10', + '0x9ff58f4ffb29fa2266ab25e75e2a8b3503311656' + ); }); snapshotAndRevertEach(); const testCases = [ { - input: new common.TokenAmount(compoundv2.toCToken(mainnetTokens.ETH), '50'), - tokenOut: mainnetTokens.ETH, + input: new common.TokenAmount(compoundv2.toCToken(common.mainnetTokens.ETH), '50'), + tokenOut: common.mainnetTokens.ETH, }, { - input: new common.TokenAmount(compoundv2.toCToken(mainnetTokens.WBTC), '50'), - tokenOut: mainnetTokens.WBTC, + input: new common.TokenAmount(compoundv2.toCToken(common.mainnetTokens.WBTC), '50'), + tokenOut: common.mainnetTokens.WBTC, }, { - input: new common.TokenAmount(compoundv2.toCToken(mainnetTokens.ETH), '50'), - tokenOut: mainnetTokens.ETH, + input: new common.TokenAmount(compoundv2.toCToken(common.mainnetTokens.ETH), '50'), + tokenOut: common.mainnetTokens.ETH, balanceBps: 5000, }, { - input: new common.TokenAmount(compoundv2.toCToken(mainnetTokens.WBTC), '50'), - tokenOut: mainnetTokens.WBTC, + input: new common.TokenAmount(compoundv2.toCToken(common.mainnetTokens.WBTC), '50'), + tokenOut: common.mainnetTokens.WBTC, balanceBps: 5000, }, ]; diff --git a/test/logics/paraswap-v5/swap-token.test.ts b/test/logics/paraswap-v5/swap-token.test.ts index 85135f01..cb94d677 100644 --- a/test/logics/paraswap-v5/swap-token.test.ts +++ b/test/logics/paraswap-v5/swap-token.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -14,8 +14,8 @@ describe('mainnet: Test ParaswapV5 SwapToken Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.ETH, '100'); - await claimToken(chainId, user.address, mainnetTokens.USDC, '3000'); + await claimToken(chainId, user.address, common.mainnetTokens.ETH, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '3000'); }); snapshotAndRevertEach(); @@ -23,43 +23,43 @@ describe('mainnet: Test ParaswapV5 SwapToken Logic', function () { const testCases = [ { params: { - input: new common.TokenAmount(mainnetTokens.ETH, '1'), - tokenOut: mainnetTokens.USDC, + input: new common.TokenAmount(common.mainnetTokens.ETH, '1'), + tokenOut: common.mainnetTokens.USDC, slippage: 500, }, }, { params: { - input: new common.TokenAmount(mainnetTokens.USDC, '1'), - tokenOut: mainnetTokens.ETH, + input: new common.TokenAmount(common.mainnetTokens.USDC, '1'), + tokenOut: common.mainnetTokens.ETH, slippage: 500, }, }, { params: { - input: new common.TokenAmount(mainnetTokens.USDC, '1'), - tokenOut: mainnetTokens.DAI, + input: new common.TokenAmount(common.mainnetTokens.USDC, '1'), + tokenOut: common.mainnetTokens.DAI, slippage: 500, }, }, { params: { - tokenIn: mainnetTokens.ETH, - output: new common.TokenAmount(mainnetTokens.USDC, '1'), + tokenIn: common.mainnetTokens.ETH, + output: new common.TokenAmount(common.mainnetTokens.USDC, '1'), slippage: 500, }, }, { params: { - tokenIn: mainnetTokens.USDC, - output: new common.TokenAmount(mainnetTokens.ETH, '0.1'), + tokenIn: common.mainnetTokens.USDC, + output: new common.TokenAmount(common.mainnetTokens.ETH, '0.1'), slippage: 500, }, }, { params: { - tokenIn: mainnetTokens.USDC, - output: new common.TokenAmount(mainnetTokens.DAI, '1'), + tokenIn: common.mainnetTokens.USDC, + output: new common.TokenAmount(common.mainnetTokens.DAI, '1'), slippage: 500, }, }, diff --git a/test/logics/permit2/pull-token.test.ts b/test/logics/permit2/pull-token.test.ts index 905a2189..aa94d6c5 100644 --- a/test/logics/permit2/pull-token.test.ts +++ b/test/logics/permit2/pull-token.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -19,18 +19,18 @@ describe('mainnet-pb: Test Permit2 PullToken Logic', function () { routerKit = new core.RouterKit(chainId); agent = await routerKit.calcAgent(user.address); - await claimToken(chainId, user.address, mainnetTokens.USDC, '100'); - await claimToken(chainId, user.address, mainnetTokens.WETH, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '100'); }); snapshotAndRevertEach(); const testCases = [ { - fields: { input: new common.TokenAmount(mainnetTokens.USDC, '1') }, + fields: { input: new common.TokenAmount(common.mainnetTokens.USDC, '1') }, }, { - fields: { input: new common.TokenAmount(mainnetTokens.WETH, '1') }, + fields: { input: new common.TokenAmount(common.mainnetTokens.WETH, '1') }, }, ]; diff --git a/test/logics/radiant-v2/borrow.test.ts b/test/logics/radiant-v2/borrow.test.ts index dbae7a3c..98f54f71 100644 --- a/test/logics/radiant-v2/borrow.test.ts +++ b/test/logics/radiant-v2/borrow.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -15,8 +15,8 @@ describe('mainnet-pb: Test RadiantV2 Borrow Logic', () => { chainId = await getChainId(); const [, user1, user2] = await hre.ethers.getSigners(); users = [user1, user2]; - await claimToken(chainId, user1.address, mainnetTokens.USDC, '20000'); - await claimToken(chainId, user2.address, mainnetTokens.WETH, '100'); + await claimToken(chainId, user1.address, common.mainnetTokens.USDC, '20000'); + await claimToken(chainId, user2.address, common.mainnetTokens.WETH, '100'); }); snapshotAndRevertEach(); @@ -24,26 +24,26 @@ describe('mainnet-pb: Test RadiantV2 Borrow Logic', () => { const testCases = [ { userIndex: 0, - deposit: new common.TokenAmount(mainnetTokens.USDC, '5000'), - output: new common.TokenAmount(mainnetTokens.WETH, '1'), + deposit: new common.TokenAmount(common.mainnetTokens.USDC, '5000'), + output: new common.TokenAmount(common.mainnetTokens.WETH, '1'), interestRateMode: radiantv2.InterestRateMode.variable, }, { userIndex: 0, - deposit: new common.TokenAmount(mainnetTokens.USDC, '5000'), - output: new common.TokenAmount(mainnetTokens.ETH, '1'), + deposit: new common.TokenAmount(common.mainnetTokens.USDC, '5000'), + output: new common.TokenAmount(common.mainnetTokens.ETH, '1'), interestRateMode: radiantv2.InterestRateMode.variable, }, { userIndex: 1, - deposit: new common.TokenAmount(mainnetTokens.WETH, '1'), - output: new common.TokenAmount(mainnetTokens.USDC, '1'), + deposit: new common.TokenAmount(common.mainnetTokens.WETH, '1'), + output: new common.TokenAmount(common.mainnetTokens.USDC, '1'), interestRateMode: radiantv2.InterestRateMode.variable, }, { userIndex: 1, - deposit: new common.TokenAmount(mainnetTokens.WETH, '1'), - output: new common.TokenAmount(mainnetTokens.USDT, '10'), + deposit: new common.TokenAmount(common.mainnetTokens.WETH, '1'), + output: new common.TokenAmount(common.mainnetTokens.USDT, '10'), interestRateMode: radiantv2.InterestRateMode.variable, }, ]; diff --git a/test/logics/radiant-v2/deposit.test.ts b/test/logics/radiant-v2/deposit.test.ts index 89eab4a9..c70bba0b 100644 --- a/test/logics/radiant-v2/deposit.test.ts +++ b/test/logics/radiant-v2/deposit.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -14,37 +14,37 @@ describe('mainnet-pb: Test RadiantV2 Deposit Logic', () => { before(async () => { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.USDC, '100'); - await claimToken(chainId, user.address, mainnetTokens.WETH, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '100'); }); snapshotAndRevertEach(); const testCases = [ { - input: new common.TokenAmount(mainnetTokens.ETH, '1'), + input: new common.TokenAmount(common.mainnetTokens.ETH, '1'), tokenOut: radiantv2.mainnetTokens.rWETH, }, { - input: new common.TokenAmount(mainnetTokens.WETH, '1'), + input: new common.TokenAmount(common.mainnetTokens.WETH, '1'), tokenOut: radiantv2.mainnetTokens.rWETH, }, { - input: new common.TokenAmount(mainnetTokens.USDC, '1'), + input: new common.TokenAmount(common.mainnetTokens.USDC, '1'), tokenOut: radiantv2.mainnetTokens.rUSDC, }, { - input: new common.TokenAmount(mainnetTokens.ETH, '1'), + input: new common.TokenAmount(common.mainnetTokens.ETH, '1'), tokenOut: radiantv2.mainnetTokens.rWETH, balanceBps: 5000, }, { - input: new common.TokenAmount(mainnetTokens.WETH, '1'), + input: new common.TokenAmount(common.mainnetTokens.WETH, '1'), tokenOut: radiantv2.mainnetTokens.rWETH, balanceBps: 5000, }, { - input: new common.TokenAmount(mainnetTokens.USDC, '1'), + input: new common.TokenAmount(common.mainnetTokens.USDC, '1'), tokenOut: radiantv2.mainnetTokens.rUSDC, balanceBps: 5000, }, diff --git a/test/logics/radiant-v2/flash-loan.test.ts b/test/logics/radiant-v2/flash-loan.test.ts index 24b595d7..4a08f8a4 100644 --- a/test/logics/radiant-v2/flash-loan.test.ts +++ b/test/logics/radiant-v2/flash-loan.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -15,19 +15,19 @@ describe('mainnet-pb: Test RadiantV2 FlashLoan Logic', () => { before(async () => { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.WETH, '2'); - await claimToken(chainId, user.address, mainnetTokens.USDC, '2'); - await claimToken(chainId, user.address, mainnetTokens.USDT, '2'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '2'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '2'); + await claimToken(chainId, user.address, common.mainnetTokens.USDT, '2'); await claimToken(chainId, user.address, radiantv2.mainnetTokens.wstETH, '2'); }); snapshotAndRevertEach(); const testCases = [ - { loans: new common.TokenAmounts([mainnetTokens.WETH, '1'], [mainnetTokens.USDC, '1']) }, - { repays: new common.TokenAmounts([mainnetTokens.WETH, '1'], [mainnetTokens.USDC, '1']) }, - { loans: new common.TokenAmounts([mainnetTokens.USDT, '1'], [radiantv2.mainnetTokens.wstETH, '1']) }, - { repays: new common.TokenAmounts([mainnetTokens.USDT, '1'], [radiantv2.mainnetTokens.wstETH, '1']) }, + { loans: new common.TokenAmounts([common.mainnetTokens.WETH, '1'], [common.mainnetTokens.USDC, '1']) }, + { repays: new common.TokenAmounts([common.mainnetTokens.WETH, '1'], [common.mainnetTokens.USDC, '1']) }, + { loans: new common.TokenAmounts([common.mainnetTokens.USDT, '1'], [radiantv2.mainnetTokens.wstETH, '1']) }, + { repays: new common.TokenAmounts([common.mainnetTokens.USDT, '1'], [radiantv2.mainnetTokens.wstETH, '1']) }, ]; testCases.forEach((params, i) => { diff --git a/test/logics/radiant-v2/repay.test.ts b/test/logics/radiant-v2/repay.test.ts index f90a5f97..81a7f89f 100644 --- a/test/logics/radiant-v2/repay.test.ts +++ b/test/logics/radiant-v2/repay.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -16,10 +16,10 @@ describe('mainnet-pb: Test RadiantV2 Repay Logic', () => { chainId = await getChainId(); const [, user1, user2] = await hre.ethers.getSigners(); users = [user1, user2]; - await claimToken(chainId, user1.address, mainnetTokens.USDC, '40000'); - await claimToken(chainId, user1.address, mainnetTokens.WETH, '100'); - await claimToken(chainId, user2.address, mainnetTokens.USDC, '100'); - await claimToken(chainId, user2.address, mainnetTokens.WETH, '100'); + await claimToken(chainId, user1.address, common.mainnetTokens.USDC, '40000'); + await claimToken(chainId, user1.address, common.mainnetTokens.WETH, '100'); + await claimToken(chainId, user2.address, common.mainnetTokens.USDC, '100'); + await claimToken(chainId, user2.address, common.mainnetTokens.WETH, '100'); }); snapshotAndRevertEach(); @@ -27,40 +27,40 @@ describe('mainnet-pb: Test RadiantV2 Repay Logic', () => { const testCases = [ { userIndex: 0, - deposit: new common.TokenAmount(mainnetTokens.USDC, '5000'), - borrow: new common.TokenAmount(mainnetTokens.ETH, '1'), + deposit: new common.TokenAmount(common.mainnetTokens.USDC, '5000'), + borrow: new common.TokenAmount(common.mainnetTokens.ETH, '1'), interestRateMode: radiantv2.InterestRateMode.variable, }, { userIndex: 0, - deposit: new common.TokenAmount(mainnetTokens.USDC, '5000'), - borrow: new common.TokenAmount(mainnetTokens.WETH, '1'), + deposit: new common.TokenAmount(common.mainnetTokens.USDC, '5000'), + borrow: new common.TokenAmount(common.mainnetTokens.WETH, '1'), interestRateMode: radiantv2.InterestRateMode.variable, }, { userIndex: 1, - deposit: new common.TokenAmount(mainnetTokens.WETH, '1'), - borrow: new common.TokenAmount(mainnetTokens.USDC, '1'), + deposit: new common.TokenAmount(common.mainnetTokens.WETH, '1'), + borrow: new common.TokenAmount(common.mainnetTokens.USDC, '1'), interestRateMode: radiantv2.InterestRateMode.variable, }, { userIndex: 0, - deposit: new common.TokenAmount(mainnetTokens.USDC, '5000'), - borrow: new common.TokenAmount(mainnetTokens.ETH, '1'), + deposit: new common.TokenAmount(common.mainnetTokens.USDC, '5000'), + borrow: new common.TokenAmount(common.mainnetTokens.ETH, '1'), interestRateMode: radiantv2.InterestRateMode.variable, balanceBps: 5000, }, { userIndex: 0, - deposit: new common.TokenAmount(mainnetTokens.USDC, '5000'), - borrow: new common.TokenAmount(mainnetTokens.WETH, '1'), + deposit: new common.TokenAmount(common.mainnetTokens.USDC, '5000'), + borrow: new common.TokenAmount(common.mainnetTokens.WETH, '1'), interestRateMode: radiantv2.InterestRateMode.variable, balanceBps: 5000, }, { userIndex: 1, - deposit: new common.TokenAmount(mainnetTokens.WETH, '1'), - borrow: new common.TokenAmount(mainnetTokens.USDC, '1'), + deposit: new common.TokenAmount(common.mainnetTokens.WETH, '1'), + borrow: new common.TokenAmount(common.mainnetTokens.USDC, '1'), interestRateMode: radiantv2.InterestRateMode.variable, balanceBps: 5000, }, diff --git a/test/logics/radiant-v2/withdraw.test.ts b/test/logics/radiant-v2/withdraw.test.ts index ddd88b02..f522f975 100644 --- a/test/logics/radiant-v2/withdraw.test.ts +++ b/test/logics/radiant-v2/withdraw.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -15,8 +15,8 @@ describe('mainnet-pb: Test RadiantV2 Withdraw Logic', () => { before(async () => { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.WETH, '100'); - await claimToken(chainId, user.address, mainnetTokens.USDC, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '100'); }); snapshotAndRevertEach(); @@ -24,29 +24,29 @@ describe('mainnet-pb: Test RadiantV2 Withdraw Logic', () => { const testCases = [ { input: new common.TokenAmount(radiantv2.mainnetTokens.rWETH, '1'), - tokenOut: mainnetTokens.ETH, + tokenOut: common.mainnetTokens.ETH, }, { input: new common.TokenAmount(radiantv2.mainnetTokens.rWETH, '1'), - tokenOut: mainnetTokens.WETH, + tokenOut: common.mainnetTokens.WETH, }, { input: new common.TokenAmount(radiantv2.mainnetTokens.rUSDC, '1'), - tokenOut: mainnetTokens.USDC, + tokenOut: common.mainnetTokens.USDC, }, { input: new common.TokenAmount(radiantv2.mainnetTokens.rWETH, '1'), - tokenOut: mainnetTokens.ETH, + tokenOut: common.mainnetTokens.ETH, balanceBps: 5000, }, { input: new common.TokenAmount(radiantv2.mainnetTokens.rWETH, '1'), - tokenOut: mainnetTokens.WETH, + tokenOut: common.mainnetTokens.WETH, balanceBps: 5000, }, { input: new common.TokenAmount(radiantv2.mainnetTokens.rUSDC, '1'), - tokenOut: mainnetTokens.USDC, + tokenOut: common.mainnetTokens.USDC, balanceBps: 5000, }, ]; diff --git a/test/logics/spark/flash-loan.test.ts b/test/logics/spark/flash-loan.test.ts index bd99d5d6..e8de0213 100644 --- a/test/logics/spark/flash-loan.test.ts +++ b/test/logics/spark/flash-loan.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -15,19 +15,25 @@ describe('mainnet-pb: Test Spark FlashLoan Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.WETH, '2'); - await claimToken(chainId, user.address, mainnetTokens.USDC, '2'); - await claimToken(chainId, user.address, mainnetTokens.USDT, '2'); - await claimToken(chainId, user.address, mainnetTokens.DAI, '2', '0x8A610c1C93da88c59F51A6264A4c70927814B320'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '2'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '2'); + await claimToken(chainId, user.address, common.mainnetTokens.USDT, '2'); + await claimToken( + chainId, + user.address, + common.mainnetTokens.DAI, + '2', + '0x8A610c1C93da88c59F51A6264A4c70927814B320' + ); }); snapshotAndRevertEach(); const testCases = [ - { loans: new common.TokenAmounts([mainnetTokens.WETH, '1'], [mainnetTokens.USDC, '1']) }, - { repays: new common.TokenAmounts([mainnetTokens.WETH, '1'], [mainnetTokens.USDC, '1']) }, - { loans: new common.TokenAmounts([mainnetTokens.USDT, '1'], [mainnetTokens.DAI, '1']) }, - { repays: new common.TokenAmounts([mainnetTokens.USDT, '1'], [mainnetTokens.DAI, '1']) }, + { loans: new common.TokenAmounts([common.mainnetTokens.WETH, '1'], [common.mainnetTokens.USDC, '1']) }, + { repays: new common.TokenAmounts([common.mainnetTokens.WETH, '1'], [common.mainnetTokens.USDC, '1']) }, + { loans: new common.TokenAmounts([common.mainnetTokens.USDT, '1'], [common.mainnetTokens.DAI, '1']) }, + { repays: new common.TokenAmounts([common.mainnetTokens.USDT, '1'], [common.mainnetTokens.DAI, '1']) }, ]; testCases.forEach((params, i) => { diff --git a/test/logics/spark/supply.test.ts b/test/logics/spark/supply.test.ts index e4576ab8..217b2842 100644 --- a/test/logics/spark/supply.test.ts +++ b/test/logics/spark/supply.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -14,8 +14,8 @@ describe('mainnet-pb: Test Spark Supply Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.USDC, '100'); - await claimToken(chainId, user.address, mainnetTokens.WETH, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '100'); }); snapshotAndRevertEach(); diff --git a/test/logics/spark/withdraw.test.ts b/test/logics/spark/withdraw.test.ts index 55c600f2..4f6a8ca8 100644 --- a/test/logics/spark/withdraw.test.ts +++ b/test/logics/spark/withdraw.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -15,8 +15,8 @@ describe('mainnet-pb: Test Spark Withdraw Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.WETH, '100'); - await claimToken(chainId, user.address, mainnetTokens.USDC, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '100'); }); snapshotAndRevertEach(); diff --git a/test/logics/stargate/swap-token.test.ts b/test/logics/stargate/swap-token.test.ts index ed0f6637..6b33f072 100644 --- a/test/logics/stargate/swap-token.test.ts +++ b/test/logics/stargate/swap-token.test.ts @@ -5,7 +5,7 @@ import * as core from '@protocolink/core'; import { expect } from 'chai'; import { getNativeToken } from '@protocolink/common'; import hre from 'hardhat'; -import { mainnetTokens, optimismTokens } from 'src/logics/stargate'; +import { optimismTokens } from 'src/logics/stargate'; import * as stargate from 'src/logics/stargate'; import * as utils from 'test/utils'; @@ -16,9 +16,15 @@ describe('mainnet: Test Stargate SwapToken Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.USDC, '5000'); - await claimToken(chainId, user.address, mainnetTokens.DAI, '500'); - await claimToken(chainId, user.address, mainnetTokens.STG, '10', '0x65bb797c2B9830d891D87288F029ed8dACc19705'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '5000'); + await claimToken(chainId, user.address, common.mainnetTokens.DAI, '500'); + await claimToken( + chainId, + user.address, + common.mainnetTokens.STG, + '10', + '0x65bb797c2B9830d891D87288F029ed8dACc19705' + ); }); snapshotAndRevertEach(); @@ -26,35 +32,35 @@ describe('mainnet: Test Stargate SwapToken Logic', function () { const testCases = [ { params: { - input: new common.TokenAmount(mainnetTokens.ETH, '1'), + input: new common.TokenAmount(common.mainnetTokens.ETH, '1'), tokenOut: optimismTokens.ETH, slippage: 500, }, }, { params: { - input: new common.TokenAmount(mainnetTokens.USDC, '100'), + input: new common.TokenAmount(common.mainnetTokens.USDC, '100'), tokenOut: optimismTokens['USDC.e'], slippage: 500, }, }, { params: { - input: new common.TokenAmount(mainnetTokens.DAI, '100'), + input: new common.TokenAmount(common.mainnetTokens.DAI, '100'), tokenOut: optimismTokens.DAI, slippage: 500, }, }, { params: { - input: new common.TokenAmount(mainnetTokens.STG, '1'), + input: new common.TokenAmount(common.mainnetTokens.STG, '1'), tokenOut: optimismTokens.STG, slippage: 500, }, }, { params: { - input: new common.TokenAmount(mainnetTokens.STG, '1'), + input: new common.TokenAmount(common.mainnetTokens.STG, '1'), tokenOut: optimismTokens.STG, slippage: 500, }, diff --git a/test/logics/uniswap-v3/swap-token.test.ts b/test/logics/uniswap-v3/swap-token.test.ts index af473b34..db717ebb 100644 --- a/test/logics/uniswap-v3/swap-token.test.ts +++ b/test/logics/uniswap-v3/swap-token.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -14,7 +14,7 @@ describe('mainnet-pb: Test UniswapV3 SwapToken Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.USDC, '5000'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '5000'); }); snapshotAndRevertEach(); @@ -22,67 +22,67 @@ describe('mainnet-pb: Test UniswapV3 SwapToken Logic', function () { const testCases = [ { params: { - input: new common.TokenAmount(mainnetTokens.ETH, '1'), - tokenOut: mainnetTokens.USDC, + input: new common.TokenAmount(common.mainnetTokens.ETH, '1'), + tokenOut: common.mainnetTokens.USDC, slippage: 5000, }, }, { params: { - input: new common.TokenAmount(mainnetTokens.USDC, '1'), - tokenOut: mainnetTokens.ETH, + input: new common.TokenAmount(common.mainnetTokens.USDC, '1'), + tokenOut: common.mainnetTokens.ETH, slippage: 5000, }, }, { params: { - input: new common.TokenAmount(mainnetTokens.USDC, '1000'), - tokenOut: mainnetTokens.DAI, + input: new common.TokenAmount(common.mainnetTokens.USDC, '1000'), + tokenOut: common.mainnetTokens.DAI, slippage: 5000, }, }, { params: { - input: new common.TokenAmount(mainnetTokens.ETH, '1'), - tokenOut: mainnetTokens.USDC, + input: new common.TokenAmount(common.mainnetTokens.ETH, '1'), + tokenOut: common.mainnetTokens.USDC, slippage: 5000, }, balanceBps: 5000, }, { params: { - input: new common.TokenAmount(mainnetTokens.USDC, '1'), - tokenOut: mainnetTokens.ETH, + input: new common.TokenAmount(common.mainnetTokens.USDC, '1'), + tokenOut: common.mainnetTokens.ETH, slippage: 5000, }, balanceBps: 5000, }, { params: { - input: new common.TokenAmount(mainnetTokens.USDC, '1000'), - tokenOut: mainnetTokens.DAI, + input: new common.TokenAmount(common.mainnetTokens.USDC, '1000'), + tokenOut: common.mainnetTokens.DAI, slippage: 5000, }, balanceBps: 5000, }, { params: { - tokenIn: mainnetTokens.ETH, - output: new common.TokenAmount(mainnetTokens.USDC, '1000'), + tokenIn: common.mainnetTokens.ETH, + output: new common.TokenAmount(common.mainnetTokens.USDC, '1000'), slippage: 5000, }, }, { params: { - tokenIn: mainnetTokens.USDC, - output: new common.TokenAmount(mainnetTokens.ETH, '0.001'), + tokenIn: common.mainnetTokens.USDC, + output: new common.TokenAmount(common.mainnetTokens.ETH, '0.001'), slippage: 5000, }, }, { params: { - tokenIn: mainnetTokens.USDC, - output: new common.TokenAmount(mainnetTokens.DAI, '1000'), + tokenIn: common.mainnetTokens.USDC, + output: new common.TokenAmount(common.mainnetTokens.DAI, '1000'), slippage: 5000, }, }, diff --git a/test/logics/utility/custom-data.test.ts b/test/logics/utility/custom-data.test.ts index 44bc720e..df397fb1 100644 --- a/test/logics/utility/custom-data.test.ts +++ b/test/logics/utility/custom-data.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { approve, claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { approve, claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -16,15 +16,15 @@ describe('mainnet-pb: Test Utility CustomData Logic', function () { chainId = await getChainId(); [, user1, user2] = await hre.ethers.getSigners(); routerKit = new core.RouterKit(chainId); - await claimToken(chainId, user1.address, mainnetTokens.USDC, '1000'); + await claimToken(chainId, user1.address, common.mainnetTokens.USDC, '1000'); }); snapshotAndRevertEach(); it('case 1: erc20 transferFrom', async function () { // 1. new transferFrom to, data - const input = new common.TokenAmount(mainnetTokens.USDC, '1'); - const to = mainnetTokens.USDC.address; + const input = new common.TokenAmount(common.mainnetTokens.USDC, '1'); + const to = common.mainnetTokens.USDC.address; const data = common.ERC20__factory.createInterface().encodeFunctionData('transferFrom', [ user1.address, user2.address, diff --git a/test/logics/utility/flash-loan-aggregrator.test.ts b/test/logics/utility/flash-loan-aggregrator.test.ts index c691750f..0049bc86 100644 --- a/test/logics/utility/flash-loan-aggregrator.test.ts +++ b/test/logics/utility/flash-loan-aggregrator.test.ts @@ -1,6 +1,6 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import { aavev3, morphoblue } from 'src/logics'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -16,8 +16,8 @@ describe('mainnet-pb: Test Utility FlashLoanAggregator Logic', function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); await claimToken(chainId, user.address, aavev3.mainnetTokens['1INCH'], '2'); - await claimToken(chainId, user.address, mainnetTokens.WETH, '2'); - await claimToken(chainId, user.address, mainnetTokens.USDC, '2'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '2'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '2'); await claimToken(chainId, user.address, morphoblue.mainnetTokens.wstETH, '2'); }); @@ -28,15 +28,21 @@ describe('mainnet-pb: Test Utility FlashLoanAggregator Logic', function () { { loans: new common.TokenAmounts([morphoblue.mainnetTokens.wstETH, '0.01']) }, { repays: new common.TokenAmounts([morphoblue.mainnetTokens.wstETH, '0.01']) }, // balancer-v2 - { loans: new common.TokenAmounts([mainnetTokens.WETH, '1'], [mainnetTokens.USDC, '1']) }, - { repays: new common.TokenAmounts([mainnetTokens.WETH, '1'], [mainnetTokens.USDC, '1']) }, - { loans: new common.TokenAmounts([mainnetTokens.WETH, '0.01'], [morphoblue.mainnetTokens.wstETH, '0.01']) }, - { repays: new common.TokenAmounts([mainnetTokens.WETH, '0.01'], [morphoblue.mainnetTokens.wstETH, '0.01']) }, + { loans: new common.TokenAmounts([common.mainnetTokens.WETH, '1'], [common.mainnetTokens.USDC, '1']) }, + { repays: new common.TokenAmounts([common.mainnetTokens.WETH, '1'], [common.mainnetTokens.USDC, '1']) }, + { loans: new common.TokenAmounts([common.mainnetTokens.WETH, '0.01'], [morphoblue.mainnetTokens.wstETH, '0.01']) }, + { repays: new common.TokenAmounts([common.mainnetTokens.WETH, '0.01'], [morphoblue.mainnetTokens.wstETH, '0.01']) }, // aave-v3 { loans: new common.TokenAmounts([aavev3.mainnetTokens['1INCH'], '1'], [aavev3.mainnetTokens.USDC, '1']) }, { repays: new common.TokenAmounts([aavev3.mainnetTokens['1INCH'], '1'], [aavev3.mainnetTokens.USDC, '1']) }, - { protocolId: 'aave-v3', loans: new common.TokenAmounts([mainnetTokens.WETH, '1'], [mainnetTokens.USDC, '1']) }, - { protocolId: 'aave-v3', repays: new common.TokenAmounts([mainnetTokens.WETH, '1'], [mainnetTokens.USDC, '1']) }, + { + protocolId: 'aave-v3', + loans: new common.TokenAmounts([common.mainnetTokens.WETH, '1'], [common.mainnetTokens.USDC, '1']), + }, + { + protocolId: 'aave-v3', + repays: new common.TokenAmounts([common.mainnetTokens.WETH, '1'], [common.mainnetTokens.USDC, '1']), + }, ]; testCases.forEach((params, i) => { diff --git a/test/logics/utility/multi-send.test.ts b/test/logics/utility/multi-send.test.ts index 1816e6cb..6c7cb600 100644 --- a/test/logics/utility/multi-send.test.ts +++ b/test/logics/utility/multi-send.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -15,9 +15,15 @@ describe('mainnet-pb: Test Utility MultiSend Logic', function () { before(async function () { chainId = await getChainId(); [, user, recipients[0], recipients[1], recipients[2]] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.WETH, '100'); - await claimToken(chainId, user.address, mainnetTokens.USDC, '100'); - await claimToken(chainId, user.address, mainnetTokens.DAI, '100', '0x8A610c1C93da88c59F51A6264A4c70927814B320'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '100'); + await claimToken( + chainId, + user.address, + common.mainnetTokens.DAI, + '100', + '0x8A610c1C93da88c59F51A6264A4c70927814B320' + ); }); snapshotAndRevertEach(); @@ -26,15 +32,15 @@ describe('mainnet-pb: Test Utility MultiSend Logic', function () { { fields: [ { - input: new common.TokenAmount(mainnetTokens.WETH, '1'), + input: new common.TokenAmount(common.mainnetTokens.WETH, '1'), recipientIndex: 0, }, { - input: new common.TokenAmount(mainnetTokens.USDC, '1'), + input: new common.TokenAmount(common.mainnetTokens.USDC, '1'), recipientIndex: 1, }, { - input: new common.TokenAmount(mainnetTokens.DAI, '1'), + input: new common.TokenAmount(common.mainnetTokens.DAI, '1'), recipientIndex: 2, }, ], @@ -42,17 +48,17 @@ describe('mainnet-pb: Test Utility MultiSend Logic', function () { { fields: [ { - input: new common.TokenAmount(mainnetTokens.WETH, '1'), + input: new common.TokenAmount(common.mainnetTokens.WETH, '1'), recipientIndex: 0, balanceBps: 5000, }, { - input: new common.TokenAmount(mainnetTokens.USDC, '1'), + input: new common.TokenAmount(common.mainnetTokens.USDC, '1'), recipientIndex: 1, balanceBps: 5000, }, { - input: new common.TokenAmount(mainnetTokens.DAI, '1'), + input: new common.TokenAmount(common.mainnetTokens.DAI, '1'), recipientIndex: 2, balanceBps: 5000, }, diff --git a/test/logics/utility/send-token.test.ts b/test/logics/utility/send-token.test.ts index 49f48d13..27e98691 100644 --- a/test/logics/utility/send-token.test.ts +++ b/test/logics/utility/send-token.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -15,19 +15,19 @@ describe('mainnet-pb: Test Utility SendToken Logic', function () { before(async function () { chainId = await getChainId(); [, user1, user2] = await hre.ethers.getSigners(); - await claimToken(chainId, user1.address, mainnetTokens.WETH, '100'); - await claimToken(chainId, user1.address, mainnetTokens.USDC, '100'); + await claimToken(chainId, user1.address, common.mainnetTokens.WETH, '100'); + await claimToken(chainId, user1.address, common.mainnetTokens.USDC, '100'); }); snapshotAndRevertEach(); const testCases = [ - { input: new common.TokenAmount(mainnetTokens.ETH, '1') }, - { input: new common.TokenAmount(mainnetTokens.WETH, '1') }, - { input: new common.TokenAmount(mainnetTokens.USDC, '1') }, - { input: new common.TokenAmount(mainnetTokens.ETH, '1'), balanceBps: 5000 }, - { input: new common.TokenAmount(mainnetTokens.WETH, '1'), balanceBps: 5000 }, - { input: new common.TokenAmount(mainnetTokens.USDC, '1'), balanceBps: 5000 }, + { input: new common.TokenAmount(common.mainnetTokens.ETH, '1') }, + { input: new common.TokenAmount(common.mainnetTokens.WETH, '1') }, + { input: new common.TokenAmount(common.mainnetTokens.USDC, '1') }, + { input: new common.TokenAmount(common.mainnetTokens.ETH, '1'), balanceBps: 5000 }, + { input: new common.TokenAmount(common.mainnetTokens.WETH, '1'), balanceBps: 5000 }, + { input: new common.TokenAmount(common.mainnetTokens.USDC, '1'), balanceBps: 5000 }, ]; testCases.forEach(({ input, balanceBps }, i) => { diff --git a/test/logics/utility/wrapped-native-token.test.ts b/test/logics/utility/wrapped-native-token.test.ts index 250f8f43..f24d35a6 100644 --- a/test/logics/utility/wrapped-native-token.test.ts +++ b/test/logics/utility/wrapped-native-token.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; import { expect } from 'chai'; @@ -14,17 +14,25 @@ describe('mainnet-pb: Test Utility WrappedNativeToken Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.ETH, '100'); - await claimToken(chainId, user.address, mainnetTokens.WETH, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.ETH, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '100'); }); snapshotAndRevertEach(); const testCases = [ - { input: new common.TokenAmount(mainnetTokens.ETH, '1'), tokenOut: mainnetTokens.WETH }, - { input: new common.TokenAmount(mainnetTokens.WETH, '1'), tokenOut: mainnetTokens.ETH }, - { input: new common.TokenAmount(mainnetTokens.ETH, '1'), tokenOut: mainnetTokens.WETH, balanceBps: 5000 }, - { input: new common.TokenAmount(mainnetTokens.WETH, '1'), tokenOut: mainnetTokens.ETH, balanceBps: 5000 }, + { input: new common.TokenAmount(common.mainnetTokens.ETH, '1'), tokenOut: common.mainnetTokens.WETH }, + { input: new common.TokenAmount(common.mainnetTokens.WETH, '1'), tokenOut: common.mainnetTokens.ETH }, + { + input: new common.TokenAmount(common.mainnetTokens.ETH, '1'), + tokenOut: common.mainnetTokens.WETH, + balanceBps: 5000, + }, + { + input: new common.TokenAmount(common.mainnetTokens.WETH, '1'), + tokenOut: common.mainnetTokens.ETH, + balanceBps: 5000, + }, ]; testCases.forEach(({ input, tokenOut, balanceBps }, i) => { diff --git a/test/logics/zeroex-v4/swap-token.test.ts b/test/logics/zeroex-v4/swap-token.test.ts index 75f25634..8b88b6fb 100644 --- a/test/logics/zeroex-v4/swap-token.test.ts +++ b/test/logics/zeroex-v4/swap-token.test.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { claimToken, getChainId, mainnetTokens, snapshotAndRevertEach } from '@protocolink/test-helpers'; +import { claimToken, getChainId, snapshotAndRevertEach } from '@protocolink/test-helpers'; import hre from 'hardhat'; import * as common from '@protocolink/common'; import * as core from '@protocolink/core'; @@ -16,9 +16,9 @@ describe('mainnet: Test ZeroExV4 SwapToken Logic', function () { before(async function () { chainId = await getChainId(); [, user] = await hre.ethers.getSigners(); - await claimToken(chainId, user.address, mainnetTokens.ETH, '100'); - await claimToken(chainId, user.address, mainnetTokens.USDC, '3000'); - await claimToken(chainId, user.address, mainnetTokens.WETH, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.ETH, '100'); + await claimToken(chainId, user.address, common.mainnetTokens.USDC, '3000'); + await claimToken(chainId, user.address, common.mainnetTokens.WETH, '100'); }); snapshotAndRevertEach(); @@ -26,40 +26,40 @@ describe('mainnet: Test ZeroExV4 SwapToken Logic', function () { const testCases = [ { params: { - input: new common.TokenAmount(mainnetTokens.ETH, '1'), - tokenOut: mainnetTokens.USDC, + input: new common.TokenAmount(common.mainnetTokens.ETH, '1'), + tokenOut: common.mainnetTokens.USDC, slippage: 100, apiKey, }, }, { params: { - input: new common.TokenAmount(mainnetTokens.USDC, '1'), - tokenOut: mainnetTokens.ETH, + input: new common.TokenAmount(common.mainnetTokens.USDC, '1'), + tokenOut: common.mainnetTokens.ETH, slippage: 500, apiKey, }, }, { params: { - input: new common.TokenAmount(mainnetTokens.USDC, '1'), - tokenOut: mainnetTokens.DAI, + input: new common.TokenAmount(common.mainnetTokens.USDC, '1'), + tokenOut: common.mainnetTokens.DAI, slippage: 500, apiKey, }, }, { params: { - input: new common.TokenAmount(mainnetTokens.WETH, '1'), - tokenOut: mainnetTokens.ETH, + input: new common.TokenAmount(common.mainnetTokens.WETH, '1'), + tokenOut: common.mainnetTokens.ETH, slippage: 0, apiKey, }, }, { params: { - input: new common.TokenAmount(mainnetTokens.ETH, '1'), - tokenOut: mainnetTokens.WETH, + input: new common.TokenAmount(common.mainnetTokens.ETH, '1'), + tokenOut: common.mainnetTokens.WETH, slippage: 0, apiKey, },