@paraswap/dex-lib 4.1.7 → 4.1.8
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/.idea/codeStyles/Project.xml +44 -4
- package/.idea/codeStyles/codeStyleConfig.xml +1 -1
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/paraswap-dex-lib.iml +7 -4
- package/build/dex/angle-staked-stable/angle-staked-stable.js +2 -1
- package/build/dex/angle-staked-stable/angle-staked-stable.js.map +1 -1
- package/build/dex/angle-transmuter/angle-transmuter.js.map +1 -1
- package/build/dex/balancer-v1/config.js +2 -1
- package/build/dex/balancer-v1/config.js.map +1 -1
- package/build/dex/jarvis.d.ts +2 -1
- package/build/dex/jarvis.js +58 -0
- package/build/dex/jarvis.js.map +1 -1
- package/build/dex/weth/weth.js +2 -1
- package/build/dex/weth/weth.js.map +1 -1
- package/build/dex/zerox/index.d.ts +3 -25
- package/build/dex/zerox/index.js +50 -42
- package/build/dex/zerox/index.js.map +1 -1
- package/build/dex/zerox/types.d.ts +29 -0
- package/build/dex/zerox/types.js +8 -1
- package/build/dex/zerox/types.js.map +1 -1
- package/package.json +1 -1
- package/scripts/get-uniswap-v3-dexes.ts +64 -0
- package/src/dex/aave-gsm/aave-gsm-gas-estimation.test.ts +32 -0
- package/src/dex/aave-v2/aave-v2-gas-estimation.test.ts +28 -0
- package/src/dex/aave-v3/aave-v3-gas-estimation.test.ts +66 -0
- package/src/dex/aave-v3-stata/aave-v3-stata-gas-estimation.test.ts +41 -0
- package/src/dex/aave-v3-stata-v2/aave-v3-stata-v2-gas-estimation.test.ts +41 -0
- package/src/dex/angle-staked-stable/angle-staked-stable-gas-estimation.test.ts +29 -0
- package/src/dex/angle-staked-stable/angle-staked-stable.ts +2 -1
- package/src/dex/angle-transmuter/angle-transmuter-gas-estimation.test.ts +41 -0
- package/src/dex/angle-transmuter/angle-transmuter.ts +0 -1
- package/src/dex/balancer-v1/balancer-v1-gas-estimation.test.ts +29 -0
- package/src/dex/balancer-v1/config.ts +2 -1
- package/src/dex/balancer-v2/balancer-v2-gas-estimation.test.ts +98 -0
- package/src/dex/balancer-v3/balancer-v3-gas-estimation.test.ts +30 -0
- package/src/dex/bancor/bancor-gas-estimation.test.ts +30 -0
- package/src/dex/bebop/bebop-gas-estimation.test.ts +30 -0
- package/src/dex/concentrator-arusd/concentrator-arusd-gas-estimation.test.ts +29 -0
- package/src/dex/curve-v1/curve-v1-gas-estimation.test.ts +29 -0
- package/src/dex/curve-v2/curve-v2-gas-estimation.test.ts +29 -0
- package/src/dex/fluid-dex/fluid-dex-gas-estimation.test.ts +29 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-rusd-gas-estimation.test.ts +29 -0
- package/src/dex/hashflow/hashflow-gas-estimation.test.ts +30 -0
- package/src/dex/idle-dao/idle-dao--gas-estimation.test.ts +30 -0
- package/src/dex/lido/lido-gas-estimation.test.ts +29 -0
- package/src/dex/lite-psm/lite-psm-gas-estimation.test.ts +34 -0
- package/src/dex/maker-psm/maker-psm-gas-estimation.test.ts +34 -0
- package/src/dex/maverick-v1/maverick-v1-gas-estimation.test.ts +29 -0
- package/src/dex/maverick-v2/maverick-v2-gas-estimation.test.ts +29 -0
- package/src/dex/pancakeswap-v3/pancakeswap-v3-gas-estimation.test.ts +29 -0
- package/src/dex/polygon-migrator/polygon-migrator-gas-estimation.test.ts +41 -0
- package/src/dex/sky-converter/sky-converter-gas-estimation.test.ts +78 -0
- package/src/dex/solidly/solidly-gas-estimation.test.ts +29 -0
- package/src/dex/solidly-v3/solidly-v3-gas-estimation.test.ts +29 -0
- package/src/dex/spark/spark-gas-estimation.test.ts +29 -0
- package/src/dex/stader/stader-gas-estimation.test.ts +29 -0
- package/src/dex/stkgho/stkgho-gas-estimation.test.ts +29 -0
- package/src/dex/swaap-v2/swaap-v2-estimation.test.ts +29 -0
- package/src/dex/swell/swell-estimation.test.ts +29 -0
- package/src/dex/trader-joe-v2.1/trader-joe-v2.1-gas-estimation.test.ts +29 -0
- package/src/dex/uniswap-v2/uniswap-v2-gas-estimation.test.ts +98 -0
- package/src/dex/uniswap-v3/uniswap-v3-gas-estimation.test.ts +98 -0
- package/src/dex/usual/usual-gas-estimation.test.ts +54 -0
- package/src/dex/usual-pp/usual-pp-gas-estimation.test.ts +29 -0
- package/src/dex/weth/weth-gas-estimation.test.ts +42 -0
- package/src/dex/weth/weth.ts +3 -1
- package/src/dex/wombat/wombat-gas-estimation.test.ts +29 -0
- package/src/dex/wsteth/wsteth-gas-estimation.test.ts +41 -0
- package/src/dex/wusdm/wusdm-gas-estimation.test.ts +41 -0
- package/tests/constants-e2e.ts +8 -0
- package/tests/tenderly-simulation-new.test.ts +151 -0
- package/tests/tenderly-simulation-new.ts +698 -0
- package/tests/token-storage-slots.json +532 -0
- package/tests/utils-e2e.ts +137 -1
- package/.idea/aws.xml +0 -17
- package/.idea/misc.xml +0 -6
- package/.idea/prettier.xml +0 -7
- package/build/abi/AaveV1_lending_pool.json +0 -27
- package/build/abi/integral/factory.json +0 -333
- package/build/abi/integral/oracle.json +0 -501
- package/build/abi/integral/pool.json +0 -1041
- package/build/abi/integral/relayer.json +0 -1536
- package/build/abi/platypus/asset.json +0 -490
- package/build/abi/platypus/avax-pool.json +0 -820
- package/build/abi/platypus/oracle.json +0 -119
- package/build/abi/platypus/pool.json +0 -677
- package/build/abi/smardex/all/smardex-router.json +0 -648
- package/build/abi/smardex/layer-1/smardex-factory.json +0 -242
- package/build/abi/smardex/layer-1/smardex-pool.json +0 -506
- package/build/abi/smardex/layer-2/smardex-factory.json +0 -185
- package/build/abi/smardex/layer-2/smardex-pool.json +0 -578
- package/build/abi/swaap-v1/pool.json +0 -1346
- package/build/dex/aave-v1/aave-v1.d.ts +0 -33
- package/build/dex/aave-v1/aave-v1.js +0 -158
- package/build/dex/aave-v1/aave-v1.js.map +0 -1
- package/build/dex/aave-v1/config.d.ts +0 -11
- package/build/dex/aave-v1/config.js +0 -20
- package/build/dex/aave-v1/config.js.map +0 -1
- package/build/dex/aave-v1/tokens-mainnet.json +0 -134
- package/build/dex/aave-v1/tokens.d.ts +0 -3
- package/build/dex/aave-v1/tokens.js +0 -50
- package/build/dex/aave-v1/tokens.js.map +0 -1
- package/build/dex/aave-v1/types.d.ts +0 -12
- package/build/dex/aave-v1/types.js +0 -3
- package/build/dex/aave-v1/types.js.map +0 -1
- package/build/dex/bProtocol.d.ts +0 -18
- package/build/dex/bProtocol.js +0 -39
- package/build/dex/bProtocol.js.map +0 -1
- package/build/dex/bancor.d.ts +0 -26
- package/build/dex/bancor.js +0 -58
- package/build/dex/bancor.js.map +0 -1
- package/build/dex/compound.d.ts +0 -18
- package/build/dex/compound.js +0 -46
- package/build/dex/compound.js.map +0 -1
- package/build/dex/curve-v2.d.ts +0 -58
- package/build/dex/curve-v2.js +0 -180
- package/build/dex/curve-v2.js.map +0 -1
- package/build/dex/dodo-v1.d.ts +0 -33
- package/build/dex/dodo-v1.js +0 -63
- package/build/dex/dodo-v1.js.map +0 -1
- package/build/dex/fluid-dex/fluid-dex-generate-pool.d.ts +0 -49
- package/build/dex/fluid-dex/fluid-dex-generate-pool.js +0 -104
- package/build/dex/fluid-dex/fluid-dex-generate-pool.js.map +0 -1
- package/build/dex/integral/config.d.ts +0 -4
- package/build/dex/integral/config.js +0 -20
- package/build/dex/integral/config.js.map +0 -1
- package/build/dex/integral/context.d.ts +0 -40
- package/build/dex/integral/context.js +0 -158
- package/build/dex/integral/context.js.map +0 -1
- package/build/dex/integral/integral-factory.d.ts +0 -24
- package/build/dex/integral/integral-factory.js +0 -95
- package/build/dex/integral/integral-factory.js.map +0 -1
- package/build/dex/integral/integral-pool.d.ts +0 -50
- package/build/dex/integral/integral-pool.js +0 -149
- package/build/dex/integral/integral-pool.js.map +0 -1
- package/build/dex/integral/integral-pricing.d.ts +0 -18
- package/build/dex/integral/integral-pricing.js +0 -114
- package/build/dex/integral/integral-pricing.js.map +0 -1
- package/build/dex/integral/integral-relayer.d.ts +0 -42
- package/build/dex/integral/integral-relayer.js +0 -192
- package/build/dex/integral/integral-relayer.js.map +0 -1
- package/build/dex/integral/integral-token.d.ts +0 -27
- package/build/dex/integral/integral-token.js +0 -59
- package/build/dex/integral/integral-token.js.map +0 -1
- package/build/dex/integral/integral.d.ts +0 -41
- package/build/dex/integral/integral.js +0 -376
- package/build/dex/integral/integral.js.map +0 -1
- package/build/dex/integral/types.d.ts +0 -85
- package/build/dex/integral/types.js +0 -9
- package/build/dex/integral/types.js.map +0 -1
- package/build/dex/integral/utils-e2e.d.ts +0 -9
- package/build/dex/integral/utils-e2e.js +0 -131
- package/build/dex/integral/utils-e2e.js.map +0 -1
- package/build/dex/integral/utils.d.ts +0 -17
- package/build/dex/integral/utils.js +0 -94
- package/build/dex/integral/utils.js.map +0 -1
- package/build/dex/lido.d.ts +0 -19
- package/build/dex/lido.js +0 -42
- package/build/dex/lido.js.map +0 -1
- package/build/dex/m-token/config.d.ts +0 -3
- package/build/dex/m-token/config.js +0 -19
- package/build/dex/m-token/config.js.map +0 -1
- package/build/dex/m-token/m-token.d.ts +0 -29
- package/build/dex/m-token/m-token.js +0 -145
- package/build/dex/m-token/m-token.js.map +0 -1
- package/build/dex/m-token/m-wrapped-m.d.ts +0 -17
- package/build/dex/m-token/m-wrapped-m.js +0 -50
- package/build/dex/m-token/m-wrapped-m.js.map +0 -1
- package/build/dex/m-token/types.d.ts +0 -12
- package/build/dex/m-token/types.js +0 -3
- package/build/dex/m-token/types.js.map +0 -1
- package/build/dex/onebit.d.ts +0 -25
- package/build/dex/onebit.js +0 -42
- package/build/dex/onebit.js.map +0 -1
- package/build/dex/platypus/asset.d.ts +0 -14
- package/build/dex/platypus/asset.js +0 -97
- package/build/dex/platypus/asset.js.map +0 -1
- package/build/dex/platypus/config.d.ts +0 -11
- package/build/dex/platypus/config.js +0 -69
- package/build/dex/platypus/config.js.map +0 -1
- package/build/dex/platypus/platypus.d.ts +0 -62
- package/build/dex/platypus/platypus.js +0 -442
- package/build/dex/platypus/platypus.js.map +0 -1
- package/build/dex/platypus/pool-avax.d.ts +0 -8
- package/build/dex/platypus/pool-avax.js +0 -54
- package/build/dex/platypus/pool-avax.js.map +0 -1
- package/build/dex/platypus/pool-base.d.ts +0 -19
- package/build/dex/platypus/pool-base.js +0 -86
- package/build/dex/platypus/pool-base.js.map +0 -1
- package/build/dex/platypus/pool-pure.d.ts +0 -8
- package/build/dex/platypus/pool-pure.js +0 -37
- package/build/dex/platypus/pool-pure.js.map +0 -1
- package/build/dex/platypus/pool-subscriber.d.ts +0 -14
- package/build/dex/platypus/pool-subscriber.js +0 -167
- package/build/dex/platypus/pool-subscriber.js.map +0 -1
- package/build/dex/platypus/pool.d.ts +0 -8
- package/build/dex/platypus/pool.js +0 -58
- package/build/dex/platypus/pool.js.map +0 -1
- package/build/dex/platypus/types.d.ts +0 -92
- package/build/dex/platypus/types.js +0 -10
- package/build/dex/platypus/types.js.map +0 -1
- package/build/dex/quickswap/spiritswap-v3.d.ts +0 -6
- package/build/dex/quickswap/spiritswap-v3.js +0 -19
- package/build/dex/quickswap/spiritswap-v3.js.map +0 -1
- package/build/dex/smardex/config.d.ts +0 -4
- package/build/dex/smardex/config.js +0 -64
- package/build/dex/smardex/config.js.map +0 -1
- package/build/dex/smardex/constants.d.ts +0 -18
- package/build/dex/smardex/constants.js +0 -33
- package/build/dex/smardex/constants.js.map +0 -1
- package/build/dex/smardex/sdk/constants.d.ts +0 -6
- package/build/dex/smardex/sdk/constants.js +0 -13
- package/build/dex/smardex/sdk/constants.js.map +0 -1
- package/build/dex/smardex/sdk/core.d.ts +0 -113
- package/build/dex/smardex/sdk/core.js +0 -499
- package/build/dex/smardex/sdk/core.js.map +0 -1
- package/build/dex/smardex/sdk/errors.d.ts +0 -15
- package/build/dex/smardex/sdk/errors.js +0 -22
- package/build/dex/smardex/sdk/errors.js.map +0 -1
- package/build/dex/smardex/sdk/types.d.ts +0 -62
- package/build/dex/smardex/sdk/types.js +0 -3
- package/build/dex/smardex/sdk/types.js.map +0 -1
- package/build/dex/smardex/sdk/utils.d.ts +0 -44
- package/build/dex/smardex/sdk/utils.js +0 -133
- package/build/dex/smardex/sdk/utils.js.map +0 -1
- package/build/dex/smardex/smardex-event-pool.d.ts +0 -28
- package/build/dex/smardex/smardex-event-pool.js +0 -119
- package/build/dex/smardex/smardex-event-pool.js.map +0 -1
- package/build/dex/smardex/smardex.d.ts +0 -65
- package/build/dex/smardex/smardex.js +0 -519
- package/build/dex/smardex/smardex.js.map +0 -1
- package/build/dex/smardex/types.d.ts +0 -55
- package/build/dex/smardex/types.js +0 -3
- package/build/dex/smardex/types.js.map +0 -1
- package/build/dex/smoothy.d.ts +0 -26
- package/build/dex/smoothy.js +0 -48
- package/build/dex/smoothy.js.map +0 -1
- package/build/dex/solidly/forks-override/cone.d.ts +0 -22
- package/build/dex/solidly/forks-override/cone.js +0 -53
- package/build/dex/solidly/forks-override/cone.js.map +0 -1
- package/build/dex/solidly/forks-override/solisnek.d.ts +0 -8
- package/build/dex/solidly/forks-override/solisnek.js +0 -15
- package/build/dex/solidly/forks-override/solisnek.js.map +0 -1
- package/build/dex/stable-pool.d.ts +0 -28
- package/build/dex/stable-pool.js +0 -62
- package/build/dex/stable-pool.js.map +0 -1
- package/build/dex/swaap-v1/config.d.ts +0 -17
- package/build/dex/swaap-v1/config.js +0 -56
- package/build/dex/swaap-v1/config.js.map +0 -1
- package/build/dex/swaap-v1/constants.d.ts +0 -6
- package/build/dex/swaap-v1/constants.js +0 -17
- package/build/dex/swaap-v1/constants.js.map +0 -1
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.d.ts +0 -25
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.js +0 -62
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.js.map +0 -1
- package/build/dex/swaap-v1/libraries/Const.d.ts +0 -18
- package/build/dex/swaap-v1/libraries/Const.js +0 -26
- package/build/dex/swaap-v1/libraries/Const.js.map +0 -1
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.d.ts +0 -77
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js +0 -316
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js.map +0 -1
- package/build/dex/swaap-v1/libraries/LogExpMath.d.ts +0 -75
- package/build/dex/swaap-v1/libraries/LogExpMath.js +0 -418
- package/build/dex/swaap-v1/libraries/LogExpMath.js.map +0 -1
- package/build/dex/swaap-v1/libraries/MathMMM.d.ts +0 -185
- package/build/dex/swaap-v1/libraries/MathMMM.js +0 -453
- package/build/dex/swaap-v1/libraries/MathMMM.js.map +0 -1
- package/build/dex/swaap-v1/libraries/Num.d.ts +0 -31
- package/build/dex/swaap-v1/libraries/Num.js +0 -167
- package/build/dex/swaap-v1/libraries/Num.js.map +0 -1
- package/build/dex/swaap-v1/libraries/PoolQuotations.d.ts +0 -23
- package/build/dex/swaap-v1/libraries/PoolQuotations.js +0 -131
- package/build/dex/swaap-v1/libraries/PoolQuotations.js.map +0 -1
- package/build/dex/swaap-v1/libraries/Struct.d.ts +0 -56
- package/build/dex/swaap-v1/libraries/Struct.js +0 -3
- package/build/dex/swaap-v1/libraries/Struct.js.map +0 -1
- package/build/dex/swaap-v1/swaap-v1-pool.d.ts +0 -45
- package/build/dex/swaap-v1/swaap-v1-pool.js +0 -656
- package/build/dex/swaap-v1/swaap-v1-pool.js.map +0 -1
- package/build/dex/swaap-v1/swaap-v1.d.ts +0 -61
- package/build/dex/swaap-v1/swaap-v1.js +0 -369
- package/build/dex/swaap-v1/swaap-v1.js.map +0 -1
- package/build/dex/swaap-v1/types.d.ts +0 -106
- package/build/dex/swaap-v1/types.js +0 -9
- package/build/dex/swaap-v1/types.js.map +0 -1
- package/build/dex/trader-joe-v2.1/optimizer.d.ts +0 -2
- package/build/dex/trader-joe-v2.1/optimizer.js +0 -47
- package/build/dex/trader-joe-v2.1/optimizer.js.map +0 -1
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +0 -7
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +0 -20
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +0 -1
- package/build/dex/trader-joe-v2.1.d.ts +0 -43
- package/build/dex/trader-joe-v2.1.js +0 -79
- package/build/dex/trader-joe-v2.1.js.map +0 -1
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Address, Token } from '../../types';
|
|
2
|
-
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
3
|
-
import { PlatypusPurePoolState, PlatypusPurePoolConfigInfo } from './types';
|
|
4
|
-
import { PlatypusPoolBase } from './pool-base';
|
|
5
|
-
export declare class PlatypusPurePool extends PlatypusPoolBase<PlatypusPurePoolState> {
|
|
6
|
-
constructor(dexKey: string, network: number, name: string, poolAddress: Address, poolCfg: PlatypusPurePoolConfigInfo, dexHelper: IDexHelper);
|
|
7
|
-
computePrices(srcToken: Token, destToken: Token, amounts: bigint[], state: PlatypusPurePoolState): bigint[];
|
|
8
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlatypusPurePool = void 0;
|
|
4
|
-
const lens_1 = require("../../lens");
|
|
5
|
-
const asset_1 = require("./asset");
|
|
6
|
-
const pool_subscriber_1 = require("./pool-subscriber");
|
|
7
|
-
const utils_1 = require("../../utils");
|
|
8
|
-
const pool_base_1 = require("./pool-base");
|
|
9
|
-
class PlatypusPurePool extends pool_base_1.PlatypusPoolBase {
|
|
10
|
-
constructor(dexKey, network, name, poolAddress, poolCfg, dexHelper) {
|
|
11
|
-
super(dexKey, network, name, dexHelper, [
|
|
12
|
-
new pool_subscriber_1.PlatypusPoolSubscriber(poolAddress, (0, lens_1.lens)().params, dexHelper.getLogger(`${dexKey}-${network} Params ${name}`)),
|
|
13
|
-
...Object.entries(poolCfg.tokens).map(([tokenAddress, c]) => new asset_1.PlatypusAssetSubscriber(c.assetAddress, (0, lens_1.lens)().asset[tokenAddress], dexHelper.getLogger(`${dexKey}-${network} ${c.tokenSymbol} asset ${name}`))),
|
|
14
|
-
], {
|
|
15
|
-
params: {
|
|
16
|
-
paused: false,
|
|
17
|
-
slippageParamK: 0n,
|
|
18
|
-
slippageParamN: 0n,
|
|
19
|
-
c1: 0n,
|
|
20
|
-
xThreshold: 0n,
|
|
21
|
-
haircutRate: 0n,
|
|
22
|
-
retentionRatio: 0n,
|
|
23
|
-
maxPriceDeviation: 0n,
|
|
24
|
-
},
|
|
25
|
-
asset: {},
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
computePrices(srcToken, destToken, amounts, state) {
|
|
29
|
-
return amounts.map(fromAmount => {
|
|
30
|
-
const idealToAmount = (fromAmount * (0, utils_1.getBigIntPow)(destToken.decimals)) /
|
|
31
|
-
(0, utils_1.getBigIntPow)(srcToken.decimals);
|
|
32
|
-
return (0, pool_base_1.calcPrice)(srcToken, destToken, fromAmount, idealToAmount, state);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.PlatypusPurePool = PlatypusPurePool;
|
|
37
|
-
//# sourceMappingURL=pool-pure.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pool-pure.js","sourceRoot":"","sources":["../../../src/dex/platypus/pool-pure.ts"],"names":[],"mappings":";;;AAEA,qCAAkC;AAClC,mCAAkD;AAClD,uDAA2D;AAG3D,uCAA2C;AAC3C,2CAA0D;AAE1D,MAAa,gBAAiB,SAAQ,4BAAuC;IAC3E,YACE,MAAc,EACd,OAAe,EACf,IAAY,EACZ,WAAoB,EACpB,OAAmC,EACnC,SAAqB;QAErB,KAAK,CACH,MAAM,EACN,OAAO,EACP,IAAI,EACJ,SAAS,EACT;YACE,IAAI,wCAAsB,CACxB,WAAW,EACX,IAAA,WAAI,GAAuC,CAAC,MAAM,EAClD,SAAS,CAAC,SAAS,CAAC,GAAG,MAAM,IAAI,OAAO,WAAW,IAAI,EAAE,CAAC,CAC3D;YACD,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CACnC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CACpB,IAAI,+BAAuB,CACzB,CAAC,CAAC,YAAY,EACd,IAAA,WAAI,GAAuC,CAAC,KAAK,CAAC,YAAY,CAAC,EAC/D,SAAS,CAAC,SAAS,CACjB,GAAG,MAAM,IAAI,OAAO,IAAI,CAAC,CAAC,WAAW,UAAU,IAAI,EAAE,CACtD,CACF,CACJ;SACF,EACD;YACE,MAAM,EAAE;gBACN,MAAM,EAAE,KAAK;gBACb,cAAc,EAAE,EAAE;gBAClB,cAAc,EAAE,EAAE;gBAClB,EAAE,EAAE,EAAE;gBACN,UAAU,EAAE,EAAE;gBACd,WAAW,EAAE,EAAE;gBACf,cAAc,EAAE,EAAE;gBAClB,iBAAiB,EAAE,EAAE;aACtB;YACD,KAAK,EAAE,EAAE;SACV,CACF,CAAC;IACJ,CAAC;IAEM,aAAa,CAClB,QAAe,EACf,SAAgB,EAChB,OAAiB,EACjB,KAA4B;QAE5B,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YAC9B,MAAM,aAAa,GACjB,CAAC,UAAU,GAAG,IAAA,oBAAY,EAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBAC/C,IAAA,oBAAY,EAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAClC,OAAO,IAAA,qBAAS,EAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA5DD,4CA4DC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DeepReadonly } from 'ts-essentials';
|
|
2
|
-
import { PartialEventSubscriber } from '../../composed-event-subscriber';
|
|
3
|
-
import { Address, BlockHeader, Log, Logger, MultiCallInput, MultiCallOutput } from '../../types';
|
|
4
|
-
import { Lens } from '../../lens';
|
|
5
|
-
import { Interface } from '@ethersproject/abi';
|
|
6
|
-
import { PlatypusPoolParams } from './types';
|
|
7
|
-
export declare class PlatypusPoolSubscriber<State> extends PartialEventSubscriber<State, PlatypusPoolParams> {
|
|
8
|
-
private pool;
|
|
9
|
-
static readonly poolInterface: Interface;
|
|
10
|
-
constructor(pool: Address, lens: Lens<DeepReadonly<State>, DeepReadonly<PlatypusPoolParams>>, logger: Logger);
|
|
11
|
-
processLog(state: DeepReadonly<PlatypusPoolParams>, log: Readonly<Log>, blockHeader: Readonly<BlockHeader>): DeepReadonly<PlatypusPoolParams> | null;
|
|
12
|
-
getGenerateStateMultiCallInputs(): MultiCallInput[];
|
|
13
|
-
generateState(multicallOutputs: MultiCallOutput[], blockNumber?: number | 'latest'): DeepReadonly<PlatypusPoolParams>;
|
|
14
|
-
}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PlatypusPoolSubscriber = void 0;
|
|
7
|
-
const composed_event_subscriber_1 = require("../../composed-event-subscriber");
|
|
8
|
-
const abi_1 = require("@ethersproject/abi");
|
|
9
|
-
const pool_json_1 = __importDefault(require("../../abi/platypus/pool.json"));
|
|
10
|
-
class PlatypusPoolSubscriber extends composed_event_subscriber_1.PartialEventSubscriber {
|
|
11
|
-
constructor(pool, lens, logger) {
|
|
12
|
-
super([pool], lens, logger);
|
|
13
|
-
this.pool = pool;
|
|
14
|
-
}
|
|
15
|
-
processLog(state, log, blockHeader) {
|
|
16
|
-
try {
|
|
17
|
-
const parsed = PlatypusPoolSubscriber.poolInterface.parseLog(log);
|
|
18
|
-
switch (parsed.name) {
|
|
19
|
-
case 'Paused': {
|
|
20
|
-
return {
|
|
21
|
-
...state,
|
|
22
|
-
paused: true,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
case 'Unpaused': {
|
|
26
|
-
return {
|
|
27
|
-
...state,
|
|
28
|
-
paused: false,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
case 'PriceDeviationUpdated': {
|
|
32
|
-
const previousPriceDeviation = BigInt(parsed.args.previousPriceDeviation.toString());
|
|
33
|
-
const newPriceDeviation = BigInt(parsed.args.newPriceDeviation.toString());
|
|
34
|
-
if (state.maxPriceDeviation !== previousPriceDeviation) {
|
|
35
|
-
this.logger.error('state.maxPriceDeviation !== previousPriceDeviation');
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
...state,
|
|
39
|
-
maxPriceDeviation: newPriceDeviation,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
case 'SlippageParamsUpdated': {
|
|
43
|
-
const previousK = BigInt(parsed.args.previousK.toString());
|
|
44
|
-
const newK = BigInt(parsed.args.newK.toString());
|
|
45
|
-
const previousN = BigInt(parsed.args.previousN.toString());
|
|
46
|
-
const newN = BigInt(parsed.args.newN.toString());
|
|
47
|
-
const previousC1 = BigInt(parsed.args.previousC1.toString());
|
|
48
|
-
const newC1 = BigInt(parsed.args.newC1.toString());
|
|
49
|
-
const previousXThreshold = BigInt(parsed.args.previousXThreshold.toString());
|
|
50
|
-
const newXThreshold = BigInt(parsed.args.newXThreshold.toString());
|
|
51
|
-
if (state.slippageParamK !== previousK) {
|
|
52
|
-
this.logger.error('state.slippageParamK !== previousK');
|
|
53
|
-
}
|
|
54
|
-
if (state.slippageParamN !== previousN) {
|
|
55
|
-
this.logger.error('state.slippageParamN !== previousN');
|
|
56
|
-
}
|
|
57
|
-
if (state.c1 !== previousC1) {
|
|
58
|
-
this.logger.error('state.c1 !== previousC1');
|
|
59
|
-
}
|
|
60
|
-
if (state.xThreshold !== previousXThreshold) {
|
|
61
|
-
this.logger.error('state.xThreshold !== previousXThreshold');
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
...state,
|
|
65
|
-
slippageParamK: newK,
|
|
66
|
-
slippageParamN: newN,
|
|
67
|
-
c1: newC1,
|
|
68
|
-
xThreshold: newXThreshold,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
case 'HaircutRateUpdated': {
|
|
72
|
-
const previousHaircut = BigInt(parsed.args.previousHaircut.toString());
|
|
73
|
-
const newHaircut = BigInt(parsed.args.newHaircut.toString());
|
|
74
|
-
if (state.haircutRate !== previousHaircut) {
|
|
75
|
-
this.logger.error('state.haircutRate !== previousHaircut');
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
...state,
|
|
79
|
-
haircutRate: newHaircut,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
case 'RetentionRatioUpdated': {
|
|
83
|
-
const previousRetentionRatio = BigInt(parsed.args.previousRetentionRatio.toString());
|
|
84
|
-
const newRetentionRatio = BigInt(parsed.args.newRetentionRatio.toString());
|
|
85
|
-
if (state.retentionRatio !== previousRetentionRatio) {
|
|
86
|
-
this.logger.error('state.retentionRatio !== previousRetentionRatio');
|
|
87
|
-
}
|
|
88
|
-
return {
|
|
89
|
-
...state,
|
|
90
|
-
retentionRatio: newRetentionRatio,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
default:
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
catch (e) {
|
|
98
|
-
this.logger.error('Failed to parse log', e);
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
getGenerateStateMultiCallInputs() {
|
|
103
|
-
return [
|
|
104
|
-
{
|
|
105
|
-
target: this.pool,
|
|
106
|
-
callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('paused'),
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
target: this.pool,
|
|
110
|
-
callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getSlippageParamK'),
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
target: this.pool,
|
|
114
|
-
callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getSlippageParamN'),
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
target: this.pool,
|
|
118
|
-
callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getC1'),
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
target: this.pool,
|
|
122
|
-
callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getXThreshold'),
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
target: this.pool,
|
|
126
|
-
callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getHaircutRate'),
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
target: this.pool,
|
|
130
|
-
callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getRetentionRatio'),
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
target: this.pool,
|
|
134
|
-
callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getMaxPriceDeviation'),
|
|
135
|
-
},
|
|
136
|
-
];
|
|
137
|
-
}
|
|
138
|
-
generateState(multicallOutputs, blockNumber) {
|
|
139
|
-
return {
|
|
140
|
-
paused: PlatypusPoolSubscriber.poolInterface.decodeFunctionResult('paused', multicallOutputs[0])[0],
|
|
141
|
-
slippageParamK: BigInt(PlatypusPoolSubscriber.poolInterface
|
|
142
|
-
.decodeFunctionResult('getSlippageParamK', multicallOutputs[1])[0]
|
|
143
|
-
.toString()),
|
|
144
|
-
slippageParamN: BigInt(PlatypusPoolSubscriber.poolInterface
|
|
145
|
-
.decodeFunctionResult('getSlippageParamN', multicallOutputs[2])[0]
|
|
146
|
-
.toString()),
|
|
147
|
-
c1: BigInt(PlatypusPoolSubscriber.poolInterface
|
|
148
|
-
.decodeFunctionResult('getC1', multicallOutputs[3])[0]
|
|
149
|
-
.toString()),
|
|
150
|
-
xThreshold: BigInt(PlatypusPoolSubscriber.poolInterface
|
|
151
|
-
.decodeFunctionResult('getXThreshold', multicallOutputs[4])[0]
|
|
152
|
-
.toString()),
|
|
153
|
-
haircutRate: BigInt(PlatypusPoolSubscriber.poolInterface
|
|
154
|
-
.decodeFunctionResult('getHaircutRate', multicallOutputs[5])[0]
|
|
155
|
-
.toString()),
|
|
156
|
-
retentionRatio: BigInt(PlatypusPoolSubscriber.poolInterface
|
|
157
|
-
.decodeFunctionResult('getRetentionRatio', multicallOutputs[6])[0]
|
|
158
|
-
.toString()),
|
|
159
|
-
maxPriceDeviation: BigInt(PlatypusPoolSubscriber.poolInterface
|
|
160
|
-
.decodeFunctionResult('getMaxPriceDeviation', multicallOutputs[7])[0]
|
|
161
|
-
.toString()),
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
exports.PlatypusPoolSubscriber = PlatypusPoolSubscriber;
|
|
166
|
-
PlatypusPoolSubscriber.poolInterface = new abi_1.Interface(pool_json_1.default);
|
|
167
|
-
//# sourceMappingURL=pool-subscriber.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pool-subscriber.js","sourceRoot":"","sources":["../../../src/dex/platypus/pool-subscriber.ts"],"names":[],"mappings":";;;;;;AACA,+EAAyE;AAUzE,4CAA+C;AAC/C,6EAAmD;AAGnD,MAAa,sBAA8B,SAAQ,kDAGlD;IAGC,YACU,IAAa,EACrB,IAAiE,EACjE,MAAc;QAEd,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAJpB,SAAI,GAAJ,IAAI,CAAS;IAKvB,CAAC;IAEM,UAAU,CACf,KAAuC,EACvC,GAAkB,EAClB,WAAkC;QAElC,IAAI;YACF,MAAM,MAAM,GAAG,sBAAsB,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAClE,QAAQ,MAAM,CAAC,IAAI,EAAE;gBACnB,KAAK,QAAQ,CAAC,CAAC;oBACb,OAAO;w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Q,EAAE,CACd;YACD,WAAW,EAAE,MAAM,CACjB,sBAAsB,CAAC,aAAa;iBACjC,oBAAoB,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC9D,QAAQ,EAAE,CACd;YACD,cAAc,EAAE,MAAM,CACpB,sBAAsB,CAAC,aAAa;iBACjC,oBAAoB,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBACjE,QAAQ,EAAE,CACd;YACD,iBAAiB,EAAE,MAAM,CACvB,sBAAsB,CAAC,aAAa;iBACjC,oBAAoB,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBACpE,QAAQ,EAAE,CACd;SACF,CAAC;IACJ,CAAC;;AA9NH,wDA+NC;AA3NiB,oCAAa,GAAG,IAAI,eAAS,CAAC,mBAAO,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Address, Token } from '../../types';
|
|
2
|
-
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
3
|
-
import { PlatypusPoolState, PlatypusPoolConfigInfo } from './types';
|
|
4
|
-
import { PlatypusPoolBase } from './pool-base';
|
|
5
|
-
export declare class PlatypusPool extends PlatypusPoolBase<PlatypusPoolState> {
|
|
6
|
-
constructor(dexKey: string, network: number, name: string, poolAddress: Address, poolCfg: PlatypusPoolConfigInfo, dexHelper: IDexHelper);
|
|
7
|
-
computePrices(srcToken: Token, destToken: Token, amounts: bigint[], state: PlatypusPoolState): bigint[];
|
|
8
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlatypusPool = void 0;
|
|
4
|
-
const lens_1 = require("../../lens");
|
|
5
|
-
const chainlink_1 = require("../../lib/chainlink");
|
|
6
|
-
const asset_1 = require("./asset");
|
|
7
|
-
const pool_subscriber_1 = require("./pool-subscriber");
|
|
8
|
-
const utils_1 = require("../../utils");
|
|
9
|
-
const pool_base_1 = require("./pool-base");
|
|
10
|
-
class PlatypusPool extends pool_base_1.PlatypusPoolBase {
|
|
11
|
-
constructor(dexKey, network, name, poolAddress, poolCfg, dexHelper) {
|
|
12
|
-
super(dexKey, network, name, dexHelper, [
|
|
13
|
-
new pool_subscriber_1.PlatypusPoolSubscriber(poolAddress, (0, lens_1.lens)().params, dexHelper.getLogger(`${dexKey}-${network} Params ${name}`)),
|
|
14
|
-
...Object.entries(poolCfg.tokens)
|
|
15
|
-
.map(([tokenAddress, c]) => [
|
|
16
|
-
new asset_1.PlatypusAssetSubscriber(c.assetAddress, (0, lens_1.lens)().asset[tokenAddress], dexHelper.getLogger(`${dexKey}-${network} ${c.tokenSymbol} asset ${name}`)),
|
|
17
|
-
new chainlink_1.ChainLinkSubscriber(c.chainlink.proxyAddress, c.chainlink.aggregatorAddress, (0, lens_1.lens)().chainlink[tokenAddress], dexHelper.getLogger(`${c.tokenSymbol} ChainLink for ${dexKey}-${network} ${name}`)),
|
|
18
|
-
])
|
|
19
|
-
.flat(),
|
|
20
|
-
], {
|
|
21
|
-
params: {
|
|
22
|
-
paused: false,
|
|
23
|
-
slippageParamK: 0n,
|
|
24
|
-
slippageParamN: 0n,
|
|
25
|
-
c1: 0n,
|
|
26
|
-
xThreshold: 0n,
|
|
27
|
-
haircutRate: 0n,
|
|
28
|
-
retentionRatio: 0n,
|
|
29
|
-
maxPriceDeviation: 0n,
|
|
30
|
-
},
|
|
31
|
-
asset: {},
|
|
32
|
-
chainlink: {},
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
computePrices(srcToken, destToken, amounts, state) {
|
|
36
|
-
const tokenAPrice = state.chainlink[srcToken.address].answer;
|
|
37
|
-
const tokenBPrice = state.chainlink[destToken.address].answer;
|
|
38
|
-
if (tokenBPrice > tokenAPrice) {
|
|
39
|
-
if (((tokenBPrice - tokenAPrice) * pool_base_1.ETH_UNIT) / tokenBPrice >
|
|
40
|
-
state.params.maxPriceDeviation) {
|
|
41
|
-
return Array(amounts.length).fill(0n);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
if (((tokenAPrice - tokenBPrice) * pool_base_1.ETH_UNIT) / tokenAPrice >
|
|
46
|
-
state.params.maxPriceDeviation) {
|
|
47
|
-
return Array(amounts.length).fill(0n);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return amounts.map(fromAmount => {
|
|
51
|
-
const idealToAmount = (fromAmount * (0, utils_1.getBigIntPow)(destToken.decimals)) /
|
|
52
|
-
(0, utils_1.getBigIntPow)(srcToken.decimals);
|
|
53
|
-
return (0, pool_base_1.calcPrice)(srcToken, destToken, fromAmount, idealToAmount, state);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.PlatypusPool = PlatypusPool;
|
|
58
|
-
//# sourceMappingURL=pool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pool.js","sourceRoot":"","sources":["../../../src/dex/platypus/pool.ts"],"names":[],"mappings":";;;AAEA,qCAAkC;AAClC,mDAA0D;AAC1D,mCAAkD;AAClD,uDAA2D;AAG3D,uCAA2C;AAC3C,2CAAoE;AAEpE,MAAa,YAAa,SAAQ,4BAAmC;IACnE,YACE,MAAc,EACd,OAAe,EACf,IAAY,EACZ,WAAoB,EACpB,OAA+B,EAC/B,SAAqB;QAErB,KAAK,CACH,MAAM,EACN,OAAO,EACP,IAAI,EACJ,SAAS,EACT;YACE,IAAI,wCAAsB,CACxB,WAAW,EACX,IAAA,WAAI,GAAmC,CAAC,MAAM,EAC9C,SAAS,CAAC,SAAS,CAAC,GAAG,MAAM,IAAI,OAAO,WAAW,IAAI,EAAE,CAAC,CAC3D;YACD,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;iBAC9B,GAAG,CAAC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KAAK,CAAC,MAAM,CAAC,iBAAiB,EAC9B;gBACA,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;aACvC;SACF;aAAM;YACL,IACE,CAAC,CAAC,WAAW,GAAG,WAAW,CAAC,GAAG,oBAAQ,CAAC,GAAG,WAAW;gBACtD,KAAK,CAAC,MAAM,CAAC,iBAAiB,EAC9B;gBACA,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;aACvC;SACF;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YAC9B,MAAM,aAAa,GACjB,CAAC,UAAU,GAAG,IAAA,oBAAY,EAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBAC/C,IAAA,oBAAY,EAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAClC,OAAO,IAAA,qBAAS,EAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAvFD,oCAuFC"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { Address } from '../../types';
|
|
2
|
-
import { ChainLinkState } from '../../lib/chainlink';
|
|
3
|
-
import { StakedAvaxState } from '../../lib/benqi/staked-avax';
|
|
4
|
-
export declare enum PlatypusOracleType {
|
|
5
|
-
None = "None",
|
|
6
|
-
ChainLink = "ChainLink",
|
|
7
|
-
StakedAvax = "StakedAvax"
|
|
8
|
-
}
|
|
9
|
-
export declare type PlatypusPoolStateCommon = {
|
|
10
|
-
params: PlatypusPoolParams;
|
|
11
|
-
asset: {
|
|
12
|
-
[underlyingAddress: string]: PlatypusAssetState;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export declare type PlatypusPoolState = PlatypusPoolStateCommon & {
|
|
16
|
-
chainlink: {
|
|
17
|
-
[underlyingAddress: string]: ChainLinkState;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export declare type PlatypusPurePoolState = PlatypusPoolStateCommon;
|
|
21
|
-
export declare type PlatypusAvaxPoolState = PlatypusPoolStateCommon & {
|
|
22
|
-
stakedAvax: StakedAvaxState;
|
|
23
|
-
};
|
|
24
|
-
export declare type PlatypusPoolParams = {
|
|
25
|
-
paused: boolean;
|
|
26
|
-
slippageParamK: bigint;
|
|
27
|
-
slippageParamN: bigint;
|
|
28
|
-
c1: bigint;
|
|
29
|
-
xThreshold: bigint;
|
|
30
|
-
haircutRate: bigint;
|
|
31
|
-
retentionRatio: bigint;
|
|
32
|
-
maxPriceDeviation: bigint;
|
|
33
|
-
};
|
|
34
|
-
export declare type PlatypusAssetState = {
|
|
35
|
-
cash: bigint;
|
|
36
|
-
liability: bigint;
|
|
37
|
-
};
|
|
38
|
-
export declare type PlatypusConfigInfo = {
|
|
39
|
-
poolAddresses: Address[];
|
|
40
|
-
pools: {
|
|
41
|
-
[poolAddress: string]: PlatypusPoolConfigInfo | PlatypusPurePoolConfigInfo | PlatypusAvaxPoolConfigInfo;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
export declare type PlatypusPoolConfigInfo = {
|
|
45
|
-
oracleType: PlatypusOracleType.ChainLink;
|
|
46
|
-
priceOracleAddress: Address;
|
|
47
|
-
tokenAddresses: Address[];
|
|
48
|
-
tokens: {
|
|
49
|
-
[tokenAddress: string]: {
|
|
50
|
-
tokenSymbol: string;
|
|
51
|
-
tokenDecimals: number;
|
|
52
|
-
assetAddress: Address;
|
|
53
|
-
chainlink: {
|
|
54
|
-
proxyAddress: Address;
|
|
55
|
-
aggregatorAddress: Address;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
export declare type PlatypusPurePoolConfigInfo = {
|
|
61
|
-
oracleType: PlatypusOracleType.None;
|
|
62
|
-
tokenAddresses: Address[];
|
|
63
|
-
tokens: {
|
|
64
|
-
[tokenAddress: string]: {
|
|
65
|
-
tokenSymbol: string;
|
|
66
|
-
tokenDecimals: number;
|
|
67
|
-
assetAddress: Address;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
export declare type PlatypusAvaxPoolConfigInfo = {
|
|
72
|
-
oracleType: PlatypusOracleType.StakedAvax;
|
|
73
|
-
priceOracleAddress: Address;
|
|
74
|
-
tokenAddresses: Address[];
|
|
75
|
-
tokens: {
|
|
76
|
-
[tokenAddress: string]: {
|
|
77
|
-
tokenSymbol: string;
|
|
78
|
-
tokenDecimals: number;
|
|
79
|
-
assetAddress: Address;
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
export declare type PlatypusData = {
|
|
84
|
-
pool: Address;
|
|
85
|
-
};
|
|
86
|
-
export declare type DexParams = {
|
|
87
|
-
pools: {
|
|
88
|
-
address: Address;
|
|
89
|
-
name: string;
|
|
90
|
-
oracleType: PlatypusOracleType;
|
|
91
|
-
}[];
|
|
92
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlatypusOracleType = void 0;
|
|
4
|
-
var PlatypusOracleType;
|
|
5
|
-
(function (PlatypusOracleType) {
|
|
6
|
-
PlatypusOracleType["None"] = "None";
|
|
7
|
-
PlatypusOracleType["ChainLink"] = "ChainLink";
|
|
8
|
-
PlatypusOracleType["StakedAvax"] = "StakedAvax";
|
|
9
|
-
})(PlatypusOracleType = exports.PlatypusOracleType || (exports.PlatypusOracleType = {}));
|
|
10
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/platypus/types.ts"],"names":[],"mappings":";;;AAIA,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,mCAAa,CAAA;IACb,6CAAuB,CAAA;IACvB,+CAAyB,CAAA;AAC3B,CAAC,EAJW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAI7B"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SpiritSwapV3 = void 0;
|
|
7
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
-
const config_1 = require("./config");
|
|
9
|
-
const quickswap_v3_1 = require("./quickswap-v3");
|
|
10
|
-
const config = lodash_1.default.pick(config_1.QuickSwapConfig, ['SpiritSwapV3']).SpiritSwapV3;
|
|
11
|
-
class SpiritSwapV3 extends quickswap_v3_1.QuickSwapV3 {
|
|
12
|
-
// public static dexKeysWithNetwork
|
|
13
|
-
constructor(dexHelper) {
|
|
14
|
-
super(dexHelper, 'spiritswapv3', config[dexHelper.config.data.network].router);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.SpiritSwapV3 = SpiritSwapV3;
|
|
18
|
-
SpiritSwapV3.dexKeys = ['spiritswapv3'];
|
|
19
|
-
//# sourceMappingURL=spiritswap-v3.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spiritswap-v3.js","sourceRoot":"","sources":["../../../src/dex/quickswap/spiritswap-v3.ts"],"names":[],"mappings":";;;;;;AACA,oDAAuB;AACvB,qCAA2C;AAC3C,iDAA6C;AAE7C,MAAM,MAAM,GAAG,gBAAC,CAAC,IAAI,CAAC,wBAAe,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC;AAEtE,MAAa,YAAa,SAAQ,0BAAW;IAG3C,mCAAmC;IACnC,YAAY,SAAqB;QAC/B,KAAK,CACH,SAAS,EACT,cAAc,EACd,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAC7C,CAAC;IACJ,CAAC;;AAVH,oCAWC;AAVQ,oBAAO,GAAG,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Adapters = exports.SmardexConfig = void 0;
|
|
4
|
-
const constants_1 = require("../../constants");
|
|
5
|
-
const GATEWAY_SUBGRAPH = 'https://subgraph.smardex.io';
|
|
6
|
-
const MAINNET_INIT_HASH = '0xc762a0f9885cc92b9fd8eef224b75997682b634460611bc0f2138986e20b653f';
|
|
7
|
-
const LAYER2_INIT_HASH = '0x33bee911475f015247aeb1eebe149d1c6d2669be54126c29d85df6b0abb4c4e9';
|
|
8
|
-
exports.SmardexConfig = {
|
|
9
|
-
Smardex: {
|
|
10
|
-
[constants_1.Network.MAINNET]: {
|
|
11
|
-
factoryAddress: '0xB878DC600550367e14220d4916Ff678fB284214F',
|
|
12
|
-
router: '0xC33984ABcAe20f47a754eF78f6526FeF266c0C6F',
|
|
13
|
-
initCode: MAINNET_INIT_HASH,
|
|
14
|
-
subgraphURL: `${GATEWAY_SUBGRAPH}/ethereum`,
|
|
15
|
-
},
|
|
16
|
-
[constants_1.Network.ARBITRUM]: {
|
|
17
|
-
factoryAddress: '0x41A00e3FbE7F479A99bA6822704d9c5dEB611F22',
|
|
18
|
-
router: '0xDA3970a20cdc2B1269fc96C4E8D300E0fdDB7b3D',
|
|
19
|
-
initCode: LAYER2_INIT_HASH,
|
|
20
|
-
subgraphURL: `${GATEWAY_SUBGRAPH}/arbitrum`,
|
|
21
|
-
},
|
|
22
|
-
[constants_1.Network.BSC]: {
|
|
23
|
-
factoryAddress: '0xA8EF6FEa013034E62E2C4A9Ec1CDb059fE23Af33',
|
|
24
|
-
router: '0xaB3699B71e89a53c529eC037C3389B5A2Caf545A',
|
|
25
|
-
initCode: LAYER2_INIT_HASH,
|
|
26
|
-
subgraphURL: `${GATEWAY_SUBGRAPH}/bsc`,
|
|
27
|
-
},
|
|
28
|
-
[constants_1.Network.POLYGON]: {
|
|
29
|
-
factoryAddress: '0x9A1e1681f6D59Ca051776410465AfAda6384398f',
|
|
30
|
-
router: '0xedD758D17175Dc9131992ebd02F55Cc4ebeb7B7c',
|
|
31
|
-
initCode: LAYER2_INIT_HASH,
|
|
32
|
-
subgraphURL: `${GATEWAY_SUBGRAPH}/polygon`,
|
|
33
|
-
},
|
|
34
|
-
[constants_1.Network.BASE]: {
|
|
35
|
-
factoryAddress: '0xdd4536dD9636564D891c919416880a3e250f975A',
|
|
36
|
-
router: '0xF03D133627364E5eDDaB8134faB3A030cf7b3020',
|
|
37
|
-
initCode: LAYER2_INIT_HASH,
|
|
38
|
-
subgraphURL: `${GATEWAY_SUBGRAPH}/base`,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
exports.Adapters = {
|
|
43
|
-
[constants_1.Network.MAINNET]: {
|
|
44
|
-
[constants_1.SwapSide.SELL]: [{ name: 'Adapter04', index: 6 }],
|
|
45
|
-
[constants_1.SwapSide.BUY]: [{ name: 'BuyAdapter02', index: 2 }],
|
|
46
|
-
},
|
|
47
|
-
[constants_1.Network.ARBITRUM]: {
|
|
48
|
-
[constants_1.SwapSide.SELL]: [{ name: 'ArbitrumAdapter02', index: 9 }],
|
|
49
|
-
[constants_1.SwapSide.BUY]: [{ name: 'ArbitrumBuyAdapter', index: 9 }],
|
|
50
|
-
},
|
|
51
|
-
[constants_1.Network.BSC]: {
|
|
52
|
-
[constants_1.SwapSide.SELL]: [{ name: 'BscAdapter02', index: 8 }],
|
|
53
|
-
[constants_1.SwapSide.BUY]: [{ name: 'BscBuyAdapter', index: 7 }],
|
|
54
|
-
},
|
|
55
|
-
[constants_1.Network.POLYGON]: {
|
|
56
|
-
[constants_1.SwapSide.SELL]: [{ name: 'PolygonAdapter02', index: 9 }],
|
|
57
|
-
[constants_1.SwapSide.BUY]: [{ name: 'PolygonBuyAdapter', index: 8 }],
|
|
58
|
-
},
|
|
59
|
-
[constants_1.Network.BASE]: {
|
|
60
|
-
[constants_1.SwapSide.SELL]: [{ name: 'BaseAdapter01', index: 8 }],
|
|
61
|
-
[constants_1.SwapSide.BUY]: [{ name: 'BaseBuyAdapter', index: 5 }],
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/smardex/config.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAEpD,MAAM,gBAAgB,GAAG,6BAA6B,CAAC;AACvD,MAAM,iBAAiB,GACrB,oEAAoE,CAAC;AACvE,MAAM,gBAAgB,GACpB,oEAAoE,CAAC;AAE1D,QAAA,aAAa,GAA4B;IACpD,OAAO,EAAE;QACP,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,cAAc,EAAE,4CAA4C;YAC5D,MAAM,EAAE,4CAA4C;YACpD,QAAQ,EAAE,iBAAiB;YAC3B,WAAW,EAAE,GAAG,gBAAgB,WAAW;SAC5C;QACD,CAAC,mBAAO,CAAC,QAAQ,CAAC,EAAE;YAClB,cAAc,EAAE,4CAA4C;YAC5D,MAAM,EAAE,4CAA4C;YACpD,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,GAAG,gBAAgB,WAAW;SAC5C;QACD,CAAC,mBAAO,CAAC,GAAG,CAAC,EAAE;YACb,cAAc,EAAE,4CAA4C;YAC5D,MAAM,EAAE,4CAA4C;YACpD,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,GAAG,gBAAgB,MAAM;SACvC;QACD,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,cAAc,EAAE,4CAA4C;YAC5D,MAAM,EAAE,4CAA4C;YACpD,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,GAAG,gB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G,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;KAC1D;IACD,CAAC,mBAAO,CAAC,IAAI,CAAC,EAAE;QACd,CAAC,oBAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACtD,CAAC,oBAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;KACvD;CACF,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { SmardexFees } from './types';
|
|
2
|
-
export declare enum TOPICS {
|
|
3
|
-
SYNC_EVENT = "0x2a368c7f33bb86e2d999940a3989d849031aff29b750f67947e6b8e8c3d2ffd6",
|
|
4
|
-
SWAP_EVENT = "0xa4228e1eb11eb9b31069d9ed20e7af9a010ca1a02d4855cee54e08e188fcc32c",
|
|
5
|
-
FEES_EVENT = "0x64f84976d9c917a44796104a59950fdbd9b3c16a5dd348b546d738301f6bd068"
|
|
6
|
-
}
|
|
7
|
-
export declare enum SmardexRouterFunctions {
|
|
8
|
-
sellExactEth = "swapExactETHForTokens",
|
|
9
|
-
sellExactToken = "swapExactTokensForETH",
|
|
10
|
-
swapExactIn = "swapExactTokensForTokens",
|
|
11
|
-
buyExactEth = "swapTokensForExactETH",
|
|
12
|
-
buyExactToken = "swapETHForExactTokens",
|
|
13
|
-
swapExactOut = "swapTokensForExactTokens"
|
|
14
|
-
}
|
|
15
|
-
export declare const directSmardexFunctionName: SmardexRouterFunctions[];
|
|
16
|
-
export declare const SUBGRAPH_TIMEOUT: number;
|
|
17
|
-
export declare const DefaultSmardexPoolGasCost: number;
|
|
18
|
-
export declare const FEES_LAYER_ONE: SmardexFees;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FEES_LAYER_ONE = exports.DefaultSmardexPoolGasCost = exports.SUBGRAPH_TIMEOUT = exports.directSmardexFunctionName = exports.SmardexRouterFunctions = exports.TOPICS = void 0;
|
|
4
|
-
var TOPICS;
|
|
5
|
-
(function (TOPICS) {
|
|
6
|
-
TOPICS["SYNC_EVENT"] = "0x2a368c7f33bb86e2d999940a3989d849031aff29b750f67947e6b8e8c3d2ffd6";
|
|
7
|
-
TOPICS["SWAP_EVENT"] = "0xa4228e1eb11eb9b31069d9ed20e7af9a010ca1a02d4855cee54e08e188fcc32c";
|
|
8
|
-
TOPICS["FEES_EVENT"] = "0x64f84976d9c917a44796104a59950fdbd9b3c16a5dd348b546d738301f6bd068";
|
|
9
|
-
})(TOPICS = exports.TOPICS || (exports.TOPICS = {}));
|
|
10
|
-
var SmardexRouterFunctions;
|
|
11
|
-
(function (SmardexRouterFunctions) {
|
|
12
|
-
SmardexRouterFunctions["sellExactEth"] = "swapExactETHForTokens";
|
|
13
|
-
SmardexRouterFunctions["sellExactToken"] = "swapExactTokensForETH";
|
|
14
|
-
SmardexRouterFunctions["swapExactIn"] = "swapExactTokensForTokens";
|
|
15
|
-
SmardexRouterFunctions["buyExactEth"] = "swapTokensForExactETH";
|
|
16
|
-
SmardexRouterFunctions["buyExactToken"] = "swapETHForExactTokens";
|
|
17
|
-
SmardexRouterFunctions["swapExactOut"] = "swapTokensForExactTokens";
|
|
18
|
-
})(SmardexRouterFunctions = exports.SmardexRouterFunctions || (exports.SmardexRouterFunctions = {}));
|
|
19
|
-
exports.directSmardexFunctionName = [
|
|
20
|
-
SmardexRouterFunctions.sellExactEth,
|
|
21
|
-
SmardexRouterFunctions.sellExactToken,
|
|
22
|
-
SmardexRouterFunctions.swapExactIn,
|
|
23
|
-
SmardexRouterFunctions.buyExactEth,
|
|
24
|
-
SmardexRouterFunctions.buyExactToken,
|
|
25
|
-
SmardexRouterFunctions.swapExactOut,
|
|
26
|
-
];
|
|
27
|
-
exports.SUBGRAPH_TIMEOUT = 20 * 1000;
|
|
28
|
-
exports.DefaultSmardexPoolGasCost = 130 * 1000;
|
|
29
|
-
exports.FEES_LAYER_ONE = {
|
|
30
|
-
feesLP: 500n,
|
|
31
|
-
feesPool: 200n,
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/dex/smardex/constants.ts"],"names":[],"mappings":";;;AAGA,IAAY,MAIX;AAJD,WAAY,MAAM;IAChB,2FAAiF,CAAA;IACjF,2FAAiF,CAAA;IACjF,2FAAiF,CAAA;AACnF,CAAC,EAJW,MAAM,GAAN,cAAM,KAAN,cAAM,QAIjB;AAED,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,gEAAsC,CAAA;IACtC,kEAAwC,CAAA;IACxC,kEAAwC,CAAA;IACxC,+DAAqC,CAAA;IACrC,iEAAuC,CAAA;IACvC,mEAAyC,CAAA;AAC3C,CAAC,EAPW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAOjC;AAEY,QAAA,yBAAyB,GAAG;IACvC,sBAAsB,CAAC,YAAY;IACnC,sBAAsB,CAAC,cAAc;IACrC,sBAAsB,CAAC,WAAW;IAClC,sBAAsB,CAAC,WAAW;IAClC,sBAAsB,CAAC,aAAa;IACpC,sBAAsB,CAAC,YAAY;CACpC,CAAC;AAEW,QAAA,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC;AAE7B,QAAA,yBAAyB,GAAG,GAAG,GAAG,IAAI,CAAC;AAEvC,QAAA,cAAc,GAAgB;IACzC,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;CACf,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TradeType = exports.LATENCY_OFFSET_SECONDS = exports.FEES_BASE = void 0;
|
|
4
|
-
// Protocol's fees constants
|
|
5
|
-
exports.FEES_BASE = 1000000n;
|
|
6
|
-
// constant for function 'updatePriceAverage'
|
|
7
|
-
exports.LATENCY_OFFSET_SECONDS = 20;
|
|
8
|
-
var TradeType;
|
|
9
|
-
(function (TradeType) {
|
|
10
|
-
TradeType[TradeType["EXACT_INPUT"] = 0] = "EXACT_INPUT";
|
|
11
|
-
TradeType[TradeType["EXACT_OUTPUT"] = 1] = "EXACT_OUTPUT";
|
|
12
|
-
})(TradeType = exports.TradeType || (exports.TradeType = {}));
|
|
13
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/dex/smardex/sdk/constants.ts"],"names":[],"mappings":";;;AAAA,4BAA4B;AACf,QAAA,SAAS,GAAG,QAAQ,CAAC;AAElC,6CAA6C;AAChC,QAAA,sBAAsB,GAAG,EAAE,CAAC;AAEzC,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,uDAAW,CAAA;IACX,yDAAY,CAAA;AACd,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB"}
|