@lavarage/sdk 6.7.0 → 6.7.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/abi/borrowerOperations.ts +1 -248
- package/abi/tokenHolderAbi.ts +1 -443
- package/dist/index.d.mts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +100 -738
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +97 -738
- package/dist/index.mjs.map +1 -1
- package/evm.ts +123 -51
- package/interfaces/evm.ts +8 -0
- package/package.json +1 -1
package/abi/tokenHolderAbi.ts
CHANGED
|
@@ -1,443 +1 @@
|
|
|
1
|
-
export const tokenHolderAbi = [
|
|
2
|
-
{ inputs: [], name: "AccessControlBadConfirmation", type: "error" },
|
|
3
|
-
{
|
|
4
|
-
inputs: [
|
|
5
|
-
{ internalType: "address", name: "account", type: "address" },
|
|
6
|
-
{ internalType: "bytes32", name: "neededRole", type: "bytes32" },
|
|
7
|
-
],
|
|
8
|
-
name: "AccessControlUnauthorizedAccount",
|
|
9
|
-
type: "error",
|
|
10
|
-
},
|
|
11
|
-
{ inputs: [], name: "InvalidInitialization", type: "error" },
|
|
12
|
-
{ inputs: [], name: "NotInitializing", type: "error" },
|
|
13
|
-
{
|
|
14
|
-
anonymous: false,
|
|
15
|
-
inputs: [
|
|
16
|
-
{
|
|
17
|
-
indexed: false,
|
|
18
|
-
internalType: "uint64",
|
|
19
|
-
name: "version",
|
|
20
|
-
type: "uint64",
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
name: "Initialized",
|
|
24
|
-
type: "event",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
anonymous: false,
|
|
28
|
-
inputs: [
|
|
29
|
-
{
|
|
30
|
-
indexed: false,
|
|
31
|
-
internalType: "uint256",
|
|
32
|
-
name: "newInterestRate",
|
|
33
|
-
type: "uint256",
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
name: "InterestRateSet",
|
|
37
|
-
type: "event",
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
anonymous: false,
|
|
41
|
-
inputs: [
|
|
42
|
-
{
|
|
43
|
-
indexed: false,
|
|
44
|
-
internalType: "uint256",
|
|
45
|
-
name: "loanId",
|
|
46
|
-
type: "uint256",
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
indexed: false,
|
|
50
|
-
internalType: "uint256",
|
|
51
|
-
name: "amount",
|
|
52
|
-
type: "uint256",
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
indexed: false,
|
|
56
|
-
internalType: "uint256",
|
|
57
|
-
name: "timestamp",
|
|
58
|
-
type: "uint256",
|
|
59
|
-
},
|
|
60
|
-
{ indexed: false, internalType: "bool", name: "repaid", type: "bool" },
|
|
61
|
-
],
|
|
62
|
-
name: "LoanCreated",
|
|
63
|
-
type: "event",
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
anonymous: false,
|
|
67
|
-
inputs: [
|
|
68
|
-
{
|
|
69
|
-
indexed: false,
|
|
70
|
-
internalType: "uint256",
|
|
71
|
-
name: "loanId",
|
|
72
|
-
type: "uint256",
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
name: "LoanRepaid",
|
|
76
|
-
type: "event",
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
anonymous: false,
|
|
80
|
-
inputs: [
|
|
81
|
-
{
|
|
82
|
-
indexed: false,
|
|
83
|
-
internalType: "address",
|
|
84
|
-
name: "collateralAddress",
|
|
85
|
-
type: "address",
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
indexed: false,
|
|
89
|
-
internalType: "uint256",
|
|
90
|
-
name: "oldValue",
|
|
91
|
-
type: "uint256",
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
indexed: false,
|
|
95
|
-
internalType: "uint256",
|
|
96
|
-
name: "newValue",
|
|
97
|
-
type: "uint256",
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
name: "MaxLendPerTokenUpdated",
|
|
101
|
-
type: "event",
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
anonymous: false,
|
|
105
|
-
inputs: [
|
|
106
|
-
{
|
|
107
|
-
indexed: false,
|
|
108
|
-
internalType: "address",
|
|
109
|
-
name: "borrower",
|
|
110
|
-
type: "address",
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
indexed: false,
|
|
114
|
-
internalType: "uint256",
|
|
115
|
-
name: "amount",
|
|
116
|
-
type: "uint256",
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
name: "PrivilegedLoan",
|
|
120
|
-
type: "event",
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
anonymous: false,
|
|
124
|
-
inputs: [
|
|
125
|
-
{
|
|
126
|
-
indexed: false,
|
|
127
|
-
internalType: "address",
|
|
128
|
-
name: "borrower",
|
|
129
|
-
type: "address",
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
indexed: false,
|
|
133
|
-
internalType: "uint256",
|
|
134
|
-
name: "amount",
|
|
135
|
-
type: "uint256",
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
name: "PrivilegedLoanRepaid",
|
|
139
|
-
type: "event",
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
anonymous: false,
|
|
143
|
-
inputs: [
|
|
144
|
-
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
145
|
-
{
|
|
146
|
-
indexed: true,
|
|
147
|
-
internalType: "bytes32",
|
|
148
|
-
name: "previousAdminRole",
|
|
149
|
-
type: "bytes32",
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
indexed: true,
|
|
153
|
-
internalType: "bytes32",
|
|
154
|
-
name: "newAdminRole",
|
|
155
|
-
type: "bytes32",
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
name: "RoleAdminChanged",
|
|
159
|
-
type: "event",
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
anonymous: false,
|
|
163
|
-
inputs: [
|
|
164
|
-
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
165
|
-
{
|
|
166
|
-
indexed: true,
|
|
167
|
-
internalType: "address",
|
|
168
|
-
name: "account",
|
|
169
|
-
type: "address",
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
indexed: true,
|
|
173
|
-
internalType: "address",
|
|
174
|
-
name: "sender",
|
|
175
|
-
type: "address",
|
|
176
|
-
},
|
|
177
|
-
],
|
|
178
|
-
name: "RoleGranted",
|
|
179
|
-
type: "event",
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
anonymous: false,
|
|
183
|
-
inputs: [
|
|
184
|
-
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
185
|
-
{
|
|
186
|
-
indexed: true,
|
|
187
|
-
internalType: "address",
|
|
188
|
-
name: "account",
|
|
189
|
-
type: "address",
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
indexed: true,
|
|
193
|
-
internalType: "address",
|
|
194
|
-
name: "sender",
|
|
195
|
-
type: "address",
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
-
name: "RoleRevoked",
|
|
199
|
-
type: "event",
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
inputs: [],
|
|
203
|
-
name: "BORROWER_ROUTER_ROLE",
|
|
204
|
-
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
205
|
-
stateMutability: "view",
|
|
206
|
-
type: "function",
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
inputs: [],
|
|
210
|
-
name: "DEFAULT_ADMIN_ROLE",
|
|
211
|
-
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
212
|
-
stateMutability: "view",
|
|
213
|
-
type: "function",
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
inputs: [
|
|
217
|
-
{ internalType: "address", name: "collateralAddress", type: "address" },
|
|
218
|
-
{ internalType: "uint256", name: "_interestRate", type: "uint256" },
|
|
219
|
-
{ internalType: "uint256", name: "maxLendPerToken", type: "uint256" },
|
|
220
|
-
{ internalType: "uint256", name: "minAmount", type: "uint256" },
|
|
221
|
-
],
|
|
222
|
-
name: "addCollateral",
|
|
223
|
-
outputs: [],
|
|
224
|
-
stateMutability: "nonpayable",
|
|
225
|
-
type: "function",
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
229
|
-
name: "collateralMapping",
|
|
230
|
-
outputs: [
|
|
231
|
-
{ internalType: "address", name: "collateralAddress", type: "address" },
|
|
232
|
-
{ internalType: "uint256", name: "maxLendPerToken", type: "uint256" },
|
|
233
|
-
{ internalType: "uint256", name: "interestRate", type: "uint256" },
|
|
234
|
-
{ internalType: "bool", name: "active", type: "bool" },
|
|
235
|
-
{ internalType: "uint256", name: "minAmount", type: "uint256" },
|
|
236
|
-
],
|
|
237
|
-
stateMutability: "view",
|
|
238
|
-
type: "function",
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
|
|
242
|
-
name: "deposit",
|
|
243
|
-
outputs: [],
|
|
244
|
-
stateMutability: "nonpayable",
|
|
245
|
-
type: "function",
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
inputs: [],
|
|
249
|
-
name: "getBalance",
|
|
250
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
251
|
-
stateMutability: "view",
|
|
252
|
-
type: "function",
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
inputs: [{ internalType: "bytes32", name: "role", type: "bytes32" }],
|
|
256
|
-
name: "getRoleAdmin",
|
|
257
|
-
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
258
|
-
stateMutability: "view",
|
|
259
|
-
type: "function",
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
inputs: [{ internalType: "address", name: "account", type: "address" }],
|
|
263
|
-
name: "grantBorrowerRouterRole",
|
|
264
|
-
outputs: [],
|
|
265
|
-
stateMutability: "nonpayable",
|
|
266
|
-
type: "function",
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
inputs: [
|
|
270
|
-
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
271
|
-
{ internalType: "address", name: "account", type: "address" },
|
|
272
|
-
],
|
|
273
|
-
name: "grantRole",
|
|
274
|
-
outputs: [],
|
|
275
|
-
stateMutability: "nonpayable",
|
|
276
|
-
type: "function",
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
inputs: [
|
|
280
|
-
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
281
|
-
{ internalType: "address", name: "account", type: "address" },
|
|
282
|
-
],
|
|
283
|
-
name: "hasRole",
|
|
284
|
-
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
285
|
-
stateMutability: "view",
|
|
286
|
-
type: "function",
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
inputs: [
|
|
290
|
-
{ internalType: "address", name: "_tokenAddress", type: "address" },
|
|
291
|
-
],
|
|
292
|
-
name: "initialize",
|
|
293
|
-
outputs: [],
|
|
294
|
-
stateMutability: "nonpayable",
|
|
295
|
-
type: "function",
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
inputs: [
|
|
299
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
300
|
-
{ internalType: "uint256", name: "collateralAmount", type: "uint256" },
|
|
301
|
-
{ internalType: "address", name: "collateralAddress", type: "address" },
|
|
302
|
-
{ internalType: "address", name: "borrower", type: "address" },
|
|
303
|
-
{ internalType: "uint256", name: "userPaid", type: "uint256" },
|
|
304
|
-
],
|
|
305
|
-
name: "loanConfirmation",
|
|
306
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
307
|
-
stateMutability: "nonpayable",
|
|
308
|
-
type: "function",
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
312
|
-
name: "loans",
|
|
313
|
-
outputs: [
|
|
314
|
-
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
315
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
316
|
-
{
|
|
317
|
-
components: [
|
|
318
|
-
{
|
|
319
|
-
internalType: "address",
|
|
320
|
-
name: "collateralAddress",
|
|
321
|
-
type: "address",
|
|
322
|
-
},
|
|
323
|
-
{ internalType: "uint256", name: "maxLendPerToken", type: "uint256" },
|
|
324
|
-
{ internalType: "uint256", name: "interestRate", type: "uint256" },
|
|
325
|
-
{ internalType: "bool", name: "active", type: "bool" },
|
|
326
|
-
{ internalType: "uint256", name: "minAmount", type: "uint256" },
|
|
327
|
-
],
|
|
328
|
-
internalType: "struct Collateral",
|
|
329
|
-
name: "collateral",
|
|
330
|
-
type: "tuple",
|
|
331
|
-
},
|
|
332
|
-
{ internalType: "uint256", name: "collateralAmount", type: "uint256" },
|
|
333
|
-
{ internalType: "uint256", name: "timestamp", type: "uint256" },
|
|
334
|
-
{ internalType: "address", name: "borrower", type: "address" },
|
|
335
|
-
{ internalType: "uint256", name: "userPaid", type: "uint256" },
|
|
336
|
-
],
|
|
337
|
-
stateMutability: "view",
|
|
338
|
-
type: "function",
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
inputs: [],
|
|
342
|
-
name: "nextLoanId",
|
|
343
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
344
|
-
stateMutability: "view",
|
|
345
|
-
type: "function",
|
|
346
|
-
},
|
|
347
|
-
{
|
|
348
|
-
inputs: [
|
|
349
|
-
{
|
|
350
|
-
internalType: "contract IERC20",
|
|
351
|
-
name: "flashLoanToken",
|
|
352
|
-
type: "address",
|
|
353
|
-
},
|
|
354
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
355
|
-
],
|
|
356
|
-
name: "privilegedLoan",
|
|
357
|
-
outputs: [],
|
|
358
|
-
stateMutability: "nonpayable",
|
|
359
|
-
type: "function",
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
inputs: [
|
|
363
|
-
{ internalType: "address", name: "collateralAddress", type: "address" },
|
|
364
|
-
],
|
|
365
|
-
name: "removeCollateral",
|
|
366
|
-
outputs: [],
|
|
367
|
-
stateMutability: "nonpayable",
|
|
368
|
-
type: "function",
|
|
369
|
-
},
|
|
370
|
-
{
|
|
371
|
-
inputs: [
|
|
372
|
-
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
373
|
-
{ internalType: "address", name: "callerConfirmation", type: "address" },
|
|
374
|
-
],
|
|
375
|
-
name: "renounceRole",
|
|
376
|
-
outputs: [],
|
|
377
|
-
stateMutability: "nonpayable",
|
|
378
|
-
type: "function",
|
|
379
|
-
},
|
|
380
|
-
{
|
|
381
|
-
inputs: [{ internalType: "uint256", name: "loanId", type: "uint256" }],
|
|
382
|
-
name: "repayLoan",
|
|
383
|
-
outputs: [],
|
|
384
|
-
stateMutability: "nonpayable",
|
|
385
|
-
type: "function",
|
|
386
|
-
},
|
|
387
|
-
{
|
|
388
|
-
inputs: [{ internalType: "address", name: "account", type: "address" }],
|
|
389
|
-
name: "revokeBorrowerRouterRole",
|
|
390
|
-
outputs: [],
|
|
391
|
-
stateMutability: "nonpayable",
|
|
392
|
-
type: "function",
|
|
393
|
-
},
|
|
394
|
-
{
|
|
395
|
-
inputs: [
|
|
396
|
-
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
397
|
-
{ internalType: "address", name: "account", type: "address" },
|
|
398
|
-
],
|
|
399
|
-
name: "revokeRole",
|
|
400
|
-
outputs: [],
|
|
401
|
-
stateMutability: "nonpayable",
|
|
402
|
-
type: "function",
|
|
403
|
-
},
|
|
404
|
-
{
|
|
405
|
-
inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
|
|
406
|
-
name: "supportsInterface",
|
|
407
|
-
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
408
|
-
stateMutability: "view",
|
|
409
|
-
type: "function",
|
|
410
|
-
},
|
|
411
|
-
{
|
|
412
|
-
inputs: [],
|
|
413
|
-
name: "tokenHolded",
|
|
414
|
-
outputs: [{ internalType: "contract IERC20", name: "", type: "address" }],
|
|
415
|
-
stateMutability: "view",
|
|
416
|
-
type: "function",
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
inputs: [
|
|
420
|
-
{
|
|
421
|
-
internalType: "address[]",
|
|
422
|
-
name: "collateralAddresses",
|
|
423
|
-
type: "address[]",
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
internalType: "uint256[]",
|
|
427
|
-
name: "newMaxLendPerTokens",
|
|
428
|
-
type: "uint256[]",
|
|
429
|
-
},
|
|
430
|
-
],
|
|
431
|
-
name: "updateMaxLendPerTokenBulk",
|
|
432
|
-
outputs: [],
|
|
433
|
-
stateMutability: "nonpayable",
|
|
434
|
-
type: "function",
|
|
435
|
-
},
|
|
436
|
-
{
|
|
437
|
-
inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
|
|
438
|
-
name: "withdraw",
|
|
439
|
-
outputs: [],
|
|
440
|
-
stateMutability: "nonpayable",
|
|
441
|
-
type: "function",
|
|
442
|
-
},
|
|
443
|
-
];
|
|
1
|
+
export const tokenHolderAbi = [{"type":"function","name":"BORROWER_ROUTER_ROLE","inputs":[],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"DEFAULT_ADMIN_ROLE","inputs":[],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"activeLoanIds","inputs":[{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"addCollateral","inputs":[{"name":"collateralAddress","type":"address","internalType":"address"},{"name":"_interestRate","type":"uint256","internalType":"uint256"},{"name":"maxLendPerToken","type":"uint256","internalType":"uint256"},{"name":"minAmount","type":"uint256","internalType":"uint256"},{"name":"maxExposure","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"collateralMapping","inputs":[{"name":"","type":"address","internalType":"address"}],"outputs":[{"name":"collateralAddress","type":"address","internalType":"address"},{"name":"maxLendPerToken","type":"uint256","internalType":"uint256"},{"name":"interestRate","type":"uint256","internalType":"uint256"},{"name":"active","type":"bool","internalType":"bool"},{"name":"minAmount","type":"uint256","internalType":"uint256"},{"name":"maxExposure","type":"uint256","internalType":"uint256"},{"name":"currentExposure","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"deposit","inputs":[{"name":"amount","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"getActiveLoanCount","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getActiveLoansBatch","inputs":[{"name":"startIndex","type":"uint256","internalType":"uint256"},{"name":"batchSize","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"tuple[]","internalType":"struct Loan[]","components":[{"name":"id","type":"uint256","internalType":"uint256"},{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"collateral","type":"tuple","internalType":"struct Collateral","components":[{"name":"collateralAddress","type":"address","internalType":"address"},{"name":"maxLendPerToken","type":"uint256","internalType":"uint256"},{"name":"interestRate","type":"uint256","internalType":"uint256"},{"name":"active","type":"bool","internalType":"bool"},{"name":"minAmount","type":"uint256","internalType":"uint256"},{"name":"maxExposure","type":"uint256","internalType":"uint256"},{"name":"currentExposure","type":"uint256","internalType":"uint256"}]},{"name":"collateralAmount","type":"uint256","internalType":"uint256"},{"name":"timestamp","type":"uint256","internalType":"uint256"},{"name":"borrower","type":"address","internalType":"address"},{"name":"userPaid","type":"uint256","internalType":"uint256"}]}],"stateMutability":"view"},{"type":"function","name":"getAvailableExposure","inputs":[{"name":"collateralAddress","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getBalance","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getCollateralExposure","inputs":[{"name":"collateralAddress","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getLoansByBorrower","inputs":[{"name":"borrower","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"tuple[]","internalType":"struct Loan[]","components":[{"name":"id","type":"uint256","internalType":"uint256"},{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"collateral","type":"tuple","internalType":"struct Collateral","components":[{"name":"collateralAddress","type":"address","internalType":"address"},{"name":"maxLendPerToken","type":"uint256","internalType":"uint256"},{"name":"interestRate","type":"uint256","internalType":"uint256"},{"name":"active","type":"bool","internalType":"bool"},{"name":"minAmount","type":"uint256","internalType":"uint256"},{"name":"maxExposure","type":"uint256","internalType":"uint256"},{"name":"currentExposure","type":"uint256","internalType":"uint256"}]},{"name":"collateralAmount","type":"uint256","internalType":"uint256"},{"name":"timestamp","type":"uint256","internalType":"uint256"},{"name":"borrower","type":"address","internalType":"address"},{"name":"userPaid","type":"uint256","internalType":"uint256"}]}],"stateMutability":"view"},{"type":"function","name":"getRoleAdmin","inputs":[{"name":"role","type":"bytes32","internalType":"bytes32"}],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"grantBorrowerRouterRole","inputs":[{"name":"account","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"grantRole","inputs":[{"name":"role","type":"bytes32","internalType":"bytes32"},{"name":"account","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"hasRole","inputs":[{"name":"role","type":"bytes32","internalType":"bytes32"},{"name":"account","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"initialize","inputs":[{"name":"_tokenAddress","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"loanConfirmation","inputs":[{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"collateralAmount","type":"uint256","internalType":"uint256"},{"name":"collateralAddress","type":"address","internalType":"address"},{"name":"borrower","type":"address","internalType":"address"},{"name":"userPaid","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"nonpayable"},{"type":"function","name":"loans","inputs":[{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"id","type":"uint256","internalType":"uint256"},{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"collateral","type":"tuple","internalType":"struct Collateral","components":[{"name":"collateralAddress","type":"address","internalType":"address"},{"name":"maxLendPerToken","type":"uint256","internalType":"uint256"},{"name":"interestRate","type":"uint256","internalType":"uint256"},{"name":"active","type":"bool","internalType":"bool"},{"name":"minAmount","type":"uint256","internalType":"uint256"},{"name":"maxExposure","type":"uint256","internalType":"uint256"},{"name":"currentExposure","type":"uint256","internalType":"uint256"}]},{"name":"collateralAmount","type":"uint256","internalType":"uint256"},{"name":"timestamp","type":"uint256","internalType":"uint256"},{"name":"borrower","type":"address","internalType":"address"},{"name":"userPaid","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"nextLoanId","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"privilegedLoan","inputs":[{"name":"flashLoanToken","type":"address","internalType":"contract IERC20"},{"name":"amount","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"removeCollateral","inputs":[{"name":"collateralAddress","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"renounceRole","inputs":[{"name":"role","type":"bytes32","internalType":"bytes32"},{"name":"callerConfirmation","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"repayLoan","inputs":[{"name":"loanId","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"revokeBorrowerRouterRole","inputs":[{"name":"account","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"revokeRole","inputs":[{"name":"role","type":"bytes32","internalType":"bytes32"},{"name":"account","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"supportsInterface","inputs":[{"name":"interfaceId","type":"bytes4","internalType":"bytes4"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"tokenHolded","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IERC20"}],"stateMutability":"view"},{"type":"function","name":"updateMaxExposure","inputs":[{"name":"collateralAddress","type":"address","internalType":"address"},{"name":"newMaxExposure","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"updateMaxLendPerTokenBulk","inputs":[{"name":"collateralAddresses","type":"address[]","internalType":"address[]"},{"name":"newMaxLendPerTokens","type":"uint256[]","internalType":"uint256[]"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"withdraw","inputs":[{"name":"amount","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"event","name":"ExposureUpdated","inputs":[{"name":"collateralAddress","type":"address","indexed":false,"internalType":"address"},{"name":"currentExposure","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"name":"version","type":"uint64","indexed":false,"internalType":"uint64"}],"anonymous":false},{"type":"event","name":"InterestRateSet","inputs":[{"name":"newInterestRate","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"event","name":"LoanCreated","inputs":[{"name":"loanId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"timestamp","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"repaid","type":"bool","indexed":false,"internalType":"bool"}],"anonymous":false},{"type":"event","name":"LoanRepaid","inputs":[{"name":"loanId","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"event","name":"MaxExposureUpdated","inputs":[{"name":"collateralAddress","type":"address","indexed":false,"internalType":"address"},{"name":"oldMaxExposure","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"newMaxExposure","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"event","name":"MaxLendPerTokenUpdated","inputs":[{"name":"collateralAddress","type":"address","indexed":false,"internalType":"address"},{"name":"oldValue","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"newValue","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"event","name":"PrivilegedLoan","inputs":[{"name":"borrower","type":"address","indexed":false,"internalType":"address"},{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"event","name":"PrivilegedLoanRepaid","inputs":[{"name":"borrower","type":"address","indexed":false,"internalType":"address"},{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"name":"role","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"previousAdminRole","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"newAdminRole","type":"bytes32","indexed":true,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"name":"role","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"account","type":"address","indexed":true,"internalType":"address"},{"name":"sender","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"name":"role","type":"bytes32","indexed":true,"internalType":"bytes32"},{"name":"account","type":"address","indexed":true,"internalType":"address"},{"name":"sender","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"error","name":"AccessControlBadConfirmation","inputs":[]},{"type":"error","name":"AccessControlUnauthorizedAccount","inputs":[{"name":"account","type":"address","internalType":"address"},{"name":"neededRole","type":"bytes32","internalType":"bytes32"}]},{"type":"error","name":"InvalidInitialization","inputs":[]},{"type":"error","name":"NotInitializing","inputs":[]}]
|
package/dist/index.d.mts
CHANGED
|
@@ -2658,6 +2658,8 @@ interface BuyEvent {
|
|
|
2658
2658
|
openingPositionSize: bigint;
|
|
2659
2659
|
collateralAmount: bigint;
|
|
2660
2660
|
initialMargin: bigint;
|
|
2661
|
+
transactionHash: string;
|
|
2662
|
+
timestamp: number;
|
|
2661
2663
|
}
|
|
2662
2664
|
interface SellEvent {
|
|
2663
2665
|
trader: string;
|
|
@@ -2665,6 +2667,8 @@ interface SellEvent {
|
|
|
2665
2667
|
loanId: bigint;
|
|
2666
2668
|
closingPositionSize: bigint;
|
|
2667
2669
|
profit: bigint;
|
|
2670
|
+
transactionHash: string;
|
|
2671
|
+
timestamp: number;
|
|
2668
2672
|
}
|
|
2669
2673
|
interface LiquidationEvent {
|
|
2670
2674
|
trader: string;
|
|
@@ -2672,6 +2676,8 @@ interface LiquidationEvent {
|
|
|
2672
2676
|
loanId: bigint;
|
|
2673
2677
|
closingPositionSize: bigint;
|
|
2674
2678
|
liquidatorRepaidAmount: bigint;
|
|
2679
|
+
transactionHash: string;
|
|
2680
|
+
timestamp: number;
|
|
2675
2681
|
}
|
|
2676
2682
|
|
|
2677
2683
|
/**
|
|
@@ -2767,6 +2773,27 @@ declare function getOffersEvm(provider: Provider, tokenHolderContractAddress: st
|
|
|
2767
2773
|
address: string;
|
|
2768
2774
|
collateral: Collateral;
|
|
2769
2775
|
}>>;
|
|
2776
|
+
/**
|
|
2777
|
+
* Get the opening fee percentage
|
|
2778
|
+
* @param provider - Ethers provider
|
|
2779
|
+
* @param borrowerOpsContractAddress - BorrowerOperations contract address
|
|
2780
|
+
* @returns Opening fee as a BigNumber
|
|
2781
|
+
*/
|
|
2782
|
+
declare function getOpeningFeeEvm(provider: Provider, borrowerOpsContractAddress: string): Promise<bigint>;
|
|
2783
|
+
/**
|
|
2784
|
+
* Get the profit fee percentage
|
|
2785
|
+
* @param provider - Ethers provider
|
|
2786
|
+
* @param borrowerOpsContractAddress - BorrowerOperations contract address
|
|
2787
|
+
* @returns Profit fee as a BigNumber
|
|
2788
|
+
*/
|
|
2789
|
+
declare function getProfitFeeEvm(provider: Provider, borrowerOpsContractAddress: string): Promise<bigint>;
|
|
2790
|
+
/**
|
|
2791
|
+
* Get the token balance of the token holder contract
|
|
2792
|
+
* @param provider - Ethers provider
|
|
2793
|
+
* @param tokenHolderContractAddress - Address of the TokenHolder contract
|
|
2794
|
+
* @returns Token balance as a BigNumber
|
|
2795
|
+
*/
|
|
2796
|
+
declare function getTokenBalanceEvm(provider: Provider, tokenHolderContractAddress: string): Promise<bigint>;
|
|
2770
2797
|
|
|
2771
2798
|
declare function getPda(seed: Buffer | Buffer[], programId: PublicKey): PublicKey;
|
|
2772
2799
|
declare function getPositionAccountPDA(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, offer: ProgramAccount, seed: PublicKey): PublicKey;
|
|
@@ -2969,4 +2996,4 @@ declare const mergePositionV2: (lavarageProgram: Program<Lavarage>, position1: P
|
|
|
2969
2996
|
collateralType: PublicKey;
|
|
2970
2997
|
}>, quoteToken: PublicKey) => Promise<VersionedTransaction>;
|
|
2971
2998
|
|
|
2972
|
-
export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closePositionEvm, closeTradeV1, closeTradeV2, createTpDelegate, getAllPositions, getClosedPositions, getClosedPositionsEvm, getCollateralInfoEvm, getDelegateAccounts, getLiquidatedPositions, getLiquidatedPositionsEvm, getLoanEvm, getOffers, getOffersEvm, getOpenPositions, getPda, getPositionAccountPDA, getPositionsEvm, getUserLoansEvm, mergePositionV2, modifyTpDelegate, openPositionEvm, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate, splitPositionV2 };
|
|
2999
|
+
export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closePositionEvm, closeTradeV1, closeTradeV2, createTpDelegate, getAllPositions, getClosedPositions, getClosedPositionsEvm, getCollateralInfoEvm, getDelegateAccounts, getLiquidatedPositions, getLiquidatedPositionsEvm, getLoanEvm, getOffers, getOffersEvm, getOpenPositions, getOpeningFeeEvm, getPda, getPositionAccountPDA, getPositionsEvm, getProfitFeeEvm, getTokenBalanceEvm, getUserLoansEvm, mergePositionV2, modifyTpDelegate, openPositionEvm, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate, splitPositionV2 };
|
package/dist/index.d.ts
CHANGED
|
@@ -2658,6 +2658,8 @@ interface BuyEvent {
|
|
|
2658
2658
|
openingPositionSize: bigint;
|
|
2659
2659
|
collateralAmount: bigint;
|
|
2660
2660
|
initialMargin: bigint;
|
|
2661
|
+
transactionHash: string;
|
|
2662
|
+
timestamp: number;
|
|
2661
2663
|
}
|
|
2662
2664
|
interface SellEvent {
|
|
2663
2665
|
trader: string;
|
|
@@ -2665,6 +2667,8 @@ interface SellEvent {
|
|
|
2665
2667
|
loanId: bigint;
|
|
2666
2668
|
closingPositionSize: bigint;
|
|
2667
2669
|
profit: bigint;
|
|
2670
|
+
transactionHash: string;
|
|
2671
|
+
timestamp: number;
|
|
2668
2672
|
}
|
|
2669
2673
|
interface LiquidationEvent {
|
|
2670
2674
|
trader: string;
|
|
@@ -2672,6 +2676,8 @@ interface LiquidationEvent {
|
|
|
2672
2676
|
loanId: bigint;
|
|
2673
2677
|
closingPositionSize: bigint;
|
|
2674
2678
|
liquidatorRepaidAmount: bigint;
|
|
2679
|
+
transactionHash: string;
|
|
2680
|
+
timestamp: number;
|
|
2675
2681
|
}
|
|
2676
2682
|
|
|
2677
2683
|
/**
|
|
@@ -2767,6 +2773,27 @@ declare function getOffersEvm(provider: Provider, tokenHolderContractAddress: st
|
|
|
2767
2773
|
address: string;
|
|
2768
2774
|
collateral: Collateral;
|
|
2769
2775
|
}>>;
|
|
2776
|
+
/**
|
|
2777
|
+
* Get the opening fee percentage
|
|
2778
|
+
* @param provider - Ethers provider
|
|
2779
|
+
* @param borrowerOpsContractAddress - BorrowerOperations contract address
|
|
2780
|
+
* @returns Opening fee as a BigNumber
|
|
2781
|
+
*/
|
|
2782
|
+
declare function getOpeningFeeEvm(provider: Provider, borrowerOpsContractAddress: string): Promise<bigint>;
|
|
2783
|
+
/**
|
|
2784
|
+
* Get the profit fee percentage
|
|
2785
|
+
* @param provider - Ethers provider
|
|
2786
|
+
* @param borrowerOpsContractAddress - BorrowerOperations contract address
|
|
2787
|
+
* @returns Profit fee as a BigNumber
|
|
2788
|
+
*/
|
|
2789
|
+
declare function getProfitFeeEvm(provider: Provider, borrowerOpsContractAddress: string): Promise<bigint>;
|
|
2790
|
+
/**
|
|
2791
|
+
* Get the token balance of the token holder contract
|
|
2792
|
+
* @param provider - Ethers provider
|
|
2793
|
+
* @param tokenHolderContractAddress - Address of the TokenHolder contract
|
|
2794
|
+
* @returns Token balance as a BigNumber
|
|
2795
|
+
*/
|
|
2796
|
+
declare function getTokenBalanceEvm(provider: Provider, tokenHolderContractAddress: string): Promise<bigint>;
|
|
2770
2797
|
|
|
2771
2798
|
declare function getPda(seed: Buffer | Buffer[], programId: PublicKey): PublicKey;
|
|
2772
2799
|
declare function getPositionAccountPDA(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, offer: ProgramAccount, seed: PublicKey): PublicKey;
|
|
@@ -2969,4 +2996,4 @@ declare const mergePositionV2: (lavarageProgram: Program<Lavarage>, position1: P
|
|
|
2969
2996
|
collateralType: PublicKey;
|
|
2970
2997
|
}>, quoteToken: PublicKey) => Promise<VersionedTransaction>;
|
|
2971
2998
|
|
|
2972
|
-
export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closePositionEvm, closeTradeV1, closeTradeV2, createTpDelegate, getAllPositions, getClosedPositions, getClosedPositionsEvm, getCollateralInfoEvm, getDelegateAccounts, getLiquidatedPositions, getLiquidatedPositionsEvm, getLoanEvm, getOffers, getOffersEvm, getOpenPositions, getPda, getPositionAccountPDA, getPositionsEvm, getUserLoansEvm, mergePositionV2, modifyTpDelegate, openPositionEvm, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate, splitPositionV2 };
|
|
2999
|
+
export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closePositionEvm, closeTradeV1, closeTradeV2, createTpDelegate, getAllPositions, getClosedPositions, getClosedPositionsEvm, getCollateralInfoEvm, getDelegateAccounts, getLiquidatedPositions, getLiquidatedPositionsEvm, getLoanEvm, getOffers, getOffersEvm, getOpenPositions, getOpeningFeeEvm, getPda, getPositionAccountPDA, getPositionsEvm, getProfitFeeEvm, getTokenBalanceEvm, getUserLoansEvm, mergePositionV2, modifyTpDelegate, openPositionEvm, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate, splitPositionV2 };
|