@paraswap/dex-lib 2.50.5 → 2.50.6-sdai
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/abi/maker-psm/pot.json +322 -0
- package/build/abi/{angle/stagToken.json → sdai/SavingsDai.abi.json} +177 -263
- package/build/config.js +2 -1
- package/build/config.js.map +1 -1
- package/build/dex/curve-v1-factory/config.js +11 -128
- package/build/dex/curve-v1-factory/config.js.map +1 -1
- package/build/dex/curve-v1-factory/curve-v1-factory.d.ts +0 -1
- package/build/dex/curve-v1-factory/curve-v1-factory.js +17 -29
- package/build/dex/curve-v1-factory/curve-v1-factory.js.map +1 -1
- package/build/dex/curve-v1-factory/curve-v1-pool-manager.js +0 -1
- package/build/dex/curve-v1-factory/curve-v1-pool-manager.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_calc_withdraw_one_coin.js +0 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_calc_withdraw_one_coin.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_dynamic_fee.js +1 -4
- package/build/dex/curve-v1-factory/price-handlers/functions/_dynamic_fee.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_rates.js +0 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_rates.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_xp.js +0 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_xp.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_xp_mem.js +0 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_xp_mem.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/calc_token_amount.js +0 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/calc_token_amount.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/calc_withdraw_one_coin.js +0 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/calc_withdraw_one_coin.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/constants.js +0 -10
- package/build/dex/curve-v1-factory/price-handlers/functions/constants.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D.js +0 -40
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D_mem.js +0 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D_mem.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D_precisions.js +0 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D_precisions.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dy.js +0 -24
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dy.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dy_underlying.js +0 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dy_underlying.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_y.js +0 -53
- package/build/dex/curve-v1-factory/price-handlers/functions/get_y.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_y_D.js +0 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_y_D.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/utils.d.ts +0 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/utils.js +1 -5
- package/build/dex/curve-v1-factory/price-handlers/functions/utils.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/types.d.ts +2 -2
- package/build/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.d.ts +2 -3
- package/build/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.js +6 -38
- package/build/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.js.map +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/pool-polling-base.js.map +1 -1
- package/build/dex/curve-v1-factory/types.d.ts +2 -11
- package/build/dex/curve-v1-factory/types.js +0 -3
- package/build/dex/curve-v1-factory/types.js.map +1 -1
- package/build/dex/hashflow/constants.d.ts +0 -27
- package/build/dex/hashflow/constants.js +1 -29
- package/build/dex/hashflow/constants.js.map +1 -1
- package/build/dex/hashflow/hashflow.d.ts +2 -3
- package/build/dex/hashflow/hashflow.js +12 -69
- package/build/dex/hashflow/hashflow.js.map +1 -1
- package/build/dex/hashflow/types.d.ts +0 -11
- package/build/dex/hashflow/types.js +0 -9
- package/build/dex/hashflow/types.js.map +1 -1
- package/build/dex/idex.d.ts +1 -1
- package/build/dex/index.d.ts +2 -2
- package/build/dex/index.js +2 -0
- package/build/dex/index.js.map +1 -1
- package/build/dex/pancakeswap-v3/config.js +0 -15
- package/build/dex/pancakeswap-v3/config.js.map +1 -1
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js +1 -1
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js.map +1 -1
- package/build/dex/sdai/config.d.ts +11 -0
- package/build/dex/sdai/config.js +24 -0
- package/build/dex/sdai/config.js.map +1 -0
- package/build/dex/sdai/constants.d.ts +2 -0
- package/build/dex/sdai/constants.js +6 -0
- package/build/dex/sdai/constants.js.map +1 -0
- package/build/dex/sdai/scripts/validate-state.d.ts +1 -0
- package/build/dex/sdai/scripts/validate-state.js +102 -0
- package/build/dex/sdai/scripts/validate-state.js.map +1 -0
- package/build/dex/sdai/sdai-pool.d.ts +16 -0
- package/build/dex/sdai/sdai-pool.js +85 -0
- package/build/dex/sdai/sdai-pool.js.map +1 -0
- package/build/dex/sdai/sdai.d.ts +51 -0
- package/build/dex/sdai/sdai.js +172 -0
- package/build/dex/sdai/sdai.js.map +1 -0
- package/build/dex/sdai/types.d.ts +21 -0
- package/build/dex/sdai/types.js +11 -0
- package/build/dex/sdai/types.js.map +1 -0
- package/build/dex/sdai/utils.d.ts +4 -0
- package/build/dex/sdai/utils.js +39 -0
- package/build/dex/sdai/utils.js.map +1 -0
- package/build/dex/woo-fi-v2/config.js +4 -4
- package/package.json +1 -1
- package/src/abi/maker-psm/pot.json +322 -0
- package/src/abi/sdai/SavingsDai.abi.json +877 -0
- package/src/abi/uniswap-v3/AlienBaseV3Router.abi.json +52 -0
- package/src/config.ts +2 -1
- package/src/dex/curve-v1-factory/config.ts +11 -128
- package/src/dex/curve-v1-factory/curve-v1-factory-e2e.test.ts +1 -123
- package/src/dex/curve-v1-factory/curve-v1-factory-integration.test.ts +0 -392
- package/src/dex/curve-v1-factory/curve-v1-factory.ts +39 -61
- package/src/dex/curve-v1-factory/curve-v1-pool-manager.ts +0 -1
- package/src/dex/curve-v1-factory/price-handlers/functions/_calc_withdraw_one_coin.ts +0 -2
- package/src/dex/curve-v1-factory/price-handlers/functions/_dynamic_fee.ts +2 -6
- package/src/dex/curve-v1-factory/price-handlers/functions/_rates.ts +0 -2
- package/src/dex/curve-v1-factory/price-handlers/functions/_xp.ts +0 -2
- package/src/dex/curve-v1-factory/price-handlers/functions/_xp_mem.ts +0 -2
- package/src/dex/curve-v1-factory/price-handlers/functions/calc_token_amount.ts +0 -2
- package/src/dex/curve-v1-factory/price-handlers/functions/calc_withdraw_one_coin.ts +0 -2
- package/src/dex/curve-v1-factory/price-handlers/functions/constants.ts +0 -11
- package/src/dex/curve-v1-factory/price-handlers/functions/get_D.ts +1 -59
- package/src/dex/curve-v1-factory/price-handlers/functions/get_D_mem.ts +0 -2
- package/src/dex/curve-v1-factory/price-handlers/functions/get_D_precisions.ts +0 -2
- package/src/dex/curve-v1-factory/price-handlers/functions/get_dy.ts +0 -51
- package/src/dex/curve-v1-factory/price-handlers/functions/get_dy_underlying.ts +0 -2
- package/src/dex/curve-v1-factory/price-handlers/functions/get_y.ts +1 -68
- package/src/dex/curve-v1-factory/price-handlers/functions/get_y_D.ts +0 -2
- package/src/dex/curve-v1-factory/price-handlers/functions/utils.ts +0 -4
- package/src/dex/curve-v1-factory/price-handlers/types.ts +1 -8
- package/src/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.ts +18 -71
- package/src/dex/curve-v1-factory/state-polling-pools/pool-polling-base.ts +0 -1
- package/src/dex/curve-v1-factory/types.ts +1 -12
- package/src/dex/hashflow/constants.ts +0 -32
- package/src/dex/hashflow/hashflow.ts +19 -121
- package/src/dex/hashflow/types.ts +2 -20
- package/src/dex/idex.ts +1 -1
- package/src/dex/index.ts +4 -2
- package/src/dex/pancakeswap-v3/config.ts +0 -16
- package/src/dex/pancakeswap-v3/pancakeswap-v3.ts +1 -3
- package/src/dex/sdai/config.ts +28 -0
- package/src/dex/sdai/constants.ts +2 -0
- package/src/dex/sdai/scripts/validate-state.ts +144 -0
- package/src/dex/sdai/sdai-e2e.test.ts +96 -0
- package/src/dex/sdai/sdai-events.test.ts +105 -0
- package/src/dex/sdai/sdai-integration.test.ts +148 -0
- package/src/dex/sdai/sdai-pool.ts +113 -0
- package/src/dex/sdai/sdai.ts +233 -0
- package/src/dex/sdai/types.ts +23 -0
- package/src/dex/sdai/utils.ts +48 -0
- package/src/dex/woo-fi-v2/config.ts +4 -4
- package/tests/constants-e2e.ts +3 -38
- package/tests/utils-e2e.ts +0 -1
- package/build/abi/Redstone.json +0 -739
- package/build/abi/angle-transmuter/MorphoOracle.json +0 -193
- package/build/abi/angle-transmuter/MorphoVault.json +0 -2506
- package/build/abi/angle-transmuter/Pyth.json +0 -1534
- package/build/abi/angle-transmuter/Transmuter.json +0 -1711
- package/build/abi/pharaoh/PharaohPool.abi.json +0 -1582
- package/build/abi/smardex/smardex-factory.json +0 -185
- package/build/abi/smardex/smardex-pool.json +0 -578
- package/build/abi/smardex/smardex-router.json +0 -648
- package/build/abi/trader-joe-v2_1/FactoryABI.json +0 -1208
- package/build/abi/trader-joe-v2_1/PairABI.json +0 -1493
- package/build/abi/trader-joe-v2_1/RouterABI.json +0 -1489
- package/build/abi/trader-joe-v2_1/StateMulticall.json +0 -193
- package/build/abi/wombat/pool.json +0 -1289
- package/build/dex/aave-v2/tokens-avalanche.json +0 -44
- package/build/dex/aave-v2/tokens-mainnet.json +0 -188
- package/build/dex/aave-v2/tokens-polygon.json +0 -44
- package/build/dex/angle-staked-stable/angle-staked-stable-pool.d.ts +0 -55
- package/build/dex/angle-staked-stable/angle-staked-stable-pool.js +0 -183
- package/build/dex/angle-staked-stable/angle-staked-stable-pool.js.map +0 -1
- package/build/dex/angle-staked-stable/angle-staked-stable.d.ts +0 -50
- package/build/dex/angle-staked-stable/angle-staked-stable.js +0 -228
- package/build/dex/angle-staked-stable/angle-staked-stable.js.map +0 -1
- package/build/dex/angle-staked-stable/config.d.ts +0 -4
- package/build/dex/angle-staked-stable/config.js +0 -139
- package/build/dex/angle-staked-stable/config.js.map +0 -1
- package/build/dex/angle-staked-stable/types.d.ts +0 -15
- package/build/dex/angle-staked-stable/types.js +0 -3
- package/build/dex/angle-staked-stable/types.js.map +0 -1
- package/build/dex/angle-transmuter/angle-transmuter-pool.d.ts +0 -61
- package/build/dex/angle-transmuter/angle-transmuter-pool.js +0 -415
- package/build/dex/angle-transmuter/angle-transmuter-pool.js.map +0 -1
- package/build/dex/angle-transmuter/angle-transmuter.d.ts +0 -59
- package/build/dex/angle-transmuter/angle-transmuter.js +0 -262
- package/build/dex/angle-transmuter/angle-transmuter.js.map +0 -1
- package/build/dex/angle-transmuter/backedOracle.d.ts +0 -19
- package/build/dex/angle-transmuter/backedOracle.js +0 -56
- package/build/dex/angle-transmuter/backedOracle.js.map +0 -1
- package/build/dex/angle-transmuter/config.d.ts +0 -4
- package/build/dex/angle-transmuter/config.js +0 -30
- package/build/dex/angle-transmuter/config.js.map +0 -1
- package/build/dex/angle-transmuter/constants.d.ts +0 -77
- package/build/dex/angle-transmuter/constants.js +0 -94
- package/build/dex/angle-transmuter/constants.js.map +0 -1
- package/build/dex/angle-transmuter/morphoOracle.d.ts +0 -42
- package/build/dex/angle-transmuter/morphoOracle.js +0 -179
- package/build/dex/angle-transmuter/morphoOracle.js.map +0 -1
- package/build/dex/angle-transmuter/morphoVault.d.ts +0 -19
- package/build/dex/angle-transmuter/morphoVault.js +0 -78
- package/build/dex/angle-transmuter/morphoVault.js.map +0 -1
- package/build/dex/angle-transmuter/pyth.d.ts +0 -19
- package/build/dex/angle-transmuter/pyth.js +0 -70
- package/build/dex/angle-transmuter/pyth.js.map +0 -1
- package/build/dex/angle-transmuter/redstone.d.ts +0 -20
- package/build/dex/angle-transmuter/redstone.js +0 -73
- package/build/dex/angle-transmuter/redstone.js.map +0 -1
- package/build/dex/angle-transmuter/transmuter.d.ts +0 -52
- package/build/dex/angle-transmuter/transmuter.js +0 -374
- package/build/dex/angle-transmuter/transmuter.js.map +0 -1
- package/build/dex/angle-transmuter/types.d.ts +0 -188
- package/build/dex/angle-transmuter/types.js +0 -33
- package/build/dex/angle-transmuter/types.js.map +0 -1
- package/build/dex/angle-transmuter/utils.d.ts +0 -9
- package/build/dex/angle-transmuter/utils.js +0 -252
- package/build/dex/angle-transmuter/utils.js.map +0 -1
- package/build/dex/smardex/subgraph-queries.d.ts +0 -1
- package/build/dex/smardex/subgraph-queries.js +0 -17
- package/build/dex/smardex/subgraph-queries.js.map +0 -1
- package/build/dex/smardex/usd-reserves.d.ts +0 -23
- package/build/dex/smardex/usd-reserves.js +0 -86
- package/build/dex/smardex/usd-reserves.js.map +0 -1
- package/build/dex/trader-joe-v2-1-2/config.d.ts +0 -4
- package/build/dex/trader-joe-v2-1-2/config.js +0 -47
- package/build/dex/trader-joe-v2-1-2/config.js.map +0 -1
- package/build/dex/trader-joe-v2-1-2/constants.d.ts +0 -20
- package/build/dex/trader-joe-v2-1-2/constants.js +0 -22
- package/build/dex/trader-joe-v2-1-2/constants.js.map +0 -1
- package/build/dex/trader-joe-v2-1-2/math/index.d.ts +0 -37
- package/build/dex/trader-joe-v2-1-2/math/index.js +0 -291
- package/build/dex/trader-joe-v2-1-2/math/index.js.map +0 -1
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2-pool.d.ts +0 -60
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2-pool.js +0 -248
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2-pool.js.map +0 -1
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2.d.ts +0 -53
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2.js +0 -307
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2.js.map +0 -1
- package/build/dex/trader-joe-v2-1-2/types.d.ts +0 -82
- package/build/dex/trader-joe-v2-1-2/types.js +0 -9
- package/build/dex/trader-joe-v2-1-2/types.js.map +0 -1
- package/build/dex/trader-joe-v2_1/config.d.ts +0 -4
- package/build/dex/trader-joe-v2_1/config.js +0 -47
- package/build/dex/trader-joe-v2_1/config.js.map +0 -1
- package/build/dex/trader-joe-v2_1/constants.d.ts +0 -20
- package/build/dex/trader-joe-v2_1/constants.js +0 -22
- package/build/dex/trader-joe-v2_1/constants.js.map +0 -1
- package/build/dex/trader-joe-v2_1/math/index.d.ts +0 -37
- package/build/dex/trader-joe-v2_1/math/index.js +0 -291
- package/build/dex/trader-joe-v2_1/math/index.js.map +0 -1
- package/build/dex/trader-joe-v2_1/trader-joe-v2.1.d.ts +0 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2.1.js +0 -384
- package/build/dex/trader-joe-v2_1/trader-joe-v2.1.js.map +0 -1
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1-pool.d.ts +0 -60
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1-pool.js +0 -247
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1-pool.js.map +0 -1
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1.d.ts +0 -53
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1.js +0 -307
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1.js.map +0 -1
- package/build/dex/trader-joe-v2_1/types.d.ts +0 -82
- package/build/dex/trader-joe-v2_1/types.js +0 -9
- package/build/dex/trader-joe-v2_1/types.js.map +0 -1
- package/build/dex/wombat/wombat-pool-poller.d.ts +0 -22
- package/build/dex/wombat/wombat-pool-poller.js +0 -164
- package/build/dex/wombat/wombat-pool-poller.js.map +0 -1
- package/build/dex-helper/Cache.d.ts +0 -31
- package/build/dex-helper/Cache.js +0 -106
- package/build/dex-helper/Cache.js.map +0 -1
- package/build/dex-helper/RedisBatcher.d.ts +0 -20
- package/build/dex-helper/RedisBatcher.js +0 -75
- package/build/dex-helper/RedisBatcher.js.map +0 -1
- package/build/dex-helper/RedisWrapper.d.ts +0 -37
- package/build/dex-helper/RedisWrapper.js +0 -165
- package/build/dex-helper/RedisWrapper.js.map +0 -1
|
@@ -698,396 +698,4 @@ describe('CurveV1Factory', function () {
|
|
|
698
698
|
}
|
|
699
699
|
});
|
|
700
700
|
});
|
|
701
|
-
|
|
702
|
-
describe('Stable NG', () => {
|
|
703
|
-
describe('Mainnet', () => {
|
|
704
|
-
const network = Network.MAINNET;
|
|
705
|
-
const dexHelper = new DummyDexHelper(network);
|
|
706
|
-
|
|
707
|
-
const tokens = Tokens[network];
|
|
708
|
-
|
|
709
|
-
beforeAll(async () => {
|
|
710
|
-
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
711
|
-
// @ts-expect-error for testing there is dummy blocknumber, but it is not
|
|
712
|
-
// part of the interface
|
|
713
|
-
dexHelper.blockManager._blockNumber = blockNumber;
|
|
714
|
-
console.log(
|
|
715
|
-
`Received blockNumber ${blockNumber} on network ${dexHelper.config.data.network}`,
|
|
716
|
-
);
|
|
717
|
-
curveV1Factory = new CurveV1Factory(network, dexKey, dexHelper);
|
|
718
|
-
if (curveV1Factory.initializePricing) {
|
|
719
|
-
await curveV1Factory.initializePricing(blockNumber);
|
|
720
|
-
}
|
|
721
|
-
});
|
|
722
|
-
|
|
723
|
-
describe('GHO -> USDe', () => {
|
|
724
|
-
const srcTokenSymbol = 'GHO';
|
|
725
|
-
const destTokenSymbol = 'USDe';
|
|
726
|
-
const amountsForSell = [
|
|
727
|
-
0n,
|
|
728
|
-
1n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
729
|
-
2n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
730
|
-
3n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
731
|
-
4n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
732
|
-
5n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
733
|
-
6n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
734
|
-
7n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
735
|
-
8n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
736
|
-
9n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
737
|
-
10n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
738
|
-
];
|
|
739
|
-
|
|
740
|
-
it('getPoolIdentifiers and getPricesVolume SELL', async function () {
|
|
741
|
-
await testPricingOnNetwork(
|
|
742
|
-
curveV1Factory,
|
|
743
|
-
network,
|
|
744
|
-
dexKey,
|
|
745
|
-
blockNumber,
|
|
746
|
-
srcTokenSymbol,
|
|
747
|
-
destTokenSymbol,
|
|
748
|
-
SwapSide.SELL,
|
|
749
|
-
amountsForSell,
|
|
750
|
-
);
|
|
751
|
-
});
|
|
752
|
-
|
|
753
|
-
it('getTopPoolsForToken', async function () {
|
|
754
|
-
// We have to check without calling initializePricing, because
|
|
755
|
-
// pool-tracker is not calling that function
|
|
756
|
-
const newCurveV1Factory = new CurveV1Factory(
|
|
757
|
-
network,
|
|
758
|
-
dexKey,
|
|
759
|
-
dexHelper,
|
|
760
|
-
);
|
|
761
|
-
if (newCurveV1Factory.updatePoolState) {
|
|
762
|
-
await newCurveV1Factory.updatePoolState();
|
|
763
|
-
}
|
|
764
|
-
const poolLiquidity = await newCurveV1Factory.getTopPoolsForToken(
|
|
765
|
-
tokens[srcTokenSymbol].address,
|
|
766
|
-
10,
|
|
767
|
-
);
|
|
768
|
-
console.log(`${srcTokenSymbol} Top Pools:`, poolLiquidity);
|
|
769
|
-
|
|
770
|
-
if (!newCurveV1Factory.hasConstantPriceLargeAmounts) {
|
|
771
|
-
checkPoolsLiquidity(
|
|
772
|
-
poolLiquidity,
|
|
773
|
-
Tokens[network][srcTokenSymbol].address,
|
|
774
|
-
dexKey,
|
|
775
|
-
);
|
|
776
|
-
}
|
|
777
|
-
});
|
|
778
|
-
});
|
|
779
|
-
});
|
|
780
|
-
|
|
781
|
-
describe('Polygon', () => {
|
|
782
|
-
const network = Network.POLYGON;
|
|
783
|
-
const dexHelper = new DummyDexHelper(network);
|
|
784
|
-
|
|
785
|
-
const tokens = Tokens[network];
|
|
786
|
-
|
|
787
|
-
beforeAll(async () => {
|
|
788
|
-
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
789
|
-
// @ts-expect-error for testing there is dummy blocknumber, but it is not
|
|
790
|
-
// part of the interface
|
|
791
|
-
dexHelper.blockManager._blockNumber = blockNumber;
|
|
792
|
-
console.log(
|
|
793
|
-
`Received blockNumber ${blockNumber} on network ${dexHelper.config.data.network}`,
|
|
794
|
-
);
|
|
795
|
-
curveV1Factory = new CurveV1Factory(network, dexKey, dexHelper);
|
|
796
|
-
if (curveV1Factory.initializePricing) {
|
|
797
|
-
await curveV1Factory.initializePricing(blockNumber);
|
|
798
|
-
}
|
|
799
|
-
});
|
|
800
|
-
|
|
801
|
-
describe('crvUSD -> USDT', () => {
|
|
802
|
-
const srcTokenSymbol = 'crvUSD';
|
|
803
|
-
const destTokenSymbol = 'USDT';
|
|
804
|
-
const amountsForSell = [
|
|
805
|
-
0n,
|
|
806
|
-
1n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
807
|
-
2n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
808
|
-
3n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
809
|
-
4n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
810
|
-
5n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
811
|
-
6n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
812
|
-
7n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
813
|
-
8n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
814
|
-
9n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
815
|
-
10n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
816
|
-
];
|
|
817
|
-
|
|
818
|
-
it('getPoolIdentifiers and getPricesVolume SELL', async function () {
|
|
819
|
-
await testPricingOnNetwork(
|
|
820
|
-
curveV1Factory,
|
|
821
|
-
network,
|
|
822
|
-
dexKey,
|
|
823
|
-
blockNumber,
|
|
824
|
-
srcTokenSymbol,
|
|
825
|
-
destTokenSymbol,
|
|
826
|
-
SwapSide.SELL,
|
|
827
|
-
amountsForSell,
|
|
828
|
-
);
|
|
829
|
-
});
|
|
830
|
-
|
|
831
|
-
it('getTopPoolsForToken', async function () {
|
|
832
|
-
// We have to check without calling initializePricing, because
|
|
833
|
-
// pool-tracker is not calling that function
|
|
834
|
-
const newCurveV1Factory = new CurveV1Factory(
|
|
835
|
-
network,
|
|
836
|
-
dexKey,
|
|
837
|
-
dexHelper,
|
|
838
|
-
);
|
|
839
|
-
if (newCurveV1Factory.updatePoolState) {
|
|
840
|
-
await newCurveV1Factory.updatePoolState();
|
|
841
|
-
}
|
|
842
|
-
const poolLiquidity = await newCurveV1Factory.getTopPoolsForToken(
|
|
843
|
-
tokens[srcTokenSymbol].address,
|
|
844
|
-
10,
|
|
845
|
-
);
|
|
846
|
-
console.log(`${srcTokenSymbol} Top Pools:`, poolLiquidity);
|
|
847
|
-
|
|
848
|
-
if (!newCurveV1Factory.hasConstantPriceLargeAmounts) {
|
|
849
|
-
checkPoolsLiquidity(
|
|
850
|
-
poolLiquidity,
|
|
851
|
-
Tokens[network][srcTokenSymbol].address,
|
|
852
|
-
dexKey,
|
|
853
|
-
);
|
|
854
|
-
}
|
|
855
|
-
});
|
|
856
|
-
});
|
|
857
|
-
});
|
|
858
|
-
|
|
859
|
-
describe('Fantom', () => {
|
|
860
|
-
const network = Network.FANTOM;
|
|
861
|
-
const dexHelper = new DummyDexHelper(network);
|
|
862
|
-
|
|
863
|
-
const tokens = Tokens[network];
|
|
864
|
-
|
|
865
|
-
beforeAll(async () => {
|
|
866
|
-
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
867
|
-
// @ts-expect-error for testing there is dummy blocknumber, but it is not
|
|
868
|
-
// part of the interface
|
|
869
|
-
dexHelper.blockManager._blockNumber = blockNumber;
|
|
870
|
-
console.log(
|
|
871
|
-
`Received blockNumber ${blockNumber} on network ${dexHelper.config.data.network}`,
|
|
872
|
-
);
|
|
873
|
-
curveV1Factory = new CurveV1Factory(network, dexKey, dexHelper);
|
|
874
|
-
if (curveV1Factory.initializePricing) {
|
|
875
|
-
await curveV1Factory.initializePricing(blockNumber);
|
|
876
|
-
}
|
|
877
|
-
});
|
|
878
|
-
|
|
879
|
-
describe('scrvUSDC_e -> scrvUSDC_p', () => {
|
|
880
|
-
const srcTokenSymbol = 'scrvUSDC_e';
|
|
881
|
-
const destTokenSymbol = 'scrvUSDC_p';
|
|
882
|
-
const amountsForSell = [
|
|
883
|
-
0n,
|
|
884
|
-
1n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
885
|
-
2n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
886
|
-
3n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
887
|
-
4n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
888
|
-
5n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
889
|
-
6n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
890
|
-
7n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
891
|
-
8n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
892
|
-
9n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
893
|
-
10n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
894
|
-
];
|
|
895
|
-
|
|
896
|
-
it('getPoolIdentifiers and getPricesVolume SELL', async function () {
|
|
897
|
-
await testPricingOnNetwork(
|
|
898
|
-
curveV1Factory,
|
|
899
|
-
network,
|
|
900
|
-
dexKey,
|
|
901
|
-
blockNumber,
|
|
902
|
-
srcTokenSymbol,
|
|
903
|
-
destTokenSymbol,
|
|
904
|
-
SwapSide.SELL,
|
|
905
|
-
amountsForSell,
|
|
906
|
-
);
|
|
907
|
-
});
|
|
908
|
-
|
|
909
|
-
it('getTopPoolsForToken', async function () {
|
|
910
|
-
// We have to check without calling initializePricing, because
|
|
911
|
-
// pool-tracker is not calling that function
|
|
912
|
-
const newCurveV1Factory = new CurveV1Factory(
|
|
913
|
-
network,
|
|
914
|
-
dexKey,
|
|
915
|
-
dexHelper,
|
|
916
|
-
);
|
|
917
|
-
if (newCurveV1Factory.updatePoolState) {
|
|
918
|
-
await newCurveV1Factory.updatePoolState();
|
|
919
|
-
}
|
|
920
|
-
const poolLiquidity = await newCurveV1Factory.getTopPoolsForToken(
|
|
921
|
-
tokens[srcTokenSymbol].address,
|
|
922
|
-
10,
|
|
923
|
-
);
|
|
924
|
-
console.log(`${srcTokenSymbol} Top Pools:`, poolLiquidity);
|
|
925
|
-
|
|
926
|
-
if (!newCurveV1Factory.hasConstantPriceLargeAmounts) {
|
|
927
|
-
checkPoolsLiquidity(
|
|
928
|
-
poolLiquidity,
|
|
929
|
-
Tokens[network][srcTokenSymbol].address,
|
|
930
|
-
dexKey,
|
|
931
|
-
);
|
|
932
|
-
}
|
|
933
|
-
});
|
|
934
|
-
});
|
|
935
|
-
});
|
|
936
|
-
|
|
937
|
-
describe('Arbitrum', () => {
|
|
938
|
-
const network = Network.ARBITRUM;
|
|
939
|
-
const dexHelper = new DummyDexHelper(network);
|
|
940
|
-
|
|
941
|
-
const tokens = Tokens[network];
|
|
942
|
-
|
|
943
|
-
beforeAll(async () => {
|
|
944
|
-
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
945
|
-
// @ts-expect-error for testing there is dummy blocknumber, but it is not
|
|
946
|
-
// part of the interface
|
|
947
|
-
dexHelper.blockManager._blockNumber = blockNumber;
|
|
948
|
-
console.log(
|
|
949
|
-
`Received blockNumber ${blockNumber} on network ${dexHelper.config.data.network}`,
|
|
950
|
-
);
|
|
951
|
-
curveV1Factory = new CurveV1Factory(network, dexKey, dexHelper);
|
|
952
|
-
if (curveV1Factory.initializePricing) {
|
|
953
|
-
await curveV1Factory.initializePricing(blockNumber);
|
|
954
|
-
}
|
|
955
|
-
});
|
|
956
|
-
|
|
957
|
-
describe('crvUSD -> USDCe', () => {
|
|
958
|
-
const srcTokenSymbol = 'crvUSD';
|
|
959
|
-
const destTokenSymbol = 'USDCe';
|
|
960
|
-
const amountsForSell = [
|
|
961
|
-
0n,
|
|
962
|
-
1n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
963
|
-
2n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
964
|
-
3n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
965
|
-
4n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
966
|
-
5n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
967
|
-
6n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
968
|
-
7n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
969
|
-
8n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
970
|
-
9n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
971
|
-
10n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
972
|
-
];
|
|
973
|
-
|
|
974
|
-
it('getPoolIdentifiers and getPricesVolume SELL', async function () {
|
|
975
|
-
await testPricingOnNetwork(
|
|
976
|
-
curveV1Factory,
|
|
977
|
-
network,
|
|
978
|
-
dexKey,
|
|
979
|
-
blockNumber,
|
|
980
|
-
srcTokenSymbol,
|
|
981
|
-
destTokenSymbol,
|
|
982
|
-
SwapSide.SELL,
|
|
983
|
-
amountsForSell,
|
|
984
|
-
);
|
|
985
|
-
});
|
|
986
|
-
|
|
987
|
-
it('getTopPoolsForToken', async function () {
|
|
988
|
-
// We have to check without calling initializePricing, because
|
|
989
|
-
// pool-tracker is not calling that function
|
|
990
|
-
const newCurveV1Factory = new CurveV1Factory(
|
|
991
|
-
network,
|
|
992
|
-
dexKey,
|
|
993
|
-
dexHelper,
|
|
994
|
-
);
|
|
995
|
-
if (newCurveV1Factory.updatePoolState) {
|
|
996
|
-
await newCurveV1Factory.updatePoolState();
|
|
997
|
-
}
|
|
998
|
-
const poolLiquidity = await newCurveV1Factory.getTopPoolsForToken(
|
|
999
|
-
tokens[srcTokenSymbol].address,
|
|
1000
|
-
10,
|
|
1001
|
-
);
|
|
1002
|
-
console.log(`${srcTokenSymbol} Top Pools:`, poolLiquidity);
|
|
1003
|
-
|
|
1004
|
-
if (!newCurveV1Factory.hasConstantPriceLargeAmounts) {
|
|
1005
|
-
checkPoolsLiquidity(
|
|
1006
|
-
poolLiquidity,
|
|
1007
|
-
Tokens[network][srcTokenSymbol].address,
|
|
1008
|
-
dexKey,
|
|
1009
|
-
);
|
|
1010
|
-
}
|
|
1011
|
-
});
|
|
1012
|
-
});
|
|
1013
|
-
});
|
|
1014
|
-
|
|
1015
|
-
describe('Optimism', () => {
|
|
1016
|
-
const network = Network.OPTIMISM;
|
|
1017
|
-
const dexHelper = new DummyDexHelper(network);
|
|
1018
|
-
|
|
1019
|
-
const tokens = Tokens[network];
|
|
1020
|
-
|
|
1021
|
-
beforeAll(async () => {
|
|
1022
|
-
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
1023
|
-
// @ts-expect-error for testing there is dummy blocknumber, but it is not
|
|
1024
|
-
// part of the interface
|
|
1025
|
-
dexHelper.blockManager._blockNumber = blockNumber;
|
|
1026
|
-
console.log(
|
|
1027
|
-
`Received blockNumber ${blockNumber} on network ${dexHelper.config.data.network}`,
|
|
1028
|
-
);
|
|
1029
|
-
curveV1Factory = new CurveV1Factory(network, dexKey, dexHelper);
|
|
1030
|
-
if (curveV1Factory.initializePricing) {
|
|
1031
|
-
await curveV1Factory.initializePricing(blockNumber);
|
|
1032
|
-
}
|
|
1033
|
-
});
|
|
1034
|
-
|
|
1035
|
-
describe('crvUSD -> USDT', () => {
|
|
1036
|
-
const srcTokenSymbol = 'crvUSD';
|
|
1037
|
-
const destTokenSymbol = 'USDT';
|
|
1038
|
-
const amountsForSell = [
|
|
1039
|
-
0n,
|
|
1040
|
-
1n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
1041
|
-
2n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
1042
|
-
3n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
1043
|
-
4n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
1044
|
-
5n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
1045
|
-
6n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
1046
|
-
7n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
1047
|
-
8n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
1048
|
-
9n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
1049
|
-
10n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
1050
|
-
];
|
|
1051
|
-
|
|
1052
|
-
it('getPoolIdentifiers and getPricesVolume SELL', async function () {
|
|
1053
|
-
await testPricingOnNetwork(
|
|
1054
|
-
curveV1Factory,
|
|
1055
|
-
network,
|
|
1056
|
-
dexKey,
|
|
1057
|
-
blockNumber,
|
|
1058
|
-
srcTokenSymbol,
|
|
1059
|
-
destTokenSymbol,
|
|
1060
|
-
SwapSide.SELL,
|
|
1061
|
-
amountsForSell,
|
|
1062
|
-
);
|
|
1063
|
-
});
|
|
1064
|
-
|
|
1065
|
-
it('getTopPoolsForToken', async function () {
|
|
1066
|
-
// We have to check without calling initializePricing, because
|
|
1067
|
-
// pool-tracker is not calling that function
|
|
1068
|
-
const newCurveV1Factory = new CurveV1Factory(
|
|
1069
|
-
network,
|
|
1070
|
-
dexKey,
|
|
1071
|
-
dexHelper,
|
|
1072
|
-
);
|
|
1073
|
-
if (newCurveV1Factory.updatePoolState) {
|
|
1074
|
-
await newCurveV1Factory.updatePoolState();
|
|
1075
|
-
}
|
|
1076
|
-
const poolLiquidity = await newCurveV1Factory.getTopPoolsForToken(
|
|
1077
|
-
tokens[srcTokenSymbol].address,
|
|
1078
|
-
10,
|
|
1079
|
-
);
|
|
1080
|
-
console.log(`${srcTokenSymbol} Top Pools:`, poolLiquidity);
|
|
1081
|
-
|
|
1082
|
-
if (!newCurveV1Factory.hasConstantPriceLargeAmounts) {
|
|
1083
|
-
checkPoolsLiquidity(
|
|
1084
|
-
poolLiquidity,
|
|
1085
|
-
Tokens[network][srcTokenSymbol].address,
|
|
1086
|
-
dexKey,
|
|
1087
|
-
);
|
|
1088
|
-
}
|
|
1089
|
-
});
|
|
1090
|
-
});
|
|
1091
|
-
});
|
|
1092
|
-
});
|
|
1093
701
|
});
|
|
@@ -101,8 +101,6 @@ export class CurveV1Factory
|
|
|
101
101
|
readonly isFeeOnTransferSupported = true;
|
|
102
102
|
readonly isStatePollingDex = true;
|
|
103
103
|
|
|
104
|
-
private factoryAddresses: string[];
|
|
105
|
-
|
|
106
104
|
readonly poolManager: CurveV1FactoryPoolManager;
|
|
107
105
|
readonly ifaces: CurveV1FactoryIfaces;
|
|
108
106
|
|
|
@@ -130,8 +128,6 @@ export class CurveV1Factory
|
|
|
130
128
|
) {
|
|
131
129
|
super(dexHelper, dexKey);
|
|
132
130
|
this.logger = dexHelper.getLogger(`${this.dexKey}-${this.network}`);
|
|
133
|
-
this.factoryAddresses =
|
|
134
|
-
this.config.factories?.map(e => e.address.toLowerCase()) || [];
|
|
135
131
|
this.ifaces = {
|
|
136
132
|
exchangeRouter: new Interface(CurveABI),
|
|
137
133
|
factory: new Interface(FactoryCurveV1ABI as JsonFragment[]),
|
|
@@ -352,7 +348,10 @@ export class CurveV1Factory
|
|
|
352
348
|
return;
|
|
353
349
|
}
|
|
354
350
|
|
|
355
|
-
if (
|
|
351
|
+
if (
|
|
352
|
+
!this.config.factoryAddresses ||
|
|
353
|
+
this.config.factoryAddresses.length == 0
|
|
354
|
+
) {
|
|
356
355
|
this.logger.warn(`No factory address specified in configs`);
|
|
357
356
|
return;
|
|
358
357
|
}
|
|
@@ -361,13 +360,13 @@ export class CurveV1Factory
|
|
|
361
360
|
// So I put it here to not forget call, because custom pools must be initialised before factory pools
|
|
362
361
|
// This function may be called multiple times, but will execute only once
|
|
363
362
|
await this.initializeCustomPollingPools(
|
|
364
|
-
this.factoryAddresses,
|
|
363
|
+
this.config.factoryAddresses,
|
|
365
364
|
blockNumber,
|
|
366
365
|
initializeInitialState,
|
|
367
366
|
);
|
|
368
367
|
|
|
369
368
|
await Promise.all(
|
|
370
|
-
this.factoryAddresses.map(async factoryAddress => {
|
|
369
|
+
this.config.factoryAddresses.map(async factoryAddress => {
|
|
371
370
|
try {
|
|
372
371
|
const poolCountResult =
|
|
373
372
|
await this.dexHelper.multiWrapper!.tryAggregate(true, [
|
|
@@ -427,11 +426,6 @@ export class CurveV1Factory
|
|
|
427
426
|
}
|
|
428
427
|
});
|
|
429
428
|
|
|
430
|
-
const factoryConfig = this.config.factories?.find(
|
|
431
|
-
({ address }) =>
|
|
432
|
-
factoryAddress.toLowerCase() === address.toLowerCase(),
|
|
433
|
-
);
|
|
434
|
-
|
|
435
429
|
let callDataFromFactoryPools: MultiCallParams<
|
|
436
430
|
string[] | number[] | string
|
|
437
431
|
>[] = poolAddresses
|
|
@@ -454,11 +448,7 @@ export class CurveV1Factory
|
|
|
454
448
|
): string[] =>
|
|
455
449
|
generalDecoder<string[]>(
|
|
456
450
|
result,
|
|
457
|
-
[
|
|
458
|
-
`address[${
|
|
459
|
-
factoryConfig?.maxPlainCoins?.toString() || ''
|
|
460
|
-
}]`,
|
|
461
|
-
],
|
|
451
|
+
['address[4]'],
|
|
462
452
|
new Array(4).fill(NULL_ADDRESS),
|
|
463
453
|
parsed => parsed[0].map((p: string) => p.toLowerCase()),
|
|
464
454
|
),
|
|
@@ -474,11 +464,7 @@ export class CurveV1Factory
|
|
|
474
464
|
): number[] =>
|
|
475
465
|
generalDecoder<number[]>(
|
|
476
466
|
result,
|
|
477
|
-
[
|
|
478
|
-
`uint256[${
|
|
479
|
-
factoryConfig?.maxPlainCoins?.toString() || ''
|
|
480
|
-
}]`,
|
|
481
|
-
],
|
|
467
|
+
['uint256[4]'],
|
|
482
468
|
[0, 0, 0, 0],
|
|
483
469
|
parsed =>
|
|
484
470
|
parsed[0].map((p: BigNumber) => Number(p.toString())),
|
|
@@ -490,51 +476,43 @@ export class CurveV1Factory
|
|
|
490
476
|
// This is divider between pools related results and implementations
|
|
491
477
|
const factoryResultsDivider = callDataFromFactoryPools.length;
|
|
492
478
|
|
|
493
|
-
const metaPoolImplementations = factoryConfig?.isStableNg
|
|
494
|
-
? []
|
|
495
|
-
: basePoolAddresses.map(basePoolAddress => ({
|
|
496
|
-
target: factoryAddress,
|
|
497
|
-
callData: this.ifaces.factory.encodeFunctionData(
|
|
498
|
-
'metapool_implementations',
|
|
499
|
-
[basePoolAddress],
|
|
500
|
-
),
|
|
501
|
-
decodeFunction: (
|
|
502
|
-
result: MultiResult<BytesLike> | BytesLike,
|
|
503
|
-
): string[] =>
|
|
504
|
-
generalDecoder<string[]>(
|
|
505
|
-
result,
|
|
506
|
-
['address[10]'],
|
|
507
|
-
new Array(10).fill(NULL_ADDRESS),
|
|
508
|
-
parsed => parsed[0].map((p: string) => p.toLowerCase()),
|
|
509
|
-
),
|
|
510
|
-
}));
|
|
511
|
-
|
|
512
|
-
const plainImplementations = factoryConfig?.isStableNg
|
|
513
|
-
? []
|
|
514
|
-
: _.flattenDeep(
|
|
515
|
-
_.range(2, FACTORY_MAX_PLAIN_COINS + 1).map(coinNumber =>
|
|
516
|
-
_.range(FACTORY_MAX_PLAIN_IMPLEMENTATIONS_FOR_COIN).map(
|
|
517
|
-
implInd => ({
|
|
518
|
-
target: factoryAddress,
|
|
519
|
-
callData: this.ifaces.factory.encodeFunctionData(
|
|
520
|
-
'plain_implementations',
|
|
521
|
-
[coinNumber, implInd],
|
|
522
|
-
),
|
|
523
|
-
decodeFunction: addressDecode,
|
|
524
|
-
}),
|
|
525
|
-
),
|
|
526
|
-
),
|
|
527
|
-
);
|
|
528
|
-
|
|
529
479
|
// Implementations must be requested from factory, but it accepts as arg basePool address
|
|
530
480
|
// for metaPools
|
|
531
481
|
callDataFromFactoryPools = callDataFromFactoryPools.concat(
|
|
532
|
-
...
|
|
482
|
+
...basePoolAddresses.map(basePoolAddress => ({
|
|
483
|
+
target: factoryAddress,
|
|
484
|
+
callData: this.ifaces.factory.encodeFunctionData(
|
|
485
|
+
'metapool_implementations',
|
|
486
|
+
[basePoolAddress],
|
|
487
|
+
),
|
|
488
|
+
decodeFunction: (
|
|
489
|
+
result: MultiResult<BytesLike> | BytesLike,
|
|
490
|
+
): string[] =>
|
|
491
|
+
generalDecoder<string[]>(
|
|
492
|
+
result,
|
|
493
|
+
['address[10]'],
|
|
494
|
+
new Array(10).fill(NULL_ADDRESS),
|
|
495
|
+
parsed => parsed[0].map((p: string) => p.toLowerCase()),
|
|
496
|
+
),
|
|
497
|
+
})),
|
|
533
498
|
// To receive plain pool implementation address, you have to call plain_implementations
|
|
534
499
|
// with two variables: N_COINS and implementations_index
|
|
535
500
|
// N_COINS is between 2-4. Currently more than 4 coins is not supported
|
|
536
501
|
// as for implementation index, there are only 0-9 indexes
|
|
537
|
-
...
|
|
502
|
+
..._.flattenDeep(
|
|
503
|
+
_.range(2, FACTORY_MAX_PLAIN_COINS + 1).map(coinNumber =>
|
|
504
|
+
_.range(FACTORY_MAX_PLAIN_IMPLEMENTATIONS_FOR_COIN).map(
|
|
505
|
+
implInd => ({
|
|
506
|
+
target: factoryAddress,
|
|
507
|
+
callData: this.ifaces.factory.encodeFunctionData(
|
|
508
|
+
'plain_implementations',
|
|
509
|
+
[coinNumber, implInd],
|
|
510
|
+
),
|
|
511
|
+
decodeFunction: addressDecode,
|
|
512
|
+
}),
|
|
513
|
+
),
|
|
514
|
+
),
|
|
515
|
+
),
|
|
538
516
|
);
|
|
539
517
|
|
|
540
518
|
const allResultsFromFactory = (
|
|
@@ -641,7 +619,7 @@ export class CurveV1Factory
|
|
|
641
619
|
factoryImplementationFromConfig.name,
|
|
642
620
|
implementationAddress.toLowerCase(),
|
|
643
621
|
poolAddresses[i],
|
|
644
|
-
this.config,
|
|
622
|
+
this.config.stateUpdatePeriodMs,
|
|
645
623
|
factoryAddress,
|
|
646
624
|
poolIdentifier,
|
|
647
625
|
poolConstants,
|
|
@@ -285,8 +285,6 @@ const implementations: Record<ImplementationNames, _calc_withdraw_one_coin> = {
|
|
|
285
285
|
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA]: customArbitrum2CoinBtc,
|
|
286
286
|
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2]: factoryPlain2EthEma2,
|
|
287
287
|
[ImplementationNames.FACTORY_PLAIN_2_CRV_EMA]: customArbitrum2CoinBtc,
|
|
288
|
-
|
|
289
|
-
[ImplementationNames.FACTORY_STABLE_NG]: notImplemented,
|
|
290
288
|
};
|
|
291
289
|
|
|
292
290
|
export default implementations;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
1
2
|
import { ImplementationNames } from '../../types';
|
|
2
3
|
import { IPoolContext, _dynamic_fee } from '../types';
|
|
3
4
|
import { throwNotExist } from './utils';
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
+
const customAvalanche3CoinLending: _dynamic_fee = (
|
|
6
7
|
self: IPoolContext,
|
|
7
8
|
xpi: bigint,
|
|
8
9
|
xpj: bigint,
|
|
@@ -22,9 +23,6 @@ const dynamicFee: _dynamic_fee = (
|
|
|
22
23
|
}
|
|
23
24
|
};
|
|
24
25
|
|
|
25
|
-
const stableNg = dynamicFee;
|
|
26
|
-
const customAvalanche3CoinLending = dynamicFee;
|
|
27
|
-
|
|
28
26
|
const notExist: _dynamic_fee = (
|
|
29
27
|
self: IPoolContext,
|
|
30
28
|
xpi: bigint,
|
|
@@ -96,8 +94,6 @@ const implementations: Record<ImplementationNames, _dynamic_fee> = {
|
|
|
96
94
|
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA]: notExist,
|
|
97
95
|
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2]: notExist,
|
|
98
96
|
[ImplementationNames.FACTORY_PLAIN_2_CRV_EMA]: notExist,
|
|
99
|
-
|
|
100
|
-
[ImplementationNames.FACTORY_STABLE_NG]: stableNg,
|
|
101
97
|
};
|
|
102
98
|
|
|
103
99
|
export default implementations;
|
|
@@ -109,8 +109,6 @@ const implementations: Record<ImplementationNames, _rates> = {
|
|
|
109
109
|
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA]: notExist,
|
|
110
110
|
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2]: notExist,
|
|
111
111
|
[ImplementationNames.FACTORY_PLAIN_2_CRV_EMA]: notExist,
|
|
112
|
-
|
|
113
|
-
[ImplementationNames.FACTORY_STABLE_NG]: notExist,
|
|
114
112
|
};
|
|
115
113
|
|
|
116
114
|
export default implementations;
|
|
@@ -107,8 +107,6 @@ const implementations: Record<ImplementationNames, _xp> = {
|
|
|
107
107
|
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA]: notExist,
|
|
108
108
|
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2]: notExist,
|
|
109
109
|
[ImplementationNames.FACTORY_PLAIN_2_CRV_EMA]: notExist,
|
|
110
|
-
|
|
111
|
-
[ImplementationNames.FACTORY_STABLE_NG]: notExist,
|
|
112
110
|
};
|
|
113
111
|
|
|
114
112
|
export default implementations;
|
|
@@ -96,8 +96,6 @@ const implementations: Record<ImplementationNames, _xp_mem> = {
|
|
|
96
96
|
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA]: factoryPlain2Basic,
|
|
97
97
|
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2]: factoryPlain2Basic,
|
|
98
98
|
[ImplementationNames.FACTORY_PLAIN_2_CRV_EMA]: factoryPlain2Basic,
|
|
99
|
-
|
|
100
|
-
[ImplementationNames.FACTORY_STABLE_NG]: notExist,
|
|
101
99
|
};
|
|
102
100
|
|
|
103
101
|
export default implementations;
|
|
@@ -223,8 +223,6 @@ const implementations: Record<ImplementationNames, calc_token_amount> = {
|
|
|
223
223
|
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA]: customPlain3CoinThree,
|
|
224
224
|
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2]: customPlain3CoinThree,
|
|
225
225
|
[ImplementationNames.FACTORY_PLAIN_2_CRV_EMA]: customPlain2CoinCrv,
|
|
226
|
-
|
|
227
|
-
[ImplementationNames.FACTORY_STABLE_NG]: notImplemented,
|
|
228
226
|
};
|
|
229
227
|
|
|
230
228
|
export default implementations;
|
|
@@ -83,8 +83,6 @@ export const implementations: Record<
|
|
|
83
83
|
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA]: customPlain3CoinThree,
|
|
84
84
|
[ImplementationNames.FACTORY_PLAIN_2_ETH_EMA2]: customPlain3CoinThree,
|
|
85
85
|
[ImplementationNames.FACTORY_PLAIN_2_CRV_EMA]: customPlain3CoinThree,
|
|
86
|
-
|
|
87
|
-
[ImplementationNames.FACTORY_STABLE_NG]: notImplemented,
|
|
88
86
|
};
|
|
89
87
|
|
|
90
88
|
export default implementations;
|
|
@@ -584,17 +584,6 @@ const implementationConstants: Record<
|
|
|
584
584
|
isFeeOnTransferSupported: false,
|
|
585
585
|
isLending: false,
|
|
586
586
|
|
|
587
|
-
N_COINS: 2,
|
|
588
|
-
BI_N_COINS: 2n,
|
|
589
|
-
PRECISION: BI_POWS[18],
|
|
590
|
-
FEE_DENOMINATOR: BI_POWS[10],
|
|
591
|
-
A_PRECISION: 100n,
|
|
592
|
-
},
|
|
593
|
-
[ImplementationNames.FACTORY_STABLE_NG]: {
|
|
594
|
-
isWrapNative: false,
|
|
595
|
-
isFeeOnTransferSupported: false,
|
|
596
|
-
isLending: false,
|
|
597
|
-
|
|
598
587
|
N_COINS: 2,
|
|
599
588
|
BI_N_COINS: 2n,
|
|
600
589
|
PRECISION: BI_POWS[18],
|