@paraswap/dex-lib 4.8.0 → 4.8.1-ekubo-v3.0

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.
@@ -0,0 +1,71 @@
1
+ [
2
+ {
3
+ "inputs": [],
4
+ "name": "vaultsLength",
5
+ "outputs": [
6
+ {
7
+ "internalType": "uint256",
8
+ "name": "",
9
+ "type": "uint256"
10
+ }
11
+ ],
12
+ "stateMutability": "view",
13
+ "type": "function"
14
+ },
15
+ {
16
+ "inputs": [
17
+ {
18
+ "internalType": "uint256[]",
19
+ "name": "_indexes",
20
+ "type": "uint256[]"
21
+ }
22
+ ],
23
+ "name": "getBatchVaultAddresses",
24
+ "outputs": [
25
+ {
26
+ "internalType": "address[]",
27
+ "name": "",
28
+ "type": "address[]"
29
+ }
30
+ ],
31
+ "stateMutability": "view",
32
+ "type": "function"
33
+ },
34
+ {
35
+ "anonymous": false,
36
+ "inputs": [
37
+ {
38
+ "indexed": true,
39
+ "internalType": "uint256",
40
+ "name": "index",
41
+ "type": "uint256"
42
+ },
43
+ {
44
+ "indexed": true,
45
+ "internalType": "address",
46
+ "name": "implementation",
47
+ "type": "address"
48
+ },
49
+ {
50
+ "indexed": false,
51
+ "internalType": "address",
52
+ "name": "vault",
53
+ "type": "address"
54
+ },
55
+ {
56
+ "indexed": false,
57
+ "internalType": "string",
58
+ "name": "name",
59
+ "type": "string"
60
+ },
61
+ {
62
+ "indexed": false,
63
+ "internalType": "string",
64
+ "name": "symbol",
65
+ "type": "string"
66
+ }
67
+ ],
68
+ "name": "NewClearVault",
69
+ "type": "event"
70
+ }
71
+ ]
@@ -0,0 +1,334 @@
1
+ [
2
+ {
3
+ "inputs": [],
4
+ "stateMutability": "nonpayable",
5
+ "type": "constructor"
6
+ },
7
+ {
8
+ "inputs": [
9
+ {
10
+ "internalType": "address",
11
+ "name": "authority",
12
+ "type": "address"
13
+ }
14
+ ],
15
+ "name": "AccessManagedInvalidAuthority",
16
+ "type": "error"
17
+ },
18
+ {
19
+ "inputs": [
20
+ {
21
+ "internalType": "address",
22
+ "name": "caller",
23
+ "type": "address"
24
+ },
25
+ {
26
+ "internalType": "uint32",
27
+ "name": "delay",
28
+ "type": "uint32"
29
+ }
30
+ ],
31
+ "name": "AccessManagedRequiredDelay",
32
+ "type": "error"
33
+ },
34
+ {
35
+ "inputs": [
36
+ {
37
+ "internalType": "address",
38
+ "name": "caller",
39
+ "type": "address"
40
+ }
41
+ ],
42
+ "name": "AccessManagedUnauthorized",
43
+ "type": "error"
44
+ },
45
+ {
46
+ "inputs": [],
47
+ "name": "AssetIsNotDepeg",
48
+ "type": "error"
49
+ },
50
+ {
51
+ "inputs": [],
52
+ "name": "EnforcedPause",
53
+ "type": "error"
54
+ },
55
+ {
56
+ "inputs": [],
57
+ "name": "ExpectedPause",
58
+ "type": "error"
59
+ },
60
+ {
61
+ "inputs": [],
62
+ "name": "InsufficientAmountOut",
63
+ "type": "error"
64
+ },
65
+ {
66
+ "inputs": [],
67
+ "name": "InvalidInitialization",
68
+ "type": "error"
69
+ },
70
+ {
71
+ "inputs": [],
72
+ "name": "NotInitializing",
73
+ "type": "error"
74
+ },
75
+ {
76
+ "inputs": [],
77
+ "name": "RedemptionNotOpened",
78
+ "type": "error"
79
+ },
80
+ {
81
+ "inputs": [
82
+ {
83
+ "internalType": "address",
84
+ "name": "token",
85
+ "type": "address"
86
+ }
87
+ ],
88
+ "name": "SafeERC20FailedOperation",
89
+ "type": "error"
90
+ },
91
+ {
92
+ "anonymous": false,
93
+ "inputs": [
94
+ {
95
+ "indexed": false,
96
+ "internalType": "address",
97
+ "name": "authority",
98
+ "type": "address"
99
+ }
100
+ ],
101
+ "name": "AuthorityUpdated",
102
+ "type": "event"
103
+ },
104
+ {
105
+ "anonymous": false,
106
+ "inputs": [
107
+ {
108
+ "indexed": false,
109
+ "internalType": "uint64",
110
+ "name": "version",
111
+ "type": "uint64"
112
+ }
113
+ ],
114
+ "name": "Initialized",
115
+ "type": "event"
116
+ },
117
+ {
118
+ "anonymous": false,
119
+ "inputs": [
120
+ {
121
+ "indexed": false,
122
+ "internalType": "address",
123
+ "name": "account",
124
+ "type": "address"
125
+ }
126
+ ],
127
+ "name": "Paused",
128
+ "type": "event"
129
+ },
130
+ {
131
+ "anonymous": false,
132
+ "inputs": [
133
+ {
134
+ "indexed": false,
135
+ "internalType": "address",
136
+ "name": "account",
137
+ "type": "address"
138
+ }
139
+ ],
140
+ "name": "Unpaused",
141
+ "type": "event"
142
+ },
143
+ {
144
+ "inputs": [],
145
+ "name": "authority",
146
+ "outputs": [
147
+ {
148
+ "internalType": "address",
149
+ "name": "",
150
+ "type": "address"
151
+ }
152
+ ],
153
+ "stateMutability": "view",
154
+ "type": "function"
155
+ },
156
+ {
157
+ "inputs": [
158
+ {
159
+ "internalType": "address",
160
+ "name": "_initialAuthority",
161
+ "type": "address"
162
+ },
163
+ {
164
+ "internalType": "address",
165
+ "name": "_oracle",
166
+ "type": "address"
167
+ }
168
+ ],
169
+ "name": "initialize",
170
+ "outputs": [],
171
+ "stateMutability": "nonpayable",
172
+ "type": "function"
173
+ },
174
+ {
175
+ "inputs": [],
176
+ "name": "isConsumingScheduledOp",
177
+ "outputs": [
178
+ {
179
+ "internalType": "bytes4",
180
+ "name": "",
181
+ "type": "bytes4"
182
+ }
183
+ ],
184
+ "stateMutability": "view",
185
+ "type": "function"
186
+ },
187
+ {
188
+ "inputs": [],
189
+ "name": "paused",
190
+ "outputs": [
191
+ {
192
+ "internalType": "bool",
193
+ "name": "",
194
+ "type": "bool"
195
+ }
196
+ ],
197
+ "stateMutability": "view",
198
+ "type": "function"
199
+ },
200
+ {
201
+ "inputs": [
202
+ {
203
+ "internalType": "address",
204
+ "name": "_vault",
205
+ "type": "address"
206
+ },
207
+ {
208
+ "internalType": "address",
209
+ "name": "_from",
210
+ "type": "address"
211
+ },
212
+ {
213
+ "internalType": "address",
214
+ "name": "_to",
215
+ "type": "address"
216
+ },
217
+ {
218
+ "internalType": "uint256",
219
+ "name": "_amountIn",
220
+ "type": "uint256"
221
+ }
222
+ ],
223
+ "name": "previewSwap",
224
+ "outputs": [
225
+ {
226
+ "internalType": "uint256",
227
+ "name": "amountOut",
228
+ "type": "uint256"
229
+ },
230
+ {
231
+ "internalType": "uint256",
232
+ "name": "ious",
233
+ "type": "uint256"
234
+ }
235
+ ],
236
+ "stateMutability": "view",
237
+ "type": "function"
238
+ },
239
+ {
240
+ "inputs": [
241
+ {
242
+ "internalType": "address",
243
+ "name": "_receiver",
244
+ "type": "address"
245
+ },
246
+ {
247
+ "internalType": "address",
248
+ "name": "_vault",
249
+ "type": "address"
250
+ },
251
+ {
252
+ "internalType": "address",
253
+ "name": "_token",
254
+ "type": "address"
255
+ },
256
+ {
257
+ "internalType": "uint256",
258
+ "name": "_amount",
259
+ "type": "uint256"
260
+ }
261
+ ],
262
+ "name": "redeemIOU",
263
+ "outputs": [],
264
+ "stateMutability": "nonpayable",
265
+ "type": "function"
266
+ },
267
+ {
268
+ "inputs": [
269
+ {
270
+ "internalType": "address",
271
+ "name": "newAuthority",
272
+ "type": "address"
273
+ }
274
+ ],
275
+ "name": "setAuthority",
276
+ "outputs": [],
277
+ "stateMutability": "nonpayable",
278
+ "type": "function"
279
+ },
280
+ {
281
+ "inputs": [
282
+ {
283
+ "internalType": "address",
284
+ "name": "_receiver",
285
+ "type": "address"
286
+ },
287
+ {
288
+ "internalType": "address",
289
+ "name": "_vault",
290
+ "type": "address"
291
+ },
292
+ {
293
+ "internalType": "address",
294
+ "name": "_from",
295
+ "type": "address"
296
+ },
297
+ {
298
+ "internalType": "address",
299
+ "name": "_to",
300
+ "type": "address"
301
+ },
302
+ {
303
+ "internalType": "uint256",
304
+ "name": "_amountIn",
305
+ "type": "uint256"
306
+ },
307
+ {
308
+ "internalType": "uint256",
309
+ "name": "_minAmountOut",
310
+ "type": "uint256"
311
+ },
312
+ {
313
+ "internalType": "bool",
314
+ "name": "_receiveIOU",
315
+ "type": "bool"
316
+ }
317
+ ],
318
+ "name": "swap",
319
+ "outputs": [
320
+ {
321
+ "internalType": "uint256",
322
+ "name": "amountOut",
323
+ "type": "uint256"
324
+ },
325
+ {
326
+ "internalType": "uint256",
327
+ "name": "ious",
328
+ "type": "uint256"
329
+ }
330
+ ],
331
+ "stateMutability": "nonpayable",
332
+ "type": "function"
333
+ }
334
+ ]
@@ -0,0 +1,28 @@
1
+ [
2
+ {
3
+ "inputs": [],
4
+ "name": "tokens",
5
+ "outputs": [
6
+ {
7
+ "internalType": "address[]",
8
+ "name": "assets",
9
+ "type": "address[]"
10
+ }
11
+ ],
12
+ "stateMutability": "view",
13
+ "type": "function"
14
+ },
15
+ {
16
+ "inputs": [],
17
+ "name": "decimals",
18
+ "outputs": [
19
+ {
20
+ "internalType": "uint8",
21
+ "name": "",
22
+ "type": "uint8"
23
+ }
24
+ ],
25
+ "stateMutability": "view",
26
+ "type": "function"
27
+ }
28
+ ]
@@ -0,0 +1,40 @@
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';
6
+ import { Address } from '../../types';
7
+ import { ClearVault, DexParams } from './types';
8
+ type OnVaultCreatedCallback = (vaults: DeepReadonly<ClearVault[]>) => void;
9
+ export declare class ClearFactory extends StatefulEventSubscriber<ClearVault[]> {
10
+ readonly parentName: string;
11
+ readonly config: DexParams;
12
+ protected network: number;
13
+ protected dexHelper: IDexHelper;
14
+ protected readonly onVaultCreated: OnVaultCreatedCallback;
15
+ handlers: {
16
+ [event: string]: (event: any, state: DeepReadonly<ClearVault[]>, log: Readonly<Log>) => Promise<DeepReadonly<ClearVault[]> | null>;
17
+ };
18
+ logDecoder: (log: Log) => any;
19
+ addressesSubscribed: Address[];
20
+ protected factoryIface: Interface;
21
+ protected vaultIface: Interface;
22
+ constructor(parentName: string, config: DexParams, network: number, dexHelper: IDexHelper, logger: Logger, onVaultCreated: OnVaultCreatedCallback);
23
+ /**
24
+ * Handle NewClearVault event - regenerate state when a new vault is created
25
+ */
26
+ handleNewClearVault(): Promise<DeepReadonly<ClearVault[]> | null>;
27
+ /**
28
+ * Process incoming logs and dispatch to appropriate handlers
29
+ */
30
+ processLog(state: DeepReadonly<ClearVault[]>, log: Readonly<Log>): Promise<DeepReadonly<ClearVault[]> | null>;
31
+ getStateOrGenerate(blockNumber: number, readonly?: boolean): Promise<DeepReadonly<ClearVault[]>>;
32
+ /**
33
+ * Generate state using on-chain calls:
34
+ * 1. Call vaultsLength() to get total count
35
+ * 2. Call getBatchVaultAddresses() to get all addresses
36
+ * 3. Call tokens() on each vault to get supported tokens
37
+ */
38
+ generateState(blockNumber: number): Promise<DeepReadonly<ClearVault[]>>;
39
+ }
40
+ export {};
@@ -0,0 +1,152 @@
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.ClearFactory = 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 ClearFactory_json_1 = __importDefault(require("../../abi/clear/ClearFactory.json"));
11
+ const ClearVault_json_1 = __importDefault(require("../../abi/clear/ClearVault.json"));
12
+ class ClearFactory extends stateful_event_subscriber_1.StatefulEventSubscriber {
13
+ parentName;
14
+ config;
15
+ network;
16
+ dexHelper;
17
+ onVaultCreated;
18
+ handlers = {};
19
+ logDecoder;
20
+ addressesSubscribed;
21
+ factoryIface = new abi_1.Interface(ClearFactory_json_1.default);
22
+ vaultIface = new abi_1.Interface(ClearVault_json_1.default);
23
+ constructor(parentName, config, network, dexHelper, logger, onVaultCreated) {
24
+ super(parentName, 'factory', dexHelper, logger);
25
+ this.parentName = parentName;
26
+ this.config = config;
27
+ this.network = network;
28
+ this.dexHelper = dexHelper;
29
+ this.onVaultCreated = onVaultCreated;
30
+ this.logDecoder = (log) => this.factoryIface.parseLog(log);
31
+ this.addressesSubscribed = [config.factoryAddress];
32
+ // Add handler for NewClearVault event
33
+ this.handlers['NewClearVault'] = this.handleNewClearVault.bind(this);
34
+ }
35
+ /**
36
+ * Handle NewClearVault event - regenerate state when a new vault is created
37
+ */
38
+ async handleNewClearVault() {
39
+ const blockNumber = await this.dexHelper.provider.getBlockNumber();
40
+ const vaults = await this.getStateOrGenerate(blockNumber, false);
41
+ this.onVaultCreated(vaults);
42
+ return vaults;
43
+ }
44
+ /**
45
+ * Process incoming logs and dispatch to appropriate handlers
46
+ */
47
+ async processLog(state, log) {
48
+ try {
49
+ let event;
50
+ try {
51
+ event = this.logDecoder(log);
52
+ }
53
+ catch (e) {
54
+ return null;
55
+ }
56
+ if (event.name in this.handlers) {
57
+ return await this.handlers[event.name](event, state, log);
58
+ }
59
+ }
60
+ catch (e) {
61
+ (0, utils_1.catchParseLogError)(e, this.logger);
62
+ }
63
+ return null;
64
+ }
65
+ async getStateOrGenerate(blockNumber, readonly = false) {
66
+ let state = this.getState(blockNumber);
67
+ if (!state) {
68
+ state = await this.generateState(blockNumber);
69
+ if (!readonly)
70
+ this.setState(state, blockNumber);
71
+ }
72
+ return state;
73
+ }
74
+ /**
75
+ * Generate state using on-chain calls:
76
+ * 1. Call vaultsLength() to get total count
77
+ * 2. Call getBatchVaultAddresses() to get all addresses
78
+ * 3. Call tokens() on each vault to get supported tokens
79
+ */
80
+ async generateState(blockNumber) {
81
+ // Step 1: Get total number of vaults
82
+ const lengthCall = {
83
+ target: this.config.factoryAddress,
84
+ callData: this.factoryIface.encodeFunctionData('vaultsLength'),
85
+ decodeFunction: (result) => {
86
+ const decoded = this.factoryIface.decodeFunctionResult('vaultsLength', result);
87
+ return BigInt(decoded[0].toString());
88
+ },
89
+ };
90
+ const [lengthResult] = await this.dexHelper.multiWrapper.tryAggregate(false, [lengthCall], blockNumber);
91
+ if (!lengthResult.success) {
92
+ this.logger.error(`${this.parentName}: Failed to fetch vaultsLength`);
93
+ return [];
94
+ }
95
+ const vaultsLength = Number(lengthResult.returnData);
96
+ if (vaultsLength === 0) {
97
+ this.logger.info(`${this.parentName}: No vaults found`);
98
+ return [];
99
+ }
100
+ // Step 2: Get all vault addresses
101
+ const indexes = Array.from({ length: vaultsLength }, (_, i) => i);
102
+ const batchCall = {
103
+ target: this.config.factoryAddress,
104
+ callData: this.factoryIface.encodeFunctionData('getBatchVaultAddresses', [
105
+ indexes,
106
+ ]),
107
+ decodeFunction: (result) => {
108
+ const decoded = this.factoryIface.decodeFunctionResult('getBatchVaultAddresses', result);
109
+ return decoded[0];
110
+ },
111
+ };
112
+ const [batchResult] = await this.dexHelper.multiWrapper.tryAggregate(false, [batchCall], blockNumber);
113
+ if (!batchResult.success || !batchResult.returnData) {
114
+ this.logger.error(`${this.parentName}: Failed to fetch vault addresses`);
115
+ return [];
116
+ }
117
+ const vaultAddresses = batchResult.returnData.map(addr => addr.toLowerCase());
118
+ // Step 3: Fetch tokens for each vault
119
+ const tokenCalls = vaultAddresses.map(vault => ({
120
+ target: vault,
121
+ callData: this.vaultIface.encodeFunctionData('tokens'),
122
+ decodeFunction: (result) => {
123
+ const decoded = this.vaultIface.decodeFunctionResult('tokens', result);
124
+ return decoded[0];
125
+ },
126
+ }));
127
+ const tokenResults = await this.dexHelper.multiWrapper.tryAggregate(false, tokenCalls, blockNumber, this.dexHelper.multiWrapper.defaultBatchSize, false);
128
+ const vaults = [];
129
+ for (let i = 0; i < vaultAddresses.length; i++) {
130
+ const result = tokenResults[i];
131
+ if (!result.success || !result.returnData) {
132
+ this.logger.warn(`${this.parentName}: Failed to fetch tokens for vault ${vaultAddresses[i]}`);
133
+ continue;
134
+ }
135
+ const tokenAddresses = result.returnData;
136
+ vaults.push({
137
+ id: vaultAddresses[i],
138
+ address: vaultAddresses[i],
139
+ tokens: tokenAddresses.map(addr => ({
140
+ id: addr.toLowerCase(),
141
+ address: addr.toLowerCase(),
142
+ symbol: '',
143
+ decimals: '18',
144
+ })),
145
+ });
146
+ }
147
+ this.logger.info(`${this.parentName}: Generated state with ${vaults.length} vaults`);
148
+ return vaults;
149
+ }
150
+ }
151
+ exports.ClearFactory = ClearFactory;
152
+ //# sourceMappingURL=clear-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clear-factory.js","sourceRoot":"","sources":["../../../src/dex/clear/clear-factory.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAG/C,uCAAiD;AACjD,+EAA0E;AAK1E,0FAAgE;AAChE,sFAA4D;AAI5D,MAAa,YAAa,SAAQ,mDAAqC;IAiB1D;IACA;IACC;IACA;IAES;IArBrB,QAAQ,GAMJ,EAAE,CAAC;IAEP,UAAU,CAAoB;IAE9B,mBAAmB,CAAY;IAErB,YAAY,GAAG,IAAI,eAAS,CAAC,2BAAe,CAAC,CAAC;IAC9C,UAAU,GAAG,IAAI,eAAS,CAAC,yBAAa,CAAC,CAAC;IAEpD,YACW,UAAkB,EAClB,MAAiB,EAChB,OAAe,EACf,SAAqB,EAC/B,MAAc,EACK,cAAsC;QAEzD,KAAK,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAPvC,eAAU,GAAV,UAAU,CAAQ;QAClB,WAAM,GAAN,MAAM,CAAW;QAChB,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAY;QAEZ,mBAAc,GAAd,cAAc,CAAwB;QAIzD,IAAI,CAAC,UAAU,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAChE,IAAI,CAAC,mBAAmB,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QAEnD,sCAAsC;QACtC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CA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