@pendle/sdk-boros 0.3.45 → 0.3.47
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/common/types.d.ts +155 -0
- package/dist/common/types.js +16 -0
- package/dist/common/types.js.map +1 -0
- package/dist/contracts/abis/distributorAbi.js.map +1 -0
- package/dist/contracts/abis/multiTokenMerkleDistributorAbi.js.map +1 -0
- package/dist/contracts/abis/viemAbis.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/base-contract-helper.d.ts +15 -0
- package/dist/contracts/base-contract-helper.js +36 -0
- package/dist/contracts/base-contract-helper.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 +25 -0
- package/dist/contracts/contracts.factory.js +73 -0
- package/dist/contracts/contracts.factory.js.map +1 -0
- package/dist/contracts/explorer.d.ts +582 -0
- package/dist/contracts/explorer.js +53 -0
- package/dist/contracts/explorer.js.map +1 -0
- package/dist/contracts/index.d.ts +3 -3
- package/dist/contracts/index.js +3 -3
- package/dist/contracts/index.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/accManager/accManager.js +1 -1
- package/dist/entities/accManager/accManager.js.map +1 -1
- package/dist/entities/agent/agent.js +1 -1
- package/dist/entities/agent/agent.js.map +1 -1
- package/dist/entities/exchange/exchange.d.ts +31 -3
- package/dist/entities/exchange/exchange.js +87 -2
- package/dist/entities/exchange/exchange.js.map +1 -1
- package/dist/entities/exchange/types.d.ts +5 -3
- package/dist/entities/exchange/utils.js +2 -2
- package/dist/entities/exchange/utils.js.map +1 -1
- package/dist/entities/marketHub.d.ts +1 -1
- package/dist/entities/marketHub.js +1 -1
- package/dist/entities/marketHub.js.map +1 -1
- package/dist/entities/multiTokenMerkleDistributor/multiTokenMerkleDistributorContract.js +1 -1
- package/dist/entities/multiTokenMerkleDistributor/multiTokenMerkleDistributorContract.js.map +1 -1
- package/dist/multicall/constants.d.ts +27 -0
- package/dist/multicall/constants.js +31 -0
- package/dist/multicall/constants.js.map +1 -0
- package/dist/multicall/helpers.d.ts +9 -0
- package/dist/multicall/helpers.js +40 -0
- package/dist/multicall/helpers.js.map +1 -0
- package/dist/multicall/multicall.d.ts +71 -0
- package/dist/multicall/multicall.js +250 -0
- package/dist/multicall/multicall.js.map +1 -0
- package/dist/types/encoders.js +1 -1
- package/dist/types/encoders.js.map +1 -1
- package/dist/utils/signing/agent.js +1 -1
- package/dist/utils/signing/agent.js.map +1 -1
- package/package.json +2 -1
- package/dist/contracts/distributorAbi.js.map +0 -1
- package/dist/contracts/multiTokenMerkleDistributorAbi.js.map +0 -1
- package/dist/contracts/viemAbis.js.map +0 -1
- /package/dist/contracts/{distributorAbi.d.ts → abis/distributorAbi.d.ts} +0 -0
- /package/dist/contracts/{distributorAbi.js → abis/distributorAbi.js} +0 -0
- /package/dist/contracts/{multiTokenMerkleDistributorAbi.d.ts → abis/multiTokenMerkleDistributorAbi.d.ts} +0 -0
- /package/dist/contracts/{multiTokenMerkleDistributorAbi.js → abis/multiTokenMerkleDistributorAbi.js} +0 -0
- /package/dist/contracts/{viemAbis.d.ts → abis/viemAbis.d.ts} +0 -0
- /package/dist/contracts/{viemAbis.js → abis/viemAbis.js} +0 -0
|
@@ -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,15 @@
|
|
|
1
|
+
import { Abi, Address, GetContractReturnType, PublicClient, WalletClient } from 'viem';
|
|
2
|
+
import { Contract } from '../common/types';
|
|
3
|
+
import { Multicall, MulticallFuncs } from '../multicall/multicall';
|
|
4
|
+
export declare abstract class BaseContractHelper<abi extends Abi, T extends Contract<abi> = Contract<abi>> {
|
|
5
|
+
abstract abi(): abi;
|
|
6
|
+
protected contract: MulticallFuncs<abi>;
|
|
7
|
+
protected client: PublicClient;
|
|
8
|
+
rawContract: T;
|
|
9
|
+
address: Address;
|
|
10
|
+
walletContract?: GetContractReturnType<abi, WalletClient>;
|
|
11
|
+
constructor(address: Address, { client, multicall }: {
|
|
12
|
+
client: PublicClient;
|
|
13
|
+
multicall: Multicall | undefined;
|
|
14
|
+
}, walletClient?: WalletClient);
|
|
15
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseContractHelper = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
class BaseContractHelper {
|
|
6
|
+
contract;
|
|
7
|
+
client;
|
|
8
|
+
rawContract;
|
|
9
|
+
address;
|
|
10
|
+
walletContract;
|
|
11
|
+
constructor(address, { client, multicall }, walletClient) {
|
|
12
|
+
this.address = address;
|
|
13
|
+
this.client = client;
|
|
14
|
+
const rawContract = (0, viem_1.getContract)({
|
|
15
|
+
address,
|
|
16
|
+
client,
|
|
17
|
+
abi: this.abi(),
|
|
18
|
+
});
|
|
19
|
+
this.rawContract = rawContract;
|
|
20
|
+
if (multicall) {
|
|
21
|
+
this.contract = multicall.wrap(rawContract);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this.contract = rawContract;
|
|
25
|
+
}
|
|
26
|
+
if (walletClient) {
|
|
27
|
+
this.walletContract = (0, viem_1.getContract)({
|
|
28
|
+
address,
|
|
29
|
+
client: walletClient,
|
|
30
|
+
abi: this.abi(),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.BaseContractHelper = BaseContractHelper;
|
|
36
|
+
//# sourceMappingURL=base-contract-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-contract-helper.js","sourceRoot":"","sources":["../../src/contracts/base-contract-helper.ts"],"names":[],"mappings":";;;AAAA,+BAAoG;AAIpG,MAAsB,kBAAkB;IAG5B,QAAQ,CAAsB;IAC9B,MAAM,CAAe;IACxB,WAAW,CAAI;IACf,OAAO,CAAU;IACjB,cAAc,CAA4C;IACjE,YACE,OAAgB,EAChB,EAAE,MAAM,EAAE,SAAS,EAA8D,EACjF,YAA2B;QAE3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,MAAM,WAAW,GAAG,IAAA,kBAAW,EAAC;YAC9B,OAAO;YACP,MAAM;YACN,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE;SAChB,CAAiB,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,GAAG,WAA6C,CAAC;QAChE,CAAC;QACD,IAAI,YAAY,EAAE,CAAC;YACjB,IAAI,CAAC,cAAc,GAAG,IAAA,kBAAW,EAAC;gBAChC,OAAO;gBACP,MAAM,EAAE,YAAY;gBACpB,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE;aAChB,CAAwD,CAAC;QAC5D,CAAC;IACH,CAAC;CACF;AAnCD,gDAmCC"}
|