@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,312 @@
1
+ [
2
+ {
3
+ "stateMutability": "nonpayable",
4
+ "type": "constructor",
5
+ "inputs": [
6
+ {
7
+ "name": "_controller",
8
+ "type": "address"
9
+ },
10
+ {
11
+ "name": "_collateral",
12
+ "type": "address"
13
+ },
14
+ {
15
+ "name": "_router",
16
+ "type": "address"
17
+ },
18
+ {
19
+ "name": "_routes",
20
+ "type": "address[9][]"
21
+ },
22
+ {
23
+ "name": "_route_params",
24
+ "type": "uint256[3][4][]"
25
+ },
26
+ {
27
+ "name": "_route_pools",
28
+ "type": "address[4][]"
29
+ },
30
+ {
31
+ "name": "_route_names",
32
+ "type": "string[]"
33
+ }
34
+ ],
35
+ "outputs": []
36
+ },
37
+ {
38
+ "stateMutability": "view",
39
+ "type": "function",
40
+ "name": "get_collateral",
41
+ "inputs": [
42
+ {
43
+ "name": "stablecoin",
44
+ "type": "uint256"
45
+ },
46
+ {
47
+ "name": "route_idx",
48
+ "type": "uint256"
49
+ }
50
+ ],
51
+ "outputs": [
52
+ {
53
+ "name": "",
54
+ "type": "uint256"
55
+ }
56
+ ]
57
+ },
58
+ {
59
+ "stateMutability": "view",
60
+ "type": "function",
61
+ "name": "get_collateral_underlying",
62
+ "inputs": [
63
+ {
64
+ "name": "stablecoin",
65
+ "type": "uint256"
66
+ },
67
+ {
68
+ "name": "route_idx",
69
+ "type": "uint256"
70
+ }
71
+ ],
72
+ "outputs": [
73
+ {
74
+ "name": "",
75
+ "type": "uint256"
76
+ }
77
+ ]
78
+ },
79
+ {
80
+ "stateMutability": "view",
81
+ "type": "function",
82
+ "name": "calculate_debt_n1",
83
+ "inputs": [
84
+ {
85
+ "name": "collateral",
86
+ "type": "uint256"
87
+ },
88
+ {
89
+ "name": "debt",
90
+ "type": "uint256"
91
+ },
92
+ {
93
+ "name": "N",
94
+ "type": "uint256"
95
+ },
96
+ {
97
+ "name": "route_idx",
98
+ "type": "uint256"
99
+ }
100
+ ],
101
+ "outputs": [
102
+ {
103
+ "name": "",
104
+ "type": "int256"
105
+ }
106
+ ]
107
+ },
108
+ {
109
+ "stateMutability": "view",
110
+ "type": "function",
111
+ "name": "max_borrowable",
112
+ "inputs": [
113
+ {
114
+ "name": "collateral",
115
+ "type": "uint256"
116
+ },
117
+ {
118
+ "name": "N",
119
+ "type": "uint256"
120
+ },
121
+ {
122
+ "name": "route_idx",
123
+ "type": "uint256"
124
+ }
125
+ ],
126
+ "outputs": [
127
+ {
128
+ "name": "",
129
+ "type": "uint256"
130
+ }
131
+ ]
132
+ },
133
+ {
134
+ "stateMutability": "view",
135
+ "type": "function",
136
+ "name": "max_collateral",
137
+ "inputs": [
138
+ {
139
+ "name": "collateral",
140
+ "type": "uint256"
141
+ },
142
+ {
143
+ "name": "N",
144
+ "type": "uint256"
145
+ },
146
+ {
147
+ "name": "route_idx",
148
+ "type": "uint256"
149
+ }
150
+ ],
151
+ "outputs": [
152
+ {
153
+ "name": "",
154
+ "type": "uint256"
155
+ }
156
+ ]
157
+ },
158
+ {
159
+ "stateMutability": "view",
160
+ "type": "function",
161
+ "name": "max_borrowable_and_collateral",
162
+ "inputs": [
163
+ {
164
+ "name": "collateral",
165
+ "type": "uint256"
166
+ },
167
+ {
168
+ "name": "N",
169
+ "type": "uint256"
170
+ },
171
+ {
172
+ "name": "route_idx",
173
+ "type": "uint256"
174
+ }
175
+ ],
176
+ "outputs": [
177
+ {
178
+ "name": "",
179
+ "type": "uint256[2]"
180
+ }
181
+ ]
182
+ },
183
+ {
184
+ "stateMutability": "nonpayable",
185
+ "type": "function",
186
+ "name": "callback_deposit",
187
+ "inputs": [
188
+ {
189
+ "name": "user",
190
+ "type": "address"
191
+ },
192
+ {
193
+ "name": "stablecoins",
194
+ "type": "uint256"
195
+ },
196
+ {
197
+ "name": "collateral",
198
+ "type": "uint256"
199
+ },
200
+ {
201
+ "name": "debt",
202
+ "type": "uint256"
203
+ },
204
+ {
205
+ "name": "callback_args",
206
+ "type": "uint256[]"
207
+ }
208
+ ],
209
+ "outputs": [
210
+ {
211
+ "name": "",
212
+ "type": "uint256[2]"
213
+ }
214
+ ]
215
+ },
216
+ {
217
+ "stateMutability": "view",
218
+ "type": "function",
219
+ "name": "routes",
220
+ "inputs": [
221
+ {
222
+ "name": "arg0",
223
+ "type": "uint256"
224
+ },
225
+ {
226
+ "name": "arg1",
227
+ "type": "uint256"
228
+ }
229
+ ],
230
+ "outputs": [
231
+ {
232
+ "name": "",
233
+ "type": "address"
234
+ }
235
+ ]
236
+ },
237
+ {
238
+ "stateMutability": "view",
239
+ "type": "function",
240
+ "name": "route_params",
241
+ "inputs": [
242
+ {
243
+ "name": "arg0",
244
+ "type": "uint256"
245
+ },
246
+ {
247
+ "name": "arg1",
248
+ "type": "uint256"
249
+ },
250
+ {
251
+ "name": "arg2",
252
+ "type": "uint256"
253
+ }
254
+ ],
255
+ "outputs": [
256
+ {
257
+ "name": "",
258
+ "type": "uint256"
259
+ }
260
+ ]
261
+ },
262
+ {
263
+ "stateMutability": "view",
264
+ "type": "function",
265
+ "name": "route_pools",
266
+ "inputs": [
267
+ {
268
+ "name": "arg0",
269
+ "type": "uint256"
270
+ },
271
+ {
272
+ "name": "arg1",
273
+ "type": "uint256"
274
+ }
275
+ ],
276
+ "outputs": [
277
+ {
278
+ "name": "",
279
+ "type": "address"
280
+ }
281
+ ]
282
+ },
283
+ {
284
+ "stateMutability": "view",
285
+ "type": "function",
286
+ "name": "route_names",
287
+ "inputs": [
288
+ {
289
+ "name": "arg0",
290
+ "type": "uint256"
291
+ }
292
+ ],
293
+ "outputs": [
294
+ {
295
+ "name": "",
296
+ "type": "string"
297
+ }
298
+ ]
299
+ },
300
+ {
301
+ "stateMutability": "view",
302
+ "type": "function",
303
+ "name": "routes_count",
304
+ "inputs": [],
305
+ "outputs": [
306
+ {
307
+ "name": "",
308
+ "type": "uint256"
309
+ }
310
+ ]
311
+ }
312
+ ]
@@ -0,0 +1,294 @@
1
+ [
2
+ {
3
+ "name": "SetAdmin",
4
+ "inputs": [
5
+ {
6
+ "name": "admin",
7
+ "type": "address",
8
+ "indexed": false
9
+ }
10
+ ],
11
+ "anonymous": false,
12
+ "type": "event"
13
+ },
14
+ {
15
+ "name": "AddPegKeeper",
16
+ "inputs": [
17
+ {
18
+ "name": "peg_keeper",
19
+ "type": "address",
20
+ "indexed": true
21
+ }
22
+ ],
23
+ "anonymous": false,
24
+ "type": "event"
25
+ },
26
+ {
27
+ "name": "RemovePegKeeper",
28
+ "inputs": [
29
+ {
30
+ "name": "peg_keeper",
31
+ "type": "address",
32
+ "indexed": true
33
+ }
34
+ ],
35
+ "anonymous": false,
36
+ "type": "event"
37
+ },
38
+ {
39
+ "name": "SetRate",
40
+ "inputs": [
41
+ {
42
+ "name": "rate",
43
+ "type": "uint256",
44
+ "indexed": false
45
+ }
46
+ ],
47
+ "anonymous": false,
48
+ "type": "event"
49
+ },
50
+ {
51
+ "name": "SetSigma",
52
+ "inputs": [
53
+ {
54
+ "name": "sigma",
55
+ "type": "uint256",
56
+ "indexed": false
57
+ }
58
+ ],
59
+ "anonymous": false,
60
+ "type": "event"
61
+ },
62
+ {
63
+ "name": "SetTargetDebtFraction",
64
+ "inputs": [
65
+ {
66
+ "name": "target_debt_fraction",
67
+ "type": "uint256",
68
+ "indexed": false
69
+ }
70
+ ],
71
+ "anonymous": false,
72
+ "type": "event"
73
+ },
74
+ {
75
+ "stateMutability": "nonpayable",
76
+ "type": "constructor",
77
+ "inputs": [
78
+ {
79
+ "name": "admin",
80
+ "type": "address"
81
+ },
82
+ {
83
+ "name": "price_oracle",
84
+ "type": "address"
85
+ },
86
+ {
87
+ "name": "controller_factory",
88
+ "type": "address"
89
+ },
90
+ {
91
+ "name": "peg_keepers",
92
+ "type": "address[5]"
93
+ },
94
+ {
95
+ "name": "rate",
96
+ "type": "uint256"
97
+ },
98
+ {
99
+ "name": "sigma",
100
+ "type": "uint256"
101
+ },
102
+ {
103
+ "name": "target_debt_fraction",
104
+ "type": "uint256"
105
+ }
106
+ ],
107
+ "outputs": []
108
+ },
109
+ {
110
+ "stateMutability": "nonpayable",
111
+ "type": "function",
112
+ "name": "set_admin",
113
+ "inputs": [
114
+ {
115
+ "name": "admin",
116
+ "type": "address"
117
+ }
118
+ ],
119
+ "outputs": []
120
+ },
121
+ {
122
+ "stateMutability": "nonpayable",
123
+ "type": "function",
124
+ "name": "add_peg_keeper",
125
+ "inputs": [
126
+ {
127
+ "name": "pk",
128
+ "type": "address"
129
+ }
130
+ ],
131
+ "outputs": []
132
+ },
133
+ {
134
+ "stateMutability": "nonpayable",
135
+ "type": "function",
136
+ "name": "remove_peg_keeper",
137
+ "inputs": [
138
+ {
139
+ "name": "pk",
140
+ "type": "address"
141
+ }
142
+ ],
143
+ "outputs": []
144
+ },
145
+ {
146
+ "stateMutability": "view",
147
+ "type": "function",
148
+ "name": "rate",
149
+ "inputs": [],
150
+ "outputs": [
151
+ {
152
+ "name": "",
153
+ "type": "uint256"
154
+ }
155
+ ]
156
+ },
157
+ {
158
+ "stateMutability": "nonpayable",
159
+ "type": "function",
160
+ "name": "rate_write",
161
+ "inputs": [],
162
+ "outputs": [
163
+ {
164
+ "name": "",
165
+ "type": "uint256"
166
+ }
167
+ ]
168
+ },
169
+ {
170
+ "stateMutability": "nonpayable",
171
+ "type": "function",
172
+ "name": "set_rate",
173
+ "inputs": [
174
+ {
175
+ "name": "rate",
176
+ "type": "uint256"
177
+ }
178
+ ],
179
+ "outputs": []
180
+ },
181
+ {
182
+ "stateMutability": "nonpayable",
183
+ "type": "function",
184
+ "name": "set_sigma",
185
+ "inputs": [
186
+ {
187
+ "name": "sigma",
188
+ "type": "uint256"
189
+ }
190
+ ],
191
+ "outputs": []
192
+ },
193
+ {
194
+ "stateMutability": "nonpayable",
195
+ "type": "function",
196
+ "name": "set_target_debt_fraction",
197
+ "inputs": [
198
+ {
199
+ "name": "target_debt_fraction",
200
+ "type": "uint256"
201
+ }
202
+ ],
203
+ "outputs": []
204
+ },
205
+ {
206
+ "stateMutability": "view",
207
+ "type": "function",
208
+ "name": "admin",
209
+ "inputs": [],
210
+ "outputs": [
211
+ {
212
+ "name": "",
213
+ "type": "address"
214
+ }
215
+ ]
216
+ },
217
+ {
218
+ "stateMutability": "view",
219
+ "type": "function",
220
+ "name": "rate0",
221
+ "inputs": [],
222
+ "outputs": [
223
+ {
224
+ "name": "",
225
+ "type": "uint256"
226
+ }
227
+ ]
228
+ },
229
+ {
230
+ "stateMutability": "view",
231
+ "type": "function",
232
+ "name": "sigma",
233
+ "inputs": [],
234
+ "outputs": [
235
+ {
236
+ "name": "",
237
+ "type": "int256"
238
+ }
239
+ ]
240
+ },
241
+ {
242
+ "stateMutability": "view",
243
+ "type": "function",
244
+ "name": "target_debt_fraction",
245
+ "inputs": [],
246
+ "outputs": [
247
+ {
248
+ "name": "",
249
+ "type": "uint256"
250
+ }
251
+ ]
252
+ },
253
+ {
254
+ "stateMutability": "view",
255
+ "type": "function",
256
+ "name": "peg_keepers",
257
+ "inputs": [
258
+ {
259
+ "name": "arg0",
260
+ "type": "uint256"
261
+ }
262
+ ],
263
+ "outputs": [
264
+ {
265
+ "name": "",
266
+ "type": "address"
267
+ }
268
+ ]
269
+ },
270
+ {
271
+ "stateMutability": "view",
272
+ "type": "function",
273
+ "name": "PRICE_ORACLE",
274
+ "inputs": [],
275
+ "outputs": [
276
+ {
277
+ "name": "",
278
+ "type": "address"
279
+ }
280
+ ]
281
+ },
282
+ {
283
+ "stateMutability": "view",
284
+ "type": "function",
285
+ "name": "CONTROLLER_FACTORY",
286
+ "inputs": [],
287
+ "outputs": [
288
+ {
289
+ "name": "",
290
+ "type": "address"
291
+ }
292
+ ]
293
+ }
294
+ ]