@curvefi/llamalend-api 1.0.2

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.
Files changed (125) hide show
  1. package/.eslintrc.json +40 -0
  2. package/.github/workflows/lint.yml +15 -0
  3. package/.github/workflows/publish.yml +55 -0
  4. package/LICENSE +21 -0
  5. package/README.md +1976 -0
  6. package/lib/cache/index.d.ts +14 -0
  7. package/lib/cache/index.js +31 -0
  8. package/lib/constants/L2Networks.d.ts +1 -0
  9. package/lib/constants/L2Networks.js +1 -0
  10. package/lib/constants/abis/Controller.json +1027 -0
  11. package/lib/constants/abis/ERC20.json +222 -0
  12. package/lib/constants/abis/ERC4626.json +1674 -0
  13. package/lib/constants/abis/GaugeController.json +794 -0
  14. package/lib/constants/abis/GaugeFactoryMainnet.json +1 -0
  15. package/lib/constants/abis/GaugeFactorySidechain.json +475 -0
  16. package/lib/constants/abis/GaugeV5.json +958 -0
  17. package/lib/constants/abis/LeverageZap.json +35 -0
  18. package/lib/constants/abis/Llamma.json +984 -0
  19. package/lib/constants/abis/Minter.json +1 -0
  20. package/lib/constants/abis/MonetaryPolicy.json +221 -0
  21. package/lib/constants/abis/OneWayLendingFactoryABI.json +899 -0
  22. package/lib/constants/abis/SidechainGauge.json +939 -0
  23. package/lib/constants/abis/Vault.json +721 -0
  24. package/lib/constants/abis/crvUSD/DeleverageZap.json +248 -0
  25. package/lib/constants/abis/crvUSD/Factory.json +514 -0
  26. package/lib/constants/abis/crvUSD/HealthCalculatorZap.json +54 -0
  27. package/lib/constants/abis/crvUSD/LeverageZap.json +312 -0
  28. package/lib/constants/abis/crvUSD/MonetaryPolicy.json +294 -0
  29. package/lib/constants/abis/crvUSD/MonetaryPolicy2.json +299 -0
  30. package/lib/constants/abis/crvUSD/PegKeeper.json +411 -0
  31. package/lib/constants/abis/crvUSD/controller.json +991 -0
  32. package/lib/constants/abis/crvUSD/llamma.json +984 -0
  33. package/lib/constants/abis/gas_oracle_optimism.json +149 -0
  34. package/lib/constants/abis/gas_oracle_optimism_blob.json +203 -0
  35. package/lib/constants/aliases.d.ts +16 -0
  36. package/lib/constants/aliases.js +124 -0
  37. package/lib/constants/coins.d.ts +16 -0
  38. package/lib/constants/coins.js +24 -0
  39. package/lib/constants/llammas.d.ts +2 -0
  40. package/lib/constants/llammas.js +96 -0
  41. package/lib/constants/utils.d.ts +4 -0
  42. package/lib/constants/utils.js +27 -0
  43. package/lib/external-api.d.ts +13 -0
  44. package/lib/external-api.js +436 -0
  45. package/lib/index.d.ts +104 -0
  46. package/lib/index.js +123 -0
  47. package/lib/interfaces.d.ts +228 -0
  48. package/lib/interfaces.js +1 -0
  49. package/lib/lendMarkets/LendMarketTemplate.d.ts +510 -0
  50. package/lib/lendMarkets/LendMarketTemplate.js +4682 -0
  51. package/lib/lendMarkets/index.d.ts +3 -0
  52. package/lib/lendMarkets/index.js +3 -0
  53. package/lib/lendMarkets/lendMarketConstructor.d.ts +2 -0
  54. package/lib/lendMarkets/lendMarketConstructor.js +6 -0
  55. package/lib/llamalend.d.ts +80 -0
  56. package/lib/llamalend.js +878 -0
  57. package/lib/mintMarkets/MintMarketTemplate.d.ts +308 -0
  58. package/lib/mintMarkets/MintMarketTemplate.js +2998 -0
  59. package/lib/mintMarkets/index.d.ts +3 -0
  60. package/lib/mintMarkets/index.js +3 -0
  61. package/lib/mintMarkets/mintMarketConstructor.d.ts +2 -0
  62. package/lib/mintMarkets/mintMarketConstructor.js +4 -0
  63. package/lib/st-crvUSD.d.ts +35 -0
  64. package/lib/st-crvUSD.js +505 -0
  65. package/lib/utils.d.ts +58 -0
  66. package/lib/utils.js +661 -0
  67. package/package.json +42 -0
  68. package/src/cache/index.ts +41 -0
  69. package/src/constants/L2Networks.ts +1 -0
  70. package/src/constants/abis/Controller.json +1027 -0
  71. package/src/constants/abis/ERC20.json +222 -0
  72. package/src/constants/abis/ERC4626.json +1674 -0
  73. package/src/constants/abis/GaugeController.json +794 -0
  74. package/src/constants/abis/GaugeFactoryMainnet.json +1 -0
  75. package/src/constants/abis/GaugeFactorySidechain.json +475 -0
  76. package/src/constants/abis/GaugeV5.json +958 -0
  77. package/src/constants/abis/LeverageZap.json +35 -0
  78. package/src/constants/abis/Llamma.json +984 -0
  79. package/src/constants/abis/Minter.json +1 -0
  80. package/src/constants/abis/MonetaryPolicy.json +221 -0
  81. package/src/constants/abis/OneWayLendingFactoryABI.json +899 -0
  82. package/src/constants/abis/SidechainGauge.json +939 -0
  83. package/src/constants/abis/Vault.json +721 -0
  84. package/src/constants/abis/crvUSD/DeleverageZap.json +248 -0
  85. package/src/constants/abis/crvUSD/ERC20.json +222 -0
  86. package/src/constants/abis/crvUSD/Factory.json +514 -0
  87. package/src/constants/abis/crvUSD/HealthCalculatorZap.json +54 -0
  88. package/src/constants/abis/crvUSD/LeverageZap.json +312 -0
  89. package/src/constants/abis/crvUSD/MonetaryPolicy.json +294 -0
  90. package/src/constants/abis/crvUSD/MonetaryPolicy2.json +299 -0
  91. package/src/constants/abis/crvUSD/PegKeeper.json +411 -0
  92. package/src/constants/abis/crvUSD/controller.json +991 -0
  93. package/src/constants/abis/crvUSD/llamma.json +984 -0
  94. package/src/constants/abis/gas_oracle_optimism.json +149 -0
  95. package/src/constants/abis/gas_oracle_optimism_blob.json +203 -0
  96. package/src/constants/aliases.ts +141 -0
  97. package/src/constants/coins.ts +41 -0
  98. package/src/constants/llammas.ts +99 -0
  99. package/src/constants/utils.ts +33 -0
  100. package/src/external-api.ts +325 -0
  101. package/src/index.ts +128 -0
  102. package/src/interfaces.ts +237 -0
  103. package/src/lendMarkets/LendMarketTemplate.ts +3022 -0
  104. package/src/lendMarkets/index.ts +7 -0
  105. package/src/lendMarkets/lendMarketConstructor.ts +7 -0
  106. package/src/llamalend.ts +785 -0
  107. package/src/mintMarkets/MintMarketTemplate.ts +1781 -0
  108. package/src/mintMarkets/index.ts +7 -0
  109. package/src/mintMarkets/mintMarketConstructor.ts +5 -0
  110. package/src/st-crvUSD.ts +244 -0
  111. package/src/utils.ts +497 -0
  112. package/test/fetch.test.ts +152 -0
  113. package/test/general.test.ts +216 -0
  114. package/test/leverageBorrowMore.test.ts +245 -0
  115. package/test/leverageCreateLoan.test.ts +236 -0
  116. package/test/leverageRepay.test.ts +240 -0
  117. package/test/readme.test.ts +475 -0
  118. package/test/selfLiquidate.test.ts +57 -0
  119. package/test/selfLiquidateCrvUSD.test.ts +54 -0
  120. package/test/st_crvUSD.test.ts +68 -0
  121. package/test/swap.test.ts +62 -0
  122. package/test/swapCrvUSD.test.ts +56 -0
  123. package/test/vault.test.ts +112 -0
  124. package/tsconfig.build.json +10 -0
  125. package/tsconfig.json +72 -0
