@paraswap/dex-lib 3.4.2-balancer-v2-single-swap.0 → 3.4.2
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/README.md +377 -377
- package/build/config.js +9 -5
- package/build/config.js.map +1 -1
- package/build/dex/algebra/algebra.js +25 -25
- package/build/dex/balancer-v1/balancer-v1.js +34 -34
- package/build/dex/balancer-v2/balancer-v2.d.ts +1 -1
- package/build/dex/balancer-v2/balancer-v2.js +65 -78
- package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
- package/build/dex/camelot/camelot.js +27 -27
- package/build/dex/kyberdmm/kyberdmm.js +27 -27
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js +25 -25
- package/build/dex/solidly/solidly.js +27 -27
- package/build/dex/solidly-v3/solidly-v3.js +25 -25
- package/build/dex/swaap-v2/config.js +15 -0
- package/build/dex/swaap-v2/config.js.map +1 -1
- package/build/dex/uniswap-v2/uniswap-v2.js +26 -26
- package/build/dex/uniswap-v3/uniswap-v3.js +25 -25
- package/funding.json +5 -5
- package/package.json +1 -1
- package/src/config.ts +500 -496
- package/src/constants.ts +67 -67
- package/src/dex/aave-v2/aave-v2.ts +409 -409
- package/src/dex/aave-v3/aave-v3.ts +320 -320
- package/src/dex/algebra/algebra.ts +1180 -1180
- package/src/dex/angle-staked-stable/angle-staked-stable.ts +347 -347
- package/src/dex/augustus-rfq.ts +180 -180
- package/src/dex/bProtocol/bProtocol.ts +108 -108
- package/src/dex/balancer-v1/balancer-v1.ts +572 -572
- package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +1699 -1699
- package/src/dex/balancer-v2/balancer-v2.ts +1669 -1701
- package/src/dex/bancor/bancor.ts +128 -128
- package/src/dex/camelot/camelot.ts +873 -873
- package/src/dex/compound/compound.ts +107 -107
- package/src/dex/curve-v1/config.ts +1179 -1179
- package/src/dex/curve-v1/curve-v1-e2e.test.ts +507 -507
- package/src/dex/curve-v1/curve-v1.ts +1315 -1315
- package/src/dex/curve-v1-factory/config.ts +1018 -1018
- package/src/dex/curve-v1-factory/curve-v1-factory.ts +1288 -1288
- package/src/dex/curve-v2/curve-v2.ts +440 -440
- package/src/dex/dexalot/dexalot.ts +1100 -1100
- package/src/dex/dodo-v1/dodo-v1.ts +132 -132
- package/src/dex/dodo-v2.ts +266 -266
- package/src/dex/etherfi.ts +239 -239
- package/src/dex/generic-rfq/generic-rfq.ts +431 -431
- package/src/dex/gmx/gmx.ts +321 -321
- package/src/dex/hashflow/hashflow.ts +1135 -1135
- package/src/dex/idex.ts +254 -254
- package/src/dex/index.ts +357 -357
- package/src/dex/jarvis-v6/jarvis-v6.ts +509 -509
- package/src/dex/jarvis.ts +262 -262
- package/src/dex/kyberdmm/kyberdmm.ts +649 -649
- package/src/dex/lido/lido.ts +110 -110
- package/src/dex/maker-psm/maker-psm.ts +592 -592
- package/src/dex/maverick-v1/maverick-v1.ts +537 -537
- package/src/dex/nerve/config.ts +635 -635
- package/src/dex/nerve/nerve-e2e.test.ts +731 -731
- package/src/dex/nerve/nerve-events.test.ts +911 -911
- package/src/dex/nerve/nerve.ts +467 -467
- package/src/dex/onebit/onebit.ts +113 -113
- package/src/dex/pancakeswap-v3/pancakeswap-v3.ts +1150 -1150
- package/src/dex/paraswap-limit-orders/config.ts +60 -60
- package/src/dex/paraswap-limit-orders/paraswap-limit-orders-e2e.test.ts +137 -137
- package/src/dex/paraswap-limit-orders/paraswap-limit-orders-integration.test.ts +328 -328
- package/src/dex/paraswap-limit-orders/paraswap-limit-orders.ts +631 -631
- package/src/dex/polygon-migrator/polygon-migrator.ts +194 -194
- package/src/dex/quick-perps/quick-perps.ts +337 -337
- package/src/dex/quickswap/config.ts +16 -16
- package/src/dex/quickswap/quickswap-e2e.test.ts +384 -384
- package/src/dex/smoothy/smoothy.ts +110 -110
- package/src/dex/solidly/config.ts +225 -225
- package/src/dex/solidly/solidly-e2e.test.ts +1421 -1421
- package/src/dex/solidly/solidly-integration.test.ts +1753 -1753
- package/src/dex/solidly/solidly.ts +687 -687
- package/src/dex/solidly-v3/solidly-v3.ts +968 -968
- package/src/dex/spark/spark.ts +284 -284
- package/src/dex/stable-pool/stable-pool.ts +129 -129
- package/src/dex/swaap-v2/config.ts +15 -0
- package/src/dex/swaap-v2/swaap-v2-e2e.test.ts +233 -17
- package/src/dex/swaap-v2/swaap-v2-integration.test.ts +1 -1
- package/src/dex/swaap-v2/swaap-v2.ts +1056 -1056
- package/src/dex/swell/swell.ts +312 -312
- package/src/dex/synthetix/synthetix.ts +420 -420
- package/src/dex/trader-joe-v2.1/trader-joe-v2.1.ts +180 -180
- package/src/dex/uniswap-v2/config.ts +637 -637
- package/src/dex/uniswap-v2/constants.ts +58 -58
- package/src/dex/uniswap-v2/uniswap-v2-e2e-avalanche.test.ts +1257 -1257
- package/src/dex/uniswap-v2/uniswap-v2-e2e-base.test.ts +42 -42
- package/src/dex/uniswap-v2/uniswap-v2-e2e-bsc.test.ts +1295 -1295
- package/src/dex/uniswap-v2/uniswap-v2-e2e-mainnet.test.ts +1834 -1834
- package/src/dex/uniswap-v2/uniswap-v2-e2e-polygon.test.ts +871 -871
- package/src/dex/uniswap-v2/uniswap-v2.ts +1117 -1117
- package/src/dex/uniswap-v3/uniswap-v3.ts +1501 -1501
- package/src/dex/uniswap-v3.ts +242 -242
- package/src/dex/weth/config.ts +73 -73
- package/src/dex/weth/weth.ts +230 -230
- package/src/dex/wombat/wombat.ts +467 -467
- package/src/dex/woo-fi-v2/woo-fi-v2.ts +529 -529
- package/src/dex/wsteth/wsteth.ts +304 -304
- package/src/dex/zerox/index.ts +328 -328
- package/src/executor/Executor01BytecodeBuilder.ts +474 -474
- package/src/executor/Executor02BytecodeBuilder.ts +1392 -1392
- package/src/executor/ExecutorBytecodeBuilder.ts +390 -390
- package/src/executor/ExecutorDetector.ts +131 -131
- package/src/executor/constants.ts +66 -66
- package/src/executor/executor01-bytecode-builder-e2e.test.ts +1478 -1478
- package/src/executor/utils.ts +62 -62
- package/src/router/simpleswap.ts +366 -366
- package/src/types.ts +342 -342
- package/tests/constants-e2e.ts +1632 -1622
- package/tests/generate-new-limit-order.ts +107 -107
|
@@ -1,194 +1,194 @@
|
|
|
1
|
-
import { SimpleExchange } from '../simple-exchange';
|
|
2
|
-
import { IDex } from '../idex';
|
|
3
|
-
import {
|
|
4
|
-
DexParams,
|
|
5
|
-
PolygonMigrationData,
|
|
6
|
-
PolygonMigratorFunctions,
|
|
7
|
-
} from './types';
|
|
8
|
-
import { Network, SwapSide } from '../../constants';
|
|
9
|
-
import { getDexKeysWithNetwork } from '../../utils';
|
|
10
|
-
import { Adapters, PolygonMigratorConfig } from './config';
|
|
11
|
-
import {
|
|
12
|
-
AdapterExchangeParam,
|
|
13
|
-
Address,
|
|
14
|
-
DexExchangeParam,
|
|
15
|
-
ExchangePrices,
|
|
16
|
-
Logger,
|
|
17
|
-
NumberAsString,
|
|
18
|
-
PoolLiquidity,
|
|
19
|
-
PoolPrices,
|
|
20
|
-
SimpleExchangeParam,
|
|
21
|
-
Token,
|
|
22
|
-
} from '../../types';
|
|
23
|
-
import { IDexHelper } from '../../dex-helper';
|
|
24
|
-
import * as CALLDATA_GAS_COST from '../../calldata-gas-cost';
|
|
25
|
-
import { BI_POWS } from '../../bigint-constants';
|
|
26
|
-
import { POLYGON_MIGRATION_GAS_COST } from './constants';
|
|
27
|
-
import PolygonMigrationAbi from '../../abi/polygon-migration/PolygonMigration.abi.json';
|
|
28
|
-
import { Interface } from 'ethers/lib/utils';
|
|
29
|
-
|
|
30
|
-
export class PolygonMigrator
|
|
31
|
-
extends SimpleExchange
|
|
32
|
-
implements IDex<PolygonMigrationData, DexParams>
|
|
33
|
-
{
|
|
34
|
-
readonly hasConstantPriceLargeAmounts = true;
|
|
35
|
-
readonly isFeeOnTransferSupported = false;
|
|
36
|
-
|
|
37
|
-
public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
|
|
38
|
-
getDexKeysWithNetwork(PolygonMigratorConfig);
|
|
39
|
-
|
|
40
|
-
logger: Logger;
|
|
41
|
-
|
|
42
|
-
constructor(
|
|
43
|
-
protected network: Network,
|
|
44
|
-
dexKey: string,
|
|
45
|
-
protected dexHelper: IDexHelper,
|
|
46
|
-
readonly migratorAddress: string = PolygonMigratorConfig[dexKey][network]
|
|
47
|
-
.migratorAddress,
|
|
48
|
-
readonly polTokenAddress: string = PolygonMigratorConfig[dexKey][network]
|
|
49
|
-
.polTokenAddress,
|
|
50
|
-
readonly maticTokenAddress: string = PolygonMigratorConfig[dexKey][network]
|
|
51
|
-
.maticTokenAddress,
|
|
52
|
-
protected unitPrice = BI_POWS[18],
|
|
53
|
-
protected adapters = Adapters[network] || {},
|
|
54
|
-
protected migratorInterface = new Interface(PolygonMigrationAbi),
|
|
55
|
-
) {
|
|
56
|
-
super(dexHelper, dexKey);
|
|
57
|
-
this.logger = dexHelper.getLogger(dexKey);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
getAdapters(side: SwapSide): { name: string; index: number }[] | null {
|
|
61
|
-
return this.adapters[side] || null;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
isMatic(tokenAddress: Address) {
|
|
65
|
-
return this.maticTokenAddress.toLowerCase() === tokenAddress.toLowerCase();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
isPol(tokenAddress: Address) {
|
|
69
|
-
return this.polTokenAddress.toLowerCase() === tokenAddress.toLowerCase();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
isAppropriatePair(srcToken: Token, destToken: Token) {
|
|
73
|
-
return (
|
|
74
|
-
(this.isMatic(srcToken.address) && this.isPol(destToken.address)) ||
|
|
75
|
-
(this.isMatic(destToken.address) && this.isPol(srcToken.address))
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
async getPoolIdentifiers(
|
|
80
|
-
srcToken: Token,
|
|
81
|
-
destToken: Token,
|
|
82
|
-
side: SwapSide,
|
|
83
|
-
blockNumber: number,
|
|
84
|
-
): Promise<string[]> {
|
|
85
|
-
if (this.isAppropriatePair(srcToken, destToken)) {
|
|
86
|
-
return [`${this.dexKey}_${srcToken.address}_${destToken.address}`];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return [];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
async getPricesVolume(
|
|
93
|
-
srcToken: Token,
|
|
94
|
-
destToken: Token,
|
|
95
|
-
amounts: bigint[],
|
|
96
|
-
side: SwapSide,
|
|
97
|
-
blockNumber: number,
|
|
98
|
-
limitPools?: string[],
|
|
99
|
-
): Promise<null | ExchangePrices<PolygonMigrationData>> {
|
|
100
|
-
if (!this.isAppropriatePair(srcToken, destToken)) {
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return [
|
|
105
|
-
{
|
|
106
|
-
prices: amounts,
|
|
107
|
-
unit: this.unitPrice,
|
|
108
|
-
gasCost: POLYGON_MIGRATION_GAS_COST,
|
|
109
|
-
exchange: this.dexKey,
|
|
110
|
-
poolAddresses: [this.migratorAddress],
|
|
111
|
-
data: null,
|
|
112
|
-
},
|
|
113
|
-
];
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// Returns estimated gas cost of calldata for this DEX in multiSwap
|
|
117
|
-
getCalldataGasCost(
|
|
118
|
-
poolPrices: PoolPrices<PolygonMigrationData>,
|
|
119
|
-
): number | number[] {
|
|
120
|
-
return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
getAdapterParam(
|
|
124
|
-
srcToken: string,
|
|
125
|
-
destToken: string,
|
|
126
|
-
srcAmount: string,
|
|
127
|
-
destAmount: string,
|
|
128
|
-
data: PolygonMigrationData,
|
|
129
|
-
side: SwapSide,
|
|
130
|
-
): AdapterExchangeParam {
|
|
131
|
-
return {
|
|
132
|
-
targetExchange: this.migratorAddress,
|
|
133
|
-
payload: '0x',
|
|
134
|
-
networkFee: '0',
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
async getSimpleParam(
|
|
139
|
-
srcToken: string,
|
|
140
|
-
destToken: string,
|
|
141
|
-
srcAmount: string,
|
|
142
|
-
destAmount: string,
|
|
143
|
-
data: PolygonMigrationData,
|
|
144
|
-
side: SwapSide,
|
|
145
|
-
): Promise<SimpleExchangeParam> {
|
|
146
|
-
const swapData = this.migratorInterface.encodeFunctionData(
|
|
147
|
-
this.isMatic(srcToken)
|
|
148
|
-
? PolygonMigratorFunctions.migrate
|
|
149
|
-
: PolygonMigratorFunctions.unmigrate,
|
|
150
|
-
[srcAmount],
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
return this.buildSimpleParamWithoutWETHConversion(
|
|
154
|
-
srcToken,
|
|
155
|
-
srcAmount,
|
|
156
|
-
destToken,
|
|
157
|
-
destAmount,
|
|
158
|
-
swapData,
|
|
159
|
-
this.migratorAddress,
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
getDexParam(
|
|
164
|
-
srcToken: Address,
|
|
165
|
-
destToken: Address,
|
|
166
|
-
srcAmount: NumberAsString,
|
|
167
|
-
destAmount: NumberAsString,
|
|
168
|
-
recipient: Address,
|
|
169
|
-
data: PolygonMigrationData,
|
|
170
|
-
side: SwapSide,
|
|
171
|
-
): DexExchangeParam {
|
|
172
|
-
const swapData = this.migratorInterface.encodeFunctionData(
|
|
173
|
-
this.isMatic(srcToken)
|
|
174
|
-
? PolygonMigratorFunctions.migrate
|
|
175
|
-
: PolygonMigratorFunctions.unmigrate,
|
|
176
|
-
[srcAmount],
|
|
177
|
-
);
|
|
178
|
-
|
|
179
|
-
return {
|
|
180
|
-
needWrapNative: this.needWrapNative,
|
|
181
|
-
dexFuncHasRecipient: false,
|
|
182
|
-
exchangeData: swapData,
|
|
183
|
-
targetExchange: this.migratorAddress,
|
|
184
|
-
returnAmountPos: undefined,
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
async getTopPoolsForToken(
|
|
189
|
-
tokenAddress: Address,
|
|
190
|
-
limit: number,
|
|
191
|
-
): Promise<PoolLiquidity[]> {
|
|
192
|
-
return [];
|
|
193
|
-
}
|
|
194
|
-
}
|
|
1
|
+
import { SimpleExchange } from '../simple-exchange';
|
|
2
|
+
import { IDex } from '../idex';
|
|
3
|
+
import {
|
|
4
|
+
DexParams,
|
|
5
|
+
PolygonMigrationData,
|
|
6
|
+
PolygonMigratorFunctions,
|
|
7
|
+
} from './types';
|
|
8
|
+
import { Network, SwapSide } from '../../constants';
|
|
9
|
+
import { getDexKeysWithNetwork } from '../../utils';
|
|
10
|
+
import { Adapters, PolygonMigratorConfig } from './config';
|
|
11
|
+
import {
|
|
12
|
+
AdapterExchangeParam,
|
|
13
|
+
Address,
|
|
14
|
+
DexExchangeParam,
|
|
15
|
+
ExchangePrices,
|
|
16
|
+
Logger,
|
|
17
|
+
NumberAsString,
|
|
18
|
+
PoolLiquidity,
|
|
19
|
+
PoolPrices,
|
|
20
|
+
SimpleExchangeParam,
|
|
21
|
+
Token,
|
|
22
|
+
} from '../../types';
|
|
23
|
+
import { IDexHelper } from '../../dex-helper';
|
|
24
|
+
import * as CALLDATA_GAS_COST from '../../calldata-gas-cost';
|
|
25
|
+
import { BI_POWS } from '../../bigint-constants';
|
|
26
|
+
import { POLYGON_MIGRATION_GAS_COST } from './constants';
|
|
27
|
+
import PolygonMigrationAbi from '../../abi/polygon-migration/PolygonMigration.abi.json';
|
|
28
|
+
import { Interface } from 'ethers/lib/utils';
|
|
29
|
+
|
|
30
|
+
export class PolygonMigrator
|
|
31
|
+
extends SimpleExchange
|
|
32
|
+
implements IDex<PolygonMigrationData, DexParams>
|
|
33
|
+
{
|
|
34
|
+
readonly hasConstantPriceLargeAmounts = true;
|
|
35
|
+
readonly isFeeOnTransferSupported = false;
|
|
36
|
+
|
|
37
|
+
public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
|
|
38
|
+
getDexKeysWithNetwork(PolygonMigratorConfig);
|
|
39
|
+
|
|
40
|
+
logger: Logger;
|
|
41
|
+
|
|
42
|
+
constructor(
|
|
43
|
+
protected network: Network,
|
|
44
|
+
dexKey: string,
|
|
45
|
+
protected dexHelper: IDexHelper,
|
|
46
|
+
readonly migratorAddress: string = PolygonMigratorConfig[dexKey][network]
|
|
47
|
+
.migratorAddress,
|
|
48
|
+
readonly polTokenAddress: string = PolygonMigratorConfig[dexKey][network]
|
|
49
|
+
.polTokenAddress,
|
|
50
|
+
readonly maticTokenAddress: string = PolygonMigratorConfig[dexKey][network]
|
|
51
|
+
.maticTokenAddress,
|
|
52
|
+
protected unitPrice = BI_POWS[18],
|
|
53
|
+
protected adapters = Adapters[network] || {},
|
|
54
|
+
protected migratorInterface = new Interface(PolygonMigrationAbi),
|
|
55
|
+
) {
|
|
56
|
+
super(dexHelper, dexKey);
|
|
57
|
+
this.logger = dexHelper.getLogger(dexKey);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
getAdapters(side: SwapSide): { name: string; index: number }[] | null {
|
|
61
|
+
return this.adapters[side] || null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
isMatic(tokenAddress: Address) {
|
|
65
|
+
return this.maticTokenAddress.toLowerCase() === tokenAddress.toLowerCase();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
isPol(tokenAddress: Address) {
|
|
69
|
+
return this.polTokenAddress.toLowerCase() === tokenAddress.toLowerCase();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
isAppropriatePair(srcToken: Token, destToken: Token) {
|
|
73
|
+
return (
|
|
74
|
+
(this.isMatic(srcToken.address) && this.isPol(destToken.address)) ||
|
|
75
|
+
(this.isMatic(destToken.address) && this.isPol(srcToken.address))
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async getPoolIdentifiers(
|
|
80
|
+
srcToken: Token,
|
|
81
|
+
destToken: Token,
|
|
82
|
+
side: SwapSide,
|
|
83
|
+
blockNumber: number,
|
|
84
|
+
): Promise<string[]> {
|
|
85
|
+
if (this.isAppropriatePair(srcToken, destToken)) {
|
|
86
|
+
return [`${this.dexKey}_${srcToken.address}_${destToken.address}`];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async getPricesVolume(
|
|
93
|
+
srcToken: Token,
|
|
94
|
+
destToken: Token,
|
|
95
|
+
amounts: bigint[],
|
|
96
|
+
side: SwapSide,
|
|
97
|
+
blockNumber: number,
|
|
98
|
+
limitPools?: string[],
|
|
99
|
+
): Promise<null | ExchangePrices<PolygonMigrationData>> {
|
|
100
|
+
if (!this.isAppropriatePair(srcToken, destToken)) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return [
|
|
105
|
+
{
|
|
106
|
+
prices: amounts,
|
|
107
|
+
unit: this.unitPrice,
|
|
108
|
+
gasCost: POLYGON_MIGRATION_GAS_COST,
|
|
109
|
+
exchange: this.dexKey,
|
|
110
|
+
poolAddresses: [this.migratorAddress],
|
|
111
|
+
data: null,
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Returns estimated gas cost of calldata for this DEX in multiSwap
|
|
117
|
+
getCalldataGasCost(
|
|
118
|
+
poolPrices: PoolPrices<PolygonMigrationData>,
|
|
119
|
+
): number | number[] {
|
|
120
|
+
return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
getAdapterParam(
|
|
124
|
+
srcToken: string,
|
|
125
|
+
destToken: string,
|
|
126
|
+
srcAmount: string,
|
|
127
|
+
destAmount: string,
|
|
128
|
+
data: PolygonMigrationData,
|
|
129
|
+
side: SwapSide,
|
|
130
|
+
): AdapterExchangeParam {
|
|
131
|
+
return {
|
|
132
|
+
targetExchange: this.migratorAddress,
|
|
133
|
+
payload: '0x',
|
|
134
|
+
networkFee: '0',
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async getSimpleParam(
|
|
139
|
+
srcToken: string,
|
|
140
|
+
destToken: string,
|
|
141
|
+
srcAmount: string,
|
|
142
|
+
destAmount: string,
|
|
143
|
+
data: PolygonMigrationData,
|
|
144
|
+
side: SwapSide,
|
|
145
|
+
): Promise<SimpleExchangeParam> {
|
|
146
|
+
const swapData = this.migratorInterface.encodeFunctionData(
|
|
147
|
+
this.isMatic(srcToken)
|
|
148
|
+
? PolygonMigratorFunctions.migrate
|
|
149
|
+
: PolygonMigratorFunctions.unmigrate,
|
|
150
|
+
[srcAmount],
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
return this.buildSimpleParamWithoutWETHConversion(
|
|
154
|
+
srcToken,
|
|
155
|
+
srcAmount,
|
|
156
|
+
destToken,
|
|
157
|
+
destAmount,
|
|
158
|
+
swapData,
|
|
159
|
+
this.migratorAddress,
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
getDexParam(
|
|
164
|
+
srcToken: Address,
|
|
165
|
+
destToken: Address,
|
|
166
|
+
srcAmount: NumberAsString,
|
|
167
|
+
destAmount: NumberAsString,
|
|
168
|
+
recipient: Address,
|
|
169
|
+
data: PolygonMigrationData,
|
|
170
|
+
side: SwapSide,
|
|
171
|
+
): DexExchangeParam {
|
|
172
|
+
const swapData = this.migratorInterface.encodeFunctionData(
|
|
173
|
+
this.isMatic(srcToken)
|
|
174
|
+
? PolygonMigratorFunctions.migrate
|
|
175
|
+
: PolygonMigratorFunctions.unmigrate,
|
|
176
|
+
[srcAmount],
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
needWrapNative: this.needWrapNative,
|
|
181
|
+
dexFuncHasRecipient: false,
|
|
182
|
+
exchangeData: swapData,
|
|
183
|
+
targetExchange: this.migratorAddress,
|
|
184
|
+
returnAmountPos: undefined,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
async getTopPoolsForToken(
|
|
189
|
+
tokenAddress: Address,
|
|
190
|
+
limit: number,
|
|
191
|
+
): Promise<PoolLiquidity[]> {
|
|
192
|
+
return [];
|
|
193
|
+
}
|
|
194
|
+
}
|