@paraswap/dex-lib 3.8.15 → 3.8.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/abi/{integral/pool.json → inception/inception-ineth-pool.json} +558 -537
- package/build/abi/inception/inception-ineth.json +609 -0
- package/build/abi/inception/inception-ratio-feed.json +93 -0
- package/build/abi/inception/inception-vault.json +991 -0
- package/build/abi/infusion/InfusionFactory.json +147 -0
- package/build/abi/infusion/InfusionPair.json +658 -0
- package/build/abi/infusion/InfusionRouter.json +442 -0
- package/build/dex/aave-v1/aave-v1.d.ts +2 -1
- package/build/dex/aave-v1/aave-v1.js +22 -0
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/angle-transmuter/angle-transmuter.js +1 -1
- package/build/dex/angle-transmuter/angle-transmuter.js.map +1 -1
- package/build/dex/idex.d.ts +11 -7
- package/build/dex/idle-dao/idle-dao-pool.d.ts +56 -0
- package/build/dex/idle-dao/idle-dao-pool.js +176 -0
- package/build/dex/idle-dao/idle-dao-pool.js.map +1 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +16 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.js +57 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +1 -0
- package/build/dex/idle-dao/scripts.d.ts +9 -0
- package/build/dex/idle-dao/scripts.js +552 -0
- package/build/dex/idle-dao/scripts.js.map +1 -0
- package/build/dex/inception/config.d.ts +5 -0
- package/build/dex/inception/config.js +112 -0
- package/build/dex/inception/config.js.map +1 -0
- package/build/dex/inception/inception-event-pool.d.ts +23 -0
- package/build/dex/inception/inception-event-pool.js +34 -0
- package/build/dex/inception/inception-event-pool.js.map +1 -0
- package/build/dex/{integral/integral.d.ts → inception/inception-native.d.ts} +21 -19
- package/build/dex/inception/inception-native.js +131 -0
- package/build/dex/inception/inception-native.js.map +1 -0
- package/build/dex/inception/inception-pool.d.ts +18 -0
- package/build/dex/inception/inception-pool.js +32 -0
- package/build/dex/inception/inception-pool.js.map +1 -0
- package/build/dex/inception/inception-price-feed.d.ts +19 -0
- package/build/dex/inception/inception-price-feed.js +51 -0
- package/build/dex/inception/inception-price-feed.js.map +1 -0
- package/build/dex/inception/inception.d.ts +44 -0
- package/build/dex/inception/inception.js +162 -0
- package/build/dex/inception/inception.js.map +1 -0
- package/build/dex/inception/tokens.d.ts +9 -0
- package/build/dex/inception/tokens.js +28 -0
- package/build/dex/inception/tokens.js.map +1 -0
- package/build/dex/inception/types.d.ts +22 -0
- package/build/dex/inception/types.js +3 -0
- package/build/dex/inception/types.js.map +1 -0
- package/build/dex/inception/utils.d.ts +7 -0
- package/build/dex/inception/utils.js +58 -0
- package/build/dex/inception/utils.js.map +1 -0
- package/build/dex/{integral → infusion}/config.d.ts +1 -1
- package/build/dex/infusion/config.js +25 -0
- package/build/dex/infusion/config.js.map +1 -0
- package/build/dex/infusion/infusion-stable-pool.d.ts +4 -0
- package/build/dex/infusion/infusion-stable-pool.js +74 -0
- package/build/dex/infusion/infusion-stable-pool.js.map +1 -0
- package/build/dex/infusion/infusion.d.ts +54 -0
- package/build/dex/infusion/infusion.js +510 -0
- package/build/dex/infusion/infusion.js.map +1 -0
- package/build/dex/infusion/types.d.ts +47 -0
- package/build/dex/infusion/types.js +3 -0
- package/build/dex/infusion/types.js.map +1 -0
- package/build/dex/infusion/utils/isStablePair.d.ts +2 -0
- package/build/dex/infusion/utils/isStablePair.js +18 -0
- package/build/dex/infusion/utils/isStablePair.js.map +1 -0
- package/build/dex/oswap/oswap.js +1 -4
- package/build/dex/oswap/oswap.js.map +1 -1
- package/build/dex/platypus/platypus.d.ts +2 -1
- package/build/dex/platypus/platypus.js +31 -0
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/swaap-v1/swaap-v1.d.ts +2 -1
- package/build/dex/swaap-v1/swaap-v1.js +10 -0
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/weth/config.js +3 -0
- package/build/dex/weth/config.js.map +1 -1
- package/package.json +1 -1
- package/src/dex/angle-transmuter/angle-transmuter.ts +1 -1
- package/src/dex/idex.ts +48 -41
- package/src/dex/weth/config.ts +3 -0
- package/src/dex/weth/weth-e2e.test.ts +156 -0
- package/.vscode/launch.json +0 -16
- package/.vscode/settings.json +0 -3
- package/build/abi/Uncompressor.json +0 -250
- package/build/abi/integral/factory.json +0 -333
- package/build/abi/integral/oracle.json +0 -501
- package/build/abi/integral/relayer.json +0 -1536
- package/build/abi/maverick-v2/MaverickV2Router.json +0 -778
- package/build/dex/bProtocol.d.ts +0 -18
- package/build/dex/bProtocol.js +0 -39
- package/build/dex/bProtocol.js.map +0 -1
- package/build/dex/bancor.d.ts +0 -26
- package/build/dex/bancor.js +0 -58
- package/build/dex/bancor.js.map +0 -1
- package/build/dex/compound.d.ts +0 -18
- package/build/dex/compound.js +0 -46
- package/build/dex/compound.js.map +0 -1
- package/build/dex/curve-v2.d.ts +0 -58
- package/build/dex/curve-v2.js +0 -180
- package/build/dex/curve-v2.js.map +0 -1
- package/build/dex/dodo-v1.d.ts +0 -33
- package/build/dex/dodo-v1.js +0 -63
- package/build/dex/dodo-v1.js.map +0 -1
- package/build/dex/etherfi/etherfi.d.ts +0 -26
- package/build/dex/etherfi/etherfi.js +0 -96
- package/build/dex/etherfi/etherfi.js.map +0 -1
- package/build/dex/integral/config.js +0 -20
- package/build/dex/integral/config.js.map +0 -1
- package/build/dex/integral/context.d.ts +0 -40
- package/build/dex/integral/context.js +0 -158
- package/build/dex/integral/context.js.map +0 -1
- package/build/dex/integral/helpers.d.ts +0 -17
- package/build/dex/integral/helpers.js +0 -157
- package/build/dex/integral/helpers.js.map +0 -1
- package/build/dex/integral/integral-factory.d.ts +0 -24
- package/build/dex/integral/integral-factory.js +0 -95
- package/build/dex/integral/integral-factory.js.map +0 -1
- package/build/dex/integral/integral-pool.d.ts +0 -50
- package/build/dex/integral/integral-pool.js +0 -149
- package/build/dex/integral/integral-pool.js.map +0 -1
- package/build/dex/integral/integral-pricing.d.ts +0 -18
- package/build/dex/integral/integral-pricing.js +0 -114
- package/build/dex/integral/integral-pricing.js.map +0 -1
- package/build/dex/integral/integral-relayer.d.ts +0 -42
- package/build/dex/integral/integral-relayer.js +0 -192
- package/build/dex/integral/integral-relayer.js.map +0 -1
- package/build/dex/integral/integral-token.d.ts +0 -27
- package/build/dex/integral/integral-token.js +0 -59
- package/build/dex/integral/integral-token.js.map +0 -1
- package/build/dex/integral/integral.js +0 -377
- package/build/dex/integral/integral.js.map +0 -1
- package/build/dex/integral/types.d.ts +0 -84
- package/build/dex/integral/types.js +0 -9
- package/build/dex/integral/types.js.map +0 -1
- package/build/dex/integral/utils-e2e.d.ts +0 -9
- package/build/dex/integral/utils-e2e.js +0 -131
- package/build/dex/integral/utils-e2e.js.map +0 -1
- package/build/dex/integral/utils.d.ts +0 -17
- package/build/dex/integral/utils.js +0 -94
- package/build/dex/integral/utils.js.map +0 -1
- package/build/dex/lido.d.ts +0 -19
- package/build/dex/lido.js +0 -42
- package/build/dex/lido.js.map +0 -1
- package/build/dex/onebit.d.ts +0 -25
- package/build/dex/onebit.js +0 -42
- package/build/dex/onebit.js.map +0 -1
- package/build/dex/sdai/config.d.ts +0 -11
- package/build/dex/sdai/config.js +0 -21
- package/build/dex/sdai/config.js.map +0 -1
- package/build/dex/sdai/constants.d.ts +0 -2
- package/build/dex/sdai/constants.js +0 -6
- package/build/dex/sdai/constants.js.map +0 -1
- package/build/dex/sdai/scripts/validate-state.d.ts +0 -1
- package/build/dex/sdai/scripts/validate-state.js +0 -102
- package/build/dex/sdai/scripts/validate-state.js.map +0 -1
- package/build/dex/sdai/sdai-pool.d.ts +0 -16
- package/build/dex/sdai/sdai-pool.js +0 -85
- package/build/dex/sdai/sdai-pool.js.map +0 -1
- package/build/dex/sdai/sdai.d.ts +0 -51
- package/build/dex/sdai/sdai.js +0 -172
- package/build/dex/sdai/sdai.js.map +0 -1
- package/build/dex/sdai/types.d.ts +0 -21
- package/build/dex/sdai/types.js +0 -11
- package/build/dex/sdai/types.js.map +0 -1
- package/build/dex/sdai/utils.d.ts +0 -4
- package/build/dex/sdai/utils.js +0 -39
- package/build/dex/sdai/utils.js.map +0 -1
- package/build/dex/smoothy.d.ts +0 -26
- package/build/dex/smoothy.js +0 -48
- package/build/dex/smoothy.js.map +0 -1
- package/build/dex/stable-pool.d.ts +0 -28
- package/build/dex/stable-pool.js +0 -62
- package/build/dex/stable-pool.js.map +0 -1
- package/build/dex/trader-joe-v2.1.d.ts +0 -43
- package/build/dex/trader-joe-v2.1.js +0 -79
- package/build/dex/trader-joe-v2.1.js.map +0 -1
- package/build/executor/compressor/Compressor.d.ts +0 -23
- package/build/executor/compressor/Compressor.js +0 -144
- package/build/executor/compressor/Compressor.js.map +0 -1
- package/build/executor/compressor/compress.d.ts +0 -17
- package/build/executor/compressor/compress.js +0 -187
- package/build/executor/compressor/compress.js.map +0 -1
- package/build/executor/compressor/compress_functions/addressSubstitution.d.ts +0 -6
- package/build/executor/compressor/compress_functions/addressSubstitution.js +0 -29
- package/build/executor/compressor/compress_functions/addressSubstitution.js.map +0 -1
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.d.ts +0 -10
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js +0 -40
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js.map +0 -1
- package/build/executor/compressor/compress_functions/byteSubstitution.d.ts +0 -11
- package/build/executor/compressor/compress_functions/byteSubstitution.js +0 -64
- package/build/executor/compressor/compress_functions/byteSubstitution.js.map +0 -1
- package/build/executor/compressor/compress_functions/ffSubstitution.d.ts +0 -7
- package/build/executor/compressor/compress_functions/ffSubstitution.js +0 -54
- package/build/executor/compressor/compress_functions/ffSubstitution.js.map +0 -1
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.d.ts +0 -8
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js +0 -67
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js.map +0 -1
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.d.ts +0 -8
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js +0 -61
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js.map +0 -1
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.d.ts +0 -6
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js +0 -37
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js.map +0 -1
- package/build/executor/compressor/compress_functions/searchUnusedBytes.d.ts +0 -9
- package/build/executor/compressor/compress_functions/searchUnusedBytes.js +0 -33
- package/build/executor/compressor/compress_functions/searchUnusedBytes.js.map +0 -1
- package/build/executor/compressor/fetchSaved.d.ts +0 -0
- package/build/executor/compressor/fetchSaved.js +0 -17
- package/build/executor/compressor/fetchSaved.js.map +0 -1
- package/build/executor/compressor/utils/computeCostL2.d.ts +0 -2
- package/build/executor/compressor/utils/computeCostL2.js +0 -14
- package/build/executor/compressor/utils/computeCostL2.js.map +0 -1
- package/build/executor/compressor/utils/findLongestDuplicatedString.d.ts +0 -2
- package/build/executor/compressor/utils/findLongestDuplicatedString.js +0 -30
- package/build/executor/compressor/utils/findLongestDuplicatedString.js.map +0 -1
- package/build/executor/compressor/utils/getAllIndexes.d.ts +0 -2
- package/build/executor/compressor/utils/getAllIndexes.js +0 -12
- package/build/executor/compressor/utils/getAllIndexes.js.map +0 -1
- package/build/executor/compressor/utils/getByteForAddress.d.ts +0 -2
- package/build/executor/compressor/utils/getByteForAddress.js +0 -14
- package/build/executor/compressor/utils/getByteForAddress.js.map +0 -1
- package/build/executor/compressor/utils/intTo2Bytes.d.ts +0 -2
- package/build/executor/compressor/utils/intTo2Bytes.js +0 -14
- package/build/executor/compressor/utils/intTo2Bytes.js.map +0 -1
- package/build/executor/compressor/utils/intTo3Bytes.d.ts +0 -2
- package/build/executor/compressor/utils/intTo3Bytes.js +0 -18
- package/build/executor/compressor/utils/intTo3Bytes.js.map +0 -1
- package/build/executor/compressor/utils/intToByte.d.ts +0 -2
- package/build/executor/compressor/utils/intToByte.js +0 -10
- package/build/executor/compressor/utils/intToByte.js.map +0 -1
|
@@ -1,95 +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.IntegralFactory = void 0;
|
|
7
|
-
const abi_1 = require("@ethersproject/abi");
|
|
8
|
-
const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
|
|
9
|
-
const factory_json_1 = __importDefault(require("../../abi/integral/factory.json"));
|
|
10
|
-
const pool_json_1 = __importDefault(require("../../abi/integral/pool.json"));
|
|
11
|
-
const decoders_1 = require("../../lib/decoders");
|
|
12
|
-
class IntegralFactory extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
13
|
-
constructor(dexHelper, parentName, factoryAddress, onPoolCreated, logger, mapKey = '') {
|
|
14
|
-
super(parentName, `${parentName} Factory`, dexHelper, logger, true, mapKey);
|
|
15
|
-
this.dexHelper = dexHelper;
|
|
16
|
-
this.factoryAddress = factoryAddress;
|
|
17
|
-
this.onPoolCreated = onPoolCreated;
|
|
18
|
-
this.handlers = {};
|
|
19
|
-
this.factoryIface = new abi_1.Interface(factory_json_1.default);
|
|
20
|
-
this.addressesSubscribed = [factoryAddress];
|
|
21
|
-
this.logDecoder = (log) => this.factoryIface.parseLog(log);
|
|
22
|
-
this.handlers['PairCreated'] = this.handlePairCreated.bind(this);
|
|
23
|
-
}
|
|
24
|
-
getPoolIdentifierData() {
|
|
25
|
-
return { factory: this.factoryAddress };
|
|
26
|
-
}
|
|
27
|
-
async generateState(blockNumber) {
|
|
28
|
-
const factory = new this.dexHelper.web3Provider.eth.Contract(factory_json_1.default, this.factoryAddress);
|
|
29
|
-
const poolCountResult = await factory.methods
|
|
30
|
-
.allPairsLength()
|
|
31
|
-
.call(undefined, blockNumber);
|
|
32
|
-
const poolCount = Number(poolCountResult);
|
|
33
|
-
const poolAddressCallDatas = [
|
|
34
|
-
...Array(poolCount),
|
|
35
|
-
].map((_, i) => {
|
|
36
|
-
return {
|
|
37
|
-
target: this.factoryAddress,
|
|
38
|
-
callData: factory.methods.allPairs(i).encodeABI(),
|
|
39
|
-
decodeFunction: decoders_1.addressDecode,
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
const poolAddresses = await this.dexHelper.multiWrapper.tryAggregate(false, poolAddressCallDatas, blockNumber, this.dexHelper.multiWrapper.defaultBatchSize, false);
|
|
43
|
-
const poolIface = new abi_1.Interface(pool_json_1.default);
|
|
44
|
-
const poolInfosCallDatas = poolAddresses
|
|
45
|
-
.map(poolAddress => {
|
|
46
|
-
return [
|
|
47
|
-
{
|
|
48
|
-
target: poolAddress.returnData,
|
|
49
|
-
callData: poolIface.encodeFunctionData('token0', []),
|
|
50
|
-
decodeFunction: decoders_1.addressDecode,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
target: poolAddress.returnData,
|
|
54
|
-
callData: poolIface.encodeFunctionData('token1', []),
|
|
55
|
-
decodeFunction: decoders_1.addressDecode,
|
|
56
|
-
},
|
|
57
|
-
];
|
|
58
|
-
})
|
|
59
|
-
.flat();
|
|
60
|
-
const poolInfos = await this.dexHelper.multiWrapper.aggregate(poolInfosCallDatas, blockNumber);
|
|
61
|
-
const state = { pools: {} };
|
|
62
|
-
poolAddresses.forEach((poolAddress, i) => {
|
|
63
|
-
const tokens = [
|
|
64
|
-
poolInfos[i * 2].toLowerCase(),
|
|
65
|
-
poolInfos[i * 2 + 1].toLowerCase(),
|
|
66
|
-
];
|
|
67
|
-
state.pools[poolAddress.returnData.toLowerCase()] = {
|
|
68
|
-
token0: tokens[0],
|
|
69
|
-
token1: tokens[1],
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
return state;
|
|
73
|
-
}
|
|
74
|
-
async processLog(state, log, blockHeader) {
|
|
75
|
-
const event = this.logDecoder(log);
|
|
76
|
-
if (event.name in this.handlers) {
|
|
77
|
-
return await this.handlers[event.name](event, state, blockHeader);
|
|
78
|
-
}
|
|
79
|
-
return state;
|
|
80
|
-
}
|
|
81
|
-
async handlePairCreated(event, state, blockHeader) {
|
|
82
|
-
const tokens = [
|
|
83
|
-
event.args.token0.toLowerCase(),
|
|
84
|
-
event.args.token1.toLowerCase(),
|
|
85
|
-
];
|
|
86
|
-
state.pools[event.args.pair.toLowerCase()] = {
|
|
87
|
-
token0: tokens[0],
|
|
88
|
-
token1: tokens[1],
|
|
89
|
-
};
|
|
90
|
-
await this.onPoolCreated(tokens[0], tokens[1], event.args.pair.toLowerCase(), blockHeader.number);
|
|
91
|
-
return state;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
exports.IntegralFactory = IntegralFactory;
|
|
95
|
-
//# sourceMappingURL=integral-factory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"integral-factory.js","sourceRoot":"","sources":["../../../src/dex/integral/integral-factory.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAG/C,+EAA0E;AAG1E,mFAAiE;AACjE,6EAA2D;AAC3D,iDAAmD;AAUnD,MAAa,eAAgB,SAAQ,mDAAqC;IAaxE,YACW,SAAqB,EAC9B,UAAkB,EACC,cAAuB,EACvB,aAAoC,EACvD,MAAc,EACd,SAAiB,EAAE;QAEnB,KAAK,CAAC,UAAU,EAAE,GAAG,UAAU,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAPnE,cAAS,GAAT,SAAS,CAAY;QAEX,mBAAc,GAAd,cAAc,CAAS;QACvB,kBAAa,GAAb,aAAa,CAAuB;QAhBzD,aAAQ,GAMJ,EAAE,CAAC;QAIS,iBAAY,GAAG,IAAI,eAAS,CAAC,sBAAkB,CAAC,CAAC;QAY/D,IAAI,CAAC,mBAAmB,GAAG,CA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AC;QACnC,IAAI,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;YAC/B,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;SACnE;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,KAAqB,EACrB,KAAmB,EACnB,WAAkC;QAElC,MAAM,MAAM,GAAuB;YACjC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE;YAC/B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE;SAChC,CAAC;QACF,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG;YAC3C,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;YACjB,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;SAClB,CAAC;QACF,MAAM,IAAI,CAAC,aAAa,CACtB,MAAM,CAAC,CAAC,CAAC,EACT,MAAM,CAAC,CAAC,CAAC,EACT,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAC7B,WAAW,CAAC,MAAM,CACnB,CAAC;QACF,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAnID,0CAmIC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { LogDescription } from 'ethers/lib/utils';
|
|
3
|
-
import { AsyncOrSync } from 'ts-essentials';
|
|
4
|
-
import { BlockHeader, Log, Logger } from '../../types';
|
|
5
|
-
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
6
|
-
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
7
|
-
import { PoolState } from './types';
|
|
8
|
-
import { Address } from '../../types';
|
|
9
|
-
export declare class IntegralEventPool extends StatefulEventSubscriber<PoolState> {
|
|
10
|
-
parentName: string;
|
|
11
|
-
protected network: number;
|
|
12
|
-
protected dexHelper: IDexHelper;
|
|
13
|
-
protected poolIface: Interface;
|
|
14
|
-
handlers: {
|
|
15
|
-
[event: string]: (event: any, pool: PoolState, blockHeader: Readonly<BlockHeader>) => AsyncOrSync<PoolState>;
|
|
16
|
-
};
|
|
17
|
-
logDecoder: (log: Log) => any;
|
|
18
|
-
addressesSubscribed: string[];
|
|
19
|
-
readonly poolAddress: Address;
|
|
20
|
-
readonly token0: Address;
|
|
21
|
-
readonly token1: Address;
|
|
22
|
-
constructor(parentName: string, network: number, dexHelper: IDexHelper, poolAddress: Address, token0: Address, token1: Address, logger: Logger, poolIface?: Interface);
|
|
23
|
-
protected getPoolIdentifierData(): {
|
|
24
|
-
token0: string;
|
|
25
|
-
token1: string;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* The function is called every time any of the subscribed
|
|
29
|
-
* addresses release log. The function accepts the current
|
|
30
|
-
* state, updates the state according to the log, and returns
|
|
31
|
-
* the updated state.
|
|
32
|
-
* @param state - Current state of event subscriber
|
|
33
|
-
* @param log - Log released by one of the subscribed addresses
|
|
34
|
-
* @returns Updates state of the event subscriber after the log
|
|
35
|
-
*/
|
|
36
|
-
protected processLog(state: PoolState, log: Readonly<Log>, blockHeader: Readonly<BlockHeader>): Promise<PoolState | null>;
|
|
37
|
-
/**
|
|
38
|
-
* The function generates state using on-chain calls. This
|
|
39
|
-
* function is called to regenerate state if the event based
|
|
40
|
-
* system fails to fetch events and the local state is no
|
|
41
|
-
* more correct.
|
|
42
|
-
* @param blockNumber - Blocknumber for which the state should
|
|
43
|
-
* should be generated
|
|
44
|
-
* @returns state of the event subscriber at blocknumber
|
|
45
|
-
*/
|
|
46
|
-
generateState(blockNumber: number): Promise<Readonly<PoolState>>;
|
|
47
|
-
handleSetSwapFee(event: LogDescription, pool: PoolState): PoolState;
|
|
48
|
-
handleSetMintFee(event: LogDescription, pool: PoolState): PoolState;
|
|
49
|
-
handleSetBurnFee(event: LogDescription, pool: PoolState): PoolState;
|
|
50
|
-
}
|
|
@@ -1,149 +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.IntegralEventPool = void 0;
|
|
7
|
-
const abi_1 = require("@ethersproject/abi");
|
|
8
|
-
const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
|
|
9
|
-
const pool_json_1 = __importDefault(require("../../abi/integral/pool.json"));
|
|
10
|
-
const oracle_json_1 = __importDefault(require("../../abi/integral/oracle.json"));
|
|
11
|
-
const UniswapV3Pool_abi_json_1 = __importDefault(require("../../abi/uniswap-v3/UniswapV3Pool.abi.json"));
|
|
12
|
-
const decoders_1 = require("../../lib/decoders");
|
|
13
|
-
const ethers_1 = require("ethers");
|
|
14
|
-
class IntegralEventPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
15
|
-
constructor(parentName, network, dexHelper, poolAddress, token0, token1, logger, poolIface = new abi_1.Interface(pool_json_1.default)) {
|
|
16
|
-
super(parentName, `${token0}_${token1}`, dexHelper, logger);
|
|
17
|
-
this.parentName = parentName;
|
|
18
|
-
this.network = network;
|
|
19
|
-
this.dexHelper = dexHelper;
|
|
20
|
-
this.poolIface = poolIface;
|
|
21
|
-
this.handlers = {};
|
|
22
|
-
this.token0 = token0.toLowerCase();
|
|
23
|
-
this.token1 = token1.toLowerCase();
|
|
24
|
-
this.poolAddress = poolAddress.toLowerCase();
|
|
25
|
-
this.logDecoder = (log) => this.poolIface.parseLog(log);
|
|
26
|
-
this.addressesSubscribed = [this.poolAddress];
|
|
27
|
-
this.handlers['SetSwapFee'] = this.handleSetSwapFee.bind(this);
|
|
28
|
-
this.handlers['SetMintFee'] = this.handleSetMintFee.bind(this);
|
|
29
|
-
this.handlers['SetBurnFee'] = this.handleSetBurnFee.bind(this);
|
|
30
|
-
}
|
|
31
|
-
getPoolIdentifierData() {
|
|
32
|
-
return {
|
|
33
|
-
token0: this.token0,
|
|
34
|
-
token1: this.token1,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* The function is called every time any of the subscribed
|
|
39
|
-
* addresses release log. The function accepts the current
|
|
40
|
-
* state, updates the state according to the log, and returns
|
|
41
|
-
* the updated state.
|
|
42
|
-
* @param state - Current state of event subscriber
|
|
43
|
-
* @param log - Log released by one of the subscribed addresses
|
|
44
|
-
* @returns Updates state of the event subscriber after the log
|
|
45
|
-
*/
|
|
46
|
-
async processLog(state, log, blockHeader) {
|
|
47
|
-
try {
|
|
48
|
-
const event = this.logDecoder(log);
|
|
49
|
-
if (event.name in this.handlers) {
|
|
50
|
-
return await this.handlers[event.name](event, state, blockHeader);
|
|
51
|
-
}
|
|
52
|
-
return state;
|
|
53
|
-
}
|
|
54
|
-
catch (e) {
|
|
55
|
-
this.logger.error(`Error_${this.parentName}_processLog could not parse the log with topic ${log.topics}:`, e);
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* The function generates state using on-chain calls. This
|
|
61
|
-
* function is called to regenerate state if the event based
|
|
62
|
-
* system fails to fetch events and the local state is no
|
|
63
|
-
* more correct.
|
|
64
|
-
* @param blockNumber - Blocknumber for which the state should
|
|
65
|
-
* should be generated
|
|
66
|
-
* @returns state of the event subscriber at blocknumber
|
|
67
|
-
*/
|
|
68
|
-
async generateState(blockNumber) {
|
|
69
|
-
const state = {};
|
|
70
|
-
const pool = new this.dexHelper.web3Provider.eth.Contract(pool_json_1.default, this.poolAddress);
|
|
71
|
-
const poolInfoCallDatas = [
|
|
72
|
-
{
|
|
73
|
-
target: this.poolAddress,
|
|
74
|
-
callData: pool.methods.oracle().encodeABI(),
|
|
75
|
-
decodeFunction: decoders_1.addressDecode,
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
target: this.poolAddress,
|
|
79
|
-
callData: pool.methods.mintFee().encodeABI(),
|
|
80
|
-
decodeFunction: decoders_1.uint256ToBigInt,
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
target: this.poolAddress,
|
|
84
|
-
callData: pool.methods.burnFee().encodeABI(),
|
|
85
|
-
decodeFunction: decoders_1.uint256ToBigInt,
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
target: this.poolAddress,
|
|
89
|
-
callData: pool.methods.swapFee().encodeABI(),
|
|
90
|
-
decodeFunction: decoders_1.uint256ToBigInt,
|
|
91
|
-
},
|
|
92
|
-
];
|
|
93
|
-
const poolInfos = await this.dexHelper.multiWrapper.aggregate(poolInfoCallDatas, blockNumber);
|
|
94
|
-
const oracleAddress = poolInfos[0].toString();
|
|
95
|
-
state.mintFee = BigInt(poolInfos[1]);
|
|
96
|
-
state.burnFee = BigInt(poolInfos[2]);
|
|
97
|
-
state.swapFee = BigInt(poolInfos[3]);
|
|
98
|
-
state.oracle = oracleAddress;
|
|
99
|
-
const historyState = this.getStaleState();
|
|
100
|
-
if (!historyState) {
|
|
101
|
-
const oracle = new this.dexHelper.web3Provider.eth.Contract(oracle_json_1.default, oracleAddress);
|
|
102
|
-
const oracleInfosCallDatas = [
|
|
103
|
-
{
|
|
104
|
-
target: oracleAddress,
|
|
105
|
-
callData: oracle.methods.xDecimals().encodeABI(),
|
|
106
|
-
decodeFunction: decoders_1.uint8ToNumber,
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
target: oracleAddress,
|
|
110
|
-
callData: oracle.methods.yDecimals().encodeABI(),
|
|
111
|
-
decodeFunction: decoders_1.uint8ToNumber,
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
target: oracleAddress,
|
|
115
|
-
callData: oracle.methods.uniswapPair().encodeABI(),
|
|
116
|
-
decodeFunction: decoders_1.addressDecode,
|
|
117
|
-
},
|
|
118
|
-
];
|
|
119
|
-
const oracleInfos = await this.dexHelper.multiWrapper.aggregate(oracleInfosCallDatas, blockNumber);
|
|
120
|
-
state.uniswapPool = oracleInfos[2].toString();
|
|
121
|
-
state.decimals0 = Number(oracleInfos[0]);
|
|
122
|
-
state.decimals1 = Number(oracleInfos[1]);
|
|
123
|
-
const uniswapPool = new this.dexHelper.web3Provider.eth.Contract(UniswapV3Pool_abi_json_1.default, state.uniswapPool);
|
|
124
|
-
const fee = await uniswapPool.methods.fee().call(undefined, blockNumber);
|
|
125
|
-
state.uniswapPoolFee = BigInt(fee);
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
state.uniswapPool = historyState.uniswapPool;
|
|
129
|
-
state.decimals0 = historyState.decimals0;
|
|
130
|
-
state.decimals1 = historyState.decimals1;
|
|
131
|
-
state.uniswapPoolFee = historyState.uniswapPoolFee;
|
|
132
|
-
}
|
|
133
|
-
return state;
|
|
134
|
-
}
|
|
135
|
-
handleSetSwapFee(event, pool) {
|
|
136
|
-
pool.swapFee = BigInt(ethers_1.BigNumber.from(event.args.fee).toString());
|
|
137
|
-
return pool;
|
|
138
|
-
}
|
|
139
|
-
handleSetMintFee(event, pool) {
|
|
140
|
-
pool.mintFee = BigInt(ethers_1.BigNumber.from(event.args.fee).toString());
|
|
141
|
-
return pool;
|
|
142
|
-
}
|
|
143
|
-
handleSetBurnFee(event, pool) {
|
|
144
|
-
pool.burnFee = BigInt(ethers_1.BigNumber.from(event.args.fee).toString());
|
|
145
|
-
return pool;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
exports.IntegralEventPool = IntegralEventPool;
|
|
149
|
-
//# sourceMappingURL=integral-pool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"integral-pool.js","sourceRoot":"","sources":["../../../src/dex/integral/integral-pool.ts"],"names":[],"mappings":";;;;;;AACA,4CAA+C;AAI/C,+EAA0E;AAG1E,6EAA2D;AAC3D,iFAA+D;AAC/D,yGAA2E;AAG3E,iD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ACjE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gBAAgB,CAAC,KAAqB,EAAE,IAAe;QACrD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,kBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gBAAgB,CAAC,KAAqB,EAAE,IAAe;QACrD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,kBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjE,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAvLD,8CAuLC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { IDexHelper } from '../../dex-helper';
|
|
3
|
-
import { Address, Logger } from '../../types';
|
|
4
|
-
import { UniswapV3EventPool } from '../uniswap-v3/uniswap-v3-pool';
|
|
5
|
-
import { Network } from '../../constants';
|
|
6
|
-
import { PoolState } from '../uniswap-v3/types';
|
|
7
|
-
import { Observation } from './types';
|
|
8
|
-
import { MultiResult } from '../../lib/multi-wrapper';
|
|
9
|
-
import { BytesLike } from 'ethers';
|
|
10
|
-
export declare function decodeStateMultiCallResultWithObservation(result: MultiResult<BytesLike> | BytesLike): Observation;
|
|
11
|
-
export declare class IntegralPricing extends UniswapV3EventPool {
|
|
12
|
-
readonly dexHelper: IDexHelper;
|
|
13
|
-
private readonly providedPoolAddress;
|
|
14
|
-
constructor(dexHelper: IDexHelper, parentName: string, erc20Interface: Interface, poolAddress: Address, token0: Address, token1: Address, feeCode: bigint, logger: Logger, network: Network, mapKey?: string);
|
|
15
|
-
get poolAddress(): Address;
|
|
16
|
-
set poolAddress(_address: Address);
|
|
17
|
-
generateState(blockNumber: number): Promise<Readonly<PoolState>>;
|
|
18
|
-
}
|
|
@@ -1,114 +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.IntegralPricing = exports.decodeStateMultiCallResultWithObservation = void 0;
|
|
7
|
-
const uniswap_v3_pool_1 = require("../uniswap-v3/uniswap-v3-pool");
|
|
8
|
-
const config_1 = require("../uniswap-v3/config");
|
|
9
|
-
const UniswapV3StateMulticall_abi_json_1 = __importDefault(require("../../abi/uniswap-v3/UniswapV3StateMulticall.abi.json"));
|
|
10
|
-
const utils_1 = require("../uniswap-v3/contract-math/utils");
|
|
11
|
-
const utils_2 = require("../../utils");
|
|
12
|
-
const TickBitMap_1 = require("../uniswap-v3/contract-math/TickBitMap");
|
|
13
|
-
const ethers_1 = require("ethers");
|
|
14
|
-
const decoders_1 = require("../../lib/decoders");
|
|
15
|
-
function decodeStateMultiCallResultWithObservation(result) {
|
|
16
|
-
const [isSuccess, toDecode] = (0, decoders_1.extractSuccessAndValue)(result);
|
|
17
|
-
if (!isSuccess || toDecode === '0x')
|
|
18
|
-
throw new Error(`decodeStateMultiCallResultWithRelativeBitmaps failed to get decodable result: ${result}`);
|
|
19
|
-
const decoded = ethers_1.ethers.utils.defaultAbiCoder.decode([
|
|
20
|
-
`
|
|
21
|
-
tuple(
|
|
22
|
-
uint32 blockTimestamp,
|
|
23
|
-
int56 tickCumulative,
|
|
24
|
-
uint160 secondsPerLiquidityCumulativeX128,
|
|
25
|
-
bool initialized,
|
|
26
|
-
)
|
|
27
|
-
`,
|
|
28
|
-
], toDecode)[0];
|
|
29
|
-
return decoded;
|
|
30
|
-
}
|
|
31
|
-
exports.decodeStateMultiCallResultWithObservation = decodeStateMultiCallResultWithObservation;
|
|
32
|
-
class IntegralPricing extends uniswap_v3_pool_1.UniswapV3EventPool {
|
|
33
|
-
constructor(dexHelper, parentName, erc20Interface, poolAddress, token0, token1, feeCode, logger, network, mapKey = '') {
|
|
34
|
-
const uniswapConfig = config_1.UniswapV3Config['UniswapV3'][network];
|
|
35
|
-
const stateMultiContract = new dexHelper.web3Provider.eth.Contract(uniswapConfig.stateMultiCallAbi !== undefined
|
|
36
|
-
? uniswapConfig.stateMultiCallAbi
|
|
37
|
-
: UniswapV3StateMulticall_abi_json_1.default, uniswapConfig.stateMulticall);
|
|
38
|
-
super(dexHelper, parentName, stateMultiContract, undefined, erc20Interface, uniswapConfig.factory, feeCode, token0, token1, logger, mapKey, uniswapConfig.initHash);
|
|
39
|
-
this.dexHelper = dexHelper;
|
|
40
|
-
this.providedPoolAddress = poolAddress;
|
|
41
|
-
}
|
|
42
|
-
get poolAddress() {
|
|
43
|
-
return this.providedPoolAddress;
|
|
44
|
-
}
|
|
45
|
-
set poolAddress(_address) { }
|
|
46
|
-
async generateState(blockNumber) {
|
|
47
|
-
const callData = this._getStateRequestCallData();
|
|
48
|
-
const [resBalance0, resBalance1, resState] = await this.dexHelper.multiWrapper.tryAggregate(false, callData, blockNumber, this.dexHelper.multiWrapper.defaultBatchSize, false);
|
|
49
|
-
if (!resState.success)
|
|
50
|
-
throw new Error('Pool does not exist');
|
|
51
|
-
const [balance0, balance1, _state] = [
|
|
52
|
-
resBalance0.returnData,
|
|
53
|
-
resBalance1.returnData,
|
|
54
|
-
resState.returnData,
|
|
55
|
-
];
|
|
56
|
-
const observationsCallData = [
|
|
57
|
-
...Array(_state.slot0.observationCardinality),
|
|
58
|
-
].map((_, i) => {
|
|
59
|
-
return {
|
|
60
|
-
target: this.poolAddress,
|
|
61
|
-
callData: this.poolIface.encodeFunctionData('observations', [i]),
|
|
62
|
-
decodeFunction: decodeStateMultiCallResultWithObservation,
|
|
63
|
-
};
|
|
64
|
-
});
|
|
65
|
-
const resObservations = await this.dexHelper.multiWrapper.tryAggregate(false, observationsCallData, blockNumber, 13107, false);
|
|
66
|
-
const observations = resObservations.reduce((memo, obs, i) => {
|
|
67
|
-
memo[i] = {
|
|
68
|
-
blockTimestamp: BigInt(obs.returnData.blockTimestamp),
|
|
69
|
-
tickCumulative: BigInt(obs.returnData.tickCumulative.toString()),
|
|
70
|
-
secondsPerLiquidityCumulativeX128: BigInt(obs.returnData.secondsPerLiquidityCumulativeX128.toString()),
|
|
71
|
-
initialized: obs.returnData.initialized,
|
|
72
|
-
};
|
|
73
|
-
return memo;
|
|
74
|
-
}, {});
|
|
75
|
-
const tickBitmap = {};
|
|
76
|
-
const ticks = {};
|
|
77
|
-
(0, utils_1._reduceTickBitmap)(tickBitmap, _state.tickBitmap);
|
|
78
|
-
(0, utils_1._reduceTicks)(ticks, _state.ticks);
|
|
79
|
-
const currentTick = (0, utils_2.bigIntify)(_state.slot0.tick);
|
|
80
|
-
const tickSpacing = (0, utils_2.bigIntify)(_state.tickSpacing);
|
|
81
|
-
const startTickBitmap = TickBitMap_1.TickBitMap.position(currentTick / tickSpacing)[0];
|
|
82
|
-
const requestedRange = this.getBitmapRangeToRequest();
|
|
83
|
-
return {
|
|
84
|
-
pool: _state.pool,
|
|
85
|
-
blockTimestamp: (0, utils_2.bigIntify)(_state.blockTimestamp),
|
|
86
|
-
slot0: {
|
|
87
|
-
sqrtPriceX96: (0, utils_2.bigIntify)(_state.slot0.sqrtPriceX96),
|
|
88
|
-
tick: currentTick,
|
|
89
|
-
observationIndex: +_state.slot0.observationIndex,
|
|
90
|
-
observationCardinality: +_state.slot0.observationCardinality,
|
|
91
|
-
observationCardinalityNext: +_state.slot0.observationCardinalityNext,
|
|
92
|
-
feeProtocol: (0, utils_2.bigIntify)(_state.slot0.feeProtocol),
|
|
93
|
-
},
|
|
94
|
-
liquidity: (0, utils_2.bigIntify)(_state.liquidity),
|
|
95
|
-
fee: this.feeCode,
|
|
96
|
-
tickSpacing,
|
|
97
|
-
maxLiquidityPerTick: (0, utils_2.bigIntify)(_state.maxLiquidityPerTick),
|
|
98
|
-
tickBitmap,
|
|
99
|
-
ticks,
|
|
100
|
-
observations,
|
|
101
|
-
isValid: true,
|
|
102
|
-
startTickBitmap,
|
|
103
|
-
lowestKnownTick: (BigInt.asIntN(24, startTickBitmap - requestedRange) << 8n) *
|
|
104
|
-
tickSpacing,
|
|
105
|
-
highestKnownTick: ((BigInt.asIntN(24, startTickBitmap + requestedRange) << 8n) +
|
|
106
|
-
BigInt.asIntN(24, 255n)) *
|
|
107
|
-
tickSpacing,
|
|
108
|
-
balance0,
|
|
109
|
-
balance1,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
exports.IntegralPricing = IntegralPricing;
|
|
114
|
-
//# sourceMappingURL=integral-pricing.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"integral-pricing.js","sourceRoot":"","sources":["../../../src/dex/integral/integral-pricing.ts"],"names":[],"mappings":";;;;;;AAGA,mEAAmE;AACnE,iDAAuD;AACvD,6HAA+F;AAQ/F,6DAG2C;AAC3C,uCAAwC;AACxC,uEAAoE;AAGpE,mCAA2C;AAC3C,iDAA4D;AAE5D,SAAgB,yCAAyC,CACvD,MAA0C;IAE1C,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,IAAA,iCAAsB,EAAC,MAAM,CAAC,CAAC;IAE7D,IAAI,CAAC,SAAS,IAAI,QAAQ,KAAK,IAAI;QACjC,MAAM,IAAI,KAAK,CACb,iFAAiF,MAAM,EAAE,CAC1F,CAAC;IAEJ,MAAM,OAAO,GAAG,eAAM,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CACjD;QACE;;;;;;;KAOD;KACA,EACD,QAAQ,CACT,CAAC,CAAC,CAAC,CAAC;IACL,OAAO,OAAsB,CAAC;AAChC,CAAC;AAxBD,8FAwBC;AAED,MAAa,eAAgB,SAAQ,oCAAkB;IAErD,YACW,SAAqB,EAC9B,UAAkB,EAClB,cAAyB,EACzB,WAAoB,EACpB,MAAe,EACf,MAAe,EACf,OAAe,EACf,MAAc,EACd,O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Ae,GAAG,cAAc,CAAC,IAAI,EAAE,CAAC;gBAC1D,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;gBAC1B,WAAW;YACb,QAAQ;YACR,QAAQ;SACT,CAAC;IACJ,CAAC;CACF;AA3ID,0CA2IC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { ethers } from 'ethers';
|
|
2
|
-
import { Interface } from '@ethersproject/abi';
|
|
3
|
-
import { LogDescription } from 'ethers/lib/utils';
|
|
4
|
-
import { IDexHelper } from '../../dex-helper';
|
|
5
|
-
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
6
|
-
import { Address, BlockHeader, Log, Logger } from '../../types';
|
|
7
|
-
import { PoolInitProps, RelayerPoolState, RelayerState } from './types';
|
|
8
|
-
import { AsyncOrSync, DeepReadonly } from 'ts-essentials';
|
|
9
|
-
export declare type OnPoolEnabledSetCallback = (poolAddress: Address, poolState: RelayerPoolState, blockNumber: number) => Promise<void>;
|
|
10
|
-
export declare class IntegralRelayer extends StatefulEventSubscriber<RelayerState> {
|
|
11
|
-
readonly dexHelper: IDexHelper;
|
|
12
|
-
readonly erc20Interface: Interface;
|
|
13
|
-
readonly relayerAddress: Address;
|
|
14
|
-
protected readonly onPoolEnabledSet: OnPoolEnabledSetCallback;
|
|
15
|
-
handlers: {
|
|
16
|
-
[event: string]: (event: any, state: RelayerState, blockHeader: Readonly<BlockHeader>) => AsyncOrSync<RelayerState>;
|
|
17
|
-
};
|
|
18
|
-
logDecoder: (log: Log) => any;
|
|
19
|
-
private pools;
|
|
20
|
-
private orders;
|
|
21
|
-
readonly relayerIface: ethers.utils.Interface;
|
|
22
|
-
constructor(dexHelper: IDexHelper, parentName: string, erc20Interface: Interface, relayerAddress: Address, initPools: PoolInitProps, onPoolEnabledSet: OnPoolEnabledSetCallback, logger: Logger, mapKey?: string);
|
|
23
|
-
addPools(more: PoolInitProps): void;
|
|
24
|
-
getPools(): {
|
|
25
|
-
[poolAddress: string]: {
|
|
26
|
-
token0: string;
|
|
27
|
-
token1: string;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
protected getPoolIdentifierData(): {
|
|
31
|
-
relayer: string;
|
|
32
|
-
};
|
|
33
|
-
executeOrder(id: bigint, blockNumber: number): void;
|
|
34
|
-
generateState(blockNumber?: number | 'latest'): Promise<RelayerState>;
|
|
35
|
-
protected processLog(state: DeepReadonly<RelayerState>, log: Readonly<Log>, blockHeader: Readonly<BlockHeader>): Promise<RelayerState>;
|
|
36
|
-
handleSwapFeeSet(event: LogDescription, state: RelayerState, _blockHeader: Readonly<BlockHeader>): RelayerState;
|
|
37
|
-
handlePairEnabledSet(event: LogDescription, state: RelayerState, blockHeader: Readonly<BlockHeader>): Promise<RelayerState>;
|
|
38
|
-
handleWrapEth(event: LogDescription, state: RelayerState, _blockHeader: Readonly<BlockHeader>): Promise<RelayerState>;
|
|
39
|
-
handleUnwrapWeth(event: LogDescription, state: RelayerState, blockHeader: Readonly<BlockHeader>): Promise<RelayerState>;
|
|
40
|
-
handleUpgraded(_event: LogDescription, state: RelayerState, blockHeader: Readonly<BlockHeader>): Promise<RelayerState>;
|
|
41
|
-
private initTokens;
|
|
42
|
-
}
|