@curvefi/api 2.37.0 → 2.38.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/README.md +36 -0
- package/lib/boosting.d.ts +10 -1
- package/lib/boosting.js +189 -0
- package/lib/constants/abis/anycall.json +552 -0
- package/lib/constants/abis/voting_escrow_oracle.json +450 -0
- package/lib/constants/abis/voting_escrow_oracle_eth.json +76 -0
- package/lib/curve.js +7 -0
- package/lib/external-api.d.ts +7 -0
- package/lib/external-api.js +16 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +14 -1
- package/lib/pools/PoolTemplate.js +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{
|
|
5
|
+
"internalType": "address",
|
|
6
|
+
"name": "_anycall",
|
|
7
|
+
"type": "address"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"stateMutability": "nonpayable",
|
|
11
|
+
"type": "constructor"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"anonymous": false,
|
|
15
|
+
"inputs": [
|
|
16
|
+
{
|
|
17
|
+
"indexed": false,
|
|
18
|
+
"internalType": "uint256",
|
|
19
|
+
"name": "_eth_block_number",
|
|
20
|
+
"type": "uint256"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"indexed": false,
|
|
24
|
+
"internalType": "bytes32",
|
|
25
|
+
"name": "_eth_blockhash",
|
|
26
|
+
"type": "bytes32"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"name": "SetBlockhash",
|
|
30
|
+
"type": "event"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"anonymous": false,
|
|
34
|
+
"inputs": [
|
|
35
|
+
{
|
|
36
|
+
"indexed": false,
|
|
37
|
+
"internalType": "address",
|
|
38
|
+
"name": "_user",
|
|
39
|
+
"type": "address"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"indexed": false,
|
|
43
|
+
"internalType": "bytes32",
|
|
44
|
+
"name": "blockhash",
|
|
45
|
+
"type": "bytes32"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"indexed": false,
|
|
49
|
+
"internalType": "bytes32",
|
|
50
|
+
"name": "proofhash",
|
|
51
|
+
"type": "bytes32"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"name": "SubmittedState",
|
|
55
|
+
"type": "event"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"anonymous": false,
|
|
59
|
+
"inputs": [
|
|
60
|
+
{
|
|
61
|
+
"indexed": false,
|
|
62
|
+
"internalType": "address",
|
|
63
|
+
"name": "_old_owner",
|
|
64
|
+
"type": "address"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"indexed": false,
|
|
68
|
+
"internalType": "address",
|
|
69
|
+
"name": "_new_owner",
|
|
70
|
+
"type": "address"
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"name": "TransferOwnership",
|
|
74
|
+
"type": "event"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"inputs": [],
|
|
78
|
+
"name": "ANYCALL",
|
|
79
|
+
"outputs": [
|
|
80
|
+
{
|
|
81
|
+
"internalType": "address",
|
|
82
|
+
"name": "",
|
|
83
|
+
"type": "address"
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"stateMutability": "view",
|
|
87
|
+
"type": "function"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"inputs": [],
|
|
91
|
+
"name": "accept_transfer_ownership",
|
|
92
|
+
"outputs": [],
|
|
93
|
+
"stateMutability": "nonpayable",
|
|
94
|
+
"type": "function"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"inputs": [
|
|
98
|
+
{
|
|
99
|
+
"internalType": "address",
|
|
100
|
+
"name": "_user",
|
|
101
|
+
"type": "address"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"internalType": "uint256",
|
|
105
|
+
"name": "_timestamp",
|
|
106
|
+
"type": "uint256"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"name": "balanceOf",
|
|
110
|
+
"outputs": [
|
|
111
|
+
{
|
|
112
|
+
"internalType": "uint256",
|
|
113
|
+
"name": "",
|
|
114
|
+
"type": "uint256"
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"stateMutability": "view",
|
|
118
|
+
"type": "function"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"inputs": [
|
|
122
|
+
{
|
|
123
|
+
"internalType": "address",
|
|
124
|
+
"name": "_user",
|
|
125
|
+
"type": "address"
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
"name": "balanceOf",
|
|
129
|
+
"outputs": [
|
|
130
|
+
{
|
|
131
|
+
"internalType": "uint256",
|
|
132
|
+
"name": "",
|
|
133
|
+
"type": "uint256"
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"stateMutability": "view",
|
|
137
|
+
"type": "function"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"inputs": [
|
|
141
|
+
{
|
|
142
|
+
"internalType": "address",
|
|
143
|
+
"name": "_future_owner",
|
|
144
|
+
"type": "address"
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
"name": "commit_transfer_ownership",
|
|
148
|
+
"outputs": [],
|
|
149
|
+
"stateMutability": "nonpayable",
|
|
150
|
+
"type": "function"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"inputs": [],
|
|
154
|
+
"name": "epoch",
|
|
155
|
+
"outputs": [
|
|
156
|
+
{
|
|
157
|
+
"internalType": "uint256",
|
|
158
|
+
"name": "",
|
|
159
|
+
"type": "uint256"
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"stateMutability": "view",
|
|
163
|
+
"type": "function"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"inputs": [],
|
|
167
|
+
"name": "future_owner",
|
|
168
|
+
"outputs": [
|
|
169
|
+
{
|
|
170
|
+
"internalType": "address",
|
|
171
|
+
"name": "",
|
|
172
|
+
"type": "address"
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
"stateMutability": "view",
|
|
176
|
+
"type": "function"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"inputs": [
|
|
180
|
+
{
|
|
181
|
+
"internalType": "uint256",
|
|
182
|
+
"name": "_eth_block_number",
|
|
183
|
+
"type": "uint256"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"name": "get_eth_blockhash",
|
|
187
|
+
"outputs": [
|
|
188
|
+
{
|
|
189
|
+
"internalType": "bytes32",
|
|
190
|
+
"name": "eth_blockhash",
|
|
191
|
+
"type": "bytes32"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"stateMutability": "view",
|
|
195
|
+
"type": "function"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"inputs": [],
|
|
199
|
+
"name": "last_eth_block_number",
|
|
200
|
+
"outputs": [
|
|
201
|
+
{
|
|
202
|
+
"internalType": "uint256",
|
|
203
|
+
"name": "",
|
|
204
|
+
"type": "uint256"
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
"stateMutability": "view",
|
|
208
|
+
"type": "function"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"inputs": [
|
|
212
|
+
{
|
|
213
|
+
"internalType": "address",
|
|
214
|
+
"name": "",
|
|
215
|
+
"type": "address"
|
|
216
|
+
}
|
|
217
|
+
],
|
|
218
|
+
"name": "locked",
|
|
219
|
+
"outputs": [
|
|
220
|
+
{
|
|
221
|
+
"internalType": "int128",
|
|
222
|
+
"name": "amount",
|
|
223
|
+
"type": "int128"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"internalType": "uint256",
|
|
227
|
+
"name": "end",
|
|
228
|
+
"type": "uint256"
|
|
229
|
+
}
|
|
230
|
+
],
|
|
231
|
+
"stateMutability": "view",
|
|
232
|
+
"type": "function"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"inputs": [],
|
|
236
|
+
"name": "owner",
|
|
237
|
+
"outputs": [
|
|
238
|
+
{
|
|
239
|
+
"internalType": "address",
|
|
240
|
+
"name": "",
|
|
241
|
+
"type": "address"
|
|
242
|
+
}
|
|
243
|
+
],
|
|
244
|
+
"stateMutability": "view",
|
|
245
|
+
"type": "function"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"inputs": [
|
|
249
|
+
{
|
|
250
|
+
"internalType": "uint256",
|
|
251
|
+
"name": "",
|
|
252
|
+
"type": "uint256"
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
"name": "point_history",
|
|
256
|
+
"outputs": [
|
|
257
|
+
{
|
|
258
|
+
"internalType": "int128",
|
|
259
|
+
"name": "bias",
|
|
260
|
+
"type": "int128"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"internalType": "int128",
|
|
264
|
+
"name": "slope",
|
|
265
|
+
"type": "int128"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"internalType": "uint256",
|
|
269
|
+
"name": "ts",
|
|
270
|
+
"type": "uint256"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"internalType": "uint256",
|
|
274
|
+
"name": "blk",
|
|
275
|
+
"type": "uint256"
|
|
276
|
+
}
|
|
277
|
+
],
|
|
278
|
+
"stateMutability": "view",
|
|
279
|
+
"type": "function"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"inputs": [
|
|
283
|
+
{
|
|
284
|
+
"internalType": "uint256",
|
|
285
|
+
"name": "_eth_block_number",
|
|
286
|
+
"type": "uint256"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"internalType": "bytes32",
|
|
290
|
+
"name": "__eth_blockhash",
|
|
291
|
+
"type": "bytes32"
|
|
292
|
+
}
|
|
293
|
+
],
|
|
294
|
+
"name": "set_eth_blockhash",
|
|
295
|
+
"outputs": [],
|
|
296
|
+
"stateMutability": "nonpayable",
|
|
297
|
+
"type": "function"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"inputs": [
|
|
301
|
+
{
|
|
302
|
+
"internalType": "uint256",
|
|
303
|
+
"name": "",
|
|
304
|
+
"type": "uint256"
|
|
305
|
+
}
|
|
306
|
+
],
|
|
307
|
+
"name": "slope_changes",
|
|
308
|
+
"outputs": [
|
|
309
|
+
{
|
|
310
|
+
"internalType": "int128",
|
|
311
|
+
"name": "",
|
|
312
|
+
"type": "int128"
|
|
313
|
+
}
|
|
314
|
+
],
|
|
315
|
+
"stateMutability": "view",
|
|
316
|
+
"type": "function"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"inputs": [
|
|
320
|
+
{
|
|
321
|
+
"internalType": "address",
|
|
322
|
+
"name": "_user",
|
|
323
|
+
"type": "address"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"internalType": "bytes",
|
|
327
|
+
"name": "_block_header_rlp",
|
|
328
|
+
"type": "bytes"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"internalType": "bytes",
|
|
332
|
+
"name": "_proof_rlp",
|
|
333
|
+
"type": "bytes"
|
|
334
|
+
}
|
|
335
|
+
],
|
|
336
|
+
"name": "submit_state",
|
|
337
|
+
"outputs": [],
|
|
338
|
+
"stateMutability": "nonpayable",
|
|
339
|
+
"type": "function"
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
"inputs": [
|
|
343
|
+
{
|
|
344
|
+
"internalType": "bytes32",
|
|
345
|
+
"name": "",
|
|
346
|
+
"type": "bytes32"
|
|
347
|
+
}
|
|
348
|
+
],
|
|
349
|
+
"name": "submitted_hashes",
|
|
350
|
+
"outputs": [
|
|
351
|
+
{
|
|
352
|
+
"internalType": "bool",
|
|
353
|
+
"name": "",
|
|
354
|
+
"type": "bool"
|
|
355
|
+
}
|
|
356
|
+
],
|
|
357
|
+
"stateMutability": "view",
|
|
358
|
+
"type": "function"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"inputs": [],
|
|
362
|
+
"name": "totalSupply",
|
|
363
|
+
"outputs": [
|
|
364
|
+
{
|
|
365
|
+
"internalType": "uint256",
|
|
366
|
+
"name": "",
|
|
367
|
+
"type": "uint256"
|
|
368
|
+
}
|
|
369
|
+
],
|
|
370
|
+
"stateMutability": "view",
|
|
371
|
+
"type": "function"
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"inputs": [
|
|
375
|
+
{
|
|
376
|
+
"internalType": "uint256",
|
|
377
|
+
"name": "_timestamp",
|
|
378
|
+
"type": "uint256"
|
|
379
|
+
}
|
|
380
|
+
],
|
|
381
|
+
"name": "totalSupply",
|
|
382
|
+
"outputs": [
|
|
383
|
+
{
|
|
384
|
+
"internalType": "uint256",
|
|
385
|
+
"name": "",
|
|
386
|
+
"type": "uint256"
|
|
387
|
+
}
|
|
388
|
+
],
|
|
389
|
+
"stateMutability": "view",
|
|
390
|
+
"type": "function"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"inputs": [
|
|
394
|
+
{
|
|
395
|
+
"internalType": "address",
|
|
396
|
+
"name": "",
|
|
397
|
+
"type": "address"
|
|
398
|
+
}
|
|
399
|
+
],
|
|
400
|
+
"name": "user_point_epoch",
|
|
401
|
+
"outputs": [
|
|
402
|
+
{
|
|
403
|
+
"internalType": "uint256",
|
|
404
|
+
"name": "",
|
|
405
|
+
"type": "uint256"
|
|
406
|
+
}
|
|
407
|
+
],
|
|
408
|
+
"stateMutability": "view",
|
|
409
|
+
"type": "function"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"inputs": [
|
|
413
|
+
{
|
|
414
|
+
"internalType": "address",
|
|
415
|
+
"name": "",
|
|
416
|
+
"type": "address"
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"internalType": "uint256",
|
|
420
|
+
"name": "",
|
|
421
|
+
"type": "uint256"
|
|
422
|
+
}
|
|
423
|
+
],
|
|
424
|
+
"name": "user_point_history",
|
|
425
|
+
"outputs": [
|
|
426
|
+
{
|
|
427
|
+
"internalType": "int128",
|
|
428
|
+
"name": "bias",
|
|
429
|
+
"type": "int128"
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"internalType": "int128",
|
|
433
|
+
"name": "slope",
|
|
434
|
+
"type": "int128"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"internalType": "uint256",
|
|
438
|
+
"name": "ts",
|
|
439
|
+
"type": "uint256"
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
"internalType": "uint256",
|
|
443
|
+
"name": "blk",
|
|
444
|
+
"type": "uint256"
|
|
445
|
+
}
|
|
446
|
+
],
|
|
447
|
+
"stateMutability": "view",
|
|
448
|
+
"type": "function"
|
|
449
|
+
}
|
|
450
|
+
]
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"stateMutability": "nonpayable",
|
|
4
|
+
"type": "function",
|
|
5
|
+
"name": "send_blockhash",
|
|
6
|
+
"inputs": [
|
|
7
|
+
{
|
|
8
|
+
"name": "_block_number",
|
|
9
|
+
"type": "uint256"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "_chain_id",
|
|
13
|
+
"type": "uint256"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"outputs": [],
|
|
17
|
+
"gas": "54147"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"stateMutability": "view",
|
|
21
|
+
"type": "function",
|
|
22
|
+
"name": "block_number_bounds",
|
|
23
|
+
"inputs": [],
|
|
24
|
+
"outputs": [
|
|
25
|
+
{
|
|
26
|
+
"name": "",
|
|
27
|
+
"type": "uint256[2]"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"gas": "740"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"stateMutability": "view",
|
|
34
|
+
"type": "function",
|
|
35
|
+
"name": "generate_eth_get_proof_params",
|
|
36
|
+
"inputs": [
|
|
37
|
+
{
|
|
38
|
+
"name": "_user",
|
|
39
|
+
"type": "address"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"outputs": [
|
|
43
|
+
{
|
|
44
|
+
"name": "",
|
|
45
|
+
"type": "address"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "",
|
|
49
|
+
"type": "uint256[20]"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "",
|
|
53
|
+
"type": "uint256"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"gas": "21089"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"stateMutability": "view",
|
|
60
|
+
"type": "function",
|
|
61
|
+
"name": "get_last_block_number_sent",
|
|
62
|
+
"inputs": [
|
|
63
|
+
{
|
|
64
|
+
"name": "_chain_id",
|
|
65
|
+
"type": "uint256"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"outputs": [
|
|
69
|
+
{
|
|
70
|
+
"name": "",
|
|
71
|
+
"type": "uint256"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"gas": "2747"
|
|
75
|
+
}
|
|
76
|
+
]
|
package/lib/curve.js
CHANGED
|
@@ -65,6 +65,9 @@ import yERC20Abi from './constants/abis/yERC20.json' assert { type: 'json' };
|
|
|
65
65
|
import minterABI from './constants/abis/minter.json' assert { type: 'json' };
|
|
66
66
|
import minterChildABI from './constants/abis/minter_child.json' assert { type: 'json' };
|
|
67
67
|
import votingEscrowABI from './constants/abis/votingescrow.json' assert { type: 'json' };
|
|
68
|
+
import anycallABI from './constants/abis/anycall.json' assert { type: 'json' };
|
|
69
|
+
import votingEscrowOracleABI from './constants/abis/voting_escrow_oracle.json' assert { type: 'json' };
|
|
70
|
+
import votingEscrowOracleEthABI from './constants/abis/voting_escrow_oracle_eth.json' assert { type: 'json' };
|
|
68
71
|
import feeDistributorABI from './constants/abis/fee_distributor.json' assert { type: 'json' };
|
|
69
72
|
import addressProviderABI from './constants/abis/address_provider.json' assert { type: 'json' };
|
|
70
73
|
import gaugeControllerABI from './constants/abis/gaugecontroller.json' assert { type: 'json' };
|
|
@@ -606,6 +609,8 @@ var Curve = /** @class */ (function () {
|
|
|
606
609
|
this.constants.NATIVE_TOKEN = NATIVE_TOKENS[this.chainId];
|
|
607
610
|
this.constants.NETWORK_NAME = NETWORK_CONSTANTS[this.chainId].NAME;
|
|
608
611
|
this.constants.ALIASES = NETWORK_CONSTANTS[this.chainId].ALIASES;
|
|
612
|
+
this.constants.ALIASES.anycall = "0x37414a8662bc1d25be3ee51fb27c2686e2490a89";
|
|
613
|
+
this.constants.ALIASES.voting_escrow_oracle = "0x12F407340697Ae0b177546E535b91A5be021fBF9";
|
|
609
614
|
this.constants.POOLS_DATA = NETWORK_CONSTANTS[this.chainId].POOLS_DATA;
|
|
610
615
|
if (this.chainId === 1)
|
|
611
616
|
this.constants.LLAMMAS_DATA = NETWORK_CONSTANTS[this.chainId].LLAMMAS_DATA;
|
|
@@ -728,6 +733,8 @@ var Curve = /** @class */ (function () {
|
|
|
728
733
|
case 21:
|
|
729
734
|
this.setContract(this.constants.ALIASES.crvusd_factory, factoryABI);
|
|
730
735
|
this.setContract(this.constants.ALIASES.crypto_factory, cryptoFactoryABI);
|
|
736
|
+
this.setContract(this.constants.ALIASES.anycall, anycallABI);
|
|
737
|
+
this.setContract(this.constants.ALIASES.voting_escrow_oracle, this.chainId === 1 ? votingEscrowOracleEthABI : votingEscrowOracleABI);
|
|
731
738
|
return [2 /*return*/];
|
|
732
739
|
}
|
|
733
740
|
});
|
package/lib/external-api.d.ts
CHANGED
|
@@ -43,3 +43,10 @@ export declare const _getAllGauges: (() => Promise<IDict<{
|
|
|
43
43
|
is_killed?: boolean;
|
|
44
44
|
}>>>;
|
|
45
45
|
export declare const _getHiddenPools: (() => Promise<IDict<string[]>>) & memoize.Memoized<() => Promise<IDict<string[]>>>;
|
|
46
|
+
export declare const _generateBoostingProof: ((block: number, address: string) => Promise<{
|
|
47
|
+
block_header_rlp: string;
|
|
48
|
+
proof_rlp: string;
|
|
49
|
+
}>) & memoize.Memoized<(block: number, address: string) => Promise<{
|
|
50
|
+
block_header_rlp: string;
|
|
51
|
+
proof_rlp: string;
|
|
52
|
+
}>>;
|
package/lib/external-api.js
CHANGED
|
@@ -167,3 +167,19 @@ export var _getHiddenPools = memoize(function () { return __awaiter(void 0, void
|
|
|
167
167
|
promise: true,
|
|
168
168
|
maxAge: 5 * 60 * 1000, // 5m
|
|
169
169
|
});
|
|
170
|
+
export var _generateBoostingProof = memoize(function (block, address) { return __awaiter(void 0, void 0, void 0, function () {
|
|
171
|
+
var url, response;
|
|
172
|
+
return __generator(this, function (_a) {
|
|
173
|
+
switch (_a.label) {
|
|
174
|
+
case 0:
|
|
175
|
+
url = "https://prices.curve.fi/v1/general/get_merkle_proof?block=".concat(block, "&account_address=").concat(address);
|
|
176
|
+
return [4 /*yield*/, axios.get(url, { validateStatus: function () { return true; } })];
|
|
177
|
+
case 1:
|
|
178
|
+
response = _a.sent();
|
|
179
|
+
return [2 /*return*/, { block_header_rlp: response.data.block_header_rlp, proof_rlp: response.data.proof_rlp }];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}); }, {
|
|
183
|
+
promise: true,
|
|
184
|
+
maxAge: 5 * 60 * 1000, // 5m
|
|
185
|
+
});
|
package/lib/index.d.ts
CHANGED
|
@@ -123,6 +123,19 @@ declare const curve: {
|
|
|
123
123
|
withdrawLockedCrv: () => Promise<number>;
|
|
124
124
|
claimFees: (address?: string) => Promise<number>;
|
|
125
125
|
};
|
|
126
|
+
sidechain: {
|
|
127
|
+
lastBlockhash: () => Promise<number>;
|
|
128
|
+
checkBlockhash: (block: number) => Promise<boolean>;
|
|
129
|
+
getAnycallBalance: () => Promise<string>;
|
|
130
|
+
topUpAnycall: (amount?: string | number) => Promise<string>;
|
|
131
|
+
sendBlockhash: (block: number, chainId: import("./interfaces.js").IChainId) => Promise<string>;
|
|
132
|
+
submitProof: (block: number, address?: string) => Promise<string>;
|
|
133
|
+
estimateGas: {
|
|
134
|
+
topUpAnycall: (amount?: string | number) => Promise<number>;
|
|
135
|
+
sendBlockhash: (block: number, chainId: import("./interfaces.js").IChainId) => Promise<number>;
|
|
136
|
+
submitProof: (block: number, address?: string) => Promise<number>;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
126
139
|
};
|
|
127
140
|
router: {
|
|
128
141
|
getBestRouteAndOutput: (inputCoin: string, outputCoin: string, amount: string | number) => Promise<{
|
package/lib/index.js
CHANGED
|
@@ -38,7 +38,7 @@ import { PoolTemplate, getPool } from "./pools/index.js";
|
|
|
38
38
|
import { getUserPoolListByLiquidity, getUserPoolListByClaimable, getUserPoolList, getUserLiquidityUSD, getUserClaimable, } from "./pools/utils.js";
|
|
39
39
|
import { getBestRouteAndOutput, swapExpected, swapPriceImpact, swapIsApproved, swapApproveEstimateGas, swapApprove, swapEstimateGas, swap, getSwappedAmount, } from "./router.js";
|
|
40
40
|
import { curve as _curve } from "./curve.js";
|
|
41
|
-
import { getCrv, getLockedAmountAndUnlockTime, getVeCrv, getVeCrvPct, calcUnlockTime, createLockEstimateGas, createLock, isApproved, approveEstimateGas, approve, increaseAmountEstimateGas, increaseAmount, increaseUnlockTimeEstimateGas, increaseUnlockTime, withdrawLockedCrvEstimateGas, withdrawLockedCrv, claimableFees, claimFeesEstimateGas, claimFees, } from "./boosting.js";
|
|
41
|
+
import { getCrv, getLockedAmountAndUnlockTime, getVeCrv, getVeCrvPct, calcUnlockTime, createLockEstimateGas, createLock, isApproved, approveEstimateGas, approve, increaseAmountEstimateGas, increaseAmount, increaseUnlockTimeEstimateGas, increaseUnlockTime, withdrawLockedCrvEstimateGas, withdrawLockedCrv, claimableFees, claimFeesEstimateGas, claimFees, lastBlockhash, checkBlockhash, getAnycallBalance, topUpAnycall, topUpAnycallEstimateGas, sendBlockhash, sendBlockhashEstimateGas, submitProof, submitProofEstimateGas, } from "./boosting.js";
|
|
42
42
|
import { getBalances, getAllowance, hasAllowance, ensureAllowanceEstimateGas, ensureAllowance, getUsdRate, getTVL, getCoinsData, getVolume, } from "./utils.js";
|
|
43
43
|
import { deployStablePlainPool, deployStablePlainPoolEstimateGas, setOracle, setOracleEstimateGas, deployStableMetaPool, deployStableMetaPoolEstimateGas, deployCryptoPool, deployCryptoPoolEstimateGas, deployGauge, deployGaugeEstimateGas, getDeployedStablePlainPoolAddress, getDeployedStableMetaPoolAddress, getDeployedCryptoPoolAddress, getDeployedGaugeAddress, } from './factory/deploy.js';
|
|
44
44
|
function init(providerType, providerSettings, options) {
|
|
@@ -154,6 +154,19 @@ var curve = {
|
|
|
154
154
|
withdrawLockedCrv: withdrawLockedCrvEstimateGas,
|
|
155
155
|
claimFees: claimFeesEstimateGas,
|
|
156
156
|
},
|
|
157
|
+
sidechain: {
|
|
158
|
+
lastBlockhash: lastBlockhash,
|
|
159
|
+
checkBlockhash: checkBlockhash,
|
|
160
|
+
getAnycallBalance: getAnycallBalance,
|
|
161
|
+
topUpAnycall: topUpAnycall,
|
|
162
|
+
sendBlockhash: sendBlockhash,
|
|
163
|
+
submitProof: submitProof,
|
|
164
|
+
estimateGas: {
|
|
165
|
+
topUpAnycall: topUpAnycallEstimateGas,
|
|
166
|
+
sendBlockhash: sendBlockhashEstimateGas,
|
|
167
|
+
submitProof: submitProofEstimateGas,
|
|
168
|
+
},
|
|
169
|
+
},
|
|
157
170
|
},
|
|
158
171
|
router: {
|
|
159
172
|
getBestRouteAndOutput: getBestRouteAndOutput,
|
|
@@ -597,8 +597,6 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
597
597
|
return __generator(this, function (_d) {
|
|
598
598
|
switch (_d.label) {
|
|
599
599
|
case 0:
|
|
600
|
-
if (curve.chainId !== 1)
|
|
601
|
-
throw Error("Boosting is available only on Ethereum network");
|
|
602
600
|
if (this.gauge === curve.constants.ZERO_ADDRESS)
|
|
603
601
|
throw Error("".concat(this.name, " doesn't have gauge"));
|
|
604
602
|
address = address || curve.signerAddress;
|
|
@@ -612,6 +610,10 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
612
610
|
case 1:
|
|
613
611
|
_c = (_d.sent()).map(function (value) { return toBN(value); }), workingBalanceBN = _c[0], balanceBN = _c[1];
|
|
614
612
|
boostBN = workingBalanceBN.div(0.4).div(balanceBN);
|
|
613
|
+
if (boostBN.lt(1))
|
|
614
|
+
return [2 /*return*/, '1.0'];
|
|
615
|
+
if (boostBN.gt(2.5))
|
|
616
|
+
return [2 /*return*/, '2.5'];
|
|
615
617
|
return [2 /*return*/, boostBN.toFixed(4).replace(/([0-9])0+$/, '$1')];
|
|
616
618
|
}
|
|
617
619
|
});
|
|
@@ -654,8 +656,6 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
654
656
|
return __generator(this, function (_f) {
|
|
655
657
|
switch (_f.label) {
|
|
656
658
|
case 0:
|
|
657
|
-
if (curve.chainId !== 1)
|
|
658
|
-
throw Error("Boosting is available only on Ethereum network");
|
|
659
659
|
if (this.gauge === curve.constants.ZERO_ADDRESS)
|
|
660
660
|
throw Error("".concat(this.name, " doesn't have gauge"));
|
|
661
661
|
if (addresses.length == 1 && Array.isArray(addresses[0]))
|