@jup-ag/lend 0.1.9 → 0.1.10-beta.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/dist/borrow/index.d.mts +8 -5
- package/dist/borrow/index.d.ts +8 -5
- package/dist/borrow/index.mjs +4 -5
- package/dist/earn/index.d.mts +25 -15
- package/dist/earn/index.d.ts +25 -15
- package/dist/earn/index.mjs +2247 -84
- package/dist/flashloan/index.d.mts +11 -7
- package/dist/flashloan/index.d.ts +11 -7
- package/dist/flashloan/index.mjs +759 -31
- package/dist/index.d.mts +39 -36
- package/dist/index.d.ts +39 -36
- package/dist/index.mjs +5 -6
- package/dist/refinance/index.d.mts +1 -1
- package/dist/refinance/index.d.ts +1 -1
- package/dist/refinance/index.mjs +4 -5
- package/dist/shared/lend.0Rjy1SRf.mjs +70 -0
- package/dist/shared/{lend.B1GEdPEJ.d.mts → lend.34CmCyWr.d.mts} +10 -7
- package/dist/shared/{lend.B1GEdPEJ.d.ts → lend.34CmCyWr.d.ts} +10 -7
- package/dist/shared/lend.BKZOr4CM.mjs +67 -0
- package/dist/shared/{lend.BzG5ldOV.mjs → lend.BjhqzIWk.mjs} +17 -16
- package/dist/shared/lend.COO39gwN.mjs +7900 -0
- package/dist/shared/lend.tU-yHdcH.mjs +204 -0
- package/package.json +1 -1
- package/dist/shared/lend.BaZsInAi.mjs +0 -3020
- package/dist/shared/lend.CioR9-te.mjs +0 -5
- package/dist/shared/lend.Cr2l14_0.mjs +0 -741
- package/dist/shared/lend.Cw-khlBI.mjs +0 -5014
- package/dist/shared/lend.DS0KoPpL.mjs +0 -2175
package/dist/earn/index.mjs
CHANGED
|
@@ -1,21 +1,2138 @@
|
|
|
1
|
-
import { SYSVAR_INSTRUCTIONS_PUBKEY, SystemProgram
|
|
1
|
+
import { PublicKey, SYSVAR_INSTRUCTIONS_PUBKEY, SystemProgram } from '@solana/web3.js';
|
|
2
2
|
import { getAssociatedTokenAddress, getAccount, createAssociatedTokenAccountInstruction, ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync } from '@solana/spl-token';
|
|
3
|
-
import { l as liquidity } from '../shared/lend.CioR9-te.mjs';
|
|
4
3
|
import { Program } from '@coral-xyz/anchor';
|
|
5
|
-
import { b as lending, g as getLendingToken, c as getLending, d as getLendingRewardsRateModel, e as getClaimAccount, f as getLendingAdmin } from '../shared/lend.DS0KoPpL.mjs';
|
|
6
4
|
import BN$1, { BN } from 'bn.js';
|
|
7
|
-
import { g as
|
|
5
|
+
import { g as getLendingToken, b as getLending, c as getLendingRewardsRateModel, d as getClaimAccount, e as getLendingAdmin } from '../shared/lend.BKZOr4CM.mjs';
|
|
6
|
+
import { g as getLiquidity, a as getRateModel, b as getUserBorrowPosition, c as getUserSupplyPosition, d as getTokenReserveFromAsset, e as getReserve } from '../shared/lend.BjhqzIWk.mjs';
|
|
7
|
+
|
|
8
|
+
const address = "jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9";
|
|
9
|
+
const metadata = {
|
|
10
|
+
name: "lending",
|
|
11
|
+
version: "0.1.0",
|
|
12
|
+
spec: "0.1.0",
|
|
13
|
+
description: "Created with Anchor"
|
|
14
|
+
};
|
|
15
|
+
const instructions = [
|
|
16
|
+
{
|
|
17
|
+
name: "deposit",
|
|
18
|
+
discriminator: [
|
|
19
|
+
242,
|
|
20
|
+
35,
|
|
21
|
+
198,
|
|
22
|
+
137,
|
|
23
|
+
82,
|
|
24
|
+
225,
|
|
25
|
+
242,
|
|
26
|
+
182
|
|
27
|
+
],
|
|
28
|
+
accounts: [
|
|
29
|
+
{
|
|
30
|
+
name: "signer",
|
|
31
|
+
writable: true,
|
|
32
|
+
signer: true
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "depositor_token_account",
|
|
36
|
+
writable: true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "recipient_token_account",
|
|
40
|
+
writable: true
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "mint",
|
|
44
|
+
relations: [
|
|
45
|
+
"lending",
|
|
46
|
+
"rewards_rate_model"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "lending_admin"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "lending",
|
|
54
|
+
writable: true
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "f_token_mint",
|
|
58
|
+
writable: true,
|
|
59
|
+
relations: [
|
|
60
|
+
"lending"
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "supply_token_reserves_liquidity",
|
|
65
|
+
writable: true
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "lending_supply_position_on_liquidity",
|
|
69
|
+
writable: true
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "rate_model"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "vault",
|
|
76
|
+
writable: true
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "liquidity",
|
|
80
|
+
writable: true
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "liquidity_program",
|
|
84
|
+
writable: true,
|
|
85
|
+
relations: [
|
|
86
|
+
"lending_admin"
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "rewards_rate_model"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "token_program"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "associated_token_program",
|
|
97
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "system_program",
|
|
101
|
+
address: "11111111111111111111111111111111"
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
args: [
|
|
105
|
+
{
|
|
106
|
+
name: "assets",
|
|
107
|
+
type: "u64"
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
returns: "u64"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "deposit_with_min_amount_out",
|
|
114
|
+
discriminator: [
|
|
115
|
+
116,
|
|
116
|
+
144,
|
|
117
|
+
16,
|
|
118
|
+
97,
|
|
119
|
+
118,
|
|
120
|
+
109,
|
|
121
|
+
40,
|
|
122
|
+
119
|
|
123
|
+
],
|
|
124
|
+
accounts: [
|
|
125
|
+
{
|
|
126
|
+
name: "signer",
|
|
127
|
+
writable: true,
|
|
128
|
+
signer: true
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "depositor_token_account",
|
|
132
|
+
writable: true
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "recipient_token_account",
|
|
136
|
+
writable: true
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "mint",
|
|
140
|
+
relations: [
|
|
141
|
+
"lending",
|
|
142
|
+
"rewards_rate_model"
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: "lending_admin"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "lending",
|
|
150
|
+
writable: true
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: "f_token_mint",
|
|
154
|
+
writable: true,
|
|
155
|
+
relations: [
|
|
156
|
+
"lending"
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: "supply_token_reserves_liquidity",
|
|
161
|
+
writable: true
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: "lending_supply_position_on_liquidity",
|
|
165
|
+
writable: true
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "rate_model"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "vault",
|
|
172
|
+
writable: true
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "liquidity",
|
|
176
|
+
writable: true
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: "liquidity_program",
|
|
180
|
+
writable: true,
|
|
181
|
+
relations: [
|
|
182
|
+
"lending_admin"
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: "rewards_rate_model"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: "token_program"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: "associated_token_program",
|
|
193
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: "system_program",
|
|
197
|
+
address: "11111111111111111111111111111111"
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
args: [
|
|
201
|
+
{
|
|
202
|
+
name: "assets",
|
|
203
|
+
type: "u64"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: "min_amount_out",
|
|
207
|
+
type: "u64"
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: "init_lending",
|
|
213
|
+
discriminator: [
|
|
214
|
+
156,
|
|
215
|
+
224,
|
|
216
|
+
67,
|
|
217
|
+
46,
|
|
218
|
+
89,
|
|
219
|
+
189,
|
|
220
|
+
157,
|
|
221
|
+
209
|
|
222
|
+
],
|
|
223
|
+
accounts: [
|
|
224
|
+
{
|
|
225
|
+
name: "signer",
|
|
226
|
+
writable: true,
|
|
227
|
+
signer: true
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: "lending_admin",
|
|
231
|
+
writable: true
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: "mint",
|
|
235
|
+
relations: [
|
|
236
|
+
"token_reserves_liquidity"
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
name: "f_token_mint",
|
|
241
|
+
writable: true,
|
|
242
|
+
pda: {
|
|
243
|
+
seeds: [
|
|
244
|
+
{
|
|
245
|
+
kind: "const",
|
|
246
|
+
value: [
|
|
247
|
+
102,
|
|
248
|
+
95,
|
|
249
|
+
116,
|
|
250
|
+
111,
|
|
251
|
+
107,
|
|
252
|
+
101,
|
|
253
|
+
110,
|
|
254
|
+
95,
|
|
255
|
+
109,
|
|
256
|
+
105,
|
|
257
|
+
110,
|
|
258
|
+
116
|
|
259
|
+
]
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
kind: "account",
|
|
263
|
+
path: "mint"
|
|
264
|
+
}
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: "metadata_account",
|
|
270
|
+
writable: true,
|
|
271
|
+
pda: {
|
|
272
|
+
seeds: [
|
|
273
|
+
{
|
|
274
|
+
kind: "const",
|
|
275
|
+
value: [
|
|
276
|
+
109,
|
|
277
|
+
101,
|
|
278
|
+
116,
|
|
279
|
+
97,
|
|
280
|
+
100,
|
|
281
|
+
97,
|
|
282
|
+
116,
|
|
283
|
+
97
|
|
284
|
+
]
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
kind: "const",
|
|
288
|
+
value: [
|
|
289
|
+
11,
|
|
290
|
+
112,
|
|
291
|
+
101,
|
|
292
|
+
177,
|
|
293
|
+
227,
|
|
294
|
+
209,
|
|
295
|
+
124,
|
|
296
|
+
69,
|
|
297
|
+
56,
|
|
298
|
+
157,
|
|
299
|
+
82,
|
|
300
|
+
127,
|
|
301
|
+
107,
|
|
302
|
+
4,
|
|
303
|
+
195,
|
|
304
|
+
205,
|
|
305
|
+
88,
|
|
306
|
+
184,
|
|
307
|
+
108,
|
|
308
|
+
115,
|
|
309
|
+
26,
|
|
310
|
+
160,
|
|
311
|
+
253,
|
|
312
|
+
181,
|
|
313
|
+
73,
|
|
314
|
+
182,
|
|
315
|
+
209,
|
|
316
|
+
188,
|
|
317
|
+
3,
|
|
318
|
+
248,
|
|
319
|
+
41,
|
|
320
|
+
70
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
kind: "account",
|
|
325
|
+
path: "f_token_mint"
|
|
326
|
+
}
|
|
327
|
+
],
|
|
328
|
+
program: {
|
|
329
|
+
kind: "const",
|
|
330
|
+
value: [
|
|
331
|
+
11,
|
|
332
|
+
112,
|
|
333
|
+
101,
|
|
334
|
+
177,
|
|
335
|
+
227,
|
|
336
|
+
209,
|
|
337
|
+
124,
|
|
338
|
+
69,
|
|
339
|
+
56,
|
|
340
|
+
157,
|
|
341
|
+
82,
|
|
342
|
+
127,
|
|
343
|
+
107,
|
|
344
|
+
4,
|
|
345
|
+
195,
|
|
346
|
+
205,
|
|
347
|
+
88,
|
|
348
|
+
184,
|
|
349
|
+
108,
|
|
350
|
+
115,
|
|
351
|
+
26,
|
|
352
|
+
160,
|
|
353
|
+
253,
|
|
354
|
+
181,
|
|
355
|
+
73,
|
|
356
|
+
182,
|
|
357
|
+
209,
|
|
358
|
+
188,
|
|
359
|
+
3,
|
|
360
|
+
248,
|
|
361
|
+
41,
|
|
362
|
+
70
|
|
363
|
+
]
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
name: "lending",
|
|
369
|
+
writable: true,
|
|
370
|
+
pda: {
|
|
371
|
+
seeds: [
|
|
372
|
+
{
|
|
373
|
+
kind: "const",
|
|
374
|
+
value: [
|
|
375
|
+
108,
|
|
376
|
+
101,
|
|
377
|
+
110,
|
|
378
|
+
100,
|
|
379
|
+
105,
|
|
380
|
+
110,
|
|
381
|
+
103
|
|
382
|
+
]
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
kind: "account",
|
|
386
|
+
path: "mint"
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
kind: "account",
|
|
390
|
+
path: "f_token_mint"
|
|
391
|
+
}
|
|
392
|
+
]
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
name: "token_reserves_liquidity"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
name: "token_program"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
name: "system_program",
|
|
403
|
+
address: "11111111111111111111111111111111"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
name: "sysvar_instruction",
|
|
407
|
+
address: "Sysvar1nstructions1111111111111111111111111"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
name: "metadata_program",
|
|
411
|
+
address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
name: "rent",
|
|
415
|
+
address: "SysvarRent111111111111111111111111111111111"
|
|
416
|
+
}
|
|
417
|
+
],
|
|
418
|
+
args: [
|
|
419
|
+
{
|
|
420
|
+
name: "symbol",
|
|
421
|
+
type: "string"
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
name: "liquidity_program",
|
|
425
|
+
type: "pubkey"
|
|
426
|
+
}
|
|
427
|
+
]
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
name: "init_lending_admin",
|
|
431
|
+
discriminator: [
|
|
432
|
+
203,
|
|
433
|
+
185,
|
|
434
|
+
241,
|
|
435
|
+
165,
|
|
436
|
+
56,
|
|
437
|
+
254,
|
|
438
|
+
33,
|
|
439
|
+
9
|
|
440
|
+
],
|
|
441
|
+
accounts: [
|
|
442
|
+
{
|
|
443
|
+
name: "authority",
|
|
444
|
+
writable: true,
|
|
445
|
+
signer: true
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
name: "lending_admin",
|
|
449
|
+
writable: true,
|
|
450
|
+
pda: {
|
|
451
|
+
seeds: [
|
|
452
|
+
{
|
|
453
|
+
kind: "const",
|
|
454
|
+
value: [
|
|
455
|
+
108,
|
|
456
|
+
101,
|
|
457
|
+
110,
|
|
458
|
+
100,
|
|
459
|
+
105,
|
|
460
|
+
110,
|
|
461
|
+
103,
|
|
462
|
+
95,
|
|
463
|
+
97,
|
|
464
|
+
100,
|
|
465
|
+
109,
|
|
466
|
+
105,
|
|
467
|
+
110
|
|
468
|
+
]
|
|
469
|
+
}
|
|
470
|
+
]
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
name: "system_program",
|
|
475
|
+
address: "11111111111111111111111111111111"
|
|
476
|
+
}
|
|
477
|
+
],
|
|
478
|
+
args: [
|
|
479
|
+
{
|
|
480
|
+
name: "liquidity_program",
|
|
481
|
+
type: "pubkey"
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
name: "rebalancer",
|
|
485
|
+
type: "pubkey"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
name: "authority",
|
|
489
|
+
type: "pubkey"
|
|
490
|
+
}
|
|
491
|
+
]
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
name: "mint",
|
|
495
|
+
discriminator: [
|
|
496
|
+
51,
|
|
497
|
+
57,
|
|
498
|
+
225,
|
|
499
|
+
47,
|
|
500
|
+
182,
|
|
501
|
+
146,
|
|
502
|
+
137,
|
|
503
|
+
166
|
|
504
|
+
],
|
|
505
|
+
accounts: [
|
|
506
|
+
{
|
|
507
|
+
name: "signer",
|
|
508
|
+
writable: true,
|
|
509
|
+
signer: true
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
name: "depositor_token_account",
|
|
513
|
+
writable: true
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
name: "recipient_token_account",
|
|
517
|
+
writable: true
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
name: "mint",
|
|
521
|
+
relations: [
|
|
522
|
+
"lending",
|
|
523
|
+
"rewards_rate_model"
|
|
524
|
+
]
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
name: "lending_admin"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
name: "lending",
|
|
531
|
+
writable: true
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
name: "f_token_mint",
|
|
535
|
+
writable: true,
|
|
536
|
+
relations: [
|
|
537
|
+
"lending"
|
|
538
|
+
]
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
name: "supply_token_reserves_liquidity",
|
|
542
|
+
writable: true
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
name: "lending_supply_position_on_liquidity",
|
|
546
|
+
writable: true
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
name: "rate_model"
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
name: "vault",
|
|
553
|
+
writable: true
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
name: "liquidity",
|
|
557
|
+
writable: true
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
name: "liquidity_program",
|
|
561
|
+
writable: true,
|
|
562
|
+
relations: [
|
|
563
|
+
"lending_admin"
|
|
564
|
+
]
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
name: "rewards_rate_model"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
name: "token_program"
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
name: "associated_token_program",
|
|
574
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
name: "system_program",
|
|
578
|
+
address: "11111111111111111111111111111111"
|
|
579
|
+
}
|
|
580
|
+
],
|
|
581
|
+
args: [
|
|
582
|
+
{
|
|
583
|
+
name: "shares",
|
|
584
|
+
type: "u64"
|
|
585
|
+
}
|
|
586
|
+
],
|
|
587
|
+
returns: "u64"
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
name: "mint_with_max_assets",
|
|
591
|
+
discriminator: [
|
|
592
|
+
6,
|
|
593
|
+
94,
|
|
594
|
+
69,
|
|
595
|
+
122,
|
|
596
|
+
30,
|
|
597
|
+
179,
|
|
598
|
+
146,
|
|
599
|
+
171
|
|
600
|
+
],
|
|
601
|
+
accounts: [
|
|
602
|
+
{
|
|
603
|
+
name: "signer",
|
|
604
|
+
writable: true,
|
|
605
|
+
signer: true
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
name: "depositor_token_account",
|
|
609
|
+
writable: true
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
name: "recipient_token_account",
|
|
613
|
+
writable: true
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
name: "mint",
|
|
617
|
+
relations: [
|
|
618
|
+
"lending",
|
|
619
|
+
"rewards_rate_model"
|
|
620
|
+
]
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
name: "lending_admin"
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
name: "lending",
|
|
627
|
+
writable: true
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
name: "f_token_mint",
|
|
631
|
+
writable: true,
|
|
632
|
+
relations: [
|
|
633
|
+
"lending"
|
|
634
|
+
]
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
name: "supply_token_reserves_liquidity",
|
|
638
|
+
writable: true
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
name: "lending_supply_position_on_liquidity",
|
|
642
|
+
writable: true
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
name: "rate_model"
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
name: "vault",
|
|
649
|
+
writable: true
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
name: "liquidity",
|
|
653
|
+
writable: true
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
name: "liquidity_program",
|
|
657
|
+
writable: true,
|
|
658
|
+
relations: [
|
|
659
|
+
"lending_admin"
|
|
660
|
+
]
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
name: "rewards_rate_model"
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
name: "token_program"
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
name: "associated_token_program",
|
|
670
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
name: "system_program",
|
|
674
|
+
address: "11111111111111111111111111111111"
|
|
675
|
+
}
|
|
676
|
+
],
|
|
677
|
+
args: [
|
|
678
|
+
{
|
|
679
|
+
name: "shares",
|
|
680
|
+
type: "u64"
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
name: "max_assets",
|
|
684
|
+
type: "u64"
|
|
685
|
+
}
|
|
686
|
+
],
|
|
687
|
+
returns: "u64"
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
name: "rebalance",
|
|
691
|
+
discriminator: [
|
|
692
|
+
108,
|
|
693
|
+
158,
|
|
694
|
+
77,
|
|
695
|
+
9,
|
|
696
|
+
210,
|
|
697
|
+
52,
|
|
698
|
+
88,
|
|
699
|
+
62
|
|
700
|
+
],
|
|
701
|
+
accounts: [
|
|
702
|
+
{
|
|
703
|
+
name: "signer",
|
|
704
|
+
writable: true,
|
|
705
|
+
signer: true
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
name: "depositor_token_account",
|
|
709
|
+
writable: true,
|
|
710
|
+
pda: {
|
|
711
|
+
seeds: [
|
|
712
|
+
{
|
|
713
|
+
kind: "account",
|
|
714
|
+
path: "signer"
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
kind: "account",
|
|
718
|
+
path: "token_program"
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
kind: "account",
|
|
722
|
+
path: "mint"
|
|
723
|
+
}
|
|
724
|
+
],
|
|
725
|
+
program: {
|
|
726
|
+
kind: "const",
|
|
727
|
+
value: [
|
|
728
|
+
140,
|
|
729
|
+
151,
|
|
730
|
+
37,
|
|
731
|
+
143,
|
|
732
|
+
78,
|
|
733
|
+
36,
|
|
734
|
+
137,
|
|
735
|
+
241,
|
|
736
|
+
187,
|
|
737
|
+
61,
|
|
738
|
+
16,
|
|
739
|
+
41,
|
|
740
|
+
20,
|
|
741
|
+
142,
|
|
742
|
+
13,
|
|
743
|
+
131,
|
|
744
|
+
11,
|
|
745
|
+
90,
|
|
746
|
+
19,
|
|
747
|
+
153,
|
|
748
|
+
218,
|
|
749
|
+
255,
|
|
750
|
+
16,
|
|
751
|
+
132,
|
|
752
|
+
4,
|
|
753
|
+
142,
|
|
754
|
+
123,
|
|
755
|
+
216,
|
|
756
|
+
219,
|
|
757
|
+
233,
|
|
758
|
+
248,
|
|
759
|
+
89
|
|
760
|
+
]
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
},
|
|
764
|
+
{
|
|
765
|
+
name: "lending_admin"
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
name: "lending",
|
|
769
|
+
writable: true
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
name: "mint",
|
|
773
|
+
relations: [
|
|
774
|
+
"lending",
|
|
775
|
+
"rewards_rate_model"
|
|
776
|
+
]
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
name: "f_token_mint",
|
|
780
|
+
writable: true,
|
|
781
|
+
relations: [
|
|
782
|
+
"lending"
|
|
783
|
+
]
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
name: "supply_token_reserves_liquidity",
|
|
787
|
+
writable: true
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
name: "lending_supply_position_on_liquidity",
|
|
791
|
+
writable: true
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
name: "rate_model",
|
|
795
|
+
writable: true
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
name: "vault",
|
|
799
|
+
writable: true
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
name: "liquidity",
|
|
803
|
+
writable: true
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
name: "liquidity_program",
|
|
807
|
+
writable: true,
|
|
808
|
+
relations: [
|
|
809
|
+
"lending_admin"
|
|
810
|
+
]
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
name: "rewards_rate_model"
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
name: "token_program"
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
name: "associated_token_program",
|
|
820
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
name: "system_program",
|
|
824
|
+
address: "11111111111111111111111111111111"
|
|
825
|
+
}
|
|
826
|
+
],
|
|
827
|
+
args: [
|
|
828
|
+
]
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
name: "redeem",
|
|
832
|
+
discriminator: [
|
|
833
|
+
184,
|
|
834
|
+
12,
|
|
835
|
+
86,
|
|
836
|
+
149,
|
|
837
|
+
70,
|
|
838
|
+
196,
|
|
839
|
+
97,
|
|
840
|
+
225
|
|
841
|
+
],
|
|
842
|
+
accounts: [
|
|
843
|
+
{
|
|
844
|
+
name: "signer",
|
|
845
|
+
writable: true,
|
|
846
|
+
signer: true
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
name: "owner_token_account",
|
|
850
|
+
writable: true
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
name: "recipient_token_account",
|
|
854
|
+
writable: true
|
|
855
|
+
},
|
|
856
|
+
{
|
|
857
|
+
name: "lending_admin"
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
name: "lending",
|
|
861
|
+
writable: true
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
name: "mint",
|
|
865
|
+
relations: [
|
|
866
|
+
"lending",
|
|
867
|
+
"rewards_rate_model"
|
|
868
|
+
]
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
name: "f_token_mint",
|
|
872
|
+
writable: true,
|
|
873
|
+
relations: [
|
|
874
|
+
"lending"
|
|
875
|
+
]
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
name: "supply_token_reserves_liquidity",
|
|
879
|
+
writable: true
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
name: "lending_supply_position_on_liquidity",
|
|
883
|
+
writable: true
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
name: "rate_model"
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
name: "vault",
|
|
890
|
+
writable: true
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
name: "claim_account",
|
|
894
|
+
writable: true
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
name: "liquidity",
|
|
898
|
+
writable: true
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
name: "liquidity_program",
|
|
902
|
+
writable: true,
|
|
903
|
+
relations: [
|
|
904
|
+
"lending_admin"
|
|
905
|
+
]
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
name: "rewards_rate_model"
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
name: "token_program"
|
|
912
|
+
},
|
|
913
|
+
{
|
|
914
|
+
name: "associated_token_program",
|
|
915
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
name: "system_program",
|
|
919
|
+
address: "11111111111111111111111111111111"
|
|
920
|
+
}
|
|
921
|
+
],
|
|
922
|
+
args: [
|
|
923
|
+
{
|
|
924
|
+
name: "shares",
|
|
925
|
+
type: "u64"
|
|
926
|
+
}
|
|
927
|
+
],
|
|
928
|
+
returns: "u64"
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
name: "redeem_with_min_amount_out",
|
|
932
|
+
discriminator: [
|
|
933
|
+
235,
|
|
934
|
+
189,
|
|
935
|
+
237,
|
|
936
|
+
56,
|
|
937
|
+
166,
|
|
938
|
+
180,
|
|
939
|
+
184,
|
|
940
|
+
149
|
|
941
|
+
],
|
|
942
|
+
accounts: [
|
|
943
|
+
{
|
|
944
|
+
name: "signer",
|
|
945
|
+
writable: true,
|
|
946
|
+
signer: true
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
name: "owner_token_account",
|
|
950
|
+
writable: true
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
name: "recipient_token_account",
|
|
954
|
+
writable: true
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
name: "lending_admin"
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
name: "lending",
|
|
961
|
+
writable: true
|
|
962
|
+
},
|
|
963
|
+
{
|
|
964
|
+
name: "mint",
|
|
965
|
+
relations: [
|
|
966
|
+
"lending",
|
|
967
|
+
"rewards_rate_model"
|
|
968
|
+
]
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
name: "f_token_mint",
|
|
972
|
+
writable: true,
|
|
973
|
+
relations: [
|
|
974
|
+
"lending"
|
|
975
|
+
]
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
name: "supply_token_reserves_liquidity",
|
|
979
|
+
writable: true
|
|
980
|
+
},
|
|
981
|
+
{
|
|
982
|
+
name: "lending_supply_position_on_liquidity",
|
|
983
|
+
writable: true
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
name: "rate_model"
|
|
987
|
+
},
|
|
988
|
+
{
|
|
989
|
+
name: "vault",
|
|
990
|
+
writable: true
|
|
991
|
+
},
|
|
992
|
+
{
|
|
993
|
+
name: "claim_account",
|
|
994
|
+
writable: true
|
|
995
|
+
},
|
|
996
|
+
{
|
|
997
|
+
name: "liquidity",
|
|
998
|
+
writable: true
|
|
999
|
+
},
|
|
1000
|
+
{
|
|
1001
|
+
name: "liquidity_program",
|
|
1002
|
+
writable: true,
|
|
1003
|
+
relations: [
|
|
1004
|
+
"lending_admin"
|
|
1005
|
+
]
|
|
1006
|
+
},
|
|
1007
|
+
{
|
|
1008
|
+
name: "rewards_rate_model"
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
name: "token_program"
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
name: "associated_token_program",
|
|
1015
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
name: "system_program",
|
|
1019
|
+
address: "11111111111111111111111111111111"
|
|
1020
|
+
}
|
|
1021
|
+
],
|
|
1022
|
+
args: [
|
|
1023
|
+
{
|
|
1024
|
+
name: "shares",
|
|
1025
|
+
type: "u64"
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
name: "min_amount_out",
|
|
1029
|
+
type: "u64"
|
|
1030
|
+
}
|
|
1031
|
+
]
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
name: "set_rewards_rate_model",
|
|
1035
|
+
discriminator: [
|
|
1036
|
+
174,
|
|
1037
|
+
231,
|
|
1038
|
+
116,
|
|
1039
|
+
203,
|
|
1040
|
+
8,
|
|
1041
|
+
58,
|
|
1042
|
+
143,
|
|
1043
|
+
203
|
|
1044
|
+
],
|
|
1045
|
+
accounts: [
|
|
1046
|
+
{
|
|
1047
|
+
name: "signer",
|
|
1048
|
+
signer: true
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
name: "lending_admin"
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
name: "lending",
|
|
1055
|
+
writable: true
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
name: "f_token_mint",
|
|
1059
|
+
relations: [
|
|
1060
|
+
"lending"
|
|
1061
|
+
]
|
|
1062
|
+
},
|
|
1063
|
+
{
|
|
1064
|
+
name: "new_rewards_rate_model"
|
|
1065
|
+
},
|
|
1066
|
+
{
|
|
1067
|
+
name: "supply_token_reserves_liquidity"
|
|
1068
|
+
}
|
|
1069
|
+
],
|
|
1070
|
+
args: [
|
|
1071
|
+
{
|
|
1072
|
+
name: "mint",
|
|
1073
|
+
type: "pubkey"
|
|
1074
|
+
}
|
|
1075
|
+
]
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
name: "update_authority",
|
|
1079
|
+
discriminator: [
|
|
1080
|
+
32,
|
|
1081
|
+
46,
|
|
1082
|
+
64,
|
|
1083
|
+
28,
|
|
1084
|
+
149,
|
|
1085
|
+
75,
|
|
1086
|
+
243,
|
|
1087
|
+
88
|
|
1088
|
+
],
|
|
1089
|
+
accounts: [
|
|
1090
|
+
{
|
|
1091
|
+
name: "signer",
|
|
1092
|
+
signer: true
|
|
1093
|
+
},
|
|
1094
|
+
{
|
|
1095
|
+
name: "lending_admin",
|
|
1096
|
+
writable: true
|
|
1097
|
+
}
|
|
1098
|
+
],
|
|
1099
|
+
args: [
|
|
1100
|
+
{
|
|
1101
|
+
name: "new_authority",
|
|
1102
|
+
type: "pubkey"
|
|
1103
|
+
}
|
|
1104
|
+
]
|
|
1105
|
+
},
|
|
1106
|
+
{
|
|
1107
|
+
name: "update_auths",
|
|
1108
|
+
discriminator: [
|
|
1109
|
+
93,
|
|
1110
|
+
96,
|
|
1111
|
+
178,
|
|
1112
|
+
156,
|
|
1113
|
+
57,
|
|
1114
|
+
117,
|
|
1115
|
+
253,
|
|
1116
|
+
209
|
|
1117
|
+
],
|
|
1118
|
+
accounts: [
|
|
1119
|
+
{
|
|
1120
|
+
name: "signer",
|
|
1121
|
+
signer: true
|
|
1122
|
+
},
|
|
1123
|
+
{
|
|
1124
|
+
name: "lending_admin",
|
|
1125
|
+
writable: true
|
|
1126
|
+
}
|
|
1127
|
+
],
|
|
1128
|
+
args: [
|
|
1129
|
+
{
|
|
1130
|
+
name: "auth_status",
|
|
1131
|
+
type: {
|
|
1132
|
+
vec: {
|
|
1133
|
+
defined: {
|
|
1134
|
+
name: "AddressBool"
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
]
|
|
1140
|
+
},
|
|
1141
|
+
{
|
|
1142
|
+
name: "update_rate",
|
|
1143
|
+
discriminator: [
|
|
1144
|
+
24,
|
|
1145
|
+
225,
|
|
1146
|
+
53,
|
|
1147
|
+
189,
|
|
1148
|
+
72,
|
|
1149
|
+
212,
|
|
1150
|
+
225,
|
|
1151
|
+
178
|
|
1152
|
+
],
|
|
1153
|
+
accounts: [
|
|
1154
|
+
{
|
|
1155
|
+
name: "lending",
|
|
1156
|
+
writable: true
|
|
1157
|
+
},
|
|
1158
|
+
{
|
|
1159
|
+
name: "mint",
|
|
1160
|
+
relations: [
|
|
1161
|
+
"lending",
|
|
1162
|
+
"supply_token_reserves_liquidity"
|
|
1163
|
+
]
|
|
1164
|
+
},
|
|
1165
|
+
{
|
|
1166
|
+
name: "f_token_mint",
|
|
1167
|
+
relations: [
|
|
1168
|
+
"lending"
|
|
1169
|
+
]
|
|
1170
|
+
},
|
|
1171
|
+
{
|
|
1172
|
+
name: "supply_token_reserves_liquidity"
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
name: "rewards_rate_model"
|
|
1176
|
+
}
|
|
1177
|
+
],
|
|
1178
|
+
args: [
|
|
1179
|
+
]
|
|
1180
|
+
},
|
|
1181
|
+
{
|
|
1182
|
+
name: "update_rebalancer",
|
|
1183
|
+
discriminator: [
|
|
1184
|
+
206,
|
|
1185
|
+
187,
|
|
1186
|
+
54,
|
|
1187
|
+
228,
|
|
1188
|
+
145,
|
|
1189
|
+
8,
|
|
1190
|
+
203,
|
|
1191
|
+
111
|
|
1192
|
+
],
|
|
1193
|
+
accounts: [
|
|
1194
|
+
{
|
|
1195
|
+
name: "signer",
|
|
1196
|
+
signer: true
|
|
1197
|
+
},
|
|
1198
|
+
{
|
|
1199
|
+
name: "lending_admin",
|
|
1200
|
+
writable: true
|
|
1201
|
+
}
|
|
1202
|
+
],
|
|
1203
|
+
args: [
|
|
1204
|
+
{
|
|
1205
|
+
name: "new_rebalancer",
|
|
1206
|
+
type: "pubkey"
|
|
1207
|
+
}
|
|
1208
|
+
]
|
|
1209
|
+
},
|
|
1210
|
+
{
|
|
1211
|
+
name: "withdraw",
|
|
1212
|
+
discriminator: [
|
|
1213
|
+
183,
|
|
1214
|
+
18,
|
|
1215
|
+
70,
|
|
1216
|
+
156,
|
|
1217
|
+
148,
|
|
1218
|
+
109,
|
|
1219
|
+
161,
|
|
1220
|
+
34
|
|
1221
|
+
],
|
|
1222
|
+
accounts: [
|
|
1223
|
+
{
|
|
1224
|
+
name: "signer",
|
|
1225
|
+
writable: true,
|
|
1226
|
+
signer: true
|
|
1227
|
+
},
|
|
1228
|
+
{
|
|
1229
|
+
name: "owner_token_account",
|
|
1230
|
+
writable: true
|
|
1231
|
+
},
|
|
1232
|
+
{
|
|
1233
|
+
name: "recipient_token_account",
|
|
1234
|
+
writable: true
|
|
1235
|
+
},
|
|
1236
|
+
{
|
|
1237
|
+
name: "lending_admin"
|
|
1238
|
+
},
|
|
1239
|
+
{
|
|
1240
|
+
name: "lending",
|
|
1241
|
+
writable: true
|
|
1242
|
+
},
|
|
1243
|
+
{
|
|
1244
|
+
name: "mint",
|
|
1245
|
+
relations: [
|
|
1246
|
+
"lending",
|
|
1247
|
+
"rewards_rate_model"
|
|
1248
|
+
]
|
|
1249
|
+
},
|
|
1250
|
+
{
|
|
1251
|
+
name: "f_token_mint",
|
|
1252
|
+
writable: true,
|
|
1253
|
+
relations: [
|
|
1254
|
+
"lending"
|
|
1255
|
+
]
|
|
1256
|
+
},
|
|
1257
|
+
{
|
|
1258
|
+
name: "supply_token_reserves_liquidity",
|
|
1259
|
+
writable: true
|
|
1260
|
+
},
|
|
1261
|
+
{
|
|
1262
|
+
name: "lending_supply_position_on_liquidity",
|
|
1263
|
+
writable: true
|
|
1264
|
+
},
|
|
1265
|
+
{
|
|
1266
|
+
name: "rate_model"
|
|
1267
|
+
},
|
|
1268
|
+
{
|
|
1269
|
+
name: "vault",
|
|
1270
|
+
writable: true
|
|
1271
|
+
},
|
|
1272
|
+
{
|
|
1273
|
+
name: "claim_account",
|
|
1274
|
+
writable: true
|
|
1275
|
+
},
|
|
1276
|
+
{
|
|
1277
|
+
name: "liquidity",
|
|
1278
|
+
writable: true
|
|
1279
|
+
},
|
|
1280
|
+
{
|
|
1281
|
+
name: "liquidity_program",
|
|
1282
|
+
writable: true,
|
|
1283
|
+
relations: [
|
|
1284
|
+
"lending_admin"
|
|
1285
|
+
]
|
|
1286
|
+
},
|
|
1287
|
+
{
|
|
1288
|
+
name: "rewards_rate_model"
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
name: "token_program"
|
|
1292
|
+
},
|
|
1293
|
+
{
|
|
1294
|
+
name: "associated_token_program",
|
|
1295
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
name: "system_program",
|
|
1299
|
+
address: "11111111111111111111111111111111"
|
|
1300
|
+
}
|
|
1301
|
+
],
|
|
1302
|
+
args: [
|
|
1303
|
+
{
|
|
1304
|
+
name: "amount",
|
|
1305
|
+
type: "u64"
|
|
1306
|
+
}
|
|
1307
|
+
],
|
|
1308
|
+
returns: "u64"
|
|
1309
|
+
},
|
|
1310
|
+
{
|
|
1311
|
+
name: "withdraw_with_max_shares_burn",
|
|
1312
|
+
discriminator: [
|
|
1313
|
+
47,
|
|
1314
|
+
197,
|
|
1315
|
+
183,
|
|
1316
|
+
171,
|
|
1317
|
+
239,
|
|
1318
|
+
18,
|
|
1319
|
+
245,
|
|
1320
|
+
171
|
|
1321
|
+
],
|
|
1322
|
+
accounts: [
|
|
1323
|
+
{
|
|
1324
|
+
name: "signer",
|
|
1325
|
+
writable: true,
|
|
1326
|
+
signer: true
|
|
1327
|
+
},
|
|
1328
|
+
{
|
|
1329
|
+
name: "owner_token_account",
|
|
1330
|
+
writable: true
|
|
1331
|
+
},
|
|
1332
|
+
{
|
|
1333
|
+
name: "recipient_token_account",
|
|
1334
|
+
writable: true
|
|
1335
|
+
},
|
|
1336
|
+
{
|
|
1337
|
+
name: "lending_admin"
|
|
1338
|
+
},
|
|
1339
|
+
{
|
|
1340
|
+
name: "lending",
|
|
1341
|
+
writable: true
|
|
1342
|
+
},
|
|
1343
|
+
{
|
|
1344
|
+
name: "mint",
|
|
1345
|
+
relations: [
|
|
1346
|
+
"lending",
|
|
1347
|
+
"rewards_rate_model"
|
|
1348
|
+
]
|
|
1349
|
+
},
|
|
1350
|
+
{
|
|
1351
|
+
name: "f_token_mint",
|
|
1352
|
+
writable: true,
|
|
1353
|
+
relations: [
|
|
1354
|
+
"lending"
|
|
1355
|
+
]
|
|
1356
|
+
},
|
|
1357
|
+
{
|
|
1358
|
+
name: "supply_token_reserves_liquidity",
|
|
1359
|
+
writable: true
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
name: "lending_supply_position_on_liquidity",
|
|
1363
|
+
writable: true
|
|
1364
|
+
},
|
|
1365
|
+
{
|
|
1366
|
+
name: "rate_model"
|
|
1367
|
+
},
|
|
1368
|
+
{
|
|
1369
|
+
name: "vault",
|
|
1370
|
+
writable: true
|
|
1371
|
+
},
|
|
1372
|
+
{
|
|
1373
|
+
name: "claim_account",
|
|
1374
|
+
writable: true
|
|
1375
|
+
},
|
|
1376
|
+
{
|
|
1377
|
+
name: "liquidity",
|
|
1378
|
+
writable: true
|
|
1379
|
+
},
|
|
1380
|
+
{
|
|
1381
|
+
name: "liquidity_program",
|
|
1382
|
+
writable: true,
|
|
1383
|
+
relations: [
|
|
1384
|
+
"lending_admin"
|
|
1385
|
+
]
|
|
1386
|
+
},
|
|
1387
|
+
{
|
|
1388
|
+
name: "rewards_rate_model"
|
|
1389
|
+
},
|
|
1390
|
+
{
|
|
1391
|
+
name: "token_program"
|
|
1392
|
+
},
|
|
1393
|
+
{
|
|
1394
|
+
name: "associated_token_program",
|
|
1395
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
1396
|
+
},
|
|
1397
|
+
{
|
|
1398
|
+
name: "system_program",
|
|
1399
|
+
address: "11111111111111111111111111111111"
|
|
1400
|
+
}
|
|
1401
|
+
],
|
|
1402
|
+
args: [
|
|
1403
|
+
{
|
|
1404
|
+
name: "amount",
|
|
1405
|
+
type: "u64"
|
|
1406
|
+
},
|
|
1407
|
+
{
|
|
1408
|
+
name: "max_shares_burn",
|
|
1409
|
+
type: "u64"
|
|
1410
|
+
}
|
|
1411
|
+
],
|
|
1412
|
+
returns: "u64"
|
|
1413
|
+
}
|
|
1414
|
+
];
|
|
1415
|
+
const accounts = [
|
|
1416
|
+
{
|
|
1417
|
+
name: "Lending",
|
|
1418
|
+
discriminator: [
|
|
1419
|
+
135,
|
|
1420
|
+
199,
|
|
1421
|
+
82,
|
|
1422
|
+
16,
|
|
1423
|
+
249,
|
|
1424
|
+
131,
|
|
1425
|
+
182,
|
|
1426
|
+
241
|
|
1427
|
+
]
|
|
1428
|
+
},
|
|
1429
|
+
{
|
|
1430
|
+
name: "LendingAdmin",
|
|
1431
|
+
discriminator: [
|
|
1432
|
+
42,
|
|
1433
|
+
8,
|
|
1434
|
+
33,
|
|
1435
|
+
220,
|
|
1436
|
+
163,
|
|
1437
|
+
40,
|
|
1438
|
+
210,
|
|
1439
|
+
5
|
|
1440
|
+
]
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
name: "LendingRewardsRateModel",
|
|
1444
|
+
discriminator: [
|
|
1445
|
+
166,
|
|
1446
|
+
72,
|
|
1447
|
+
71,
|
|
1448
|
+
131,
|
|
1449
|
+
172,
|
|
1450
|
+
74,
|
|
1451
|
+
166,
|
|
1452
|
+
181
|
|
1453
|
+
]
|
|
1454
|
+
},
|
|
1455
|
+
{
|
|
1456
|
+
name: "TokenReserve",
|
|
1457
|
+
discriminator: [
|
|
1458
|
+
21,
|
|
1459
|
+
18,
|
|
1460
|
+
59,
|
|
1461
|
+
135,
|
|
1462
|
+
120,
|
|
1463
|
+
20,
|
|
1464
|
+
31,
|
|
1465
|
+
12
|
|
1466
|
+
]
|
|
1467
|
+
},
|
|
1468
|
+
{
|
|
1469
|
+
name: "UserSupplyPosition",
|
|
1470
|
+
discriminator: [
|
|
1471
|
+
202,
|
|
1472
|
+
219,
|
|
1473
|
+
136,
|
|
1474
|
+
118,
|
|
1475
|
+
61,
|
|
1476
|
+
177,
|
|
1477
|
+
21,
|
|
1478
|
+
146
|
|
1479
|
+
]
|
|
1480
|
+
}
|
|
1481
|
+
];
|
|
1482
|
+
const events = [
|
|
1483
|
+
{
|
|
1484
|
+
name: "LogDeposit",
|
|
1485
|
+
discriminator: [
|
|
1486
|
+
176,
|
|
1487
|
+
243,
|
|
1488
|
+
1,
|
|
1489
|
+
56,
|
|
1490
|
+
142,
|
|
1491
|
+
206,
|
|
1492
|
+
1,
|
|
1493
|
+
106
|
|
1494
|
+
]
|
|
1495
|
+
},
|
|
1496
|
+
{
|
|
1497
|
+
name: "LogRebalance",
|
|
1498
|
+
discriminator: [
|
|
1499
|
+
90,
|
|
1500
|
+
67,
|
|
1501
|
+
219,
|
|
1502
|
+
41,
|
|
1503
|
+
181,
|
|
1504
|
+
118,
|
|
1505
|
+
132,
|
|
1506
|
+
9
|
|
1507
|
+
]
|
|
1508
|
+
},
|
|
1509
|
+
{
|
|
1510
|
+
name: "LogUpdateAuthority",
|
|
1511
|
+
discriminator: [
|
|
1512
|
+
150,
|
|
1513
|
+
152,
|
|
1514
|
+
157,
|
|
1515
|
+
143,
|
|
1516
|
+
6,
|
|
1517
|
+
135,
|
|
1518
|
+
193,
|
|
1519
|
+
101
|
|
1520
|
+
]
|
|
1521
|
+
},
|
|
1522
|
+
{
|
|
1523
|
+
name: "LogUpdateAuths",
|
|
1524
|
+
discriminator: [
|
|
1525
|
+
88,
|
|
1526
|
+
80,
|
|
1527
|
+
109,
|
|
1528
|
+
48,
|
|
1529
|
+
111,
|
|
1530
|
+
203,
|
|
1531
|
+
76,
|
|
1532
|
+
251
|
|
1533
|
+
]
|
|
1534
|
+
},
|
|
1535
|
+
{
|
|
1536
|
+
name: "LogUpdateRates",
|
|
1537
|
+
discriminator: [
|
|
1538
|
+
222,
|
|
1539
|
+
11,
|
|
1540
|
+
113,
|
|
1541
|
+
60,
|
|
1542
|
+
147,
|
|
1543
|
+
15,
|
|
1544
|
+
68,
|
|
1545
|
+
217
|
|
1546
|
+
]
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
name: "LogUpdateRebalancer",
|
|
1550
|
+
discriminator: [
|
|
1551
|
+
66,
|
|
1552
|
+
79,
|
|
1553
|
+
144,
|
|
1554
|
+
204,
|
|
1555
|
+
26,
|
|
1556
|
+
217,
|
|
1557
|
+
153,
|
|
1558
|
+
225
|
|
1559
|
+
]
|
|
1560
|
+
},
|
|
1561
|
+
{
|
|
1562
|
+
name: "LogUpdateRewards",
|
|
1563
|
+
discriminator: [
|
|
1564
|
+
37,
|
|
1565
|
+
13,
|
|
1566
|
+
111,
|
|
1567
|
+
186,
|
|
1568
|
+
47,
|
|
1569
|
+
245,
|
|
1570
|
+
162,
|
|
1571
|
+
121
|
|
1572
|
+
]
|
|
1573
|
+
},
|
|
1574
|
+
{
|
|
1575
|
+
name: "LogWithdraw",
|
|
1576
|
+
discriminator: [
|
|
1577
|
+
49,
|
|
1578
|
+
9,
|
|
1579
|
+
176,
|
|
1580
|
+
179,
|
|
1581
|
+
222,
|
|
1582
|
+
190,
|
|
1583
|
+
6,
|
|
1584
|
+
117
|
|
1585
|
+
]
|
|
1586
|
+
}
|
|
1587
|
+
];
|
|
1588
|
+
const errors = [
|
|
1589
|
+
{
|
|
1590
|
+
code: 6000,
|
|
1591
|
+
name: "FTokenDepositInsignificant",
|
|
1592
|
+
msg: "F_TOKEN_DEPOSIT_INSIGNIFICANT"
|
|
1593
|
+
},
|
|
1594
|
+
{
|
|
1595
|
+
code: 6001,
|
|
1596
|
+
name: "FTokenMinAmountOut",
|
|
1597
|
+
msg: "F_TOKEN_MIN_AMOUNT_OUT"
|
|
1598
|
+
},
|
|
1599
|
+
{
|
|
1600
|
+
code: 6002,
|
|
1601
|
+
name: "FTokenMaxAmount",
|
|
1602
|
+
msg: "F_TOKEN_MAX_AMOUNT"
|
|
1603
|
+
},
|
|
1604
|
+
{
|
|
1605
|
+
code: 6003,
|
|
1606
|
+
name: "FTokenInvalidParams",
|
|
1607
|
+
msg: "F_TOKEN_INVALID_PARAMS"
|
|
1608
|
+
},
|
|
1609
|
+
{
|
|
1610
|
+
code: 6004,
|
|
1611
|
+
name: "FTokenRewardsRateModelAlreadySet",
|
|
1612
|
+
msg: "F_TOKEN_REWARDS_RATE_MODEL_ALREADY_SET"
|
|
1613
|
+
},
|
|
1614
|
+
{
|
|
1615
|
+
code: 6005,
|
|
1616
|
+
name: "FTokenMaxAuthCountReached",
|
|
1617
|
+
msg: "F_TOKEN_MAX_AUTH_COUNT"
|
|
1618
|
+
},
|
|
1619
|
+
{
|
|
1620
|
+
code: 6006,
|
|
1621
|
+
name: "FTokenLiquidityExchangePriceUnexpected",
|
|
1622
|
+
msg: "F_TOKEN_LIQUIDITY_EXCHANGE_PRICE_UNEXPECTED"
|
|
1623
|
+
},
|
|
1624
|
+
{
|
|
1625
|
+
code: 6007,
|
|
1626
|
+
name: "FTokenCpiToLiquidityFailed",
|
|
1627
|
+
msg: "F_TOKEN_CPI_TO_LIQUIDITY_FAILED"
|
|
1628
|
+
},
|
|
1629
|
+
{
|
|
1630
|
+
code: 6008,
|
|
1631
|
+
name: "FTokenOnlyAuth",
|
|
1632
|
+
msg: "F_TOKEN_ONLY_AUTH"
|
|
1633
|
+
},
|
|
1634
|
+
{
|
|
1635
|
+
code: 6009,
|
|
1636
|
+
name: "FTokenOnlyAuthority",
|
|
1637
|
+
msg: "F_TOKEN_ONLY_AUTHORITY"
|
|
1638
|
+
},
|
|
1639
|
+
{
|
|
1640
|
+
code: 6010,
|
|
1641
|
+
name: "FTokenOnlyRebalancer",
|
|
1642
|
+
msg: "F_TOKEN_ONLY_REBALANCER"
|
|
1643
|
+
},
|
|
1644
|
+
{
|
|
1645
|
+
code: 6011,
|
|
1646
|
+
name: "FTokenUserSupplyPositionRequired",
|
|
1647
|
+
msg: "F_TOKEN_USER_SUPPLY_POSITION_REQUIRED"
|
|
1648
|
+
},
|
|
1649
|
+
{
|
|
1650
|
+
code: 6012,
|
|
1651
|
+
name: "FTokenLiquidityProgramMismatch",
|
|
1652
|
+
msg: "F_TOKEN_LIQUIDITY_PROGRAM_MISMATCH"
|
|
1653
|
+
}
|
|
1654
|
+
];
|
|
1655
|
+
const types = [
|
|
1656
|
+
{
|
|
1657
|
+
name: "AddressBool",
|
|
1658
|
+
type: {
|
|
1659
|
+
kind: "struct",
|
|
1660
|
+
fields: [
|
|
1661
|
+
{
|
|
1662
|
+
name: "addr",
|
|
1663
|
+
type: "pubkey"
|
|
1664
|
+
},
|
|
1665
|
+
{
|
|
1666
|
+
name: "value",
|
|
1667
|
+
type: "bool"
|
|
1668
|
+
}
|
|
1669
|
+
]
|
|
1670
|
+
}
|
|
1671
|
+
},
|
|
1672
|
+
{
|
|
1673
|
+
name: "Lending",
|
|
1674
|
+
type: {
|
|
1675
|
+
kind: "struct",
|
|
1676
|
+
fields: [
|
|
1677
|
+
{
|
|
1678
|
+
name: "mint",
|
|
1679
|
+
type: "pubkey"
|
|
1680
|
+
},
|
|
1681
|
+
{
|
|
1682
|
+
name: "f_token_mint",
|
|
1683
|
+
type: "pubkey"
|
|
1684
|
+
},
|
|
1685
|
+
{
|
|
1686
|
+
name: "lending_id",
|
|
1687
|
+
type: "u16"
|
|
1688
|
+
},
|
|
1689
|
+
{
|
|
1690
|
+
name: "decimals",
|
|
1691
|
+
docs: [
|
|
1692
|
+
"@dev number of decimals for the fToken, same as ASSET"
|
|
1693
|
+
],
|
|
1694
|
+
type: "u8"
|
|
1695
|
+
},
|
|
1696
|
+
{
|
|
1697
|
+
name: "rewards_rate_model",
|
|
1698
|
+
docs: [
|
|
1699
|
+
"@dev To read PDA of rewards rate model to get_rate instruction"
|
|
1700
|
+
],
|
|
1701
|
+
type: "pubkey"
|
|
1702
|
+
},
|
|
1703
|
+
{
|
|
1704
|
+
name: "liquidity_exchange_price",
|
|
1705
|
+
docs: [
|
|
1706
|
+
"@dev exchange price for the underlying asset in the liquidity protocol (without rewards)"
|
|
1707
|
+
],
|
|
1708
|
+
type: "u64"
|
|
1709
|
+
},
|
|
1710
|
+
{
|
|
1711
|
+
name: "token_exchange_price",
|
|
1712
|
+
docs: [
|
|
1713
|
+
"@dev exchange price between fToken and the underlying asset (with rewards)"
|
|
1714
|
+
],
|
|
1715
|
+
type: "u64"
|
|
1716
|
+
},
|
|
1717
|
+
{
|
|
1718
|
+
name: "last_update_timestamp",
|
|
1719
|
+
docs: [
|
|
1720
|
+
"@dev timestamp when exchange prices were updated the last time"
|
|
1721
|
+
],
|
|
1722
|
+
type: "u64"
|
|
1723
|
+
},
|
|
1724
|
+
{
|
|
1725
|
+
name: "token_reserves_liquidity",
|
|
1726
|
+
type: "pubkey"
|
|
1727
|
+
},
|
|
1728
|
+
{
|
|
1729
|
+
name: "supply_position_on_liquidity",
|
|
1730
|
+
type: "pubkey"
|
|
1731
|
+
},
|
|
1732
|
+
{
|
|
1733
|
+
name: "bump",
|
|
1734
|
+
type: "u8"
|
|
1735
|
+
}
|
|
1736
|
+
]
|
|
1737
|
+
}
|
|
1738
|
+
},
|
|
1739
|
+
{
|
|
1740
|
+
name: "LendingAdmin",
|
|
1741
|
+
type: {
|
|
1742
|
+
kind: "struct",
|
|
1743
|
+
fields: [
|
|
1744
|
+
{
|
|
1745
|
+
name: "authority",
|
|
1746
|
+
type: "pubkey"
|
|
1747
|
+
},
|
|
1748
|
+
{
|
|
1749
|
+
name: "liquidity_program",
|
|
1750
|
+
type: "pubkey"
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
name: "rebalancer",
|
|
1754
|
+
type: "pubkey"
|
|
1755
|
+
},
|
|
1756
|
+
{
|
|
1757
|
+
name: "next_lending_id",
|
|
1758
|
+
type: "u16"
|
|
1759
|
+
},
|
|
1760
|
+
{
|
|
1761
|
+
name: "auths",
|
|
1762
|
+
type: {
|
|
1763
|
+
vec: "pubkey"
|
|
1764
|
+
}
|
|
1765
|
+
},
|
|
1766
|
+
{
|
|
1767
|
+
name: "bump",
|
|
1768
|
+
type: "u8"
|
|
1769
|
+
}
|
|
1770
|
+
]
|
|
1771
|
+
}
|
|
1772
|
+
},
|
|
1773
|
+
{
|
|
1774
|
+
name: "LendingRewardsRateModel",
|
|
1775
|
+
type: {
|
|
1776
|
+
kind: "struct",
|
|
1777
|
+
fields: [
|
|
1778
|
+
{
|
|
1779
|
+
name: "mint",
|
|
1780
|
+
docs: [
|
|
1781
|
+
"@dev mint address"
|
|
1782
|
+
],
|
|
1783
|
+
type: "pubkey"
|
|
1784
|
+
},
|
|
1785
|
+
{
|
|
1786
|
+
name: "start_tvl",
|
|
1787
|
+
docs: [
|
|
1788
|
+
"@dev tvl below which rewards rate is 0. If current TVL is below this value, triggering `update_rate()` on the fToken",
|
|
1789
|
+
"might bring the total TVL above this cut-off."
|
|
1790
|
+
],
|
|
1791
|
+
type: "u64"
|
|
1792
|
+
},
|
|
1793
|
+
{
|
|
1794
|
+
name: "duration",
|
|
1795
|
+
docs: [
|
|
1796
|
+
"@dev for how long current rewards should run"
|
|
1797
|
+
],
|
|
1798
|
+
type: "u64"
|
|
1799
|
+
},
|
|
1800
|
+
{
|
|
1801
|
+
name: "start_time",
|
|
1802
|
+
docs: [
|
|
1803
|
+
"@dev when current rewards got started"
|
|
1804
|
+
],
|
|
1805
|
+
type: "u64"
|
|
1806
|
+
},
|
|
1807
|
+
{
|
|
1808
|
+
name: "yearly_reward",
|
|
1809
|
+
docs: [
|
|
1810
|
+
"@dev current annualized reward based on input params (duration, rewardAmount)"
|
|
1811
|
+
],
|
|
1812
|
+
type: "u64"
|
|
1813
|
+
},
|
|
1814
|
+
{
|
|
1815
|
+
name: "next_duration",
|
|
1816
|
+
docs: [
|
|
1817
|
+
"@dev Duration for the next rewards phase"
|
|
1818
|
+
],
|
|
1819
|
+
type: "u64"
|
|
1820
|
+
},
|
|
1821
|
+
{
|
|
1822
|
+
name: "next_reward_amount",
|
|
1823
|
+
docs: [
|
|
1824
|
+
"@dev Amount of rewards for the next phase"
|
|
1825
|
+
],
|
|
1826
|
+
type: "u64"
|
|
1827
|
+
},
|
|
1828
|
+
{
|
|
1829
|
+
name: "bump",
|
|
1830
|
+
type: "u8"
|
|
1831
|
+
}
|
|
1832
|
+
]
|
|
1833
|
+
}
|
|
1834
|
+
},
|
|
1835
|
+
{
|
|
1836
|
+
name: "LogDeposit",
|
|
1837
|
+
type: {
|
|
1838
|
+
kind: "struct",
|
|
1839
|
+
fields: [
|
|
1840
|
+
{
|
|
1841
|
+
name: "sender",
|
|
1842
|
+
type: "pubkey"
|
|
1843
|
+
},
|
|
1844
|
+
{
|
|
1845
|
+
name: "receiver",
|
|
1846
|
+
type: "pubkey"
|
|
1847
|
+
},
|
|
1848
|
+
{
|
|
1849
|
+
name: "assets",
|
|
1850
|
+
type: "u64"
|
|
1851
|
+
},
|
|
1852
|
+
{
|
|
1853
|
+
name: "shares_minted",
|
|
1854
|
+
type: "u64"
|
|
1855
|
+
}
|
|
1856
|
+
]
|
|
1857
|
+
}
|
|
1858
|
+
},
|
|
1859
|
+
{
|
|
1860
|
+
name: "LogRebalance",
|
|
1861
|
+
type: {
|
|
1862
|
+
kind: "struct",
|
|
1863
|
+
fields: [
|
|
1864
|
+
{
|
|
1865
|
+
name: "assets",
|
|
1866
|
+
type: "u64"
|
|
1867
|
+
}
|
|
1868
|
+
]
|
|
1869
|
+
}
|
|
1870
|
+
},
|
|
1871
|
+
{
|
|
1872
|
+
name: "LogUpdateAuthority",
|
|
1873
|
+
type: {
|
|
1874
|
+
kind: "struct",
|
|
1875
|
+
fields: [
|
|
1876
|
+
{
|
|
1877
|
+
name: "new_authority",
|
|
1878
|
+
type: "pubkey"
|
|
1879
|
+
}
|
|
1880
|
+
]
|
|
1881
|
+
}
|
|
1882
|
+
},
|
|
1883
|
+
{
|
|
1884
|
+
name: "LogUpdateAuths",
|
|
1885
|
+
type: {
|
|
1886
|
+
kind: "struct",
|
|
1887
|
+
fields: [
|
|
1888
|
+
{
|
|
1889
|
+
name: "auth_status",
|
|
1890
|
+
type: {
|
|
1891
|
+
vec: {
|
|
1892
|
+
defined: {
|
|
1893
|
+
name: "AddressBool"
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
]
|
|
1899
|
+
}
|
|
1900
|
+
},
|
|
1901
|
+
{
|
|
1902
|
+
name: "LogUpdateRates",
|
|
1903
|
+
type: {
|
|
1904
|
+
kind: "struct",
|
|
1905
|
+
fields: [
|
|
1906
|
+
{
|
|
1907
|
+
name: "token_exchange_price",
|
|
1908
|
+
type: "u64"
|
|
1909
|
+
},
|
|
1910
|
+
{
|
|
1911
|
+
name: "liquidity_exchange_price",
|
|
1912
|
+
type: "u64"
|
|
1913
|
+
}
|
|
1914
|
+
]
|
|
1915
|
+
}
|
|
1916
|
+
},
|
|
1917
|
+
{
|
|
1918
|
+
name: "LogUpdateRebalancer",
|
|
1919
|
+
type: {
|
|
1920
|
+
kind: "struct",
|
|
1921
|
+
fields: [
|
|
1922
|
+
{
|
|
1923
|
+
name: "new_rebalancer",
|
|
1924
|
+
type: "pubkey"
|
|
1925
|
+
}
|
|
1926
|
+
]
|
|
1927
|
+
}
|
|
1928
|
+
},
|
|
1929
|
+
{
|
|
1930
|
+
name: "LogUpdateRewards",
|
|
1931
|
+
type: {
|
|
1932
|
+
kind: "struct",
|
|
1933
|
+
fields: [
|
|
1934
|
+
{
|
|
1935
|
+
name: "rewards_rate_model",
|
|
1936
|
+
type: "pubkey"
|
|
1937
|
+
}
|
|
1938
|
+
]
|
|
1939
|
+
}
|
|
1940
|
+
},
|
|
1941
|
+
{
|
|
1942
|
+
name: "LogWithdraw",
|
|
1943
|
+
type: {
|
|
1944
|
+
kind: "struct",
|
|
1945
|
+
fields: [
|
|
1946
|
+
{
|
|
1947
|
+
name: "sender",
|
|
1948
|
+
type: "pubkey"
|
|
1949
|
+
},
|
|
1950
|
+
{
|
|
1951
|
+
name: "receiver",
|
|
1952
|
+
type: "pubkey"
|
|
1953
|
+
},
|
|
1954
|
+
{
|
|
1955
|
+
name: "owner",
|
|
1956
|
+
type: "pubkey"
|
|
1957
|
+
},
|
|
1958
|
+
{
|
|
1959
|
+
name: "assets",
|
|
1960
|
+
type: "u64"
|
|
1961
|
+
},
|
|
1962
|
+
{
|
|
1963
|
+
name: "shares_burned",
|
|
1964
|
+
type: "u64"
|
|
1965
|
+
}
|
|
1966
|
+
]
|
|
1967
|
+
}
|
|
1968
|
+
},
|
|
1969
|
+
{
|
|
1970
|
+
name: "TokenReserve",
|
|
1971
|
+
docs: [
|
|
1972
|
+
"Token configuration and exchange prices"
|
|
1973
|
+
],
|
|
1974
|
+
serialization: "bytemuck",
|
|
1975
|
+
repr: {
|
|
1976
|
+
kind: "c",
|
|
1977
|
+
packed: true
|
|
1978
|
+
},
|
|
1979
|
+
type: {
|
|
1980
|
+
kind: "struct",
|
|
1981
|
+
fields: [
|
|
1982
|
+
{
|
|
1983
|
+
name: "mint",
|
|
1984
|
+
type: "pubkey"
|
|
1985
|
+
},
|
|
1986
|
+
{
|
|
1987
|
+
name: "vault",
|
|
1988
|
+
type: "pubkey"
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
name: "borrow_rate",
|
|
1992
|
+
type: "u16"
|
|
1993
|
+
},
|
|
1994
|
+
{
|
|
1995
|
+
name: "fee_on_interest",
|
|
1996
|
+
type: "u16"
|
|
1997
|
+
},
|
|
1998
|
+
{
|
|
1999
|
+
name: "last_utilization",
|
|
2000
|
+
type: "u16"
|
|
2001
|
+
},
|
|
2002
|
+
{
|
|
2003
|
+
name: "last_update_timestamp",
|
|
2004
|
+
type: "u64"
|
|
2005
|
+
},
|
|
2006
|
+
{
|
|
2007
|
+
name: "supply_exchange_price",
|
|
2008
|
+
type: "u64"
|
|
2009
|
+
},
|
|
2010
|
+
{
|
|
2011
|
+
name: "borrow_exchange_price",
|
|
2012
|
+
type: "u64"
|
|
2013
|
+
},
|
|
2014
|
+
{
|
|
2015
|
+
name: "max_utilization",
|
|
2016
|
+
type: "u16"
|
|
2017
|
+
},
|
|
2018
|
+
{
|
|
2019
|
+
name: "total_supply_with_interest",
|
|
2020
|
+
type: "u64"
|
|
2021
|
+
},
|
|
2022
|
+
{
|
|
2023
|
+
name: "total_supply_interest_free",
|
|
2024
|
+
type: "u64"
|
|
2025
|
+
},
|
|
2026
|
+
{
|
|
2027
|
+
name: "total_borrow_with_interest",
|
|
2028
|
+
type: "u64"
|
|
2029
|
+
},
|
|
2030
|
+
{
|
|
2031
|
+
name: "total_borrow_interest_free",
|
|
2032
|
+
type: "u64"
|
|
2033
|
+
},
|
|
2034
|
+
{
|
|
2035
|
+
name: "total_claim_amount",
|
|
2036
|
+
type: "u64"
|
|
2037
|
+
},
|
|
2038
|
+
{
|
|
2039
|
+
name: "interacting_protocol",
|
|
2040
|
+
type: "pubkey"
|
|
2041
|
+
},
|
|
2042
|
+
{
|
|
2043
|
+
name: "interacting_timestamp",
|
|
2044
|
+
type: "u64"
|
|
2045
|
+
},
|
|
2046
|
+
{
|
|
2047
|
+
name: "interacting_balance",
|
|
2048
|
+
type: "u64"
|
|
2049
|
+
}
|
|
2050
|
+
]
|
|
2051
|
+
}
|
|
2052
|
+
},
|
|
2053
|
+
{
|
|
2054
|
+
name: "UserSupplyPosition",
|
|
2055
|
+
docs: [
|
|
2056
|
+
"User supply position"
|
|
2057
|
+
],
|
|
2058
|
+
serialization: "bytemuck",
|
|
2059
|
+
repr: {
|
|
2060
|
+
kind: "c",
|
|
2061
|
+
packed: true
|
|
2062
|
+
},
|
|
2063
|
+
type: {
|
|
2064
|
+
kind: "struct",
|
|
2065
|
+
fields: [
|
|
2066
|
+
{
|
|
2067
|
+
name: "protocol",
|
|
2068
|
+
type: "pubkey"
|
|
2069
|
+
},
|
|
2070
|
+
{
|
|
2071
|
+
name: "mint",
|
|
2072
|
+
type: "pubkey"
|
|
2073
|
+
},
|
|
2074
|
+
{
|
|
2075
|
+
name: "with_interest",
|
|
2076
|
+
type: "u8"
|
|
2077
|
+
},
|
|
2078
|
+
{
|
|
2079
|
+
name: "amount",
|
|
2080
|
+
type: "u64"
|
|
2081
|
+
},
|
|
2082
|
+
{
|
|
2083
|
+
name: "withdrawal_limit",
|
|
2084
|
+
type: "u128"
|
|
2085
|
+
},
|
|
2086
|
+
{
|
|
2087
|
+
name: "last_update",
|
|
2088
|
+
type: "u64"
|
|
2089
|
+
},
|
|
2090
|
+
{
|
|
2091
|
+
name: "expand_pct",
|
|
2092
|
+
type: "u16"
|
|
2093
|
+
},
|
|
2094
|
+
{
|
|
2095
|
+
name: "expand_duration",
|
|
2096
|
+
type: "u64"
|
|
2097
|
+
},
|
|
2098
|
+
{
|
|
2099
|
+
name: "base_withdrawal_limit",
|
|
2100
|
+
type: "u64"
|
|
2101
|
+
},
|
|
2102
|
+
{
|
|
2103
|
+
name: "status",
|
|
2104
|
+
type: "u8"
|
|
2105
|
+
}
|
|
2106
|
+
]
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
];
|
|
2110
|
+
const lending = {
|
|
2111
|
+
address: address,
|
|
2112
|
+
metadata: metadata,
|
|
2113
|
+
instructions: instructions,
|
|
2114
|
+
accounts: accounts,
|
|
2115
|
+
events: events,
|
|
2116
|
+
errors: errors,
|
|
2117
|
+
types: types
|
|
2118
|
+
};
|
|
8
2119
|
|
|
9
2120
|
const U64_MAX = new BN("18446744073709551615");
|
|
10
2121
|
const MAX_DEPOSIT = U64_MAX;
|
|
11
2122
|
const MAX_WITHDRAW = U64_MAX;
|
|
12
2123
|
const getLendingProgram = ({
|
|
13
2124
|
connection,
|
|
14
|
-
signer
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2125
|
+
signer,
|
|
2126
|
+
market
|
|
2127
|
+
}) => {
|
|
2128
|
+
let idl = { ...lending };
|
|
2129
|
+
if (market === "ethena")
|
|
2130
|
+
idl.address = "jup97Zx1NixM8UJMQFw8TtKzqTiRT3ETAJR7cVx3PfQ";
|
|
2131
|
+
return new Program(idl, {
|
|
2132
|
+
connection,
|
|
2133
|
+
publicKey: signer
|
|
2134
|
+
});
|
|
2135
|
+
};
|
|
19
2136
|
const getAccountOwner = async (account, connection) => {
|
|
20
2137
|
const info = await connection.getAccountInfo(account);
|
|
21
2138
|
if (!info)
|
|
@@ -51,16 +2168,19 @@ const getOrCreateATAInstruction = async (owner, mint, connection) => {
|
|
|
51
2168
|
}
|
|
52
2169
|
return ixs;
|
|
53
2170
|
};
|
|
2171
|
+
const getLiquidityProgramId = (market) => {
|
|
2172
|
+
return market === "ethena" ? new PublicKey("jup6QF1sNDGpkkcu6F4qaFHcRBmnSS1VgyB4uFbBvNS") : new PublicKey("jupeiUmn818Jg1ekPURTpr4mFo29p46vygyykFJ3wZC");
|
|
2173
|
+
};
|
|
54
2174
|
|
|
55
|
-
const LIQUIDITY_PROGRAM_ID = new PublicKey(liquidity.address);
|
|
56
2175
|
async function getDepositContext({
|
|
57
2176
|
asset,
|
|
58
2177
|
signer,
|
|
59
|
-
connection
|
|
2178
|
+
connection,
|
|
2179
|
+
market
|
|
60
2180
|
}) {
|
|
61
|
-
const lendingToken = getLendingToken(asset);
|
|
62
|
-
const lending$1 = getLending(asset);
|
|
63
|
-
const liquidityKey = getLiquidity();
|
|
2181
|
+
const lendingToken = getLendingToken(asset, market);
|
|
2182
|
+
const lending$1 = getLending(asset, market);
|
|
2183
|
+
const liquidityKey = getLiquidity(market);
|
|
64
2184
|
const tokenProgram = await getAccountOwner(asset, connection);
|
|
65
2185
|
return {
|
|
66
2186
|
signer,
|
|
@@ -76,25 +2196,34 @@ async function getDepositContext({
|
|
|
76
2196
|
true,
|
|
77
2197
|
tokenProgram
|
|
78
2198
|
),
|
|
79
|
-
lendingAdmin: getLendingAdmin(),
|
|
2199
|
+
lendingAdmin: getLendingAdmin(market),
|
|
80
2200
|
lending: lending$1,
|
|
81
2201
|
mint: asset,
|
|
82
2202
|
fTokenMint: lendingToken,
|
|
83
2203
|
claimAccount: getClaimAccount(
|
|
84
2204
|
asset,
|
|
85
|
-
getLendingAdmin()
|
|
2205
|
+
getLendingAdmin(market),
|
|
2206
|
+
market
|
|
2207
|
+
),
|
|
2208
|
+
supplyTokenReservesLiquidity: getTokenReserveFromAsset(
|
|
2209
|
+
asset,
|
|
2210
|
+
market
|
|
2211
|
+
),
|
|
2212
|
+
borrowTokenReservesLiquidity: getTokenReserveFromAsset(
|
|
2213
|
+
asset,
|
|
2214
|
+
market
|
|
86
2215
|
),
|
|
87
|
-
supplyTokenReservesLiquidity: getTokenReserveFromAsset(asset),
|
|
88
|
-
borrowTokenReservesLiquidity: getTokenReserveFromAsset(asset),
|
|
89
2216
|
lendingSupplyPositionOnLiquidity: getUserSupplyPosition(
|
|
90
2217
|
asset,
|
|
91
|
-
lending$1
|
|
2218
|
+
lending$1,
|
|
2219
|
+
market
|
|
92
2220
|
),
|
|
93
2221
|
lendingBorrowPositionOnLiquidity: getUserBorrowPosition(
|
|
94
2222
|
asset,
|
|
95
|
-
lending$1
|
|
2223
|
+
lending$1,
|
|
2224
|
+
market
|
|
96
2225
|
),
|
|
97
|
-
rateModel: getRateModel(asset),
|
|
2226
|
+
rateModel: getRateModel(asset, market),
|
|
98
2227
|
vault: getAssociatedTokenAddressSync(
|
|
99
2228
|
asset,
|
|
100
2229
|
liquidityKey,
|
|
@@ -102,8 +2231,11 @@ async function getDepositContext({
|
|
|
102
2231
|
tokenProgram
|
|
103
2232
|
),
|
|
104
2233
|
liquidity: liquidityKey,
|
|
105
|
-
liquidityProgram:
|
|
106
|
-
rewardsRateModel: getLendingRewardsRateModel(
|
|
2234
|
+
liquidityProgram: getLiquidityProgramId(market),
|
|
2235
|
+
rewardsRateModel: getLendingRewardsRateModel(
|
|
2236
|
+
asset,
|
|
2237
|
+
market
|
|
2238
|
+
),
|
|
107
2239
|
tokenProgram,
|
|
108
2240
|
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
109
2241
|
systemProgram: SystemProgram.programId,
|
|
@@ -114,17 +2246,19 @@ const getDepositIxs = async ({
|
|
|
114
2246
|
amount,
|
|
115
2247
|
asset,
|
|
116
2248
|
signer,
|
|
117
|
-
connection
|
|
2249
|
+
connection,
|
|
2250
|
+
market = "main"
|
|
118
2251
|
}) => {
|
|
119
2252
|
const program = getLendingProgram({
|
|
120
2253
|
connection,
|
|
121
|
-
signer
|
|
2254
|
+
signer,
|
|
2255
|
+
market
|
|
122
2256
|
});
|
|
123
2257
|
const ixs = [];
|
|
124
2258
|
ixs.push(
|
|
125
2259
|
...await getOrCreateATAInstruction(
|
|
126
2260
|
signer,
|
|
127
|
-
getLendingToken(asset),
|
|
2261
|
+
getLendingToken(asset, market),
|
|
128
2262
|
connection
|
|
129
2263
|
)
|
|
130
2264
|
);
|
|
@@ -133,7 +2267,8 @@ const getDepositIxs = async ({
|
|
|
133
2267
|
await getDepositContext({
|
|
134
2268
|
asset,
|
|
135
2269
|
signer,
|
|
136
|
-
connection
|
|
2270
|
+
connection,
|
|
2271
|
+
market
|
|
137
2272
|
})
|
|
138
2273
|
).instruction()
|
|
139
2274
|
);
|
|
@@ -143,17 +2278,19 @@ const getMintIxs = async ({
|
|
|
143
2278
|
shares,
|
|
144
2279
|
asset,
|
|
145
2280
|
signer,
|
|
146
|
-
connection
|
|
2281
|
+
connection,
|
|
2282
|
+
market = "main"
|
|
147
2283
|
}) => {
|
|
148
2284
|
const program = getLendingProgram({
|
|
149
2285
|
connection,
|
|
150
|
-
signer
|
|
2286
|
+
signer,
|
|
2287
|
+
market
|
|
151
2288
|
});
|
|
152
2289
|
const ixs = [];
|
|
153
2290
|
ixs.push(
|
|
154
2291
|
...await getOrCreateATAInstruction(
|
|
155
2292
|
signer,
|
|
156
|
-
getLendingToken(asset),
|
|
2293
|
+
getLendingToken(asset, market),
|
|
157
2294
|
connection
|
|
158
2295
|
)
|
|
159
2296
|
);
|
|
@@ -162,7 +2299,8 @@ const getMintIxs = async ({
|
|
|
162
2299
|
await getDepositContext({
|
|
163
2300
|
asset,
|
|
164
2301
|
signer,
|
|
165
|
-
connection
|
|
2302
|
+
connection,
|
|
2303
|
+
market
|
|
166
2304
|
})
|
|
167
2305
|
).instruction()
|
|
168
2306
|
);
|
|
@@ -171,11 +2309,12 @@ const getMintIxs = async ({
|
|
|
171
2309
|
async function getWithdrawContext({
|
|
172
2310
|
asset,
|
|
173
2311
|
signer,
|
|
174
|
-
connection
|
|
2312
|
+
connection,
|
|
2313
|
+
market
|
|
175
2314
|
}) {
|
|
176
|
-
const lendingToken = getLendingToken(asset);
|
|
177
|
-
const lending$1 = getLending(asset);
|
|
178
|
-
const liquidityKey = getLiquidity();
|
|
2315
|
+
const lendingToken = getLendingToken(asset, market);
|
|
2316
|
+
const lending$1 = getLending(asset, market);
|
|
2317
|
+
const liquidityKey = getLiquidity(market);
|
|
179
2318
|
const tokenProgram = await getAccountOwner(asset, connection);
|
|
180
2319
|
return {
|
|
181
2320
|
signer,
|
|
@@ -191,20 +2330,25 @@ async function getWithdrawContext({
|
|
|
191
2330
|
true,
|
|
192
2331
|
tokenProgram
|
|
193
2332
|
),
|
|
194
|
-
lendingAdmin: getLendingAdmin(),
|
|
2333
|
+
lendingAdmin: getLendingAdmin(market),
|
|
195
2334
|
lending: lending$1,
|
|
196
2335
|
mint: asset,
|
|
197
2336
|
claimAccount: getClaimAccount(
|
|
198
2337
|
asset,
|
|
199
|
-
getLendingAdmin()
|
|
2338
|
+
getLendingAdmin(market),
|
|
2339
|
+
market
|
|
200
2340
|
),
|
|
201
2341
|
fTokenMint: lendingToken,
|
|
202
|
-
supplyTokenReservesLiquidity: getTokenReserveFromAsset(
|
|
2342
|
+
supplyTokenReservesLiquidity: getTokenReserveFromAsset(
|
|
2343
|
+
asset,
|
|
2344
|
+
market
|
|
2345
|
+
),
|
|
203
2346
|
lendingSupplyPositionOnLiquidity: getUserSupplyPosition(
|
|
204
2347
|
asset,
|
|
205
|
-
lending$1
|
|
2348
|
+
lending$1,
|
|
2349
|
+
market
|
|
206
2350
|
),
|
|
207
|
-
rateModel: getRateModel(asset),
|
|
2351
|
+
rateModel: getRateModel(asset, market),
|
|
208
2352
|
vault: getAssociatedTokenAddressSync(
|
|
209
2353
|
asset,
|
|
210
2354
|
liquidityKey,
|
|
@@ -212,8 +2356,11 @@ async function getWithdrawContext({
|
|
|
212
2356
|
tokenProgram
|
|
213
2357
|
),
|
|
214
2358
|
liquidity: liquidityKey,
|
|
215
|
-
liquidityProgram:
|
|
216
|
-
rewardsRateModel: getLendingRewardsRateModel(
|
|
2359
|
+
liquidityProgram: getLiquidityProgramId(market),
|
|
2360
|
+
rewardsRateModel: getLendingRewardsRateModel(
|
|
2361
|
+
asset,
|
|
2362
|
+
market
|
|
2363
|
+
),
|
|
217
2364
|
tokenProgram,
|
|
218
2365
|
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
219
2366
|
systemProgram: SystemProgram.programId,
|
|
@@ -224,11 +2371,13 @@ const getWithdrawIxs = async ({
|
|
|
224
2371
|
amount,
|
|
225
2372
|
asset,
|
|
226
2373
|
signer,
|
|
227
|
-
connection
|
|
2374
|
+
connection,
|
|
2375
|
+
market = "main"
|
|
228
2376
|
}) => {
|
|
229
2377
|
const program = getLendingProgram({
|
|
230
2378
|
connection,
|
|
231
|
-
signer
|
|
2379
|
+
signer,
|
|
2380
|
+
market
|
|
232
2381
|
});
|
|
233
2382
|
const ixs = [];
|
|
234
2383
|
ixs.push(...await getOrCreateATAInstruction(signer, asset, connection));
|
|
@@ -237,7 +2386,8 @@ const getWithdrawIxs = async ({
|
|
|
237
2386
|
await getWithdrawContext({
|
|
238
2387
|
asset,
|
|
239
2388
|
signer,
|
|
240
|
-
connection
|
|
2389
|
+
connection,
|
|
2390
|
+
market
|
|
241
2391
|
})
|
|
242
2392
|
).instruction()
|
|
243
2393
|
);
|
|
@@ -247,11 +2397,13 @@ const getRedeemIxs = async ({
|
|
|
247
2397
|
shares,
|
|
248
2398
|
asset,
|
|
249
2399
|
signer,
|
|
250
|
-
connection
|
|
2400
|
+
connection,
|
|
2401
|
+
market = "main"
|
|
251
2402
|
}) => {
|
|
252
2403
|
const program = getLendingProgram({
|
|
253
2404
|
connection,
|
|
254
|
-
signer
|
|
2405
|
+
signer,
|
|
2406
|
+
market
|
|
255
2407
|
});
|
|
256
2408
|
const ixs = [];
|
|
257
2409
|
ixs.push(...await getOrCreateATAInstruction(signer, asset, connection));
|
|
@@ -260,7 +2412,8 @@ const getRedeemIxs = async ({
|
|
|
260
2412
|
await getWithdrawContext({
|
|
261
2413
|
asset,
|
|
262
2414
|
signer,
|
|
263
|
-
connection
|
|
2415
|
+
connection,
|
|
2416
|
+
market
|
|
264
2417
|
})
|
|
265
2418
|
).instruction()
|
|
266
2419
|
);
|
|
@@ -322,10 +2475,10 @@ const getTokenBalance = async (owner, mintAddress, conn) => {
|
|
|
322
2475
|
return 0;
|
|
323
2476
|
}
|
|
324
2477
|
};
|
|
325
|
-
async function getRewardsRate(asset, totalAssets, connection) {
|
|
326
|
-
const program = getLendingProgram({ connection });
|
|
2478
|
+
async function getRewardsRate(asset, totalAssets, connection, market) {
|
|
2479
|
+
const program = getLendingProgram({ connection, market });
|
|
327
2480
|
const currentRateModel = await program.account.lendingRewardsRateModel.fetch(
|
|
328
|
-
getLendingRewardsRateModel(asset)
|
|
2481
|
+
getLendingRewardsRateModel(asset, market)
|
|
329
2482
|
);
|
|
330
2483
|
if (totalAssets.lt(currentRateModel.startTvl)) {
|
|
331
2484
|
return {
|
|
@@ -348,10 +2501,10 @@ async function getRewardsRate(asset, totalAssets, connection) {
|
|
|
348
2501
|
rewardsStartTime: currentRateModel.startTime
|
|
349
2502
|
};
|
|
350
2503
|
}
|
|
351
|
-
async function getLiquidityExchangePricesAndConfig(assetAddress, connection) {
|
|
352
|
-
const program = getLendingProgram({ connection });
|
|
2504
|
+
async function getLiquidityExchangePricesAndConfig(assetAddress, connection, market) {
|
|
2505
|
+
const program = getLendingProgram({ connection, market });
|
|
353
2506
|
const account = await program.account.tokenReserve.fetch(
|
|
354
|
-
getReserve(assetAddress)
|
|
2507
|
+
getReserve(assetAddress, market)
|
|
355
2508
|
);
|
|
356
2509
|
const tokenReserve = {
|
|
357
2510
|
mint: account.mint,
|
|
@@ -377,8 +2530,8 @@ async function getLiquidityExchangePricesAndConfig(assetAddress, connection) {
|
|
|
377
2530
|
maxUtilization: tokenReserve.maxUtilization || new BN$1(9500)
|
|
378
2531
|
};
|
|
379
2532
|
}
|
|
380
|
-
async function getNewExchangePrice(lending, connection) {
|
|
381
|
-
const { supplyExchangePrice: liquidityExchangePrice } = await getLiquidityExchangePricesAndConfig(lending.mint, connection);
|
|
2533
|
+
async function getNewExchangePrice(lending, connection, market) {
|
|
2534
|
+
const { supplyExchangePrice: liquidityExchangePrice } = await getLiquidityExchangePricesAndConfig(lending.mint, connection, market);
|
|
382
2535
|
const oldTokenExchangePrice = new BN$1(lending.tokenExchangePrice.toString());
|
|
383
2536
|
const oldLiquidityExchangePrice = new BN$1(
|
|
384
2537
|
lending.liquidityExchangePrice.toString()
|
|
@@ -386,7 +2539,12 @@ async function getNewExchangePrice(lending, connection) {
|
|
|
386
2539
|
let totalReturnPercent = new BN$1(0);
|
|
387
2540
|
const totalSupply = await getTokenTotalSupply(lending.fTokenMint, connection);
|
|
388
2541
|
const totalAssets = oldTokenExchangePrice.mul(new BN$1(totalSupply)).div(LENDING_CONSTANTS.EXCHANGE_PRICES_PRECISION);
|
|
389
|
-
let rewardsRate = await getRewardsRate(
|
|
2542
|
+
let rewardsRate = await getRewardsRate(
|
|
2543
|
+
lending.mint,
|
|
2544
|
+
totalAssets,
|
|
2545
|
+
connection,
|
|
2546
|
+
market
|
|
2547
|
+
);
|
|
390
2548
|
if (rewardsRate.rate.gt(LENDING_CONSTANTS.MAX_REWARDS_RATE)) {
|
|
391
2549
|
rewardsRate.rate = new BN$1(0);
|
|
392
2550
|
}
|
|
@@ -432,7 +2590,7 @@ async function calculateRewardsRate(currentModel, totalAssets) {
|
|
|
432
2590
|
rewardsStartTime: new BN$1(currentModel.startTime.toString())
|
|
433
2591
|
};
|
|
434
2592
|
}
|
|
435
|
-
async function getLendingTokenRewards(lending, connection) {
|
|
2593
|
+
async function getLendingTokenRewards(lending, connection, market) {
|
|
436
2594
|
let rewardsRate = new BN$1(0);
|
|
437
2595
|
if (!lending.rewardsRateModel.equals(PublicKey.default)) {
|
|
438
2596
|
try {
|
|
@@ -443,7 +2601,8 @@ async function getLendingTokenRewards(lending, connection) {
|
|
|
443
2601
|
const totalAssets = calculateTotalAssets(lending, fTokenSupply);
|
|
444
2602
|
const currentRateModel = await fetchRewardsRateModel(
|
|
445
2603
|
lending.rewardsRateModel,
|
|
446
|
-
connection
|
|
2604
|
+
connection,
|
|
2605
|
+
market
|
|
447
2606
|
);
|
|
448
2607
|
const result = await calculateRewardsRate(currentRateModel, totalAssets);
|
|
449
2608
|
rewardsRate = result.rewardsRate;
|
|
@@ -459,9 +2618,9 @@ async function getLendingTokenRewards(lending, connection) {
|
|
|
459
2618
|
rewardsRate
|
|
460
2619
|
};
|
|
461
2620
|
}
|
|
462
|
-
async function fetchRewardsRateModel(address, connection) {
|
|
2621
|
+
async function fetchRewardsRateModel(address, connection, market) {
|
|
463
2622
|
try {
|
|
464
|
-
const program = getLendingProgram({ connection });
|
|
2623
|
+
const program = getLendingProgram({ connection, market });
|
|
465
2624
|
const fetchedAccount = await connection.getAccountInfo(address);
|
|
466
2625
|
if (!fetchedAccount) {
|
|
467
2626
|
throw new Error(
|
|
@@ -477,17 +2636,17 @@ async function fetchRewardsRateModel(address, connection) {
|
|
|
477
2636
|
throw error_;
|
|
478
2637
|
}
|
|
479
2638
|
}
|
|
480
|
-
async function convertToAssets(asset, shares, connection) {
|
|
481
|
-
const program = getLendingProgram({ connection });
|
|
2639
|
+
async function convertToAssets(asset, shares, connection, market) {
|
|
2640
|
+
const program = getLendingProgram({ connection, market });
|
|
482
2641
|
const lending$1 = await program.account.lending.fetch(
|
|
483
|
-
getLending(asset)
|
|
2642
|
+
getLending(asset, market)
|
|
484
2643
|
);
|
|
485
|
-
const exchangePrice = await getNewExchangePrice(lending$1, connection);
|
|
2644
|
+
const exchangePrice = await getNewExchangePrice(lending$1, connection, market);
|
|
486
2645
|
return shares.mul(exchangePrice).divRound(LENDING_CONSTANTS.EXCHANGE_PRICES_PRECISION);
|
|
487
2646
|
}
|
|
488
|
-
async function getTokenReserveAccount(asset, connection) {
|
|
489
|
-
const program = getLendingProgram({ connection });
|
|
490
|
-
const tokenReservePDA = getReserve(asset);
|
|
2647
|
+
async function getTokenReserveAccount(asset, connection, market) {
|
|
2648
|
+
const program = getLendingProgram({ connection, market });
|
|
2649
|
+
const tokenReservePDA = getReserve(asset, market);
|
|
491
2650
|
try {
|
|
492
2651
|
const account = await program.account.tokenReserve.fetch(tokenReservePDA);
|
|
493
2652
|
return {
|
|
@@ -510,8 +2669,8 @@ async function getTokenReserveAccount(asset, connection) {
|
|
|
510
2669
|
);
|
|
511
2670
|
}
|
|
512
2671
|
}
|
|
513
|
-
async function getTotalAmounts(asset, connection) {
|
|
514
|
-
const tokenReserve = await getTokenReserveAccount(asset, connection);
|
|
2672
|
+
async function getTotalAmounts(asset, connection, market) {
|
|
2673
|
+
const tokenReserve = await getTokenReserveAccount(asset, connection, market);
|
|
515
2674
|
if (!tokenReserve) return;
|
|
516
2675
|
return {
|
|
517
2676
|
supplyRawInterest: tokenReserve.supplyInterest,
|
|
@@ -520,10 +2679,10 @@ async function getTotalAmounts(asset, connection) {
|
|
|
520
2679
|
borrowInterestFree: tokenReserve.borrowInterestFree
|
|
521
2680
|
};
|
|
522
2681
|
}
|
|
523
|
-
async function getLiquidityAssetSupplyRate(asset, connection) {
|
|
2682
|
+
async function getLiquidityAssetSupplyRate(asset, connection, market) {
|
|
524
2683
|
const [exchangePricesAndConfig, totalAmounts] = await Promise.all([
|
|
525
|
-
getLiquidityExchangePricesAndConfig(asset, connection),
|
|
526
|
-
getTotalAmounts(asset, connection)
|
|
2684
|
+
getLiquidityExchangePricesAndConfig(asset, connection, market),
|
|
2685
|
+
getTotalAmounts(asset, connection, market)
|
|
527
2686
|
]);
|
|
528
2687
|
let supplyRate = new BN$1(0);
|
|
529
2688
|
if (!totalAmounts) {
|
|
@@ -541,9 +2700,10 @@ async function getLiquidityAssetSupplyRate(asset, connection) {
|
|
|
541
2700
|
return supplyRate;
|
|
542
2701
|
}
|
|
543
2702
|
const getLendingTokens = async ({
|
|
544
|
-
connection
|
|
2703
|
+
connection,
|
|
2704
|
+
market
|
|
545
2705
|
}) => {
|
|
546
|
-
const program = getLendingProgram({ connection });
|
|
2706
|
+
const program = getLendingProgram({ connection, market });
|
|
547
2707
|
const lending = await program.account.lending.all();
|
|
548
2708
|
const data = lending.map((l) => l.account);
|
|
549
2709
|
data.sort((a, b) => a.lendingId - b.lendingId);
|
|
@@ -551,15 +2711,16 @@ const getLendingTokens = async ({
|
|
|
551
2711
|
};
|
|
552
2712
|
const getLendingTokenDetails = async ({
|
|
553
2713
|
lendingToken,
|
|
554
|
-
connection
|
|
2714
|
+
connection,
|
|
2715
|
+
market
|
|
555
2716
|
}) => {
|
|
556
|
-
const program = getLendingProgram({ connection });
|
|
2717
|
+
const program = getLendingProgram({ connection, market });
|
|
557
2718
|
const lendingData = await getLendingData(lendingToken, program);
|
|
558
2719
|
const [assetTotalSupply, supplyRate, exchangePrice, { rewardsRate }] = await Promise.all([
|
|
559
2720
|
getTokenTotalSupply(lendingData.fTokenMint, connection),
|
|
560
|
-
getLiquidityAssetSupplyRate(lendingData.mint, connection),
|
|
561
|
-
getNewExchangePrice(lendingData, connection),
|
|
562
|
-
getLendingTokenRewards(lendingData, connection)
|
|
2721
|
+
getLiquidityAssetSupplyRate(lendingData.mint, connection, market),
|
|
2722
|
+
getNewExchangePrice(lendingData, connection, market),
|
|
2723
|
+
getLendingTokenRewards(lendingData, connection, market)
|
|
563
2724
|
]);
|
|
564
2725
|
const convertToShares = new BN$1(10).pow(new BN$1(lendingData.decimals)).mul(LENDING_CONSTANTS.EXCHANGE_PRICES_PRECISION).divRound(exchangePrice);
|
|
565
2726
|
const convertToAssets2 = new BN$1(10).pow(new BN$1(lendingData.decimals)).mul(exchangePrice).divRound(LENDING_CONSTANTS.EXCHANGE_PRICES_PRECISION);
|
|
@@ -580,18 +2741,20 @@ const getLendingTokenDetails = async ({
|
|
|
580
2741
|
const getUserLendingPositionByAsset = async ({
|
|
581
2742
|
user,
|
|
582
2743
|
asset,
|
|
583
|
-
connection
|
|
2744
|
+
connection,
|
|
2745
|
+
market
|
|
584
2746
|
}) => {
|
|
585
2747
|
const lendingTokenBalance = await getTokenBalance(
|
|
586
2748
|
user,
|
|
587
|
-
getLendingToken(asset),
|
|
2749
|
+
getLendingToken(asset, market),
|
|
588
2750
|
connection
|
|
589
2751
|
);
|
|
590
2752
|
const underlyingBalance = await getTokenBalance(user, asset, connection);
|
|
591
2753
|
const assets = await convertToAssets(
|
|
592
2754
|
asset,
|
|
593
2755
|
new BN$1(lendingTokenBalance.toString()),
|
|
594
|
-
connection
|
|
2756
|
+
connection,
|
|
2757
|
+
market
|
|
595
2758
|
);
|
|
596
2759
|
return {
|
|
597
2760
|
lendingTokenShares: new BN$1(lendingTokenBalance.toString()),
|
|
@@ -600,4 +2763,4 @@ const getUserLendingPositionByAsset = async ({
|
|
|
600
2763
|
};
|
|
601
2764
|
};
|
|
602
2765
|
|
|
603
|
-
export { MAX_DEPOSIT, MAX_WITHDRAW, U64_MAX, getAccountOwner, getDepositContext, getDepositIxs, getLendingProgram, getLendingTokenDetails, getLendingTokens, getMintIxs, getOrCreateATAInstruction, getRedeemIxs, getUserLendingPositionByAsset, getWithdrawContext, getWithdrawIxs };
|
|
2766
|
+
export { MAX_DEPOSIT, MAX_WITHDRAW, U64_MAX, getAccountOwner, getDepositContext, getDepositIxs, getLendingProgram, getLendingTokenDetails, getLendingTokens, getLiquidityProgramId, getMintIxs, getOrCreateATAInstruction, getRedeemIxs, getUserLendingPositionByAsset, getWithdrawContext, getWithdrawIxs };
|