@paraswap/dex-lib 4.3.5 → 4.3.6
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/algebra-integral/AlgebraFactory.abi.json +947 -0
- package/build/abi/algebra-integral/Quoter.abi.json +231 -0
- package/build/abi/algebra-integral/SwapRouter.abi.json +810 -0
- package/build/abi/ekubo/twamm-data-fetcher.json +216 -0
- package/build/abi/ekubo/twamm.json +720 -0
- package/build/abi/ring-v2/few-wrapped-token.json +587 -0
- package/build/abi/ring-v2/ring-v2-factory.json +125 -0
- package/build/abi/ring-v2/ring-v2-pool.json +461 -0
- package/build/abi/ring-v2/ring-v2-router.json +332 -0
- package/build/abi/uniswap-v2/ring-v2-router.json +332 -0
- package/build/dex/algebra-integral/algebra-integral-factory.d.ts +29 -0
- package/build/dex/algebra-integral/algebra-integral-factory.js +159 -0
- package/build/dex/algebra-integral/algebra-integral-factory.js.map +1 -0
- package/build/dex/algebra-integral/algebra-integral.d.ts +43 -0
- package/build/dex/algebra-integral/algebra-integral.js +425 -0
- package/build/dex/algebra-integral/algebra-integral.js.map +1 -0
- package/build/dex/algebra-integral/config.d.ts +3 -0
- package/build/dex/algebra-integral/config.js +17 -0
- package/build/dex/algebra-integral/config.js.map +1 -0
- package/build/dex/algebra-integral/types.d.ts +35 -0
- package/build/dex/algebra-integral/types.js +10 -0
- package/build/dex/algebra-integral/types.js.map +1 -0
- package/build/dex/balancer-v3/balancer-v3.js +13 -2
- package/build/dex/balancer-v3/balancer-v3.js.map +1 -1
- package/build/dex/balancer-v3/utils.d.ts +10 -0
- package/build/dex/balancer-v3/utils.js +32 -0
- package/build/dex/balancer-v3/utils.js.map +1 -1
- package/build/dex/ekubo/pools/base.d.ts +36 -0
- package/build/dex/ekubo/pools/base.js +289 -0
- package/build/dex/ekubo/pools/base.js.map +1 -0
- package/build/dex/ekubo/pools/full-range.d.ts +23 -0
- package/build/dex/ekubo/pools/full-range.js +99 -0
- package/build/dex/ekubo/pools/full-range.js.map +1 -0
- package/build/dex/ekubo/pools/iface.d.ts +46 -0
- package/build/dex/ekubo/pools/iface.js +75 -0
- package/build/dex/ekubo/pools/iface.js.map +1 -0
- package/build/dex/ekubo/pools/math/twamm/exp2.d.ts +1 -0
- package/build/dex/ekubo/pools/math/twamm/exp2.js +86 -0
- package/build/dex/ekubo/pools/math/twamm/exp2.js.map +1 -0
- package/build/dex/ekubo/pools/math/twamm/sqrt-ratio.d.ts +1 -0
- package/build/dex/ekubo/pools/math/twamm/sqrt-ratio.js +56 -0
- package/build/dex/ekubo/pools/math/twamm/sqrt-ratio.js.map +1 -0
- package/build/dex/ekubo/pools/oracle.d.ts +8 -0
- package/build/dex/ekubo/pools/oracle.js +19 -0
- package/build/dex/ekubo/pools/oracle.js.map +1 -0
- package/build/dex/ekubo/pools/twamm.d.ts +38 -0
- package/build/dex/ekubo/pools/twamm.js +253 -0
- package/build/dex/ekubo/pools/twamm.js.map +1 -0
- package/build/dex/ekubo/pools/utils.d.ts +28 -0
- package/build/dex/ekubo/pools/utils.js +80 -0
- package/build/dex/ekubo/pools/utils.js.map +1 -0
- package/build/dex/miro-migrator/constants.d.ts +1 -1
- package/build/dex/miro-migrator/constants.js +1 -1
- package/build/dex/miro-migrator/miro-migrator-pool.d.ts +5 -5
- package/build/dex/miro-migrator/miro-migrator-pool.js +13 -22
- package/build/dex/miro-migrator/miro-migrator-pool.js.map +1 -1
- package/build/dex/miro-migrator/miro-migrator-state.d.ts +27 -0
- package/build/dex/miro-migrator/miro-migrator-state.js +89 -0
- package/build/dex/miro-migrator/miro-migrator-state.js.map +1 -0
- package/build/dex/miro-migrator/miro-migrator.js +4 -2
- package/build/dex/miro-migrator/miro-migrator.js.map +1 -1
- package/build/dex/uniswap-v2/ring-v2.d.ts +35 -0
- package/build/dex/uniswap-v2/ring-v2.js +223 -0
- package/build/dex/uniswap-v2/ring-v2.js.map +1 -0
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import { Log, Logger } from '../../types';
|
|
|
4
4
|
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
5
5
|
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
6
6
|
import { PoolState } from './types';
|
|
7
|
+
import { Contract } from 'ethers';
|
|
7
8
|
export declare class MiroMigratorEventPool extends StatefulEventSubscriber<PoolState> {
|
|
8
9
|
readonly parentName: string;
|
|
9
10
|
protected network: number;
|
|
@@ -11,17 +12,16 @@ export declare class MiroMigratorEventPool extends StatefulEventSubscriber<PoolS
|
|
|
11
12
|
protected migratorAddress: string;
|
|
12
13
|
protected xyzAddress: string;
|
|
13
14
|
protected transferTopic: string;
|
|
14
|
-
protected migratorInterface: Interface;
|
|
15
15
|
protected xyzInterface: Interface;
|
|
16
|
+
protected xyzContract: Contract;
|
|
16
17
|
handlers: {
|
|
17
18
|
[event: string]: (event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>) => DeepReadonly<PoolState> | null;
|
|
18
19
|
};
|
|
19
20
|
logDecoder: (log: Log) => any;
|
|
20
|
-
|
|
21
|
-
constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, migratorAddress: string, xyzAddress: string, transferTopic: string, migratorInterface?: Interface, xyzInterface?: Interface);
|
|
21
|
+
constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, migratorAddress: string, xyzAddress: string, transferTopic: string, xyzInterface?: Interface, xyzContract?: Contract);
|
|
22
22
|
protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>): Promise<DeepReadonly<PoolState> | null>;
|
|
23
23
|
generateState(blockNumber?: number | 'latest'): Promise<DeepReadonly<PoolState>>;
|
|
24
24
|
getOrGenerateState(blockNumber: number): Promise<PoolState>;
|
|
25
|
-
handleTransferTo(event: any, state: DeepReadonly<PoolState
|
|
26
|
-
handleTransferFrom(event: any, state: DeepReadonly<PoolState
|
|
25
|
+
handleTransferTo(event: any, state: DeepReadonly<PoolState>): Promise<DeepReadonly<PoolState>>;
|
|
26
|
+
handleTransferFrom(event: any, state: DeepReadonly<PoolState>): Promise<DeepReadonly<PoolState>>;
|
|
27
27
|
}
|
|
@@ -7,9 +7,8 @@ exports.MiroMigratorEventPool = void 0;
|
|
|
7
7
|
const abi_1 = require("@ethersproject/abi");
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
|
|
10
|
-
const decoders_1 = require("../../lib/decoders");
|
|
11
|
-
const MiroMigrator_abi_json_1 = __importDefault(require("../../abi/miro-migrator/MiroMigrator.abi.json"));
|
|
12
10
|
const erc20_json_1 = __importDefault(require("../../abi/erc20.json"));
|
|
11
|
+
const ethers_1 = require("ethers");
|
|
13
12
|
class MiroMigratorEventPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
14
13
|
parentName;
|
|
15
14
|
network;
|
|
@@ -17,21 +16,20 @@ class MiroMigratorEventPool extends stateful_event_subscriber_1.StatefulEventSub
|
|
|
17
16
|
migratorAddress;
|
|
18
17
|
xyzAddress;
|
|
19
18
|
transferTopic;
|
|
20
|
-
migratorInterface;
|
|
21
19
|
xyzInterface;
|
|
20
|
+
xyzContract;
|
|
22
21
|
handlers = {};
|
|
23
22
|
logDecoder;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
super(parentName, 'state', dexHelper, logger);
|
|
23
|
+
constructor(parentName, network, dexHelper, logger, migratorAddress, xyzAddress, transferTopic, xyzInterface = new abi_1.Interface(erc20_json_1.default), xyzContract = new ethers_1.Contract(xyzAddress, erc20_json_1.default, dexHelper.provider)) {
|
|
24
|
+
super(parentName, 'xyz', dexHelper, logger);
|
|
27
25
|
this.parentName = parentName;
|
|
28
26
|
this.network = network;
|
|
29
27
|
this.dexHelper = dexHelper;
|
|
30
28
|
this.migratorAddress = migratorAddress;
|
|
31
29
|
this.xyzAddress = xyzAddress;
|
|
32
30
|
this.transferTopic = transferTopic;
|
|
33
|
-
this.migratorInterface = migratorInterface;
|
|
34
31
|
this.xyzInterface = xyzInterface;
|
|
32
|
+
this.xyzContract = xyzContract;
|
|
35
33
|
this.logDecoder = (log) => this.xyzInterface.parseLog(log);
|
|
36
34
|
this.addressesSubscribed = [xyzAddress];
|
|
37
35
|
}
|
|
@@ -40,11 +38,11 @@ class MiroMigratorEventPool extends stateful_event_subscriber_1.StatefulEventSub
|
|
|
40
38
|
const event = this.logDecoder(log);
|
|
41
39
|
if (log.topics[0] === this.transferTopic &&
|
|
42
40
|
event.args.dst.toLowerCase() === this.migratorAddress.toLowerCase()) {
|
|
43
|
-
return this.handleTransferTo(event, state
|
|
41
|
+
return this.handleTransferTo(event, state);
|
|
44
42
|
}
|
|
45
43
|
if (log.topics[0] === this.transferTopic &&
|
|
46
44
|
event.args.src.toLowerCase() === this.migratorAddress.toLowerCase()) {
|
|
47
|
-
return this.handleTransferFrom(event, state
|
|
45
|
+
return this.handleTransferFrom(event, state);
|
|
48
46
|
}
|
|
49
47
|
return null;
|
|
50
48
|
}
|
|
@@ -54,17 +52,10 @@ class MiroMigratorEventPool extends stateful_event_subscriber_1.StatefulEventSub
|
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
async generateState(blockNumber = 'latest') {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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 };
|
|
55
|
+
const balance = await this.xyzContract.balanceOf(this.migratorAddress, {
|
|
56
|
+
blockTag: blockNumber,
|
|
57
|
+
});
|
|
58
|
+
return { balance: balance.toBigInt() };
|
|
68
59
|
}
|
|
69
60
|
async getOrGenerateState(blockNumber) {
|
|
70
61
|
let state = this.getState(blockNumber);
|
|
@@ -74,12 +65,12 @@ class MiroMigratorEventPool extends stateful_event_subscriber_1.StatefulEventSub
|
|
|
74
65
|
}
|
|
75
66
|
return state;
|
|
76
67
|
}
|
|
77
|
-
async handleTransferTo(event, state
|
|
68
|
+
async handleTransferTo(event, state) {
|
|
78
69
|
return {
|
|
79
70
|
balance: state.balance + BigInt(event.args.wad),
|
|
80
71
|
};
|
|
81
72
|
}
|
|
82
|
-
async handleTransferFrom(event, state
|
|
73
|
+
async handleTransferFrom(event, state) {
|
|
83
74
|
return {
|
|
84
75
|
balance: state.balance - BigInt(event.args.wad),
|
|
85
76
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"miro-migrator-pool.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/miro-migrator-pool.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAG/C,uCAAiD;AACjD,+EAA0E;AAG1E,
|
|
1
|
+
{"version":3,"file":"miro-migrator-pool.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/miro-migrator-pool.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAG/C,uCAAiD;AACjD,+EAA0E;AAG1E,sEAA4C;AAC5C,mCAAkC;AAElC,MAAa,qBAAsB,SAAQ,mDAAkC;IAYhE;IACC;IACA;IAEA;IACA;IACA;IACA;IACA;IAnBZ,QAAQ,GAMJ,EAAE,CAAC;IAEP,UAAU,CAAoB;IAE9B,YACW,UAAkB,EACjB,OAAe,EACf,SAAqB,EAC/B,MAAc,EACJ,eAAuB,EACvB,UAAkB,EAClB,aAAqB,EACrB,eAA0B,IAAI,eAAS,CAAC,oBAAQ,CAAC,EACjD,cAAwB,IAAI,iBAAQ,CAC5C,UAAU,EACV,oBAAQ,EACR,SAAS,CAAC,QAAQ,CACnB;QAED,KAAK,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAdnC,eAAU,GAAV,UAAU,CAAQ;QACjB,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAY;QAErB,oBAAe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O,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,EAAE;YACrE,QAAQ,EAAE,WAAW;SACtB,CAAC,CAAC;QAEH,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,WAAmB;QAC1C,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,KAAK,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;YAC9C,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,gBAAgB,CACpB,KAAU,EACV,KAA8B;QAE9B,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;SAChD,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,KAAU,EACV,KAA8B;QAE9B,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;SAChD,CAAC;IACJ,CAAC;CACF;AA/FD,sDA+FC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { DeepReadonly } from 'ts-essentials';
|
|
3
|
+
import { Log, Logger } from '../../types';
|
|
4
|
+
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
5
|
+
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
6
|
+
import { MiroMigratorState } from './types';
|
|
7
|
+
export declare class MiroMigratorEventState extends StatefulEventSubscriber<MiroMigratorState> {
|
|
8
|
+
readonly parentName: string;
|
|
9
|
+
protected network: number;
|
|
10
|
+
protected dexHelper: IDexHelper;
|
|
11
|
+
protected migratorAddress: string;
|
|
12
|
+
protected xyzAddress: string;
|
|
13
|
+
protected transferTopic: string;
|
|
14
|
+
protected migratorInterface: Interface;
|
|
15
|
+
protected xyzInterface: Interface;
|
|
16
|
+
handlers: {
|
|
17
|
+
[event: string]: (event: any, state: DeepReadonly<MiroMigratorState>, log: Readonly<Log>) => DeepReadonly<MiroMigratorState> | null;
|
|
18
|
+
};
|
|
19
|
+
logDecoder: (log: Log) => any;
|
|
20
|
+
addressesSubscribed: string[];
|
|
21
|
+
constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, migratorAddress: string, xyzAddress: string, transferTopic: string, migratorInterface?: Interface, xyzInterface?: Interface);
|
|
22
|
+
protected processLog(state: DeepReadonly<MiroMigratorState>, log: Readonly<Log>): Promise<DeepReadonly<MiroMigratorState> | null>;
|
|
23
|
+
generateState(blockNumber?: number | 'latest'): Promise<DeepReadonly<MiroMigratorState>>;
|
|
24
|
+
getOrGenerateState(blockNumber: number): Promise<MiroMigratorState>;
|
|
25
|
+
handleTransferTo(event: any, state: DeepReadonly<MiroMigratorState>, log: Readonly<Log>): Promise<DeepReadonly<MiroMigratorState>>;
|
|
26
|
+
handleTransferFrom(event: any, state: DeepReadonly<MiroMigratorState>, log: Readonly<Log>): Promise<DeepReadonly<MiroMigratorState>>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
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.MiroMigratorEventState = void 0;
|
|
7
|
+
const abi_1 = require("@ethersproject/abi");
|
|
8
|
+
const utils_1 = require("../../utils");
|
|
9
|
+
const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
|
|
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"));
|
|
13
|
+
class MiroMigratorEventState extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
14
|
+
parentName;
|
|
15
|
+
network;
|
|
16
|
+
dexHelper;
|
|
17
|
+
migratorAddress;
|
|
18
|
+
xyzAddress;
|
|
19
|
+
transferTopic;
|
|
20
|
+
migratorInterface;
|
|
21
|
+
xyzInterface;
|
|
22
|
+
handlers = {};
|
|
23
|
+
logDecoder;
|
|
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);
|
|
27
|
+
this.parentName = parentName;
|
|
28
|
+
this.network = network;
|
|
29
|
+
this.dexHelper = dexHelper;
|
|
30
|
+
this.migratorAddress = migratorAddress;
|
|
31
|
+
this.xyzAddress = xyzAddress;
|
|
32
|
+
this.transferTopic = transferTopic;
|
|
33
|
+
this.migratorInterface = migratorInterface;
|
|
34
|
+
this.xyzInterface = xyzInterface;
|
|
35
|
+
this.logDecoder = (log) => this.migratorInterface.parseLog(log);
|
|
36
|
+
this.addressesSubscribed = [xyzAddress];
|
|
37
|
+
}
|
|
38
|
+
async processLog(state, log) {
|
|
39
|
+
try {
|
|
40
|
+
const event = this.logDecoder(log);
|
|
41
|
+
if (log.topics[0] === this.transferTopic &&
|
|
42
|
+
event.args.to.toLowerCase() === this.migratorAddress.toLowerCase()) {
|
|
43
|
+
return this.handleTransferTo(event, state, log);
|
|
44
|
+
}
|
|
45
|
+
if (log.topics[0] === this.transferTopic &&
|
|
46
|
+
event.args.from.toLowerCase() === this.migratorAddress.toLowerCase()) {
|
|
47
|
+
return this.handleTransferFrom(event, state, log);
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
(0, utils_1.catchParseLogError)(e, this.logger);
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async generateState(blockNumber = 'latest') {
|
|
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 };
|
|
68
|
+
}
|
|
69
|
+
async getOrGenerateState(blockNumber) {
|
|
70
|
+
let state = this.getState(blockNumber);
|
|
71
|
+
if (!state) {
|
|
72
|
+
state = await this.generateState(blockNumber);
|
|
73
|
+
this.setState(state, blockNumber);
|
|
74
|
+
}
|
|
75
|
+
return state;
|
|
76
|
+
}
|
|
77
|
+
async handleTransferTo(event, state, log) {
|
|
78
|
+
return {
|
|
79
|
+
balance: state.balance + BigInt(event.args.value),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
async handleTransferFrom(event, state, log) {
|
|
83
|
+
return {
|
|
84
|
+
balance: state.balance - BigInt(event.args.value),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.MiroMigratorEventState = MiroMigratorEventState;
|
|
89
|
+
//# sourceMappingURL=miro-migrator-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"miro-migrator-state.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/miro-migrator-state.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAG/C,uCAAiD;AACjD,+EAA0E;AA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Q,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,gBAAgB,CACpB,KAAU,EACV,KAAsC,EACtC,GAAkB;QAElB,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;SAClD,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,KAAU,EACV,KAAsC,EACtC,GAAkB;QAElB,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;SAClD,CAAC;IACJ,CAAC;CACF;AA3GD,wDA2GC"}
|
|
@@ -126,7 +126,10 @@ class MiroMigrator extends simple_exchange_1.SimpleExchange {
|
|
|
126
126
|
];
|
|
127
127
|
}
|
|
128
128
|
getCalldataGasCost(poolPrices) {
|
|
129
|
-
return CALLDATA_GAS_COST.
|
|
129
|
+
return (CALLDATA_GAS_COST.FUNCTION_SELECTOR +
|
|
130
|
+
CALLDATA_GAS_COST.AMOUNT +
|
|
131
|
+
CALLDATA_GAS_COST.OFFSET_SMALL +
|
|
132
|
+
CALLDATA_GAS_COST.ZERO);
|
|
130
133
|
}
|
|
131
134
|
getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
132
135
|
return {
|
|
@@ -146,7 +149,6 @@ class MiroMigrator extends simple_exchange_1.SimpleExchange {
|
|
|
146
149
|
dexFuncHasRecipient: false,
|
|
147
150
|
exchangeData: swapData,
|
|
148
151
|
targetExchange: this.migratorAddress,
|
|
149
|
-
returnAmountPos: undefined,
|
|
150
152
|
};
|
|
151
153
|
}
|
|
152
154
|
async getTopPoolsForToken(tokenAddress, limit) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"miro-migrator.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/miro-migrator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"miro-migrator.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/miro-migrator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,2EAA6D;AAC7D,uCAAoD;AAGpD,mCAAkE;AAClE,wDAAoD;AACpD,qCAA8C;AAC9C,6DAAiD;AACjD,4CAA+C;AAC/C,0GAA4E;AAC5E,2CAAsE;AACtE,6DAA6D;AAE7D,MAAa,YACX,SAAQ,gCAAc;IAcX;IACA;IACA;IACA;IAEA;IAEA;IAEC;IACA;IArBH,4BAA4B,GAAG,IAAI,CAAC;IAEpC,wBAAwB,GAAG,KAAK,CAAC;IAEnC,MAAM,CAAC,kBAAkB,GAC9B,IAAA,6BAAqB,EAAC,2BAAkB,CAAC,CAAC;IAC5B,SAAS,CAAwB;IAEjD,MAAM,CAAS;IAEf,YACW,OAAgB,EAChB,MAAc,EACd,SAAqB,EACrB,kBAA0B,2BAAkB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;SACnE,eAAe,EACT,kBAA0B,2BAAkB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;SACnE,eAAe,EACT,kBAA0B,2BAAkB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;SACnE,eAAe,EACR,YAAY,0BAAO,CAAC,EAAE,CAAC,EACvB,oBAAoB,IAAI,eAAS,CAAC,+BAAe,CAAC;QAE5D,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAZhB,YAAO,GAAP,OAAO,CAAS;QAChB,WAAM,GAAN,MAAM,CAAQ;QACd,cAAS,GAAT,SAAS,CAAY;QACrB,oBAAe,GAAf,eAAe,CACN;QACT,oBAAe,GAAf,eAAe,CACN;QACT,oBAAe,GAAf,eAAe,CACN;QACR,cAAS,GAAT,SAAS,CAAc;QACvB,sBAAiB,GAAjB,iBAAi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F;gBACD,YAAY,EAAE,UAAU,EAAE,4DAA4D;aACvF;SACF,CAAC;IACJ,CAAC;;AA3MH,oCA4MC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { Network, SwapSide } from '../../constants';
|
|
3
|
+
import { IDexHelper } from '../../dex-helper';
|
|
4
|
+
import { Token, TransferFeeParams, ExchangePrices, Address, DexExchangeParam, NumberAsString } from '../../types';
|
|
5
|
+
import { UniswapV2Data } from './types';
|
|
6
|
+
import { UniswapV2 } from './uniswap-v2';
|
|
7
|
+
export declare enum RingV2Functions {
|
|
8
|
+
swapExactTokensForTokens = "swapExactTokensForTokens",
|
|
9
|
+
swapExactETHForTokens = "swapExactETHForTokens",
|
|
10
|
+
swapTokensForExactTokens = "swapTokensForExactTokens",
|
|
11
|
+
swapTokensForExactETH = "swapTokensForExactETH",
|
|
12
|
+
swapETHForExactTokens = "swapETHForExactTokens"
|
|
13
|
+
}
|
|
14
|
+
export declare function computeFWTokenAddress(originalAddress: string, dexKey: string, network: Network): string;
|
|
15
|
+
export declare class RingV2 extends UniswapV2 {
|
|
16
|
+
protected network: Network;
|
|
17
|
+
protected dexHelper: IDexHelper;
|
|
18
|
+
protected isDynamicFees: boolean;
|
|
19
|
+
protected factoryAddress: Address;
|
|
20
|
+
protected subgraphURL: string | undefined;
|
|
21
|
+
protected initCode: string;
|
|
22
|
+
protected feeCode: number;
|
|
23
|
+
protected poolGasCost: number;
|
|
24
|
+
protected decoderIface: Interface;
|
|
25
|
+
protected router: string;
|
|
26
|
+
static dexKeysWithNetwork: {
|
|
27
|
+
key: string;
|
|
28
|
+
networks: Network[];
|
|
29
|
+
}[];
|
|
30
|
+
constructor(network: Network, dexKey: string, dexHelper: IDexHelper, isDynamicFees?: boolean, factoryAddress?: Address, subgraphURL?: string | undefined, initCode?: string, feeCode?: number, poolGasCost?: number, decoderIface?: Interface, router?: string);
|
|
31
|
+
getTokenAddresses<T extends string | Token>(_from: T, _to: T): [T, T];
|
|
32
|
+
getPoolIdentifiers(_from: Token, _to: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
|
|
33
|
+
getPricesVolume(_from: Token, _to: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[], transferFees?: TransferFeeParams): Promise<ExchangePrices<UniswapV2Data> | null>;
|
|
34
|
+
getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: UniswapV2Data, side: SwapSide): DexExchangeParam;
|
|
35
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
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.RingV2 = exports.RingV2Functions = void 0;
|
|
7
|
+
exports.computeFWTokenAddress = computeFWTokenAddress;
|
|
8
|
+
const abi_1 = require("@ethersproject/abi");
|
|
9
|
+
const address_1 = require("@ethersproject/address");
|
|
10
|
+
const keccak256_1 = require("@ethersproject/keccak256");
|
|
11
|
+
const constants_1 = require("../../constants");
|
|
12
|
+
const types_1 = require("../../executor/types");
|
|
13
|
+
const token_transfer_fee_1 = require("../../lib/token-transfer-fee");
|
|
14
|
+
const utils_1 = require("../../utils");
|
|
15
|
+
const uniswap_v2_1 = require("./uniswap-v2");
|
|
16
|
+
const uniswap_v2_pool_json_1 = __importDefault(require("../../abi/uniswap-v2/uniswap-v2-pool.json"));
|
|
17
|
+
const uniswap_v2_factory_json_1 = __importDefault(require("../../abi/uniswap-v2/uniswap-v2-factory.json"));
|
|
18
|
+
const ring_v2_router_json_1 = __importDefault(require("../../abi/uniswap-v2/ring-v2-router.json"));
|
|
19
|
+
const utils_2 = require("../../executor/utils");
|
|
20
|
+
var RingV2Functions;
|
|
21
|
+
(function (RingV2Functions) {
|
|
22
|
+
RingV2Functions["swapExactTokensForTokens"] = "swapExactTokensForTokens";
|
|
23
|
+
RingV2Functions["swapExactETHForTokens"] = "swapExactETHForTokens";
|
|
24
|
+
RingV2Functions["swapTokensForExactTokens"] = "swapTokensForExactTokens";
|
|
25
|
+
RingV2Functions["swapTokensForExactETH"] = "swapTokensForExactETH";
|
|
26
|
+
RingV2Functions["swapETHForExactTokens"] = "swapETHForExactTokens";
|
|
27
|
+
})(RingV2Functions || (exports.RingV2Functions = RingV2Functions = {}));
|
|
28
|
+
const RingV2Config = {
|
|
29
|
+
RingV2: {
|
|
30
|
+
[constants_1.Network.MAINNET]: {
|
|
31
|
+
factoryAddress: '0xeb2A625B704d73e82946D8d026E1F588Eed06416',
|
|
32
|
+
initCode: '0xa7ae6a5ec37f0c21bbdac560794258c4089b8ae3ffa6e3909b53c6091764a676',
|
|
33
|
+
poolGasCost: 80 * 1000,
|
|
34
|
+
feeCode: 30,
|
|
35
|
+
router: '0x39d1d8fcC5E6EEAf567Bce4e29B94fec956D3519',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
const FewWrappedTokenConfig = {
|
|
40
|
+
RingV2: {
|
|
41
|
+
[constants_1.Network.MAINNET]: {
|
|
42
|
+
fewWrapFactory: '0x7D86394139bf1122E82FDF45Bb4e3b038A4464DD',
|
|
43
|
+
initCode: '0x2bdba5734ddf754fb149ef1faa937956c52cfd1f24d68163a95f42d08ec06d38',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
function computeFWTokenAddress(originalAddress, dexKey, network) {
|
|
48
|
+
const constructorArgumentsEncoded = abi_1.defaultAbiCoder.encode(['address'], [originalAddress]);
|
|
49
|
+
const create2Inputs = [
|
|
50
|
+
'0xff',
|
|
51
|
+
FewWrappedTokenConfig[dexKey][network].fewWrapFactory, // factory address
|
|
52
|
+
(0, keccak256_1.keccak256)(constructorArgumentsEncoded), // salt
|
|
53
|
+
FewWrappedTokenConfig[dexKey][network].initCode, // init code
|
|
54
|
+
];
|
|
55
|
+
const input = `0x${create2Inputs.map(i => i.slice(2)).join('')}`;
|
|
56
|
+
return (0, address_1.getAddress)(`0x${(0, keccak256_1.keccak256)(input).slice(-40)}`);
|
|
57
|
+
}
|
|
58
|
+
const DefaultRingV2PoolGasCost = 90 * 1000;
|
|
59
|
+
const ringV2poolIface = new abi_1.Interface(uniswap_v2_pool_json_1.default);
|
|
60
|
+
class RingV2 extends uniswap_v2_1.UniswapV2 {
|
|
61
|
+
network;
|
|
62
|
+
dexHelper;
|
|
63
|
+
isDynamicFees;
|
|
64
|
+
factoryAddress;
|
|
65
|
+
subgraphURL;
|
|
66
|
+
initCode;
|
|
67
|
+
feeCode;
|
|
68
|
+
poolGasCost;
|
|
69
|
+
decoderIface;
|
|
70
|
+
router;
|
|
71
|
+
static dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(RingV2Config);
|
|
72
|
+
constructor(network, dexKey, dexHelper, isDynamicFees = false, factoryAddress = RingV2Config[dexKey][network]
|
|
73
|
+
.factoryAddress, subgraphURL = RingV2Config[dexKey] &&
|
|
74
|
+
RingV2Config[dexKey][network].subgraphURL, initCode = RingV2Config[dexKey][network].initCode,
|
|
75
|
+
// feeCode is ignored when isDynamicFees is set to true
|
|
76
|
+
feeCode = RingV2Config[dexKey][network].feeCode, poolGasCost = (RingV2Config[dexKey] &&
|
|
77
|
+
RingV2Config[dexKey][network].poolGasCost) ??
|
|
78
|
+
DefaultRingV2PoolGasCost, decoderIface = ringV2poolIface, router = (RingV2Config[dexKey] &&
|
|
79
|
+
RingV2Config[dexKey][network].router) ??
|
|
80
|
+
dexHelper.config.data.uniswapV2ExchangeRouterAddress) {
|
|
81
|
+
super(network, dexKey, dexHelper, isDynamicFees, factoryAddress, subgraphURL, initCode, feeCode, poolGasCost, decoderIface, undefined, // adapters being the same as UniswapV2
|
|
82
|
+
router);
|
|
83
|
+
this.network = network;
|
|
84
|
+
this.dexHelper = dexHelper;
|
|
85
|
+
this.isDynamicFees = isDynamicFees;
|
|
86
|
+
this.factoryAddress = factoryAddress;
|
|
87
|
+
this.subgraphURL = subgraphURL;
|
|
88
|
+
this.initCode = initCode;
|
|
89
|
+
this.feeCode = feeCode;
|
|
90
|
+
this.poolGasCost = poolGasCost;
|
|
91
|
+
this.decoderIface = decoderIface;
|
|
92
|
+
this.router = router;
|
|
93
|
+
this.factory = new dexHelper.web3Provider.eth.Contract(uniswap_v2_factory_json_1.default, this.factoryAddress);
|
|
94
|
+
this.exchangeRouterInterface = new abi_1.Interface(ring_v2_router_json_1.default);
|
|
95
|
+
}
|
|
96
|
+
getTokenAddresses(_from, _to) {
|
|
97
|
+
const from = typeof _from === 'string'
|
|
98
|
+
? this.dexHelper.config.wrapETH(_from)
|
|
99
|
+
: this.dexHelper.config.wrapETH(_from);
|
|
100
|
+
const to = typeof _to === 'string'
|
|
101
|
+
? this.dexHelper.config.wrapETH(_to)
|
|
102
|
+
: this.dexHelper.config.wrapETH(_to);
|
|
103
|
+
const getFewWrappedToken = (token) => {
|
|
104
|
+
const address = typeof token === 'string' ? token : token.address;
|
|
105
|
+
const fewTokenAddress = computeFWTokenAddress(address, this.dexKey, this.network);
|
|
106
|
+
const newToken = typeof token === 'string'
|
|
107
|
+
? fewTokenAddress
|
|
108
|
+
: {
|
|
109
|
+
...token,
|
|
110
|
+
address: fewTokenAddress,
|
|
111
|
+
...(token.symbol ? { symbol: `fw${token.symbol}` } : {}),
|
|
112
|
+
};
|
|
113
|
+
return newToken;
|
|
114
|
+
};
|
|
115
|
+
return [getFewWrappedToken(from), getFewWrappedToken(to)];
|
|
116
|
+
}
|
|
117
|
+
async getPoolIdentifiers(_from, _to, side, blockNumber) {
|
|
118
|
+
const [from, to] = this.getTokenAddresses(_from, _to);
|
|
119
|
+
if (from.address.toLowerCase() === to.address.toLowerCase()) {
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
return [this.getPoolIdentifier(from.address, to.address)];
|
|
123
|
+
}
|
|
124
|
+
async getPricesVolume(_from, _to, amounts, side, blockNumber,
|
|
125
|
+
// list of pool identifiers to use for pricing, if undefined use all pools
|
|
126
|
+
limitPools, transferFees = {
|
|
127
|
+
srcFee: 0,
|
|
128
|
+
destFee: 0,
|
|
129
|
+
srcDexFee: 0,
|
|
130
|
+
destDexFee: 0,
|
|
131
|
+
}) {
|
|
132
|
+
try {
|
|
133
|
+
const [from, to] = this.getTokenAddresses(_from, _to);
|
|
134
|
+
if (from.address.toLowerCase() === to.address.toLowerCase()) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
const poolIdentifier = this.getPoolIdentifier(from.address, to.address);
|
|
138
|
+
if (limitPools && limitPools.every(p => p !== poolIdentifier)) {
|
|
139
|
+
this.logger.debug('Pool not in limitPools');
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
await this.batchCatchUpPairs([[from, to]], blockNumber);
|
|
143
|
+
const isSell = side === constants_1.SwapSide.SELL;
|
|
144
|
+
const pairParam = await this.getPairOrderedParams(from, to, blockNumber, transferFees.srcDexFee);
|
|
145
|
+
if (!pairParam) {
|
|
146
|
+
this.logger.debug('No pair parameters found');
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
const unitAmount = (0, utils_1.getBigIntPow)(isSell ? from.decimals : to.decimals);
|
|
150
|
+
const [unitVolumeWithFee, ...amountsWithFee] = (0, token_transfer_fee_1.applyTransferFee)([unitAmount, ...amounts], side, isSell ? transferFees.srcFee : transferFees.destFee, isSell ? constants_1.SRC_TOKEN_PARASWAP_TRANSFERS : constants_1.DEST_TOKEN_PARASWAP_TRANSFERS);
|
|
151
|
+
this.logger.debug('Unit Volume With Fee:', unitVolumeWithFee, 'isSell=', isSell);
|
|
152
|
+
const unit = isSell
|
|
153
|
+
? await this.getSellPricePath(unitVolumeWithFee, [pairParam])
|
|
154
|
+
: await this.getBuyPricePath(unitVolumeWithFee, [pairParam]);
|
|
155
|
+
const prices = isSell
|
|
156
|
+
? await Promise.all(amountsWithFee.map(amount => this.getSellPricePath(amount, [pairParam])))
|
|
157
|
+
: await Promise.all(amountsWithFee.map(amount => this.getBuyPricePath(amount, [pairParam])));
|
|
158
|
+
const [unitOutWithFee, ...outputsWithFee] = (0, token_transfer_fee_1.applyTransferFee)([unit, ...prices], side,
|
|
159
|
+
// This part is confusing, because we treat differently SELL and BUY fees
|
|
160
|
+
// If Buy, we should apply transfer fee on srcToken on top of dexFee applied earlier
|
|
161
|
+
// But for Sell we should apply only one dexFee
|
|
162
|
+
isSell ? transferFees.destDexFee : transferFees.srcFee, isSell ? this.DEST_TOKEN_DEX_TRANSFERS : constants_1.SRC_TOKEN_PARASWAP_TRANSFERS);
|
|
163
|
+
// As ringv2 just has one pool per token pair
|
|
164
|
+
return [
|
|
165
|
+
{
|
|
166
|
+
prices: outputsWithFee,
|
|
167
|
+
unit: unitOutWithFee,
|
|
168
|
+
data: {
|
|
169
|
+
router: this.router,
|
|
170
|
+
path: [from.address.toLowerCase(), to.address.toLowerCase()],
|
|
171
|
+
factory: this.factoryAddress,
|
|
172
|
+
initCode: this.initCode,
|
|
173
|
+
feeFactor: this.feeFactor,
|
|
174
|
+
pools: [
|
|
175
|
+
{
|
|
176
|
+
address: pairParam.exchange,
|
|
177
|
+
fee: parseInt(pairParam.fee),
|
|
178
|
+
direction: pairParam.direction,
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
exchange: this.dexKey,
|
|
183
|
+
poolIdentifier,
|
|
184
|
+
gasCost: this.poolGasCost,
|
|
185
|
+
poolAddresses: [pairParam.exchange],
|
|
186
|
+
},
|
|
187
|
+
];
|
|
188
|
+
}
|
|
189
|
+
catch (e) {
|
|
190
|
+
this.logger.debug('Error in getPricesVolume');
|
|
191
|
+
if (blockNumber === 0)
|
|
192
|
+
this.logger.error(`Error_getPricesVolume: Aurelius block manager not yet instantiated`);
|
|
193
|
+
this.logger.error(`Error_getPrices:`, e);
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
|
|
198
|
+
let args;
|
|
199
|
+
let functionName;
|
|
200
|
+
let ttl = 1200;
|
|
201
|
+
const deadline = `0x${(Math.floor(new Date().getTime() / 1000) + ttl).toString(16)}`;
|
|
202
|
+
if (side == constants_1.SwapSide.SELL) {
|
|
203
|
+
functionName = RingV2Functions.swapExactTokensForTokens;
|
|
204
|
+
args = [srcAmount, destAmount, data.path, recipient, deadline];
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
functionName = RingV2Functions.swapTokensForExactTokens;
|
|
208
|
+
args = [destAmount, srcAmount, data.path, recipient, deadline];
|
|
209
|
+
}
|
|
210
|
+
const exchangeData = this.exchangeRouterInterface.encodeFunctionData(functionName, args);
|
|
211
|
+
return {
|
|
212
|
+
needWrapNative: this.needWrapNative,
|
|
213
|
+
specialDexSupportsInsertFromAmount: true,
|
|
214
|
+
dexFuncHasRecipient: true,
|
|
215
|
+
exchangeData,
|
|
216
|
+
targetExchange: data.router,
|
|
217
|
+
specialDexFlag: types_1.SpecialDex.DEFAULT,
|
|
218
|
+
returnAmountPos: (0, utils_2.extractReturnAmountPosition)(this.exchangeRouterInterface, functionName, 'amounts', 1),
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
exports.RingV2 = RingV2;
|
|
223
|
+
//# sourceMappingURL=ring-v2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ring-v2.js","sourceRoot":"","sources":["../../../src/dex/uniswap-v2/ring-v2.ts"],"names":[],"mappings":";;;;;;AA+DA,sDAoBC;AAnFD,4CAAgE;AAChE,oDAAoD;AACpD,wDAAqD;AACrD,+CAKyB;AAEzB,gDAAkD;AAClD,qEAAgE;AAUhE,uCAAkE;AAElE,6CAAyC;AACzC,qGAAqE;AACrE,2GAA+E;AAC/E,mGAA+E;AAC/E,gDAAmE;AAEnE,IAAY,e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