@@ -0,0 +1,514 @@
1
+ [
2
+ {
3
+ "name": "AddMarket",
4
+ "inputs": [
5
+ {
6
+ "name": "collateral",
7
+ "type": "address",
8
+ "indexed": true
9
+ },
10
+ {
11
+ "name": "controller",
12
+ "type": "address",
13
+ "indexed": false
14
+ },
15
+ {
16
+ "name": "amm",
17
+ "type": "address",
18
+ "indexed": false
19
+ },
20
+ {
21
+ "name": "monetary_policy",
22
+ "type": "address",
23
+ "indexed": false
24
+ },
25
+ {
26
+ "name": "ix",
27
+ "type": "uint256",
28
+ "indexed": false
29
+ }
30
+ ],
31
+ "anonymous": false,
32
+ "type": "event"
33
+ },
34
+ {
35
+ "name": "SetDebtCeiling",
36
+ "inputs": [
37
+ {
38
+ "name": "addr",
39
+ "type": "address",
40
+ "indexed": true
41
+ },
42
+ {
43
+ "name": "debt_ceiling",
44
+ "type": "uint256",
45
+ "indexed": false
46
+ }
47
+ ],
48
+ "anonymous": false,
49
+ "type": "event"
50
+ },
51
+ {
52
+ "name": "MintForMarket",
53
+ "inputs": [
54
+ {
55
+ "name": "addr",
56
+ "type": "address",
57
+ "indexed": true
58
+ },
59
+ {
60
+ "name": "amount",
61
+ "type": "uint256",
62
+ "indexed": false
63
+ }
64
+ ],
65
+ "anonymous": false,
66
+ "type": "event"
67
+ },
68
+ {
69
+ "name": "RemoveFromMarket",
70
+ "inputs": [
71
+ {
72
+ "name": "addr",
73
+ "type": "address",
74
+ "indexed": true
75
+ },
76
+ {
77
+ "name": "amount",
78
+ "type": "uint256",
79
+ "indexed": false
80
+ }
81
+ ],
82
+ "anonymous": false,
83
+ "type": "event"
84
+ },
85
+ {
86
+ "name": "SetImplementations",
87
+ "inputs": [
88
+ {
89
+ "name": "amm",
90
+ "type": "address",
91
+ "indexed": false
92
+ },
93
+ {
94
+ "name": "controller",
95
+ "type": "address",
96
+ "indexed": false
97
+ }
98
+ ],
99
+ "anonymous": false,
100
+ "type": "event"
101
+ },
102
+ {
103
+ "name": "SetAdmin",
104
+ "inputs": [
105
+ {
106
+ "name": "admin",
107
+ "type": "address",
108
+ "indexed": false
109
+ }
110
+ ],
111
+ "anonymous": false,
112
+ "type": "event"
113
+ },
114
+ {
115
+ "name": "SetFeeReceiver",
116
+ "inputs": [
117
+ {
118
+ "name": "fee_receiver",
119
+ "type": "address",
120
+ "indexed": false
121
+ }
122
+ ],
123
+ "anonymous": false,
124
+ "type": "event"
125
+ },
126
+ {
127
+ "stateMutability": "nonpayable",
128
+ "type": "constructor",
129
+ "inputs": [
130
+ {
131
+ "name": "stablecoin",
132
+ "type": "address"
133
+ },
134
+ {
135
+ "name": "admin",
136
+ "type": "address"
137
+ },
138
+ {
139
+ "name": "fee_receiver",
140
+ "type": "address"
141
+ },
142
+ {
143
+ "name": "weth",
144
+ "type": "address"
145
+ }
146
+ ],
147
+ "outputs": []
148
+ },
149
+ {
150
+ "stateMutability": "view",
151
+ "type": "function",
152
+ "name": "stablecoin",
153
+ "inputs": [],
154
+ "outputs": [
155
+ {
156
+ "name": "",
157
+ "type": "address"
158
+ }
159
+ ]
160
+ },
161
+ {
162
+ "stateMutability": "nonpayable",
163
+ "type": "function",
164
+ "name": "add_market",
165
+ "inputs": [
166
+ {
167
+ "name": "token",
168
+ "type": "address"
169
+ },
170
+ {
171
+ "name": "A",
172
+ "type": "uint256"
173
+ },
174
+ {
175
+ "name": "fee",
176
+ "type": "uint256"
177
+ },
178
+ {
179
+ "name": "admin_fee",
180
+ "type": "uint256"
181
+ },
182
+ {
183
+ "name": "_price_oracle_contract",
184
+ "type": "address"
185
+ },
186
+ {
187
+ "name": "monetary_policy",
188
+ "type": "address"
189
+ },
190
+ {
191
+ "name": "loan_discount",
192
+ "type": "uint256"
193
+ },
194
+ {
195
+ "name": "liquidation_discount",
196
+ "type": "uint256"
197
+ },
198
+ {
199
+ "name": "debt_ceiling",
200
+ "type": "uint256"
201
+ }
202
+ ],
203
+ "outputs": [
204
+ {
205
+ "name": "",
206
+ "type": "address[2]"
207
+ }
208
+ ]
209
+ },
210
+ {
211
+ "stateMutability": "view",
212
+ "type": "function",
213
+ "name": "total_debt",
214
+ "inputs": [],
215
+ "outputs": [
216
+ {
217
+ "name": "",
218
+ "type": "uint256"
219
+ }
220
+ ]
221
+ },
222
+ {
223
+ "stateMutability": "view",
224
+ "type": "function",
225
+ "name": "get_controller",
226
+ "inputs": [
227
+ {
228
+ "name": "collateral",
229
+ "type": "address"
230
+ }
231
+ ],
232
+ "outputs": [
233
+ {
234
+ "name": "",
235
+ "type": "address"
236
+ }
237
+ ]
238
+ },
239
+ {
240
+ "stateMutability": "view",
241
+ "type": "function",
242
+ "name": "get_amm",
243
+ "inputs": [
244
+ {
245
+ "name": "collateral",
246
+ "type": "address"
247
+ }
248
+ ],
249
+ "outputs": [
250
+ {
251
+ "name": "",
252
+ "type": "address"
253
+ }
254
+ ]
255
+ },
256
+ {
257
+ "stateMutability": "nonpayable",
258
+ "type": "function",
259
+ "name": "set_implementations",
260
+ "inputs": [
261
+ {
262
+ "name": "controller",
263
+ "type": "address"
264
+ },
265
+ {
266
+ "name": "amm",
267
+ "type": "address"
268
+ }
269
+ ],
270
+ "outputs": []
271
+ },
272
+ {
273
+ "stateMutability": "nonpayable",
274
+ "type": "function",
275
+ "name": "set_admin",
276
+ "inputs": [
277
+ {
278
+ "name": "admin",
279
+ "type": "address"
280
+ }
281
+ ],
282
+ "outputs": []
283
+ },
284
+ {
285
+ "stateMutability": "nonpayable",
286
+ "type": "function",
287
+ "name": "set_fee_receiver",
288
+ "inputs": [
289
+ {
290
+ "name": "fee_receiver",
291
+ "type": "address"
292
+ }
293
+ ],
294
+ "outputs": []
295
+ },
296
+ {
297
+ "stateMutability": "nonpayable",
298
+ "type": "function",
299
+ "name": "set_debt_ceiling",
300
+ "inputs": [
301
+ {
302
+ "name": "_to",
303
+ "type": "address"
304
+ },
305
+ {
306
+ "name": "debt_ceiling",
307
+ "type": "uint256"
308
+ }
309
+ ],
310
+ "outputs": []
311
+ },
312
+ {
313
+ "stateMutability": "nonpayable",
314
+ "type": "function",
315
+ "name": "rug_debt_ceiling",
316
+ "inputs": [
317
+ {
318
+ "name": "_to",
319
+ "type": "address"
320
+ }
321
+ ],
322
+ "outputs": []
323
+ },
324
+ {
325
+ "stateMutability": "nonpayable",
326
+ "type": "function",
327
+ "name": "collect_fees_above_ceiling",
328
+ "inputs": [
329
+ {
330
+ "name": "_to",
331
+ "type": "address"
332
+ }
333
+ ],
334
+ "outputs": []
335
+ },
336
+ {
337
+ "stateMutability": "view",
338
+ "type": "function",
339
+ "name": "controllers",
340
+ "inputs": [
341
+ {
342
+ "name": "arg0",
343
+ "type": "uint256"
344
+ }
345
+ ],
346
+ "outputs": [
347
+ {
348
+ "name": "",
349
+ "type": "address"
350
+ }
351
+ ]
352
+ },
353
+ {
354
+ "stateMutability": "view",
355
+ "type": "function",
356
+ "name": "amms",
357
+ "inputs": [
358
+ {
359
+ "name": "arg0",
360
+ "type": "uint256"
361
+ }
362
+ ],
363
+ "outputs": [
364
+ {
365
+ "name": "",
366
+ "type": "address"
367
+ }
368
+ ]
369
+ },
370
+ {
371
+ "stateMutability": "view",
372
+ "type": "function",
373
+ "name": "admin",
374
+ "inputs": [],
375
+ "outputs": [
376
+ {
377
+ "name": "",
378
+ "type": "address"
379
+ }
380
+ ]
381
+ },
382
+ {
383
+ "stateMutability": "view",
384
+ "type": "function",
385
+ "name": "fee_receiver",
386
+ "inputs": [],
387
+ "outputs": [
388
+ {
389
+ "name": "",
390
+ "type": "address"
391
+ }
392
+ ]
393
+ },
394
+ {
395
+ "stateMutability": "view",
396
+ "type": "function",
397
+ "name": "controller_implementation",
398
+ "inputs": [],
399
+ "outputs": [
400
+ {
401
+ "name": "",
402
+ "type": "address"
403
+ }
404
+ ]
405
+ },
406
+ {
407
+ "stateMutability": "view",
408
+ "type": "function",
409
+ "name": "amm_implementation",
410
+ "inputs": [],
411
+ "outputs": [
412
+ {
413
+ "name": "",
414
+ "type": "address"
415
+ }
416
+ ]
417
+ },
418
+ {
419
+ "stateMutability": "view",
420
+ "type": "function",
421
+ "name": "n_collaterals",
422
+ "inputs": [],
423
+ "outputs": [
424
+ {
425
+ "name": "",
426
+ "type": "uint256"
427
+ }
428
+ ]
429
+ },
430
+ {
431
+ "stateMutability": "view",
432
+ "type": "function",
433
+ "name": "collaterals",
434
+ "inputs": [
435
+ {
436
+ "name": "arg0",
437
+ "type": "uint256"
438
+ }
439
+ ],
440
+ "outputs": [
441
+ {
442
+ "name": "",
443
+ "type": "address"
444
+ }
445
+ ]
446
+ },
447
+ {
448
+ "stateMutability": "view",
449
+ "type": "function",
450
+ "name": "collaterals_index",
451
+ "inputs": [
452
+ {
453
+ "name": "arg0",
454
+ "type": "address"
455
+ },
456
+ {
457
+ "name": "arg1",
458
+ "type": "uint256"
459
+ }
460
+ ],
461
+ "outputs": [
462
+ {
463
+ "name": "",
464
+ "type": "uint256"
465
+ }
466
+ ]
467
+ },
468
+ {
469
+ "stateMutability": "view",
470
+ "type": "function",
471
+ "name": "debt_ceiling",
472
+ "inputs": [
473
+ {
474
+ "name": "arg0",
475
+ "type": "address"
476
+ }
477
+ ],
478
+ "outputs": [
479
+ {
480
+ "name": "",
481
+ "type": "uint256"
482
+ }
483
+ ]
484
+ },
485
+ {
486
+ "stateMutability": "view",
487
+ "type": "function",
488
+ "name": "debt_ceiling_residual",
489
+ "inputs": [
490
+ {
491
+ "name": "arg0",
492
+ "type": "address"
493
+ }
494
+ ],
495
+ "outputs": [
496
+ {
497
+ "name": "",
498
+ "type": "uint256"
499
+ }
500
+ ]
501
+ },
502
+ {
503
+ "stateMutability": "view",
504
+ "type": "function",
505
+ "name": "WETH",
506
+ "inputs": [],
507
+ "outputs": [
508
+ {
509
+ "name": "",
510
+ "type": "address"
511
+ }
512
+ ]
513
+ }
514
+ ]
@@ -0,0 +1,54 @@
1
+ [
2
+ {
3
+ "stateMutability": "nonpayable",
4
+ "type": "constructor",
5
+ "inputs": [
6
+ {
7
+ "name": "amm",
8
+ "type": "address"
9
+ },
10
+ {
11
+ "name": "controller",
12
+ "type": "address"
13
+ },
14
+ {
15
+ "name": "collateral_token",
16
+ "type": "address"
17
+ }
18
+ ],
19
+ "outputs": []
20
+ },
21
+ {
22
+ "stateMutability": "view",
23
+ "type": "function",
24
+ "name": "health_calculator",
25
+ "inputs": [
26
+ {
27
+ "name": "user",
28
+ "type": "address"
29
+ },
30
+ {
31
+ "name": "d_collateral",
32
+ "type": "int256"
33
+ },
34
+ {
35
+ "name": "d_debt",
36
+ "type": "int256"
37
+ },
38
+ {
39
+ "name": "full",
40
+ "type": "bool"
41
+ },
42
+ {
43
+ "name": "N",
44
+ "type": "uint256"
45
+ }
46
+ ],
47
+ "outputs": [
48
+ {
49
+ "name": "",
50
+ "type": "int256"
51
+ }
52
+ ]
53
+ }
54
+ ]