@curvefi/api 2.53.0 → 2.53.1
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/lib/constants/abis/factory-v2/Plain2BasicWithRates.json +857 -0
- package/lib/factory/constants.js +2 -1
- package/lib/factory/factory-api.js +4 -0
- package/lib/factory/factory.js +2 -0
- package/lib/interfaces.d.ts +1 -0
- package/lib/pools/PoolTemplate.d.ts +2 -0
- package/lib/pools/PoolTemplate.js +38 -18
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,857 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"anonymous": false,
|
|
4
|
+
"inputs": [
|
|
5
|
+
{
|
|
6
|
+
"indexed": true,
|
|
7
|
+
"name": "sender",
|
|
8
|
+
"type": "address"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"indexed": true,
|
|
12
|
+
"name": "receiver",
|
|
13
|
+
"type": "address"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"indexed": false,
|
|
17
|
+
"name": "value",
|
|
18
|
+
"type": "uint256"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"name": "Transfer",
|
|
22
|
+
"type": "event"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"anonymous": false,
|
|
26
|
+
"inputs": [
|
|
27
|
+
{
|
|
28
|
+
"indexed": true,
|
|
29
|
+
"name": "owner",
|
|
30
|
+
"type": "address"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"indexed": true,
|
|
34
|
+
"name": "spender",
|
|
35
|
+
"type": "address"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"indexed": false,
|
|
39
|
+
"name": "value",
|
|
40
|
+
"type": "uint256"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"name": "Approval",
|
|
44
|
+
"type": "event"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"anonymous": false,
|
|
48
|
+
"inputs": [
|
|
49
|
+
{
|
|
50
|
+
"indexed": true,
|
|
51
|
+
"name": "buyer",
|
|
52
|
+
"type": "address"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"indexed": false,
|
|
56
|
+
"name": "sold_id",
|
|
57
|
+
"type": "int128"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"indexed": false,
|
|
61
|
+
"name": "tokens_sold",
|
|
62
|
+
"type": "uint256"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"indexed": false,
|
|
66
|
+
"name": "bought_id",
|
|
67
|
+
"type": "int128"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"indexed": false,
|
|
71
|
+
"name": "tokens_bought",
|
|
72
|
+
"type": "uint256"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"name": "TokenExchange",
|
|
76
|
+
"type": "event"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"anonymous": false,
|
|
80
|
+
"inputs": [
|
|
81
|
+
{
|
|
82
|
+
"indexed": true,
|
|
83
|
+
"name": "provider",
|
|
84
|
+
"type": "address"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"indexed": false,
|
|
88
|
+
"name": "token_amounts",
|
|
89
|
+
"type": "uint256[2]"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"indexed": false,
|
|
93
|
+
"name": "fees",
|
|
94
|
+
"type": "uint256[2]"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"indexed": false,
|
|
98
|
+
"name": "invariant",
|
|
99
|
+
"type": "uint256"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"indexed": false,
|
|
103
|
+
"name": "token_supply",
|
|
104
|
+
"type": "uint256"
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"name": "AddLiquidity",
|
|
108
|
+
"type": "event"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"anonymous": false,
|
|
112
|
+
"inputs": [
|
|
113
|
+
{
|
|
114
|
+
"indexed": true,
|
|
115
|
+
"name": "provider",
|
|
116
|
+
"type": "address"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"indexed": false,
|
|
120
|
+
"name": "token_amounts",
|
|
121
|
+
"type": "uint256[2]"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"indexed": false,
|
|
125
|
+
"name": "fees",
|
|
126
|
+
"type": "uint256[2]"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"indexed": false,
|
|
130
|
+
"name": "token_supply",
|
|
131
|
+
"type": "uint256"
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"name": "RemoveLiquidity",
|
|
135
|
+
"type": "event"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"anonymous": false,
|
|
139
|
+
"inputs": [
|
|
140
|
+
{
|
|
141
|
+
"indexed": true,
|
|
142
|
+
"name": "provider",
|
|
143
|
+
"type": "address"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"indexed": false,
|
|
147
|
+
"name": "token_amount",
|
|
148
|
+
"type": "uint256"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"indexed": false,
|
|
152
|
+
"name": "coin_amount",
|
|
153
|
+
"type": "uint256"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"indexed": false,
|
|
157
|
+
"name": "token_supply",
|
|
158
|
+
"type": "uint256"
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
"name": "RemoveLiquidityOne",
|
|
162
|
+
"type": "event"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"anonymous": false,
|
|
166
|
+
"inputs": [
|
|
167
|
+
{
|
|
168
|
+
"indexed": true,
|
|
169
|
+
"name": "provider",
|
|
170
|
+
"type": "address"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"indexed": false,
|
|
174
|
+
"name": "token_amounts",
|
|
175
|
+
"type": "uint256[2]"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"indexed": false,
|
|
179
|
+
"name": "fees",
|
|
180
|
+
"type": "uint256[2]"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"indexed": false,
|
|
184
|
+
"name": "invariant",
|
|
185
|
+
"type": "uint256"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"indexed": false,
|
|
189
|
+
"name": "token_supply",
|
|
190
|
+
"type": "uint256"
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"name": "RemoveLiquidityImbalance",
|
|
194
|
+
"type": "event"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"anonymous": false,
|
|
198
|
+
"inputs": [
|
|
199
|
+
{
|
|
200
|
+
"indexed": false,
|
|
201
|
+
"name": "old_A",
|
|
202
|
+
"type": "uint256"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"indexed": false,
|
|
206
|
+
"name": "new_A",
|
|
207
|
+
"type": "uint256"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"indexed": false,
|
|
211
|
+
"name": "initial_time",
|
|
212
|
+
"type": "uint256"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"indexed": false,
|
|
216
|
+
"name": "future_time",
|
|
217
|
+
"type": "uint256"
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
"name": "RampA",
|
|
221
|
+
"type": "event"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"anonymous": false,
|
|
225
|
+
"inputs": [
|
|
226
|
+
{
|
|
227
|
+
"indexed": false,
|
|
228
|
+
"name": "A",
|
|
229
|
+
"type": "uint256"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"indexed": false,
|
|
233
|
+
"name": "t",
|
|
234
|
+
"type": "uint256"
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
"name": "StopRampA",
|
|
238
|
+
"type": "event"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"inputs": [],
|
|
242
|
+
"outputs": [],
|
|
243
|
+
"stateMutability": "nonpayable",
|
|
244
|
+
"type": "constructor"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"gas": "464602",
|
|
248
|
+
"inputs": [
|
|
249
|
+
{
|
|
250
|
+
"name": "_name",
|
|
251
|
+
"type": "string"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"name": "_symbol",
|
|
255
|
+
"type": "string"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"name": "_coins",
|
|
259
|
+
"type": "address[4]"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"name": "_rate_multipliers",
|
|
263
|
+
"type": "uint256[4]"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"name": "_A",
|
|
267
|
+
"type": "uint256"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"name": "_fee",
|
|
271
|
+
"type": "uint256"
|
|
272
|
+
}
|
|
273
|
+
],
|
|
274
|
+
"name": "initialize",
|
|
275
|
+
"outputs": [],
|
|
276
|
+
"stateMutability": "nonpayable",
|
|
277
|
+
"type": "function"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"gas": "318",
|
|
281
|
+
"inputs": [],
|
|
282
|
+
"name": "decimals",
|
|
283
|
+
"outputs": [
|
|
284
|
+
{
|
|
285
|
+
"name": "",
|
|
286
|
+
"type": "uint256"
|
|
287
|
+
}
|
|
288
|
+
],
|
|
289
|
+
"stateMutability": "view",
|
|
290
|
+
"type": "function"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"gas": "75377",
|
|
294
|
+
"inputs": [
|
|
295
|
+
{
|
|
296
|
+
"name": "_to",
|
|
297
|
+
"type": "address"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"name": "_value",
|
|
301
|
+
"type": "uint256"
|
|
302
|
+
}
|
|
303
|
+
],
|
|
304
|
+
"name": "transfer",
|
|
305
|
+
"outputs": [
|
|
306
|
+
{
|
|
307
|
+
"name": "",
|
|
308
|
+
"type": "bool"
|
|
309
|
+
}
|
|
310
|
+
],
|
|
311
|
+
"stateMutability": "nonpayable",
|
|
312
|
+
"type": "function"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"gas": "112012",
|
|
316
|
+
"inputs": [
|
|
317
|
+
{
|
|
318
|
+
"name": "_from",
|
|
319
|
+
"type": "address"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"name": "_to",
|
|
323
|
+
"type": "address"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"name": "_value",
|
|
327
|
+
"type": "uint256"
|
|
328
|
+
}
|
|
329
|
+
],
|
|
330
|
+
"name": "transferFrom",
|
|
331
|
+
"outputs": [
|
|
332
|
+
{
|
|
333
|
+
"name": "",
|
|
334
|
+
"type": "bool"
|
|
335
|
+
}
|
|
336
|
+
],
|
|
337
|
+
"stateMutability": "nonpayable",
|
|
338
|
+
"type": "function"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"gas": "37851",
|
|
342
|
+
"inputs": [
|
|
343
|
+
{
|
|
344
|
+
"name": "_spender",
|
|
345
|
+
"type": "address"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"name": "_value",
|
|
349
|
+
"type": "uint256"
|
|
350
|
+
}
|
|
351
|
+
],
|
|
352
|
+
"name": "approve",
|
|
353
|
+
"outputs": [
|
|
354
|
+
{
|
|
355
|
+
"name": "",
|
|
356
|
+
"type": "bool"
|
|
357
|
+
}
|
|
358
|
+
],
|
|
359
|
+
"stateMutability": "nonpayable",
|
|
360
|
+
"type": "function"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"gas": "2107",
|
|
364
|
+
"inputs": [],
|
|
365
|
+
"name": "get_balances",
|
|
366
|
+
"outputs": [
|
|
367
|
+
{
|
|
368
|
+
"name": "",
|
|
369
|
+
"type": "uint256[2]"
|
|
370
|
+
}
|
|
371
|
+
],
|
|
372
|
+
"stateMutability": "view",
|
|
373
|
+
"type": "function"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"gas": "468",
|
|
377
|
+
"inputs": [],
|
|
378
|
+
"name": "admin_fee",
|
|
379
|
+
"outputs": [
|
|
380
|
+
{
|
|
381
|
+
"name": "",
|
|
382
|
+
"type": "uint256"
|
|
383
|
+
}
|
|
384
|
+
],
|
|
385
|
+
"stateMutability": "view",
|
|
386
|
+
"type": "function"
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"gas": "5564",
|
|
390
|
+
"inputs": [],
|
|
391
|
+
"name": "A",
|
|
392
|
+
"outputs": [
|
|
393
|
+
{
|
|
394
|
+
"name": "",
|
|
395
|
+
"type": "uint256"
|
|
396
|
+
}
|
|
397
|
+
],
|
|
398
|
+
"stateMutability": "view",
|
|
399
|
+
"type": "function"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
"gas": "5526",
|
|
403
|
+
"inputs": [],
|
|
404
|
+
"name": "A_precise",
|
|
405
|
+
"outputs": [
|
|
406
|
+
{
|
|
407
|
+
"name": "",
|
|
408
|
+
"type": "uint256"
|
|
409
|
+
}
|
|
410
|
+
],
|
|
411
|
+
"stateMutability": "view",
|
|
412
|
+
"type": "function"
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"gas": "836956",
|
|
416
|
+
"inputs": [],
|
|
417
|
+
"name": "get_virtual_price",
|
|
418
|
+
"outputs": [
|
|
419
|
+
{
|
|
420
|
+
"name": "",
|
|
421
|
+
"type": "uint256"
|
|
422
|
+
}
|
|
423
|
+
],
|
|
424
|
+
"stateMutability": "view",
|
|
425
|
+
"type": "function"
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"gas": "3322008",
|
|
429
|
+
"inputs": [
|
|
430
|
+
{
|
|
431
|
+
"name": "_amounts",
|
|
432
|
+
"type": "uint256[2]"
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
"name": "_is_deposit",
|
|
436
|
+
"type": "bool"
|
|
437
|
+
}
|
|
438
|
+
],
|
|
439
|
+
"name": "calc_token_amount",
|
|
440
|
+
"outputs": [
|
|
441
|
+
{
|
|
442
|
+
"name": "",
|
|
443
|
+
"type": "uint256"
|
|
444
|
+
}
|
|
445
|
+
],
|
|
446
|
+
"stateMutability": "view",
|
|
447
|
+
"type": "function"
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
"inputs": [
|
|
451
|
+
{
|
|
452
|
+
"name": "_amounts",
|
|
453
|
+
"type": "uint256[2]"
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
"name": "_min_mint_amount",
|
|
457
|
+
"type": "uint256"
|
|
458
|
+
}
|
|
459
|
+
],
|
|
460
|
+
"name": "add_liquidity",
|
|
461
|
+
"outputs": [
|
|
462
|
+
{
|
|
463
|
+
"name": "",
|
|
464
|
+
"type": "uint256"
|
|
465
|
+
}
|
|
466
|
+
],
|
|
467
|
+
"stateMutability": "nonpayable",
|
|
468
|
+
"type": "function"
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
"gas": "2100691",
|
|
472
|
+
"inputs": [
|
|
473
|
+
{
|
|
474
|
+
"name": "i",
|
|
475
|
+
"type": "int128"
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
"name": "j",
|
|
479
|
+
"type": "int128"
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"name": "dx",
|
|
483
|
+
"type": "uint256"
|
|
484
|
+
}
|
|
485
|
+
],
|
|
486
|
+
"name": "get_dy",
|
|
487
|
+
"outputs": [
|
|
488
|
+
{
|
|
489
|
+
"name": "",
|
|
490
|
+
"type": "uint256"
|
|
491
|
+
}
|
|
492
|
+
],
|
|
493
|
+
"stateMutability": "view",
|
|
494
|
+
"type": "function"
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"inputs": [
|
|
498
|
+
{
|
|
499
|
+
"name": "i",
|
|
500
|
+
"type": "int128"
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"name": "j",
|
|
504
|
+
"type": "int128"
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
"name": "_dx",
|
|
508
|
+
"type": "uint256"
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
"name": "_min_dy",
|
|
512
|
+
"type": "uint256"
|
|
513
|
+
}
|
|
514
|
+
],
|
|
515
|
+
"name": "exchange",
|
|
516
|
+
"outputs": [
|
|
517
|
+
{
|
|
518
|
+
"name": "",
|
|
519
|
+
"type": "uint256"
|
|
520
|
+
}
|
|
521
|
+
],
|
|
522
|
+
"stateMutability": "nonpayable",
|
|
523
|
+
"type": "function"
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
"inputs": [
|
|
527
|
+
{
|
|
528
|
+
"name": "_burn_amount",
|
|
529
|
+
"type": "uint256"
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"name": "_min_amounts",
|
|
533
|
+
"type": "uint256[2]"
|
|
534
|
+
}
|
|
535
|
+
],
|
|
536
|
+
"name": "remove_liquidity",
|
|
537
|
+
"outputs": [
|
|
538
|
+
{
|
|
539
|
+
"name": "",
|
|
540
|
+
"type": "uint256[2]"
|
|
541
|
+
}
|
|
542
|
+
],
|
|
543
|
+
"stateMutability": "nonpayable",
|
|
544
|
+
"type": "function"
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
"inputs": [
|
|
548
|
+
{
|
|
549
|
+
"name": "_amounts",
|
|
550
|
+
"type": "uint256[2]"
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
"name": "_max_burn_amount",
|
|
554
|
+
"type": "uint256"
|
|
555
|
+
}
|
|
556
|
+
],
|
|
557
|
+
"name": "remove_liquidity_imbalance",
|
|
558
|
+
"outputs": [
|
|
559
|
+
{
|
|
560
|
+
"name": "",
|
|
561
|
+
"type": "uint256"
|
|
562
|
+
}
|
|
563
|
+
],
|
|
564
|
+
"stateMutability": "nonpayable",
|
|
565
|
+
"type": "function"
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
"gas": "1100",
|
|
569
|
+
"inputs": [
|
|
570
|
+
{
|
|
571
|
+
"name": "_burn_amount",
|
|
572
|
+
"type": "uint256"
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
"name": "i",
|
|
576
|
+
"type": "int128"
|
|
577
|
+
}
|
|
578
|
+
],
|
|
579
|
+
"name": "calc_withdraw_one_coin",
|
|
580
|
+
"outputs": [
|
|
581
|
+
{
|
|
582
|
+
"name": "",
|
|
583
|
+
"type": "uint256"
|
|
584
|
+
}
|
|
585
|
+
],
|
|
586
|
+
"stateMutability": "view",
|
|
587
|
+
"type": "function"
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
"inputs": [
|
|
591
|
+
{
|
|
592
|
+
"name": "_burn_amount",
|
|
593
|
+
"type": "uint256"
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
"name": "i",
|
|
597
|
+
"type": "int128"
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
"name": "_min_received",
|
|
601
|
+
"type": "uint256"
|
|
602
|
+
}
|
|
603
|
+
],
|
|
604
|
+
"name": "remove_liquidity_one_coin",
|
|
605
|
+
"outputs": [
|
|
606
|
+
{
|
|
607
|
+
"name": "",
|
|
608
|
+
"type": "uint256"
|
|
609
|
+
}
|
|
610
|
+
],
|
|
611
|
+
"stateMutability": "nonpayable",
|
|
612
|
+
"type": "function"
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
"gas": "152901",
|
|
616
|
+
"inputs": [
|
|
617
|
+
{
|
|
618
|
+
"name": "_future_A",
|
|
619
|
+
"type": "uint256"
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
"name": "_future_time",
|
|
623
|
+
"type": "uint256"
|
|
624
|
+
}
|
|
625
|
+
],
|
|
626
|
+
"name": "ramp_A",
|
|
627
|
+
"outputs": [],
|
|
628
|
+
"stateMutability": "nonpayable",
|
|
629
|
+
"type": "function"
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
"gas": "149665",
|
|
633
|
+
"inputs": [],
|
|
634
|
+
"name": "stop_ramp_A",
|
|
635
|
+
"outputs": [],
|
|
636
|
+
"stateMutability": "nonpayable",
|
|
637
|
+
"type": "function"
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
"gas": "3740",
|
|
641
|
+
"inputs": [
|
|
642
|
+
{
|
|
643
|
+
"name": "i",
|
|
644
|
+
"type": "uint256"
|
|
645
|
+
}
|
|
646
|
+
],
|
|
647
|
+
"name": "admin_balances",
|
|
648
|
+
"outputs": [
|
|
649
|
+
{
|
|
650
|
+
"name": "",
|
|
651
|
+
"type": "uint256"
|
|
652
|
+
}
|
|
653
|
+
],
|
|
654
|
+
"stateMutability": "view",
|
|
655
|
+
"type": "function"
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
"gas": "14082",
|
|
659
|
+
"inputs": [],
|
|
660
|
+
"name": "withdraw_admin_fees",
|
|
661
|
+
"outputs": [],
|
|
662
|
+
"stateMutability": "nonpayable",
|
|
663
|
+
"type": "function"
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
"gas": "1793",
|
|
667
|
+
"inputs": [
|
|
668
|
+
{
|
|
669
|
+
"name": "arg0",
|
|
670
|
+
"type": "uint256"
|
|
671
|
+
}
|
|
672
|
+
],
|
|
673
|
+
"name": "coins",
|
|
674
|
+
"outputs": [
|
|
675
|
+
{
|
|
676
|
+
"name": "",
|
|
677
|
+
"type": "address"
|
|
678
|
+
}
|
|
679
|
+
],
|
|
680
|
+
"stateMutability": "view",
|
|
681
|
+
"type": "function"
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
"gas": "1823",
|
|
685
|
+
"inputs": [
|
|
686
|
+
{
|
|
687
|
+
"name": "arg0",
|
|
688
|
+
"type": "uint256"
|
|
689
|
+
}
|
|
690
|
+
],
|
|
691
|
+
"name": "balances",
|
|
692
|
+
"outputs": [
|
|
693
|
+
{
|
|
694
|
+
"name": "",
|
|
695
|
+
"type": "uint256"
|
|
696
|
+
}
|
|
697
|
+
],
|
|
698
|
+
"stateMutability": "view",
|
|
699
|
+
"type": "function"
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
"gas": "1808",
|
|
703
|
+
"inputs": [],
|
|
704
|
+
"name": "fee",
|
|
705
|
+
"outputs": [
|
|
706
|
+
{
|
|
707
|
+
"name": "",
|
|
708
|
+
"type": "uint256"
|
|
709
|
+
}
|
|
710
|
+
],
|
|
711
|
+
"stateMutability": "view",
|
|
712
|
+
"type": "function"
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
"gas": "1838",
|
|
716
|
+
"inputs": [],
|
|
717
|
+
"name": "initial_A",
|
|
718
|
+
"outputs": [
|
|
719
|
+
{
|
|
720
|
+
"name": "",
|
|
721
|
+
"type": "uint256"
|
|
722
|
+
}
|
|
723
|
+
],
|
|
724
|
+
"stateMutability": "view",
|
|
725
|
+
"type": "function"
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
"gas": "1868",
|
|
729
|
+
"inputs": [],
|
|
730
|
+
"name": "future_A",
|
|
731
|
+
"outputs": [
|
|
732
|
+
{
|
|
733
|
+
"name": "",
|
|
734
|
+
"type": "uint256"
|
|
735
|
+
}
|
|
736
|
+
],
|
|
737
|
+
"stateMutability": "view",
|
|
738
|
+
"type": "function"
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
"gas": "1898",
|
|
742
|
+
"inputs": [],
|
|
743
|
+
"name": "initial_A_time",
|
|
744
|
+
"outputs": [
|
|
745
|
+
{
|
|
746
|
+
"name": "",
|
|
747
|
+
"type": "uint256"
|
|
748
|
+
}
|
|
749
|
+
],
|
|
750
|
+
"stateMutability": "view",
|
|
751
|
+
"type": "function"
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
"gas": "1928",
|
|
755
|
+
"inputs": [],
|
|
756
|
+
"name": "future_A_time",
|
|
757
|
+
"outputs": [
|
|
758
|
+
{
|
|
759
|
+
"name": "",
|
|
760
|
+
"type": "uint256"
|
|
761
|
+
}
|
|
762
|
+
],
|
|
763
|
+
"stateMutability": "view",
|
|
764
|
+
"type": "function"
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
"gas": "8288",
|
|
768
|
+
"inputs": [],
|
|
769
|
+
"name": "name",
|
|
770
|
+
"outputs": [
|
|
771
|
+
{
|
|
772
|
+
"name": "",
|
|
773
|
+
"type": "string"
|
|
774
|
+
}
|
|
775
|
+
],
|
|
776
|
+
"stateMutability": "view",
|
|
777
|
+
"type": "function"
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
"gas": "7341",
|
|
781
|
+
"inputs": [],
|
|
782
|
+
"name": "symbol",
|
|
783
|
+
"outputs": [
|
|
784
|
+
{
|
|
785
|
+
"name": "",
|
|
786
|
+
"type": "string"
|
|
787
|
+
}
|
|
788
|
+
],
|
|
789
|
+
"stateMutability": "view",
|
|
790
|
+
"type": "function"
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
"gas": "2233",
|
|
794
|
+
"inputs": [
|
|
795
|
+
{
|
|
796
|
+
"name": "arg0",
|
|
797
|
+
"type": "address"
|
|
798
|
+
}
|
|
799
|
+
],
|
|
800
|
+
"name": "balanceOf",
|
|
801
|
+
"outputs": [
|
|
802
|
+
{
|
|
803
|
+
"name": "",
|
|
804
|
+
"type": "uint256"
|
|
805
|
+
}
|
|
806
|
+
],
|
|
807
|
+
"stateMutability": "view",
|
|
808
|
+
"type": "function"
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
"gas": "2478",
|
|
812
|
+
"inputs": [
|
|
813
|
+
{
|
|
814
|
+
"name": "arg0",
|
|
815
|
+
"type": "address"
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
"name": "arg1",
|
|
819
|
+
"type": "address"
|
|
820
|
+
}
|
|
821
|
+
],
|
|
822
|
+
"name": "allowance",
|
|
823
|
+
"outputs": [
|
|
824
|
+
{
|
|
825
|
+
"name": "",
|
|
826
|
+
"type": "uint256"
|
|
827
|
+
}
|
|
828
|
+
],
|
|
829
|
+
"stateMutability": "view",
|
|
830
|
+
"type": "function"
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
"stateMutability": "view",
|
|
834
|
+
"type": "function",
|
|
835
|
+
"name": "stored_rates",
|
|
836
|
+
"inputs": [],
|
|
837
|
+
"outputs": [
|
|
838
|
+
{
|
|
839
|
+
"name": "",
|
|
840
|
+
"type": "uint256[2]"
|
|
841
|
+
}
|
|
842
|
+
]
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
"gas": "2078",
|
|
846
|
+
"inputs": [],
|
|
847
|
+
"name": "totalSupply",
|
|
848
|
+
"outputs": [
|
|
849
|
+
{
|
|
850
|
+
"name": "",
|
|
851
|
+
"type": "uint256"
|
|
852
|
+
}
|
|
853
|
+
],
|
|
854
|
+
"stateMutability": "view",
|
|
855
|
+
"type": "function"
|
|
856
|
+
}
|
|
857
|
+
]
|
package/lib/factory/constants.js
CHANGED
|
@@ -11,6 +11,7 @@ import MetaSbtc2ABI from "../constants/abis/factory-v2/MetaSbtc2.json" assert {
|
|
|
11
11
|
import MetaSbtc2BalancesABI from "../constants/abis/factory-v2/MetaSbtc2Balance.json" assert { type: 'json' };
|
|
12
12
|
import MetaUSDGeistABI from "../constants/abis/factory-v2/MetaUSDGeist.json" assert { type: 'json' };
|
|
13
13
|
import Plain2BasicABI from "../constants/abis/factory-v2/Plain2Basic.json" assert { type: 'json' };
|
|
14
|
+
import Plain2BasicWithRatesABI from "../constants/abis/factory-v2/Plain2BasicWithRates.json" assert { type: 'json' };
|
|
14
15
|
import Plain2BalancesABI from "../constants/abis/factory-v2/Plain2Balances.json" assert { type: 'json' };
|
|
15
16
|
import Plain2ETHABI from "../constants/abis/factory-v2/Plain2ETH.json" assert { type: 'json' };
|
|
16
17
|
import Plain2ETHOracleABI from "../constants/abis/factory-v2/Plain2ETHOracle.json" assert { type: 'json' };
|
|
@@ -63,7 +64,7 @@ export var implementationABIDictEthereum = lowerCaseKeys({
|
|
|
63
64
|
// !!! crvUSD Factory !!!
|
|
64
65
|
"0x67fe41A94e779CcFa22cff02cc2957DC9C0e4286": Plain2BasicABI,
|
|
65
66
|
"0x7Ca46A636b02D4aBC66883D7FF164bDE506DC66a": Plain2BalancesABI,
|
|
66
|
-
"0x36Dc03C0e12a1C241306a6A8F327Fe28bA2Be5b0":
|
|
67
|
+
"0x36Dc03C0e12a1C241306a6A8F327Fe28bA2Be5b0": Plain2BasicWithRatesABI,
|
|
67
68
|
// !!! crvUSD Factory !!!
|
|
68
69
|
"0x9B52F13DF69D79Ec5aAB6D1aCe3157d29B409cC3": Plain3BasicABI,
|
|
69
70
|
"0x50b085f2e5958C4A87baf93A8AB79F6bec068494": Plain3BalancesABI,
|
|
@@ -203,6 +203,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
|
|
|
203
203
|
gauge_abi: _this.chainId === 1 ? factoryGaugeABI : gaugeChildABI,
|
|
204
204
|
deposit_abi: basePoolZap.ABI,
|
|
205
205
|
in_api: true,
|
|
206
|
+
is_stable_ng: false,
|
|
206
207
|
};
|
|
207
208
|
}
|
|
208
209
|
else {
|
|
@@ -226,6 +227,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
|
|
|
226
227
|
swap_abi: factoryType === "factory-tricrypto" ? tricryptoFactorySwapABI : cryptoFactorySwapABI,
|
|
227
228
|
gauge_abi: _this.chainId === 1 ? factoryGaugeABI : gaugeChildABI,
|
|
228
229
|
in_api: true,
|
|
230
|
+
is_stable_ng: false,
|
|
229
231
|
};
|
|
230
232
|
}
|
|
231
233
|
}
|
|
@@ -261,6 +263,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
|
|
|
261
263
|
gauge_abi: _this.chainId === 1 ? factoryGaugeABI : gaugeChildABI,
|
|
262
264
|
deposit_abi: basePoolZap.ABI,
|
|
263
265
|
in_api: true,
|
|
266
|
+
is_stable_ng: factoryType === 'factory-stable-ng',
|
|
264
267
|
};
|
|
265
268
|
}
|
|
266
269
|
else {
|
|
@@ -285,6 +288,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
|
|
|
285
288
|
swap_abi: implementationABIDict[pool.implementationAddress],
|
|
286
289
|
gauge_abi: _this.chainId === 1 ? factoryGaugeABI : gaugeChildABI,
|
|
287
290
|
in_api: true,
|
|
291
|
+
is_stable_ng: factoryType === 'factory-stable-ng',
|
|
288
292
|
};
|
|
289
293
|
}
|
|
290
294
|
});
|
package/lib/factory/factory.js
CHANGED
|
@@ -414,6 +414,7 @@ export function getFactoryPoolData(fromIdx, swapAddress, factoryAddress) {
|
|
|
414
414
|
wrapped_decimals: __spreadArray([], coinAddresses[i].map(function (addr) { return coinAddressDecimalsDict[addr]; }), true),
|
|
415
415
|
swap_abi: swapABIs[i],
|
|
416
416
|
gauge_abi: this_1.chainId === 1 ? factoryGaugeABI : gaugeChildABI,
|
|
417
|
+
is_stable_ng: factoryAddress === curve.constants.ALIASES.stable_ng_factory,
|
|
417
418
|
};
|
|
418
419
|
}
|
|
419
420
|
else {
|
|
@@ -448,6 +449,7 @@ export function getFactoryPoolData(fromIdx, swapAddress, factoryAddress) {
|
|
|
448
449
|
swap_abi: swapABIs[i],
|
|
449
450
|
gauge_abi: this_1.chainId === 1 ? factoryGaugeABI : gaugeChildABI,
|
|
450
451
|
deposit_abi: basePoolZap.ABI,
|
|
452
|
+
is_stable_ng: factoryAddress === curve.constants.ALIASES.stable_ng_factory,
|
|
451
453
|
};
|
|
452
454
|
}
|
|
453
455
|
};
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare class PoolTemplate {
|
|
|
20
20
|
isFake: boolean;
|
|
21
21
|
isFactory: boolean;
|
|
22
22
|
isMetaFactory: boolean;
|
|
23
|
+
isStableNg: boolean;
|
|
23
24
|
isLlamma: boolean;
|
|
24
25
|
basePool: string;
|
|
25
26
|
metaCoinIdx: number;
|
|
@@ -258,6 +259,7 @@ export declare class PoolTemplate {
|
|
|
258
259
|
private _getCoinIdx;
|
|
259
260
|
private _getRates;
|
|
260
261
|
private _balances;
|
|
262
|
+
private _stored_rates;
|
|
261
263
|
private _underlyingPrices;
|
|
262
264
|
private _wrappedPrices;
|
|
263
265
|
}
|
|
@@ -56,7 +56,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
56
56
|
};
|
|
57
57
|
import memoize from "memoizee";
|
|
58
58
|
import { _getPoolsFromApi, _getSubgraphData, _getFactoryAPYsAndVolumes, _getLegacyAPYsAndVolumes } from '../external-api.js';
|
|
59
|
-
import { _getCoinAddresses, _getBalances, _prepareAddresses, _ensureAllowance, _getUsdRate, hasAllowance, ensureAllowance, ensureAllowanceEstimateGas, BN, toBN, toStringFromBN, parseUnits, getEthIndex, fromBN, _cutZeros, _setContracts, _get_small_x, _get_price_impact, checkNumber, _getCrvApyFromApi, _getRewardsFromApi, mulBy1_3, smartNumber, DIGas, _getAddress, } from '../utils.js';
|
|
59
|
+
import { _getCoinAddresses, _getBalances, _prepareAddresses, _ensureAllowance, _getUsdRate, hasAllowance, ensureAllowance, ensureAllowanceEstimateGas, BN, toBN, toStringFromBN, parseUnits, getEthIndex, fromBN, _cutZeros, _setContracts, _get_small_x, _get_price_impact, checkNumber, _getCrvApyFromApi, _getRewardsFromApi, mulBy1_3, smartNumber, DIGas, _getAddress, isMethodExist, } from '../utils.js';
|
|
60
60
|
import { curve } from "../curve.js";
|
|
61
61
|
import ERC20Abi from '../constants/abis/ERC20.json' assert { type: 'json' };
|
|
62
62
|
var DAY = 86400;
|
|
@@ -1145,6 +1145,14 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1145
1145
|
});
|
|
1146
1146
|
});
|
|
1147
1147
|
};
|
|
1148
|
+
this._stored_rates = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1149
|
+
return __generator(this, function (_c) {
|
|
1150
|
+
switch (_c.label) {
|
|
1151
|
+
case 0: return [4 /*yield*/, curve.contracts[this.address].contract.stored_rates()];
|
|
1152
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
1153
|
+
}
|
|
1154
|
+
});
|
|
1155
|
+
}); };
|
|
1148
1156
|
this._underlyingPrices = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1149
1157
|
var promises, _i, _c, addr;
|
|
1150
1158
|
return __generator(this, function (_d) {
|
|
@@ -1196,6 +1204,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1196
1204
|
this.isFake = poolData.is_fake || false;
|
|
1197
1205
|
this.isFactory = poolData.is_factory || false;
|
|
1198
1206
|
this.isMetaFactory = (this.isMeta && this.isFactory) || this.zap === '0xa79828df1850e8a3a3064576f380d90aecdd3359';
|
|
1207
|
+
this.isStableNg = poolData.is_stable_ng || false;
|
|
1199
1208
|
this.isLlamma = poolData.is_llamma || false;
|
|
1200
1209
|
this.basePool = poolData.base_pool || '';
|
|
1201
1210
|
this.metaCoinIdx = this.isMeta ? (_c = poolData.meta_coin_idx) !== null && _c !== void 0 ? _c : poolData.wrapped_coins.length - 1 : -1;
|
|
@@ -1496,34 +1505,45 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1496
1505
|
};
|
|
1497
1506
|
PoolTemplate.prototype.depositBonus = function (amounts) {
|
|
1498
1507
|
return __awaiter(this, void 0, void 0, function () {
|
|
1499
|
-
var amountsBN, prices,
|
|
1500
|
-
|
|
1501
|
-
|
|
1508
|
+
var amountsBN, prices, isUseStoredRates, result, pricesBN, balancesBN, balancedAmounts, expectedBN, _c, balancedExpectedBN, _d;
|
|
1509
|
+
var _this = this;
|
|
1510
|
+
return __generator(this, function (_e) {
|
|
1511
|
+
switch (_e.label) {
|
|
1502
1512
|
case 0:
|
|
1503
1513
|
amountsBN = amounts.map(BN);
|
|
1504
|
-
|
|
1514
|
+
prices = [];
|
|
1515
|
+
isUseStoredRates = isMethodExist(curve.contracts[this.address].contract, 'stored_rates') && this.isPlain;
|
|
1516
|
+
if (!(this.isCrypto || this.id === 'wsteth')) return [3 /*break*/, 2];
|
|
1505
1517
|
return [4 /*yield*/, this._underlyingPrices()];
|
|
1506
1518
|
case 1:
|
|
1507
|
-
|
|
1508
|
-
return [3 /*break*/,
|
|
1519
|
+
prices = _e.sent();
|
|
1520
|
+
return [3 /*break*/, 5];
|
|
1509
1521
|
case 2:
|
|
1510
|
-
|
|
1511
|
-
|
|
1522
|
+
if (!isUseStoredRates) return [3 /*break*/, 4];
|
|
1523
|
+
return [4 /*yield*/, this._stored_rates()];
|
|
1512
1524
|
case 3:
|
|
1513
|
-
|
|
1525
|
+
result = _e.sent();
|
|
1526
|
+
result.forEach(function (item, index) {
|
|
1527
|
+
prices.push(Number(item) / (Math.pow(10, (36 - _this.underlyingDecimals[index]))));
|
|
1528
|
+
});
|
|
1529
|
+
return [3 /*break*/, 5];
|
|
1530
|
+
case 4:
|
|
1531
|
+
prices = this.underlyingCoins.map(function () { return 1; });
|
|
1532
|
+
_e.label = 5;
|
|
1533
|
+
case 5:
|
|
1514
1534
|
pricesBN = prices.map(BN);
|
|
1515
1535
|
return [4 /*yield*/, this.stats.underlyingBalances()];
|
|
1516
|
-
case
|
|
1517
|
-
balancesBN = (
|
|
1536
|
+
case 6:
|
|
1537
|
+
balancesBN = (_e.sent()).map(BN);
|
|
1518
1538
|
balancedAmounts = this._balancedAmountsWithSameValue(amountsBN, pricesBN, balancesBN);
|
|
1519
|
-
|
|
1539
|
+
_c = BN;
|
|
1520
1540
|
return [4 /*yield*/, this.depositExpected(amounts)];
|
|
1521
|
-
case
|
|
1522
|
-
expectedBN =
|
|
1523
|
-
|
|
1541
|
+
case 7:
|
|
1542
|
+
expectedBN = _c.apply(void 0, [_e.sent()]);
|
|
1543
|
+
_d = BN;
|
|
1524
1544
|
return [4 /*yield*/, this.depositExpected(balancedAmounts)];
|
|
1525
|
-
case
|
|
1526
|
-
balancedExpectedBN =
|
|
1545
|
+
case 8:
|
|
1546
|
+
balancedExpectedBN = _d.apply(void 0, [_e.sent()]);
|
|
1527
1547
|
return [2 /*return*/, String(expectedBN.minus(balancedExpectedBN).div(balancedExpectedBN).times(100))];
|
|
1528
1548
|
}
|
|
1529
1549
|
});
|
package/lib/utils.d.ts
CHANGED
|
@@ -57,5 +57,6 @@ export declare const getCoinsData: (...coins: string[] | string[][]) => Promise<
|
|
|
57
57
|
export declare const hasDepositAndStake: () => boolean;
|
|
58
58
|
export declare const hasRouter: () => boolean;
|
|
59
59
|
export declare const getCountArgsOfMethodByContract: (contract: Contract, methodName: string) => number;
|
|
60
|
+
export declare const isMethodExist: (contract: Contract, methodName: string) => boolean;
|
|
60
61
|
export declare const getPoolName: (name: string) => string;
|
|
61
62
|
export declare const assetTypeNameHandler: (assetTypeName: string) => REFERENCE_ASSET;
|
package/lib/utils.js
CHANGED
|
@@ -914,6 +914,15 @@ export var getCountArgsOfMethodByContract = function (contract, methodName) {
|
|
|
914
914
|
return -1;
|
|
915
915
|
}
|
|
916
916
|
};
|
|
917
|
+
export var isMethodExist = function (contract, methodName) {
|
|
918
|
+
var func = contract.interface.fragments.find(function (item) { return item.name === methodName; });
|
|
919
|
+
if (func) {
|
|
920
|
+
return true;
|
|
921
|
+
}
|
|
922
|
+
else {
|
|
923
|
+
return false;
|
|
924
|
+
}
|
|
925
|
+
};
|
|
917
926
|
export var getPoolName = function (name) {
|
|
918
927
|
var separatedName = name.split(": ");
|
|
919
928
|
if (separatedName.length > 1) {
|