diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000..a588d6d0c --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,22 @@ +name: CI +on: push + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node: ['16.x'] + name: Node ${{ matrix.node }} sample + steps: + - uses: actions/checkout@v2 + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + + - name: Install Dependencies + run: yarn + + - name: Run Eslint checks + run: yarn check:es diff --git a/README.md b/README.md index c4f62d38f..723826186 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ParaSwap DexLib +# ParaSwap DexLib [![CI](https://github.com/paraswap/paraswap-dex-lib/actions/workflows/ci.yaml/badge.svg?branch=master)](https://github.com/paraswap/paraswap-dex-lib/actions/workflows/ci.yaml) **DexLib** is a library used by ParaSwap backend to integrate with decentralized exchanges. This library enables external DEX developers to integrate their DEX with ParaSwap by creating pull requests to this repository. diff --git a/package.json b/package.json index 5766eabb3..333fd33ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@paraswap/dex-lib", - "version": "2.9.56", + "version": "2.9.57", "main": "build/index.js", "types": "build/index.d.ts", "repository": "https://github.com/paraswap/paraswap-dex-lib", diff --git a/src/dex/balancer-v2/LinearPool.ts b/src/dex/balancer-v2/LinearPool.ts index 1ae8a6379..81a829012 100644 --- a/src/dex/balancer-v2/LinearPool.ts +++ b/src/dex/balancer-v2/LinearPool.ts @@ -346,11 +346,6 @@ export class LinearPool extends BasePool { target: pool.address, callData: this.poolInterface.encodeFunctionData('getScalingFactors'), }); - //getScalingFactors does not include the rate for the phantom bpt, need to fetch it separately - poolCallData.push({ - target: pool.address, - callData: this.poolInterface.encodeFunctionData('getRate'), - }); // returns lowerTarget, upperTarget poolCallData.push({ target: pool.address, @@ -389,12 +384,6 @@ export class LinearPool extends BasePool { data[startIndex++], pool.address, )[0]; - const rate = decodeThrowError( - this.poolInterface, - 'getRate', - data[startIndex++], - pool.address, - )[0]; const [lowerTarget, upperTarget] = decodeThrowError( this.poolInterface, 'getTargets', diff --git a/src/dex/balancer-v2/PhantomStablePool.ts b/src/dex/balancer-v2/PhantomStablePool.ts index 999b07130..e9408d8d8 100644 --- a/src/dex/balancer-v2/PhantomStablePool.ts +++ b/src/dex/balancer-v2/PhantomStablePool.ts @@ -311,10 +311,6 @@ export class PhantomStablePool extends BasePool { target: pool.address, callData: this.poolInterface.encodeFunctionData('getScalingFactors'), }, - { - target: pool.address, - callData: this.poolInterface.encodeFunctionData('getRate'), - }, { target: pool.address, callData: this.poolInterface.encodeFunctionData( @@ -373,12 +369,6 @@ export class PhantomStablePool extends BasePool { data[startIndex++], pool.address, )[0]; - const rate = decodeThrowError( - this.poolInterface, - 'getRate', - data[startIndex++], - pool.address, - )[0]; const amp = decodeThrowError( this.poolInterface, 'getAmplificationParameter', @@ -386,17 +376,10 @@ export class PhantomStablePool extends BasePool { pool.address, ); - const bptIndex = pool.tokens.findIndex( - t => t.address.toLowerCase() === pool.address.toLowerCase(), - ); - const tokens = poolTokens.tokens.map((address: string, idx: number) => ({ address: address.toLowerCase(), balance: BigInt(poolTokens.balances[idx].toString()), - scalingFactor: - idx === bptIndex - ? BigInt(rate.toString()) - : BigInt(scalingFactors[idx].toString()), + scalingFactor: BigInt(scalingFactors[idx].toString()), })); const poolState: PoolState = { diff --git a/src/dex/balancer-v2/balancer-v2-integration.test.ts b/src/dex/balancer-v2/balancer-v2-integration.test.ts index 7c41aaa1d..cc29f0408 100644 --- a/src/dex/balancer-v2/balancer-v2-integration.test.ts +++ b/src/dex/balancer-v2/balancer-v2-integration.test.ts @@ -50,61 +50,24 @@ const amounts = [0n, BI_POWS[18], 2000000000000000000n]; const dexKey = 'BalancerV2'; describe('BalancerV2', function () { - describe('BeetsFi', () => { - it('FTM -> BOO: getPoolIdentifiers and getPricesVolume', async () => { - const dexKey = 'BeetsFi'; - const network = Network.FANTOM; - const srcToken = Tokens[network]['FTM']; - const destToken = Tokens[network]['BOO']; - const amounts = [0n, BI_POWS[18]]; + describe('ComposableStable', () => { + it('USDC -> USDT getPoolIdentifiers and getPricesVolume', async () => { + const network = Network.MAINNET; + const srcToken = Tokens[network]['USDC']; + const destToken = Tokens[network]['USDT']; + const amounts = [0n, 10000001000000n]; const dexHelper = new DummyDexHelper(network); - // const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber(); - const blockNumber = 54734626; - const beetsFi = new BalancerV2(network, dexKey, dexHelper); - - await beetsFi.initializePricing(blockNumber); - - const pools = await beetsFi.getPoolIdentifiers( - srcToken, - destToken, - SwapSide.SELL, - blockNumber, - ); - console.log('Pool Identifiers: ', pools); + const blockNumber = await dexHelper.web3Provider.eth.getBlockNumber(); + // You will need blockTimestamp to check onchain calculation, because + // it depends on timestamp. If you have different values, they are incomparable + // const block = await dexHelper.web3Provider.eth.getBlock(blockNumber); - expect(pools.length).toBeGreaterThan(0); + const balancerV2 = new BalancerV2(network, dexKey, dexHelper); - const poolPrices = await beetsFi.getPricesVolume( - srcToken, - destToken, - amounts, - SwapSide.SELL, - blockNumber, - pools, - ); - console.log('Pool Prices: ', poolPrices); + await balancerV2.initializePricing(blockNumber); - expect(poolPrices).not.toBeNull(); - checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey); - - await beetsFi.releaseResources(); - }); - it('WETH -> FTM: getPoolIdentifiers and getPricesVolume', async () => { - const dexKey = 'BeetsFi'; - const network = Network.FANTOM; - const srcToken = Tokens[network]['WETH']; - const destToken = Tokens[network]['FTM']; - const amounts = [0n, BI_POWS[18]]; - - const dexHelper = new DummyDexHelper(network); - // const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber(); - const blockNumber = 54782005; - const beetsFi = new BalancerV2(network, dexKey, dexHelper); - - await beetsFi.initializePricing(blockNumber); - - const pools = await beetsFi.getPoolIdentifiers( + const pools = await balancerV2.getPoolIdentifiers( srcToken, destToken, SwapSide.SELL, @@ -114,7 +77,7 @@ describe('BalancerV2', function () { expect(pools.length).toBeGreaterThan(0); - const poolPrices = await beetsFi.getPricesVolume( + const poolPrices = await balancerV2.getPricesVolume( srcToken, destToken, amounts, @@ -127,11 +90,9 @@ describe('BalancerV2', function () { expect(poolPrices).not.toBeNull(); checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey); - await beetsFi.releaseResources(); + await balancerV2.releaseResources(); }); - }); - describe('ComposableStable', () => { it('getPoolIdentifiers and getPricesVolume', async () => { const dexHelper = new DummyDexHelper(Network.POLYGON); const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber(); @@ -397,3 +358,82 @@ describe('BalancerV2', function () { }); }); }); + +describe('BeetsFi', () => { + it('FTM -> BOO: getPoolIdentifiers and getPricesVolume', async () => { + const dexKey = 'BeetsFi'; + const network = Network.FANTOM; + const srcToken = Tokens[network]['FTM']; + const destToken = Tokens[network]['BOO']; + const amounts = [0n, BI_POWS[18]]; + + const dexHelper = new DummyDexHelper(network); + const blockNumber = await dexHelper.web3Provider.eth.getBlockNumber(); + const beetsFi = new BalancerV2(network, dexKey, dexHelper); + + await beetsFi.initializePricing(blockNumber); + + const pools = await beetsFi.getPoolIdentifiers( + srcToken, + destToken, + SwapSide.SELL, + blockNumber, + ); + console.log('Pool Identifiers: ', pools); + + expect(pools.length).toBeGreaterThan(0); + + const poolPrices = await beetsFi.getPricesVolume( + srcToken, + destToken, + amounts, + SwapSide.SELL, + blockNumber, + pools, + ); + console.log('Pool Prices: ', poolPrices); + + expect(poolPrices).not.toBeNull(); + checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey); + + await beetsFi.releaseResources(); + }); + it('WETH -> FTM: getPoolIdentifiers and getPricesVolume', async () => { + const dexKey = 'BeetsFi'; + const network = Network.FANTOM; + const srcToken = Tokens[network]['WETH']; + const destToken = Tokens[network]['FTM']; + const amounts = [0n, BI_POWS[18]]; + + const dexHelper = new DummyDexHelper(network); + const blockNumber = await dexHelper.web3Provider.eth.getBlockNumber(); + const beetsFi = new BalancerV2(network, dexKey, dexHelper); + + await beetsFi.initializePricing(blockNumber); + + const pools = await beetsFi.getPoolIdentifiers( + srcToken, + destToken, + SwapSide.SELL, + blockNumber, + ); + console.log('Pool Identifiers: ', pools); + + expect(pools.length).toBeGreaterThan(0); + + const poolPrices = await beetsFi.getPricesVolume( + srcToken, + destToken, + amounts, + SwapSide.SELL, + blockNumber, + pools, + ); + console.log('Pool Prices: ', poolPrices); + + expect(poolPrices).not.toBeNull(); + checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey); + + await beetsFi.releaseResources(); + }); +}); diff --git a/src/dex/balancer-v2/balancer-v2.ts b/src/dex/balancer-v2/balancer-v2.ts index c7ae8cd33..badf3db39 100644 --- a/src/dex/balancer-v2/balancer-v2.ts +++ b/src/dex/balancer-v2/balancer-v2.ts @@ -51,7 +51,11 @@ import { poolGetMainTokens, poolGetPathForTokenInOut, } from './utils'; -import { MIN_USD_LIQUIDITY_TO_FETCH } from './constants'; +import { + MIN_USD_LIQUIDITY_TO_FETCH, + STABLE_GAS_COST, + VARIABLE_GAS_COST_PER_CYCLE, +} from './constants'; const fetchAllPools = `query ($count: Int) { pools: pools( @@ -158,11 +162,11 @@ export class BalancerV2EventPool extends StatefulEventSubscriber { The difference of note for swaps is ComposableStable must use 'actualSupply' instead of VirtualSupply. VirtualSupply could be calculated easily whereas actualSupply cannot hence the use of onchain call. */ - // const composableStable = new PhantomStablePool( - // this.vaultAddress, - // this.vaultInterface, - // true, - // ); + const composableStable = new PhantomStablePool( + this.vaultAddress, + this.vaultInterface, + true, + ); const linearPool = new LinearPool(this.vaultAddress, this.vaultInterface); this.pools = {}; @@ -177,7 +181,7 @@ export class BalancerV2EventPool extends StatefulEventSubscriber { // Beets uses "Linear" generically for all linear pool types this.pools[BalancerPoolTypes.Linear] = linearPool; this.pools[BalancerPoolTypes.StablePhantom] = stablePhantomPool; - // this.pools[BalancerPoolTypes.ComposableStable] = composableStable; + this.pools[BalancerPoolTypes.ComposableStable] = composableStable; this.vaultDecoder = (log: Log) => this.vaultInterface.parseLog(log); this.addressesSubscribed = [vaultAddress]; @@ -760,7 +764,8 @@ export class BalancerV2 }, poolAddresses: [poolAddress], exchange: this.dexKey, - gasCost: 150 * 1000 * (path.length - 1), + gasCost: + STABLE_GAS_COST + VARIABLE_GAS_COST_PER_CYCLE * path.length, poolIdentifier: `${this.dexKey}_${poolAddress}`, }; diff --git a/src/dex/balancer-v2/constants.ts b/src/dex/balancer-v2/constants.ts index d71ecc39e..39d700520 100644 --- a/src/dex/balancer-v2/constants.ts +++ b/src/dex/balancer-v2/constants.ts @@ -1 +1,10 @@ export const MIN_USD_LIQUIDITY_TO_FETCH = 100n; + +// Let's take this trade as an example: +// https://dashboard.tenderly.co/paraswap/paraswap/fork/e4c81946-fd6e-4299-b35c-c47b775e3c05/simulation/8839462c-6239-4ae1-9ed0-8013f89b41de/gas-usage + +// 271719 - 57856 - 79098 - 51041 = 83724 ~ 84k +export const STABLE_GAS_COST = 84_000; + +// I see three pools used in trade: (57856 + 79098 + 51041) / 3 = 62665 ~ 63k +export const VARIABLE_GAS_COST_PER_CYCLE = 63_000; diff --git a/src/dex/balancer-v2/types.ts b/src/dex/balancer-v2/types.ts index 91d8ffc2c..d2945d539 100644 --- a/src/dex/balancer-v2/types.ts +++ b/src/dex/balancer-v2/types.ts @@ -11,7 +11,7 @@ export enum BalancerPoolTypes { StablePhantom = 'StablePhantom', ERC4626Linear = 'ERC4626Linear', Linear = 'Linear', - // ComposableStable = 'ComposableStable', + ComposableStable = 'ComposableStable', } export type TokenState = { diff --git a/src/dex/balancer-v2/utils.ts b/src/dex/balancer-v2/utils.ts index 5284923f6..e92b795ef 100644 --- a/src/dex/balancer-v2/utils.ts +++ b/src/dex/balancer-v2/utils.ts @@ -162,8 +162,8 @@ function isLinearPool(poolType: string) { function isPhantomStablePool(poolType: string) { return ( - poolType === BalancerPoolTypes.StablePhantom - // || poolType === BalancerPoolTypes.ComposableStable + poolType === BalancerPoolTypes.StablePhantom || + poolType === BalancerPoolTypes.ComposableStable ); } diff --git a/src/dex/uniswap-v2/config.ts b/src/dex/uniswap-v2/config.ts index dc6a92b2b..10d176167 100644 --- a/src/dex/uniswap-v2/config.ts +++ b/src/dex/uniswap-v2/config.ts @@ -379,6 +379,13 @@ export const UniswapV2Config: DexConfigMap = { poolGasCost: 90 * 1000, feeCode: 25, }, + [Network.MAINNET]: { + factoryAddress: '0x1097053Fd2ea711dad45caCcc45EfF7548fCB362', + initCode: + '0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d', + poolGasCost: 90 * 1000, + feeCode: 25, + }, }, PaintSwap: { [Network.FANTOM]: { @@ -443,12 +450,61 @@ export const UniswapV2Config: DexConfigMap = { }, Swapsicle: { [Network.AVALANCHE]: { - subgraphURL: 'https://api.thegraph.com/subgraphs/name/billy93/exchange', + subgraphURL: + 'https://api.thegraph.com/subgraphs/name/swapsicledex/swapsicle-exchange-avalanche', factoryAddress: '0x9C60C867cE07a3c403E2598388673C10259EC768', initCode: '0x9e43ee37212e3296c7f6087d3e0a37b48a4e4e413538dac0fd18cfe2f80666c1', feeCode: 30, }, + [Network.POLYGON]: { + subgraphURL: + 'https://api.thegraph.com/subgraphs/name/swapsicledex/swapsicle-exchange-polygon', + factoryAddress: '0x735ab9808d792B5c8B54e31196c011c26C08b4ce', + initCode: + '0x2ed0c8714ca80192f88764ee4b4c8c8cb6dfc01859a02b25ce67f304e499d48e', + feeCode: 30, + }, + [Network.BSC]: { + subgraphURL: + 'https://api.thegraph.com/subgraphs/name/swapsicledex/swapsicle-exchange-bnb', + factoryAddress: '0xEe673452BD981966d4799c865a96e0b92A8d0E45', + initCode: + '0x2ed0c8714ca80192f88764ee4b4c8c8cb6dfc01859a02b25ce67f304e499d48e', + feeCode: 30, + }, + [Network.FANTOM]: { + subgraphURL: + 'https://api.thegraph.com/subgraphs/name/swapsicledex/swapsicle-exchange-fantom', + factoryAddress: '0x98F23162E3a7FE610aC89C88E4217a599A15858F', + initCode: + '0xcb64282d14f9033fbb6a3a827bd515fff027bb6994a0d33ac0424e7e3037dad3', + feeCode: 30, + }, + [Network.ARBITRUM]: { + subgraphURL: + 'https://api.thegraph.com/subgraphs/name/swapsicledex/swapsicle-exchange-arbitrum', + factoryAddress: '0x2f0c7c98462651bb2102f6cd05acdad333e031b0', + initCode: + '0x2ed0c8714ca80192f88764ee4b4c8c8cb6dfc01859a02b25ce67f304e499d48e', + feeCode: 30, + }, + [Network.MAINNET]: { + subgraphURL: + 'https://api.thegraph.com/subgraphs/name/swapsicledex/swapsicle-exchange-ethereum', + factoryAddress: '0x2F0C7C98462651BB2102F6Cd05acDAd333E031b0', + initCode: + '0x2ed0c8714ca80192f88764ee4b4c8c8cb6dfc01859a02b25ce67f304e499d48e', + feeCode: 30, + }, + [Network.OPTIMISM]: { + subgraphURL: + 'https://api.thegraph.com/subgraphs/name/swapsicledex/swapsicle-exchange-optimism', + factoryAddress: '0x2f0c7c98462651bb2102f6cd05acdad333e031b0', + initCode: + '0x2ed0c8714ca80192f88764ee4b4c8c8cb6dfc01859a02b25ce67f304e499d48e', + feeCode: 30, + }, }, QuickSwap: { [Network.POLYGON]: { diff --git a/src/dex/uniswap-v2/uniswap-v2-e2e-arbitrum.test.ts b/src/dex/uniswap-v2/uniswap-v2-e2e-arbitrum.test.ts index ea899debb..0fe8e9ddc 100644 --- a/src/dex/uniswap-v2/uniswap-v2-e2e-arbitrum.test.ts +++ b/src/dex/uniswap-v2/uniswap-v2-e2e-arbitrum.test.ts @@ -187,4 +187,92 @@ describe('UniswapV2 E2E Arbitrum', () => { }); }); }); + + describe(`Swapsicle`, () => { + const dexKey = 'Swapsicle'; + + const sideToContractMethods = new Map([ + [ + SwapSide.SELL, + [ + ContractMethod.simpleSwap, + ContractMethod.multiSwap, + ContractMethod.megaSwap, + ], + ], + [SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]], + ]); + + const pairs: { name: string; sellAmount: string; buyAmount: string }[][] = [ + [ + { name: 'WETH', sellAmount: '700000000000', buyAmount: '1000' }, + { name: 'USDC', sellAmount: '100000', buyAmount: '4000' }, + ], + [ + { name: 'WETH', sellAmount: '700000000000', buyAmount: '10000' }, + { name: 'USDT', sellAmount: '100000', buyAmount: '40000' }, + ], + [ + { name: 'WETH', sellAmount: '700000000000', buyAmount: '10000' }, + { name: 'DAI', sellAmount: '1000000000000', buyAmount: '40000000' }, + ], + [ + { name: 'POPS', sellAmount: '1000000000000000000', buyAmount: '10000' }, + { name: 'USDC', sellAmount: '10000', buyAmount: '40000' }, + ], + [ + { + name: 'WETH', + sellAmount: '1000000000000000000', + buyAmount: '10000000', + }, + { + name: 'POPS', + sellAmount: '1000000000000000000', + buyAmount: '1000000000000000000', + }, + ], + ]; + + sideToContractMethods.forEach((contractMethods, side) => + describe(`${side}`, () => { + contractMethods.forEach((contractMethod: ContractMethod) => { + pairs.forEach(pair => { + describe(`${contractMethod}`, () => { + it(`${pair[0].name} -> ${pair[1].name}`, async () => { + await testE2E( + tokens[pair[0].name], + tokens[pair[1].name], + holders[pair[0].name], + side === SwapSide.SELL + ? pair[0].sellAmount + : pair[0].buyAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + it(`${pair[1].name} -> ${pair[0].name}`, async () => { + await testE2E( + tokens[pair[1].name], + tokens[pair[0].name], + holders[pair[1].name], + side === SwapSide.SELL + ? pair[1].sellAmount + : pair[1].buyAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + }); + }); + }); + }), + ); + }); }); diff --git a/src/dex/uniswap-v2/uniswap-v2-e2e-avalanche.test.ts b/src/dex/uniswap-v2/uniswap-v2-e2e-avalanche.test.ts index 8e7f85d19..7eed0311c 100644 --- a/src/dex/uniswap-v2/uniswap-v2-e2e-avalanche.test.ts +++ b/src/dex/uniswap-v2/uniswap-v2-e2e-avalanche.test.ts @@ -468,140 +468,80 @@ describe('UniswapV2 E2E Avalanche', () => { }); }); - describe('Swapsicle', () => { + describe(`Swapsicle`, () => { const dexKey = 'Swapsicle'; - describe('simpleSwap', () => { - it('USDC -> MIM', async () => { - await testE2E( - tokens.USDC, - tokens.MIM, - holders.USDC, - '3000000000', - SwapSide.SELL, - dexKey, - ContractMethod.simpleSwap, - network, - provider, - ); - }); - - it('MIM -> USDC', async () => { - await testE2E( - tokens.MIM, - tokens.USDC, - holders.MIM, - '3000000000000000000000', - SwapSide.SELL, - dexKey, - ContractMethod.simpleSwap, - network, - provider, - ); - }); - - it('WAVAX -> USDCe', async () => { - await testE2E( - tokens.WAVAX, - tokens.USDCe, - holders.WAVAX, - '7000000000000000000', - SwapSide.SELL, - dexKey, + const sideToContractMethods = new Map([ + [ + SwapSide.SELL, + [ ContractMethod.simpleSwap, - network, - provider, - ); - }); - }); - - describe('multiSwap', () => { - it('USDC -> MIM', async () => { - await testE2E( - tokens.USDC, - tokens.MIM, - holders.USDC, - '3000000000', - SwapSide.SELL, - dexKey, ContractMethod.multiSwap, - network, - provider, - ); - }); - - it('MIM -> USDC', async () => { - await testE2E( - tokens.MIM, - tokens.USDC, - holders.MIM, - '3000000000000000000000', - SwapSide.SELL, - dexKey, - ContractMethod.multiSwap, - network, - provider, - ); - }); - - it('WAVAX -> USDCe', async () => { - await testE2E( - tokens.WAVAX, - tokens.USDCe, - holders.WAVAX, - '7000000000000000000', - SwapSide.SELL, - dexKey, - ContractMethod.multiSwap, - network, - provider, - ); - }); - }); - - describe('megaSwap', () => { - it('USDC -> MIM', async () => { - await testE2E( - tokens.USDC, - tokens.MIM, - holders.USDC, - '3000000000', - SwapSide.SELL, - dexKey, ContractMethod.megaSwap, - network, - provider, - ); - }); - - it('MIM -> USDC', async () => { - await testE2E( - tokens.MIM, - tokens.USDC, - holders.MIM, - '3000000000000000000000', - SwapSide.SELL, - dexKey, - ContractMethod.megaSwap, - network, - provider, - ); - }); - - it('WAVAX -> USDCe', async () => { - await testE2E( - tokens.WAVAX, - tokens.USDCe, - holders.WAVAX, - '7000000000000000000', - SwapSide.SELL, - dexKey, - ContractMethod.megaSwap, - network, - provider, - ); - }); - }); + ], + ], + [SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]], + ]); + + const pairs: { name: string; sellAmount: string; buyAmount: string }[][] = [ + [ + { name: 'WAVAX', sellAmount: '7000000000000000000', buyAmount: '1000' }, + { name: 'USDC', sellAmount: '5000', buyAmount: '10000000' }, + ], + [ + { name: 'USDCe', sellAmount: '3000000000', buyAmount: '1000' }, + { name: 'MIM', sellAmount: '300000000000000000', buyAmount: '300000' }, + ], + [ + { name: 'WAVAX', sellAmount: '7000000000000000000', buyAmount: '1000' }, + { name: 'USDCe', sellAmount: '1000', buyAmount: '1000' }, + ], + [ + { name: 'POPS', sellAmount: '7000000000000000000', buyAmount: '1000' }, + { name: 'WAVAX', sellAmount: '7000000000000000000', buyAmount: '1000' }, + ], + ]; + + sideToContractMethods.forEach((contractMethods, side) => + describe(`${side}`, () => { + contractMethods.forEach((contractMethod: ContractMethod) => { + pairs.forEach(pair => { + describe(`${contractMethod}`, () => { + it(`${pair[0].name} -> ${pair[1].name}`, async () => { + await testE2E( + tokens[pair[0].name], + tokens[pair[1].name], + holders[pair[0].name], + side === SwapSide.SELL + ? pair[0].sellAmount + : pair[0].buyAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + it(`${pair[1].name} -> ${pair[0].name}`, async () => { + await testE2E( + tokens[pair[1].name], + tokens[pair[0].name], + holders[pair[1].name], + side === SwapSide.SELL + ? pair[1].sellAmount + : pair[1].buyAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + }); + }); + }); + }), + ); }); describe('CanarySwap', () => { diff --git a/src/dex/uniswap-v2/uniswap-v2-e2e-bsc.test.ts b/src/dex/uniswap-v2/uniswap-v2-e2e-bsc.test.ts index fe7f5d56c..ff7a66013 100644 --- a/src/dex/uniswap-v2/uniswap-v2-e2e-bsc.test.ts +++ b/src/dex/uniswap-v2/uniswap-v2-e2e-bsc.test.ts @@ -1406,4 +1406,80 @@ describe('UniswapV2 E2E BSC', () => { }); }); }); + + describe(`Swapsicle`, () => { + const dexKey = 'Swapsicle'; + + const sideToContractMethods = new Map([ + [ + SwapSide.SELL, + [ + ContractMethod.simpleSwap, + ContractMethod.multiSwap, + ContractMethod.megaSwap, + ], + ], + [SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]], + ]); + + const pairs: { name: string; sellAmount: string; buyAmount: string }[][] = [ + [ + { name: 'WBNB', sellAmount: '7000000000000000000', buyAmount: '1000' }, + { name: 'BUSD', sellAmount: '5000', buyAmount: '10000000' }, + ], + [ + { name: 'WBNB', sellAmount: '3000000000', buyAmount: '1000' }, + { name: 'POPS', sellAmount: '800000000000', buyAmount: '800000000000' }, + ], + [ + { name: 'WBNB', sellAmount: '7000000000000000000', buyAmount: '1000' }, + { name: 'DAI', sellAmount: '1000', buyAmount: '1000' }, + ], + [ + { name: 'WBNB', sellAmount: '7000000000000000000', buyAmount: '1000' }, + { name: 'USDC', sellAmount: '700', buyAmount: '1000' }, + ], + ]; + + sideToContractMethods.forEach((contractMethods, side) => + describe(`${side}`, () => { + contractMethods.forEach((contractMethod: ContractMethod) => { + pairs.forEach(pair => { + describe(`${contractMethod}`, () => { + it(`${pair[0].name} -> ${pair[1].name}`, async () => { + await testE2E( + tokens[pair[0].name], + tokens[pair[1].name], + holders[pair[0].name], + side === SwapSide.SELL + ? pair[0].sellAmount + : pair[0].buyAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + it(`${pair[1].name} -> ${pair[0].name}`, async () => { + await testE2E( + tokens[pair[1].name], + tokens[pair[0].name], + holders[pair[1].name], + side === SwapSide.SELL + ? pair[1].sellAmount + : pair[1].buyAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + }); + }); + }); + }), + ); + }); }); diff --git a/src/dex/uniswap-v2/uniswap-v2-e2e-fantom.test.ts b/src/dex/uniswap-v2/uniswap-v2-e2e-fantom.test.ts index b1d849ea3..d9cd9f431 100644 --- a/src/dex/uniswap-v2/uniswap-v2-e2e-fantom.test.ts +++ b/src/dex/uniswap-v2/uniswap-v2-e2e-fantom.test.ts @@ -1345,4 +1345,84 @@ describe('UniswapV2 E2E Fantom', () => { }); }); }); + + describe(`Swapsicle`, () => { + const dexKey = 'Swapsicle'; + + const sideToContractMethods = new Map([ + [ + SwapSide.SELL, + [ + ContractMethod.simpleSwap, + ContractMethod.multiSwap, + ContractMethod.megaSwap, + ], + ], + [SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]], + ]); + + const pairs: { name: string; sellAmount: string; buyAmount: string }[][] = [ + [ + { name: 'WFTM', sellAmount: '7000000000000000000', buyAmount: '1000' }, + { name: 'USDC', sellAmount: '5000', buyAmount: '10000000' }, + ], + [ + { name: 'WFTM', sellAmount: '3000000000', buyAmount: '1000' }, + { name: 'POPS', sellAmount: '800000000000', buyAmount: '800000000000' }, + ], + [ + { name: 'WFTM', sellAmount: '7000000000000000000', buyAmount: '1000' }, + { name: 'MIM', sellAmount: '1000', buyAmount: '1000' }, + ], + [ + { name: 'WFTM', sellAmount: '7000000000000000000', buyAmount: '1000' }, + { name: 'DAI', sellAmount: '1000', buyAmount: '1000' }, + ], + [ + { name: 'WFTM', sellAmount: '7000000000000000000', buyAmount: '1000' }, + { name: 'FUSDT', sellAmount: '1000', buyAmount: '1000' }, + ], + ]; + + sideToContractMethods.forEach((contractMethods, side) => + describe(`${side}`, () => { + contractMethods.forEach((contractMethod: ContractMethod) => { + pairs.forEach(pair => { + describe(`${contractMethod}`, () => { + it(`${pair[0].name} -> ${pair[1].name}`, async () => { + await testE2E( + tokens[pair[0].name], + tokens[pair[1].name], + holders[pair[0].name], + side === SwapSide.SELL + ? pair[0].sellAmount + : pair[0].buyAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + it(`${pair[1].name} -> ${pair[0].name}`, async () => { + await testE2E( + tokens[pair[1].name], + tokens[pair[0].name], + holders[pair[1].name], + side === SwapSide.SELL + ? pair[1].sellAmount + : pair[1].buyAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + }); + }); + }); + }), + ); + }); }); diff --git a/src/dex/uniswap-v2/uniswap-v2-e2e-mainnet.test.ts b/src/dex/uniswap-v2/uniswap-v2-e2e-mainnet.test.ts index b65914c6b..ce9d00eff 100644 --- a/src/dex/uniswap-v2/uniswap-v2-e2e-mainnet.test.ts +++ b/src/dex/uniswap-v2/uniswap-v2-e2e-mainnet.test.ts @@ -1222,4 +1222,239 @@ describe('UniswapV2 E2E Mainnet', () => { }); }); }); + + describe('PancakeSwapV2', () => { + const dexKey = 'PancakeSwapV2'; + + describe('Simpleswap', () => { + it('TOKEN -> ETH', async () => { + await testE2E( + tokens.USDT, + tokens.ETH, + holders.USDT, + '200000000', + SwapSide.SELL, + dexKey, + ContractMethod.simpleSwap, + network, + provider, + ); + }); + it('ETH -> TOKEN', async () => { + await testE2E( + tokens.ETH, + tokens.USDT, + holders.ETH, + '500000000000000000', + SwapSide.SELL, + dexKey, + ContractMethod.simpleSwap, + network, + provider, + ); + }); + it('TOKEN -> TOKEN', async () => { + await testE2E( + tokens.USDC, + tokens.STG, + holders.USDC, + '50000', + SwapSide.SELL, + dexKey, + ContractMethod.simpleSwap, + network, + provider, + ); + }); + }); + + describe('SimpleBuy', () => { + it('TOKEN -> ETH', async () => { + await testE2E( + tokens.USDT, + tokens.ETH, + holders.USDT, + '2000000000', + SwapSide.BUY, + dexKey, + ContractMethod.simpleBuy, + network, + provider, + ); + }); + it('ETH -> TOKEN', async () => { + await testE2E( + tokens.ETH, + tokens.USDT, + holders.ETH, + '1000000', + SwapSide.BUY, + dexKey, + ContractMethod.simpleBuy, + network, + provider, + ); + }); + it('TOKEN -> TOKEN', async () => { + await testE2E( + tokens.USDC, + tokens.STG, + holders.USDC, + '100000', + SwapSide.BUY, + dexKey, + ContractMethod.simpleBuy, + network, + provider, + ); + }); + }); + + describe('Multiswap', () => { + it('TOKEN -> ETH', async () => { + await testE2E( + tokens.USDT, + tokens.ETH, + holders.USDT, + '200000000', + SwapSide.SELL, + dexKey, + ContractMethod.multiSwap, + network, + provider, + ); + }); + it('ETH -> TOKEN', async () => { + await testE2E( + tokens.ETH, + tokens.USDT, + holders.ETH, + '500000000000000000', + SwapSide.SELL, + dexKey, + ContractMethod.multiSwap, + network, + provider, + ); + }); + it('TOKEN -> TOKEN', async () => { + await testE2E( + tokens.USDC, + tokens.STG, + holders.USDC, + '1000000', + SwapSide.SELL, + dexKey, + ContractMethod.multiSwap, + network, + provider, + ); + }); + }); + describe('MegaPath', () => { + it('TOKEN -> ETH', async () => { + await testE2E( + tokens.USDT, + tokens.ETH, + holders.USDT, + '200000000', + SwapSide.SELL, + dexKey, + ContractMethod.megaSwap, + network, + provider, + ); + }); + it('ETH -> TOKEN', async () => { + await testE2E( + tokens.ETH, + tokens.USDT, + holders.ETH, + '500000000000000000', + SwapSide.SELL, + dexKey, + ContractMethod.megaSwap, + network, + provider, + ); + }); + it('TOKEN -> TOKEN', async () => { + await testE2E( + tokens.USDC, + tokens.STG, + holders.USDC, + '1000000', + SwapSide.SELL, + dexKey, + ContractMethod.megaSwap, + network, + provider, + ); + }); + }); + }); + + describe(`Swapsicle`, () => { + const dexKey = 'Swapsicle'; + + const sideToContractMethods = new Map([ + [ + SwapSide.SELL, + [ + ContractMethod.simpleSwap, + ContractMethod.multiSwap, + ContractMethod.megaSwap, + ], + ], + [SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]], + ]); + + const pairs: { name: string; sellAmount: string; buyAmount: string }[][] = [ + [ + { name: 'USDC', sellAmount: '7000', buyAmount: '10000' }, + { name: 'WETH', sellAmount: '1000000000000000000', buyAmount: '4000' }, + ], + ]; + + sideToContractMethods.forEach((contractMethods, side) => + describe(`${side}`, () => { + contractMethods.forEach((contractMethod: ContractMethod) => { + pairs.forEach(pair => { + describe(`${contractMethod}`, () => { + it(`${pair[0].name} -> ${pair[1].name}`, async () => { + await testE2E( + tokens[pair[0].name], + tokens[pair[1].name], + holders[pair[0].name], + side === SwapSide.SELL + ? pair[0].sellAmount + : pair[0].buyAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + it(`${pair[1].name} -> ${pair[0].name}`, async () => { + await testE2E( + tokens[pair[1].name], + tokens[pair[0].name], + holders[pair[1].name], + side === SwapSide.SELL + ? pair[1].sellAmount + : pair[1].buyAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + }); + }); + }); + }), + ); + }); }); diff --git a/src/dex/uniswap-v2/uniswap-v2-e2e-optimism.test.ts b/src/dex/uniswap-v2/uniswap-v2-e2e-optimism.test.ts index d61a57b9a..f53dbf85b 100644 --- a/src/dex/uniswap-v2/uniswap-v2-e2e-optimism.test.ts +++ b/src/dex/uniswap-v2/uniswap-v2-e2e-optimism.test.ts @@ -187,4 +187,96 @@ describe('UniswapV2 E2E Optimism', () => { }); }); }); + + describe(`Swapsicle`, () => { + const dexKey = 'Swapsicle'; + + const sideToContractMethods = new Map([ + [ + SwapSide.SELL, + [ + ContractMethod.simpleSwap, + ContractMethod.multiSwap, + ContractMethod.megaSwap, + ], + ], + [SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]], + ]); + + const pairs: { name: string; sellAmount: string; buyAmount: string }[][] = [ + [ + { name: 'OP', sellAmount: '1000000000000000000', buyAmount: '7000' }, + { name: 'USDC', sellAmount: '1000', buyAmount: '4000' }, + ], + [ + { name: 'WETH', sellAmount: '700000000000', buyAmount: '1000' }, + { name: 'USDC', sellAmount: '100000', buyAmount: '40000' }, + ], + [ + { + name: 'WETH', + sellAmount: '1000000000000000000', + buyAmount: '70000000', + }, + { name: 'DAI', sellAmount: '1000000000000000000', buyAmount: '4000' }, + ], + [ + { name: 'WETH', sellAmount: '1000000000000000000', buyAmount: '1000' }, + { name: 'USDT', sellAmount: '100000', buyAmount: '40000' }, + ], + [ + { + name: 'POPS', + sellAmount: '1000000000000000000', + buyAmount: '10000000', + }, + { + name: 'WETH', + sellAmount: '1000000000000000000', + buyAmount: '1000000000000000000', + }, + ], + ]; + + sideToContractMethods.forEach((contractMethods, side) => + describe(`${side}`, () => { + contractMethods.forEach((contractMethod: ContractMethod) => { + pairs.forEach(pair => { + describe(`${contractMethod}`, () => { + it(`${pair[0].name} -> ${pair[1].name}`, async () => { + await testE2E( + tokens[pair[0].name], + tokens[pair[1].name], + holders[pair[0].name], + side === SwapSide.SELL + ? pair[0].sellAmount + : pair[0].buyAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + it(`${pair[1].name} -> ${pair[0].name}`, async () => { + await testE2E( + tokens[pair[1].name], + tokens[pair[0].name], + holders[pair[1].name], + side === SwapSide.SELL + ? pair[1].sellAmount + : pair[1].buyAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + }); + }); + }); + }), + ); + }); }); diff --git a/src/dex/uniswap-v2/uniswap-v2-e2e-polygon.test.ts b/src/dex/uniswap-v2/uniswap-v2-e2e-polygon.test.ts index e646eaa76..0035a7161 100644 --- a/src/dex/uniswap-v2/uniswap-v2-e2e-polygon.test.ts +++ b/src/dex/uniswap-v2/uniswap-v2-e2e-polygon.test.ts @@ -2,8 +2,8 @@ import dotenv from 'dotenv'; dotenv.config(); import { testE2E } from '../../../tests/utils-e2e'; -import { Tokens, Holders } from '../../../tests/constants-e2e'; -import { Network, ContractMethod, SwapSide } from '../../constants'; +import { Holders, Tokens } from '../../../tests/constants-e2e'; +import { ContractMethod, Network, SwapSide } from '../../constants'; import { StaticJsonRpcProvider } from '@ethersproject/providers'; import { generateConfig } from '../../config'; @@ -38,7 +38,7 @@ describe('UniswapV2 E2E Polygon', () => { tokens.DAI, tokens.MATIC, holders.DAI, - '700000000000000000000', + '100000', SwapSide.SELL, dexKey, ContractMethod.simpleSwap, @@ -1258,6 +1258,7 @@ describe('UniswapV2 E2E Polygon', () => { ); }); }); + describe('multiSwap', () => { it('MATIC -> TOKEN', async () => { await testE2E( @@ -1301,6 +1302,7 @@ describe('UniswapV2 E2E Polygon', () => { ); }); }); + describe('megaSwap', () => { it('MATIC -> TOKEN', async () => { await testE2E( @@ -1345,4 +1347,80 @@ describe('UniswapV2 E2E Polygon', () => { }); }); }); + + describe(`Swapsicle`, () => { + const dexKey = 'Swapsicle'; + + const sideToContractMethods = new Map([ + [ + SwapSide.SELL, + [ + ContractMethod.simpleSwap, + ContractMethod.multiSwap, + ContractMethod.megaSwap, + ], + ], + [SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]], + ]); + + const pairs: { name: string; sellAmount: string; buyAmount: string }[][] = [ + [ + { name: 'MATIC', sellAmount: '100000000000000000', buyAmount: '1000' }, + { name: 'USDC', sellAmount: '10000000', buyAmount: '1000' }, + ], + [ + { name: 'MATIC', sellAmount: '1000000000', buyAmount: '1000' }, + { name: 'DAI', sellAmount: '50000', buyAmount: '1000000000' }, + ], + [ + { name: 'MATIC', sellAmount: '100000000000000000', buyAmount: '1000' }, + { name: 'USDT', sellAmount: '100000000', buyAmount: '1000' }, + ], + [ + { name: 'MATIC', sellAmount: '10000000', buyAmount: '1000' }, + { name: 'POPS', sellAmount: '8000000', buyAmount: '1000' }, + ], + ]; + + sideToContractMethods.forEach((contractMethods, side) => + describe(`${side}`, () => { + contractMethods.forEach((contractMethod: ContractMethod) => { + pairs.forEach(pair => { + describe(`${contractMethod}`, () => { + it(`${pair[0].name} -> ${pair[1].name}`, async () => { + await testE2E( + tokens[pair[0].name], + tokens[pair[1].name], + holders[pair[0].name], + side === SwapSide.SELL + ? pair[0].sellAmount + : pair[0].buyAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + it(`${pair[1].name} -> ${pair[0].name}`, async () => { + await testE2E( + tokens[pair[1].name], + tokens[pair[0].name], + holders[pair[1].name], + side === SwapSide.SELL + ? pair[1].sellAmount + : pair[1].buyAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + }); + }); + }); + }), + ); + }); }); diff --git a/tests/constants-e2e.ts b/tests/constants-e2e.ts index 4c8dcdccc..81ff3236e 100644 --- a/tests/constants-e2e.ts +++ b/tests/constants-e2e.ts @@ -117,6 +117,10 @@ export const Tokens: { address: '0x43Dfc4159D86F3A37A5A4B3D4580b888ad7d4DDd', decimals: 18, }, + STG: { + address: '0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6', + decimals: 18, + }, ADAI: { address: '0x028171bca77440897b824ca71d1c56cac55b68a3', decimals: 18, @@ -296,6 +300,10 @@ export const Tokens: { address: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', decimals: 6, }, + POPS: { + address: '0xa92A1576D11dB45c53be71d59245ac97ce0d8147', + decimals: 18, + }, WETH: { address: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', decimals: 18, @@ -400,6 +408,10 @@ export const Tokens: { address: '0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83', decimals: 18, }, + DAI: { + address: '0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e', + decimals: 18, + }, USDC: { address: '0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', decimals: 6, @@ -408,6 +420,14 @@ export const Tokens: { address: '0x049d68029688eabf473097a2fc38ef61633a3c7a', decimals: 6, }, + POPS: { + address: '0x9dE4b40bDcE50Ec6a1A668bF85997BbBD324069a', + decimals: 18, + }, + MIM: { + address: '0x82f0b8b456c1a451378467398982d4834b6829c1', + decimals: 18, + }, FRAX: { address: '0xdc301622e621166BD8E82f2cA0A26c13Ad0BE355', decimals: 18, @@ -438,6 +458,10 @@ export const Tokens: { }, }, [Network.BSC]: { + POPS: { + address: '0xa1051433EC7b5cc249c75Fdd5b96BF423f2f4A32', + decimals: 18, + }, DAI: { address: '0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3', decimals: 18, @@ -513,6 +537,10 @@ export const Tokens: { address: '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7', decimals: 6, }, + POPS: { + address: '0x240248628B7B6850352764C5dFa50D1592A033A8', + decimals: 18, + }, WAVAX: { address: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7', decimals: 18, @@ -645,6 +673,10 @@ export const Tokens: { address: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', decimals: 6, }, + USDT: { + address: '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9', + decimals: 6, + }, FRAX: { address: '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', decimals: 18, @@ -673,6 +705,10 @@ export const Tokens: { address: '0x64343594ab9b56e99087bfa6f2335db24c2d1f17', decimals: 18, }, + POPS: { + address: '0xa0b20DecBc557E3f68E140eD5a0c69bc865F865A', + decimals: 18, + }, }, [Network.OPTIMISM]: { DAI: { @@ -692,6 +728,10 @@ export const Tokens: { address: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58', decimals: 6, }, + POPS: { + address: '0x3D51a9fB5dCc87F7B237B04975559b920a9a56Ff', + decimals: 18, + }, OP: { address: '0x4200000000000000000000000000000000000042', decimals: 18, @@ -737,7 +777,7 @@ export const Holders: { BADGER: '0x34e2741a3f8483dbe5231f61c005110ff4b9f50a', STETH: '0x9bdb521a97e95177bf252c253e256a60c3e14447', wstETH: '0x6cE0F913F035ec6195bC3cE885aec4C66E485BC4', - WETH: '0x6555e1CC97d3cbA6eAddebBCD7Ca51d75771e0B8', + WETH: '0x56178a0d5f301baf6cf3e1cd53d9863437345bf9', USDT: '0x5754284f345afc66a98fbb0a0afe71e0f007b949', XAUT: '0xc4e161e8d8a4bc4ac762ab33a28bbac5474203d7', CVX: '0x0aCA67Fa70B142A3b9bF2eD89A81B40ff85dACdC', @@ -753,7 +793,7 @@ export const Holders: { DODO: '0x3e19d726ed435afd3a42967551426b3a47c0f5b7', ADAI: '0x826c3064d4f5b9507152f5cb440ca9326e1ec8fa', AWETH: '0xa433105e7396070a5e1fdd7e2b2338f1bfa0de68', - BUSD: '0x47ac0Fb4F2D84898e4D9E7b4DaB3C24507a6D503', + BUSD: '0xf977814e90da44bfa03b6295a0616a897441acec', INCH: '0x4ee7c0f5480eb1edd8902a5e8b991ed52992d5f5', mUSD: '0x3aD1D5CFCF9169Da73C23D85d5f2Bf53bC9d39dF', mBTC: '0x15A295e9BCFcF93a8721DCb9A19330fc59771271', @@ -795,6 +835,7 @@ export const Holders: { WMATIC: '0xFffbCD322cEace527C8ec6Da8de2461C6D9d4e6e', AMWMATIC: '0x8832924854e3Cedb0a6Abf372e6CCFF9F7654332', USDC: '0x06959153B974D0D5fDfd87D561db6d8d4FA0bb0B', + POPS: '0x2693b57ee51f4e2a26dfb339a911fa8731061f49', MUST: '0x9f2a409848fb9b7bd058b24a23e8dbf1e166a109', AMDAI: '0xFA0DCe8280FCDf369a4cbFc1830d3302789307a6', mUSD: '0x5084f622cbDf1E22E473d66d97916524745B9b6e', @@ -817,12 +858,15 @@ export const Holders: { MAI: '0x9a8cf02f3e56c664ce75e395d0e4f3dc3dafe138', }, [Network.FANTOM]: { + DAI: '0x370f4b2dcf75c94d8d4450b493661a9c6170d0b5', FTM: '0x431e81E5dfB5A24541b5Ff8762bDEF3f32F96354', WFTM: '0x431e81E5dfB5A24541b5Ff8762bDEF3f32F96354', USDC: '0xd1e4a32679216f4a4dd38e45dab9bc4b8a45e592', FUSDT: '0x9ade1c17d25246c405604344f89E8F23F8c1c632', + POPS: '0x4b78b52e7de4d8b7d367297cb8a87c1875a9d591', aFanUSDT: '0x8EBc96fF91A30059E447bFC7C0a7394f8A5793E6', aFanWFTM: '0x935AD0fBea9572bB24138F23A69e314f0BDbdDbE', + MIM: '0xbcab7d083cf6a01e0dda9ed7f8a02b47d125e682', FRAX: '0x4423ac71f53ca92e2f2be5917a9c2468e7412f4a', nETH: '0x16b658270ac50c0063940ed287c401b3df7ccf70', WETH: '0x4ad64fd7ca6d6150614179b9bce4094bc18f29cb', @@ -835,10 +879,11 @@ export const Holders: { DAI: '0xf68a4b64162906eff0ff6ae34e2bb1cd42fef62d', WBNB: '0x59d779bed4db1e734d3fda3172d45bc3063ecd69', BUSD: '0x0D0707963952f2fBA59dD06f2b425ace40b492Fe', + POPS: '0x4b78b52e7de4d8b7d367297cb8a87c1875a9d591', BNB: '0xf68a4b64162906eff0ff6ae34e2bb1cd42fef62d', USDT: '0xf89d7b9c864f589bbf53a82105107622b35eaa40', ETH: '0xefdca55e4bce6c1d535cb2d0687b5567eef2ae83', - USDC: '0xF977814e90dA44bFA03b6295A0616a897441aceC', + USDC: '0x8894e0a0c962cb723c1976a4421c95949be2d4e3', RADIO: '0x75b3efed620e2d6750d88263cd4d7a27b0d7d3c5', bBTC: '0x72a53cdbbcc1b9efa39c834a540550e23463aacb', anyBTC: '0x4ffef8e8a75c20ab0ddf96c50d2457277d27923c', @@ -850,11 +895,12 @@ export const Holders: { avWAVAX: '0xc5ed2333f8a2C351fCA35E5EBAdb2A82F5d254C3', WAVAX: '0xAc1F5F1eDBcAE771be00d0eC044deC5BEdbFd816', sAVAX: '0xC73DF1e68FC203F6E4b6270240D6f82A850e8D38', - USDCe: '0xCe2CC46682E9C6D5f174aF598fb4931a9c0bE68e', + USDCe: '0x3a2434c698f8d79af1f5a9e43013157ca8b11a66', USDC: '0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8', USDTe: '0x84d34f4f83a87596cd3fb6887cff8f17bf5a7b83', USDT: '0x715f3c533Cf264215Ba8BE00838a053284351086', WETHe: '0xD291B51f7a1a1F4917D085F2a7731A447E4aF82D', + POPS: '0x5268c2331658cb0b2858cfa9db27d8f22f5434bc', ETH: '0x9852e84b5AA485683d8AeE7B0332e42442763b75', DAIE: '0xED2a7edd7413021d440b09D654f3b87712abAB66', TUSD: '0x5Db946411F08f15300f23D9bde4A407B07D56C03', @@ -863,7 +909,7 @@ export const Holders: { wBTC: '0xbB2BD754A45f400A01158A8b3C89DE085D58ABF1', renBTC: '0xb8D1D22609D10078Db36915fc4610F8674b44319', ADAI: '0xc5ed2333f8a2C351fCA35E5EBAdb2A82F5d254C3', - MIM: '0x652aD82d4CcbA3b162094b7bee69436d36754317', + MIM: '0x64cb3f5aada07d831b8db6c6d9c715c53c251ef3', TSD: '0x691A89db352B72dDb249bFe16503494eC0D920A4', THO: '0xc40d16c47394a506d451475c8a7c46c1175c1da1', aAvaUSDT: '0x50B1Ba98Cf117c9682048D56628B294ebbAA4ec2', @@ -877,9 +923,11 @@ export const Holders: { }, [Network.ARBITRUM]: { ETH: '0xF977814e90dA44bFA03b6295A0616a897441aceC', - DAI: '0xc5ed2333f8a2C351fCA35E5EBAdb2A82F5d254C3', - WETH: '0xc2707568D31F3fB1Fc55B2F8b2ae5682eAa72041', - USDC: '0xd6216fc19db775df9774a6e33526131da7d19a2c', + DAI: '0x252cd7185db7c3689a571096d5b57d45681aa080', + WETH: '0xb7e50106a5bd3cf21af210a755f9c8740890a8c9', + USDC: '0x905dfcd5649217c42684f23958568e533c711aa3', + USDT: '0x9dd329f5411466d9e0c488ff72519ca9fef0cb40', + POPS: '0x4b78b52e7de4d8b7d367297cb8a87c1875a9d591', FRAX: '0x59bf0545fca0e5ad48e13da269facd2e8c886ba4', nUSD: '0x9dd329f5411466d9e0c488ff72519ca9fef0cb40', nETH: '0xa067668661c84476afcdc6fa5d758c4c01c34352', @@ -895,6 +943,7 @@ export const Holders: { ETH: '0x9ef21bE1C270AA1c3c3d750F458442397fBFFCB6', DAI: '0x1337bedc9d22ecbe766df105c9623922a27963ec', WETH: '0x68F5C0A2DE713a54991E01858Fd27a3832401849', + POPS: '0x3cbd9044aaabef08ce93a68448e093cff405ad76', USDC: '0xEBb8EA128BbdFf9a1780A4902A9380022371d466', USDT: '0xEBb8EA128BbdFf9a1780A4902A9380022371d466', OP: '0xEBb8EA128BbdFf9a1780A4902A9380022371d466', diff --git a/tests/utils-e2e.ts b/tests/utils-e2e.ts index 9f18f329e..4dd053148 100644 --- a/tests/utils-e2e.ts +++ b/tests/utils-e2e.ts @@ -246,8 +246,8 @@ export async function testE2E( ); expect(parseFloat(priceRoute.destAmount)).toBeGreaterThan(0); - // Calculate slippage. Default is 7% - const _slippage = slippage || 700; + // Calculate slippage. Default is 1% + const _slippage = slippage || 100; const minMaxAmount = (swapSide === SwapSide.SELL ? BigInt(priceRoute.destAmount) * (10000n - BigInt(_slippage))