@paraswap/dex-lib 4.1.15 → 4.1.16
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/.vscode/launch.json +53 -0
- package/.vscode/settings.json +2 -0
- package/.vscode/tasks.json +15 -0
- package/build/abi/{integral/pool.json → inception/inception-ineth-pool.json} +558 -537
- package/build/abi/inception/inception-ratio-feed.json +329 -0
- package/build/abi/inception/inception-vault.json +991 -0
- package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +52 -0
- package/build/abi/usual-m-smart-m/usualM.abi.json +483 -0
- package/build/abi/{integral/relayer.json → wombat/pool.json} +474 -721
- package/build/dex/aave-v1/aave-v1.d.ts +2 -1
- package/build/dex/aave-v1/aave-v1.js +23 -0
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/aave-v2/tokens-avalanche.json +44 -0
- package/build/dex/aave-v2/tokens-mainnet.json +188 -0
- package/build/dex/aave-v2/tokens-polygon.json +44 -0
- package/build/dex/balancer-v3/abi/balancerBatchRouter.d.ts +729 -0
- package/build/dex/balancer-v3/abi/balancerBatchRouter.js +732 -0
- package/build/dex/balancer-v3/abi/balancerBatchRouter.js.map +1 -0
- package/build/dex/balancer-v3/abi/balancerRouter.d.ts +1406 -0
- package/build/dex/balancer-v3/abi/balancerRouter.js +1175 -0
- package/build/dex/balancer-v3/abi/balancerRouter.js.map +1 -0
- package/build/dex/balancer-v3/abi/vaultExtension.V3.d.ts +2081 -0
- package/build/dex/balancer-v3/abi/vaultExtension.V3.js +1851 -0
- package/build/dex/balancer-v3/abi/vaultExtension.V3.js.map +1 -0
- package/build/dex/balancer-v3/balancer-v3-sepolia-pools.d.ts +34 -0
- package/build/dex/balancer-v3/balancer-v3-sepolia-pools.js +406 -0
- package/build/dex/balancer-v3/balancer-v3-sepolia-pools.js.map +1 -0
- package/build/dex/balancer-v3/gyroECLPPool.d.ts +11 -0
- package/build/dex/balancer-v3/gyroECLPPool.js +6 -0
- package/build/dex/balancer-v3/gyroECLPPool.js.map +1 -0
- package/build/dex/balancer-v3/utils.d.ts +2 -0
- package/build/dex/balancer-v3/utils.js +11 -0
- package/build/dex/balancer-v3/utils.js.map +1 -0
- package/build/dex/erc4626/scripts/validate-state.d.ts +0 -0
- package/build/dex/erc4626/scripts/validate-state.js +146 -0
- package/build/dex/erc4626/scripts/validate-state.js.map +1 -0
- package/build/dex/inception/config.d.ts +4 -0
- package/build/dex/inception/config.js +109 -0
- package/build/dex/inception/config.js.map +1 -0
- package/build/dex/inception/inception-event-pool.d.ts +16 -0
- package/build/dex/inception/inception-event-pool.js +49 -0
- package/build/dex/inception/inception-event-pool.js.map +1 -0
- package/build/dex/inception/inception.d.ts +43 -0
- package/build/dex/inception/inception.js +180 -0
- package/build/dex/inception/inception.js.map +1 -0
- package/build/dex/inception/tokens.d.ts +9 -0
- package/build/dex/inception/tokens.js +28 -0
- package/build/dex/inception/tokens.js.map +1 -0
- package/build/dex/inception/types.d.ts +22 -0
- package/build/dex/{m-token → inception}/types.js.map +1 -1
- package/build/dex/inception/utils.d.ts +7 -0
- package/build/dex/inception/utils.js +58 -0
- package/build/dex/inception/utils.js.map +1 -0
- 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/maker-psm/scripts/gem.abi.json +136 -0
- package/build/dex/maker-psm/scripts/validate-state.d.ts +0 -0
- package/build/dex/maker-psm/scripts/validate-state.js +185 -0
- package/build/dex/maker-psm/scripts/validate-state.js.map +1 -0
- package/build/dex/maker-psm/scripts/vat.abi.json +243 -0
- package/build/dex/maverick-v2/maverick-v2-pool.js +2 -2
- package/build/dex/maverick-v2/maverick-v2-pool.js.map +1 -1
- package/build/dex/platypus/platypus.d.ts +2 -1
- package/build/dex/platypus/platypus.js +45 -0
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/solidly-v3/scripts/check-event-pool-event.d.ts +1 -0
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js +53 -0
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +1 -0
- package/build/dex/stable-pool.js +1 -8
- package/build/dex/stable-pool.js.map +1 -1
- package/build/dex/swaap-v1/swaap-v1.d.ts +2 -1
- package/build/dex/swaap-v1/swaap-v1.js +14 -0
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +17 -0
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +64 -0
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +1 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +17 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +79 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +1 -0
- package/build/dex/uniswap-v3/uniswap-v3-pricing.d.ts +4 -0
- package/build/dex/uniswap-v3/uniswap-v3-pricing.js +43 -0
- package/build/dex/uniswap-v3/uniswap-v3-pricing.js.map +1 -0
- package/build/dex/uniswap-v3/uniswap-v3-worker.d.ts +1 -0
- package/build/dex/uniswap-v3/uniswap-v3-worker.js +10 -0
- package/build/dex/uniswap-v3/uniswap-v3-worker.js.map +1 -0
- package/build/dex/uniswap-v4/config.js +0 -43
- package/build/dex/uniswap-v4/config.js.map +1 -1
- package/build/dex/uniswap-v4/encoder.js +2 -12
- package/build/dex/uniswap-v4/encoder.js.map +1 -1
- package/build/dex/uniswap-v4/types.d.ts +4 -72
- package/build/dex/uniswap-v4/uniswap-v4.d.ts +6 -6
- package/build/dex/uniswap-v4/uniswap-v4.js +47 -29
- package/build/dex/uniswap-v4/uniswap-v4.js.map +1 -1
- package/build/dex/usual/usual-m-smart-m.d.ts +17 -0
- package/build/dex/usual/usual-m-smart-m.js +50 -0
- package/build/dex/usual/usual-m-smart-m.js.map +1 -0
- package/build/dex/usual-m-smart-m/config.d.ts +3 -0
- package/build/dex/usual-m-smart-m/config.js +13 -0
- package/build/dex/usual-m-smart-m/config.js.map +1 -0
- package/build/dex/usual-m-smart-m/types.d.ts +7 -0
- package/build/dex/usual-m-smart-m/types.js +3 -0
- package/build/dex/usual-m-smart-m/types.js.map +1 -0
- package/build/dex/usual-m-smart-m/usual-m-smart-m.d.ts +35 -0
- package/build/dex/usual-m-smart-m/usual-m-smart-m.js +161 -0
- package/build/dex/usual-m-smart-m/usual-m-smart-m.js.map +1 -0
- package/build/dex/{m-token → usual-m-usd0}/config.d.ts +2 -2
- package/build/dex/usual-m-usd0/config.js +14 -0
- package/build/dex/usual-m-usd0/config.js.map +1 -0
- package/build/dex/usual-m-usd0/types.d.ts +8 -0
- package/build/dex/usual-m-usd0/types.js +3 -0
- package/build/dex/usual-m-usd0/types.js.map +1 -0
- package/build/dex/usual-m-usd0/usual-m-usd0.d.ts +35 -0
- package/build/dex/usual-m-usd0/usual-m-usd0.js +159 -0
- package/build/dex/usual-m-usd0/usual-m-usd0.js.map +1 -0
- package/build/dex/zerox/index.d.ts +4 -26
- 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/src/dex/maverick-v2/maverick-v2-pool.ts +2 -2
- package/.idea/aws.xml +0 -17
- package/.idea/codeStyles/Project.xml +0 -19
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/paraswap-dex-lib.iml +0 -9
- package/.idea/prettier.xml +0 -7
- package/.idea/vcs.xml +0 -6
- package/build/abi/integral/factory.json +0 -333
- package/build/abi/integral/oracle.json +0 -501
- package/build/abi/uniswap-v4/pool-manager.abi.json +0 -1366
- package/build/abi/uniswap-v4/state-view.abi.json +0 -365
- 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/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/spark/susds-psm.d.ts +0 -49
- package/build/dex/spark/susds-psm.js +0 -245
- package/build/dex/spark/susds-psm.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/uniswap-v4/constants.d.ts +0 -7
- package/build/dex/uniswap-v4/constants.js +0 -18
- package/build/dex/uniswap-v4/constants.js.map +0 -1
- package/build/dex/uniswap-v4/contract-math/BitMath.d.ts +0 -4
- package/build/dex/uniswap-v4/contract-math/BitMath.js +0 -53
- package/build/dex/uniswap-v4/contract-math/BitMath.js.map +0 -1
- package/build/dex/uniswap-v4/contract-math/FixedPoint128.d.ts +0 -3
- package/build/dex/uniswap-v4/contract-math/FixedPoint128.js +0 -8
- package/build/dex/uniswap-v4/contract-math/FixedPoint128.js.map +0 -1
- package/build/dex/uniswap-v4/contract-math/FixedPoint96.d.ts +0 -4
- package/build/dex/uniswap-v4/contract-math/FixedPoint96.js +0 -9
- package/build/dex/uniswap-v4/contract-math/FixedPoint96.js.map +0 -1
- package/build/dex/uniswap-v4/contract-math/FullMath.d.ts +0 -4
- package/build/dex/uniswap-v4/contract-math/FullMath.js +0 -19
- package/build/dex/uniswap-v4/contract-math/FullMath.js.map +0 -1
- package/build/dex/uniswap-v4/contract-math/LiquidityMath.d.ts +0 -3
- package/build/dex/uniswap-v4/contract-math/LiquidityMath.js +0 -18
- package/build/dex/uniswap-v4/contract-math/LiquidityMath.js.map +0 -1
- package/build/dex/uniswap-v4/contract-math/Position.d.ts +0 -9
- package/build/dex/uniswap-v4/contract-math/Position.js +0 -39
- package/build/dex/uniswap-v4/contract-math/Position.js.map +0 -1
- package/build/dex/uniswap-v4/contract-math/SqrtPriceMath.d.ts +0 -11
- package/build/dex/uniswap-v4/contract-math/SqrtPriceMath.js +0 -80
- package/build/dex/uniswap-v4/contract-math/SqrtPriceMath.js.map +0 -1
- package/build/dex/uniswap-v4/contract-math/SwapMath.d.ts +0 -8
- package/build/dex/uniswap-v4/contract-math/SwapMath.js +0 -70
- package/build/dex/uniswap-v4/contract-math/SwapMath.js.map +0 -1
- package/build/dex/uniswap-v4/contract-math/Tick.d.ts +0 -9
- package/build/dex/uniswap-v4/contract-math/Tick.js +0 -40
- package/build/dex/uniswap-v4/contract-math/Tick.js.map +0 -1
- package/build/dex/uniswap-v4/contract-math/TickBitMap.d.ts +0 -8
- package/build/dex/uniswap-v4/contract-math/TickBitMap.js +0 -40
- package/build/dex/uniswap-v4/contract-math/TickBitMap.js.map +0 -1
- package/build/dex/uniswap-v4/contract-math/TickMath.d.ts +0 -9
- package/build/dex/uniswap-v4/contract-math/TickMath.js +0 -164
- package/build/dex/uniswap-v4/contract-math/TickMath.js.map +0 -1
- package/build/dex/uniswap-v4/contract-math/UnsafeMath.d.ts +0 -4
- package/build/dex/uniswap-v4/contract-math/UnsafeMath.js +0 -16
- package/build/dex/uniswap-v4/contract-math/UnsafeMath.js.map +0 -1
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-math.d.ts +0 -8
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-math.js +0 -11
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-math.js.map +0 -1
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-pool-math.d.ts +0 -15
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-pool-math.js +0 -108
- package/build/dex/uniswap-v4/contract-math/uniswap-v4-pool-math.js.map +0 -1
- package/build/dex/uniswap-v4/contract-math/utils.d.ts +0 -4
- package/build/dex/uniswap-v4/contract-math/utils.js +0 -23
- package/build/dex/uniswap-v4/contract-math/utils.js.map +0 -1
- package/build/dex/uniswap-v4/subgraph.d.ts +0 -5
- package/build/dex/uniswap-v4/subgraph.js +0 -80
- package/build/dex/uniswap-v4/subgraph.js.map +0 -1
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.d.ts +0 -33
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.js +0 -260
- package/build/dex/uniswap-v4/uniswap-v4-pool-manager.js.map +0 -1
- package/build/dex/uniswap-v4/utils.d.ts +0 -2
- package/build/dex/uniswap-v4/utils.js +0 -15
- package/build/dex/uniswap-v4/utils.js.map +0 -1
- /package/build/dex/{m-token → inception}/types.js +0 -0
|
@@ -37,7 +37,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.UniswapV4 = void 0;
|
|
40
|
-
const lodash_1 = require("lodash");
|
|
41
40
|
const constants_1 = require("../../constants");
|
|
42
41
|
const utils_1 = require("../../utils");
|
|
43
42
|
const simple_exchange_1 = require("../simple-exchange");
|
|
@@ -48,70 +47,59 @@ const bigint_constants_1 = require("../../bigint-constants");
|
|
|
48
47
|
const abi_1 = require("@ethersproject/abi");
|
|
49
48
|
const decoders_1 = require("../../lib/decoders");
|
|
50
49
|
const encoder_1 = require("./encoder");
|
|
51
|
-
const uniswap_v4_pool_manager_1 = require("./uniswap-v4-pool-manager");
|
|
52
50
|
class UniswapV4 extends simple_exchange_1.SimpleExchange {
|
|
53
51
|
network;
|
|
54
52
|
dexHelper;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
router;
|
|
54
|
+
quoter;
|
|
55
|
+
poolManager;
|
|
56
|
+
subgraph;
|
|
58
57
|
hasConstantPriceLargeAmounts = false;
|
|
59
58
|
needWrapNative = false;
|
|
60
59
|
logger;
|
|
61
60
|
quoterIface;
|
|
62
|
-
poolManager;
|
|
63
61
|
static dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.UniswapV4Config);
|
|
64
|
-
constructor(network, dexKey, dexHelper,
|
|
62
|
+
constructor(network, dexKey, dexHelper, router = config_1.UniswapV4Config[dexKey][network].router, quoter = config_1.UniswapV4Config[dexKey][network].quoter, poolManager = config_1.UniswapV4Config[dexKey][network].poolManager, subgraph = config_1.UniswapV4Config[dexKey][network].subgraphURL) {
|
|
65
63
|
super(dexHelper, dexKey);
|
|
66
64
|
this.network = network;
|
|
67
65
|
this.dexHelper = dexHelper;
|
|
68
|
-
this.
|
|
69
|
-
this.
|
|
70
|
-
this.
|
|
66
|
+
this.router = router;
|
|
67
|
+
this.quoter = quoter;
|
|
68
|
+
this.poolManager = poolManager;
|
|
69
|
+
this.subgraph = subgraph;
|
|
71
70
|
this.logger = dexHelper.getLogger(dexKey);
|
|
72
71
|
this.quoterIface = new abi_1.Interface(quoter_abi_json_1.default);
|
|
73
|
-
this.poolManager = new uniswap_v4_pool_manager_1.UniswapV4PoolManager(dexHelper, dexKey, network, config_1.UniswapV4Config[dexKey][network], this.logger);
|
|
74
|
-
}
|
|
75
|
-
async initializePricing(blockNumber) {
|
|
76
|
-
await this.poolManager.initialize(blockNumber);
|
|
77
72
|
}
|
|
78
73
|
async getPoolIdentifiers(from, to, side, blockNumber) {
|
|
79
|
-
const pools = await this.
|
|
74
|
+
const pools = await this.getAvailablePools(from.address.toLowerCase(), to.address.toLowerCase());
|
|
80
75
|
return pools.map(pool => pool.id);
|
|
81
76
|
}
|
|
82
77
|
async getPricesVolume(from, to, amounts, side, blockNumber, limitPools) {
|
|
83
78
|
if (side === constants_1.SwapSide.BUY)
|
|
84
79
|
return null;
|
|
85
|
-
const pools = await this.
|
|
80
|
+
const pools = await this.getAvailablePools(from.address.toLowerCase(), to.address.toLowerCase());
|
|
86
81
|
const availablePools = limitPools?.filter(t => pools.find(p => p.id === t)) ??
|
|
87
82
|
pools.map(t => t.id);
|
|
88
83
|
const pricesPromises = availablePools.map(async (poolId) => {
|
|
89
84
|
const pool = pools.find(p => p.id === poolId);
|
|
90
|
-
const zeroForOne = from.address.toLowerCase() === pool.key.currency0.toLowerCase()
|
|
91
|
-
((0, utils_1.isETHAddress)(from.address) && pool.key.currency0 === constants_1.NULL_ADDRESS);
|
|
85
|
+
const zeroForOne = from.address.toLowerCase() === pool.key.currency0.toLowerCase();
|
|
92
86
|
const prices = await this.queryPrice(zeroForOne, amounts, pool);
|
|
93
|
-
if (prices?.every(price => price === 0n || price === 1n)) {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
87
|
return {
|
|
97
88
|
unit: bigint_constants_1.BI_POWS[to.decimals],
|
|
98
89
|
prices,
|
|
99
90
|
data: {
|
|
100
91
|
exchange: this.dexKey,
|
|
101
|
-
pool
|
|
102
|
-
id: pool.id,
|
|
103
|
-
key: (0, lodash_1.omit)(pool.key, ['tick', 'ticks']),
|
|
104
|
-
},
|
|
92
|
+
pool,
|
|
105
93
|
zeroForOne,
|
|
106
94
|
},
|
|
107
|
-
poolAddresses: [this.
|
|
95
|
+
poolAddresses: [this.poolManager],
|
|
108
96
|
exchange: this.dexKey,
|
|
109
97
|
gasCost: 100_000,
|
|
110
98
|
poolIdentifier: poolId,
|
|
111
99
|
};
|
|
112
100
|
});
|
|
113
101
|
const prices = await Promise.all(pricesPromises);
|
|
114
|
-
return prices
|
|
102
|
+
return prices;
|
|
115
103
|
}
|
|
116
104
|
// Returns estimated gas cost of calldata for this DEX in multiSwap
|
|
117
105
|
getCalldataGasCost(poolPrices) {
|
|
@@ -123,9 +111,39 @@ class UniswapV4 extends simple_exchange_1.SimpleExchange {
|
|
|
123
111
|
async getTopPoolsForToken(tokenAddress, count) {
|
|
124
112
|
return [];
|
|
125
113
|
}
|
|
114
|
+
async getAvailablePools(srcToken, destToken) {
|
|
115
|
+
// fetch only pools with positive volumeUSD
|
|
116
|
+
const availablePoolsQuery = `query ($token0: Bytes!, $token1: Bytes!, $hooks: Bytes!) {
|
|
117
|
+
pools (where :{token0: $token0, token1: $token1, hooks: $hooks, volumeUSD_gt: 0}, orderBy: volumeUSD, orderDirection: desc) {
|
|
118
|
+
id
|
|
119
|
+
fee: feeTier
|
|
120
|
+
tickSpacing
|
|
121
|
+
hooks
|
|
122
|
+
}
|
|
123
|
+
}`;
|
|
124
|
+
const [token0, token1] = parseInt(srcToken, 16) < parseInt(destToken, 16)
|
|
125
|
+
? [srcToken, destToken]
|
|
126
|
+
: [destToken, srcToken];
|
|
127
|
+
const { data } = await this.dexHelper.httpRequest.querySubgraph(this.subgraph,
|
|
128
|
+
// at the moment, support only pools with no hooks
|
|
129
|
+
{
|
|
130
|
+
query: availablePoolsQuery,
|
|
131
|
+
variables: { token0, token1, hooks: constants_1.NULL_ADDRESS },
|
|
132
|
+
}, { timeout: constants_1.SUBGRAPH_TIMEOUT });
|
|
133
|
+
return data.pools.map(pool => ({
|
|
134
|
+
id: pool.id,
|
|
135
|
+
key: {
|
|
136
|
+
currency0: token0,
|
|
137
|
+
currency1: token1,
|
|
138
|
+
fee: pool.fee,
|
|
139
|
+
tickSpacing: pool.tickSpacing,
|
|
140
|
+
hooks: pool.hooks,
|
|
141
|
+
},
|
|
142
|
+
}));
|
|
143
|
+
}
|
|
126
144
|
async queryPrice(zeroForOne, amounts, pool) {
|
|
127
145
|
const calls = amounts.map(amount => ({
|
|
128
|
-
target: this.
|
|
146
|
+
target: this.quoter,
|
|
129
147
|
callData: this.quoterIface.encodeFunctionData('quoteExactInputSingle', [
|
|
130
148
|
{
|
|
131
149
|
poolKey: pool.key,
|
|
@@ -150,7 +168,7 @@ class UniswapV4 extends simple_exchange_1.SimpleExchange {
|
|
|
150
168
|
needWrapNative: this.needWrapNative,
|
|
151
169
|
dexFuncHasRecipient: true,
|
|
152
170
|
exchangeData,
|
|
153
|
-
targetExchange: this.
|
|
171
|
+
targetExchange: this.router,
|
|
154
172
|
permit2Approval: true,
|
|
155
173
|
returnAmountPos: undefined,
|
|
156
174
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniswap-v4.js","sourceRoot":"","sources":["../../../src/dex/uniswap-v4/uniswap-v4.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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AI,CAAC,SAAS,CAAC,YAAa,CAAC,YAAY,CAC7D,KAAK,EACL,KAAK,CACN,CAAC;QACF,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1E,CAAC;IAED,WAAW,CACT,QAAiB,EACjB,SAAkB,EAClB,SAAyB,EACzB,UAA0B,EAC1B,SAAkB,EAClB,IAAmB,EACnB,IAAc;QAEd,MAAM,YAAY,GAAG,IAAA,sCAA4B,EAC/C,QAAQ,EACR,SAAS,EACT,IAAI,CAAC,IAAI,CAAC,GAAG,EACb,IAAI,CAAC,UAAU,EACf,MAAM,CAAC,SAAS,CAAC;QACjB,wCAAwC;QACxC,MAAM,CAAC,CAAC,CAAC,EACT,SAAS,CACV,CAAC;QAEF,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,mBAAmB,EAAE,IAAI;YACzB,YAAY;YACZ,cAAc,EAAE,IAAI,CAAC,MAAM;YAC3B,eAAe,EAAE,IAAI;YACrB,eAAe,EAAE,SAAS;SAC3B,CAAC;IACJ,CAAC;IAED,eAAe,CACb,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAmB,EACnB,IAAc;QAEd,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAE1B,MAAM,OAAO,GAAG,EAAE,CAAC;QAEnB,OAAO;YACL,cAAc,EAAE,QAAQ;YACxB,OAAO;YACP,UAAU,EAAE,GAAG;SAChB,CAAC;IACJ,CAAC;;AApOH,8BAqOC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Address, NumberAsString, DexExchangeParam } from '../../types';
|
|
2
|
+
import { SwapSide, Network } from '../../constants';
|
|
3
|
+
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
4
|
+
import { Interface } from '@ethersproject/abi';
|
|
5
|
+
import { Usual } from './usual';
|
|
6
|
+
export declare class UsualMSmartM extends Usual {
|
|
7
|
+
readonly network: Network;
|
|
8
|
+
readonly dexKey: string;
|
|
9
|
+
readonly dexHelper: IDexHelper;
|
|
10
|
+
static dexKeysWithNetwork: {
|
|
11
|
+
key: string;
|
|
12
|
+
networks: Network[];
|
|
13
|
+
}[];
|
|
14
|
+
usualMIface: Interface;
|
|
15
|
+
constructor(network: Network, dexKey: string, dexHelper: IDexHelper);
|
|
16
|
+
getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: {}, side: SwapSide): Promise<DexExchangeParam>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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.UsualMSmartM = void 0;
|
|
7
|
+
const constants_1 = require("../../constants");
|
|
8
|
+
const abi_1 = require("@ethersproject/abi");
|
|
9
|
+
const usual_1 = require("./usual");
|
|
10
|
+
const utils_1 = require("../../utils");
|
|
11
|
+
const usualM_abi_json_1 = __importDefault(require("../../abi/usual-m-smart-m/usualM.abi.json"));
|
|
12
|
+
const Config = {
|
|
13
|
+
UsualMSmartM: {
|
|
14
|
+
[constants_1.Network.MAINNET]: {
|
|
15
|
+
fromToken: {
|
|
16
|
+
address: '0x437cc33344a0b27a429f795ff6b469c72698b291',
|
|
17
|
+
decimals: 6,
|
|
18
|
+
},
|
|
19
|
+
toToken: {
|
|
20
|
+
address: '0xfe274c305b365dc38e188e8f01c4fae2171ce927',
|
|
21
|
+
decimals: 6,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
class UsualMSmartM extends usual_1.Usual {
|
|
27
|
+
constructor(network, dexKey, dexHelper) {
|
|
28
|
+
super(network, dexKey, dexHelper, Config[dexKey][network]);
|
|
29
|
+
this.network = network;
|
|
30
|
+
this.dexKey = dexKey;
|
|
31
|
+
this.dexHelper = dexHelper;
|
|
32
|
+
this.usualMIface = new abi_1.Interface(usualM_abi_json_1.default);
|
|
33
|
+
}
|
|
34
|
+
async getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
|
|
35
|
+
if (this.isFromToken(srcToken) && this.isToToken(destToken)) {
|
|
36
|
+
const exchangeData = this.usualMIface.encodeFunctionData('wrap(address, uint256)', [recipient, srcAmount]);
|
|
37
|
+
return {
|
|
38
|
+
needWrapNative: false,
|
|
39
|
+
dexFuncHasRecipient: true,
|
|
40
|
+
exchangeData,
|
|
41
|
+
targetExchange: this.config.toToken.address,
|
|
42
|
+
returnAmountPos: undefined,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
throw new Error('LOGIC ERROR');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.UsualMSmartM = UsualMSmartM;
|
|
49
|
+
UsualMSmartM.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(Config);
|
|
50
|
+
//# sourceMappingURL=usual-m-smart-m.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usual-m-smart-m.js","sourceRoot":"","sources":["../../../src/dex/usual/usual-m-smart-m.ts"],"names":[],"mappings":";;;;;;AAMA,+CAAoD;AAGpD,4CAA6D;AAC7D,mCAAgC;AAChC,uCAAoD;AACpD,gGAAmE;AAEnE,MAAM,MAAM,GAA4B;IACtC,YAAY,EAAE;QACZ,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,SAAS,EAAE;gBACT,OAAO,EAAE,4CAA4C;gBACrD,QAAQ,EAAE,CAAC;aACZ;YACD,OAAO,EAAE;gBACP,OAAO,EAAE,4CAA4C;gBACrD,QAAQ,EAAE,CAAC;aACZ;SACF;KACF;CACF,CAAC;AAEF,MAAa,YAAa,SAAQ,aAAK;IAMrC,YACW,OAAgB,EAChB,MAAc,EACd,SAAqB;QAE9B,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAJlD,YAAO,GAAP,OAAO,CAAS;QAChB,WAAM,GAAN,MAAM,CAAQ;QACd,cAAS,GAAT,SAAS,CAAY;QAG9B,IAAI,CAAC,WAAW,GAAG,IAAI,eAAS,CAAC,yBAA4B,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,WAAW,CACf,QAAiB,EACjB,SAAkB,EAClB,SAAyB,EACzB,UAA0B,EAC1B,SAAkB,EAClB,IAAQ,EACR,IAAc;QAEd,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE;YAC3D,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,kBAAkB,CACtD,wBAAwB,EACxB,CAAC,SAAS,EAAE,SAAS,CAAC,CACvB,CAAC;YAEF,OAAO;gBACL,cAAc,EAAE,KAAK;gBACrB,mBAAmB,EAAE,IAAI;gBACzB,YAAY;gBACZ,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO;gBAC3C,eAAe,EAAE,SAAS;aAC3B,CAAC;SACH;QAED,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC;;AAxCH,oCAyCC;AAxCe,+BAAkB,GAC9B,IAAA,6BAAqB,EAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UsualMSmartMConfig = void 0;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
exports.UsualMSmartMConfig = {
|
|
6
|
+
UsualMSmartM: {
|
|
7
|
+
[constants_1.Network.MAINNET]: {
|
|
8
|
+
smartMAddress: '0x437cc33344a0B27A429f795ff6B469C72698B291',
|
|
9
|
+
usualMAddress: '0xFe274C305b365dC38e188E8f01c4FAe2171ce927',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/usual-m-smart-m/config.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAEvC,QAAA,kBAAkB,GAA4B;IACzD,YAAY,EAAE;QACZ,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,aAAa,EAAE,4CAA4C;YAC3D,aAAa,EAAE,4CAA4C;SAC5D;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/usual-m-smart-m/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, Logger, NumberAsString, DexExchangeParam, PoolLiquidity } from '../../types';
|
|
2
|
+
import { SwapSide, Network } from '../../constants';
|
|
3
|
+
import { IDex } from '../idex';
|
|
4
|
+
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
5
|
+
import { UsualMSmartMData, DexParams } from './types';
|
|
6
|
+
import { SimpleExchange } from '../simple-exchange';
|
|
7
|
+
import { Interface } from '@ethersproject/abi';
|
|
8
|
+
export declare class UsualMSmartM1 extends SimpleExchange implements IDex<UsualMSmartMData> {
|
|
9
|
+
readonly network: Network;
|
|
10
|
+
readonly dexKey: string;
|
|
11
|
+
readonly dexHelper: IDexHelper;
|
|
12
|
+
protected config: DexParams;
|
|
13
|
+
readonly hasConstantPriceLargeAmounts = true;
|
|
14
|
+
readonly needWrapNative = false;
|
|
15
|
+
readonly isFeeOnTransferSupported = false;
|
|
16
|
+
static dexKeysWithNetwork: {
|
|
17
|
+
key: string;
|
|
18
|
+
networks: Network[];
|
|
19
|
+
}[];
|
|
20
|
+
usualMIface: Interface;
|
|
21
|
+
logger: Logger;
|
|
22
|
+
constructor(network: Network, dexKey: string, dexHelper: IDexHelper);
|
|
23
|
+
initializePricing(blockNumber: number): Promise<void>;
|
|
24
|
+
getConfig(): DexParams;
|
|
25
|
+
is_smartM(token: string): boolean;
|
|
26
|
+
is_usualM(token: string): boolean;
|
|
27
|
+
is_usualM_swap_token(srcToken: string, destToken: string): boolean;
|
|
28
|
+
getAdapters(): null;
|
|
29
|
+
getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
|
|
30
|
+
getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<UsualMSmartMData>>;
|
|
31
|
+
getCalldataGasCost(poolPrices: PoolPrices<UsualMSmartMData>): number | number[];
|
|
32
|
+
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: UsualMSmartMData, side: SwapSide): AdapterExchangeParam;
|
|
33
|
+
getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: UsualMSmartMData, side: SwapSide): Promise<DexExchangeParam>;
|
|
34
|
+
getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.UsualMSmartM1 = void 0;
|
|
30
|
+
const constants_1 = require("../../constants");
|
|
31
|
+
const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
|
|
32
|
+
const utils_1 = require("../../utils");
|
|
33
|
+
const simple_exchange_1 = require("../simple-exchange");
|
|
34
|
+
const config_1 = require("./config");
|
|
35
|
+
const abi_1 = require("@ethersproject/abi");
|
|
36
|
+
const usualM_abi_json_1 = __importDefault(require("../../abi/usual-m-smart-m/usualM.abi.json"));
|
|
37
|
+
const bigint_constants_1 = require("../../bigint-constants");
|
|
38
|
+
class UsualMSmartM1 extends simple_exchange_1.SimpleExchange {
|
|
39
|
+
constructor(network, dexKey, dexHelper) {
|
|
40
|
+
super(dexHelper, dexKey);
|
|
41
|
+
this.network = network;
|
|
42
|
+
this.dexKey = dexKey;
|
|
43
|
+
this.dexHelper = dexHelper;
|
|
44
|
+
this.hasConstantPriceLargeAmounts = true;
|
|
45
|
+
this.needWrapNative = false;
|
|
46
|
+
this.isFeeOnTransferSupported = false;
|
|
47
|
+
const config = config_1.UsualMSmartMConfig[dexKey][network];
|
|
48
|
+
this.usualMIface = new abi_1.Interface(usualM_abi_json_1.default);
|
|
49
|
+
this.config = {
|
|
50
|
+
smartMAddress: config.smartMAddress.toLowerCase(),
|
|
51
|
+
usualMAddress: config.usualMAddress.toLowerCase(),
|
|
52
|
+
};
|
|
53
|
+
this.logger = dexHelper.getLogger(dexKey);
|
|
54
|
+
}
|
|
55
|
+
async initializePricing(blockNumber) {
|
|
56
|
+
// No initialization needed for constant price
|
|
57
|
+
}
|
|
58
|
+
getConfig() {
|
|
59
|
+
return this.config;
|
|
60
|
+
}
|
|
61
|
+
is_smartM(token) {
|
|
62
|
+
return token.toLowerCase() === this.config.smartMAddress.toLowerCase();
|
|
63
|
+
}
|
|
64
|
+
is_usualM(token) {
|
|
65
|
+
return token.toLowerCase() === this.config.usualMAddress.toLowerCase();
|
|
66
|
+
}
|
|
67
|
+
is_usualM_swap_token(srcToken, destToken) {
|
|
68
|
+
return this.is_smartM(srcToken) && this.is_usualM(destToken);
|
|
69
|
+
}
|
|
70
|
+
getAdapters() {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
|
|
74
|
+
if (!srcToken || !destToken) {
|
|
75
|
+
this.logger.error('Source or destination token is undefined');
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
const srcTokenAddress = srcToken.address?.toLowerCase();
|
|
79
|
+
const destTokenAddress = destToken.address?.toLowerCase();
|
|
80
|
+
if (!srcTokenAddress || !destTokenAddress) {
|
|
81
|
+
this.logger.error('Source or destination token address is undefined');
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
if (this.is_usualM_swap_token(srcTokenAddress, destTokenAddress)) {
|
|
85
|
+
return [`${this.dexKey}_${this.config.usualMAddress}`];
|
|
86
|
+
}
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
|
|
90
|
+
if (side === constants_1.SwapSide.BUY) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
const isUsualMSwapToken = this.is_usualM_swap_token(srcToken.address, destToken.address);
|
|
94
|
+
if (!isUsualMSwapToken) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
const unitOut = bigint_constants_1.BI_POWS[18]; // 1:1 swap
|
|
98
|
+
const amountsOut = amounts; // 1:1 swap, so output amounts are the same as input
|
|
99
|
+
return [
|
|
100
|
+
{
|
|
101
|
+
unit: unitOut,
|
|
102
|
+
prices: amountsOut,
|
|
103
|
+
data: {},
|
|
104
|
+
poolAddresses: [this.config.usualMAddress],
|
|
105
|
+
exchange: this.dexKey,
|
|
106
|
+
gasCost: 70000,
|
|
107
|
+
poolIdentifier: this.dexKey,
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
getCalldataGasCost(poolPrices) {
|
|
112
|
+
return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
|
|
113
|
+
}
|
|
114
|
+
getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
115
|
+
const payload = '0x';
|
|
116
|
+
return {
|
|
117
|
+
targetExchange: this.config.usualMAddress,
|
|
118
|
+
payload,
|
|
119
|
+
networkFee: '0',
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
|
|
123
|
+
if (this.is_smartM(srcToken) && this.is_usualM(destToken)) {
|
|
124
|
+
const exchangeData = this.usualMIface.encodeFunctionData('wrap', [
|
|
125
|
+
recipient,
|
|
126
|
+
srcAmount,
|
|
127
|
+
]);
|
|
128
|
+
return {
|
|
129
|
+
needWrapNative: false,
|
|
130
|
+
dexFuncHasRecipient: true,
|
|
131
|
+
exchangeData,
|
|
132
|
+
targetExchange: this.config.usualMAddress,
|
|
133
|
+
returnAmountPos: undefined,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
throw new Error('LOGIC ERROR');
|
|
137
|
+
}
|
|
138
|
+
async getTopPoolsForToken(tokenAddress, limit) {
|
|
139
|
+
const isSmartM = this.is_smartM(tokenAddress);
|
|
140
|
+
if (!isSmartM && !this.is_usualM(tokenAddress))
|
|
141
|
+
return [];
|
|
142
|
+
return [
|
|
143
|
+
{
|
|
144
|
+
exchange: this.dexKey,
|
|
145
|
+
address: this.config.usualMAddress,
|
|
146
|
+
connectorTokens: [
|
|
147
|
+
{
|
|
148
|
+
decimals: 6,
|
|
149
|
+
address: isSmartM
|
|
150
|
+
? this.config.usualMAddress
|
|
151
|
+
: this.config.smartMAddress,
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
liquidityUSD: 1000000000, // Just returning a big number so this DEX will be preferred
|
|
155
|
+
},
|
|
156
|
+
];
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.UsualMSmartM1 = UsualMSmartM1;
|
|
160
|
+
UsualMSmartM1.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.UsualMSmartMConfig);
|
|
161
|
+
//# sourceMappingURL=usual-m-smart-m.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usual-m-smart-m.js","sourceRoot":"","sources":["../../../src/dex/usual-m-smart-m/usual-m-smart-m.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,+CAAoD;AACpD,2EAA6D;AAC7D,uCAAoD;AAIpD,wDAAoD;AACpD,qCAA8C;AAC9C,4CAA6D;AAC7D,gGAAmE;AACnE,6DAAiD;AAEjD,MAAa,aACX,SAAQ,gCAAc;IAetB,YACW,OAAgB,EAChB,MAAc,EACd,SAAqB;QAE9B,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAJ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AAO;YACL;gBACE,QAAQ,EAAE,IAAI,CAAC,MAAM;gBACrB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa;gBAClC,eAAe,EAAE;oBACf;wBACE,QAAQ,EAAE,CAAC;wBACX,OAAO,EAAE,QAAQ;4BACf,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa;4BAC3B,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa;qBAC9B;iBACF;gBACD,YAAY,EAAE,UAAU,EAAE,4DAA4D;aACvF;SACF,CAAC;IACJ,CAAC;;AA9LH,sCA+LC;AArLe,gCAAkB,GAC9B,IAAA,6BAAqB,EAAC,2BAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UsualMUsd0Config = void 0;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
exports.UsualMUsd0Config = {
|
|
6
|
+
UsualMUsd0: {
|
|
7
|
+
[constants_1.Network.MAINNET]: {
|
|
8
|
+
usualMAddress: '0xFe274C305b365dC38e188E8f01c4FAe2171ce927',
|
|
9
|
+
usd0Address: '0x73A15FeD60Bf67631dC6cd7Bc5B6e8da8190aCF5',
|
|
10
|
+
usualDaoCollateralAddress: '0xde6e1F680C4816446C8D515989E2358636A38b04',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/usual-m-usd0/config.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAEvC,QAAA,gBAAgB,GAA4B;IACvD,UAAU,EAAE;QACV,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,aAAa,EAAE,4CAA4C;YAC3D,WAAW,EAAE,4CAA4C;YACzD,yBAAyB,EAAE,4CAA4C;SACxE;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/usual-m-usd0/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, Logger, NumberAsString, DexExchangeParam, PoolLiquidity } from '../../types';
|
|
2
|
+
import { SwapSide, Network } from '../../constants';
|
|
3
|
+
import { IDex } from '../idex';
|
|
4
|
+
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
5
|
+
import { UsualMUsd0Data, DexParams } from './types';
|
|
6
|
+
import { SimpleExchange } from '../simple-exchange';
|
|
7
|
+
import { Interface } from '@ethersproject/abi';
|
|
8
|
+
export declare class UsualMUsd01 extends SimpleExchange implements IDex<UsualMUsd0Data> {
|
|
9
|
+
readonly network: Network;
|
|
10
|
+
readonly dexKey: string;
|
|
11
|
+
readonly dexHelper: IDexHelper;
|
|
12
|
+
protected config: DexParams;
|
|
13
|
+
readonly hasConstantPriceLargeAmounts = true;
|
|
14
|
+
readonly needWrapNative = false;
|
|
15
|
+
readonly isFeeOnTransferSupported = false;
|
|
16
|
+
static dexKeysWithNetwork: {
|
|
17
|
+
key: string;
|
|
18
|
+
networks: Network[];
|
|
19
|
+
}[];
|
|
20
|
+
usualDaoCollateralIface: Interface;
|
|
21
|
+
logger: Logger;
|
|
22
|
+
constructor(network: Network, dexKey: string, dexHelper: IDexHelper);
|
|
23
|
+
initializePricing(blockNumber: number): Promise<void>;
|
|
24
|
+
getConfig(): DexParams;
|
|
25
|
+
is_usualM(token: string): boolean;
|
|
26
|
+
is_usd0(token: string): boolean;
|
|
27
|
+
is_usd0_swap_token(srcToken: string, destToken: string): boolean;
|
|
28
|
+
getAdapters(): null;
|
|
29
|
+
getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
|
|
30
|
+
getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<UsualMUsd0Data>>;
|
|
31
|
+
getCalldataGasCost(poolPrices: PoolPrices<UsualMUsd0Data>): number | number[];
|
|
32
|
+
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: UsualMUsd0Data, side: SwapSide): AdapterExchangeParam;
|
|
33
|
+
getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: UsualMUsd0Data, side: SwapSide): Promise<DexExchangeParam>;
|
|
34
|
+
getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
|
|
35
|
+
}
|