@curvefi/api 2.15.1 → 2.16.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.
- package/lib/constants/abis/frxeth/swap.json +889 -0
- package/lib/constants/coins/ethereum.js +1 -0
- package/lib/constants/pools/ethereum.js +25 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/pools/PoolTemplate.js +8 -14
- package/lib/pools/utils.d.ts +3 -0
- package/lib/pools/utils.js +80 -15
- package/package.json +1 -1
|
@@ -0,0 +1,889 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "TokenExchange",
|
|
4
|
+
"inputs": [
|
|
5
|
+
{
|
|
6
|
+
"name": "buyer",
|
|
7
|
+
"type": "address",
|
|
8
|
+
"indexed": true
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "sold_id",
|
|
12
|
+
"type": "int128",
|
|
13
|
+
"indexed": false
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "tokens_sold",
|
|
17
|
+
"type": "uint256",
|
|
18
|
+
"indexed": false
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "bought_id",
|
|
22
|
+
"type": "int128",
|
|
23
|
+
"indexed": false
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "tokens_bought",
|
|
27
|
+
"type": "uint256",
|
|
28
|
+
"indexed": false
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"anonymous": false,
|
|
32
|
+
"type": "event"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "AddLiquidity",
|
|
36
|
+
"inputs": [
|
|
37
|
+
{
|
|
38
|
+
"name": "provider",
|
|
39
|
+
"type": "address",
|
|
40
|
+
"indexed": true
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "token_amounts",
|
|
44
|
+
"type": "uint256[2]",
|
|
45
|
+
"indexed": false
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "fees",
|
|
49
|
+
"type": "uint256[2]",
|
|
50
|
+
"indexed": false
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "invariant",
|
|
54
|
+
"type": "uint256",
|
|
55
|
+
"indexed": false
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "token_supply",
|
|
59
|
+
"type": "uint256",
|
|
60
|
+
"indexed": false
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"anonymous": false,
|
|
64
|
+
"type": "event"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "RemoveLiquidity",
|
|
68
|
+
"inputs": [
|
|
69
|
+
{
|
|
70
|
+
"name": "provider",
|
|
71
|
+
"type": "address",
|
|
72
|
+
"indexed": true
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "token_amounts",
|
|
76
|
+
"type": "uint256[2]",
|
|
77
|
+
"indexed": false
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "fees",
|
|
81
|
+
"type": "uint256[2]",
|
|
82
|
+
"indexed": false
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "token_supply",
|
|
86
|
+
"type": "uint256",
|
|
87
|
+
"indexed": false
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"anonymous": false,
|
|
91
|
+
"type": "event"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"name": "RemoveLiquidityOne",
|
|
95
|
+
"inputs": [
|
|
96
|
+
{
|
|
97
|
+
"name": "provider",
|
|
98
|
+
"type": "address",
|
|
99
|
+
"indexed": true
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"name": "token_amount",
|
|
103
|
+
"type": "uint256",
|
|
104
|
+
"indexed": false
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "coin_amount",
|
|
108
|
+
"type": "uint256",
|
|
109
|
+
"indexed": false
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "token_supply",
|
|
113
|
+
"type": "uint256",
|
|
114
|
+
"indexed": false
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"anonymous": false,
|
|
118
|
+
"type": "event"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"name": "RemoveLiquidityImbalance",
|
|
122
|
+
"inputs": [
|
|
123
|
+
{
|
|
124
|
+
"name": "provider",
|
|
125
|
+
"type": "address",
|
|
126
|
+
"indexed": true
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "token_amounts",
|
|
130
|
+
"type": "uint256[2]",
|
|
131
|
+
"indexed": false
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"name": "fees",
|
|
135
|
+
"type": "uint256[2]",
|
|
136
|
+
"indexed": false
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"name": "invariant",
|
|
140
|
+
"type": "uint256",
|
|
141
|
+
"indexed": false
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"name": "token_supply",
|
|
145
|
+
"type": "uint256",
|
|
146
|
+
"indexed": false
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"anonymous": false,
|
|
150
|
+
"type": "event"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"name": "CommitNewAdmin",
|
|
154
|
+
"inputs": [
|
|
155
|
+
{
|
|
156
|
+
"name": "deadline",
|
|
157
|
+
"type": "uint256",
|
|
158
|
+
"indexed": true
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"name": "admin",
|
|
162
|
+
"type": "address",
|
|
163
|
+
"indexed": true
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"anonymous": false,
|
|
167
|
+
"type": "event"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"name": "NewAdmin",
|
|
171
|
+
"inputs": [
|
|
172
|
+
{
|
|
173
|
+
"name": "admin",
|
|
174
|
+
"type": "address",
|
|
175
|
+
"indexed": true
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"anonymous": false,
|
|
179
|
+
"type": "event"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "CommitNewFee",
|
|
183
|
+
"inputs": [
|
|
184
|
+
{
|
|
185
|
+
"name": "deadline",
|
|
186
|
+
"type": "uint256",
|
|
187
|
+
"indexed": true
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"name": "fee",
|
|
191
|
+
"type": "uint256",
|
|
192
|
+
"indexed": false
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "admin_fee",
|
|
196
|
+
"type": "uint256",
|
|
197
|
+
"indexed": false
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"anonymous": false,
|
|
201
|
+
"type": "event"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"name": "NewFee",
|
|
205
|
+
"inputs": [
|
|
206
|
+
{
|
|
207
|
+
"name": "fee",
|
|
208
|
+
"type": "uint256",
|
|
209
|
+
"indexed": false
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "admin_fee",
|
|
213
|
+
"type": "uint256",
|
|
214
|
+
"indexed": false
|
|
215
|
+
}
|
|
216
|
+
],
|
|
217
|
+
"anonymous": false,
|
|
218
|
+
"type": "event"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"name": "RampA",
|
|
222
|
+
"inputs": [
|
|
223
|
+
{
|
|
224
|
+
"name": "old_A",
|
|
225
|
+
"type": "uint256",
|
|
226
|
+
"indexed": false
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"name": "new_A",
|
|
230
|
+
"type": "uint256",
|
|
231
|
+
"indexed": false
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"name": "initial_time",
|
|
235
|
+
"type": "uint256",
|
|
236
|
+
"indexed": false
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"name": "future_time",
|
|
240
|
+
"type": "uint256",
|
|
241
|
+
"indexed": false
|
|
242
|
+
}
|
|
243
|
+
],
|
|
244
|
+
"anonymous": false,
|
|
245
|
+
"type": "event"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"name": "StopRampA",
|
|
249
|
+
"inputs": [
|
|
250
|
+
{
|
|
251
|
+
"name": "A",
|
|
252
|
+
"type": "uint256",
|
|
253
|
+
"indexed": false
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"name": "t",
|
|
257
|
+
"type": "uint256",
|
|
258
|
+
"indexed": false
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
"anonymous": false,
|
|
262
|
+
"type": "event"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"stateMutability": "nonpayable",
|
|
266
|
+
"type": "constructor",
|
|
267
|
+
"inputs": [
|
|
268
|
+
{
|
|
269
|
+
"name": "_owner",
|
|
270
|
+
"type": "address"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"name": "_coins",
|
|
274
|
+
"type": "address[2]"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"name": "_pool_token",
|
|
278
|
+
"type": "address"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"name": "_A",
|
|
282
|
+
"type": "uint256"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"name": "_fee",
|
|
286
|
+
"type": "uint256"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"name": "_admin_fee",
|
|
290
|
+
"type": "uint256"
|
|
291
|
+
}
|
|
292
|
+
],
|
|
293
|
+
"outputs": []
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"stateMutability": "view",
|
|
297
|
+
"type": "function",
|
|
298
|
+
"name": "A",
|
|
299
|
+
"inputs": [],
|
|
300
|
+
"outputs": [
|
|
301
|
+
{
|
|
302
|
+
"name": "",
|
|
303
|
+
"type": "uint256"
|
|
304
|
+
}
|
|
305
|
+
]
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"stateMutability": "view",
|
|
309
|
+
"type": "function",
|
|
310
|
+
"name": "A_precise",
|
|
311
|
+
"inputs": [],
|
|
312
|
+
"outputs": [
|
|
313
|
+
{
|
|
314
|
+
"name": "",
|
|
315
|
+
"type": "uint256"
|
|
316
|
+
}
|
|
317
|
+
]
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"stateMutability": "view",
|
|
321
|
+
"type": "function",
|
|
322
|
+
"name": "get_p",
|
|
323
|
+
"inputs": [],
|
|
324
|
+
"outputs": [
|
|
325
|
+
{
|
|
326
|
+
"name": "",
|
|
327
|
+
"type": "uint256"
|
|
328
|
+
}
|
|
329
|
+
]
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"stateMutability": "view",
|
|
333
|
+
"type": "function",
|
|
334
|
+
"name": "price_oracle",
|
|
335
|
+
"inputs": [],
|
|
336
|
+
"outputs": [
|
|
337
|
+
{
|
|
338
|
+
"name": "",
|
|
339
|
+
"type": "uint256"
|
|
340
|
+
}
|
|
341
|
+
]
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"stateMutability": "view",
|
|
345
|
+
"type": "function",
|
|
346
|
+
"name": "get_virtual_price",
|
|
347
|
+
"inputs": [],
|
|
348
|
+
"outputs": [
|
|
349
|
+
{
|
|
350
|
+
"name": "",
|
|
351
|
+
"type": "uint256"
|
|
352
|
+
}
|
|
353
|
+
]
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"stateMutability": "view",
|
|
357
|
+
"type": "function",
|
|
358
|
+
"name": "calc_token_amount",
|
|
359
|
+
"inputs": [
|
|
360
|
+
{
|
|
361
|
+
"name": "_amounts",
|
|
362
|
+
"type": "uint256[2]"
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"name": "_is_deposit",
|
|
366
|
+
"type": "bool"
|
|
367
|
+
}
|
|
368
|
+
],
|
|
369
|
+
"outputs": [
|
|
370
|
+
{
|
|
371
|
+
"name": "",
|
|
372
|
+
"type": "uint256"
|
|
373
|
+
}
|
|
374
|
+
]
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"stateMutability": "payable",
|
|
378
|
+
"type": "function",
|
|
379
|
+
"name": "add_liquidity",
|
|
380
|
+
"inputs": [
|
|
381
|
+
{
|
|
382
|
+
"name": "_amounts",
|
|
383
|
+
"type": "uint256[2]"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"name": "_min_mint_amount",
|
|
387
|
+
"type": "uint256"
|
|
388
|
+
}
|
|
389
|
+
],
|
|
390
|
+
"outputs": [
|
|
391
|
+
{
|
|
392
|
+
"name": "",
|
|
393
|
+
"type": "uint256"
|
|
394
|
+
}
|
|
395
|
+
]
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"stateMutability": "view",
|
|
399
|
+
"type": "function",
|
|
400
|
+
"name": "get_dy",
|
|
401
|
+
"inputs": [
|
|
402
|
+
{
|
|
403
|
+
"name": "i",
|
|
404
|
+
"type": "int128"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"name": "j",
|
|
408
|
+
"type": "int128"
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
"name": "_dx",
|
|
412
|
+
"type": "uint256"
|
|
413
|
+
}
|
|
414
|
+
],
|
|
415
|
+
"outputs": [
|
|
416
|
+
{
|
|
417
|
+
"name": "",
|
|
418
|
+
"type": "uint256"
|
|
419
|
+
}
|
|
420
|
+
]
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
"stateMutability": "payable",
|
|
424
|
+
"type": "function",
|
|
425
|
+
"name": "exchange",
|
|
426
|
+
"inputs": [
|
|
427
|
+
{
|
|
428
|
+
"name": "i",
|
|
429
|
+
"type": "int128"
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"name": "j",
|
|
433
|
+
"type": "int128"
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
"name": "_dx",
|
|
437
|
+
"type": "uint256"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
"name": "_min_dy",
|
|
441
|
+
"type": "uint256"
|
|
442
|
+
}
|
|
443
|
+
],
|
|
444
|
+
"outputs": [
|
|
445
|
+
{
|
|
446
|
+
"name": "",
|
|
447
|
+
"type": "uint256"
|
|
448
|
+
}
|
|
449
|
+
]
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
"stateMutability": "nonpayable",
|
|
453
|
+
"type": "function",
|
|
454
|
+
"name": "remove_liquidity",
|
|
455
|
+
"inputs": [
|
|
456
|
+
{
|
|
457
|
+
"name": "_amount",
|
|
458
|
+
"type": "uint256"
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
"name": "_min_amounts",
|
|
462
|
+
"type": "uint256[2]"
|
|
463
|
+
}
|
|
464
|
+
],
|
|
465
|
+
"outputs": [
|
|
466
|
+
{
|
|
467
|
+
"name": "",
|
|
468
|
+
"type": "uint256[2]"
|
|
469
|
+
}
|
|
470
|
+
]
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
"stateMutability": "nonpayable",
|
|
474
|
+
"type": "function",
|
|
475
|
+
"name": "remove_liquidity_imbalance",
|
|
476
|
+
"inputs": [
|
|
477
|
+
{
|
|
478
|
+
"name": "_amounts",
|
|
479
|
+
"type": "uint256[2]"
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"name": "_max_burn_amount",
|
|
483
|
+
"type": "uint256"
|
|
484
|
+
}
|
|
485
|
+
],
|
|
486
|
+
"outputs": [
|
|
487
|
+
{
|
|
488
|
+
"name": "",
|
|
489
|
+
"type": "uint256"
|
|
490
|
+
}
|
|
491
|
+
]
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
"stateMutability": "view",
|
|
495
|
+
"type": "function",
|
|
496
|
+
"name": "calc_withdraw_one_coin",
|
|
497
|
+
"inputs": [
|
|
498
|
+
{
|
|
499
|
+
"name": "_token_amount",
|
|
500
|
+
"type": "uint256"
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"name": "i",
|
|
504
|
+
"type": "int128"
|
|
505
|
+
}
|
|
506
|
+
],
|
|
507
|
+
"outputs": [
|
|
508
|
+
{
|
|
509
|
+
"name": "",
|
|
510
|
+
"type": "uint256"
|
|
511
|
+
}
|
|
512
|
+
]
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
"stateMutability": "nonpayable",
|
|
516
|
+
"type": "function",
|
|
517
|
+
"name": "remove_liquidity_one_coin",
|
|
518
|
+
"inputs": [
|
|
519
|
+
{
|
|
520
|
+
"name": "_token_amount",
|
|
521
|
+
"type": "uint256"
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
"name": "i",
|
|
525
|
+
"type": "int128"
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
"name": "_min_amount",
|
|
529
|
+
"type": "uint256"
|
|
530
|
+
}
|
|
531
|
+
],
|
|
532
|
+
"outputs": [
|
|
533
|
+
{
|
|
534
|
+
"name": "",
|
|
535
|
+
"type": "uint256"
|
|
536
|
+
}
|
|
537
|
+
]
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
"stateMutability": "nonpayable",
|
|
541
|
+
"type": "function",
|
|
542
|
+
"name": "ramp_A",
|
|
543
|
+
"inputs": [
|
|
544
|
+
{
|
|
545
|
+
"name": "_future_A",
|
|
546
|
+
"type": "uint256"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"name": "_future_time",
|
|
550
|
+
"type": "uint256"
|
|
551
|
+
}
|
|
552
|
+
],
|
|
553
|
+
"outputs": []
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
"stateMutability": "nonpayable",
|
|
557
|
+
"type": "function",
|
|
558
|
+
"name": "stop_ramp_A",
|
|
559
|
+
"inputs": [],
|
|
560
|
+
"outputs": []
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
"stateMutability": "nonpayable",
|
|
564
|
+
"type": "function",
|
|
565
|
+
"name": "commit_new_fee",
|
|
566
|
+
"inputs": [
|
|
567
|
+
{
|
|
568
|
+
"name": "_new_fee",
|
|
569
|
+
"type": "uint256"
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
"name": "_new_admin_fee",
|
|
573
|
+
"type": "uint256"
|
|
574
|
+
}
|
|
575
|
+
],
|
|
576
|
+
"outputs": []
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
"stateMutability": "nonpayable",
|
|
580
|
+
"type": "function",
|
|
581
|
+
"name": "apply_new_fee",
|
|
582
|
+
"inputs": [],
|
|
583
|
+
"outputs": []
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"stateMutability": "nonpayable",
|
|
587
|
+
"type": "function",
|
|
588
|
+
"name": "revert_new_parameters",
|
|
589
|
+
"inputs": [],
|
|
590
|
+
"outputs": []
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
"stateMutability": "nonpayable",
|
|
594
|
+
"type": "function",
|
|
595
|
+
"name": "set_ma_exp_time",
|
|
596
|
+
"inputs": [
|
|
597
|
+
{
|
|
598
|
+
"name": "_ma_exp_time",
|
|
599
|
+
"type": "uint256"
|
|
600
|
+
}
|
|
601
|
+
],
|
|
602
|
+
"outputs": []
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
"stateMutability": "nonpayable",
|
|
606
|
+
"type": "function",
|
|
607
|
+
"name": "commit_transfer_ownership",
|
|
608
|
+
"inputs": [
|
|
609
|
+
{
|
|
610
|
+
"name": "_owner",
|
|
611
|
+
"type": "address"
|
|
612
|
+
}
|
|
613
|
+
],
|
|
614
|
+
"outputs": []
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"stateMutability": "nonpayable",
|
|
618
|
+
"type": "function",
|
|
619
|
+
"name": "apply_transfer_ownership",
|
|
620
|
+
"inputs": [],
|
|
621
|
+
"outputs": []
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
"stateMutability": "nonpayable",
|
|
625
|
+
"type": "function",
|
|
626
|
+
"name": "revert_transfer_ownership",
|
|
627
|
+
"inputs": [],
|
|
628
|
+
"outputs": []
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
"stateMutability": "view",
|
|
632
|
+
"type": "function",
|
|
633
|
+
"name": "admin_balances",
|
|
634
|
+
"inputs": [
|
|
635
|
+
{
|
|
636
|
+
"name": "i",
|
|
637
|
+
"type": "uint256"
|
|
638
|
+
}
|
|
639
|
+
],
|
|
640
|
+
"outputs": [
|
|
641
|
+
{
|
|
642
|
+
"name": "",
|
|
643
|
+
"type": "uint256"
|
|
644
|
+
}
|
|
645
|
+
]
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
"stateMutability": "nonpayable",
|
|
649
|
+
"type": "function",
|
|
650
|
+
"name": "withdraw_admin_fees",
|
|
651
|
+
"inputs": [],
|
|
652
|
+
"outputs": []
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
"stateMutability": "nonpayable",
|
|
656
|
+
"type": "function",
|
|
657
|
+
"name": "donate_admin_fees",
|
|
658
|
+
"inputs": [],
|
|
659
|
+
"outputs": []
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
"stateMutability": "nonpayable",
|
|
663
|
+
"type": "function",
|
|
664
|
+
"name": "kill_me",
|
|
665
|
+
"inputs": [],
|
|
666
|
+
"outputs": []
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
"stateMutability": "nonpayable",
|
|
670
|
+
"type": "function",
|
|
671
|
+
"name": "unkill_me",
|
|
672
|
+
"inputs": [],
|
|
673
|
+
"outputs": []
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
"stateMutability": "view",
|
|
677
|
+
"type": "function",
|
|
678
|
+
"name": "coins",
|
|
679
|
+
"inputs": [
|
|
680
|
+
{
|
|
681
|
+
"name": "arg0",
|
|
682
|
+
"type": "uint256"
|
|
683
|
+
}
|
|
684
|
+
],
|
|
685
|
+
"outputs": [
|
|
686
|
+
{
|
|
687
|
+
"name": "",
|
|
688
|
+
"type": "address"
|
|
689
|
+
}
|
|
690
|
+
]
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
"stateMutability": "view",
|
|
694
|
+
"type": "function",
|
|
695
|
+
"name": "balances",
|
|
696
|
+
"inputs": [
|
|
697
|
+
{
|
|
698
|
+
"name": "arg0",
|
|
699
|
+
"type": "uint256"
|
|
700
|
+
}
|
|
701
|
+
],
|
|
702
|
+
"outputs": [
|
|
703
|
+
{
|
|
704
|
+
"name": "",
|
|
705
|
+
"type": "uint256"
|
|
706
|
+
}
|
|
707
|
+
]
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
"stateMutability": "view",
|
|
711
|
+
"type": "function",
|
|
712
|
+
"name": "fee",
|
|
713
|
+
"inputs": [],
|
|
714
|
+
"outputs": [
|
|
715
|
+
{
|
|
716
|
+
"name": "",
|
|
717
|
+
"type": "uint256"
|
|
718
|
+
}
|
|
719
|
+
]
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
"stateMutability": "view",
|
|
723
|
+
"type": "function",
|
|
724
|
+
"name": "admin_fee",
|
|
725
|
+
"inputs": [],
|
|
726
|
+
"outputs": [
|
|
727
|
+
{
|
|
728
|
+
"name": "",
|
|
729
|
+
"type": "uint256"
|
|
730
|
+
}
|
|
731
|
+
]
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
"stateMutability": "view",
|
|
735
|
+
"type": "function",
|
|
736
|
+
"name": "owner",
|
|
737
|
+
"inputs": [],
|
|
738
|
+
"outputs": [
|
|
739
|
+
{
|
|
740
|
+
"name": "",
|
|
741
|
+
"type": "address"
|
|
742
|
+
}
|
|
743
|
+
]
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
"stateMutability": "view",
|
|
747
|
+
"type": "function",
|
|
748
|
+
"name": "lp_token",
|
|
749
|
+
"inputs": [],
|
|
750
|
+
"outputs": [
|
|
751
|
+
{
|
|
752
|
+
"name": "",
|
|
753
|
+
"type": "address"
|
|
754
|
+
}
|
|
755
|
+
]
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
"stateMutability": "view",
|
|
759
|
+
"type": "function",
|
|
760
|
+
"name": "initial_A",
|
|
761
|
+
"inputs": [],
|
|
762
|
+
"outputs": [
|
|
763
|
+
{
|
|
764
|
+
"name": "",
|
|
765
|
+
"type": "uint256"
|
|
766
|
+
}
|
|
767
|
+
]
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
"stateMutability": "view",
|
|
771
|
+
"type": "function",
|
|
772
|
+
"name": "future_A",
|
|
773
|
+
"inputs": [],
|
|
774
|
+
"outputs": [
|
|
775
|
+
{
|
|
776
|
+
"name": "",
|
|
777
|
+
"type": "uint256"
|
|
778
|
+
}
|
|
779
|
+
]
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
"stateMutability": "view",
|
|
783
|
+
"type": "function",
|
|
784
|
+
"name": "initial_A_time",
|
|
785
|
+
"inputs": [],
|
|
786
|
+
"outputs": [
|
|
787
|
+
{
|
|
788
|
+
"name": "",
|
|
789
|
+
"type": "uint256"
|
|
790
|
+
}
|
|
791
|
+
]
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
"stateMutability": "view",
|
|
795
|
+
"type": "function",
|
|
796
|
+
"name": "future_A_time",
|
|
797
|
+
"inputs": [],
|
|
798
|
+
"outputs": [
|
|
799
|
+
{
|
|
800
|
+
"name": "",
|
|
801
|
+
"type": "uint256"
|
|
802
|
+
}
|
|
803
|
+
]
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
"stateMutability": "view",
|
|
807
|
+
"type": "function",
|
|
808
|
+
"name": "admin_actions_deadline",
|
|
809
|
+
"inputs": [],
|
|
810
|
+
"outputs": [
|
|
811
|
+
{
|
|
812
|
+
"name": "",
|
|
813
|
+
"type": "uint256"
|
|
814
|
+
}
|
|
815
|
+
]
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
"stateMutability": "view",
|
|
819
|
+
"type": "function",
|
|
820
|
+
"name": "transfer_ownership_deadline",
|
|
821
|
+
"inputs": [],
|
|
822
|
+
"outputs": [
|
|
823
|
+
{
|
|
824
|
+
"name": "",
|
|
825
|
+
"type": "uint256"
|
|
826
|
+
}
|
|
827
|
+
]
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
"stateMutability": "view",
|
|
831
|
+
"type": "function",
|
|
832
|
+
"name": "future_fee",
|
|
833
|
+
"inputs": [],
|
|
834
|
+
"outputs": [
|
|
835
|
+
{
|
|
836
|
+
"name": "",
|
|
837
|
+
"type": "uint256"
|
|
838
|
+
}
|
|
839
|
+
]
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
"stateMutability": "view",
|
|
843
|
+
"type": "function",
|
|
844
|
+
"name": "future_admin_fee",
|
|
845
|
+
"inputs": [],
|
|
846
|
+
"outputs": [
|
|
847
|
+
{
|
|
848
|
+
"name": "",
|
|
849
|
+
"type": "uint256"
|
|
850
|
+
}
|
|
851
|
+
]
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
"stateMutability": "view",
|
|
855
|
+
"type": "function",
|
|
856
|
+
"name": "future_owner",
|
|
857
|
+
"inputs": [],
|
|
858
|
+
"outputs": [
|
|
859
|
+
{
|
|
860
|
+
"name": "",
|
|
861
|
+
"type": "address"
|
|
862
|
+
}
|
|
863
|
+
]
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
"stateMutability": "view",
|
|
867
|
+
"type": "function",
|
|
868
|
+
"name": "ma_exp_time",
|
|
869
|
+
"inputs": [],
|
|
870
|
+
"outputs": [
|
|
871
|
+
{
|
|
872
|
+
"name": "",
|
|
873
|
+
"type": "uint256"
|
|
874
|
+
}
|
|
875
|
+
]
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
"stateMutability": "view",
|
|
879
|
+
"type": "function",
|
|
880
|
+
"name": "ma_last_time",
|
|
881
|
+
"inputs": [],
|
|
882
|
+
"outputs": [
|
|
883
|
+
{
|
|
884
|
+
"name": "",
|
|
885
|
+
"type": "uint256"
|
|
886
|
+
}
|
|
887
|
+
]
|
|
888
|
+
}
|
|
889
|
+
]
|
|
@@ -31,6 +31,7 @@ exports.ETH_COINS_ETHEREUM = {
|
|
|
31
31
|
seth: "0x5e74c9036fb86bd7ecdcb084a0673efc32ea31cb",
|
|
32
32
|
reth: "0x9559aaa82d9649c7a7b220e7c461d2e74c9a3593",
|
|
33
33
|
weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
34
|
+
frxeth: "0x5E8422345238F34275888049021821E8E08CAa1f",
|
|
34
35
|
xaut: "0x68749665ff8d2d112fa859aa293f07a622782f38", // XAUt TODO move to GOLD
|
|
35
36
|
};
|
|
36
37
|
exports.LINK_COINS_ETHEREUM = {
|
|
@@ -89,6 +89,7 @@ var deposit_json_23 = __importDefault(require("../abis/rai/deposit.json"));
|
|
|
89
89
|
var swap_json_40 = __importDefault(require("../abis/2pool/swap.json"));
|
|
90
90
|
var swap_json_41 = __importDefault(require("../abis/4pool/swap.json"));
|
|
91
91
|
var swap_json_42 = __importDefault(require("../abis/fraxusdc/swap.json"));
|
|
92
|
+
var swap_json_43 = __importDefault(require("../abis/frxeth/swap.json"));
|
|
92
93
|
var utils_1 = require("../utils");
|
|
93
94
|
exports.POOLS_DATA_ETHEREUM = (0, utils_1.lowerCasePoolDataAddresses)({
|
|
94
95
|
compound: {
|
|
@@ -1549,4 +1550,28 @@ exports.POOLS_DATA_ETHEREUM = (0, utils_1.lowerCasePoolDataAddresses)({
|
|
|
1549
1550
|
gauge_abi: gauge_v5_json_1.default,
|
|
1550
1551
|
deposit_abi: deposit_json_22.default,
|
|
1551
1552
|
},
|
|
1553
|
+
frxeth: {
|
|
1554
|
+
name: "frxeth",
|
|
1555
|
+
full_name: "frxeth",
|
|
1556
|
+
symbol: "frxeth",
|
|
1557
|
+
reference_asset: 'ETH',
|
|
1558
|
+
swap_address: "0xa1F8A6807c402E4A15ef4EBa36528A3FED24E577",
|
|
1559
|
+
token_address: "0xf43211935C781D5ca1a41d2041F397B8A7366C7A",
|
|
1560
|
+
gauge_address: "0x2932a86df44Fe8D2A706d8e9c5d51c24883423F5",
|
|
1561
|
+
is_plain: true,
|
|
1562
|
+
underlying_coins: ['ETH', 'frxrETH'],
|
|
1563
|
+
wrapped_coins: ['ETH', 'frxrETH'],
|
|
1564
|
+
underlying_coin_addresses: [
|
|
1565
|
+
'0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
1566
|
+
'0x5E8422345238F34275888049021821E8E08CAa1f',
|
|
1567
|
+
],
|
|
1568
|
+
wrapped_coin_addresses: [
|
|
1569
|
+
'0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
1570
|
+
'0x5E8422345238F34275888049021821E8E08CAa1f',
|
|
1571
|
+
],
|
|
1572
|
+
underlying_decimals: [18, 18],
|
|
1573
|
+
wrapped_decimals: [18, 18],
|
|
1574
|
+
swap_abi: swap_json_43.default,
|
|
1575
|
+
gauge_abi: gauge_v5_json_1.default,
|
|
1576
|
+
},
|
|
1552
1577
|
});
|
package/lib/index.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ declare const curve: {
|
|
|
33
33
|
getFactoryPoolList: () => string[];
|
|
34
34
|
getCryptoFactoryPoolList: () => string[];
|
|
35
35
|
getUserPoolList: (address?: string | undefined) => Promise<string[]>;
|
|
36
|
+
getUserLiquidityUSD: (pools: string[], address?: string | undefined) => Promise<string[]>;
|
|
36
37
|
PoolTemplate: typeof PoolTemplate;
|
|
37
38
|
getPool: (poolId: string) => PoolTemplate;
|
|
38
39
|
getUsdRate: (coin: string) => Promise<number>;
|
package/lib/index.js
CHANGED
|
@@ -99,6 +99,7 @@ var curve = {
|
|
|
99
99
|
getFactoryPoolList: utils_1.getFactoryPoolList,
|
|
100
100
|
getCryptoFactoryPoolList: utils_1.getCryptoFactoryPoolList,
|
|
101
101
|
getUserPoolList: utils_1.getUserPoolList,
|
|
102
|
+
getUserLiquidityUSD: utils_1.getUserLiquidityUSD,
|
|
102
103
|
PoolTemplate: pools_1.PoolTemplate,
|
|
103
104
|
getPool: pools_1.getPool,
|
|
104
105
|
getUsdRate: utils_2.getUsdRate,
|
|
@@ -2555,22 +2555,16 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2555
2555
|
PoolTemplate.prototype.userLiquidityUSD = function (address) {
|
|
2556
2556
|
if (address === void 0) { address = ""; }
|
|
2557
2557
|
return __awaiter(this, void 0, void 0, function () {
|
|
2558
|
-
var
|
|
2559
|
-
return __generator(this, function (
|
|
2560
|
-
switch (
|
|
2561
|
-
case 0: return [4 /*yield*/, this.
|
|
2558
|
+
var lpBalanceBN, lpPrice;
|
|
2559
|
+
return __generator(this, function (_c) {
|
|
2560
|
+
switch (_c.label) {
|
|
2561
|
+
case 0: return [4 /*yield*/, this._userLpTotalBalance(address)];
|
|
2562
2562
|
case 1:
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
for (_i = 0, _c = this.underlyingCoinAddresses; _i < _c.length; _i++) {
|
|
2566
|
-
addr = _c[_i];
|
|
2567
|
-
promises.push((0, utils_1._getUsdRate)(addr));
|
|
2568
|
-
}
|
|
2569
|
-
return [4 /*yield*/, Promise.all(promises)];
|
|
2563
|
+
lpBalanceBN = _c.sent();
|
|
2564
|
+
return [4 /*yield*/, (0, utils_1._getUsdRate)(this.lpToken)];
|
|
2570
2565
|
case 2:
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
return [2 /*return*/, totalLiquidity.toFixed(8)];
|
|
2566
|
+
lpPrice = _c.sent();
|
|
2567
|
+
return [2 /*return*/, lpBalanceBN.times(lpPrice).toFixed(8)];
|
|
2574
2568
|
}
|
|
2575
2569
|
});
|
|
2576
2570
|
});
|
package/lib/pools/utils.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { ethers } from "ethers";
|
|
1
2
|
export declare const getPoolList: () => string[];
|
|
2
3
|
export declare const getFactoryPoolList: () => string[];
|
|
3
4
|
export declare const getCryptoFactoryPoolList: () => string[];
|
|
5
|
+
export declare const _getUserLpBalances: (pools: string[], address?: string) => Promise<ethers.BigNumber[]>;
|
|
4
6
|
export declare const getUserPoolList: (address?: string) => Promise<string[]>;
|
|
7
|
+
export declare const getUserLiquidityUSD: (pools: string[], address?: string) => Promise<string[]>;
|
package/lib/pools/utils.js
CHANGED
|
@@ -45,45 +45,84 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
45
45
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.getUserPoolList = exports.getCryptoFactoryPoolList = exports.getFactoryPoolList = exports.getPoolList = void 0;
|
|
48
|
+
exports.getUserLiquidityUSD = exports.getUserPoolList = exports._getUserLpBalances = exports.getCryptoFactoryPoolList = exports.getFactoryPoolList = exports.getPoolList = void 0;
|
|
49
49
|
var ethers_1 = require("ethers");
|
|
50
|
-
var curve_1 = require("../curve");
|
|
51
50
|
var poolConstructor_1 = require("./poolConstructor");
|
|
51
|
+
var curve_1 = require("../curve");
|
|
52
|
+
var utils_1 = require("../utils");
|
|
52
53
|
var getPoolList = function () { return Object.keys(curve_1.curve.constants.POOLS_DATA); };
|
|
53
54
|
exports.getPoolList = getPoolList;
|
|
54
55
|
var getFactoryPoolList = function () { return Object.keys(curve_1.curve.constants.FACTORY_POOLS_DATA); };
|
|
55
56
|
exports.getFactoryPoolList = getFactoryPoolList;
|
|
56
57
|
var getCryptoFactoryPoolList = function () { return Object.keys(curve_1.curve.constants.CRYPTO_FACTORY_POOLS_DATA); };
|
|
57
58
|
exports.getCryptoFactoryPoolList = getCryptoFactoryPoolList;
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
var _userLpBalance = {};
|
|
60
|
+
var _isUserLpBalanceExpired = function (address, poolId) {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
return (((_b = (_a = _userLpBalance[address]) === null || _a === void 0 ? void 0 : _a[poolId]) === null || _b === void 0 ? void 0 : _b.time) || 0) + 600000 < Date.now();
|
|
63
|
+
};
|
|
64
|
+
var _getUserLpBalances = function (pools, address) { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
|
+
var poolsToFetch, _i, pools_1, poolId, calls, _a, poolsToFetch_1, poolId, pool, _rawBalances, _b, poolsToFetch_2, poolId, pool, _balance, _lpBalances, _c, pools_2, poolId;
|
|
66
|
+
var _d;
|
|
67
|
+
return __generator(this, function (_e) {
|
|
68
|
+
switch (_e.label) {
|
|
62
69
|
case 0:
|
|
63
70
|
if (!address)
|
|
64
71
|
address = curve_1.curve.signerAddress;
|
|
65
72
|
address = address;
|
|
66
|
-
|
|
73
|
+
poolsToFetch = [];
|
|
74
|
+
for (_i = 0, pools_1 = pools; _i < pools_1.length; _i++) {
|
|
75
|
+
poolId = pools_1[_i];
|
|
76
|
+
if (_isUserLpBalanceExpired(address, poolId))
|
|
77
|
+
poolsToFetch.push(poolId);
|
|
78
|
+
}
|
|
79
|
+
if (!(poolsToFetch.length > 0)) return [3 /*break*/, 2];
|
|
67
80
|
calls = [];
|
|
68
|
-
for (
|
|
69
|
-
poolId =
|
|
81
|
+
for (_a = 0, poolsToFetch_1 = poolsToFetch; _a < poolsToFetch_1.length; _a++) {
|
|
82
|
+
poolId = poolsToFetch_1[_a];
|
|
70
83
|
pool = (0, poolConstructor_1.getPool)(poolId);
|
|
71
84
|
calls.push(curve_1.curve.contracts[pool.lpToken].multicallContract.balanceOf(address));
|
|
72
85
|
if (pool.gauge !== ethers_1.ethers.constants.AddressZero)
|
|
73
86
|
calls.push(curve_1.curve.contracts[pool.gauge].multicallContract.balanceOf(address));
|
|
74
87
|
}
|
|
75
|
-
userPoolList = [];
|
|
76
88
|
return [4 /*yield*/, curve_1.curve.multicallProvider.all(calls)];
|
|
77
89
|
case 1:
|
|
78
|
-
_rawBalances =
|
|
79
|
-
for (
|
|
80
|
-
poolId =
|
|
90
|
+
_rawBalances = _e.sent();
|
|
91
|
+
for (_b = 0, poolsToFetch_2 = poolsToFetch; _b < poolsToFetch_2.length; _b++) {
|
|
92
|
+
poolId = poolsToFetch_2[_b];
|
|
81
93
|
pool = (0, poolConstructor_1.getPool)(poolId);
|
|
82
94
|
_balance = _rawBalances.shift();
|
|
83
95
|
if (pool.gauge !== ethers_1.ethers.constants.AddressZero)
|
|
84
96
|
_balance = _balance.add(_rawBalances.shift());
|
|
85
|
-
if (
|
|
86
|
-
|
|
97
|
+
if (!_userLpBalance[address])
|
|
98
|
+
_userLpBalance[address] = {};
|
|
99
|
+
_userLpBalance[address][poolId] = { '_lpBalance': _balance, 'time': Date.now() };
|
|
100
|
+
}
|
|
101
|
+
_e.label = 2;
|
|
102
|
+
case 2:
|
|
103
|
+
_lpBalances = [];
|
|
104
|
+
for (_c = 0, pools_2 = pools; _c < pools_2.length; _c++) {
|
|
105
|
+
poolId = pools_2[_c];
|
|
106
|
+
_lpBalances.push((_d = _userLpBalance[address]) === null || _d === void 0 ? void 0 : _d[poolId]._lpBalance);
|
|
107
|
+
}
|
|
108
|
+
return [2 /*return*/, _lpBalances];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}); };
|
|
112
|
+
exports._getUserLpBalances = _getUserLpBalances;
|
|
113
|
+
var getUserPoolList = function (address) { return __awaiter(void 0, void 0, void 0, function () {
|
|
114
|
+
var pools, _lpBalances, userPoolList, i;
|
|
115
|
+
return __generator(this, function (_a) {
|
|
116
|
+
switch (_a.label) {
|
|
117
|
+
case 0:
|
|
118
|
+
pools = __spreadArray(__spreadArray(__spreadArray([], (0, exports.getPoolList)(), true), (0, exports.getFactoryPoolList)(), true), (0, exports.getCryptoFactoryPoolList)(), true);
|
|
119
|
+
return [4 /*yield*/, (0, exports._getUserLpBalances)(pools, address)];
|
|
120
|
+
case 1:
|
|
121
|
+
_lpBalances = _a.sent();
|
|
122
|
+
userPoolList = [];
|
|
123
|
+
for (i = 0; i < pools.length; i++) {
|
|
124
|
+
if (_lpBalances[i].gt(0)) {
|
|
125
|
+
userPoolList.push(pools[i]);
|
|
87
126
|
}
|
|
88
127
|
}
|
|
89
128
|
return [2 /*return*/, userPoolList];
|
|
@@ -91,3 +130,29 @@ var getUserPoolList = function (address) { return __awaiter(void 0, void 0, void
|
|
|
91
130
|
});
|
|
92
131
|
}); };
|
|
93
132
|
exports.getUserPoolList = getUserPoolList;
|
|
133
|
+
var getUserLiquidityUSD = function (pools, address) { return __awaiter(void 0, void 0, void 0, function () {
|
|
134
|
+
var _lpBalances, userLiquidityUSD, i, pool, price;
|
|
135
|
+
return __generator(this, function (_a) {
|
|
136
|
+
switch (_a.label) {
|
|
137
|
+
case 0: return [4 /*yield*/, (0, exports._getUserLpBalances)(pools, address)];
|
|
138
|
+
case 1:
|
|
139
|
+
_lpBalances = _a.sent();
|
|
140
|
+
userLiquidityUSD = [];
|
|
141
|
+
i = 0;
|
|
142
|
+
_a.label = 2;
|
|
143
|
+
case 2:
|
|
144
|
+
if (!(i < pools.length)) return [3 /*break*/, 5];
|
|
145
|
+
pool = (0, poolConstructor_1.getPool)(pools[i]);
|
|
146
|
+
return [4 /*yield*/, (0, utils_1._getUsdRate)(pool.lpToken)];
|
|
147
|
+
case 3:
|
|
148
|
+
price = _a.sent();
|
|
149
|
+
userLiquidityUSD.push((0, utils_1.toBN)(_lpBalances[i]).times(price).toFixed(8));
|
|
150
|
+
_a.label = 4;
|
|
151
|
+
case 4:
|
|
152
|
+
i++;
|
|
153
|
+
return [3 /*break*/, 2];
|
|
154
|
+
case 5: return [2 /*return*/, userLiquidityUSD];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}); };
|
|
158
|
+
exports.getUserLiquidityUSD = getUserLiquidityUSD;
|