@paraswap/dex-lib 4.6.10 → 4.6.12
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/algebra/lib/AlgebraMath.js +13 -3
- package/build/dex/algebra/lib/AlgebraMath.js.map +1 -1
- package/build/dex/algebra/lib/TickManager.js +5 -0
- package/build/dex/algebra/lib/TickManager.js.map +1 -1
- package/build/dex/idle-dao/idle-dao.d.ts +1 -0
- package/build/dex/idle-dao/idle-dao.js +23 -11
- package/build/dex/idle-dao/idle-dao.js.map +1 -1
- package/build/dex/maker-psm/maker-psm.d.ts +4 -41
- package/build/dex/maker-psm/maker-psm.js +41 -144
- package/build/dex/maker-psm/maker-psm.js.map +1 -1
- 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 -28
- 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/pancakeswap-v3/contract-math/Tick.d.ts +1 -1
- package/build/dex/pancakeswap-v3/contract-math/Tick.js +10 -1
- package/build/dex/pancakeswap-v3/contract-math/Tick.js.map +1 -1
- package/build/dex/pancakeswap-v3/contract-math/pancakeswap-v3-math.js +11 -3
- package/build/dex/pancakeswap-v3/contract-math/pancakeswap-v3-math.js.map +1 -1
- package/build/dex/uniswap-v3/contract-math/Tick.d.ts +1 -1
- package/build/dex/uniswap-v3/contract-math/Tick.js +10 -1
- package/build/dex/uniswap-v3/contract-math/Tick.js.map +1 -1
- package/build/dex/uniswap-v3/contract-math/uniswap-v3-math.js +11 -3
- package/build/dex/uniswap-v3/contract-math/uniswap-v3-math.js.map +1 -1
- package/build/dex/uniswap-v3/contract-math/utils.js +3 -0
- package/build/dex/uniswap-v3/contract-math/utils.js.map +1 -1
- package/build/dex/uniswap-v3/types.d.ts +3 -0
- package/build/dex/uniswap-v3/types.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/aave-pt-to-underlying/aave-pt-to-underlying.d.ts +0 -39
- package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying.js +0 -244
- package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying.js.map +0 -1
- package/build/dex/aave-pt-to-underlying/config.d.ts +0 -3
- package/build/dex/aave-pt-to-underlying/config.js +0 -47
- package/build/dex/aave-pt-to-underlying/config.js.map +0 -1
- package/build/dex/aave-pt-to-underlying/constants.d.ts +0 -2
- package/build/dex/aave-pt-to-underlying/constants.js +0 -6
- package/build/dex/aave-pt-to-underlying/constants.js.map +0 -1
- package/build/dex/aave-pt-to-underlying/types.d.ts +0 -22
- package/build/dex/aave-pt-to-underlying/types.js +0 -3
- package/build/dex/aave-pt-to-underlying/types.js.map +0 -1
- package/build/dex/aave-pt-to-usdc/aave-pt-to-usdc.d.ts +0 -39
- package/build/dex/aave-pt-to-usdc/aave-pt-to-usdc.js +0 -244
- package/build/dex/aave-pt-to-usdc/aave-pt-to-usdc.js.map +0 -1
- package/build/dex/aave-pt-to-usdc/config.d.ts +0 -3
- package/build/dex/aave-pt-to-usdc/config.js +0 -47
- package/build/dex/aave-pt-to-usdc/config.js.map +0 -1
- package/build/dex/aave-pt-to-usdc/constants.d.ts +0 -2
- package/build/dex/aave-pt-to-usdc/constants.js +0 -6
- package/build/dex/aave-pt-to-usdc/constants.js.map +0 -1
- package/build/dex/aave-pt-to-usdc/types.d.ts +0 -22
- package/build/dex/aave-pt-to-usdc/types.js +0 -3
- package/build/dex/aave-pt-to-usdc/types.js.map +0 -1
- package/build/dex/ekubo/pools/math/sqrt-ratio.d.ts +0 -8
- package/build/dex/ekubo/pools/math/sqrt-ratio.js +0 -113
- package/build/dex/ekubo/pools/math/sqrt-ratio.js.map +0 -1
- package/build/dex/ekubo/pools/mev-resist.d.ts +0 -7
- package/build/dex/ekubo/pools/mev-resist.js +0 -40
- package/build/dex/ekubo/pools/mev-resist.js.map +0 -1
- package/build/dex/ekubo/pools/pool.d.ts +0 -52
- package/build/dex/ekubo/pools/pool.js +0 -86
- package/build/dex/ekubo/pools/pool.js.map +0 -1
- 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
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EkuboPool = exports.NamedEventHandlers = void 0;
|
|
4
|
-
const stateful_event_subscriber_1 = require("../../../stateful-event-subscriber");
|
|
5
|
-
class NamedEventHandlers {
|
|
6
|
-
iface;
|
|
7
|
-
handlers;
|
|
8
|
-
constructor(iface, handlers) {
|
|
9
|
-
this.iface = iface;
|
|
10
|
-
this.handlers = handlers;
|
|
11
|
-
}
|
|
12
|
-
parseLog(log, oldState, blockHeader) {
|
|
13
|
-
const event = this.iface.parseLog(log);
|
|
14
|
-
return this.handlers[event.name]?.(event.args, oldState, blockHeader);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.NamedEventHandlers = NamedEventHandlers;
|
|
18
|
-
const BASE_GAS_COST = 11_700;
|
|
19
|
-
class EkuboPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
20
|
-
key;
|
|
21
|
-
namedEventHandlers;
|
|
22
|
-
anonymousEventHandlers;
|
|
23
|
-
constructor(parentName, dexHelper, logger, key, namedEventHandlers, anonymousEventHandlers) {
|
|
24
|
-
super(parentName, key.stringId, dexHelper, logger);
|
|
25
|
-
this.key = key;
|
|
26
|
-
this.namedEventHandlers = namedEventHandlers;
|
|
27
|
-
this.anonymousEventHandlers = anonymousEventHandlers;
|
|
28
|
-
this.addressesSubscribed = [
|
|
29
|
-
...new Set(Object.keys(namedEventHandlers).concat(Object.keys(anonymousEventHandlers))),
|
|
30
|
-
];
|
|
31
|
-
}
|
|
32
|
-
async updateState(blockNumber) {
|
|
33
|
-
this.setState(await this.generateState(blockNumber), blockNumber);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* The function is called every time any of the subscribed
|
|
37
|
-
* addresses release log. The function accepts the current
|
|
38
|
-
* state, updates the state according to the log, and returns
|
|
39
|
-
* the updated state.
|
|
40
|
-
* @param state - Current state of event subscriber
|
|
41
|
-
* @param log - Log released by one of the subscribed addresses
|
|
42
|
-
* @returns Updates state of the event subscriber after the log
|
|
43
|
-
*/
|
|
44
|
-
processLog(state, log, blockHeader) {
|
|
45
|
-
const emitter = log.address;
|
|
46
|
-
if (log.topics.length === 0) {
|
|
47
|
-
return this.anonymousEventHandlers[emitter]?.(log.data, state, blockHeader);
|
|
48
|
-
}
|
|
49
|
-
return this.namedEventHandlers[emitter]?.parseLog(log, state, blockHeader);
|
|
50
|
-
}
|
|
51
|
-
quote(amount, token, blockNumber) {
|
|
52
|
-
const isToken1 = token === this.key.token1;
|
|
53
|
-
if (!isToken1 && this.key.token0 !== token) {
|
|
54
|
-
throw new Error('Invalid token');
|
|
55
|
-
}
|
|
56
|
-
if (amount === 0n) {
|
|
57
|
-
return {
|
|
58
|
-
consumedAmount: 0n,
|
|
59
|
-
calculatedAmount: 0n,
|
|
60
|
-
gasConsumed: 0,
|
|
61
|
-
skipAhead: 0,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
const state = this.getState(blockNumber);
|
|
65
|
-
if (state === null) {
|
|
66
|
-
throw new Error(`Quote for block number ${blockNumber} requested but state is not recent enough`);
|
|
67
|
-
}
|
|
68
|
-
const quote = this._quote(amount, isToken1, state);
|
|
69
|
-
if (quote.calculatedAmount === 0n) {
|
|
70
|
-
quote.gasConsumed = 0;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
quote.gasConsumed += BASE_GAS_COST;
|
|
74
|
-
}
|
|
75
|
-
return quote;
|
|
76
|
-
}
|
|
77
|
-
computeTvl() {
|
|
78
|
-
const state = this.getStaleState();
|
|
79
|
-
if (state === null) {
|
|
80
|
-
throw new Error('pool has no state');
|
|
81
|
-
}
|
|
82
|
-
return this._computeTvl(state);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
exports.EkuboPool = EkuboPool;
|
|
86
|
-
//# sourceMappingURL=pool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pool.js","sourceRoot":"","sources":["../../../../src/dex/ekubo/pools/pool.ts"],"names":[],"mappings":";;;AAIA,kFAA6E;AAgC7E,MAAa,kBAAkB;IAEV;IACA;IAFnB,YACmB,KAAgB,EAChB,QAAkD;QADlD,UAAK,GAAL,KAAK,CAAW;QAChB,aAAQ,GAAR,QAAQ,CAA0C;IAClE,CAAC;IAEG,QAAQ,CACb,GAAkB,EAClB,QAA6B,EAC7B,WAAkC;QAElC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IACxE,CAAC;CACF;AAdD,gDAcC;AAED,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B,MAAsB,SACpB,SAAQ,mDAA8B;IAOpB;IACC;IAIA;IATnB,YACE,UAA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,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;QACnC,CAAC;QAED,IAAI,MAAM,KAAK,EAAE,EAAE,CAAC;YAClB,OAAO;gBACL,cAAc,EAAE,EAAE;gBAClB,gBAAgB,EAAE,EAAE;gBACpB,WAAW,EAAE,CAAC;gBACd,SAAS,EAAE,CAAC;aACb,CAAC;QACJ,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACzC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CACb,0BAA0B,WAAW,2CAA2C,CACjF,CAAC;QACJ,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAEnD,IAAI,KAAK,CAAC,gBAAgB,KAAK,EAAE,EAAE,CAAC;YAClC,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,WAAW,IAAI,aAAa,CAAC;QACrC,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IASM,UAAU;QACf,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACnC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;CAGF;AA/GD,8BA+GC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"miro-migrator-state.js","sourceRoot":"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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,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"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { MultiResult } from '../../../../lib/multi-wrapper';
|
|
2
|
-
import { BytesLike } from 'ethers';
|
|
3
|
-
import { DecodedStateMultiCallResultWithRelativeBitmaps } from '../../types';
|
|
4
|
-
export declare function decodeStateMultiCallResultWithRelativeBitmaps(result: MultiResult<BytesLike> | BytesLike): DecodedStateMultiCallResultWithRelativeBitmaps;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decodeStateMultiCallResultWithRelativeBitmaps = decodeStateMultiCallResultWithRelativeBitmaps;
|
|
4
|
-
const ethers_1 = require("ethers");
|
|
5
|
-
const decoders_1 = require("../../../../lib/decoders");
|
|
6
|
-
const ts_essentials_1 = require("ts-essentials");
|
|
7
|
-
function decodeStateMultiCallResultWithRelativeBitmaps(result) {
|
|
8
|
-
const [isSuccess, toDecode] = (0, decoders_1.extractSuccessAndValue)(result);
|
|
9
|
-
(0, ts_essentials_1.assert)(isSuccess && toDecode !== '0x', `decodeStateMultiCallResultWithRelativeBitmaps failed to get decodable result: ${result}`);
|
|
10
|
-
const decoded = ethers_1.ethers.utils.defaultAbiCoder.decode([
|
|
11
|
-
// I don't want to pass here any interface, so I just use it in ethers format
|
|
12
|
-
`
|
|
13
|
-
tuple(
|
|
14
|
-
address pool,
|
|
15
|
-
uint256 blockTimestamp,
|
|
16
|
-
tuple(
|
|
17
|
-
uint160 sqrtPriceX96,
|
|
18
|
-
int24 tick,
|
|
19
|
-
uint16 observationIndex,
|
|
20
|
-
uint16 observationCardinality,
|
|
21
|
-
uint16 observationCardinalityNext,
|
|
22
|
-
uint8 feeProtocol,
|
|
23
|
-
bool unlocked
|
|
24
|
-
) slot0,
|
|
25
|
-
uint128 liquidity,
|
|
26
|
-
int24 tickSpacing,
|
|
27
|
-
uint128 maxLiquidityPerTick,
|
|
28
|
-
tuple(
|
|
29
|
-
uint32 blockTimestamp,
|
|
30
|
-
int56 tickCumulative,
|
|
31
|
-
uint160 secondsPerLiquidityCumulativeX128,
|
|
32
|
-
bool initialized
|
|
33
|
-
) observation,
|
|
34
|
-
tuple(
|
|
35
|
-
int16 index,
|
|
36
|
-
uint256 value
|
|
37
|
-
)[] tickBitmap,
|
|
38
|
-
tuple(
|
|
39
|
-
int24 index,
|
|
40
|
-
tuple(
|
|
41
|
-
uint128 liquidityGross,
|
|
42
|
-
int128 liquidityNet,
|
|
43
|
-
int56 tickCumulativeOutside,
|
|
44
|
-
uint160 secondsPerLiquidityOutsideX128,
|
|
45
|
-
uint32 secondsOutside,
|
|
46
|
-
bool initialized
|
|
47
|
-
) value
|
|
48
|
-
)[] ticks
|
|
49
|
-
)
|
|
50
|
-
`,
|
|
51
|
-
], toDecode)[0];
|
|
52
|
-
// This conversion is not precise, because when we decode, we have more values
|
|
53
|
-
// But I typed only the ones that are used later
|
|
54
|
-
return decoded;
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v3/forks/pangolin-v3/utils.ts"],"names":[],"mappings":";;AAMA,sGA2DC;AAhED,mCAA2C;AAE3C,uDAAkE;AAClE,iDAAuC;AAEvC,SAAgB,6CAA6C,CAC3D,MAA0C;IAE1C,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,IAAA,iCAAsB,EAAC,MAAM,CAAC,CAAC;IAE7D,IAAA,sBAAM,EACJ,SAAS,IAAI,QAAQ,KAAK,IAAI,EAC9B,iFAAiF,MAAM,EAAE,CAC1F,CAAC;IAEF,MAAM,OAAO,GAAG,eAAM,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CACjD;QACE,6EAA6E;QAC7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsCD;KACA,EACD,QAAQ,CACT,CAAC,CAAC,CAAC,CAAC;IAEL,8EAA8E;IAC9E,gDAAgD;IAChD,OAAO,OAAyD,CAAC;AACnE,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { UniswapV4Pool } from '../../uniswap-v4-pool';
|
|
2
|
-
import { PoolState } from '../../types';
|
|
3
|
-
export declare class CabalcoinHookPool extends UniswapV4Pool {
|
|
4
|
-
private hookInterface;
|
|
5
|
-
constructor(...args: ConstructorParameters<typeof UniswapV4Pool>);
|
|
6
|
-
handleCustomFeeChangedEvent(event: any, poolState: PoolState): Promise<PoolState>;
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CabalcoinHookPool = void 0;
|
|
7
|
-
const abi_1 = require("@ethersproject/abi");
|
|
8
|
-
const uniswap_v4_pool_1 = require("../../uniswap-v4-pool");
|
|
9
|
-
const uniswap_v4_pool_math_1 = require("../../contract-math/uniswap-v4-pool-math");
|
|
10
|
-
const cabalcoin_hook_abi_json_1 = __importDefault(require("../../../../abi/uniswap-v4/hooks/cabalcoin-hook.abi.json"));
|
|
11
|
-
class CabalcoinHookPool extends uniswap_v4_pool_1.UniswapV4Pool {
|
|
12
|
-
hookInterface = new abi_1.Interface(cabalcoin_hook_abi_json_1.default);
|
|
13
|
-
constructor(...args) {
|
|
14
|
-
super(...args);
|
|
15
|
-
this.addressesSubscribed.push(this.hooks);
|
|
16
|
-
this.logDecoders.push((log) => this.hookInterface.parseLog(log));
|
|
17
|
-
this.handlers['CustomFeeChanged'] =
|
|
18
|
-
this.handleCustomFeeChangedEvent.bind(this);
|
|
19
|
-
}
|
|
20
|
-
async handleCustomFeeChangedEvent(event, poolState) {
|
|
21
|
-
const id = event.args.id.toLowerCase();
|
|
22
|
-
uniswap_v4_pool_math_1.uniswapV4PoolMath.checkPoolInitialized(poolState);
|
|
23
|
-
poolState.fee = event.args.newFee.toString();
|
|
24
|
-
return poolState;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.CabalcoinHookPool = CabalcoinHookPool;
|
|
28
|
-
//# sourceMappingURL=cabalcoin-hook-pool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cabalcoin-hook-pool.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAC/C,2DAAsD;AAEtD,mFAA6E;AAE7E,uHAAwF;AAExF,MAAa,iBAAkB,SAAQ,+BAAa;IAC1C,aAAa,GAAG,IAAI,eAAS,CAAC,iCAAgB,CAAC,CAAC;IAExD,YAAY,GAAG,IAAiD;QAC9D,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;QAEf,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAEtE,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YAC/B,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,2BAA2B,CAAC,KAAU,EAAE,SAAoB;QAChE,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;QACvC,wCAAiB,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;QAElD,SAAS,CAAC,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAE7C,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AArBD,8CAqBC"}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v4/hooks/cabalcoin-hook/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { UniswapV4Pool } from '../../uniswap-v4-pool';
|
|
2
|
-
import { PoolState } from '../../types';
|
|
3
|
-
export declare class FeeHookPool extends UniswapV4Pool {
|
|
4
|
-
private hookInterface;
|
|
5
|
-
constructor(...args: ConstructorParameters<typeof UniswapV4Pool>);
|
|
6
|
-
handleCustomFeeChangedEvent(event: any, poolState: PoolState): Promise<PoolState>;
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FeeHookPool = void 0;
|
|
7
|
-
const abi_1 = require("@ethersproject/abi");
|
|
8
|
-
const uniswap_v4_pool_1 = require("../../uniswap-v4-pool");
|
|
9
|
-
const uniswap_v4_pool_math_1 = require("../../contract-math/uniswap-v4-pool-math");
|
|
10
|
-
const fee_hook_abi_json_1 = __importDefault(require("../../../../abi/uniswap-v4/hooks/fee-hook.abi.json"));
|
|
11
|
-
class FeeHookPool extends uniswap_v4_pool_1.UniswapV4Pool {
|
|
12
|
-
hookInterface = new abi_1.Interface(fee_hook_abi_json_1.default);
|
|
13
|
-
constructor(...args) {
|
|
14
|
-
super(...args);
|
|
15
|
-
this.addressesSubscribed.push(this.hooks);
|
|
16
|
-
this.logDecoders.push((log) => this.hookInterface.parseLog(log));
|
|
17
|
-
this.handlers['CustomFeeChanged'] =
|
|
18
|
-
this.handleCustomFeeChangedEvent.bind(this);
|
|
19
|
-
}
|
|
20
|
-
async handleCustomFeeChangedEvent(event, poolState) {
|
|
21
|
-
const id = event.args.id.toLowerCase();
|
|
22
|
-
uniswap_v4_pool_math_1.uniswapV4PoolMath.checkPoolInitialized(poolState);
|
|
23
|
-
poolState.fee = event.args.newFee.toString();
|
|
24
|
-
return poolState;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.FeeHookPool = FeeHookPool;
|
|
28
|
-
//# sourceMappingURL=fee-hook-pool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fee-hook-pool.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAC/C,2DAAsD;AAEtD,mFAA6E;AAE7E,2GAA4E;AAE5E,MAAa,WAAY,SAAQ,+BAAa;IACpC,aAAa,GAAG,IAAI,eAAS,CAAC,2BAAU,CAAC,CAAC;IAElD,YAAY,GAAG,IAAiD;QAC9D,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;QAEf,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAEtE,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YAC/B,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,2BAA2B,CAAC,KAAU,EAAE,SAAoB;QAChE,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;QACvC,wCAAiB,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;QAElD,SAAS,CAAC,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAE7C,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AArBD,kCAqBC"}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v4/hooks/fee-hook/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CabalcoinHookPool = exports.FeeHookPool = void 0;
|
|
4
|
-
var fee_hook_pool_1 = require("./fee-hook/fee-hook-pool");
|
|
5
|
-
Object.defineProperty(exports, "FeeHookPool", { enumerable: true, get: function () { return fee_hook_pool_1.FeeHookPool; } });
|
|
6
|
-
var cabalcoin_hook_pool_1 = require("./cabalcoin-hook/cabalcoin-hook-pool");
|
|
7
|
-
Object.defineProperty(exports, "CabalcoinHookPool", { enumerable: true, get: function () { return cabalcoin_hook_pool_1.CabalcoinHookPool; } });
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dex/uniswap-v4/hooks/index.ts"],"names":[],"mappings":";;;AAAA,0DAAuD;AAA9C,4GAAA,WAAW,OAAA;AACpB,4EAAyE;AAAhE,wHAAA,iBAAiB,OAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
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 { PoolState } from './types';
|
|
7
|
-
import { Contract } from 'ethers';
|
|
8
|
-
export declare class UsdcTransmuterEventPool extends StatefulEventSubscriber<PoolState> {
|
|
9
|
-
readonly parentName: string;
|
|
10
|
-
protected network: number;
|
|
11
|
-
protected dexHelper: IDexHelper;
|
|
12
|
-
protected usdcTransmuterAddress: string;
|
|
13
|
-
protected usdcAddress: string;
|
|
14
|
-
protected usdcTransmuterIface: Interface;
|
|
15
|
-
protected usdcContract: Contract;
|
|
16
|
-
handlers: {
|
|
17
|
-
[event: string]: (event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>) => DeepReadonly<PoolState> | null;
|
|
18
|
-
};
|
|
19
|
-
logDecoder: (log: Log) => any;
|
|
20
|
-
constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, usdcTransmuterAddress: string, usdcAddress: string, usdcTransmuterIface?: Interface, usdcContract?: Contract);
|
|
21
|
-
protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>): DeepReadonly<PoolState> | null;
|
|
22
|
-
generateState(blockNumber?: number | 'latest'): Promise<DeepReadonly<PoolState>>;
|
|
23
|
-
getOrGenerateState(blockNumber: number): Promise<PoolState>;
|
|
24
|
-
handleDeposit(event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>): DeepReadonly<PoolState> | null;
|
|
25
|
-
handleWithdrawal(event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>): DeepReadonly<PoolState> | null;
|
|
26
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.UsdcTransmuterEventPool = 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 usdc_transmuter_abi_json_1 = __importDefault(require("../../abi/usdc-transmuter/usdc-transmuter.abi.json"));
|
|
11
|
-
const utils_2 = require("../../lib/tokens/utils");
|
|
12
|
-
const ethers_1 = require("ethers");
|
|
13
|
-
class UsdcTransmuterEventPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
14
|
-
parentName;
|
|
15
|
-
network;
|
|
16
|
-
dexHelper;
|
|
17
|
-
usdcTransmuterAddress;
|
|
18
|
-
usdcAddress;
|
|
19
|
-
usdcTransmuterIface;
|
|
20
|
-
usdcContract;
|
|
21
|
-
handlers = {};
|
|
22
|
-
logDecoder;
|
|
23
|
-
constructor(parentName, network, dexHelper, logger, usdcTransmuterAddress, usdcAddress, usdcTransmuterIface = new abi_1.Interface(usdc_transmuter_abi_json_1.default), usdcContract = new ethers_1.Contract(usdcAddress, utils_2.erc20Iface, dexHelper.provider)) {
|
|
24
|
-
super(parentName, 'usdc', dexHelper, logger);
|
|
25
|
-
this.parentName = parentName;
|
|
26
|
-
this.network = network;
|
|
27
|
-
this.dexHelper = dexHelper;
|
|
28
|
-
this.usdcTransmuterAddress = usdcTransmuterAddress;
|
|
29
|
-
this.usdcAddress = usdcAddress;
|
|
30
|
-
this.usdcTransmuterIface = usdcTransmuterIface;
|
|
31
|
-
this.usdcContract = usdcContract;
|
|
32
|
-
this.logDecoder = (log) => this.usdcTransmuterIface.parseLog(log);
|
|
33
|
-
this.addressesSubscribed = [usdcTransmuterAddress];
|
|
34
|
-
this.handlers['Deposit'] = this.handleDeposit.bind(this);
|
|
35
|
-
this.handlers['Withdraw'] = this.handleWithdrawal.bind(this);
|
|
36
|
-
}
|
|
37
|
-
processLog(state, log) {
|
|
38
|
-
try {
|
|
39
|
-
const event = this.logDecoder(log);
|
|
40
|
-
if (event.name in this.handlers) {
|
|
41
|
-
return this.handlers[event.name](event, state, log);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch (e) {
|
|
45
|
-
(0, utils_1.catchParseLogError)(e, this.logger);
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
async generateState(blockNumber = 'latest') {
|
|
50
|
-
const balance = await this.usdcContract.balanceOf(this.usdcTransmuterAddress, { blockTag: blockNumber });
|
|
51
|
-
return {
|
|
52
|
-
balance: balance.toBigInt(),
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
async getOrGenerateState(blockNumber) {
|
|
56
|
-
let state = this.getState(blockNumber);
|
|
57
|
-
if (!state) {
|
|
58
|
-
state = await this.generateState(blockNumber);
|
|
59
|
-
this.setState(state, blockNumber);
|
|
60
|
-
}
|
|
61
|
-
return state;
|
|
62
|
-
}
|
|
63
|
-
handleDeposit(event, state, log) {
|
|
64
|
-
return {
|
|
65
|
-
balance: state.balance + event.args.amount.toBigInt(),
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
handleWithdrawal(event, state, log) {
|
|
69
|
-
return {
|
|
70
|
-
balance: state.balance - event.args.amount.toBigInt(),
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
exports.UsdcTransmuterEventPool = UsdcTransmuterEventPool;
|
|
75
|
-
//# sourceMappingURL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