@paraswap/dex-lib 4.6.1 → 4.6.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/build/abi/miro-migrator/MiroMigrator.abi.json +36 -19
- package/build/dex/miro-migrator/config.js +3 -10
- package/build/dex/miro-migrator/config.js.map +1 -1
- package/build/dex/miro-migrator/constants.d.ts +2 -1
- package/build/dex/miro-migrator/constants.js +3 -2
- package/build/dex/miro-migrator/constants.js.map +1 -1
- package/build/dex/miro-migrator/miro-migrator-pool.d.ts +9 -5
- package/build/dex/miro-migrator/miro-migrator-pool.js +49 -30
- package/build/dex/miro-migrator/miro-migrator-pool.js.map +1 -1
- package/build/dex/miro-migrator/miro-migrator.d.ts +5 -4
- package/build/dex/miro-migrator/miro-migrator.js +41 -83
- package/build/dex/miro-migrator/miro-migrator.js.map +1 -1
- package/build/dex/miro-migrator/types.d.ts +2 -4
- package/build/dex/miro-migrator/types.js +1 -2
- package/build/dex/miro-migrator/types.js.map +1 -1
- package/build/dex/uniswap-v3/contract-math/uniswap-v3-math.d.ts +2 -1
- package/build/dex/uniswap-v3/contract-math/uniswap-v3-math.js +4 -3
- package/build/dex/uniswap-v3/contract-math/uniswap-v3-math.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.js +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/package.json +1 -1
- package/build/abi/pangolin-v3/PangolinV3StateMulticall.abi.json +0 -796
- package/build/abi/ring-v2/few-wrapped-token.json +0 -587
- package/build/abi/ring-v2/ring-v2-factory.json +0 -125
- package/build/abi/ring-v2/ring-v2-pool.json +0 -461
- package/build/abi/ring-v2/ring-v2-router.json +0 -332
- package/build/abi/uniswap-v4/hooks/cabalcoin-hook.abi.json +0 -682
- package/build/abi/uniswap-v4/hooks/fee-hook.abi.json +0 -1335
- package/build/dex/miro-migrator/miro-migrator-state.d.ts +0 -27
- package/build/dex/miro-migrator/miro-migrator-state.js +0 -89
- package/build/dex/miro-migrator/miro-migrator-state.js.map +0 -1
- package/build/dex/uniswap-v3/forks/pangolin-v3/utils.d.ts +0 -4
- package/build/dex/uniswap-v3/forks/pangolin-v3/utils.js +0 -56
- package/build/dex/uniswap-v3/forks/pangolin-v3/utils.js.map +0 -1
- package/build/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.d.ts +0 -7
- package/build/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.js +0 -28
- package/build/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.js.map +0 -1
- package/build/dex/uniswap-v4/hooks/cabalcoin-hook/types.d.ts +0 -0
- package/build/dex/uniswap-v4/hooks/cabalcoin-hook/types.js +0 -2
- package/build/dex/uniswap-v4/hooks/cabalcoin-hook/types.js.map +0 -1
- package/build/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.d.ts +0 -7
- package/build/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.js +0 -28
- package/build/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.js.map +0 -1
- package/build/dex/uniswap-v4/hooks/fee-hook/types.d.ts +0 -0
- package/build/dex/uniswap-v4/hooks/fee-hook/types.js +0 -2
- package/build/dex/uniswap-v4/hooks/fee-hook/types.js.map +0 -1
- package/build/dex/uniswap-v4/hooks/index.d.ts +0 -2
- package/build/dex/uniswap-v4/hooks/index.js +0 -8
- package/build/dex/uniswap-v4/hooks/index.js.map +0 -1
- package/build/dex/usdc-transmuter/usdc-transmuter-pool.d.ts +0 -26
- package/build/dex/usdc-transmuter/usdc-transmuter-pool.js +0 -75
- package/build/dex/usdc-transmuter/usdc-transmuter-pool.js.map +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"inputs": [
|
|
4
4
|
{
|
|
5
5
|
"components": [
|
|
6
|
-
{ "internalType": "address", "name": "
|
|
6
|
+
{ "internalType": "address", "name": "xyz", "type": "address" },
|
|
7
7
|
{ "internalType": "address", "name": "weth", "type": "address" },
|
|
8
8
|
{
|
|
9
9
|
"internalType": "address",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
{ "internalType": "address", "name": "sePSP1", "type": "address" },
|
|
24
24
|
{ "internalType": "address", "name": "sePSP2", "type": "address" },
|
|
25
|
-
{ "internalType": "address", "name": "
|
|
25
|
+
{ "internalType": "address", "name": "seXYZ", "type": "address" },
|
|
26
26
|
{
|
|
27
27
|
"internalType": "contract IAcrossSpokePool",
|
|
28
28
|
"name": "spokePool",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
{
|
|
114
114
|
"indexed": true,
|
|
115
115
|
"internalType": "uint256",
|
|
116
|
-
"name": "
|
|
116
|
+
"name": "xyzAmount",
|
|
117
117
|
"type": "uint256"
|
|
118
118
|
},
|
|
119
119
|
{
|
|
@@ -151,6 +151,13 @@
|
|
|
151
151
|
"name": "Unpaused",
|
|
152
152
|
"type": "event"
|
|
153
153
|
},
|
|
154
|
+
{
|
|
155
|
+
"inputs": [],
|
|
156
|
+
"name": "BURN_ADDR",
|
|
157
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
158
|
+
"stateMutability": "view",
|
|
159
|
+
"type": "function"
|
|
160
|
+
},
|
|
154
161
|
{
|
|
155
162
|
"inputs": [],
|
|
156
163
|
"name": "PSP",
|
|
@@ -174,7 +181,7 @@
|
|
|
174
181
|
},
|
|
175
182
|
{
|
|
176
183
|
"inputs": [],
|
|
177
|
-
"name": "
|
|
184
|
+
"name": "SE_XYZ",
|
|
178
185
|
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
179
186
|
"stateMutability": "view",
|
|
180
187
|
"type": "function"
|
|
@@ -194,14 +201,14 @@
|
|
|
194
201
|
},
|
|
195
202
|
{
|
|
196
203
|
"inputs": [],
|
|
197
|
-
"name": "
|
|
204
|
+
"name": "WETH",
|
|
198
205
|
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
199
206
|
"stateMutability": "view",
|
|
200
207
|
"type": "function"
|
|
201
208
|
},
|
|
202
209
|
{
|
|
203
210
|
"inputs": [],
|
|
204
|
-
"name": "
|
|
211
|
+
"name": "XYZ",
|
|
205
212
|
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
206
213
|
"stateMutability": "view",
|
|
207
214
|
"type": "function"
|
|
@@ -212,7 +219,7 @@
|
|
|
212
219
|
],
|
|
213
220
|
"name": "bridgeConfigs",
|
|
214
221
|
"outputs": [
|
|
215
|
-
{ "internalType": "address", "name": "
|
|
222
|
+
{ "internalType": "address", "name": "xyz", "type": "address" },
|
|
216
223
|
{ "internalType": "address", "name": "weth", "type": "address" },
|
|
217
224
|
{ "internalType": "address", "name": "bridgeStaking", "type": "address" },
|
|
218
225
|
{ "internalType": "uint256", "name": "destChainId", "type": "uint256" }
|
|
@@ -222,7 +229,7 @@
|
|
|
222
229
|
},
|
|
223
230
|
{
|
|
224
231
|
"inputs": [
|
|
225
|
-
{ "internalType": "uint256", "name": "
|
|
232
|
+
{ "internalType": "uint256", "name": "xyzAmount", "type": "uint256" },
|
|
226
233
|
{ "internalType": "uint256", "name": "wethAmount", "type": "uint256" },
|
|
227
234
|
{ "internalType": "uint256", "name": "destChainId", "type": "uint256" },
|
|
228
235
|
{
|
|
@@ -260,7 +267,7 @@
|
|
|
260
267
|
}
|
|
261
268
|
],
|
|
262
269
|
"internalType": "struct IMiroMigrator.BridgeData",
|
|
263
|
-
"name": "
|
|
270
|
+
"name": "xyzBridgeData",
|
|
264
271
|
"type": "tuple"
|
|
265
272
|
},
|
|
266
273
|
{
|
|
@@ -297,7 +304,7 @@
|
|
|
297
304
|
},
|
|
298
305
|
{ "internalType": "bytes", "name": "permitData", "type": "bytes" }
|
|
299
306
|
],
|
|
300
|
-
"name": "
|
|
307
|
+
"name": "bridgeXYZAndStake",
|
|
301
308
|
"outputs": [],
|
|
302
309
|
"stateMutability": "payable",
|
|
303
310
|
"type": "function"
|
|
@@ -309,7 +316,7 @@
|
|
|
309
316
|
{ "internalType": "uint256", "name": "minBptOut", "type": "uint256" },
|
|
310
317
|
{ "internalType": "bytes", "name": "permitData", "type": "bytes" }
|
|
311
318
|
],
|
|
312
|
-
"name": "
|
|
319
|
+
"name": "migratePSPtoSeXYZ",
|
|
313
320
|
"outputs": [],
|
|
314
321
|
"stateMutability": "payable",
|
|
315
322
|
"type": "function"
|
|
@@ -319,7 +326,7 @@
|
|
|
319
326
|
{ "internalType": "uint256", "name": "pspAmount", "type": "uint256" },
|
|
320
327
|
{ "internalType": "bytes", "name": "permitData", "type": "bytes" }
|
|
321
328
|
],
|
|
322
|
-
"name": "
|
|
329
|
+
"name": "migratePSPtoXYZ",
|
|
323
330
|
"outputs": [],
|
|
324
331
|
"stateMutability": "nonpayable",
|
|
325
332
|
"type": "function"
|
|
@@ -331,7 +338,7 @@
|
|
|
331
338
|
{ "internalType": "uint256", "name": "minBptOut", "type": "uint256" },
|
|
332
339
|
{ "internalType": "bytes", "name": "permitData", "type": "bytes" }
|
|
333
340
|
],
|
|
334
|
-
"name": "
|
|
341
|
+
"name": "migrateSePSP1toSeXYZ",
|
|
335
342
|
"outputs": [],
|
|
336
343
|
"stateMutability": "payable",
|
|
337
344
|
"type": "function"
|
|
@@ -341,7 +348,7 @@
|
|
|
341
348
|
{ "internalType": "uint256", "name": "sePSP1Amount", "type": "uint256" },
|
|
342
349
|
{ "internalType": "bytes", "name": "permitData", "type": "bytes" }
|
|
343
350
|
],
|
|
344
|
-
"name": "
|
|
351
|
+
"name": "migrateSePSP1toXYZ",
|
|
345
352
|
"outputs": [],
|
|
346
353
|
"stateMutability": "nonpayable",
|
|
347
354
|
"type": "function"
|
|
@@ -354,7 +361,7 @@
|
|
|
354
361
|
{ "internalType": "uint256", "name": "minBptOut", "type": "uint256" },
|
|
355
362
|
{ "internalType": "bytes", "name": "permitData", "type": "bytes" }
|
|
356
363
|
],
|
|
357
|
-
"name": "
|
|
364
|
+
"name": "migrateSePSP2toSeXYZ",
|
|
358
365
|
"outputs": [],
|
|
359
366
|
"stateMutability": "nonpayable",
|
|
360
367
|
"type": "function"
|
|
@@ -400,7 +407,7 @@
|
|
|
400
407
|
}
|
|
401
408
|
],
|
|
402
409
|
"internalType": "struct IMiroMigrator.BridgeData",
|
|
403
|
-
"name": "
|
|
410
|
+
"name": "xyzBridgeData",
|
|
404
411
|
"type": "tuple"
|
|
405
412
|
},
|
|
406
413
|
{
|
|
@@ -437,7 +444,7 @@
|
|
|
437
444
|
},
|
|
438
445
|
{ "internalType": "bytes", "name": "permitData", "type": "bytes" }
|
|
439
446
|
],
|
|
440
|
-
"name": "
|
|
447
|
+
"name": "migrateSePSP2toSeXYZAndBridge",
|
|
441
448
|
"outputs": [],
|
|
442
449
|
"stateMutability": "nonpayable",
|
|
443
450
|
"type": "function"
|
|
@@ -463,9 +470,19 @@
|
|
|
463
470
|
"stateMutability": "view",
|
|
464
471
|
"type": "function"
|
|
465
472
|
},
|
|
473
|
+
{
|
|
474
|
+
"inputs": [
|
|
475
|
+
{ "internalType": "address", "name": "token", "type": "address" },
|
|
476
|
+
{ "internalType": "address", "name": "to", "type": "address" }
|
|
477
|
+
],
|
|
478
|
+
"name": "reClaimERC20",
|
|
479
|
+
"outputs": [],
|
|
480
|
+
"stateMutability": "nonpayable",
|
|
481
|
+
"type": "function"
|
|
482
|
+
},
|
|
466
483
|
{
|
|
467
484
|
"inputs": [{ "internalType": "address", "name": "to", "type": "address" }],
|
|
468
|
-
"name": "
|
|
485
|
+
"name": "reClaimETH",
|
|
469
486
|
"outputs": [],
|
|
470
487
|
"stateMutability": "nonpayable",
|
|
471
488
|
"type": "function"
|
|
@@ -481,7 +498,7 @@
|
|
|
481
498
|
"inputs": [
|
|
482
499
|
{
|
|
483
500
|
"components": [
|
|
484
|
-
{ "internalType": "address", "name": "
|
|
501
|
+
{ "internalType": "address", "name": "xyz", "type": "address" },
|
|
485
502
|
{ "internalType": "address", "name": "weth", "type": "address" },
|
|
486
503
|
{
|
|
487
504
|
"internalType": "address",
|
|
@@ -4,17 +4,10 @@ exports.MiroMigratorConfig = void 0;
|
|
|
4
4
|
const constants_1 = require("../../constants");
|
|
5
5
|
exports.MiroMigratorConfig = {
|
|
6
6
|
MiroMigrator: {
|
|
7
|
-
[constants_1.Network.MAINNET]: {
|
|
8
|
-
migratorAddress: '0x4aBD869acbF927048434d137A3331D006Db54416',
|
|
9
|
-
vlrTokenAddress: '0x4e107a0000DB66f0E9Fd2039288Bf811dD1f9c74',
|
|
10
|
-
pspTokenAddress: '0xcAfE001067cDEF266AfB7Eb5A286dCFD277f3dE5',
|
|
11
|
-
sePsp1TokenAddress: '0x716fBC68E0c761684D9280484243FF094CC5FfAB',
|
|
12
|
-
},
|
|
13
7
|
[constants_1.Network.OPTIMISM]: {
|
|
14
|
-
migratorAddress: '
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
sePsp1TokenAddress: '0x8C934b7dBc782568d14ceaBbEAeDF37cB6348615',
|
|
8
|
+
migratorAddress: '0x5032433fb65d7db8e8b90cb239d50fdfd941fb6b',
|
|
9
|
+
pspTokenAddress: '0x326aec8d7d99d1d6022c57c5f6194d2a7867227d',
|
|
10
|
+
xyzTokenAddress: '0xa2781111f824ca1cd98454b2c9722baefc898e99',
|
|
18
11
|
},
|
|
19
12
|
},
|
|
20
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/config.ts"],"names":[],"mappings":";;;AAEA,+CAA0C;AAE7B,QAAA,kBAAkB,GAA4B;IACzD,YAAY,EAAE;QACZ,CAAC,mBAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/config.ts"],"names":[],"mappings":";;;AAEA,+CAA0C;AAE7B,QAAA,kBAAkB,GAA4B;IACzD,YAAY,EAAE;QACZ,CAAC,mBAAO,CAAC,QAAQ,CAAC,EAAE;YAClB,eAAe,EAAE,4CAA4C;YAC7D,eAAe,EAAE,4CAA4C;YAC7D,eAAe,EAAE,4CAA4C;SAC9D;KACF;CACF,CAAC"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare const MIRO_MIGRATION_GAS_COST =
|
|
1
|
+
export declare const MIRO_MIGRATION_GAS_COST = 95000;
|
|
2
|
+
export declare const TRANSFER_TOPIC = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MIRO_MIGRATION_GAS_COST = void 0;
|
|
4
|
-
exports.MIRO_MIGRATION_GAS_COST =
|
|
3
|
+
exports.TRANSFER_TOPIC = exports.MIRO_MIGRATION_GAS_COST = void 0;
|
|
4
|
+
exports.MIRO_MIGRATION_GAS_COST = 95_000;
|
|
5
|
+
exports.TRANSFER_TOPIC = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef';
|
|
5
6
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG,MAAM,CAAC;AAEjC,QAAA,cAAc,GACzB,oEAAoE,CAAC"}
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
1
2
|
import { DeepReadonly } from 'ts-essentials';
|
|
2
3
|
import { Log, Logger } from '../../types';
|
|
3
4
|
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
4
5
|
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
5
6
|
import { PoolState } from './types';
|
|
6
|
-
import { Contract } from 'ethers';
|
|
7
7
|
export declare class MiroMigratorEventPool extends StatefulEventSubscriber<PoolState> {
|
|
8
8
|
readonly parentName: string;
|
|
9
9
|
protected network: number;
|
|
10
10
|
protected dexHelper: IDexHelper;
|
|
11
11
|
protected migratorAddress: string;
|
|
12
|
-
protected
|
|
13
|
-
protected
|
|
12
|
+
protected xyzAddress: string;
|
|
13
|
+
protected transferTopic: string;
|
|
14
|
+
protected migratorInterface: Interface;
|
|
15
|
+
protected xyzInterface: Interface;
|
|
14
16
|
handlers: {
|
|
15
17
|
[event: string]: (event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>) => DeepReadonly<PoolState> | null;
|
|
16
18
|
};
|
|
17
19
|
logDecoder: (log: Log) => any;
|
|
18
|
-
|
|
20
|
+
addressesSubscribed: string[];
|
|
21
|
+
constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, migratorAddress: string, xyzAddress: string, transferTopic: string, migratorInterface?: Interface, xyzInterface?: Interface);
|
|
19
22
|
protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>): Promise<DeepReadonly<PoolState> | null>;
|
|
20
23
|
generateState(blockNumber?: number | 'latest'): Promise<DeepReadonly<PoolState>>;
|
|
21
24
|
getOrGenerateState(blockNumber: number): Promise<PoolState>;
|
|
22
|
-
|
|
25
|
+
handleTransferTo(event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>): Promise<DeepReadonly<PoolState>>;
|
|
26
|
+
handleTransferFrom(event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>): Promise<DeepReadonly<PoolState>>;
|
|
23
27
|
}
|
|
@@ -1,50 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.MiroMigratorEventPool = void 0;
|
|
7
|
+
const abi_1 = require("@ethersproject/abi");
|
|
4
8
|
const utils_1 = require("../../utils");
|
|
5
9
|
const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
10
|
+
const decoders_1 = require("../../lib/decoders");
|
|
11
|
+
const MiroMigrator_abi_json_1 = __importDefault(require("../../abi/miro-migrator/MiroMigrator.abi.json"));
|
|
12
|
+
const erc20_json_1 = __importDefault(require("../../abi/erc20.json"));
|
|
8
13
|
class MiroMigratorEventPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
9
14
|
parentName;
|
|
10
15
|
network;
|
|
11
16
|
dexHelper;
|
|
12
17
|
migratorAddress;
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
xyzAddress;
|
|
19
|
+
transferTopic;
|
|
20
|
+
migratorInterface;
|
|
21
|
+
xyzInterface;
|
|
15
22
|
handlers = {};
|
|
16
23
|
logDecoder;
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
addressesSubscribed;
|
|
25
|
+
constructor(parentName, network, dexHelper, logger, migratorAddress, xyzAddress, transferTopic, migratorInterface = new abi_1.Interface(MiroMigrator_abi_json_1.default), xyzInterface = new abi_1.Interface(erc20_json_1.default)) {
|
|
26
|
+
super(parentName, 'state', dexHelper, logger);
|
|
19
27
|
this.parentName = parentName;
|
|
20
28
|
this.network = network;
|
|
21
29
|
this.dexHelper = dexHelper;
|
|
22
30
|
this.migratorAddress = migratorAddress;
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
31
|
+
this.xyzAddress = xyzAddress;
|
|
32
|
+
this.transferTopic = transferTopic;
|
|
33
|
+
this.migratorInterface = migratorInterface;
|
|
34
|
+
this.xyzInterface = xyzInterface;
|
|
35
|
+
this.logDecoder = (log) => this.xyzInterface.parseLog(log);
|
|
36
|
+
this.addressesSubscribed = [xyzAddress];
|
|
28
37
|
}
|
|
29
38
|
async processLog(state, log) {
|
|
30
39
|
try {
|
|
31
40
|
const event = this.logDecoder(log);
|
|
32
|
-
if (
|
|
33
|
-
|
|
41
|
+
if (log.topics[0] === this.transferTopic &&
|
|
42
|
+
event.args.dst.toLowerCase() === this.migratorAddress.toLowerCase()) {
|
|
43
|
+
return this.handleTransferTo(event, state, log);
|
|
34
44
|
}
|
|
45
|
+
if (log.topics[0] === this.transferTopic &&
|
|
46
|
+
event.args.src.toLowerCase() === this.migratorAddress.toLowerCase()) {
|
|
47
|
+
return this.handleTransferFrom(event, state, log);
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
35
50
|
}
|
|
36
51
|
catch (e) {
|
|
37
52
|
(0, utils_1.catchParseLogError)(e, this.logger);
|
|
53
|
+
return null;
|
|
38
54
|
}
|
|
39
|
-
return null;
|
|
40
55
|
}
|
|
41
56
|
async generateState(blockNumber = 'latest') {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
const calls = [
|
|
58
|
+
{
|
|
59
|
+
target: this.xyzAddress,
|
|
60
|
+
callData: this.xyzInterface.encodeFunctionData('balanceOf', [
|
|
61
|
+
this.migratorAddress,
|
|
62
|
+
]),
|
|
63
|
+
decodeFunction: decoders_1.uint256ToBigInt,
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
const [balance] = await this.dexHelper.multiWrapper.tryAggregate(true, calls, blockNumber);
|
|
67
|
+
return { balance: balance.returnData };
|
|
48
68
|
}
|
|
49
69
|
async getOrGenerateState(blockNumber) {
|
|
50
70
|
let state = this.getState(blockNumber);
|
|
@@ -54,16 +74,15 @@ class MiroMigratorEventPool extends stateful_event_subscriber_1.StatefulEventSub
|
|
|
54
74
|
}
|
|
55
75
|
return state;
|
|
56
76
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
balance
|
|
65
|
-
}
|
|
66
|
-
return { balance };
|
|
77
|
+
async handleTransferTo(event, state, log) {
|
|
78
|
+
return {
|
|
79
|
+
balance: state.balance + BigInt(event.args.wad),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
async handleTransferFrom(event, state, log) {
|
|
83
|
+
return {
|
|
84
|
+
balance: state.balance - BigInt(event.args.wad),
|
|
85
|
+
};
|
|
67
86
|
}
|
|
68
87
|
}
|
|
69
88
|
exports.MiroMigratorEventPool = MiroMigratorEventPool;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"miro-migrator-pool.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/miro-migrator-pool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"miro-migrator-pool.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/miro-migrator-pool.ts"],"names":[],"mappings":"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"}
|
|
@@ -10,7 +10,9 @@ export declare class MiroMigrator extends SimpleExchange implements IDex<MiroMig
|
|
|
10
10
|
readonly network: Network;
|
|
11
11
|
readonly dexKey: string;
|
|
12
12
|
readonly dexHelper: IDexHelper;
|
|
13
|
-
readonly
|
|
13
|
+
readonly migratorAddress: string;
|
|
14
|
+
readonly pspTokenAddress: string;
|
|
15
|
+
readonly xyzTokenAddress: string;
|
|
14
16
|
protected unitPrice: bigint;
|
|
15
17
|
protected migratorInterface: Interface;
|
|
16
18
|
readonly hasConstantPriceLargeAmounts = true;
|
|
@@ -21,10 +23,9 @@ export declare class MiroMigrator extends SimpleExchange implements IDex<MiroMig
|
|
|
21
23
|
}[];
|
|
22
24
|
readonly eventPool: MiroMigratorEventPool;
|
|
23
25
|
logger: Logger;
|
|
24
|
-
constructor(network: Network, dexKey: string, dexHelper: IDexHelper,
|
|
26
|
+
constructor(network: Network, dexKey: string, dexHelper: IDexHelper, migratorAddress?: string, pspTokenAddress?: string, xyzTokenAddress?: string, unitPrice?: bigint, migratorInterface?: Interface);
|
|
25
27
|
isPSP(tokenAddress: Address): boolean;
|
|
26
|
-
|
|
27
|
-
isVLRToken(tokenAddress: Address): boolean;
|
|
28
|
+
isXYZ(tokenAddress: Address): boolean;
|
|
28
29
|
isAppropriatePair(srcToken: Token, destToken: Token): boolean;
|
|
29
30
|
getAdapters(side: SwapSide): {
|
|
30
31
|
name: string;
|
|
@@ -37,7 +37,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.MiroMigrator = void 0;
|
|
40
|
-
const constants_1 = require("../../constants");
|
|
41
40
|
const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
|
|
42
41
|
const utils_1 = require("../../utils");
|
|
43
42
|
const types_1 = require("./types");
|
|
@@ -46,13 +45,15 @@ const config_1 = require("./config");
|
|
|
46
45
|
const bigint_constants_1 = require("../../bigint-constants");
|
|
47
46
|
const abi_1 = require("@ethersproject/abi");
|
|
48
47
|
const MiroMigrator_abi_json_1 = __importDefault(require("../../abi/miro-migrator/MiroMigrator.abi.json"));
|
|
49
|
-
const
|
|
48
|
+
const constants_1 = require("./constants");
|
|
50
49
|
const miro_migrator_pool_1 = require("./miro-migrator-pool");
|
|
51
50
|
class MiroMigrator extends simple_exchange_1.SimpleExchange {
|
|
52
51
|
network;
|
|
53
52
|
dexKey;
|
|
54
53
|
dexHelper;
|
|
55
|
-
|
|
54
|
+
migratorAddress;
|
|
55
|
+
pspTokenAddress;
|
|
56
|
+
xyzTokenAddress;
|
|
56
57
|
unitPrice;
|
|
57
58
|
migratorInterface;
|
|
58
59
|
hasConstantPriceLargeAmounts = true;
|
|
@@ -60,31 +61,30 @@ class MiroMigrator extends simple_exchange_1.SimpleExchange {
|
|
|
60
61
|
static dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.MiroMigratorConfig);
|
|
61
62
|
eventPool;
|
|
62
63
|
logger;
|
|
63
|
-
constructor(network, dexKey, dexHelper,
|
|
64
|
+
constructor(network, dexKey, dexHelper, migratorAddress = config_1.MiroMigratorConfig[dexKey][network]
|
|
65
|
+
.migratorAddress, pspTokenAddress = config_1.MiroMigratorConfig[dexKey][network]
|
|
66
|
+
.pspTokenAddress, xyzTokenAddress = config_1.MiroMigratorConfig[dexKey][network]
|
|
67
|
+
.xyzTokenAddress, unitPrice = bigint_constants_1.BI_POWS[18], migratorInterface = new abi_1.Interface(MiroMigrator_abi_json_1.default)) {
|
|
64
68
|
super(dexHelper, dexKey);
|
|
65
69
|
this.network = network;
|
|
66
70
|
this.dexKey = dexKey;
|
|
67
71
|
this.dexHelper = dexHelper;
|
|
68
|
-
this.
|
|
72
|
+
this.migratorAddress = migratorAddress;
|
|
73
|
+
this.pspTokenAddress = pspTokenAddress;
|
|
74
|
+
this.xyzTokenAddress = xyzTokenAddress;
|
|
69
75
|
this.unitPrice = unitPrice;
|
|
70
76
|
this.migratorInterface = migratorInterface;
|
|
71
77
|
this.logger = dexHelper.getLogger(dexKey);
|
|
72
|
-
this.eventPool = new miro_migrator_pool_1.MiroMigratorEventPool(this.dexKey, this.network, this.dexHelper, this.logger, this.
|
|
78
|
+
this.eventPool = new miro_migrator_pool_1.MiroMigratorEventPool(this.dexKey, this.network, this.dexHelper, this.logger, this.migratorAddress, this.xyzTokenAddress, constants_1.TRANSFER_TOPIC);
|
|
73
79
|
}
|
|
74
80
|
isPSP(tokenAddress) {
|
|
75
|
-
return
|
|
81
|
+
return this.pspTokenAddress.toLowerCase() === tokenAddress.toLowerCase();
|
|
76
82
|
}
|
|
77
|
-
|
|
78
|
-
return
|
|
79
|
-
tokenAddress.toLowerCase());
|
|
80
|
-
}
|
|
81
|
-
isVLRToken(tokenAddress) {
|
|
82
|
-
return (this.config.vlrTokenAddress.toLowerCase() === tokenAddress.toLowerCase());
|
|
83
|
+
isXYZ(tokenAddress) {
|
|
84
|
+
return this.xyzTokenAddress.toLowerCase() === tokenAddress.toLowerCase();
|
|
83
85
|
}
|
|
84
86
|
isAppropriatePair(srcToken, destToken) {
|
|
85
|
-
return
|
|
86
|
-
(this.isSePSP1Token(srcToken.address) &&
|
|
87
|
-
this.isVLRToken(destToken.address)));
|
|
87
|
+
return this.isPSP(srcToken.address) && this.isXYZ(destToken.address);
|
|
88
88
|
}
|
|
89
89
|
getAdapters(side) {
|
|
90
90
|
return null;
|
|
@@ -118,98 +118,56 @@ class MiroMigrator extends simple_exchange_1.SimpleExchange {
|
|
|
118
118
|
{
|
|
119
119
|
prices,
|
|
120
120
|
unit: this.unitPrice,
|
|
121
|
-
gasCost:
|
|
121
|
+
gasCost: constants_1.MIRO_MIGRATION_GAS_COST,
|
|
122
122
|
exchange: this.dexKey,
|
|
123
|
-
poolAddresses: [this.
|
|
123
|
+
poolAddresses: [this.migratorAddress],
|
|
124
124
|
data: null,
|
|
125
125
|
},
|
|
126
126
|
];
|
|
127
127
|
}
|
|
128
128
|
getCalldataGasCost(poolPrices) {
|
|
129
|
-
return
|
|
130
|
-
CALLDATA_GAS_COST.AMOUNT +
|
|
131
|
-
CALLDATA_GAS_COST.OFFSET_SMALL +
|
|
132
|
-
CALLDATA_GAS_COST.ZERO);
|
|
129
|
+
return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
|
|
133
130
|
}
|
|
134
131
|
getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
135
132
|
return {
|
|
136
|
-
targetExchange: this.
|
|
133
|
+
targetExchange: this.migratorAddress,
|
|
137
134
|
payload: '0x',
|
|
138
135
|
networkFee: '0',
|
|
139
136
|
};
|
|
140
137
|
}
|
|
141
138
|
async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
? types_1.MiroMigratorFunctions.migratePSPtoVLR
|
|
145
|
-
: types_1.MiroMigratorFunctions.migrateSePSP1toVLR;
|
|
146
|
-
const swapData = this.migratorInterface.encodeFunctionData(functionName, [
|
|
147
|
-
srcAmount,
|
|
148
|
-
'0x',
|
|
149
|
-
]);
|
|
150
|
-
return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, this.config.migratorAddress);
|
|
139
|
+
const swapData = this.migratorInterface.encodeFunctionData(types_1.MiroMigratorFunctions.migratePSPtoXYZ, [srcAmount, '0x']);
|
|
140
|
+
return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, this.migratorAddress);
|
|
151
141
|
}
|
|
152
142
|
getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
|
|
153
|
-
const
|
|
154
|
-
const functionName = isPSPtoVLR
|
|
155
|
-
? types_1.MiroMigratorFunctions.migratePSPtoVLR
|
|
156
|
-
: types_1.MiroMigratorFunctions.migrateSePSP1toVLR;
|
|
157
|
-
const swapData = this.migratorInterface.encodeFunctionData(functionName, [
|
|
158
|
-
srcAmount,
|
|
159
|
-
'0x',
|
|
160
|
-
]);
|
|
143
|
+
const swapData = this.migratorInterface.encodeFunctionData(types_1.MiroMigratorFunctions.migratePSPtoXYZ, [srcAmount, '0x']);
|
|
161
144
|
return {
|
|
162
145
|
needWrapNative: this.needWrapNative,
|
|
163
146
|
dexFuncHasRecipient: false,
|
|
164
147
|
exchangeData: swapData,
|
|
165
|
-
targetExchange: this.
|
|
148
|
+
targetExchange: this.migratorAddress,
|
|
149
|
+
returnAmountPos: undefined,
|
|
166
150
|
};
|
|
167
151
|
}
|
|
168
152
|
async getTopPoolsForToken(tokenAddress, limit) {
|
|
169
|
-
|
|
170
|
-
const isSePSP1 = this.isSePSP1Token(tokenAddress);
|
|
171
|
-
const isVLR = this.isVLRToken(tokenAddress);
|
|
172
|
-
if (!isPSP && !isSePSP1 && !isVLR) {
|
|
153
|
+
if (!this.isPSP(tokenAddress) && !this.isXYZ(tokenAddress)) {
|
|
173
154
|
return [];
|
|
174
155
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
if (isVLR) {
|
|
192
|
-
return [
|
|
193
|
-
{
|
|
194
|
-
exchange: this.dexKey,
|
|
195
|
-
address: this.config.migratorAddress,
|
|
196
|
-
connectorTokens: [
|
|
197
|
-
{
|
|
198
|
-
address: this.config.pspTokenAddress,
|
|
199
|
-
decimals: 18,
|
|
200
|
-
liquidityUSD: 1000000000,
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
address: this.config.sePsp1TokenAddress,
|
|
204
|
-
decimals: 18,
|
|
205
|
-
liquidityUSD: 1000000000,
|
|
206
|
-
},
|
|
207
|
-
],
|
|
208
|
-
liquidityUSD: constants_1.NO_USD_LIQUIDITY,
|
|
209
|
-
},
|
|
210
|
-
];
|
|
211
|
-
}
|
|
212
|
-
return [];
|
|
156
|
+
return [
|
|
157
|
+
{
|
|
158
|
+
exchange: this.dexKey,
|
|
159
|
+
address: this.migratorAddress,
|
|
160
|
+
connectorTokens: [
|
|
161
|
+
{
|
|
162
|
+
address: this.isPSP(tokenAddress)
|
|
163
|
+
? this.xyzTokenAddress
|
|
164
|
+
: this.pspTokenAddress,
|
|
165
|
+
decimals: 18,
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
liquidityUSD: 1000000000, // Just returning a big number so this DEX will be preferred
|
|
169
|
+
},
|
|
170
|
+
];
|
|
213
171
|
}
|
|
214
172
|
}
|
|
215
173
|
exports.MiroMigrator = MiroMigrator;
|