@pendle/sdk-boros 0.3.46 → 0.3.48
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/dist/common/cacheDecorators.d.ts +19 -0
- package/dist/common/cacheDecorators.js +112 -0
- package/dist/common/cacheDecorators.js.map +1 -0
- package/dist/common/time.d.ts +19 -0
- package/dist/common/time.js +102 -0
- package/dist/common/time.js.map +1 -0
- package/dist/contracts/amm.d.ts +600 -0
- package/dist/contracts/amm.js +36 -0
- package/dist/contracts/amm.js.map +1 -0
- package/dist/contracts/consts.d.ts +1 -0
- package/dist/contracts/consts.js +5 -0
- package/dist/contracts/consts.js.map +1 -0
- package/dist/contracts/contracts.factory.d.ts +4 -0
- package/dist/contracts/contracts.factory.js +8 -0
- package/dist/contracts/contracts.factory.js.map +1 -1
- package/dist/contracts/market.d.ts +1700 -0
- package/dist/contracts/market.js +85 -0
- package/dist/contracts/market.js.map +1 -0
- package/dist/entities/exchange/exchange.d.ts +10 -1
- package/dist/entities/exchange/exchange.js +49 -2
- package/dist/entities/exchange/exchange.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
import { MulticallOptions } from '../multicall/multicall';
|
|
2
|
+
import { MarketAcc } from '../types';
|
|
3
|
+
import { iAMMAbi } from './abis/viemAbis';
|
|
4
|
+
import { BaseContractHelper } from './base-contract-helper';
|
|
5
|
+
export declare class AMM extends BaseContractHelper<typeof iAMMAbi> {
|
|
6
|
+
abi(): readonly [{
|
|
7
|
+
readonly inputs: readonly [{
|
|
8
|
+
readonly internalType: "MarketAcc";
|
|
9
|
+
readonly name: "account";
|
|
10
|
+
readonly type: "bytes26";
|
|
11
|
+
}, {
|
|
12
|
+
readonly internalType: "uint256";
|
|
13
|
+
readonly name: "balance";
|
|
14
|
+
readonly type: "uint256";
|
|
15
|
+
}, {
|
|
16
|
+
readonly internalType: "uint256";
|
|
17
|
+
readonly name: "value";
|
|
18
|
+
readonly type: "uint256";
|
|
19
|
+
}];
|
|
20
|
+
readonly name: "BOROS20NotEnoughBalance";
|
|
21
|
+
readonly type: "error";
|
|
22
|
+
}, {
|
|
23
|
+
readonly anonymous: false;
|
|
24
|
+
readonly inputs: readonly [{
|
|
25
|
+
readonly indexed: false;
|
|
26
|
+
readonly internalType: "uint128";
|
|
27
|
+
readonly name: "minAbsRate";
|
|
28
|
+
readonly type: "uint128";
|
|
29
|
+
}, {
|
|
30
|
+
readonly indexed: false;
|
|
31
|
+
readonly internalType: "uint128";
|
|
32
|
+
readonly name: "maxAbsRate";
|
|
33
|
+
readonly type: "uint128";
|
|
34
|
+
}, {
|
|
35
|
+
readonly indexed: false;
|
|
36
|
+
readonly internalType: "uint32";
|
|
37
|
+
readonly name: "cutOffTimestamp";
|
|
38
|
+
readonly type: "uint32";
|
|
39
|
+
}];
|
|
40
|
+
readonly name: "AMMConfigUpdated";
|
|
41
|
+
readonly type: "event";
|
|
42
|
+
}, {
|
|
43
|
+
readonly anonymous: false;
|
|
44
|
+
readonly inputs: readonly [{
|
|
45
|
+
readonly indexed: false;
|
|
46
|
+
readonly internalType: "MarketAcc";
|
|
47
|
+
readonly name: "from";
|
|
48
|
+
readonly type: "bytes26";
|
|
49
|
+
}, {
|
|
50
|
+
readonly indexed: false;
|
|
51
|
+
readonly internalType: "MarketAcc";
|
|
52
|
+
readonly name: "to";
|
|
53
|
+
readonly type: "bytes26";
|
|
54
|
+
}, {
|
|
55
|
+
readonly indexed: false;
|
|
56
|
+
readonly internalType: "uint256";
|
|
57
|
+
readonly name: "value";
|
|
58
|
+
readonly type: "uint256";
|
|
59
|
+
}];
|
|
60
|
+
readonly name: "BOROS20Transfer";
|
|
61
|
+
readonly type: "event";
|
|
62
|
+
}, {
|
|
63
|
+
readonly anonymous: false;
|
|
64
|
+
readonly inputs: readonly [{
|
|
65
|
+
readonly indexed: true;
|
|
66
|
+
readonly internalType: "MarketAcc";
|
|
67
|
+
readonly name: "payer";
|
|
68
|
+
readonly type: "bytes26";
|
|
69
|
+
}, {
|
|
70
|
+
readonly indexed: false;
|
|
71
|
+
readonly internalType: "uint256";
|
|
72
|
+
readonly name: "netLpBurned";
|
|
73
|
+
readonly type: "uint256";
|
|
74
|
+
}, {
|
|
75
|
+
readonly indexed: false;
|
|
76
|
+
readonly internalType: "int256";
|
|
77
|
+
readonly name: "netCashOut";
|
|
78
|
+
readonly type: "int256";
|
|
79
|
+
}, {
|
|
80
|
+
readonly indexed: false;
|
|
81
|
+
readonly internalType: "int256";
|
|
82
|
+
readonly name: "netSizeOut";
|
|
83
|
+
readonly type: "int256";
|
|
84
|
+
}];
|
|
85
|
+
readonly name: "Burn";
|
|
86
|
+
readonly type: "event";
|
|
87
|
+
}, {
|
|
88
|
+
readonly anonymous: false;
|
|
89
|
+
readonly inputs: readonly [{
|
|
90
|
+
readonly indexed: false;
|
|
91
|
+
readonly internalType: "uint256";
|
|
92
|
+
readonly name: "newFeeRate";
|
|
93
|
+
readonly type: "uint256";
|
|
94
|
+
}];
|
|
95
|
+
readonly name: "FeeRateUpdated";
|
|
96
|
+
readonly type: "event";
|
|
97
|
+
}, {
|
|
98
|
+
readonly anonymous: false;
|
|
99
|
+
readonly inputs: readonly [{
|
|
100
|
+
readonly indexed: false;
|
|
101
|
+
readonly internalType: "uint32";
|
|
102
|
+
readonly name: "newWindow";
|
|
103
|
+
readonly type: "uint32";
|
|
104
|
+
}];
|
|
105
|
+
readonly name: "ImpliedRateObservationWindowUpdated";
|
|
106
|
+
readonly type: "event";
|
|
107
|
+
}, {
|
|
108
|
+
readonly anonymous: false;
|
|
109
|
+
readonly inputs: readonly [{
|
|
110
|
+
readonly indexed: true;
|
|
111
|
+
readonly internalType: "MarketAcc";
|
|
112
|
+
readonly name: "receiver";
|
|
113
|
+
readonly type: "bytes26";
|
|
114
|
+
}, {
|
|
115
|
+
readonly indexed: false;
|
|
116
|
+
readonly internalType: "uint256";
|
|
117
|
+
readonly name: "netLpMinted";
|
|
118
|
+
readonly type: "uint256";
|
|
119
|
+
}, {
|
|
120
|
+
readonly indexed: false;
|
|
121
|
+
readonly internalType: "int256";
|
|
122
|
+
readonly name: "netCashIn";
|
|
123
|
+
readonly type: "int256";
|
|
124
|
+
}, {
|
|
125
|
+
readonly indexed: false;
|
|
126
|
+
readonly internalType: "int256";
|
|
127
|
+
readonly name: "netSizeIn";
|
|
128
|
+
readonly type: "int256";
|
|
129
|
+
}];
|
|
130
|
+
readonly name: "Mint";
|
|
131
|
+
readonly type: "event";
|
|
132
|
+
}, {
|
|
133
|
+
readonly anonymous: false;
|
|
134
|
+
readonly inputs: readonly [{
|
|
135
|
+
readonly indexed: false;
|
|
136
|
+
readonly internalType: "int256";
|
|
137
|
+
readonly name: "sizeOut";
|
|
138
|
+
readonly type: "int256";
|
|
139
|
+
}, {
|
|
140
|
+
readonly indexed: false;
|
|
141
|
+
readonly internalType: "int256";
|
|
142
|
+
readonly name: "costOut";
|
|
143
|
+
readonly type: "int256";
|
|
144
|
+
}, {
|
|
145
|
+
readonly indexed: false;
|
|
146
|
+
readonly internalType: "uint256";
|
|
147
|
+
readonly name: "fee";
|
|
148
|
+
readonly type: "uint256";
|
|
149
|
+
}];
|
|
150
|
+
readonly name: "Swap";
|
|
151
|
+
readonly type: "event";
|
|
152
|
+
}, {
|
|
153
|
+
readonly anonymous: false;
|
|
154
|
+
readonly inputs: readonly [{
|
|
155
|
+
readonly indexed: false;
|
|
156
|
+
readonly internalType: "uint256";
|
|
157
|
+
readonly name: "newTotalSupplyCap";
|
|
158
|
+
readonly type: "uint256";
|
|
159
|
+
}];
|
|
160
|
+
readonly name: "TotalSupplyCapUpdated";
|
|
161
|
+
readonly type: "event";
|
|
162
|
+
}, {
|
|
163
|
+
readonly inputs: readonly [];
|
|
164
|
+
readonly name: "ACCOUNT_ONE";
|
|
165
|
+
readonly outputs: readonly [{
|
|
166
|
+
readonly internalType: "MarketAcc";
|
|
167
|
+
readonly name: "";
|
|
168
|
+
readonly type: "bytes26";
|
|
169
|
+
}];
|
|
170
|
+
readonly stateMutability: "view";
|
|
171
|
+
readonly type: "function";
|
|
172
|
+
}, {
|
|
173
|
+
readonly inputs: readonly [];
|
|
174
|
+
readonly name: "AMM_ID";
|
|
175
|
+
readonly outputs: readonly [{
|
|
176
|
+
readonly internalType: "AMMId";
|
|
177
|
+
readonly name: "";
|
|
178
|
+
readonly type: "uint24";
|
|
179
|
+
}];
|
|
180
|
+
readonly stateMutability: "view";
|
|
181
|
+
readonly type: "function";
|
|
182
|
+
}, {
|
|
183
|
+
readonly inputs: readonly [];
|
|
184
|
+
readonly name: "MARKET";
|
|
185
|
+
readonly outputs: readonly [{
|
|
186
|
+
readonly internalType: "address";
|
|
187
|
+
readonly name: "";
|
|
188
|
+
readonly type: "address";
|
|
189
|
+
}];
|
|
190
|
+
readonly stateMutability: "view";
|
|
191
|
+
readonly type: "function";
|
|
192
|
+
}, {
|
|
193
|
+
readonly inputs: readonly [];
|
|
194
|
+
readonly name: "MATURITY";
|
|
195
|
+
readonly outputs: readonly [{
|
|
196
|
+
readonly internalType: "uint32";
|
|
197
|
+
readonly name: "";
|
|
198
|
+
readonly type: "uint32";
|
|
199
|
+
}];
|
|
200
|
+
readonly stateMutability: "view";
|
|
201
|
+
readonly type: "function";
|
|
202
|
+
}, {
|
|
203
|
+
readonly inputs: readonly [];
|
|
204
|
+
readonly name: "ROUTER";
|
|
205
|
+
readonly outputs: readonly [{
|
|
206
|
+
readonly internalType: "address";
|
|
207
|
+
readonly name: "";
|
|
208
|
+
readonly type: "address";
|
|
209
|
+
}];
|
|
210
|
+
readonly stateMutability: "view";
|
|
211
|
+
readonly type: "function";
|
|
212
|
+
}, {
|
|
213
|
+
readonly inputs: readonly [];
|
|
214
|
+
readonly name: "SEED_TIME";
|
|
215
|
+
readonly outputs: readonly [{
|
|
216
|
+
readonly internalType: "uint32";
|
|
217
|
+
readonly name: "";
|
|
218
|
+
readonly type: "uint32";
|
|
219
|
+
}];
|
|
220
|
+
readonly stateMutability: "view";
|
|
221
|
+
readonly type: "function";
|
|
222
|
+
}, {
|
|
223
|
+
readonly inputs: readonly [];
|
|
224
|
+
readonly name: "SELF_ACC";
|
|
225
|
+
readonly outputs: readonly [{
|
|
226
|
+
readonly internalType: "MarketAcc";
|
|
227
|
+
readonly name: "";
|
|
228
|
+
readonly type: "bytes26";
|
|
229
|
+
}];
|
|
230
|
+
readonly stateMutability: "view";
|
|
231
|
+
readonly type: "function";
|
|
232
|
+
}, {
|
|
233
|
+
readonly inputs: readonly [];
|
|
234
|
+
readonly name: "_storage";
|
|
235
|
+
readonly outputs: readonly [{
|
|
236
|
+
readonly internalType: "uint128";
|
|
237
|
+
readonly name: "minAbsRate";
|
|
238
|
+
readonly type: "uint128";
|
|
239
|
+
}, {
|
|
240
|
+
readonly internalType: "uint128";
|
|
241
|
+
readonly name: "maxAbsRate";
|
|
242
|
+
readonly type: "uint128";
|
|
243
|
+
}, {
|
|
244
|
+
readonly internalType: "uint32";
|
|
245
|
+
readonly name: "cutOffTimestamp";
|
|
246
|
+
readonly type: "uint32";
|
|
247
|
+
}, {
|
|
248
|
+
readonly internalType: "uint32";
|
|
249
|
+
readonly name: "oracleImpliedRateWindow";
|
|
250
|
+
readonly type: "uint32";
|
|
251
|
+
}, {
|
|
252
|
+
readonly internalType: "uint64";
|
|
253
|
+
readonly name: "feeRate";
|
|
254
|
+
readonly type: "uint64";
|
|
255
|
+
}, {
|
|
256
|
+
readonly internalType: "uint256";
|
|
257
|
+
readonly name: "totalSupplyCap";
|
|
258
|
+
readonly type: "uint256";
|
|
259
|
+
}, {
|
|
260
|
+
readonly internalType: "uint128";
|
|
261
|
+
readonly name: "totalFloatAmount";
|
|
262
|
+
readonly type: "uint128";
|
|
263
|
+
}, {
|
|
264
|
+
readonly internalType: "uint128";
|
|
265
|
+
readonly name: "normFixedAmount";
|
|
266
|
+
readonly type: "uint128";
|
|
267
|
+
}, {
|
|
268
|
+
readonly internalType: "uint32";
|
|
269
|
+
readonly name: "lastTradedTime";
|
|
270
|
+
readonly type: "uint32";
|
|
271
|
+
}, {
|
|
272
|
+
readonly internalType: "int128";
|
|
273
|
+
readonly name: "prevOracleImpliedRate";
|
|
274
|
+
readonly type: "int128";
|
|
275
|
+
}];
|
|
276
|
+
readonly stateMutability: "view";
|
|
277
|
+
readonly type: "function";
|
|
278
|
+
}, {
|
|
279
|
+
readonly inputs: readonly [{
|
|
280
|
+
readonly internalType: "MarketAcc";
|
|
281
|
+
readonly name: "account";
|
|
282
|
+
readonly type: "bytes26";
|
|
283
|
+
}];
|
|
284
|
+
readonly name: "balanceOf";
|
|
285
|
+
readonly outputs: readonly [{
|
|
286
|
+
readonly internalType: "uint256";
|
|
287
|
+
readonly name: "";
|
|
288
|
+
readonly type: "uint256";
|
|
289
|
+
}];
|
|
290
|
+
readonly stateMutability: "view";
|
|
291
|
+
readonly type: "function";
|
|
292
|
+
}, {
|
|
293
|
+
readonly inputs: readonly [{
|
|
294
|
+
readonly internalType: "MarketAcc";
|
|
295
|
+
readonly name: "payer";
|
|
296
|
+
readonly type: "bytes26";
|
|
297
|
+
}, {
|
|
298
|
+
readonly internalType: "int256";
|
|
299
|
+
readonly name: "totalCash";
|
|
300
|
+
readonly type: "int256";
|
|
301
|
+
}, {
|
|
302
|
+
readonly internalType: "int256";
|
|
303
|
+
readonly name: "totalSize";
|
|
304
|
+
readonly type: "int256";
|
|
305
|
+
}, {
|
|
306
|
+
readonly internalType: "uint256";
|
|
307
|
+
readonly name: "lpToBurn";
|
|
308
|
+
readonly type: "uint256";
|
|
309
|
+
}];
|
|
310
|
+
readonly name: "burnByBorosRouter";
|
|
311
|
+
readonly outputs: readonly [{
|
|
312
|
+
readonly internalType: "int256";
|
|
313
|
+
readonly name: "netCashOut";
|
|
314
|
+
readonly type: "int256";
|
|
315
|
+
}, {
|
|
316
|
+
readonly internalType: "int256";
|
|
317
|
+
readonly name: "netSizeOut";
|
|
318
|
+
readonly type: "int256";
|
|
319
|
+
}, {
|
|
320
|
+
readonly internalType: "bool";
|
|
321
|
+
readonly name: "isMatured";
|
|
322
|
+
readonly type: "bool";
|
|
323
|
+
}];
|
|
324
|
+
readonly stateMutability: "nonpayable";
|
|
325
|
+
readonly type: "function";
|
|
326
|
+
}, {
|
|
327
|
+
readonly inputs: readonly [{
|
|
328
|
+
readonly internalType: "int256";
|
|
329
|
+
readonly name: "targetRate";
|
|
330
|
+
readonly type: "int256";
|
|
331
|
+
}];
|
|
332
|
+
readonly name: "calcSwapSize";
|
|
333
|
+
readonly outputs: readonly [{
|
|
334
|
+
readonly internalType: "int256";
|
|
335
|
+
readonly name: "";
|
|
336
|
+
readonly type: "int256";
|
|
337
|
+
}];
|
|
338
|
+
readonly stateMutability: "view";
|
|
339
|
+
readonly type: "function";
|
|
340
|
+
}, {
|
|
341
|
+
readonly inputs: readonly [];
|
|
342
|
+
readonly name: "decimals";
|
|
343
|
+
readonly outputs: readonly [{
|
|
344
|
+
readonly internalType: "uint8";
|
|
345
|
+
readonly name: "";
|
|
346
|
+
readonly type: "uint8";
|
|
347
|
+
}];
|
|
348
|
+
readonly stateMutability: "view";
|
|
349
|
+
readonly type: "function";
|
|
350
|
+
}, {
|
|
351
|
+
readonly inputs: readonly [];
|
|
352
|
+
readonly name: "feeRate";
|
|
353
|
+
readonly outputs: readonly [{
|
|
354
|
+
readonly internalType: "uint64";
|
|
355
|
+
readonly name: "";
|
|
356
|
+
readonly type: "uint64";
|
|
357
|
+
}];
|
|
358
|
+
readonly stateMutability: "view";
|
|
359
|
+
readonly type: "function";
|
|
360
|
+
}, {
|
|
361
|
+
readonly inputs: readonly [];
|
|
362
|
+
readonly name: "impliedRate";
|
|
363
|
+
readonly outputs: readonly [{
|
|
364
|
+
readonly internalType: "int256";
|
|
365
|
+
readonly name: "";
|
|
366
|
+
readonly type: "int256";
|
|
367
|
+
}];
|
|
368
|
+
readonly stateMutability: "view";
|
|
369
|
+
readonly type: "function";
|
|
370
|
+
}, {
|
|
371
|
+
readonly inputs: readonly [{
|
|
372
|
+
readonly internalType: "MarketAcc";
|
|
373
|
+
readonly name: "receiver";
|
|
374
|
+
readonly type: "bytes26";
|
|
375
|
+
}, {
|
|
376
|
+
readonly internalType: "int256";
|
|
377
|
+
readonly name: "totalCash";
|
|
378
|
+
readonly type: "int256";
|
|
379
|
+
}, {
|
|
380
|
+
readonly internalType: "int256";
|
|
381
|
+
readonly name: "totalSize";
|
|
382
|
+
readonly type: "int256";
|
|
383
|
+
}, {
|
|
384
|
+
readonly internalType: "int256";
|
|
385
|
+
readonly name: "maxCashIn";
|
|
386
|
+
readonly type: "int256";
|
|
387
|
+
}, {
|
|
388
|
+
readonly internalType: "int256";
|
|
389
|
+
readonly name: "exactSizeIn";
|
|
390
|
+
readonly type: "int256";
|
|
391
|
+
}];
|
|
392
|
+
readonly name: "mintByBorosRouter";
|
|
393
|
+
readonly outputs: readonly [{
|
|
394
|
+
readonly internalType: "int256";
|
|
395
|
+
readonly name: "netCashIn";
|
|
396
|
+
readonly type: "int256";
|
|
397
|
+
}, {
|
|
398
|
+
readonly internalType: "uint256";
|
|
399
|
+
readonly name: "netLpOut";
|
|
400
|
+
readonly type: "uint256";
|
|
401
|
+
}];
|
|
402
|
+
readonly stateMutability: "nonpayable";
|
|
403
|
+
readonly type: "function";
|
|
404
|
+
}, {
|
|
405
|
+
readonly inputs: readonly [];
|
|
406
|
+
readonly name: "name";
|
|
407
|
+
readonly outputs: readonly [{
|
|
408
|
+
readonly internalType: "string";
|
|
409
|
+
readonly name: "";
|
|
410
|
+
readonly type: "string";
|
|
411
|
+
}];
|
|
412
|
+
readonly stateMutability: "view";
|
|
413
|
+
readonly type: "function";
|
|
414
|
+
}, {
|
|
415
|
+
readonly inputs: readonly [];
|
|
416
|
+
readonly name: "oracleImpliedRate";
|
|
417
|
+
readonly outputs: readonly [{
|
|
418
|
+
readonly internalType: "int128";
|
|
419
|
+
readonly name: "oracleImpliedRate";
|
|
420
|
+
readonly type: "int128";
|
|
421
|
+
}, {
|
|
422
|
+
readonly internalType: "uint32";
|
|
423
|
+
readonly name: "observationWindow";
|
|
424
|
+
readonly type: "uint32";
|
|
425
|
+
}];
|
|
426
|
+
readonly stateMutability: "view";
|
|
427
|
+
readonly type: "function";
|
|
428
|
+
}, {
|
|
429
|
+
readonly inputs: readonly [];
|
|
430
|
+
readonly name: "readState";
|
|
431
|
+
readonly outputs: readonly [{
|
|
432
|
+
readonly components: readonly [{
|
|
433
|
+
readonly internalType: "uint256";
|
|
434
|
+
readonly name: "totalFloatAmount";
|
|
435
|
+
readonly type: "uint256";
|
|
436
|
+
}, {
|
|
437
|
+
readonly internalType: "uint256";
|
|
438
|
+
readonly name: "normFixedAmount";
|
|
439
|
+
readonly type: "uint256";
|
|
440
|
+
}, {
|
|
441
|
+
readonly internalType: "uint256";
|
|
442
|
+
readonly name: "totalLp";
|
|
443
|
+
readonly type: "uint256";
|
|
444
|
+
}, {
|
|
445
|
+
readonly internalType: "uint256";
|
|
446
|
+
readonly name: "latestFTime";
|
|
447
|
+
readonly type: "uint256";
|
|
448
|
+
}, {
|
|
449
|
+
readonly internalType: "uint256";
|
|
450
|
+
readonly name: "maturity";
|
|
451
|
+
readonly type: "uint256";
|
|
452
|
+
}, {
|
|
453
|
+
readonly internalType: "uint256";
|
|
454
|
+
readonly name: "seedTime";
|
|
455
|
+
readonly type: "uint256";
|
|
456
|
+
}, {
|
|
457
|
+
readonly internalType: "uint256";
|
|
458
|
+
readonly name: "minAbsRate";
|
|
459
|
+
readonly type: "uint256";
|
|
460
|
+
}, {
|
|
461
|
+
readonly internalType: "uint256";
|
|
462
|
+
readonly name: "maxAbsRate";
|
|
463
|
+
readonly type: "uint256";
|
|
464
|
+
}, {
|
|
465
|
+
readonly internalType: "uint256";
|
|
466
|
+
readonly name: "cutOffTimestamp";
|
|
467
|
+
readonly type: "uint256";
|
|
468
|
+
}];
|
|
469
|
+
readonly internalType: "struct AMMState";
|
|
470
|
+
readonly name: "";
|
|
471
|
+
readonly type: "tuple";
|
|
472
|
+
}];
|
|
473
|
+
readonly stateMutability: "view";
|
|
474
|
+
readonly type: "function";
|
|
475
|
+
}, {
|
|
476
|
+
readonly inputs: readonly [{
|
|
477
|
+
readonly internalType: "uint128";
|
|
478
|
+
readonly name: "minAbsRate";
|
|
479
|
+
readonly type: "uint128";
|
|
480
|
+
}, {
|
|
481
|
+
readonly internalType: "uint128";
|
|
482
|
+
readonly name: "maxAbsRate";
|
|
483
|
+
readonly type: "uint128";
|
|
484
|
+
}, {
|
|
485
|
+
readonly internalType: "uint32";
|
|
486
|
+
readonly name: "cutOffTimestamp";
|
|
487
|
+
readonly type: "uint32";
|
|
488
|
+
}];
|
|
489
|
+
readonly name: "setAMMConfig";
|
|
490
|
+
readonly outputs: readonly [];
|
|
491
|
+
readonly stateMutability: "nonpayable";
|
|
492
|
+
readonly type: "function";
|
|
493
|
+
}, {
|
|
494
|
+
readonly inputs: readonly [{
|
|
495
|
+
readonly internalType: "uint64";
|
|
496
|
+
readonly name: "newFeeRate";
|
|
497
|
+
readonly type: "uint64";
|
|
498
|
+
}];
|
|
499
|
+
readonly name: "setAMMFeeRate";
|
|
500
|
+
readonly outputs: readonly [];
|
|
501
|
+
readonly stateMutability: "nonpayable";
|
|
502
|
+
readonly type: "function";
|
|
503
|
+
}, {
|
|
504
|
+
readonly inputs: readonly [{
|
|
505
|
+
readonly internalType: "uint32";
|
|
506
|
+
readonly name: "newWindow";
|
|
507
|
+
readonly type: "uint32";
|
|
508
|
+
}];
|
|
509
|
+
readonly name: "setAMMImpliedRateObservationWindow";
|
|
510
|
+
readonly outputs: readonly [];
|
|
511
|
+
readonly stateMutability: "nonpayable";
|
|
512
|
+
readonly type: "function";
|
|
513
|
+
}, {
|
|
514
|
+
readonly inputs: readonly [{
|
|
515
|
+
readonly internalType: "uint256";
|
|
516
|
+
readonly name: "newTotalSupplyCap";
|
|
517
|
+
readonly type: "uint256";
|
|
518
|
+
}];
|
|
519
|
+
readonly name: "setAMMTotalSupplyCap";
|
|
520
|
+
readonly outputs: readonly [];
|
|
521
|
+
readonly stateMutability: "nonpayable";
|
|
522
|
+
readonly type: "function";
|
|
523
|
+
}, {
|
|
524
|
+
readonly inputs: readonly [{
|
|
525
|
+
readonly internalType: "int256";
|
|
526
|
+
readonly name: "sizeOut";
|
|
527
|
+
readonly type: "int256";
|
|
528
|
+
}];
|
|
529
|
+
readonly name: "swapByBorosRouter";
|
|
530
|
+
readonly outputs: readonly [{
|
|
531
|
+
readonly internalType: "int256";
|
|
532
|
+
readonly name: "costOut";
|
|
533
|
+
readonly type: "int256";
|
|
534
|
+
}];
|
|
535
|
+
readonly stateMutability: "nonpayable";
|
|
536
|
+
readonly type: "function";
|
|
537
|
+
}, {
|
|
538
|
+
readonly inputs: readonly [{
|
|
539
|
+
readonly internalType: "int256";
|
|
540
|
+
readonly name: "sizeOut";
|
|
541
|
+
readonly type: "int256";
|
|
542
|
+
}];
|
|
543
|
+
readonly name: "swapView";
|
|
544
|
+
readonly outputs: readonly [{
|
|
545
|
+
readonly internalType: "int256";
|
|
546
|
+
readonly name: "costOut";
|
|
547
|
+
readonly type: "int256";
|
|
548
|
+
}];
|
|
549
|
+
readonly stateMutability: "view";
|
|
550
|
+
readonly type: "function";
|
|
551
|
+
}, {
|
|
552
|
+
readonly inputs: readonly [];
|
|
553
|
+
readonly name: "symbol";
|
|
554
|
+
readonly outputs: readonly [{
|
|
555
|
+
readonly internalType: "string";
|
|
556
|
+
readonly name: "";
|
|
557
|
+
readonly type: "string";
|
|
558
|
+
}];
|
|
559
|
+
readonly stateMutability: "view";
|
|
560
|
+
readonly type: "function";
|
|
561
|
+
}, {
|
|
562
|
+
readonly inputs: readonly [];
|
|
563
|
+
readonly name: "totalSupply";
|
|
564
|
+
readonly outputs: readonly [{
|
|
565
|
+
readonly internalType: "uint256";
|
|
566
|
+
readonly name: "";
|
|
567
|
+
readonly type: "uint256";
|
|
568
|
+
}];
|
|
569
|
+
readonly stateMutability: "view";
|
|
570
|
+
readonly type: "function";
|
|
571
|
+
}, {
|
|
572
|
+
readonly inputs: readonly [];
|
|
573
|
+
readonly name: "totalSupplyCap";
|
|
574
|
+
readonly outputs: readonly [{
|
|
575
|
+
readonly internalType: "uint256";
|
|
576
|
+
readonly name: "";
|
|
577
|
+
readonly type: "uint256";
|
|
578
|
+
}];
|
|
579
|
+
readonly stateMutability: "view";
|
|
580
|
+
readonly type: "function";
|
|
581
|
+
}];
|
|
582
|
+
readState(): Promise<{
|
|
583
|
+
totalFloatAmount: bigint;
|
|
584
|
+
normFixedAmount: bigint;
|
|
585
|
+
totalLp: bigint;
|
|
586
|
+
latestFTime: bigint;
|
|
587
|
+
maturity: bigint;
|
|
588
|
+
seedTime: bigint;
|
|
589
|
+
minAbsRate: bigint;
|
|
590
|
+
maxAbsRate: bigint;
|
|
591
|
+
cutOffTimestamp: bigint;
|
|
592
|
+
}>;
|
|
593
|
+
impliedRate(): Promise<bigint>;
|
|
594
|
+
feeRate(): Promise<bigint>;
|
|
595
|
+
marketAcc(): Promise<`0x${string}`>;
|
|
596
|
+
balanceOf(marketAcc: MarketAcc, multicallOptions?: MulticallOptions): Promise<bigint>;
|
|
597
|
+
calcSwapSize(targetRate: bigint, multicallOptions?: MulticallOptions): Promise<bigint>;
|
|
598
|
+
totalSupply(multicallOptions?: MulticallOptions): Promise<bigint>;
|
|
599
|
+
totalSupplyCap(multicallOptions?: MulticallOptions): Promise<bigint>;
|
|
600
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AMM = void 0;
|
|
4
|
+
const viemAbis_1 = require("./abis/viemAbis");
|
|
5
|
+
const base_contract_helper_1 = require("./base-contract-helper");
|
|
6
|
+
class AMM extends base_contract_helper_1.BaseContractHelper {
|
|
7
|
+
abi() {
|
|
8
|
+
return viemAbis_1.iAMMAbi;
|
|
9
|
+
}
|
|
10
|
+
async readState() {
|
|
11
|
+
return await this.contract.read.readState();
|
|
12
|
+
}
|
|
13
|
+
async impliedRate() {
|
|
14
|
+
return await this.contract.read.impliedRate();
|
|
15
|
+
}
|
|
16
|
+
async feeRate() {
|
|
17
|
+
return await this.contract.read.feeRate();
|
|
18
|
+
}
|
|
19
|
+
async marketAcc() {
|
|
20
|
+
return await this.contract.read.SELF_ACC();
|
|
21
|
+
}
|
|
22
|
+
async balanceOf(marketAcc, multicallOptions) {
|
|
23
|
+
return await this.contract.read.balanceOf(marketAcc, multicallOptions);
|
|
24
|
+
}
|
|
25
|
+
async calcSwapSize(targetRate, multicallOptions) {
|
|
26
|
+
return await this.contract.read.calcSwapSize(targetRate, multicallOptions);
|
|
27
|
+
}
|
|
28
|
+
async totalSupply(multicallOptions) {
|
|
29
|
+
return await this.contract.read.totalSupply(multicallOptions);
|
|
30
|
+
}
|
|
31
|
+
async totalSupplyCap(multicallOptions) {
|
|
32
|
+
return await this.contract.read.totalSupplyCap(multicallOptions);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.AMM = AMM;
|
|
36
|
+
//# sourceMappingURL=amm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amm.js","sourceRoot":"","sources":["../../src/contracts/amm.ts"],"names":[],"mappings":";;;AAGA,8CAA0C;AAC1C,iEAA4D;AAE5D,MAAa,GAAI,SAAQ,yCAAkC;IACzD,GAAG;QACD,OAAO,kBAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,SAAS;QACb,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,WAAW;QACf,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,OAAO;QACX,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,SAAS;QACb,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,SAAoB,EAAE,gBAAmC;QACvE,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,UAAkB,EAAE,gBAAmC;QACxE,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;IAC7E,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,gBAAmC;QACnD,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,gBAAmC;QACtD,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;IACnE,CAAC;CACF;AApCD,kBAoCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EXPLORER_CONTRACT_ADDRESS = "0x0CcB40176E133E5A011130D6BF6665005C29839E";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../../src/contracts/consts.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GAAG,4CAA4C,CAAC"}
|
|
@@ -2,6 +2,8 @@ import { Address, GetContractReturnType, PublicClient, WalletClient } from 'viem
|
|
|
2
2
|
import { Explorer } from './explorer';
|
|
3
3
|
import { Multicall } from '../multicall/multicall';
|
|
4
4
|
import { iMulticall3Abi } from './abis/viemAbis';
|
|
5
|
+
import { MarketContract } from './market';
|
|
6
|
+
import { AMM } from './amm';
|
|
5
7
|
export declare class ContractsFactory {
|
|
6
8
|
private rpcClient;
|
|
7
9
|
private multicallContract;
|
|
@@ -17,5 +19,7 @@ export declare class ContractsFactory {
|
|
|
17
19
|
multicall: Multicall | undefined;
|
|
18
20
|
};
|
|
19
21
|
getExplorerContract(address: Address, walletClient?: WalletClient): Explorer;
|
|
22
|
+
getMarketContract(address: Address, walletClient?: WalletClient): MarketContract;
|
|
23
|
+
getAmmContract(address: Address, walletClient?: WalletClient): AMM;
|
|
20
24
|
getMulticall3Contract(address: Address): GetContractReturnType<typeof iMulticall3Abi, PublicClient, Address>;
|
|
21
25
|
}
|
|
@@ -8,6 +8,8 @@ const multicall_1 = require("../multicall/multicall");
|
|
|
8
8
|
const viemAbis_1 = require("./abis/viemAbis");
|
|
9
9
|
const common_1 = require("../common");
|
|
10
10
|
const constants_1 = require("../multicall/constants");
|
|
11
|
+
const market_1 = require("./market");
|
|
12
|
+
const amm_1 = require("./amm");
|
|
11
13
|
class ContractsFactory {
|
|
12
14
|
rpcClient;
|
|
13
15
|
multicallContract;
|
|
@@ -51,6 +53,12 @@ class ContractsFactory {
|
|
|
51
53
|
getExplorerContract(address, walletClient) {
|
|
52
54
|
return new explorer_1.Explorer(address, this.getRpcClientAndMulticall(), walletClient);
|
|
53
55
|
}
|
|
56
|
+
getMarketContract(address, walletClient) {
|
|
57
|
+
return new market_1.MarketContract(address, this.getRpcClientAndMulticall(), walletClient);
|
|
58
|
+
}
|
|
59
|
+
getAmmContract(address, walletClient) {
|
|
60
|
+
return new amm_1.AMM(address, this.getRpcClientAndMulticall(), walletClient);
|
|
61
|
+
}
|
|
54
62
|
getMulticall3Contract(address) {
|
|
55
63
|
const client = this.getRpcClient();
|
|
56
64
|
const contract = (0, viem_1.getContract)({
|