@wireio/stake 0.1.2 → 0.2.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/lib/stake.browser.js +2360 -1742
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +4796 -82
- package/lib/stake.js +8661 -7954
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +2360 -1742
- package/lib/stake.m.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/solana/idl/liqsol_core.json +1369 -1129
- package/src/assets/solana/idl/liqsol_token.json +1 -1
- package/src/assets/solana/idl/validator_leaderboard.json +1 -1
- package/src/assets/solana/types/liqsol_core.ts +1369 -1129
- package/src/assets/solana/types/liqsol_token.ts +1 -1
- package/src/assets/solana/types/validator_leaderboard.ts +1 -1
- package/src/index.ts +1 -0
- package/src/networks/ethereum/ethereum.ts +74 -51
- package/src/networks/solana/clients/deposit.client.ts +7 -11
- package/src/networks/solana/clients/distribution.client.ts +1 -3
- package/src/networks/solana/clients/outpost.client.ts +474 -0
- package/src/networks/solana/constants.ts +90 -52
- package/src/networks/solana/solana.ts +155 -128
- package/src/networks/solana/types.ts +95 -8
- package/src/networks/solana/utils.ts +111 -94
- package/src/staker/staker.ts +1 -1
- package/src/staker/types.ts +7 -5
package/lib/stake.browser.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { PublicKey as PublicKey$1, KeyType, EvmChainID, SolChainID } from '@wireio/core';
|
|
2
|
-
import { PublicKey, StakeProgram, SystemProgram, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_CLOCK_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, SYSVAR_RENT_PUBKEY, Transaction,
|
|
2
|
+
import { PublicKey, StakeProgram, SystemProgram, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_CLOCK_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, SYSVAR_RENT_PUBKEY, Transaction, Keypair, Connection } from '@solana/web3.js';
|
|
3
3
|
import { Program, BN, AnchorProvider } from '@coral-xyz/anchor';
|
|
4
|
-
import { getAssociatedTokenAddressSync, TOKEN_2022_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddress } from '@solana/spl-token';
|
|
4
|
+
import { getAssociatedTokenAddressSync, TOKEN_2022_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddress, createAssociatedTokenAccountInstruction } from '@solana/spl-token';
|
|
5
5
|
import { ethers, Contract, BigNumber } from 'ethers';
|
|
6
6
|
|
|
7
|
-
var address$2 = "
|
|
7
|
+
var address$2 = "HR3t8mA25TdJpwLph2h2L7KhK7ynWoAByYYzgUAfd5rk";
|
|
8
8
|
var metadata$2 = {
|
|
9
9
|
name: "liqsol_core",
|
|
10
10
|
version: "0.1.0",
|
|
@@ -13,98 +13,110 @@ var metadata$2 = {
|
|
|
13
13
|
};
|
|
14
14
|
var instructions$2 = [
|
|
15
15
|
{
|
|
16
|
-
name: "
|
|
16
|
+
name: "accumulate_unstake_request",
|
|
17
|
+
docs: [
|
|
18
|
+
"Accumulate unstake requests to be processed in next allocation cycle",
|
|
19
|
+
"Multiple requests can be accumulated before calculating allocations",
|
|
20
|
+
"Returns the target epoch when this unstake request will be processed"
|
|
21
|
+
],
|
|
17
22
|
discriminator: [
|
|
18
|
-
|
|
23
|
+
24,
|
|
24
|
+
73,
|
|
25
|
+
69,
|
|
26
|
+
139,
|
|
19
27
|
36,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
124,
|
|
24
|
-
92,
|
|
25
|
-
74
|
|
28
|
+
209,
|
|
29
|
+
105,
|
|
30
|
+
252
|
|
26
31
|
],
|
|
27
32
|
accounts: [
|
|
28
33
|
{
|
|
29
|
-
name: "
|
|
34
|
+
name: "admin",
|
|
30
35
|
writable: true,
|
|
31
36
|
signer: true
|
|
32
37
|
},
|
|
33
38
|
{
|
|
34
|
-
name: "
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
name: "stake_allocation_state",
|
|
40
|
+
docs: [
|
|
41
|
+
"Stake allocation state - to accumulate pending unstake requests"
|
|
42
|
+
],
|
|
38
43
|
writable: true
|
|
39
44
|
},
|
|
40
45
|
{
|
|
41
|
-
name: "
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
name: "bond_id",
|
|
47
|
-
type: {
|
|
48
|
-
array: [
|
|
49
|
-
"u8",
|
|
50
|
-
32
|
|
51
|
-
]
|
|
52
|
-
}
|
|
46
|
+
name: "stake_metrics",
|
|
47
|
+
docs: [
|
|
48
|
+
"Stake metrics - to validate total unstake amount is available"
|
|
49
|
+
]
|
|
53
50
|
},
|
|
54
51
|
{
|
|
55
|
-
name: "
|
|
56
|
-
|
|
52
|
+
name: "maintenance_ledger",
|
|
53
|
+
docs: [
|
|
54
|
+
"Maintenance ledger - to determine target processing epoch"
|
|
55
|
+
]
|
|
57
56
|
},
|
|
58
57
|
{
|
|
59
|
-
name: "
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
name: "clock"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
args: [
|
|
62
62
|
{
|
|
63
|
-
name: "
|
|
63
|
+
name: "amount",
|
|
64
64
|
type: "u64"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
name: "roles",
|
|
68
|
-
type: {
|
|
69
|
-
array: [
|
|
70
|
-
{
|
|
71
|
-
defined: {
|
|
72
|
-
name: "Role"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
4
|
|
76
|
-
]
|
|
77
|
-
}
|
|
78
65
|
}
|
|
79
|
-
]
|
|
66
|
+
],
|
|
67
|
+
returns: "u64"
|
|
80
68
|
},
|
|
81
69
|
{
|
|
82
|
-
name: "
|
|
70
|
+
name: "add_validator_v2",
|
|
83
71
|
docs: [
|
|
84
|
-
"
|
|
72
|
+
"Add a new validator"
|
|
85
73
|
],
|
|
86
74
|
discriminator: [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
75
|
+
217,
|
|
76
|
+
158,
|
|
77
|
+
30,
|
|
78
|
+
19,
|
|
79
|
+
123,
|
|
80
|
+
99,
|
|
81
|
+
110,
|
|
82
|
+
30
|
|
95
83
|
],
|
|
96
84
|
accounts: [
|
|
97
85
|
{
|
|
98
86
|
name: "authority",
|
|
87
|
+
writable: true,
|
|
99
88
|
signer: true
|
|
100
89
|
},
|
|
101
90
|
{
|
|
102
|
-
name: "
|
|
91
|
+
name: "active_list",
|
|
92
|
+
docs: [
|
|
93
|
+
"Active list - will add the validator here"
|
|
94
|
+
],
|
|
95
|
+
writable: true
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "validator_info",
|
|
99
|
+
docs: [
|
|
100
|
+
"Create the validator info account"
|
|
101
|
+
],
|
|
102
|
+
writable: true
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "validator_transient",
|
|
106
|
+
docs: [
|
|
107
|
+
"Create the validator transient account"
|
|
108
|
+
],
|
|
103
109
|
writable: true
|
|
104
110
|
},
|
|
105
111
|
{
|
|
106
|
-
name: "
|
|
112
|
+
name: "stake_allocation_state",
|
|
113
|
+
docs: [
|
|
114
|
+
"Stake allocation state - to update total_active_vpp when adding validator"
|
|
115
|
+
],
|
|
107
116
|
writable: true
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "system_program"
|
|
108
120
|
}
|
|
109
121
|
],
|
|
110
122
|
args: [
|
|
@@ -154,111 +166,201 @@ var instructions$2 = [
|
|
|
154
166
|
]
|
|
155
167
|
},
|
|
156
168
|
{
|
|
157
|
-
name: "
|
|
169
|
+
name: "aggregate_stake_metrics",
|
|
170
|
+
docs: [
|
|
171
|
+
"V2: Aggregate stake metrics across all validators using PDA architecture"
|
|
172
|
+
],
|
|
158
173
|
discriminator: [
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
174
|
+
13,
|
|
175
|
+
245,
|
|
176
|
+
47,
|
|
177
|
+
202,
|
|
178
|
+
170,
|
|
179
|
+
73,
|
|
180
|
+
98,
|
|
181
|
+
207
|
|
167
182
|
],
|
|
168
183
|
accounts: [
|
|
169
184
|
{
|
|
170
|
-
name: "
|
|
171
|
-
writable: true,
|
|
185
|
+
name: "admin",
|
|
172
186
|
signer: true
|
|
173
187
|
},
|
|
174
188
|
{
|
|
175
|
-
name: "
|
|
189
|
+
name: "stake_metrics",
|
|
176
190
|
writable: true
|
|
177
191
|
},
|
|
178
192
|
{
|
|
179
|
-
name: "
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
193
|
+
name: "epoch_state",
|
|
194
|
+
writable: true
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: "payout_state",
|
|
198
|
+
writable: true
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: "processing_state",
|
|
202
|
+
writable: true
|
|
183
203
|
},
|
|
184
204
|
{
|
|
185
|
-
name: "
|
|
205
|
+
name: "active_list"
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
args: [
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: "blacklist_validator",
|
|
213
|
+
docs: [
|
|
214
|
+
"Blacklist a validator (user-facing, maintenance will handle graveyard movement)",
|
|
215
|
+
"UnderPerforming is set automatically when score is updated",
|
|
216
|
+
"Another serious emergency stop function"
|
|
217
|
+
],
|
|
218
|
+
discriminator: [
|
|
219
|
+
125,
|
|
220
|
+
42,
|
|
221
|
+
36,
|
|
222
|
+
229,
|
|
223
|
+
27,
|
|
224
|
+
38,
|
|
225
|
+
226,
|
|
226
|
+
62
|
|
227
|
+
],
|
|
228
|
+
accounts: [
|
|
229
|
+
{
|
|
230
|
+
name: "validator_info",
|
|
186
231
|
writable: true
|
|
187
232
|
},
|
|
188
233
|
{
|
|
189
|
-
name: "
|
|
234
|
+
name: "stake_allocation_state",
|
|
190
235
|
docs: [
|
|
191
|
-
"
|
|
236
|
+
"Stake allocation state - to update total_active_vpp when VPP changes"
|
|
192
237
|
],
|
|
238
|
+
writable: true
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
args: [
|
|
242
|
+
{
|
|
243
|
+
name: "vote_account",
|
|
244
|
+
type: "pubkey"
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: "calculate_unstake_allocations",
|
|
250
|
+
docs: [
|
|
251
|
+
"Calculate unstake allocations across validators (batched, up to 10 per call)",
|
|
252
|
+
"Distributes the FROZEN processing amount proportionally based on active stake",
|
|
253
|
+
"Call this after accumulating requests via accumulate_unstake_request"
|
|
254
|
+
],
|
|
255
|
+
discriminator: [
|
|
256
|
+
156,
|
|
257
|
+
232,
|
|
258
|
+
48,
|
|
259
|
+
116,
|
|
260
|
+
107,
|
|
261
|
+
60,
|
|
262
|
+
136,
|
|
263
|
+
140
|
|
264
|
+
],
|
|
265
|
+
accounts: [
|
|
266
|
+
{
|
|
267
|
+
name: "admin",
|
|
193
268
|
writable: true,
|
|
194
269
|
signer: true
|
|
195
270
|
},
|
|
196
271
|
{
|
|
197
|
-
name: "
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
name: "wire_receipt",
|
|
272
|
+
name: "stake_allocation_state",
|
|
201
273
|
docs: [
|
|
202
|
-
"
|
|
274
|
+
"Stake allocation state - to track unstake allocation batching"
|
|
203
275
|
],
|
|
204
276
|
writable: true
|
|
205
277
|
},
|
|
206
278
|
{
|
|
207
|
-
name: "
|
|
279
|
+
name: "stake_metrics",
|
|
280
|
+
docs: [
|
|
281
|
+
"Stake metrics - to validate total unstake amount is available"
|
|
282
|
+
]
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
name: "active_list",
|
|
286
|
+
docs: [
|
|
287
|
+
"Active validator list - to verify validators are in active list"
|
|
288
|
+
]
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
name: "maintenance_ledger",
|
|
292
|
+
docs: [
|
|
293
|
+
"Maintenance ledger - to track last unstake allocation epoch"
|
|
294
|
+
],
|
|
295
|
+
writable: true
|
|
208
296
|
}
|
|
209
297
|
],
|
|
210
298
|
args: [
|
|
211
299
|
]
|
|
212
300
|
},
|
|
213
301
|
{
|
|
214
|
-
name: "
|
|
302
|
+
name: "calculate_validator_allocations",
|
|
215
303
|
discriminator: [
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
304
|
+
48,
|
|
305
|
+
217,
|
|
306
|
+
8,
|
|
307
|
+
168,
|
|
308
|
+
228,
|
|
309
|
+
221,
|
|
310
|
+
140,
|
|
311
|
+
112
|
|
224
312
|
],
|
|
225
313
|
accounts: [
|
|
226
314
|
{
|
|
227
|
-
name: "
|
|
315
|
+
name: "admin",
|
|
228
316
|
writable: true,
|
|
229
317
|
signer: true
|
|
230
318
|
},
|
|
231
319
|
{
|
|
232
|
-
name: "
|
|
320
|
+
name: "stake_allocation_state",
|
|
233
321
|
docs: [
|
|
234
|
-
"
|
|
235
|
-
]
|
|
322
|
+
"Stake allocation state - to track rebalancing progress"
|
|
323
|
+
],
|
|
324
|
+
writable: true
|
|
236
325
|
},
|
|
237
326
|
{
|
|
238
|
-
name: "
|
|
327
|
+
name: "stake_metrics",
|
|
328
|
+
docs: [
|
|
329
|
+
"Stake metrics - to get current total active stake"
|
|
330
|
+
]
|
|
239
331
|
},
|
|
240
332
|
{
|
|
241
|
-
name: "
|
|
333
|
+
name: "active_list",
|
|
242
334
|
docs: [
|
|
243
|
-
"
|
|
335
|
+
"Active validator list - to verify validators are in active list"
|
|
244
336
|
]
|
|
245
337
|
},
|
|
246
338
|
{
|
|
247
|
-
name: "
|
|
339
|
+
name: "reserve_pool",
|
|
340
|
+
docs: [
|
|
341
|
+
"Reserve pool - to read current balance"
|
|
342
|
+
],
|
|
248
343
|
writable: true
|
|
249
344
|
},
|
|
250
345
|
{
|
|
251
|
-
name: "
|
|
346
|
+
name: "maintenance_ledger",
|
|
252
347
|
docs: [
|
|
253
|
-
"
|
|
348
|
+
"Maintenance ledger - to track last rebalance epoch"
|
|
254
349
|
],
|
|
255
350
|
writable: true
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
name: "clock"
|
|
256
354
|
}
|
|
257
355
|
],
|
|
258
356
|
args: [
|
|
259
357
|
{
|
|
260
|
-
name: "
|
|
261
|
-
type: "
|
|
358
|
+
name: "encumbered_funds",
|
|
359
|
+
type: "u64"
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
name: "validators_count",
|
|
363
|
+
type: "u8"
|
|
262
364
|
}
|
|
263
365
|
]
|
|
264
366
|
},
|
|
@@ -318,6 +420,67 @@ var instructions$2 = [
|
|
|
318
420
|
args: [
|
|
319
421
|
]
|
|
320
422
|
},
|
|
423
|
+
{
|
|
424
|
+
name: "cleanup_from_graveyard",
|
|
425
|
+
docs: [
|
|
426
|
+
"Cleanup a validator from graveyard after cooldown expires, get him outta here//"
|
|
427
|
+
],
|
|
428
|
+
discriminator: [
|
|
429
|
+
154,
|
|
430
|
+
168,
|
|
431
|
+
171,
|
|
432
|
+
22,
|
|
433
|
+
38,
|
|
434
|
+
14,
|
|
435
|
+
26,
|
|
436
|
+
229
|
|
437
|
+
],
|
|
438
|
+
accounts: [
|
|
439
|
+
{
|
|
440
|
+
name: "authority",
|
|
441
|
+
writable: true,
|
|
442
|
+
signer: true
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
name: "graveyard_list",
|
|
446
|
+
docs: [
|
|
447
|
+
"Graveyard list - will remove from here"
|
|
448
|
+
],
|
|
449
|
+
writable: true
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
name: "validator_info",
|
|
453
|
+
docs: [
|
|
454
|
+
"Validator info - check cooldown, optionally close"
|
|
455
|
+
],
|
|
456
|
+
writable: true
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
name: "validator_transient",
|
|
460
|
+
docs: [
|
|
461
|
+
"Validator transient - close and refund rent"
|
|
462
|
+
],
|
|
463
|
+
writable: true
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
name: "stake_allocation_state",
|
|
467
|
+
docs: [
|
|
468
|
+
"Stake allocation state - DO NOT update (validator not going back to active list during cleanup)",
|
|
469
|
+
"This is here for consistency but won't be used in cleanup_from_graveyard"
|
|
470
|
+
],
|
|
471
|
+
writable: true
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
name: "system_program"
|
|
475
|
+
}
|
|
476
|
+
],
|
|
477
|
+
args: [
|
|
478
|
+
{
|
|
479
|
+
name: "vote_account",
|
|
480
|
+
type: "pubkey"
|
|
481
|
+
}
|
|
482
|
+
]
|
|
483
|
+
},
|
|
321
484
|
{
|
|
322
485
|
name: "deposit",
|
|
323
486
|
discriminator: [
|
|
@@ -431,152 +594,70 @@ var instructions$2 = [
|
|
|
431
594
|
]
|
|
432
595
|
},
|
|
433
596
|
{
|
|
434
|
-
name: "
|
|
597
|
+
name: "force_validator_unstake",
|
|
435
598
|
docs: [
|
|
436
|
-
"
|
|
437
|
-
"
|
|
599
|
+
"A function you can call to directly influence the amount to unstake from a particular validator",
|
|
600
|
+
"Tbh this is a bypass of the system and should not be called unless you know what you are doing"
|
|
438
601
|
],
|
|
439
602
|
discriminator: [
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
603
|
+
7,
|
|
604
|
+
208,
|
|
605
|
+
146,
|
|
606
|
+
241,
|
|
607
|
+
10,
|
|
608
|
+
219,
|
|
609
|
+
109,
|
|
610
|
+
30
|
|
448
611
|
],
|
|
449
612
|
accounts: [
|
|
450
613
|
{
|
|
451
|
-
name: "
|
|
614
|
+
name: "admin",
|
|
452
615
|
writable: true,
|
|
453
616
|
signer: true
|
|
454
617
|
},
|
|
455
618
|
{
|
|
456
|
-
name: "
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
name: "vault"
|
|
461
|
-
},
|
|
462
|
-
{
|
|
463
|
-
name: "ephemeral_stake",
|
|
619
|
+
name: "validator_info",
|
|
620
|
+
docs: [
|
|
621
|
+
"Validator info account to update"
|
|
622
|
+
],
|
|
464
623
|
writable: true
|
|
465
|
-
},
|
|
466
|
-
{
|
|
467
|
-
name: "controller_state"
|
|
468
|
-
},
|
|
469
|
-
{
|
|
470
|
-
name: "stake_program"
|
|
471
|
-
},
|
|
472
|
-
{
|
|
473
|
-
name: "system_program"
|
|
474
|
-
},
|
|
475
|
-
{
|
|
476
|
-
name: "clock"
|
|
477
|
-
},
|
|
478
|
-
{
|
|
479
|
-
name: "stake_history"
|
|
480
|
-
},
|
|
481
|
-
{
|
|
482
|
-
name: "rent"
|
|
483
624
|
}
|
|
484
625
|
],
|
|
485
626
|
args: [
|
|
486
627
|
{
|
|
487
|
-
name: "
|
|
488
|
-
type: "
|
|
628
|
+
name: "vote_account",
|
|
629
|
+
type: "pubkey"
|
|
489
630
|
},
|
|
490
631
|
{
|
|
491
|
-
name: "
|
|
492
|
-
type: "
|
|
632
|
+
name: "amount",
|
|
633
|
+
type: "u64"
|
|
493
634
|
}
|
|
494
635
|
]
|
|
495
636
|
},
|
|
496
637
|
{
|
|
497
|
-
name: "
|
|
638
|
+
name: "get_min_max_resolved_epoch_deactivations",
|
|
498
639
|
docs: [
|
|
499
|
-
"
|
|
640
|
+
"Get minimum max_resolved_epoch_deactivations from MaintenanceLedger",
|
|
641
|
+
"This is designed to be called via CPI from other programs"
|
|
500
642
|
],
|
|
501
643
|
discriminator: [
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
644
|
+
171,
|
|
645
|
+
169,
|
|
646
|
+
39,
|
|
647
|
+
207,
|
|
648
|
+
181,
|
|
649
|
+
67,
|
|
650
|
+
86,
|
|
651
|
+
73
|
|
510
652
|
],
|
|
511
653
|
accounts: [
|
|
512
654
|
{
|
|
513
|
-
name: "
|
|
514
|
-
writable: true
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
name: "vault"
|
|
518
|
-
},
|
|
519
|
-
{
|
|
520
|
-
name: "epoch_state",
|
|
521
|
-
writable: true
|
|
522
|
-
},
|
|
523
|
-
{
|
|
524
|
-
name: "processing_state",
|
|
525
|
-
writable: true
|
|
526
|
-
},
|
|
527
|
-
{
|
|
528
|
-
name: "validator_registry",
|
|
529
|
-
writable: true
|
|
530
|
-
},
|
|
531
|
-
{
|
|
532
|
-
name: "stake_program"
|
|
533
|
-
},
|
|
534
|
-
{
|
|
535
|
-
name: "system_program"
|
|
536
|
-
},
|
|
537
|
-
{
|
|
538
|
-
name: "clock"
|
|
539
|
-
},
|
|
540
|
-
{
|
|
541
|
-
name: "stake_history"
|
|
542
|
-
},
|
|
543
|
-
{
|
|
544
|
-
name: "stake_config"
|
|
545
|
-
},
|
|
546
|
-
{
|
|
547
|
-
name: "rent"
|
|
655
|
+
name: "epoch_state"
|
|
548
656
|
}
|
|
549
657
|
],
|
|
550
658
|
args: [
|
|
551
|
-
{
|
|
552
|
-
name: "validators_count",
|
|
553
|
-
type: "u8"
|
|
554
|
-
}
|
|
555
|
-
]
|
|
556
|
-
},
|
|
557
|
-
{
|
|
558
|
-
name: "get_transient_values",
|
|
559
|
-
discriminator: [
|
|
560
|
-
13,
|
|
561
|
-
139,
|
|
562
|
-
204,
|
|
563
|
-
177,
|
|
564
|
-
30,
|
|
565
|
-
98,
|
|
566
|
-
185,
|
|
567
|
-
246
|
|
568
|
-
],
|
|
569
|
-
accounts: [
|
|
570
|
-
{
|
|
571
|
-
name: "validator_registry"
|
|
572
|
-
}
|
|
573
659
|
],
|
|
574
|
-
|
|
575
|
-
{
|
|
576
|
-
name: "vote_account",
|
|
577
|
-
type: "pubkey"
|
|
578
|
-
}
|
|
579
|
-
]
|
|
660
|
+
returns: "u16"
|
|
580
661
|
},
|
|
581
662
|
{
|
|
582
663
|
name: "init_bucket",
|
|
@@ -661,16 +742,19 @@ var instructions$2 = [
|
|
|
661
742
|
]
|
|
662
743
|
},
|
|
663
744
|
{
|
|
664
|
-
name: "
|
|
745
|
+
name: "initialize_active_list",
|
|
746
|
+
docs: [
|
|
747
|
+
"Initialize the active validator list (zero-copy)"
|
|
748
|
+
],
|
|
665
749
|
discriminator: [
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
750
|
+
222,
|
|
751
|
+
123,
|
|
752
|
+
57,
|
|
753
|
+
119,
|
|
754
|
+
223,
|
|
755
|
+
4,
|
|
756
|
+
150,
|
|
757
|
+
36
|
|
674
758
|
],
|
|
675
759
|
accounts: [
|
|
676
760
|
{
|
|
@@ -679,7 +763,7 @@ var instructions$2 = [
|
|
|
679
763
|
signer: true
|
|
680
764
|
},
|
|
681
765
|
{
|
|
682
|
-
name: "
|
|
766
|
+
name: "active_list",
|
|
683
767
|
writable: true
|
|
684
768
|
},
|
|
685
769
|
{
|
|
@@ -722,28 +806,28 @@ var instructions$2 = [
|
|
|
722
806
|
]
|
|
723
807
|
},
|
|
724
808
|
{
|
|
725
|
-
name: "
|
|
809
|
+
name: "initialize_graveyard_list",
|
|
726
810
|
docs: [
|
|
727
|
-
"
|
|
811
|
+
"Initialize the graveyard validator list (zero-copy)"
|
|
728
812
|
],
|
|
729
813
|
discriminator: [
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
249,
|
|
814
|
+
178,
|
|
815
|
+
8,
|
|
733
816
|
179,
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
817
|
+
111,
|
|
818
|
+
75,
|
|
819
|
+
19,
|
|
820
|
+
130,
|
|
821
|
+
176
|
|
738
822
|
],
|
|
739
823
|
accounts: [
|
|
740
824
|
{
|
|
741
|
-
name: "
|
|
825
|
+
name: "payer",
|
|
742
826
|
writable: true,
|
|
743
827
|
signer: true
|
|
744
828
|
},
|
|
745
829
|
{
|
|
746
|
-
name: "
|
|
830
|
+
name: "graveyard_list",
|
|
747
831
|
writable: true
|
|
748
832
|
},
|
|
749
833
|
{
|
|
@@ -894,6 +978,38 @@ var instructions$2 = [
|
|
|
894
978
|
args: [
|
|
895
979
|
]
|
|
896
980
|
},
|
|
981
|
+
{
|
|
982
|
+
name: "initialize_stake_allocation_state",
|
|
983
|
+
discriminator: [
|
|
984
|
+
159,
|
|
985
|
+
99,
|
|
986
|
+
175,
|
|
987
|
+
136,
|
|
988
|
+
251,
|
|
989
|
+
241,
|
|
990
|
+
88,
|
|
991
|
+
82
|
|
992
|
+
],
|
|
993
|
+
accounts: [
|
|
994
|
+
{
|
|
995
|
+
name: "admin",
|
|
996
|
+
writable: true,
|
|
997
|
+
signer: true
|
|
998
|
+
},
|
|
999
|
+
{
|
|
1000
|
+
name: "stake_allocation_state",
|
|
1001
|
+
writable: true
|
|
1002
|
+
},
|
|
1003
|
+
{
|
|
1004
|
+
name: "clock"
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
name: "system_program"
|
|
1008
|
+
}
|
|
1009
|
+
],
|
|
1010
|
+
args: [
|
|
1011
|
+
]
|
|
1012
|
+
},
|
|
897
1013
|
{
|
|
898
1014
|
name: "initialize_stake_controller_state",
|
|
899
1015
|
docs: [
|
|
@@ -997,74 +1113,6 @@ var instructions$2 = [
|
|
|
997
1113
|
args: [
|
|
998
1114
|
]
|
|
999
1115
|
},
|
|
1000
|
-
{
|
|
1001
|
-
name: "initialize_transients_tracking",
|
|
1002
|
-
docs: [
|
|
1003
|
-
"Done///"
|
|
1004
|
-
],
|
|
1005
|
-
discriminator: [
|
|
1006
|
-
45,
|
|
1007
|
-
17,
|
|
1008
|
-
111,
|
|
1009
|
-
28,
|
|
1010
|
-
248,
|
|
1011
|
-
238,
|
|
1012
|
-
237,
|
|
1013
|
-
30
|
|
1014
|
-
],
|
|
1015
|
-
accounts: [
|
|
1016
|
-
{
|
|
1017
|
-
name: "payer",
|
|
1018
|
-
writable: true,
|
|
1019
|
-
signer: true
|
|
1020
|
-
},
|
|
1021
|
-
{
|
|
1022
|
-
name: "transients_tracking",
|
|
1023
|
-
writable: true
|
|
1024
|
-
},
|
|
1025
|
-
{
|
|
1026
|
-
name: "system_program"
|
|
1027
|
-
}
|
|
1028
|
-
],
|
|
1029
|
-
args: [
|
|
1030
|
-
]
|
|
1031
|
-
},
|
|
1032
|
-
{
|
|
1033
|
-
name: "initialize_validator_registry",
|
|
1034
|
-
docs: [
|
|
1035
|
-
"Done///"
|
|
1036
|
-
],
|
|
1037
|
-
discriminator: [
|
|
1038
|
-
168,
|
|
1039
|
-
49,
|
|
1040
|
-
128,
|
|
1041
|
-
236,
|
|
1042
|
-
25,
|
|
1043
|
-
7,
|
|
1044
|
-
168,
|
|
1045
|
-
85
|
|
1046
|
-
],
|
|
1047
|
-
accounts: [
|
|
1048
|
-
{
|
|
1049
|
-
name: "payer",
|
|
1050
|
-
writable: true,
|
|
1051
|
-
signer: true
|
|
1052
|
-
},
|
|
1053
|
-
{
|
|
1054
|
-
name: "validator_registry",
|
|
1055
|
-
writable: true
|
|
1056
|
-
},
|
|
1057
|
-
{
|
|
1058
|
-
name: "system_program"
|
|
1059
|
-
}
|
|
1060
|
-
],
|
|
1061
|
-
args: [
|
|
1062
|
-
{
|
|
1063
|
-
name: "authority",
|
|
1064
|
-
type: "pubkey"
|
|
1065
|
-
}
|
|
1066
|
-
]
|
|
1067
|
-
},
|
|
1068
1116
|
{
|
|
1069
1117
|
name: "initialize_vault",
|
|
1070
1118
|
docs: [
|
|
@@ -1131,19 +1179,20 @@ var instructions$2 = [
|
|
|
1131
1179
|
]
|
|
1132
1180
|
},
|
|
1133
1181
|
{
|
|
1134
|
-
name: "
|
|
1182
|
+
name: "merge_activating_stakes",
|
|
1135
1183
|
docs: [
|
|
1136
|
-
"
|
|
1184
|
+
"V2: Merge activating transient stakes using PDA architecture",
|
|
1185
|
+
"Returns the number of epochs successfully merged"
|
|
1137
1186
|
],
|
|
1138
1187
|
discriminator: [
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1188
|
+
181,
|
|
1189
|
+
183,
|
|
1190
|
+
76,
|
|
1191
|
+
92,
|
|
1192
|
+
57,
|
|
1193
|
+
11,
|
|
1194
|
+
212,
|
|
1195
|
+
189
|
|
1147
1196
|
],
|
|
1148
1197
|
accounts: [
|
|
1149
1198
|
{
|
|
@@ -1155,11 +1204,29 @@ var instructions$2 = [
|
|
|
1155
1204
|
writable: true
|
|
1156
1205
|
},
|
|
1157
1206
|
{
|
|
1158
|
-
name: "
|
|
1207
|
+
name: "active_list",
|
|
1208
|
+
docs: [
|
|
1209
|
+
"Active validators list (zero-copy)"
|
|
1210
|
+
]
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
name: "graveyard_list",
|
|
1214
|
+
docs: [
|
|
1215
|
+
"Graveyard validators list (zero-copy) - needed to check validators in cooldown"
|
|
1216
|
+
]
|
|
1217
|
+
},
|
|
1218
|
+
{
|
|
1219
|
+
name: "validator_info",
|
|
1220
|
+
docs: [
|
|
1221
|
+
"Validator info PDA for the validator being processed"
|
|
1222
|
+
],
|
|
1159
1223
|
writable: true
|
|
1160
1224
|
},
|
|
1161
1225
|
{
|
|
1162
|
-
name: "
|
|
1226
|
+
name: "validator_transient",
|
|
1227
|
+
docs: [
|
|
1228
|
+
"Validator transient tracking PDA for the validator being processed"
|
|
1229
|
+
],
|
|
1163
1230
|
writable: true
|
|
1164
1231
|
},
|
|
1165
1232
|
{
|
|
@@ -1195,24 +1262,143 @@ var instructions$2 = [
|
|
|
1195
1262
|
name: "start_epoch",
|
|
1196
1263
|
type: "u64"
|
|
1197
1264
|
}
|
|
1265
|
+
],
|
|
1266
|
+
returns: "u16"
|
|
1267
|
+
},
|
|
1268
|
+
{
|
|
1269
|
+
name: "merge_deactivated_stakes",
|
|
1270
|
+
docs: [
|
|
1271
|
+
"V2: Merge fully deactivated stakes back to reserve"
|
|
1272
|
+
],
|
|
1273
|
+
discriminator: [
|
|
1274
|
+
160,
|
|
1275
|
+
255,
|
|
1276
|
+
180,
|
|
1277
|
+
104,
|
|
1278
|
+
216,
|
|
1279
|
+
98,
|
|
1280
|
+
248,
|
|
1281
|
+
73
|
|
1282
|
+
],
|
|
1283
|
+
accounts: [
|
|
1284
|
+
{
|
|
1285
|
+
name: "admin",
|
|
1286
|
+
writable: true,
|
|
1287
|
+
signer: true
|
|
1288
|
+
},
|
|
1289
|
+
{
|
|
1290
|
+
name: "vault",
|
|
1291
|
+
writable: true
|
|
1292
|
+
},
|
|
1293
|
+
{
|
|
1294
|
+
name: "active_list",
|
|
1295
|
+
docs: [
|
|
1296
|
+
"Active validators list (zero-copy)"
|
|
1297
|
+
]
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
name: "graveyard_list",
|
|
1301
|
+
docs: [
|
|
1302
|
+
"Graveyard validators list (zero-copy) - needed to check validators in cooldown"
|
|
1303
|
+
]
|
|
1304
|
+
},
|
|
1305
|
+
{
|
|
1306
|
+
name: "validator_info",
|
|
1307
|
+
docs: [
|
|
1308
|
+
"Validator info PDA for the validator being processed"
|
|
1309
|
+
],
|
|
1310
|
+
writable: true
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
name: "validator_transient",
|
|
1314
|
+
docs: [
|
|
1315
|
+
"Validator transient tracking PDA for the validator being processed"
|
|
1316
|
+
],
|
|
1317
|
+
writable: true
|
|
1318
|
+
},
|
|
1319
|
+
{
|
|
1320
|
+
name: "stake_program"
|
|
1321
|
+
},
|
|
1322
|
+
{
|
|
1323
|
+
name: "system_program"
|
|
1324
|
+
},
|
|
1325
|
+
{
|
|
1326
|
+
name: "clock"
|
|
1327
|
+
},
|
|
1328
|
+
{
|
|
1329
|
+
name: "stake_history"
|
|
1330
|
+
},
|
|
1331
|
+
{
|
|
1332
|
+
name: "rent"
|
|
1333
|
+
},
|
|
1334
|
+
{
|
|
1335
|
+
name: "epoch_state",
|
|
1336
|
+
writable: true
|
|
1337
|
+
},
|
|
1338
|
+
{
|
|
1339
|
+
name: "processing_state",
|
|
1340
|
+
writable: true
|
|
1341
|
+
}
|
|
1342
|
+
],
|
|
1343
|
+
args: [
|
|
1344
|
+
{
|
|
1345
|
+
name: "vote_account",
|
|
1346
|
+
type: "pubkey"
|
|
1347
|
+
}
|
|
1198
1348
|
]
|
|
1199
1349
|
},
|
|
1200
1350
|
{
|
|
1201
|
-
name: "
|
|
1351
|
+
name: "move_to_graveyard",
|
|
1352
|
+
docs: [
|
|
1353
|
+
"Move a validator from active list to graveyard, this is a serious function called in exceptional cases where something has gone awry with the validator",
|
|
1354
|
+
"and our system would be too late to catch it"
|
|
1355
|
+
],
|
|
1202
1356
|
discriminator: [
|
|
1203
|
-
|
|
1204
|
-
99,
|
|
1205
|
-
170,
|
|
1206
|
-
186,
|
|
1207
|
-
84,
|
|
1357
|
+
171,
|
|
1208
1358
|
61,
|
|
1209
|
-
|
|
1210
|
-
|
|
1359
|
+
145,
|
|
1360
|
+
127,
|
|
1361
|
+
189,
|
|
1362
|
+
218,
|
|
1363
|
+
221,
|
|
1364
|
+
199
|
|
1211
1365
|
],
|
|
1212
1366
|
accounts: [
|
|
1213
1367
|
{
|
|
1214
|
-
name: "
|
|
1368
|
+
name: "authority",
|
|
1369
|
+
writable: true,
|
|
1370
|
+
signer: true
|
|
1371
|
+
},
|
|
1372
|
+
{
|
|
1373
|
+
name: "active_list",
|
|
1374
|
+
docs: [
|
|
1375
|
+
"Active list - will remove from here"
|
|
1376
|
+
],
|
|
1377
|
+
writable: true
|
|
1378
|
+
},
|
|
1379
|
+
{
|
|
1380
|
+
name: "graveyard_list",
|
|
1381
|
+
docs: [
|
|
1382
|
+
"Graveyard list - will add here"
|
|
1383
|
+
],
|
|
1384
|
+
writable: true
|
|
1385
|
+
},
|
|
1386
|
+
{
|
|
1387
|
+
name: "validator_info",
|
|
1388
|
+
docs: [
|
|
1389
|
+
"Update the validator info to mark as blacklisted/underperforming"
|
|
1390
|
+
],
|
|
1391
|
+
writable: true
|
|
1392
|
+
},
|
|
1393
|
+
{
|
|
1394
|
+
name: "stake_allocation_state",
|
|
1395
|
+
docs: [
|
|
1396
|
+
"Stake allocation state - to update total_active_vpp when removing validator"
|
|
1397
|
+
],
|
|
1215
1398
|
writable: true
|
|
1399
|
+
},
|
|
1400
|
+
{
|
|
1401
|
+
name: "system_program"
|
|
1216
1402
|
}
|
|
1217
1403
|
],
|
|
1218
1404
|
args: [
|
|
@@ -1221,8 +1407,12 @@ var instructions$2 = [
|
|
|
1221
1407
|
type: "pubkey"
|
|
1222
1408
|
},
|
|
1223
1409
|
{
|
|
1224
|
-
name: "
|
|
1225
|
-
type:
|
|
1410
|
+
name: "reason",
|
|
1411
|
+
type: {
|
|
1412
|
+
defined: {
|
|
1413
|
+
name: "ValidatorStateChangeReason"
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1226
1416
|
}
|
|
1227
1417
|
]
|
|
1228
1418
|
},
|
|
@@ -1246,10 +1436,6 @@ var instructions$2 = [
|
|
|
1246
1436
|
name: "admin",
|
|
1247
1437
|
signer: true
|
|
1248
1438
|
},
|
|
1249
|
-
{
|
|
1250
|
-
name: "pay_cycle",
|
|
1251
|
-
writable: true
|
|
1252
|
-
},
|
|
1253
1439
|
{
|
|
1254
1440
|
name: "stake_metrics",
|
|
1255
1441
|
writable: true
|
|
@@ -1263,7 +1449,8 @@ var instructions$2 = [
|
|
|
1263
1449
|
writable: true
|
|
1264
1450
|
},
|
|
1265
1451
|
{
|
|
1266
|
-
name: "distribution_state"
|
|
1452
|
+
name: "distribution_state",
|
|
1453
|
+
writable: true
|
|
1267
1454
|
},
|
|
1268
1455
|
{
|
|
1269
1456
|
name: "liqsol_mint",
|
|
@@ -1294,152 +1481,297 @@ var instructions$2 = [
|
|
|
1294
1481
|
]
|
|
1295
1482
|
},
|
|
1296
1483
|
{
|
|
1297
|
-
name: "
|
|
1484
|
+
name: "process_stake_orders",
|
|
1485
|
+
docs: [
|
|
1486
|
+
"V2: Process stake orders using PDA architecture with pre-calculated allocations"
|
|
1487
|
+
],
|
|
1298
1488
|
discriminator: [
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1489
|
+
92,
|
|
1490
|
+
161,
|
|
1491
|
+
223,
|
|
1492
|
+
219,
|
|
1493
|
+
54,
|
|
1494
|
+
232,
|
|
1495
|
+
40,
|
|
1496
|
+
16
|
|
1307
1497
|
],
|
|
1308
1498
|
accounts: [
|
|
1309
1499
|
{
|
|
1310
|
-
name: "
|
|
1500
|
+
name: "admin",
|
|
1311
1501
|
writable: true,
|
|
1312
1502
|
signer: true
|
|
1313
1503
|
},
|
|
1314
1504
|
{
|
|
1315
|
-
name: "
|
|
1316
|
-
writable: true
|
|
1317
|
-
},
|
|
1318
|
-
{
|
|
1319
|
-
name: "liqsol_mint"
|
|
1320
|
-
},
|
|
1321
|
-
{
|
|
1322
|
-
name: "pool_authority",
|
|
1323
|
-
docs: [
|
|
1324
|
-
"Pool authority PDA"
|
|
1325
|
-
]
|
|
1326
|
-
},
|
|
1327
|
-
{
|
|
1328
|
-
name: "liqsol_pool_ata",
|
|
1329
|
-
docs: [
|
|
1330
|
-
"Pool's liqSOL ATA - deterministically derived from pool_authority + liqsol_mint"
|
|
1331
|
-
],
|
|
1505
|
+
name: "reserve_pool",
|
|
1332
1506
|
writable: true
|
|
1333
1507
|
},
|
|
1334
1508
|
{
|
|
1335
|
-
name: "
|
|
1336
|
-
docs: [
|
|
1337
|
-
"SOL bucket for raw SOL warrant purchases"
|
|
1338
|
-
],
|
|
1339
|
-
writable: true
|
|
1509
|
+
name: "vault"
|
|
1340
1510
|
},
|
|
1341
1511
|
{
|
|
1342
|
-
name: "
|
|
1512
|
+
name: "epoch_state",
|
|
1343
1513
|
writable: true
|
|
1344
1514
|
},
|
|
1345
1515
|
{
|
|
1346
|
-
name: "
|
|
1516
|
+
name: "processing_state",
|
|
1347
1517
|
writable: true
|
|
1348
1518
|
},
|
|
1349
1519
|
{
|
|
1350
|
-
name: "
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1520
|
+
name: "active_list",
|
|
1521
|
+
docs: [
|
|
1522
|
+
"Active validator list - used to get total validator count"
|
|
1523
|
+
]
|
|
1354
1524
|
},
|
|
1355
1525
|
{
|
|
1356
|
-
name: "
|
|
1526
|
+
name: "stake_allocation_state",
|
|
1527
|
+
docs: [
|
|
1528
|
+
"Stake allocation state - to verify allocations have been calculated for current epoch"
|
|
1529
|
+
],
|
|
1357
1530
|
writable: true
|
|
1358
1531
|
},
|
|
1359
1532
|
{
|
|
1360
|
-
name: "
|
|
1533
|
+
name: "stake_program"
|
|
1361
1534
|
},
|
|
1362
1535
|
{
|
|
1363
1536
|
name: "system_program"
|
|
1364
1537
|
},
|
|
1365
1538
|
{
|
|
1366
|
-
name: "
|
|
1367
|
-
writable: true
|
|
1539
|
+
name: "clock"
|
|
1368
1540
|
},
|
|
1369
1541
|
{
|
|
1370
|
-
name: "
|
|
1371
|
-
writable: true
|
|
1542
|
+
name: "stake_history"
|
|
1372
1543
|
},
|
|
1373
1544
|
{
|
|
1374
|
-
name: "
|
|
1545
|
+
name: "stake_config"
|
|
1375
1546
|
},
|
|
1376
1547
|
{
|
|
1377
|
-
name: "
|
|
1548
|
+
name: "rent"
|
|
1378
1549
|
}
|
|
1379
1550
|
],
|
|
1380
1551
|
args: [
|
|
1552
|
+
{
|
|
1553
|
+
name: "validators_count",
|
|
1554
|
+
type: "u8"
|
|
1555
|
+
}
|
|
1381
1556
|
]
|
|
1382
1557
|
},
|
|
1383
1558
|
{
|
|
1384
|
-
name: "
|
|
1559
|
+
name: "process_unstake_orders",
|
|
1560
|
+
docs: [
|
|
1561
|
+
"V2: Process unstake orders by splitting and deactivating stakes"
|
|
1562
|
+
],
|
|
1385
1563
|
discriminator: [
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1564
|
+
44,
|
|
1565
|
+
122,
|
|
1566
|
+
251,
|
|
1567
|
+
185,
|
|
1568
|
+
253,
|
|
1569
|
+
193,
|
|
1570
|
+
250,
|
|
1571
|
+
191
|
|
1394
1572
|
],
|
|
1395
1573
|
accounts: [
|
|
1396
1574
|
{
|
|
1397
|
-
name: "
|
|
1398
|
-
writable: true,
|
|
1575
|
+
name: "admin",
|
|
1399
1576
|
signer: true
|
|
1400
1577
|
},
|
|
1401
1578
|
{
|
|
1402
|
-
name: "
|
|
1579
|
+
name: "vault",
|
|
1403
1580
|
writable: true
|
|
1404
1581
|
},
|
|
1405
1582
|
{
|
|
1406
|
-
name: "
|
|
1583
|
+
name: "epoch_state",
|
|
1407
1584
|
writable: true
|
|
1408
1585
|
},
|
|
1409
1586
|
{
|
|
1410
|
-
name: "
|
|
1587
|
+
name: "processing_state",
|
|
1411
1588
|
writable: true
|
|
1412
1589
|
},
|
|
1413
1590
|
{
|
|
1414
|
-
name: "
|
|
1591
|
+
name: "active_list",
|
|
1592
|
+
docs: [
|
|
1593
|
+
"Active validator list - used to get total validator count"
|
|
1594
|
+
]
|
|
1415
1595
|
},
|
|
1416
1596
|
{
|
|
1417
|
-
name: "
|
|
1418
|
-
|
|
1597
|
+
name: "graveyard_list",
|
|
1598
|
+
docs: [
|
|
1599
|
+
"Graveyard validator list - allows unstaking from graveyard validators"
|
|
1600
|
+
]
|
|
1419
1601
|
},
|
|
1420
1602
|
{
|
|
1421
|
-
name: "
|
|
1422
|
-
docs: [
|
|
1423
|
-
"User's warrant deposit record"
|
|
1424
|
-
],
|
|
1425
|
-
writable: true
|
|
1603
|
+
name: "clock"
|
|
1426
1604
|
},
|
|
1427
1605
|
{
|
|
1428
|
-
name: "
|
|
1429
|
-
docs: [
|
|
1430
|
-
"Pool's UserRecord in distribution system (for yield tracking)"
|
|
1431
|
-
],
|
|
1432
|
-
writable: true
|
|
1606
|
+
name: "stake_history"
|
|
1433
1607
|
},
|
|
1434
1608
|
{
|
|
1435
|
-
name: "
|
|
1436
|
-
writable: true
|
|
1609
|
+
name: "stake_config"
|
|
1437
1610
|
},
|
|
1438
1611
|
{
|
|
1439
|
-
name: "
|
|
1612
|
+
name: "rent"
|
|
1440
1613
|
},
|
|
1441
1614
|
{
|
|
1442
|
-
name: "
|
|
1615
|
+
name: "system_program"
|
|
1616
|
+
},
|
|
1617
|
+
{
|
|
1618
|
+
name: "stake_program"
|
|
1619
|
+
}
|
|
1620
|
+
],
|
|
1621
|
+
args: [
|
|
1622
|
+
{
|
|
1623
|
+
name: "validators_count",
|
|
1624
|
+
type: "u8"
|
|
1625
|
+
}
|
|
1626
|
+
]
|
|
1627
|
+
},
|
|
1628
|
+
{
|
|
1629
|
+
name: "purchase_warrants_from_yield",
|
|
1630
|
+
discriminator: [
|
|
1631
|
+
42,
|
|
1632
|
+
126,
|
|
1633
|
+
140,
|
|
1634
|
+
136,
|
|
1635
|
+
176,
|
|
1636
|
+
155,
|
|
1637
|
+
106,
|
|
1638
|
+
139
|
|
1639
|
+
],
|
|
1640
|
+
accounts: [
|
|
1641
|
+
{
|
|
1642
|
+
name: "user",
|
|
1643
|
+
writable: true,
|
|
1644
|
+
signer: true
|
|
1645
|
+
},
|
|
1646
|
+
{
|
|
1647
|
+
name: "global_state",
|
|
1648
|
+
writable: true
|
|
1649
|
+
},
|
|
1650
|
+
{
|
|
1651
|
+
name: "liqsol_mint"
|
|
1652
|
+
},
|
|
1653
|
+
{
|
|
1654
|
+
name: "pool_authority",
|
|
1655
|
+
docs: [
|
|
1656
|
+
"Pool authority PDA"
|
|
1657
|
+
]
|
|
1658
|
+
},
|
|
1659
|
+
{
|
|
1660
|
+
name: "liqsol_pool_ata",
|
|
1661
|
+
docs: [
|
|
1662
|
+
"Pool's liqSOL ATA - deterministically derived from pool_authority + liqsol_mint"
|
|
1663
|
+
],
|
|
1664
|
+
writable: true
|
|
1665
|
+
},
|
|
1666
|
+
{
|
|
1667
|
+
name: "sol_bucket",
|
|
1668
|
+
docs: [
|
|
1669
|
+
"SOL bucket for raw SOL warrant purchases"
|
|
1670
|
+
],
|
|
1671
|
+
writable: true
|
|
1672
|
+
},
|
|
1673
|
+
{
|
|
1674
|
+
name: "liqsol_pool_user_record",
|
|
1675
|
+
writable: true
|
|
1676
|
+
},
|
|
1677
|
+
{
|
|
1678
|
+
name: "distribution_state",
|
|
1679
|
+
writable: true
|
|
1680
|
+
},
|
|
1681
|
+
{
|
|
1682
|
+
name: "pay_rate_history"
|
|
1683
|
+
},
|
|
1684
|
+
{
|
|
1685
|
+
name: "bucket_authority"
|
|
1686
|
+
},
|
|
1687
|
+
{
|
|
1688
|
+
name: "bucket_token_account",
|
|
1689
|
+
writable: true
|
|
1690
|
+
},
|
|
1691
|
+
{
|
|
1692
|
+
name: "token_program"
|
|
1693
|
+
},
|
|
1694
|
+
{
|
|
1695
|
+
name: "system_program"
|
|
1696
|
+
},
|
|
1697
|
+
{
|
|
1698
|
+
name: "tranche_state",
|
|
1699
|
+
writable: true
|
|
1700
|
+
},
|
|
1701
|
+
{
|
|
1702
|
+
name: "user_warrant_record",
|
|
1703
|
+
writable: true
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
name: "chainlink_feed"
|
|
1707
|
+
},
|
|
1708
|
+
{
|
|
1709
|
+
name: "chainlink_program"
|
|
1710
|
+
}
|
|
1711
|
+
],
|
|
1712
|
+
args: [
|
|
1713
|
+
]
|
|
1714
|
+
},
|
|
1715
|
+
{
|
|
1716
|
+
name: "purchase_with_liqsol",
|
|
1717
|
+
discriminator: [
|
|
1718
|
+
90,
|
|
1719
|
+
74,
|
|
1720
|
+
45,
|
|
1721
|
+
119,
|
|
1722
|
+
201,
|
|
1723
|
+
62,
|
|
1724
|
+
148,
|
|
1725
|
+
74
|
|
1726
|
+
],
|
|
1727
|
+
accounts: [
|
|
1728
|
+
{
|
|
1729
|
+
name: "user",
|
|
1730
|
+
writable: true,
|
|
1731
|
+
signer: true
|
|
1732
|
+
},
|
|
1733
|
+
{
|
|
1734
|
+
name: "liqsol_mint",
|
|
1735
|
+
writable: true
|
|
1736
|
+
},
|
|
1737
|
+
{
|
|
1738
|
+
name: "global_state",
|
|
1739
|
+
writable: true
|
|
1740
|
+
},
|
|
1741
|
+
{
|
|
1742
|
+
name: "buyer_ata",
|
|
1743
|
+
writable: true
|
|
1744
|
+
},
|
|
1745
|
+
{
|
|
1746
|
+
name: "pool_authority"
|
|
1747
|
+
},
|
|
1748
|
+
{
|
|
1749
|
+
name: "liqsol_pool_ata",
|
|
1750
|
+
writable: true
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
name: "warrant_deposit_record",
|
|
1754
|
+
docs: [
|
|
1755
|
+
"User's warrant deposit record"
|
|
1756
|
+
],
|
|
1757
|
+
writable: true
|
|
1758
|
+
},
|
|
1759
|
+
{
|
|
1760
|
+
name: "liqsol_pool_user_record",
|
|
1761
|
+
docs: [
|
|
1762
|
+
"Pool's UserRecord in distribution system (for yield tracking)"
|
|
1763
|
+
],
|
|
1764
|
+
writable: true
|
|
1765
|
+
},
|
|
1766
|
+
{
|
|
1767
|
+
name: "distribution_state",
|
|
1768
|
+
writable: true
|
|
1769
|
+
},
|
|
1770
|
+
{
|
|
1771
|
+
name: "pay_rate_history"
|
|
1772
|
+
},
|
|
1773
|
+
{
|
|
1774
|
+
name: "bucket_authority"
|
|
1443
1775
|
},
|
|
1444
1776
|
{
|
|
1445
1777
|
name: "bucket_token_account",
|
|
@@ -1827,6 +2159,67 @@ var instructions$2 = [
|
|
|
1827
2159
|
args: [
|
|
1828
2160
|
]
|
|
1829
2161
|
},
|
|
2162
|
+
{
|
|
2163
|
+
name: "restore_from_graveyard",
|
|
2164
|
+
docs: [
|
|
2165
|
+
"Move a validator from the graveyard to the active list, this is a serious function called in exceptional cases where something has gone awry with our programmatic",
|
|
2166
|
+
"decision to put the validator in the graveyard"
|
|
2167
|
+
],
|
|
2168
|
+
discriminator: [
|
|
2169
|
+
13,
|
|
2170
|
+
118,
|
|
2171
|
+
10,
|
|
2172
|
+
220,
|
|
2173
|
+
199,
|
|
2174
|
+
124,
|
|
2175
|
+
142,
|
|
2176
|
+
248
|
|
2177
|
+
],
|
|
2178
|
+
accounts: [
|
|
2179
|
+
{
|
|
2180
|
+
name: "authority",
|
|
2181
|
+
writable: true,
|
|
2182
|
+
signer: true
|
|
2183
|
+
},
|
|
2184
|
+
{
|
|
2185
|
+
name: "active_list",
|
|
2186
|
+
docs: [
|
|
2187
|
+
"Active list - will remove from here"
|
|
2188
|
+
],
|
|
2189
|
+
writable: true
|
|
2190
|
+
},
|
|
2191
|
+
{
|
|
2192
|
+
name: "graveyard_list",
|
|
2193
|
+
docs: [
|
|
2194
|
+
"Graveyard list - will add here"
|
|
2195
|
+
],
|
|
2196
|
+
writable: true
|
|
2197
|
+
},
|
|
2198
|
+
{
|
|
2199
|
+
name: "validator_info",
|
|
2200
|
+
docs: [
|
|
2201
|
+
"Update the validator info to mark as blacklisted/underperforming"
|
|
2202
|
+
],
|
|
2203
|
+
writable: true
|
|
2204
|
+
},
|
|
2205
|
+
{
|
|
2206
|
+
name: "stake_allocation_state",
|
|
2207
|
+
docs: [
|
|
2208
|
+
"Stake allocation state - to update total_active_vpp when removing validator"
|
|
2209
|
+
],
|
|
2210
|
+
writable: true
|
|
2211
|
+
},
|
|
2212
|
+
{
|
|
2213
|
+
name: "system_program"
|
|
2214
|
+
}
|
|
2215
|
+
],
|
|
2216
|
+
args: [
|
|
2217
|
+
{
|
|
2218
|
+
name: "vote_account",
|
|
2219
|
+
type: "pubkey"
|
|
2220
|
+
}
|
|
2221
|
+
]
|
|
2222
|
+
},
|
|
1830
2223
|
{
|
|
1831
2224
|
name: "set_d_day",
|
|
1832
2225
|
discriminator: [
|
|
@@ -1857,31 +2250,41 @@ var instructions$2 = [
|
|
|
1857
2250
|
]
|
|
1858
2251
|
},
|
|
1859
2252
|
{
|
|
1860
|
-
name: "
|
|
2253
|
+
name: "set_last_state_change_epoch",
|
|
2254
|
+
docs: [
|
|
2255
|
+
"Admin function to directly set last_state_change_epoch (useful for testing cooldowns)"
|
|
2256
|
+
],
|
|
1861
2257
|
discriminator: [
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
2258
|
+
94,
|
|
2259
|
+
57,
|
|
2260
|
+
139,
|
|
2261
|
+
195,
|
|
2262
|
+
123,
|
|
2263
|
+
224,
|
|
2264
|
+
227,
|
|
2265
|
+
106
|
|
1870
2266
|
],
|
|
1871
2267
|
accounts: [
|
|
1872
2268
|
{
|
|
1873
|
-
name: "
|
|
1874
|
-
|
|
2269
|
+
name: "validator_info",
|
|
2270
|
+
writable: true
|
|
1875
2271
|
},
|
|
1876
2272
|
{
|
|
1877
|
-
name: "
|
|
2273
|
+
name: "stake_allocation_state",
|
|
2274
|
+
docs: [
|
|
2275
|
+
"Stake allocation state - to update total_active_vpp when VPP changes"
|
|
2276
|
+
],
|
|
1878
2277
|
writable: true
|
|
1879
2278
|
}
|
|
1880
2279
|
],
|
|
1881
2280
|
args: [
|
|
1882
2281
|
{
|
|
1883
|
-
name: "
|
|
1884
|
-
type: "
|
|
2282
|
+
name: "vote_account",
|
|
2283
|
+
type: "pubkey"
|
|
2284
|
+
},
|
|
2285
|
+
{
|
|
2286
|
+
name: "epoch",
|
|
2287
|
+
type: "u16"
|
|
1885
2288
|
}
|
|
1886
2289
|
]
|
|
1887
2290
|
},
|
|
@@ -1944,72 +2347,30 @@ var instructions$2 = [
|
|
|
1944
2347
|
]
|
|
1945
2348
|
},
|
|
1946
2349
|
{
|
|
1947
|
-
name: "
|
|
2350
|
+
name: "stake_liqsol",
|
|
1948
2351
|
discriminator: [
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
2352
|
+
135,
|
|
2353
|
+
102,
|
|
2354
|
+
130,
|
|
2355
|
+
67,
|
|
2356
|
+
57,
|
|
2357
|
+
29,
|
|
2358
|
+
101,
|
|
2359
|
+
95
|
|
1957
2360
|
],
|
|
1958
2361
|
accounts: [
|
|
1959
2362
|
{
|
|
1960
|
-
name: "
|
|
2363
|
+
name: "user",
|
|
1961
2364
|
writable: true,
|
|
1962
2365
|
signer: true
|
|
1963
2366
|
},
|
|
1964
2367
|
{
|
|
1965
|
-
name: "
|
|
2368
|
+
name: "liqsol_mint",
|
|
2369
|
+
writable: true
|
|
1966
2370
|
},
|
|
1967
2371
|
{
|
|
1968
|
-
name: "
|
|
1969
|
-
|
|
1970
|
-
"Actor being slashed"
|
|
1971
|
-
]
|
|
1972
|
-
},
|
|
1973
|
-
{
|
|
1974
|
-
name: "bonded_actor",
|
|
1975
|
-
writable: true
|
|
1976
|
-
},
|
|
1977
|
-
{
|
|
1978
|
-
name: "wire_receipt",
|
|
1979
|
-
docs: [
|
|
1980
|
-
"The WireReceipt used as collateral - will be zeroed"
|
|
1981
|
-
],
|
|
1982
|
-
writable: true
|
|
1983
|
-
}
|
|
1984
|
-
],
|
|
1985
|
-
args: [
|
|
1986
|
-
]
|
|
1987
|
-
},
|
|
1988
|
-
{
|
|
1989
|
-
name: "stake_liqsol",
|
|
1990
|
-
discriminator: [
|
|
1991
|
-
135,
|
|
1992
|
-
102,
|
|
1993
|
-
130,
|
|
1994
|
-
67,
|
|
1995
|
-
57,
|
|
1996
|
-
29,
|
|
1997
|
-
101,
|
|
1998
|
-
95
|
|
1999
|
-
],
|
|
2000
|
-
accounts: [
|
|
2001
|
-
{
|
|
2002
|
-
name: "user",
|
|
2003
|
-
writable: true,
|
|
2004
|
-
signer: true
|
|
2005
|
-
},
|
|
2006
|
-
{
|
|
2007
|
-
name: "liqsol_mint",
|
|
2008
|
-
writable: true
|
|
2009
|
-
},
|
|
2010
|
-
{
|
|
2011
|
-
name: "global_state",
|
|
2012
|
-
writable: true
|
|
2372
|
+
name: "global_state",
|
|
2373
|
+
writable: true
|
|
2013
2374
|
},
|
|
2014
2375
|
{
|
|
2015
2376
|
name: "user_ata",
|
|
@@ -2071,62 +2432,20 @@ var instructions$2 = [
|
|
|
2071
2432
|
]
|
|
2072
2433
|
},
|
|
2073
2434
|
{
|
|
2074
|
-
name: "
|
|
2075
|
-
discriminator: [
|
|
2076
|
-
10,
|
|
2077
|
-
26,
|
|
2078
|
-
245,
|
|
2079
|
-
222,
|
|
2080
|
-
183,
|
|
2081
|
-
46,
|
|
2082
|
-
70,
|
|
2083
|
-
181
|
|
2084
|
-
],
|
|
2085
|
-
accounts: [
|
|
2086
|
-
{
|
|
2087
|
-
name: "authority",
|
|
2088
|
-
signer: true
|
|
2089
|
-
},
|
|
2090
|
-
{
|
|
2091
|
-
name: "validator_registry",
|
|
2092
|
-
writable: true
|
|
2093
|
-
},
|
|
2094
|
-
{
|
|
2095
|
-
name: "stake_controller_program"
|
|
2096
|
-
}
|
|
2097
|
-
],
|
|
2098
|
-
args: [
|
|
2099
|
-
{
|
|
2100
|
-
name: "vote_accounts",
|
|
2101
|
-
type: {
|
|
2102
|
-
vec: "pubkey"
|
|
2103
|
-
}
|
|
2104
|
-
},
|
|
2105
|
-
{
|
|
2106
|
-
name: "validator_metrics",
|
|
2107
|
-
type: {
|
|
2108
|
-
vec: {
|
|
2109
|
-
defined: {
|
|
2110
|
-
name: "ValidatorMetrics"
|
|
2111
|
-
}
|
|
2112
|
-
}
|
|
2113
|
-
}
|
|
2114
|
-
}
|
|
2115
|
-
]
|
|
2116
|
-
},
|
|
2117
|
-
{
|
|
2118
|
-
name: "sync_validator_stakes",
|
|
2435
|
+
name: "sync_main_stake_accounts",
|
|
2119
2436
|
docs: [
|
|
2120
|
-
"
|
|
2437
|
+
"V2: Sync main stake accounts using PDA architecture (batched)",
|
|
2438
|
+
"Processes up to 10 validators per transaction via remaining_accounts",
|
|
2439
|
+
"Note: Only syncs primary delegated stakes, not transient stakes"
|
|
2121
2440
|
],
|
|
2122
2441
|
discriminator: [
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2442
|
+
159,
|
|
2443
|
+
17,
|
|
2444
|
+
201,
|
|
2445
|
+
39,
|
|
2446
|
+
89,
|
|
2447
|
+
62,
|
|
2448
|
+
65,
|
|
2130
2449
|
135
|
|
2131
2450
|
],
|
|
2132
2451
|
accounts: [
|
|
@@ -2135,118 +2454,36 @@ var instructions$2 = [
|
|
|
2135
2454
|
signer: true
|
|
2136
2455
|
},
|
|
2137
2456
|
{
|
|
2138
|
-
name: "
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2457
|
+
name: "processing_state",
|
|
2458
|
+
docs: [
|
|
2459
|
+
"Processing state for tracking batch progress"
|
|
2460
|
+
],
|
|
2142
2461
|
writable: true
|
|
2143
2462
|
},
|
|
2144
2463
|
{
|
|
2145
|
-
name: "
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
name: "validator",
|
|
2151
|
-
type: "pubkey"
|
|
2152
|
-
}
|
|
2153
|
-
]
|
|
2154
|
-
},
|
|
2155
|
-
{
|
|
2156
|
-
name: "unbond",
|
|
2157
|
-
discriminator: [
|
|
2158
|
-
151,
|
|
2159
|
-
129,
|
|
2160
|
-
36,
|
|
2161
|
-
46,
|
|
2162
|
-
102,
|
|
2163
|
-
195,
|
|
2164
|
-
111,
|
|
2165
|
-
122
|
|
2166
|
-
],
|
|
2167
|
-
accounts: [
|
|
2168
|
-
{
|
|
2169
|
-
name: "bond_owner",
|
|
2170
|
-
signer: true
|
|
2464
|
+
name: "epoch_state",
|
|
2465
|
+
docs: [
|
|
2466
|
+
"Epoch state to mark completion"
|
|
2467
|
+
],
|
|
2468
|
+
writable: true
|
|
2171
2469
|
},
|
|
2172
2470
|
{
|
|
2173
|
-
name: "
|
|
2471
|
+
name: "active_list",
|
|
2174
2472
|
docs: [
|
|
2175
|
-
"
|
|
2473
|
+
"Active validator list - to check validator counts"
|
|
2176
2474
|
]
|
|
2177
2475
|
},
|
|
2178
2476
|
{
|
|
2179
|
-
name: "
|
|
2180
|
-
},
|
|
2181
|
-
{
|
|
2182
|
-
name: "actor",
|
|
2477
|
+
name: "graveyard_list",
|
|
2183
2478
|
docs: [
|
|
2184
|
-
"
|
|
2479
|
+
"Graveyard validator list - to check validator counts"
|
|
2185
2480
|
]
|
|
2186
2481
|
},
|
|
2187
2482
|
{
|
|
2188
|
-
name: "
|
|
2189
|
-
writable: true
|
|
2190
|
-
}
|
|
2191
|
-
],
|
|
2192
|
-
args: [
|
|
2193
|
-
]
|
|
2194
|
-
},
|
|
2195
|
-
{
|
|
2196
|
-
name: "update_bond_level",
|
|
2197
|
-
discriminator: [
|
|
2198
|
-
48,
|
|
2199
|
-
233,
|
|
2200
|
-
159,
|
|
2201
|
-
234,
|
|
2202
|
-
230,
|
|
2203
|
-
200,
|
|
2204
|
-
171,
|
|
2205
|
-
205
|
|
2206
|
-
],
|
|
2207
|
-
accounts: [
|
|
2208
|
-
{
|
|
2209
|
-
name: "authority",
|
|
2210
|
-
signer: true
|
|
2211
|
-
},
|
|
2212
|
-
{
|
|
2213
|
-
name: "bar_config"
|
|
2214
|
-
},
|
|
2215
|
-
{
|
|
2216
|
-
name: "bond_level",
|
|
2217
|
-
writable: true
|
|
2483
|
+
name: "stake_history"
|
|
2218
2484
|
}
|
|
2219
2485
|
],
|
|
2220
2486
|
args: [
|
|
2221
|
-
{
|
|
2222
|
-
name: "warmup_period",
|
|
2223
|
-
type: "u64"
|
|
2224
|
-
},
|
|
2225
|
-
{
|
|
2226
|
-
name: "cooldown_period",
|
|
2227
|
-
type: "u64"
|
|
2228
|
-
},
|
|
2229
|
-
{
|
|
2230
|
-
name: "min_receipt_principal",
|
|
2231
|
-
type: "u64"
|
|
2232
|
-
},
|
|
2233
|
-
{
|
|
2234
|
-
name: "roles",
|
|
2235
|
-
type: {
|
|
2236
|
-
array: [
|
|
2237
|
-
{
|
|
2238
|
-
defined: {
|
|
2239
|
-
name: "Role"
|
|
2240
|
-
}
|
|
2241
|
-
},
|
|
2242
|
-
4
|
|
2243
|
-
]
|
|
2244
|
-
}
|
|
2245
|
-
},
|
|
2246
|
-
{
|
|
2247
|
-
name: "enabled",
|
|
2248
|
-
type: "bool"
|
|
2249
|
-
}
|
|
2250
2487
|
]
|
|
2251
2488
|
},
|
|
2252
2489
|
{
|
|
@@ -2290,64 +2527,6 @@ var instructions$2 = [
|
|
|
2290
2527
|
}
|
|
2291
2528
|
]
|
|
2292
2529
|
},
|
|
2293
|
-
{
|
|
2294
|
-
name: "update_max_resolved_deactivations",
|
|
2295
|
-
discriminator: [
|
|
2296
|
-
231,
|
|
2297
|
-
111,
|
|
2298
|
-
22,
|
|
2299
|
-
0,
|
|
2300
|
-
70,
|
|
2301
|
-
141,
|
|
2302
|
-
42,
|
|
2303
|
-
204
|
|
2304
|
-
],
|
|
2305
|
-
accounts: [
|
|
2306
|
-
{
|
|
2307
|
-
name: "transients_tracking",
|
|
2308
|
-
writable: true
|
|
2309
|
-
}
|
|
2310
|
-
],
|
|
2311
|
-
args: [
|
|
2312
|
-
{
|
|
2313
|
-
name: "vote_account",
|
|
2314
|
-
type: "pubkey"
|
|
2315
|
-
},
|
|
2316
|
-
{
|
|
2317
|
-
name: "new_value",
|
|
2318
|
-
type: "u16"
|
|
2319
|
-
}
|
|
2320
|
-
]
|
|
2321
|
-
},
|
|
2322
|
-
{
|
|
2323
|
-
name: "update_max_resolved_stake",
|
|
2324
|
-
discriminator: [
|
|
2325
|
-
241,
|
|
2326
|
-
21,
|
|
2327
|
-
28,
|
|
2328
|
-
14,
|
|
2329
|
-
58,
|
|
2330
|
-
11,
|
|
2331
|
-
76,
|
|
2332
|
-
44
|
|
2333
|
-
],
|
|
2334
|
-
accounts: [
|
|
2335
|
-
{
|
|
2336
|
-
name: "transients_tracking",
|
|
2337
|
-
writable: true
|
|
2338
|
-
}
|
|
2339
|
-
],
|
|
2340
|
-
args: [
|
|
2341
|
-
{
|
|
2342
|
-
name: "vote_account",
|
|
2343
|
-
type: "pubkey"
|
|
2344
|
-
},
|
|
2345
|
-
{
|
|
2346
|
-
name: "new_value",
|
|
2347
|
-
type: "u16"
|
|
2348
|
-
}
|
|
2349
|
-
]
|
|
2350
|
-
},
|
|
2351
2530
|
{
|
|
2352
2531
|
name: "update_price_bounds",
|
|
2353
2532
|
discriminator: [
|
|
@@ -2394,68 +2573,105 @@ var instructions$2 = [
|
|
|
2394
2573
|
]
|
|
2395
2574
|
},
|
|
2396
2575
|
{
|
|
2397
|
-
name: "
|
|
2398
|
-
docs: [
|
|
2399
|
-
"Done///"
|
|
2400
|
-
],
|
|
2576
|
+
name: "update_user",
|
|
2401
2577
|
discriminator: [
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2578
|
+
9,
|
|
2579
|
+
2,
|
|
2580
|
+
160,
|
|
2581
|
+
169,
|
|
2582
|
+
118,
|
|
2583
|
+
12,
|
|
2584
|
+
207,
|
|
2585
|
+
84
|
|
2410
2586
|
],
|
|
2411
2587
|
accounts: [
|
|
2412
2588
|
{
|
|
2413
|
-
name: "
|
|
2414
|
-
|
|
2589
|
+
name: "user",
|
|
2590
|
+
writable: true
|
|
2415
2591
|
},
|
|
2416
2592
|
{
|
|
2417
|
-
name: "
|
|
2593
|
+
name: "user_ata",
|
|
2418
2594
|
writable: true
|
|
2419
2595
|
},
|
|
2420
2596
|
{
|
|
2421
|
-
name: "
|
|
2597
|
+
name: "user_record",
|
|
2422
2598
|
writable: true
|
|
2423
2599
|
},
|
|
2424
2600
|
{
|
|
2425
|
-
name: "
|
|
2426
|
-
|
|
2601
|
+
name: "authority",
|
|
2602
|
+
docs: [
|
|
2603
|
+
"Authority that can update this user record",
|
|
2604
|
+
"- For manual registration: user's keypair",
|
|
2605
|
+
"- For deposit flow: deposit program's program_authority PDA"
|
|
2606
|
+
],
|
|
2607
|
+
signer: true
|
|
2427
2608
|
},
|
|
2428
2609
|
{
|
|
2429
|
-
name: "
|
|
2430
|
-
|
|
2610
|
+
name: "payer",
|
|
2611
|
+
docs: [
|
|
2612
|
+
"Payer for the user record PDA creation (always the user)"
|
|
2613
|
+
],
|
|
2614
|
+
writable: true,
|
|
2615
|
+
signer: true
|
|
2431
2616
|
},
|
|
2432
2617
|
{
|
|
2433
|
-
name: "
|
|
2618
|
+
name: "distribution_state",
|
|
2434
2619
|
writable: true
|
|
2435
2620
|
},
|
|
2436
2621
|
{
|
|
2437
|
-
name: "
|
|
2622
|
+
name: "liqsol_mint"
|
|
2623
|
+
},
|
|
2624
|
+
{
|
|
2625
|
+
name: "instructions_sysvar"
|
|
2626
|
+
},
|
|
2627
|
+
{
|
|
2628
|
+
name: "token_program"
|
|
2629
|
+
},
|
|
2630
|
+
{
|
|
2631
|
+
name: "pay_rate_history"
|
|
2632
|
+
},
|
|
2633
|
+
{
|
|
2634
|
+
name: "bucket_authority"
|
|
2635
|
+
},
|
|
2636
|
+
{
|
|
2637
|
+
name: "bucket_token_account",
|
|
2638
|
+
docs: [
|
|
2639
|
+
"The bucket's associated token account holding liq"
|
|
2640
|
+
],
|
|
2438
2641
|
writable: true
|
|
2642
|
+
},
|
|
2643
|
+
{
|
|
2644
|
+
name: "system_program"
|
|
2439
2645
|
}
|
|
2440
2646
|
],
|
|
2441
2647
|
args: [
|
|
2442
2648
|
]
|
|
2443
2649
|
},
|
|
2444
2650
|
{
|
|
2445
|
-
name: "
|
|
2651
|
+
name: "update_validator_info_v2",
|
|
2652
|
+
docs: [
|
|
2653
|
+
"Update validator info fields (V2), function to force update a validator's info, should not be used unless in development for testing"
|
|
2654
|
+
],
|
|
2446
2655
|
discriminator: [
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2656
|
+
123,
|
|
2657
|
+
47,
|
|
2658
|
+
0,
|
|
2659
|
+
192,
|
|
2660
|
+
74,
|
|
2661
|
+
132,
|
|
2662
|
+
84,
|
|
2663
|
+
46
|
|
2455
2664
|
],
|
|
2456
2665
|
accounts: [
|
|
2457
2666
|
{
|
|
2458
|
-
name: "
|
|
2667
|
+
name: "validator_info",
|
|
2668
|
+
writable: true
|
|
2669
|
+
},
|
|
2670
|
+
{
|
|
2671
|
+
name: "stake_allocation_state",
|
|
2672
|
+
docs: [
|
|
2673
|
+
"Stake allocation state - to update total_active_vpp when VPP changes"
|
|
2674
|
+
],
|
|
2459
2675
|
writable: true
|
|
2460
2676
|
}
|
|
2461
2677
|
],
|
|
@@ -2465,88 +2681,76 @@ var instructions$2 = [
|
|
|
2465
2681
|
type: "pubkey"
|
|
2466
2682
|
},
|
|
2467
2683
|
{
|
|
2468
|
-
name: "
|
|
2684
|
+
name: "current_active_stake_amount",
|
|
2469
2685
|
type: {
|
|
2470
|
-
|
|
2471
|
-
name: "TransientUpdateParams"
|
|
2472
|
-
}
|
|
2686
|
+
option: "u64"
|
|
2473
2687
|
}
|
|
2474
|
-
}
|
|
2475
|
-
]
|
|
2476
|
-
},
|
|
2477
|
-
{
|
|
2478
|
-
name: "update_user",
|
|
2479
|
-
discriminator: [
|
|
2480
|
-
9,
|
|
2481
|
-
2,
|
|
2482
|
-
160,
|
|
2483
|
-
169,
|
|
2484
|
-
118,
|
|
2485
|
-
12,
|
|
2486
|
-
207,
|
|
2487
|
-
84
|
|
2488
|
-
],
|
|
2489
|
-
accounts: [
|
|
2490
|
-
{
|
|
2491
|
-
name: "user",
|
|
2492
|
-
writable: true
|
|
2493
2688
|
},
|
|
2494
2689
|
{
|
|
2495
|
-
name: "
|
|
2496
|
-
|
|
2690
|
+
name: "epoch_reward_amount",
|
|
2691
|
+
type: {
|
|
2692
|
+
option: "u64"
|
|
2693
|
+
}
|
|
2497
2694
|
},
|
|
2498
2695
|
{
|
|
2499
|
-
name: "
|
|
2500
|
-
|
|
2696
|
+
name: "transient_active_stake_amount",
|
|
2697
|
+
type: {
|
|
2698
|
+
option: "u64"
|
|
2699
|
+
}
|
|
2501
2700
|
},
|
|
2502
2701
|
{
|
|
2503
|
-
name: "
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
"- For deposit flow: deposit program's program_authority PDA"
|
|
2508
|
-
],
|
|
2509
|
-
signer: true
|
|
2702
|
+
name: "epoch",
|
|
2703
|
+
type: {
|
|
2704
|
+
option: "u64"
|
|
2705
|
+
}
|
|
2510
2706
|
},
|
|
2511
2707
|
{
|
|
2512
|
-
name: "
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2708
|
+
name: "performance_score",
|
|
2709
|
+
type: {
|
|
2710
|
+
option: "u8"
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2713
|
+
]
|
|
2714
|
+
},
|
|
2715
|
+
{
|
|
2716
|
+
name: "update_validator_transient",
|
|
2717
|
+
docs: [
|
|
2718
|
+
"Update validator transient tracking (V2), another function not to be really used in production except for testing//",
|
|
2719
|
+
"TODO: discuss wether to let this function be ?"
|
|
2720
|
+
],
|
|
2721
|
+
discriminator: [
|
|
2722
|
+
124,
|
|
2723
|
+
36,
|
|
2724
|
+
28,
|
|
2725
|
+
172,
|
|
2726
|
+
25,
|
|
2727
|
+
233,
|
|
2728
|
+
39,
|
|
2729
|
+
219
|
|
2730
|
+
],
|
|
2731
|
+
accounts: [
|
|
2519
2732
|
{
|
|
2520
|
-
name: "
|
|
2733
|
+
name: "validator_transient",
|
|
2521
2734
|
writable: true
|
|
2522
|
-
}
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
},
|
|
2526
|
-
{
|
|
2527
|
-
name: "instructions_sysvar"
|
|
2528
|
-
},
|
|
2529
|
-
{
|
|
2530
|
-
name: "token_program"
|
|
2531
|
-
},
|
|
2532
|
-
{
|
|
2533
|
-
name: "pay_rate_history"
|
|
2534
|
-
},
|
|
2735
|
+
}
|
|
2736
|
+
],
|
|
2737
|
+
args: [
|
|
2535
2738
|
{
|
|
2536
|
-
name: "
|
|
2739
|
+
name: "vote_account",
|
|
2740
|
+
type: "pubkey"
|
|
2537
2741
|
},
|
|
2538
2742
|
{
|
|
2539
|
-
name: "
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
writable: true
|
|
2743
|
+
name: "max_resolved_epoch_deactivations",
|
|
2744
|
+
type: {
|
|
2745
|
+
option: "u16"
|
|
2746
|
+
}
|
|
2544
2747
|
},
|
|
2545
2748
|
{
|
|
2546
|
-
name: "
|
|
2749
|
+
name: "max_resolved_activating_stake",
|
|
2750
|
+
type: {
|
|
2751
|
+
option: "u16"
|
|
2752
|
+
}
|
|
2547
2753
|
}
|
|
2548
|
-
],
|
|
2549
|
-
args: [
|
|
2550
2754
|
]
|
|
2551
2755
|
},
|
|
2552
2756
|
{
|
|
@@ -2637,42 +2841,16 @@ var instructions$2 = [
|
|
|
2637
2841
|
];
|
|
2638
2842
|
var accounts$1 = [
|
|
2639
2843
|
{
|
|
2640
|
-
name: "
|
|
2641
|
-
discriminator: [
|
|
2642
|
-
172,
|
|
2643
|
-
166,
|
|
2644
|
-
67,
|
|
2645
|
-
186,
|
|
2646
|
-
146,
|
|
2647
|
-
5,
|
|
2648
|
-
198,
|
|
2649
|
-
67
|
|
2650
|
-
]
|
|
2651
|
-
},
|
|
2652
|
-
{
|
|
2653
|
-
name: "BondLevel",
|
|
2654
|
-
discriminator: [
|
|
2655
|
-
103,
|
|
2656
|
-
61,
|
|
2657
|
-
221,
|
|
2658
|
-
129,
|
|
2659
|
-
28,
|
|
2660
|
-
118,
|
|
2661
|
-
201,
|
|
2662
|
-
85
|
|
2663
|
-
]
|
|
2664
|
-
},
|
|
2665
|
-
{
|
|
2666
|
-
name: "BondedActor",
|
|
2844
|
+
name: "BatchOrchestrator",
|
|
2667
2845
|
discriminator: [
|
|
2668
|
-
127,
|
|
2669
|
-
148,
|
|
2670
2846
|
70,
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2847
|
+
163,
|
|
2848
|
+
206,
|
|
2849
|
+
225,
|
|
2850
|
+
7,
|
|
2851
|
+
189,
|
|
2852
|
+
73,
|
|
2853
|
+
94
|
|
2676
2854
|
]
|
|
2677
2855
|
},
|
|
2678
2856
|
{
|
|
@@ -2688,19 +2866,6 @@ var accounts$1 = [
|
|
|
2688
2866
|
103
|
|
2689
2867
|
]
|
|
2690
2868
|
},
|
|
2691
|
-
{
|
|
2692
|
-
name: "EpochState",
|
|
2693
|
-
discriminator: [
|
|
2694
|
-
191,
|
|
2695
|
-
63,
|
|
2696
|
-
139,
|
|
2697
|
-
237,
|
|
2698
|
-
144,
|
|
2699
|
-
12,
|
|
2700
|
-
223,
|
|
2701
|
-
210
|
|
2702
|
-
]
|
|
2703
|
-
},
|
|
2704
2869
|
{
|
|
2705
2870
|
name: "Global",
|
|
2706
2871
|
discriminator: [
|
|
@@ -2741,16 +2906,16 @@ var accounts$1 = [
|
|
|
2741
2906
|
]
|
|
2742
2907
|
},
|
|
2743
2908
|
{
|
|
2744
|
-
name: "
|
|
2909
|
+
name: "MaintenanceLedger",
|
|
2745
2910
|
discriminator: [
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
70,
|
|
2750
|
-
134,
|
|
2911
|
+
140,
|
|
2912
|
+
250,
|
|
2913
|
+
92,
|
|
2751
2914
|
173,
|
|
2752
|
-
|
|
2753
|
-
|
|
2915
|
+
147,
|
|
2916
|
+
65,
|
|
2917
|
+
26,
|
|
2918
|
+
39
|
|
2754
2919
|
]
|
|
2755
2920
|
},
|
|
2756
2921
|
{
|
|
@@ -2793,16 +2958,16 @@ var accounts$1 = [
|
|
|
2793
2958
|
]
|
|
2794
2959
|
},
|
|
2795
2960
|
{
|
|
2796
|
-
name: "
|
|
2961
|
+
name: "StakeAllocationState",
|
|
2797
2962
|
discriminator: [
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
130,
|
|
2802
|
-
245,
|
|
2803
|
-
250,
|
|
2963
|
+
23,
|
|
2964
|
+
238,
|
|
2965
|
+
120,
|
|
2804
2966
|
198,
|
|
2805
|
-
|
|
2967
|
+
156,
|
|
2968
|
+
165,
|
|
2969
|
+
151,
|
|
2970
|
+
119
|
|
2806
2971
|
]
|
|
2807
2972
|
},
|
|
2808
2973
|
{
|
|
@@ -2897,29 +3062,42 @@ var accounts$1 = [
|
|
|
2897
3062
|
]
|
|
2898
3063
|
},
|
|
2899
3064
|
{
|
|
2900
|
-
name: "
|
|
3065
|
+
name: "ValidatorInfoAccount",
|
|
2901
3066
|
discriminator: [
|
|
2902
|
-
168,
|
|
2903
|
-
113,
|
|
2904
3067
|
195,
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
3068
|
+
243,
|
|
3069
|
+
81,
|
|
3070
|
+
187,
|
|
3071
|
+
172,
|
|
3072
|
+
232,
|
|
3073
|
+
57,
|
|
3074
|
+
59
|
|
2910
3075
|
]
|
|
2911
3076
|
},
|
|
2912
3077
|
{
|
|
2913
|
-
name: "
|
|
3078
|
+
name: "ValidatorList",
|
|
2914
3079
|
discriminator: [
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
3080
|
+
131,
|
|
3081
|
+
181,
|
|
3082
|
+
125,
|
|
3083
|
+
127,
|
|
3084
|
+
46,
|
|
3085
|
+
36,
|
|
3086
|
+
40,
|
|
3087
|
+
167
|
|
3088
|
+
]
|
|
3089
|
+
},
|
|
3090
|
+
{
|
|
3091
|
+
name: "ValidatorTransientAccount",
|
|
3092
|
+
discriminator: [
|
|
3093
|
+
97,
|
|
3094
|
+
207,
|
|
3095
|
+
155,
|
|
3096
|
+
142,
|
|
3097
|
+
86,
|
|
3098
|
+
170,
|
|
3099
|
+
118,
|
|
3100
|
+
161
|
|
2923
3101
|
]
|
|
2924
3102
|
},
|
|
2925
3103
|
{
|
|
@@ -3006,230 +3184,121 @@ var events = [
|
|
|
3006
3184
|
var errors$2 = [
|
|
3007
3185
|
{
|
|
3008
3186
|
code: 6000,
|
|
3009
|
-
name: "
|
|
3010
|
-
msg: "
|
|
3187
|
+
name: "NoRewardsToClaim",
|
|
3188
|
+
msg: "No rewards to claim"
|
|
3011
3189
|
},
|
|
3012
3190
|
{
|
|
3013
3191
|
code: 6001,
|
|
3014
|
-
name: "
|
|
3015
|
-
msg: "
|
|
3192
|
+
name: "InsufficientBalance",
|
|
3193
|
+
msg: "Insufficient balance"
|
|
3016
3194
|
},
|
|
3017
3195
|
{
|
|
3018
3196
|
code: 6002,
|
|
3019
|
-
name: "
|
|
3020
|
-
msg: "
|
|
3197
|
+
name: "InsufficientFunds",
|
|
3198
|
+
msg: "Insufficient funds"
|
|
3021
3199
|
},
|
|
3022
3200
|
{
|
|
3023
3201
|
code: 6003,
|
|
3024
|
-
name: "
|
|
3025
|
-
msg: "
|
|
3202
|
+
name: "Unauthorized",
|
|
3203
|
+
msg: "Unauthorized - caller is not the distribution authority"
|
|
3026
3204
|
},
|
|
3027
3205
|
{
|
|
3028
3206
|
code: 6004,
|
|
3029
|
-
name: "
|
|
3030
|
-
msg: "
|
|
3207
|
+
name: "InvalidMint",
|
|
3208
|
+
msg: "Invalid mint"
|
|
3031
3209
|
},
|
|
3032
3210
|
{
|
|
3033
3211
|
code: 6005,
|
|
3034
|
-
name: "
|
|
3035
|
-
msg: "
|
|
3212
|
+
name: "InvalidOwner",
|
|
3213
|
+
msg: "Invalid owner"
|
|
3036
3214
|
},
|
|
3037
3215
|
{
|
|
3038
3216
|
code: 6006,
|
|
3039
|
-
name: "
|
|
3040
|
-
msg: "
|
|
3217
|
+
name: "InvalidUserRecord",
|
|
3218
|
+
msg: "Invalid user record"
|
|
3041
3219
|
},
|
|
3042
3220
|
{
|
|
3043
3221
|
code: 6007,
|
|
3044
|
-
name: "
|
|
3045
|
-
msg: "
|
|
3222
|
+
name: "InvalidWithdrawal",
|
|
3223
|
+
msg: "Invalid withdrawal - balance increased instead of decreased"
|
|
3046
3224
|
},
|
|
3047
3225
|
{
|
|
3048
3226
|
code: 6008,
|
|
3049
|
-
name: "
|
|
3050
|
-
msg: "
|
|
3227
|
+
name: "InvalidProgramId",
|
|
3228
|
+
msg: "Invalid program ID"
|
|
3051
3229
|
},
|
|
3052
3230
|
{
|
|
3053
3231
|
code: 6009,
|
|
3054
|
-
name: "
|
|
3055
|
-
msg: "
|
|
3232
|
+
name: "InstructionIntrospectionFailed",
|
|
3233
|
+
msg: "Instruction introspection failed"
|
|
3056
3234
|
},
|
|
3057
3235
|
{
|
|
3058
3236
|
code: 6010,
|
|
3059
|
-
name: "
|
|
3060
|
-
msg: "
|
|
3061
|
-
}
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
name: "SourceDeactivating",
|
|
3065
|
-
msg: "Source stake is deactivating"
|
|
3066
|
-
},
|
|
3237
|
+
name: "ReceiptFulfilled",
|
|
3238
|
+
msg: "Receipt already fulfilled"
|
|
3239
|
+
}
|
|
3240
|
+
];
|
|
3241
|
+
var types$4 = [
|
|
3067
3242
|
{
|
|
3068
|
-
|
|
3069
|
-
name: "DestinationBorrowFailed",
|
|
3070
|
-
msg: "Failed to borrow destination account data"
|
|
3071
|
-
},
|
|
3072
|
-
{
|
|
3073
|
-
code: 6013,
|
|
3074
|
-
name: "DestinationParseFailed",
|
|
3075
|
-
msg: "Failed to parse destination stake state"
|
|
3076
|
-
},
|
|
3077
|
-
{
|
|
3078
|
-
code: 6014,
|
|
3079
|
-
name: "SourceBorrowFailed",
|
|
3080
|
-
msg: "Failed to borrow source account data"
|
|
3081
|
-
},
|
|
3082
|
-
{
|
|
3083
|
-
code: 6015,
|
|
3084
|
-
name: "SourceParseFailed",
|
|
3085
|
-
msg: "Failed to parse source stake state"
|
|
3086
|
-
},
|
|
3087
|
-
{
|
|
3088
|
-
code: 6016,
|
|
3089
|
-
name: "DifferentValidators",
|
|
3090
|
-
msg: "Stakes are delegated to different validators"
|
|
3091
|
-
},
|
|
3092
|
-
{
|
|
3093
|
-
code: 6017,
|
|
3094
|
-
name: "DifferentStakers",
|
|
3095
|
-
msg: "Stakes have different staker authorities"
|
|
3096
|
-
},
|
|
3097
|
-
{
|
|
3098
|
-
code: 6018,
|
|
3099
|
-
name: "DifferentWithdrawers",
|
|
3100
|
-
msg: "Stakes have different withdrawer authorities"
|
|
3101
|
-
},
|
|
3102
|
-
{
|
|
3103
|
-
code: 6019,
|
|
3104
|
-
name: "AuthoritiesNotFound",
|
|
3105
|
-
msg: "Could not extract authorities from accounts"
|
|
3106
|
-
},
|
|
3107
|
-
{
|
|
3108
|
-
code: 6020,
|
|
3109
|
-
name: "MergeInstructionFailed",
|
|
3110
|
-
msg: "Merge instruction failed"
|
|
3111
|
-
},
|
|
3112
|
-
{
|
|
3113
|
-
code: 6021,
|
|
3114
|
-
name: "EpochRewardsActive",
|
|
3115
|
-
msg: "Epoch rewards distribution is active - stake operations blocked"
|
|
3116
|
-
},
|
|
3117
|
-
{
|
|
3118
|
-
code: 6022,
|
|
3119
|
-
name: "DifferentCreditsObserved",
|
|
3120
|
-
msg: "Stakes have different credits_observed - cannot merge until both earn same rewards"
|
|
3121
|
-
}
|
|
3122
|
-
];
|
|
3123
|
-
var types$4 = [
|
|
3124
|
-
{
|
|
3125
|
-
name: "BarConfig",
|
|
3243
|
+
name: "BatchOrchestrator",
|
|
3126
3244
|
type: {
|
|
3127
3245
|
kind: "struct",
|
|
3128
3246
|
fields: [
|
|
3129
3247
|
{
|
|
3130
|
-
name: "
|
|
3131
|
-
type: "
|
|
3248
|
+
name: "validators_processed_this_epoch",
|
|
3249
|
+
type: "u8"
|
|
3132
3250
|
},
|
|
3133
3251
|
{
|
|
3134
|
-
name: "
|
|
3252
|
+
name: "current_merge_processing_epoch",
|
|
3253
|
+
docs: [
|
|
3254
|
+
"Intra batch state, how many validators have been processed for activating transient merges - reset to 0 at the end of each epoch OR at the beginning of the function call when there is a mismatch",
|
|
3255
|
+
"between the current_merge_processing_epoch and the actual current epoch//"
|
|
3256
|
+
],
|
|
3135
3257
|
type: "u64"
|
|
3136
3258
|
},
|
|
3137
3259
|
{
|
|
3138
|
-
name: "
|
|
3260
|
+
name: "validators_merge_processed_this_epoch",
|
|
3139
3261
|
type: "u8"
|
|
3140
|
-
}
|
|
3141
|
-
]
|
|
3142
|
-
}
|
|
3143
|
-
},
|
|
3144
|
-
{
|
|
3145
|
-
name: "BondLevel",
|
|
3146
|
-
type: {
|
|
3147
|
-
kind: "struct",
|
|
3148
|
-
fields: [
|
|
3149
|
-
{
|
|
3150
|
-
name: "id",
|
|
3151
|
-
type: {
|
|
3152
|
-
array: [
|
|
3153
|
-
"u8",
|
|
3154
|
-
32
|
|
3155
|
-
]
|
|
3156
|
-
}
|
|
3157
3262
|
},
|
|
3158
3263
|
{
|
|
3159
|
-
name: "
|
|
3264
|
+
name: "current_deactivating_merge_epoch",
|
|
3160
3265
|
type: "u64"
|
|
3161
3266
|
},
|
|
3162
3267
|
{
|
|
3163
|
-
name: "
|
|
3164
|
-
type: "
|
|
3268
|
+
name: "validators_deactivating_merge_processed",
|
|
3269
|
+
type: "u8"
|
|
3165
3270
|
},
|
|
3166
3271
|
{
|
|
3167
|
-
name: "
|
|
3168
|
-
|
|
3169
|
-
"Minimum principal across WireReceipt buckets (staked + purchased + purchased_with_sol)"
|
|
3170
|
-
],
|
|
3171
|
-
type: "u64"
|
|
3272
|
+
name: "validators_sync_processed_this_epoch",
|
|
3273
|
+
type: "u8"
|
|
3172
3274
|
},
|
|
3173
3275
|
{
|
|
3174
|
-
name: "
|
|
3175
|
-
|
|
3176
|
-
"Roles granted when bonding at this level"
|
|
3177
|
-
],
|
|
3178
|
-
type: {
|
|
3179
|
-
array: [
|
|
3180
|
-
{
|
|
3181
|
-
defined: {
|
|
3182
|
-
name: "Role"
|
|
3183
|
-
}
|
|
3184
|
-
},
|
|
3185
|
-
4
|
|
3186
|
-
]
|
|
3187
|
-
}
|
|
3276
|
+
name: "validators_unstake_processed_this_epoch",
|
|
3277
|
+
type: "u8"
|
|
3188
3278
|
},
|
|
3189
3279
|
{
|
|
3190
|
-
name: "
|
|
3280
|
+
name: "distribution_in_progress",
|
|
3191
3281
|
type: "bool"
|
|
3192
3282
|
},
|
|
3193
3283
|
{
|
|
3194
|
-
name: "
|
|
3284
|
+
name: "validators_aggregate_processed_this_epoch",
|
|
3195
3285
|
type: "u8"
|
|
3196
|
-
}
|
|
3197
|
-
]
|
|
3198
|
-
}
|
|
3199
|
-
},
|
|
3200
|
-
{
|
|
3201
|
-
name: "BondedActor",
|
|
3202
|
-
type: {
|
|
3203
|
-
kind: "struct",
|
|
3204
|
-
fields: [
|
|
3205
|
-
{
|
|
3206
|
-
name: "actor",
|
|
3207
|
-
type: "pubkey"
|
|
3208
|
-
},
|
|
3209
|
-
{
|
|
3210
|
-
name: "bond_owner",
|
|
3211
|
-
type: "pubkey"
|
|
3212
3286
|
},
|
|
3213
3287
|
{
|
|
3214
|
-
name: "
|
|
3215
|
-
type: "
|
|
3288
|
+
name: "temp_total_active_stake",
|
|
3289
|
+
type: "u64"
|
|
3216
3290
|
},
|
|
3217
3291
|
{
|
|
3218
|
-
name: "
|
|
3219
|
-
type:
|
|
3220
|
-
array: [
|
|
3221
|
-
"u8",
|
|
3222
|
-
32
|
|
3223
|
-
]
|
|
3224
|
-
}
|
|
3292
|
+
name: "temp_total_transient_stake",
|
|
3293
|
+
type: "u64"
|
|
3225
3294
|
},
|
|
3226
3295
|
{
|
|
3227
|
-
name: "
|
|
3228
|
-
type: "
|
|
3296
|
+
name: "temp_total_reward",
|
|
3297
|
+
type: "u64"
|
|
3229
3298
|
},
|
|
3230
3299
|
{
|
|
3231
|
-
name: "
|
|
3232
|
-
type: "
|
|
3300
|
+
name: "temp_total_unstakeable_stake",
|
|
3301
|
+
type: "u64"
|
|
3233
3302
|
},
|
|
3234
3303
|
{
|
|
3235
3304
|
name: "bump",
|
|
@@ -3286,50 +3355,6 @@ var types$4 = [
|
|
|
3286
3355
|
]
|
|
3287
3356
|
}
|
|
3288
3357
|
},
|
|
3289
|
-
{
|
|
3290
|
-
name: "EpochState",
|
|
3291
|
-
type: {
|
|
3292
|
-
kind: "struct",
|
|
3293
|
-
fields: [
|
|
3294
|
-
{
|
|
3295
|
-
name: "last_updated_global_epoch",
|
|
3296
|
-
type: "u64"
|
|
3297
|
-
},
|
|
3298
|
-
{
|
|
3299
|
-
name: "last_distribution_epoch",
|
|
3300
|
-
type: {
|
|
3301
|
-
option: "u64"
|
|
3302
|
-
}
|
|
3303
|
-
},
|
|
3304
|
-
{
|
|
3305
|
-
name: "last_distribution_slot",
|
|
3306
|
-
type: {
|
|
3307
|
-
option: "u64"
|
|
3308
|
-
}
|
|
3309
|
-
},
|
|
3310
|
-
{
|
|
3311
|
-
name: "last_deactivation_epoch",
|
|
3312
|
-
type: "u64"
|
|
3313
|
-
},
|
|
3314
|
-
{
|
|
3315
|
-
name: "last_rebalance_epoch",
|
|
3316
|
-
type: "u64"
|
|
3317
|
-
},
|
|
3318
|
-
{
|
|
3319
|
-
name: "last_merge_transients_epoch",
|
|
3320
|
-
type: "u64"
|
|
3321
|
-
},
|
|
3322
|
-
{
|
|
3323
|
-
name: "current_merge_processing_epoch",
|
|
3324
|
-
type: "u64"
|
|
3325
|
-
},
|
|
3326
|
-
{
|
|
3327
|
-
name: "bump",
|
|
3328
|
-
type: "u8"
|
|
3329
|
-
}
|
|
3330
|
-
]
|
|
3331
|
-
}
|
|
3332
|
-
},
|
|
3333
3358
|
{
|
|
3334
3359
|
name: "Global",
|
|
3335
3360
|
docs: [
|
|
@@ -3486,30 +3511,56 @@ var types$4 = [
|
|
|
3486
3511
|
}
|
|
3487
3512
|
},
|
|
3488
3513
|
{
|
|
3489
|
-
name: "
|
|
3514
|
+
name: "MaintenanceLedger",
|
|
3490
3515
|
type: {
|
|
3491
3516
|
kind: "struct",
|
|
3492
3517
|
fields: [
|
|
3493
3518
|
{
|
|
3494
|
-
name: "
|
|
3519
|
+
name: "last_sync_epoch",
|
|
3520
|
+
type: "u16"
|
|
3521
|
+
},
|
|
3522
|
+
{
|
|
3523
|
+
name: "last_updated_stake_metrics_epoch",
|
|
3495
3524
|
type: "u64"
|
|
3496
3525
|
},
|
|
3497
3526
|
{
|
|
3498
|
-
name: "
|
|
3527
|
+
name: "last_distribution_epoch",
|
|
3528
|
+
type: {
|
|
3529
|
+
option: "u64"
|
|
3530
|
+
}
|
|
3531
|
+
},
|
|
3532
|
+
{
|
|
3533
|
+
name: "last_distribution_slot",
|
|
3534
|
+
type: {
|
|
3535
|
+
option: "u64"
|
|
3536
|
+
}
|
|
3537
|
+
},
|
|
3538
|
+
{
|
|
3539
|
+
name: "last_merge_deactivating_transients_epoch",
|
|
3499
3540
|
type: "u64"
|
|
3500
3541
|
},
|
|
3501
3542
|
{
|
|
3502
|
-
name: "
|
|
3503
|
-
type: "
|
|
3543
|
+
name: "last_rebalance_allocation_epoch",
|
|
3544
|
+
type: "u64"
|
|
3504
3545
|
},
|
|
3505
3546
|
{
|
|
3506
|
-
name: "
|
|
3507
|
-
type: "
|
|
3547
|
+
name: "last_merge_activating_transients_epoch",
|
|
3548
|
+
type: "u64"
|
|
3549
|
+
},
|
|
3550
|
+
{
|
|
3551
|
+
name: "last_unstake_epoch",
|
|
3552
|
+
type: {
|
|
3553
|
+
option: "u64"
|
|
3554
|
+
}
|
|
3508
3555
|
},
|
|
3509
3556
|
{
|
|
3510
|
-
name: "
|
|
3557
|
+
name: "last_unstake_allocation_epoch",
|
|
3511
3558
|
type: "u64"
|
|
3512
3559
|
},
|
|
3560
|
+
{
|
|
3561
|
+
name: "min_max_resolved_epoch_deactivations",
|
|
3562
|
+
type: "u16"
|
|
3563
|
+
},
|
|
3513
3564
|
{
|
|
3514
3565
|
name: "bump",
|
|
3515
3566
|
type: "u8"
|
|
@@ -3573,29 +3624,33 @@ var types$4 = [
|
|
|
3573
3624
|
kind: "struct",
|
|
3574
3625
|
fields: [
|
|
3575
3626
|
{
|
|
3576
|
-
name: "
|
|
3627
|
+
name: "total_yield_paid_out_epoch",
|
|
3577
3628
|
type: "u64"
|
|
3578
3629
|
},
|
|
3579
|
-
{
|
|
3580
|
-
name: "epoch_payout_delta",
|
|
3581
|
-
type: "i64"
|
|
3582
|
-
},
|
|
3583
3630
|
{
|
|
3584
3631
|
name: "fees_remaining_to_distribute",
|
|
3585
3632
|
type: "u64"
|
|
3586
3633
|
},
|
|
3587
3634
|
{
|
|
3588
|
-
name: "
|
|
3635
|
+
name: "total_fees_deposited",
|
|
3589
3636
|
type: "u64"
|
|
3590
3637
|
},
|
|
3591
3638
|
{
|
|
3592
|
-
name: "
|
|
3593
|
-
type: "
|
|
3639
|
+
name: "total_cumulative_payout_alltime",
|
|
3640
|
+
type: "u128"
|
|
3594
3641
|
},
|
|
3595
3642
|
{
|
|
3596
|
-
name: "
|
|
3643
|
+
name: "total_cumulative_payout_epoch",
|
|
3597
3644
|
type: "u64"
|
|
3598
3645
|
},
|
|
3646
|
+
{
|
|
3647
|
+
name: "timestamp",
|
|
3648
|
+
type: "i64"
|
|
3649
|
+
},
|
|
3650
|
+
{
|
|
3651
|
+
name: "epoch",
|
|
3652
|
+
type: "u16"
|
|
3653
|
+
},
|
|
3599
3654
|
{
|
|
3600
3655
|
name: "bump",
|
|
3601
3656
|
type: "u8"
|
|
@@ -3650,47 +3705,86 @@ var types$4 = [
|
|
|
3650
3705
|
}
|
|
3651
3706
|
},
|
|
3652
3707
|
{
|
|
3653
|
-
name: "
|
|
3708
|
+
name: "StakeAllocationState",
|
|
3709
|
+
docs: [
|
|
3710
|
+
"Stake allocation state tracking for validator stake distribution and unstake orders",
|
|
3711
|
+
"Tracks both staking allocations (VPP-based) and unstake order batching"
|
|
3712
|
+
],
|
|
3654
3713
|
type: {
|
|
3655
3714
|
kind: "struct",
|
|
3656
3715
|
fields: [
|
|
3657
3716
|
{
|
|
3658
|
-
name: "
|
|
3659
|
-
|
|
3717
|
+
name: "total_active_vpp",
|
|
3718
|
+
docs: [
|
|
3719
|
+
"Sum of all VPP scores for Trusted validators in the active list"
|
|
3720
|
+
],
|
|
3721
|
+
type: "u64"
|
|
3660
3722
|
},
|
|
3661
3723
|
{
|
|
3662
|
-
name: "
|
|
3724
|
+
name: "bump",
|
|
3725
|
+
docs: [
|
|
3726
|
+
"Bump seed for PDA"
|
|
3727
|
+
],
|
|
3663
3728
|
type: "u8"
|
|
3664
3729
|
},
|
|
3665
3730
|
{
|
|
3666
|
-
name: "
|
|
3731
|
+
name: "initial_reserve_balance",
|
|
3732
|
+
docs: [
|
|
3733
|
+
"Initial reserve balance when distribution cycle started (for batched distribution)"
|
|
3734
|
+
],
|
|
3735
|
+
type: "u64"
|
|
3736
|
+
},
|
|
3737
|
+
{
|
|
3738
|
+
name: "pending_unstake_amount_this_epoch",
|
|
3739
|
+
docs: [
|
|
3740
|
+
"Accumulates unstake requests during the epoch (before allocation starts)",
|
|
3741
|
+
"Resets to 0 when allocation cycle begins"
|
|
3742
|
+
],
|
|
3743
|
+
type: "u64"
|
|
3744
|
+
},
|
|
3745
|
+
{
|
|
3746
|
+
name: "unstake_allocation_in_progress",
|
|
3747
|
+
docs: [
|
|
3748
|
+
"Whether unstake allocation is currently in progress (batched processing)"
|
|
3749
|
+
],
|
|
3667
3750
|
type: "bool"
|
|
3668
3751
|
},
|
|
3669
3752
|
{
|
|
3670
|
-
name: "
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
{
|
|
3677
|
-
name: "Role",
|
|
3678
|
-
docs: [
|
|
3679
|
-
"Role granted by a bond level"
|
|
3680
|
-
],
|
|
3681
|
-
type: {
|
|
3682
|
-
kind: "struct",
|
|
3683
|
-
fields: [
|
|
3753
|
+
name: "validators_processed_this_unstake_allocation",
|
|
3754
|
+
docs: [
|
|
3755
|
+
"Number of validators processed in the current unstake allocation batch"
|
|
3756
|
+
],
|
|
3757
|
+
type: "u16"
|
|
3758
|
+
},
|
|
3684
3759
|
{
|
|
3685
|
-
name: "
|
|
3760
|
+
name: "processing_unstake_amount_this_allocation",
|
|
3761
|
+
docs: [
|
|
3762
|
+
"FROZEN amount being allocated across all batches this cycle",
|
|
3763
|
+
"Set at start of allocation, prevents race conditions with new requests"
|
|
3764
|
+
],
|
|
3686
3765
|
type: "u64"
|
|
3687
3766
|
},
|
|
3688
3767
|
{
|
|
3689
|
-
name: "
|
|
3768
|
+
name: "rebalance_in_progress",
|
|
3690
3769
|
docs: [
|
|
3691
|
-
"
|
|
3770
|
+
"Whether rebalancing is currently in progress (batched processing)"
|
|
3692
3771
|
],
|
|
3693
|
-
type: "
|
|
3772
|
+
type: "bool"
|
|
3773
|
+
},
|
|
3774
|
+
{
|
|
3775
|
+
name: "validators_processed_this_rebalance",
|
|
3776
|
+
docs: [
|
|
3777
|
+
"Number of validators processed in the current rebalance cycle"
|
|
3778
|
+
],
|
|
3779
|
+
type: "u16"
|
|
3780
|
+
},
|
|
3781
|
+
{
|
|
3782
|
+
name: "total_amount_to_distribute_this_rebalance",
|
|
3783
|
+
docs: [
|
|
3784
|
+
"Total amount to distribute for this rebalance cycle (after subtracting encumbered funds and buffer)",
|
|
3785
|
+
"Saved at the start to ensure consistency across all batches"
|
|
3786
|
+
],
|
|
3787
|
+
type: "u64"
|
|
3694
3788
|
}
|
|
3695
3789
|
]
|
|
3696
3790
|
}
|
|
@@ -3740,6 +3834,10 @@ var types$4 = [
|
|
|
3740
3834
|
name: "sol_system_pay_rate",
|
|
3741
3835
|
type: "u64"
|
|
3742
3836
|
},
|
|
3837
|
+
{
|
|
3838
|
+
name: "unstakeable_stake",
|
|
3839
|
+
type: "u64"
|
|
3840
|
+
},
|
|
3743
3841
|
{
|
|
3744
3842
|
name: "bump",
|
|
3745
3843
|
type: "u8"
|
|
@@ -3885,89 +3983,21 @@ var types$4 = [
|
|
|
3885
3983
|
}
|
|
3886
3984
|
},
|
|
3887
3985
|
{
|
|
3888
|
-
name: "
|
|
3986
|
+
name: "UserRecord",
|
|
3889
3987
|
type: {
|
|
3890
3988
|
kind: "struct",
|
|
3891
3989
|
fields: [
|
|
3892
3990
|
{
|
|
3893
|
-
name: "
|
|
3991
|
+
name: "user_ata",
|
|
3894
3992
|
type: "pubkey"
|
|
3895
3993
|
},
|
|
3896
3994
|
{
|
|
3897
|
-
name: "
|
|
3898
|
-
type: "
|
|
3995
|
+
name: "tracked_balance",
|
|
3996
|
+
type: "u64"
|
|
3899
3997
|
},
|
|
3900
3998
|
{
|
|
3901
|
-
name: "
|
|
3902
|
-
type: "
|
|
3903
|
-
},
|
|
3904
|
-
{
|
|
3905
|
-
name: "last_updated_epoch_activations",
|
|
3906
|
-
type: "u16"
|
|
3907
|
-
},
|
|
3908
|
-
{
|
|
3909
|
-
name: "last_updated_epoch_deactivations_rebalancing",
|
|
3910
|
-
type: "u16"
|
|
3911
|
-
},
|
|
3912
|
-
{
|
|
3913
|
-
name: "last_updated_epoch_deactivations_withdrawals",
|
|
3914
|
-
type: "u16"
|
|
3915
|
-
},
|
|
3916
|
-
{
|
|
3917
|
-
name: "total_deactivation_amount_for_epoch",
|
|
3918
|
-
type: "u64"
|
|
3919
|
-
}
|
|
3920
|
-
]
|
|
3921
|
-
}
|
|
3922
|
-
},
|
|
3923
|
-
{
|
|
3924
|
-
name: "TransientUpdateParams",
|
|
3925
|
-
type: {
|
|
3926
|
-
kind: "struct",
|
|
3927
|
-
fields: [
|
|
3928
|
-
{
|
|
3929
|
-
name: "max_resolved_epoch_deactivations",
|
|
3930
|
-
type: {
|
|
3931
|
-
option: "u16"
|
|
3932
|
-
}
|
|
3933
|
-
},
|
|
3934
|
-
{
|
|
3935
|
-
name: "max_resolved_activating_stake",
|
|
3936
|
-
type: {
|
|
3937
|
-
option: "u16"
|
|
3938
|
-
}
|
|
3939
|
-
},
|
|
3940
|
-
{
|
|
3941
|
-
name: "last_updated_epoch_activations",
|
|
3942
|
-
type: {
|
|
3943
|
-
option: "u16"
|
|
3944
|
-
}
|
|
3945
|
-
},
|
|
3946
|
-
{
|
|
3947
|
-
name: "last_updated_epoch_deactivations",
|
|
3948
|
-
type: {
|
|
3949
|
-
option: "u16"
|
|
3950
|
-
}
|
|
3951
|
-
}
|
|
3952
|
-
]
|
|
3953
|
-
}
|
|
3954
|
-
},
|
|
3955
|
-
{
|
|
3956
|
-
name: "UserRecord",
|
|
3957
|
-
type: {
|
|
3958
|
-
kind: "struct",
|
|
3959
|
-
fields: [
|
|
3960
|
-
{
|
|
3961
|
-
name: "user_ata",
|
|
3962
|
-
type: "pubkey"
|
|
3963
|
-
},
|
|
3964
|
-
{
|
|
3965
|
-
name: "tracked_balance",
|
|
3966
|
-
type: "u64"
|
|
3967
|
-
},
|
|
3968
|
-
{
|
|
3969
|
-
name: "claim_balance",
|
|
3970
|
-
type: "u64"
|
|
3999
|
+
name: "claim_balance",
|
|
4000
|
+
type: "u64"
|
|
3971
4001
|
},
|
|
3972
4002
|
{
|
|
3973
4003
|
name: "last_claim_timestamp",
|
|
@@ -4029,113 +4059,330 @@ var types$4 = [
|
|
|
4029
4059
|
}
|
|
4030
4060
|
},
|
|
4031
4061
|
{
|
|
4032
|
-
name: "
|
|
4062
|
+
name: "ValidatorInfoAccount",
|
|
4063
|
+
docs: [
|
|
4064
|
+
"Per-validator information account",
|
|
4065
|
+
"Seed: [\"validator_info\", vote_account]"
|
|
4066
|
+
],
|
|
4033
4067
|
type: {
|
|
4034
4068
|
kind: "struct",
|
|
4035
4069
|
fields: [
|
|
4036
4070
|
{
|
|
4037
4071
|
name: "vote_account",
|
|
4072
|
+
docs: [
|
|
4073
|
+
"Vote account this info belongs to"
|
|
4074
|
+
],
|
|
4038
4075
|
type: "pubkey"
|
|
4039
4076
|
},
|
|
4040
4077
|
{
|
|
4041
4078
|
name: "vpp",
|
|
4079
|
+
docs: [
|
|
4080
|
+
"Validator Performance Points (0-100 score)"
|
|
4081
|
+
],
|
|
4082
|
+
type: "u8"
|
|
4083
|
+
},
|
|
4084
|
+
{
|
|
4085
|
+
name: "bump",
|
|
4086
|
+
docs: [
|
|
4087
|
+
"Bump seed for PDA"
|
|
4088
|
+
],
|
|
4042
4089
|
type: "u8"
|
|
4043
4090
|
},
|
|
4044
4091
|
{
|
|
4045
4092
|
name: "current_active_stake",
|
|
4093
|
+
docs: [
|
|
4094
|
+
"Fully active stake earning rewards"
|
|
4095
|
+
],
|
|
4046
4096
|
type: "u64"
|
|
4047
4097
|
},
|
|
4048
4098
|
{
|
|
4049
4099
|
name: "epoch_reward",
|
|
4100
|
+
docs: [
|
|
4101
|
+
"Rewards earned in the last epoch",
|
|
4102
|
+
"This is update in the function: sync_validator_stakes_v2 and is a simple subtraction of current - previous active stake. This does cater for deactivations etc. so",
|
|
4103
|
+
"no worries"
|
|
4104
|
+
],
|
|
4050
4105
|
type: "u64"
|
|
4051
4106
|
},
|
|
4052
4107
|
{
|
|
4053
4108
|
name: "transient_active_stake",
|
|
4109
|
+
docs: [
|
|
4110
|
+
"Stake warming up (activating), not fully active yet"
|
|
4111
|
+
],
|
|
4112
|
+
type: "u64"
|
|
4113
|
+
},
|
|
4114
|
+
{
|
|
4115
|
+
name: "transient_deactivating_stake",
|
|
4116
|
+
docs: [
|
|
4117
|
+
"Stake cooling down (deactivating), no longer earning rewards"
|
|
4118
|
+
],
|
|
4054
4119
|
type: "u64"
|
|
4055
4120
|
},
|
|
4056
4121
|
{
|
|
4057
4122
|
name: "last_chain_sync_epoch",
|
|
4123
|
+
docs: [
|
|
4124
|
+
"When was this entry last updated from the chain?",
|
|
4125
|
+
"This is update in the function: sync_validator_stakes_v2"
|
|
4126
|
+
],
|
|
4127
|
+
type: "u16"
|
|
4128
|
+
},
|
|
4129
|
+
{
|
|
4130
|
+
name: "last_score_sync_epoch",
|
|
4131
|
+
docs: [
|
|
4132
|
+
"When was this VPP score last updated from our Validator Leaderboard program?"
|
|
4133
|
+
],
|
|
4058
4134
|
type: "u16"
|
|
4135
|
+
},
|
|
4136
|
+
{
|
|
4137
|
+
name: "last_state_change_epoch",
|
|
4138
|
+
docs: [
|
|
4139
|
+
"When was the validator state last changed? (helps determine cooldowns)"
|
|
4140
|
+
],
|
|
4141
|
+
type: "u16"
|
|
4142
|
+
},
|
|
4143
|
+
{
|
|
4144
|
+
name: "amount_to_stake",
|
|
4145
|
+
docs: [
|
|
4146
|
+
"The amount of stake to stake"
|
|
4147
|
+
],
|
|
4148
|
+
type: "u64"
|
|
4149
|
+
},
|
|
4150
|
+
{
|
|
4151
|
+
name: "amount_to_unstake",
|
|
4152
|
+
docs: [
|
|
4153
|
+
"The amount of stake to unstake"
|
|
4154
|
+
],
|
|
4155
|
+
type: "u64"
|
|
4156
|
+
},
|
|
4157
|
+
{
|
|
4158
|
+
name: "validator_repute",
|
|
4159
|
+
docs: [
|
|
4160
|
+
"State of the validator"
|
|
4161
|
+
],
|
|
4162
|
+
type: {
|
|
4163
|
+
defined: {
|
|
4164
|
+
name: "ValidatorReputation"
|
|
4165
|
+
}
|
|
4166
|
+
}
|
|
4167
|
+
},
|
|
4168
|
+
{
|
|
4169
|
+
name: "validator_state",
|
|
4170
|
+
type: {
|
|
4171
|
+
defined: {
|
|
4172
|
+
name: "ValidatorState"
|
|
4173
|
+
}
|
|
4174
|
+
}
|
|
4175
|
+
},
|
|
4176
|
+
{
|
|
4177
|
+
name: "state_transition_trigger_stake_amount",
|
|
4178
|
+
type: "u64"
|
|
4059
4179
|
}
|
|
4060
4180
|
]
|
|
4061
4181
|
}
|
|
4062
4182
|
},
|
|
4063
4183
|
{
|
|
4064
|
-
name: "
|
|
4184
|
+
name: "ValidatorList",
|
|
4185
|
+
docs: [
|
|
4186
|
+
"Zero-copy validator list account",
|
|
4187
|
+
"Stores a fixed-capacity array of validator vote account pubkeys"
|
|
4188
|
+
],
|
|
4189
|
+
serialization: "bytemuckunsafe",
|
|
4190
|
+
repr: {
|
|
4191
|
+
kind: "c"
|
|
4192
|
+
},
|
|
4065
4193
|
type: {
|
|
4066
4194
|
kind: "struct",
|
|
4067
4195
|
fields: [
|
|
4068
4196
|
{
|
|
4069
|
-
name: "
|
|
4070
|
-
|
|
4197
|
+
name: "count",
|
|
4198
|
+
docs: [
|
|
4199
|
+
"Current number of validators in the list"
|
|
4200
|
+
],
|
|
4201
|
+
type: "u32"
|
|
4071
4202
|
},
|
|
4072
4203
|
{
|
|
4073
|
-
name: "
|
|
4204
|
+
name: "capacity",
|
|
4205
|
+
docs: [
|
|
4206
|
+
"Maximum capacity of the list"
|
|
4207
|
+
],
|
|
4074
4208
|
type: "u32"
|
|
4075
4209
|
},
|
|
4076
4210
|
{
|
|
4077
|
-
name: "
|
|
4078
|
-
|
|
4211
|
+
name: "bump",
|
|
4212
|
+
docs: [
|
|
4213
|
+
"PDA bump seed"
|
|
4214
|
+
],
|
|
4215
|
+
type: "u8"
|
|
4079
4216
|
},
|
|
4080
4217
|
{
|
|
4081
|
-
name: "
|
|
4082
|
-
|
|
4218
|
+
name: "_padding",
|
|
4219
|
+
docs: [
|
|
4220
|
+
"Padding for alignment"
|
|
4221
|
+
],
|
|
4222
|
+
type: {
|
|
4223
|
+
array: [
|
|
4224
|
+
"u8",
|
|
4225
|
+
7
|
|
4226
|
+
]
|
|
4227
|
+
}
|
|
4228
|
+
},
|
|
4229
|
+
{
|
|
4230
|
+
name: "validators",
|
|
4231
|
+
docs: [
|
|
4232
|
+
"Fixed array of validator vote account pubkeys",
|
|
4233
|
+
"Using Option to allow for empty slots (None = empty)"
|
|
4234
|
+
],
|
|
4235
|
+
type: {
|
|
4236
|
+
array: [
|
|
4237
|
+
{
|
|
4238
|
+
defined: {
|
|
4239
|
+
name: "ValidatorListEntry"
|
|
4240
|
+
}
|
|
4241
|
+
},
|
|
4242
|
+
256
|
|
4243
|
+
]
|
|
4244
|
+
}
|
|
4083
4245
|
}
|
|
4084
4246
|
]
|
|
4085
4247
|
}
|
|
4086
4248
|
},
|
|
4087
4249
|
{
|
|
4088
|
-
name: "
|
|
4250
|
+
name: "ValidatorListEntry",
|
|
4251
|
+
serialization: "bytemuckunsafe",
|
|
4252
|
+
repr: {
|
|
4253
|
+
kind: "c"
|
|
4254
|
+
},
|
|
4089
4255
|
type: {
|
|
4090
4256
|
kind: "struct",
|
|
4091
4257
|
fields: [
|
|
4092
4258
|
{
|
|
4093
|
-
name: "
|
|
4259
|
+
name: "vote_account",
|
|
4260
|
+
docs: [
|
|
4261
|
+
"Vote account pubkey (all zeros = empty slot)"
|
|
4262
|
+
],
|
|
4094
4263
|
type: "pubkey"
|
|
4264
|
+
}
|
|
4265
|
+
]
|
|
4266
|
+
}
|
|
4267
|
+
},
|
|
4268
|
+
{
|
|
4269
|
+
name: "ValidatorReputation",
|
|
4270
|
+
type: {
|
|
4271
|
+
kind: "enum",
|
|
4272
|
+
variants: [
|
|
4273
|
+
{
|
|
4274
|
+
name: "Trusted"
|
|
4095
4275
|
},
|
|
4096
4276
|
{
|
|
4097
|
-
name: "
|
|
4098
|
-
type: {
|
|
4099
|
-
vec: {
|
|
4100
|
-
defined: {
|
|
4101
|
-
name: "ValidatorInfo"
|
|
4102
|
-
}
|
|
4103
|
-
}
|
|
4104
|
-
}
|
|
4277
|
+
name: "Blacklisted"
|
|
4105
4278
|
},
|
|
4106
4279
|
{
|
|
4107
|
-
name: "
|
|
4108
|
-
|
|
4280
|
+
name: "UnderPerforming"
|
|
4281
|
+
}
|
|
4282
|
+
]
|
|
4283
|
+
}
|
|
4284
|
+
},
|
|
4285
|
+
{
|
|
4286
|
+
name: "ValidatorState",
|
|
4287
|
+
type: {
|
|
4288
|
+
kind: "enum",
|
|
4289
|
+
variants: [
|
|
4290
|
+
{
|
|
4291
|
+
name: "Warming"
|
|
4109
4292
|
},
|
|
4110
4293
|
{
|
|
4111
|
-
name: "
|
|
4112
|
-
|
|
4294
|
+
name: "NotDelegated"
|
|
4295
|
+
},
|
|
4296
|
+
{
|
|
4297
|
+
name: "Cooling"
|
|
4298
|
+
},
|
|
4299
|
+
{
|
|
4300
|
+
name: "Warm"
|
|
4301
|
+
}
|
|
4302
|
+
]
|
|
4303
|
+
}
|
|
4304
|
+
},
|
|
4305
|
+
{
|
|
4306
|
+
name: "ValidatorStateChangeReason",
|
|
4307
|
+
type: {
|
|
4308
|
+
kind: "enum",
|
|
4309
|
+
variants: [
|
|
4310
|
+
{
|
|
4311
|
+
name: "Blacklisted"
|
|
4312
|
+
},
|
|
4313
|
+
{
|
|
4314
|
+
name: "UnderPerforming"
|
|
4113
4315
|
}
|
|
4114
4316
|
]
|
|
4115
4317
|
}
|
|
4116
4318
|
},
|
|
4117
4319
|
{
|
|
4118
|
-
name: "
|
|
4320
|
+
name: "ValidatorTransientAccount",
|
|
4321
|
+
docs: [
|
|
4322
|
+
"Per-validator transient stake tracking account",
|
|
4323
|
+
"Seed: [\"validator_transient\", vote_account]",
|
|
4324
|
+
"",
|
|
4325
|
+
"This account tracks the resolution status of transient stake accounts",
|
|
4326
|
+
"(both activating and deactivating) for a specific validator."
|
|
4327
|
+
],
|
|
4119
4328
|
type: {
|
|
4120
4329
|
kind: "struct",
|
|
4121
4330
|
fields: [
|
|
4122
4331
|
{
|
|
4123
|
-
name: "
|
|
4332
|
+
name: "vote_account",
|
|
4333
|
+
docs: [
|
|
4334
|
+
"Vote account this transient tracking belongs to"
|
|
4335
|
+
],
|
|
4336
|
+
type: "pubkey"
|
|
4337
|
+
},
|
|
4338
|
+
{
|
|
4339
|
+
name: "bump",
|
|
4340
|
+
docs: [
|
|
4341
|
+
"Bump seed for PDA"
|
|
4342
|
+
],
|
|
4343
|
+
type: "u8"
|
|
4344
|
+
},
|
|
4345
|
+
{
|
|
4346
|
+
name: "_padding",
|
|
4347
|
+
docs: [
|
|
4348
|
+
"Padding for alignment"
|
|
4349
|
+
],
|
|
4124
4350
|
type: {
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
}
|
|
4351
|
+
array: [
|
|
4352
|
+
"u8",
|
|
4353
|
+
7
|
|
4354
|
+
]
|
|
4130
4355
|
}
|
|
4131
4356
|
},
|
|
4132
4357
|
{
|
|
4133
|
-
name: "
|
|
4358
|
+
name: "max_resolved_epoch_deactivations",
|
|
4359
|
+
docs: [
|
|
4360
|
+
"The epoch number for which we have resolved the deactivating stakes",
|
|
4361
|
+
"(resolved = deactivated and merged into the stake pool reserve)"
|
|
4362
|
+
],
|
|
4134
4363
|
type: "u16"
|
|
4135
4364
|
},
|
|
4136
4365
|
{
|
|
4137
|
-
name: "
|
|
4138
|
-
|
|
4366
|
+
name: "max_resolved_activating_stake",
|
|
4367
|
+
docs: [
|
|
4368
|
+
"The epoch number for which we have resolved the activating stakes",
|
|
4369
|
+
"(resolved = fully activated and merged into the main stake account)"
|
|
4370
|
+
],
|
|
4371
|
+
type: "u16"
|
|
4372
|
+
},
|
|
4373
|
+
{
|
|
4374
|
+
name: "last_updated_epoch_activations",
|
|
4375
|
+
docs: [
|
|
4376
|
+
"When did we last check if there are pending activated transient stakes that need to be merged in"
|
|
4377
|
+
],
|
|
4378
|
+
type: "u16"
|
|
4379
|
+
},
|
|
4380
|
+
{
|
|
4381
|
+
name: "last_updated_epoch_deactivations",
|
|
4382
|
+
docs: [
|
|
4383
|
+
"When did we last check if there were pending deactivated stakes that need to be merged into the reserve pool"
|
|
4384
|
+
],
|
|
4385
|
+
type: "u16"
|
|
4139
4386
|
}
|
|
4140
4387
|
]
|
|
4141
4388
|
}
|
|
@@ -4214,13 +4461,6 @@ var types$4 = [
|
|
|
4214
4461
|
],
|
|
4215
4462
|
type: "u64"
|
|
4216
4463
|
},
|
|
4217
|
-
{
|
|
4218
|
-
name: "locked",
|
|
4219
|
-
docs: [
|
|
4220
|
-
"True when WireReceipt is locked by an active bond (prevents withdrawals)"
|
|
4221
|
-
],
|
|
4222
|
-
type: "bool"
|
|
4223
|
-
},
|
|
4224
4464
|
{
|
|
4225
4465
|
name: "bump",
|
|
4226
4466
|
type: "u8"
|
|
@@ -4279,7 +4519,7 @@ var liqsolCoreIDL = {
|
|
|
4279
4519
|
types: types$4
|
|
4280
4520
|
};
|
|
4281
4521
|
|
|
4282
|
-
var address$1 = "
|
|
4522
|
+
var address$1 = "HEAKvfg2X7K4zbGDiAbfuu5abxQyk1HbKVgskZZFXrUx";
|
|
4283
4523
|
var metadata$1 = {
|
|
4284
4524
|
name: "liqsol_token",
|
|
4285
4525
|
version: "0.1.0",
|
|
@@ -4468,7 +4708,7 @@ var liqsolTokenJson = {
|
|
|
4468
4708
|
types: types$3
|
|
4469
4709
|
};
|
|
4470
4710
|
|
|
4471
|
-
var address = "
|
|
4711
|
+
var address = "BcMW7wN54FexYaB7Xujvag5uUQ1WoDoGbzVg1VEXPBhV";
|
|
4472
4712
|
var metadata = {
|
|
4473
4713
|
name: "validator_leaderboard",
|
|
4474
4714
|
version: "0.1.0",
|
|
@@ -5068,7 +5308,7 @@ const PDA_SEEDS = {
|
|
|
5068
5308
|
VAULT: "vault",
|
|
5069
5309
|
RESERVE_POOL: "reserve_pool",
|
|
5070
5310
|
STAKE_CONTROLLER_STATE: "stake_controller",
|
|
5071
|
-
PAYOUT_STATE: "
|
|
5311
|
+
PAYOUT_STATE: "payout_state",
|
|
5072
5312
|
LIQSOL_MINT: "liqsol_mint",
|
|
5073
5313
|
LIQSOL_MINT_AUTHORITY: "mint_authority",
|
|
5074
5314
|
BUCKET_AUTHORITY: "liqsol_bucket",
|
|
@@ -5077,7 +5317,16 @@ const PDA_SEEDS = {
|
|
|
5077
5317
|
PAY_RATE_HISTORY: "pay_rate_history",
|
|
5078
5318
|
LEADERBOARD_STATE: "leaderboard_state",
|
|
5079
5319
|
VALIDATOR_RECORD: "validator",
|
|
5080
|
-
GLOBAL_STAKE_INFO: "global_stake_info"
|
|
5320
|
+
GLOBAL_STAKE_INFO: "global_stake_info",
|
|
5321
|
+
WARRANT_DEPOSIT_GLOBAL: "warrant_deposit_global",
|
|
5322
|
+
LIQSOL_POOL: "liqsol_pool",
|
|
5323
|
+
WARRANT_DEPOSIT_RECORD: "warrant_deposit_record",
|
|
5324
|
+
WIRE_SOL_BUCKET: "wire_sol_bucket",
|
|
5325
|
+
TRANCHE_STATE: "tranche_state",
|
|
5326
|
+
USER_WARRANT_RECORD: "user_warrant_record",
|
|
5327
|
+
BAR_STATE_SEED: "bar_state",
|
|
5328
|
+
BONDED_ACTOR_SEED: "bonded_actor",
|
|
5329
|
+
BOND_LEVEL_SEED: "bond_level"
|
|
5081
5330
|
};
|
|
5082
5331
|
const deriveLiqsolMintPda = () => PublicKey.findProgramAddressSync(
|
|
5083
5332
|
[Buffer.from(PDA_SEEDS.LIQSOL_MINT)],
|
|
@@ -5135,17 +5384,63 @@ const deriveStakeControllerVaultPda = () => PublicKey.findProgramAddressSync(
|
|
|
5135
5384
|
[Buffer.from(PDA_SEEDS.VAULT)],
|
|
5136
5385
|
PROGRAM_IDS.LIQSOL_CORE
|
|
5137
5386
|
)[0];
|
|
5387
|
+
const deriveOutpostGlobalStatePda = () => PublicKey.findProgramAddressSync(
|
|
5388
|
+
[Buffer.from(PDA_SEEDS.WARRANT_DEPOSIT_GLOBAL)],
|
|
5389
|
+
LIQSOL_CORE
|
|
5390
|
+
)[0];
|
|
5391
|
+
const deriveOutpostPoolAuthorityPda = () => PublicKey.findProgramAddressSync(
|
|
5392
|
+
[Buffer.from(PDA_SEEDS.LIQSOL_POOL)],
|
|
5393
|
+
LIQSOL_CORE
|
|
5394
|
+
)[0];
|
|
5395
|
+
const deriveWireReceiptPda = (user) => PublicKey.findProgramAddressSync(
|
|
5396
|
+
[Buffer.from(PDA_SEEDS.WARRANT_DEPOSIT_RECORD), user.toBuffer()],
|
|
5397
|
+
LIQSOL_CORE
|
|
5398
|
+
)[0];
|
|
5399
|
+
const derivePoolUserRecordPda = (poolAuthority) => PublicKey.findProgramAddressSync(
|
|
5400
|
+
[Buffer.from(PDA_SEEDS.USER_RECORD), poolAuthority.toBuffer()],
|
|
5401
|
+
LIQSOL_CORE
|
|
5402
|
+
)[0];
|
|
5403
|
+
const deriveUserUserRecordPda = (user) => PublicKey.findProgramAddressSync(
|
|
5404
|
+
[Buffer.from(PDA_SEEDS.USER_RECORD), user.toBuffer()],
|
|
5405
|
+
LIQSOL_CORE
|
|
5406
|
+
)[0];
|
|
5407
|
+
const deriveSolBucketPda = () => PublicKey.findProgramAddressSync(
|
|
5408
|
+
[Buffer.from(PDA_SEEDS.WIRE_SOL_BUCKET)],
|
|
5409
|
+
LIQSOL_CORE
|
|
5410
|
+
)[0];
|
|
5411
|
+
const deriveTrancheStatePda = () => PublicKey.findProgramAddressSync(
|
|
5412
|
+
[Buffer.from(PDA_SEEDS.TRANCHE_STATE)],
|
|
5413
|
+
LIQSOL_CORE
|
|
5414
|
+
)[0];
|
|
5415
|
+
const deriveUserWarrantRecordPda = (user) => PublicKey.findProgramAddressSync(
|
|
5416
|
+
[Buffer.from(PDA_SEEDS.USER_WARRANT_RECORD), user.toBuffer()],
|
|
5417
|
+
LIQSOL_CORE
|
|
5418
|
+
)[0];
|
|
5419
|
+
const deriveBarConfigPda = () => PublicKey.findProgramAddressSync(
|
|
5420
|
+
[Buffer.from(PDA_SEEDS.BAR_STATE_SEED)],
|
|
5421
|
+
LIQSOL_CORE
|
|
5422
|
+
)[0];
|
|
5423
|
+
const deriveBondLevelPda = (bondLevelId) => PublicKey.findProgramAddressSync(
|
|
5424
|
+
[Buffer.from(PDA_SEEDS.BOND_LEVEL_SEED), Buffer.from(bondLevelId)],
|
|
5425
|
+
LIQSOL_CORE
|
|
5426
|
+
)[0];
|
|
5427
|
+
const deriveBondedActorPda = (actor) => PublicKey.findProgramAddressSync(
|
|
5428
|
+
[Buffer.from(PDA_SEEDS.BONDED_ACTOR_SEED), actor.toBuffer()],
|
|
5429
|
+
LIQSOL_CORE
|
|
5430
|
+
)[0];
|
|
5138
5431
|
const deriveEphemeralStakeAddress = async (user, seed) => {
|
|
5139
5432
|
const seedStr = `ephemeral_${seed}`;
|
|
5140
5433
|
return await PublicKey.createWithSeed(user, seedStr, StakeProgram.programId);
|
|
5141
5434
|
};
|
|
5435
|
+
const CHAINLINK_FEED = new PublicKey("99B2bTijsU6f1GCT73HmdR7HCFFjGMBcPZY6jZ96ynrR");
|
|
5436
|
+
const CHAINLINK_PROGRAM = new PublicKey("HEvSKofvBgfaexv23kMabbYqxasxU3mQ4ibBMEmJWHny");
|
|
5142
5437
|
const PAY_RATE_SCALE_FACTOR = BigInt(1e12);
|
|
5143
5438
|
const DEFAULT_AVERAGE_PAY_RATE = BigInt(191780821);
|
|
5144
5439
|
const DEFAULT_PAY_RATE_LOOKBACK = 5;
|
|
5145
5440
|
const EPHEMERAL_RENT_EXEMPTION = 2282880;
|
|
5146
5441
|
const LAMPORTS_PER_SOL = 1e9;
|
|
5147
5442
|
const lamportsToSol = (lamports) => Number(lamports) / LAMPORTS_PER_SOL;
|
|
5148
|
-
const solToLamports = (sol) => Math.round(sol * LAMPORTS_PER_SOL);
|
|
5443
|
+
const solToLamports = (sol) => BigInt(Math.round(sol * LAMPORTS_PER_SOL));
|
|
5149
5444
|
|
|
5150
5445
|
const PROGRAMS = {
|
|
5151
5446
|
liqsolCore: {
|
|
@@ -5181,8 +5476,10 @@ class DepositClient {
|
|
|
5181
5476
|
const svc = new SolanaProgramService(provider);
|
|
5182
5477
|
this.program = svc.getProgram("liqsolCore");
|
|
5183
5478
|
}
|
|
5184
|
-
|
|
5185
|
-
|
|
5479
|
+
get wallet() {
|
|
5480
|
+
return this.provider.wallet;
|
|
5481
|
+
}
|
|
5482
|
+
async buildDepositTx(amount, user = this.wallet.publicKey) {
|
|
5186
5483
|
const depositAuthority = deriveDepositAuthorityPda();
|
|
5187
5484
|
const liqsolMint = deriveLiqsolMintPda();
|
|
5188
5485
|
const liqsolMintAuthority = deriveLiqsolMintAuthorityPda();
|
|
@@ -5208,7 +5505,7 @@ class DepositClient {
|
|
|
5208
5505
|
);
|
|
5209
5506
|
const seed = Math.floor(Math.random() * 2 ** 32);
|
|
5210
5507
|
const ephemeralStake = await deriveEphemeralStakeAddress(user, seed);
|
|
5211
|
-
const ix = await program.methods.deposit(new BN(
|
|
5508
|
+
const ix = await this.program.methods.deposit(new BN(amount.toString()), seed).accounts({
|
|
5212
5509
|
user,
|
|
5213
5510
|
depositAuthority,
|
|
5214
5511
|
systemProgram: SystemProgram.programId,
|
|
@@ -5234,8 +5531,7 @@ class DepositClient {
|
|
|
5234
5531
|
stakeHistory: SYSVAR_STAKE_HISTORY_PUBKEY,
|
|
5235
5532
|
rent: SYSVAR_RENT_PUBKEY
|
|
5236
5533
|
}).instruction();
|
|
5237
|
-
|
|
5238
|
-
return { transaction: tx, ephemeralStake };
|
|
5534
|
+
return new Transaction().add(ix);
|
|
5239
5535
|
}
|
|
5240
5536
|
}
|
|
5241
5537
|
|
|
@@ -5479,216 +5775,800 @@ class LeaderboardClient {
|
|
|
5479
5775
|
}
|
|
5480
5776
|
}
|
|
5481
5777
|
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
const adapter = config.provider;
|
|
5487
|
-
if (!adapter.publicKey) {
|
|
5488
|
-
throw new Error("Solana wallet adapter not connected");
|
|
5489
|
-
}
|
|
5490
|
-
if (!config.network.rpcUrls.length) {
|
|
5491
|
-
throw new Error("No RPC URLs provided");
|
|
5492
|
-
}
|
|
5493
|
-
const publicKey = adapter.publicKey;
|
|
5494
|
-
const wirePub = new PublicKey$1(KeyType.ED, publicKey.toBytes());
|
|
5495
|
-
if (!wirePub.equals(config.pubKey)) {
|
|
5496
|
-
throw new Error("Passed-in pubKey doesn't match adapter.publicKey");
|
|
5497
|
-
}
|
|
5498
|
-
const opts = { commitment };
|
|
5499
|
-
if (config.network.rpcUrls.length > 1 && config.network.rpcUrls[1].startsWith("ws")) {
|
|
5500
|
-
opts.wsEndpoint = config.network.rpcUrls[1];
|
|
5501
|
-
}
|
|
5502
|
-
this.pubKey = wirePub;
|
|
5503
|
-
this.connection = new Connection(config.network.rpcUrls[0], opts);
|
|
5504
|
-
const anchorWallet = {
|
|
5505
|
-
publicKey,
|
|
5506
|
-
async signTransaction(tx) {
|
|
5507
|
-
return adapter.signTransaction(tx);
|
|
5508
|
-
},
|
|
5509
|
-
async signAllTransactions(txs) {
|
|
5510
|
-
return Promise.all(txs.map((tx) => adapter.signTransaction(tx)));
|
|
5511
|
-
}
|
|
5512
|
-
};
|
|
5513
|
-
this.anchor = new AnchorProvider(this.connection, anchorWallet, { commitment });
|
|
5514
|
-
this.depositClient = new DepositClient(this.anchor);
|
|
5515
|
-
this.distributionClient = new DistributionClient(this.anchor);
|
|
5516
|
-
this.leaderboardClient = new LeaderboardClient(this.anchor);
|
|
5517
|
-
}
|
|
5518
|
-
get solPubKey() {
|
|
5519
|
-
return new PublicKey(this.pubKey.data.array);
|
|
5520
|
-
}
|
|
5521
|
-
get network() {
|
|
5522
|
-
return this.config.network;
|
|
5523
|
-
}
|
|
5524
|
-
async getPortfolio() {
|
|
5525
|
-
try {
|
|
5526
|
-
const user = this.solPubKey;
|
|
5527
|
-
const reservePoolPDA = deriveReservePoolPda();
|
|
5528
|
-
const vaultPDA = deriveVaultPda();
|
|
5529
|
-
const liqsolMint = deriveLiqsolMintPda();
|
|
5530
|
-
const userLiqsolAta = getAssociatedTokenAddressSync(
|
|
5531
|
-
liqsolMint,
|
|
5532
|
-
user,
|
|
5533
|
-
false,
|
|
5534
|
-
TOKEN_2022_PROGRAM_ID
|
|
5535
|
-
);
|
|
5536
|
-
const [nativeLamports, actualBalResp, userRecord] = await Promise.all([
|
|
5537
|
-
this.connection.getBalance(user),
|
|
5538
|
-
this.connection.getTokenAccountBalance(userLiqsolAta).catch(() => null),
|
|
5539
|
-
this.distributionClient.getUserRecord(user).catch(() => null)
|
|
5540
|
-
]);
|
|
5541
|
-
const actualAmountStr = actualBalResp?.value?.amount ?? "0";
|
|
5542
|
-
const actualDecimals = actualBalResp?.value?.decimals ?? 9;
|
|
5543
|
-
const trackedAmountStr = userRecord?.trackedBalance ? userRecord.trackedBalance.toString() : "0";
|
|
5544
|
-
const trackedDecimals = actualDecimals;
|
|
5545
|
-
const nativeSymbol = "SOL";
|
|
5546
|
-
const liqSymbol = "LiqSOL";
|
|
5547
|
-
const portfolio = {
|
|
5548
|
-
native: {
|
|
5549
|
-
amount: BigInt(nativeLamports),
|
|
5550
|
-
symbol: nativeSymbol,
|
|
5551
|
-
decimals: 9
|
|
5552
|
-
},
|
|
5553
|
-
liq: {
|
|
5554
|
-
amount: BigInt(actualAmountStr),
|
|
5555
|
-
symbol: liqSymbol,
|
|
5556
|
-
decimals: actualDecimals
|
|
5557
|
-
},
|
|
5558
|
-
staked: {
|
|
5559
|
-
amount: BigInt(0),
|
|
5560
|
-
symbol: liqSymbol,
|
|
5561
|
-
decimals: actualDecimals
|
|
5562
|
-
},
|
|
5563
|
-
tracked: {
|
|
5564
|
-
amount: BigInt(trackedAmountStr),
|
|
5565
|
-
symbol: liqSymbol,
|
|
5566
|
-
decimals: trackedDecimals
|
|
5567
|
-
},
|
|
5568
|
-
extras: {
|
|
5569
|
-
userLiqsolAta: userLiqsolAta.toBase58(),
|
|
5570
|
-
reservePoolPDA: reservePoolPDA.toBase58(),
|
|
5571
|
-
vaultPDA: vaultPDA.toBase58()
|
|
5572
|
-
},
|
|
5573
|
-
chainID: this.network.chainId
|
|
5574
|
-
};
|
|
5575
|
-
return portfolio;
|
|
5576
|
-
} catch (error) {
|
|
5577
|
-
console.log("Error in getPortfolio:", error);
|
|
5578
|
-
throw error;
|
|
5579
|
-
}
|
|
5778
|
+
let _liqsolCoreProgram = null;
|
|
5779
|
+
function getLiqsolCoreProgram(connection) {
|
|
5780
|
+
if (_liqsolCoreProgram && _liqsolCoreProgram.provider.connection === connection) {
|
|
5781
|
+
return _liqsolCoreProgram;
|
|
5580
5782
|
}
|
|
5581
|
-
|
|
5582
|
-
|
|
5783
|
+
const tmpKeypair = Keypair.generate();
|
|
5784
|
+
const wallet = { publicKey: tmpKeypair.publicKey, signAllTransactions: async () => [], signTransaction: async () => tmpKeypair };
|
|
5785
|
+
const provider = new AnchorProvider(connection, wallet, {
|
|
5786
|
+
commitment: "confirmed"
|
|
5787
|
+
});
|
|
5788
|
+
const program = new Program(
|
|
5789
|
+
liqsolCoreIDL,
|
|
5790
|
+
provider
|
|
5791
|
+
);
|
|
5792
|
+
_liqsolCoreProgram = program;
|
|
5793
|
+
return program;
|
|
5794
|
+
}
|
|
5795
|
+
async function getUserLiqSolBalance(connection, user) {
|
|
5796
|
+
const liqsolMint = deriveLiqsolMintPda();
|
|
5797
|
+
const ata = await getAssociatedTokenAddress(
|
|
5798
|
+
liqsolMint,
|
|
5799
|
+
user,
|
|
5800
|
+
false,
|
|
5801
|
+
TOKEN_2022_PROGRAM_ID
|
|
5802
|
+
);
|
|
5803
|
+
try {
|
|
5804
|
+
const bal = await connection.getTokenAccountBalance(ata);
|
|
5805
|
+
return Number(bal.value.amount);
|
|
5806
|
+
} catch {
|
|
5807
|
+
return 0;
|
|
5583
5808
|
}
|
|
5584
|
-
|
|
5809
|
+
}
|
|
5810
|
+
async function getBucketLiqSolBalance(connection) {
|
|
5811
|
+
const liqsolMint = deriveLiqsolMintPda();
|
|
5812
|
+
const bucketAuthority = deriveBucketAuthorityPda();
|
|
5813
|
+
const ata = await getAssociatedTokenAddress(
|
|
5814
|
+
liqsolMint,
|
|
5815
|
+
bucketAuthority,
|
|
5816
|
+
true,
|
|
5817
|
+
TOKEN_2022_PROGRAM_ID
|
|
5818
|
+
);
|
|
5819
|
+
try {
|
|
5820
|
+
const bal = await connection.getTokenAccountBalance(ata);
|
|
5821
|
+
return Number(bal.value.amount);
|
|
5822
|
+
} catch {
|
|
5823
|
+
return 0;
|
|
5585
5824
|
}
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
const
|
|
5591
|
-
return
|
|
5825
|
+
}
|
|
5826
|
+
async function getReservePoolBalance(connection) {
|
|
5827
|
+
const reservePool = deriveReservePoolPda();
|
|
5828
|
+
try {
|
|
5829
|
+
const lamports = await connection.getBalance(reservePool);
|
|
5830
|
+
return lamports;
|
|
5831
|
+
} catch {
|
|
5832
|
+
return 0;
|
|
5592
5833
|
}
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5834
|
+
}
|
|
5835
|
+
async function getStakeControllerStateRaw(connection) {
|
|
5836
|
+
const pda = deriveStakeControllerStatePda();
|
|
5837
|
+
const info = await connection.getAccountInfo(pda);
|
|
5838
|
+
return info?.data ?? null;
|
|
5839
|
+
}
|
|
5840
|
+
async function getPayoutStateRaw(connection) {
|
|
5841
|
+
const pda = derivePayoutStatePda();
|
|
5842
|
+
const info = await connection.getAccountInfo(pda);
|
|
5843
|
+
return info?.data ?? null;
|
|
5844
|
+
}
|
|
5845
|
+
async function getUserRecordRaw(connection, user) {
|
|
5846
|
+
const pda = deriveUserRecordPda(user);
|
|
5847
|
+
const info = await connection.getAccountInfo(pda);
|
|
5848
|
+
return info?.data ?? null;
|
|
5849
|
+
}
|
|
5850
|
+
async function getAveragePayRate(connection, lookback = DEFAULT_PAY_RATE_LOOKBACK) {
|
|
5851
|
+
const program = getLiqsolCoreProgram(connection);
|
|
5852
|
+
const payRateHistoryPda = derivePayRateHistoryPda();
|
|
5853
|
+
try {
|
|
5854
|
+
const anyProgram = program;
|
|
5855
|
+
const payRateHistoryAccount = await anyProgram.account.payRateHistory.fetch(
|
|
5856
|
+
payRateHistoryPda
|
|
5857
|
+
);
|
|
5858
|
+
const entries = payRateHistoryAccount.entries ?? [];
|
|
5859
|
+
const totalEntriesAdded = Number(
|
|
5860
|
+
payRateHistoryAccount.totalEntriesAdded ?? 0
|
|
5861
|
+
);
|
|
5862
|
+
const currentIndex = payRateHistoryAccount.currentIndex ?? 0;
|
|
5863
|
+
const maxEntries = payRateHistoryAccount.maxEntries ?? entries.length;
|
|
5864
|
+
if (!entries.length) {
|
|
5865
|
+
return DEFAULT_AVERAGE_PAY_RATE;
|
|
5866
|
+
}
|
|
5867
|
+
const entriesToFetch = Math.min(lookback, maxEntries, entries.length);
|
|
5868
|
+
let idx;
|
|
5869
|
+
if (totalEntriesAdded === 0) {
|
|
5870
|
+
idx = 0;
|
|
5871
|
+
} else if (currentIndex === 0) {
|
|
5872
|
+
idx = maxEntries - 1;
|
|
5873
|
+
} else {
|
|
5874
|
+
idx = currentIndex - 1;
|
|
5875
|
+
}
|
|
5876
|
+
let sum = BigInt(0);
|
|
5877
|
+
let validCount = BigInt(0);
|
|
5878
|
+
for (let i = 0; i < entriesToFetch; i++) {
|
|
5879
|
+
const entry = entries[idx];
|
|
5880
|
+
if (entry && typeof entry.scaledRate !== "undefined") {
|
|
5881
|
+
const rate = BigInt(entry.scaledRate.toString());
|
|
5882
|
+
if (rate > BigInt(0)) {
|
|
5883
|
+
sum += rate;
|
|
5884
|
+
validCount += BigInt(1);
|
|
5885
|
+
}
|
|
5886
|
+
}
|
|
5887
|
+
if (totalEntriesAdded === 0) {
|
|
5888
|
+
idx = (idx + 1) % maxEntries;
|
|
5889
|
+
} else {
|
|
5890
|
+
idx = idx === 0 ? maxEntries - 1 : idx - 1;
|
|
5598
5891
|
}
|
|
5599
|
-
const { tx, blockhash, lastValidBlockHeight } = await this.prepareTx(build.transaction);
|
|
5600
|
-
const signed = await this.signTransaction(tx);
|
|
5601
|
-
const result = await this.sendAndConfirmHttp(signed, { blockhash, lastValidBlockHeight });
|
|
5602
|
-
console.log("Registered:", {
|
|
5603
|
-
needToRegister: build.needToRegister,
|
|
5604
|
-
freed: build.plan.willFree,
|
|
5605
|
-
corrected: build.plan.selected.map((c) => ({
|
|
5606
|
-
owner: c.owner?.toBase58(),
|
|
5607
|
-
delta: c.delta?.toString()
|
|
5608
|
-
}))
|
|
5609
|
-
});
|
|
5610
|
-
return result.signature;
|
|
5611
|
-
} catch (error) {
|
|
5612
|
-
console.error("Error in register:", error);
|
|
5613
|
-
throw error;
|
|
5614
5892
|
}
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
const signature = await this.connection.sendRawTransaction(signed.serialize(), {
|
|
5618
|
-
skipPreflight: false,
|
|
5619
|
-
preflightCommitment: commitment,
|
|
5620
|
-
maxRetries: 3
|
|
5621
|
-
});
|
|
5622
|
-
const conf = await this.connection.confirmTransaction(
|
|
5623
|
-
{ signature, blockhash: ctx.blockhash, lastValidBlockHeight: ctx.lastValidBlockHeight },
|
|
5624
|
-
commitment
|
|
5625
|
-
);
|
|
5626
|
-
const ok = !conf.value.err;
|
|
5627
|
-
if (!ok) {
|
|
5628
|
-
throw new Error(`Transaction failed: ${JSON.stringify(conf.value.err)}`);
|
|
5893
|
+
if (validCount === BigInt(0)) {
|
|
5894
|
+
return DEFAULT_AVERAGE_PAY_RATE;
|
|
5629
5895
|
}
|
|
5630
|
-
return
|
|
5631
|
-
}
|
|
5632
|
-
|
|
5633
|
-
return this.anchor.wallet.signTransaction(tx);
|
|
5634
|
-
}
|
|
5635
|
-
async sendTransaction(signed) {
|
|
5636
|
-
return this.anchor.sendAndConfirm(signed);
|
|
5637
|
-
}
|
|
5638
|
-
async prepareTx(tx) {
|
|
5639
|
-
const { blockhash, lastValidBlockHeight } = await this.connection.getLatestBlockhash("confirmed");
|
|
5640
|
-
tx.recentBlockhash = blockhash;
|
|
5641
|
-
tx.feePayer = this.solPubKey;
|
|
5642
|
-
return { tx, blockhash, lastValidBlockHeight };
|
|
5896
|
+
return sum / validCount;
|
|
5897
|
+
} catch (err) {
|
|
5898
|
+
return DEFAULT_AVERAGE_PAY_RATE;
|
|
5643
5899
|
}
|
|
5644
5900
|
}
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5901
|
+
function calculateExpectedFee(depositAmountLamports, averagePayRate) {
|
|
5902
|
+
return averagePayRate.mul(new BN(4)).mul(depositAmountLamports).div(new BN(1e12));
|
|
5903
|
+
}
|
|
5904
|
+
function previewDepositEffects(params) {
|
|
5905
|
+
const { depositAmountLamports, averagePayRate } = params;
|
|
5906
|
+
const rent = new BN(
|
|
5907
|
+
params.rentExemptionLamports ?? EPHEMERAL_RENT_EXEMPTION
|
|
5908
|
+
);
|
|
5909
|
+
const fee = calculateExpectedFee(depositAmountLamports, averagePayRate);
|
|
5910
|
+
const userLiqSol = depositAmountLamports.sub(fee).add(rent);
|
|
5911
|
+
const bucketLiqSol = fee;
|
|
5912
|
+
const reserveIncrease = depositAmountLamports.add(rent);
|
|
5913
|
+
return {
|
|
5914
|
+
feeLamports: fee,
|
|
5915
|
+
userLiqSolLamports: userLiqSol,
|
|
5916
|
+
bucketLiqSolLamports: bucketLiqSol,
|
|
5917
|
+
reserveIncreaseLamports: reserveIncrease
|
|
5918
|
+
};
|
|
5919
|
+
}
|
|
5920
|
+
async function buildOutpostAccounts(connection, user) {
|
|
5921
|
+
const globalState = deriveOutpostGlobalStatePda();
|
|
5922
|
+
const poolAuthority = deriveOutpostPoolAuthorityPda();
|
|
5923
|
+
const liqsolMint = deriveLiqsolMintPda();
|
|
5924
|
+
const distributionState = deriveDistributionStatePda();
|
|
5925
|
+
const payRateHistory = derivePayRateHistoryPda();
|
|
5926
|
+
const bucketAuthority = deriveBucketAuthorityPda();
|
|
5927
|
+
const solBucket = deriveSolBucketPda();
|
|
5928
|
+
const trancheState = deriveTrancheStatePda();
|
|
5929
|
+
const wireReceipt = deriveWireReceiptPda(user);
|
|
5930
|
+
const poolUserRecord = derivePoolUserRecordPda(poolAuthority);
|
|
5931
|
+
const userUserRecord = deriveUserUserRecordPda(user);
|
|
5932
|
+
const userWarrantRecord = deriveUserWarrantRecordPda(user);
|
|
5933
|
+
const liqsolPoolAta = await getAssociatedTokenAddress(
|
|
5934
|
+
liqsolMint,
|
|
5935
|
+
poolAuthority,
|
|
5936
|
+
true,
|
|
5937
|
+
TOKEN_2022_PROGRAM_ID
|
|
5938
|
+
);
|
|
5939
|
+
const bucketTokenAccount = await getAssociatedTokenAddress(
|
|
5940
|
+
liqsolMint,
|
|
5941
|
+
bucketAuthority,
|
|
5942
|
+
true,
|
|
5943
|
+
TOKEN_2022_PROGRAM_ID
|
|
5944
|
+
);
|
|
5945
|
+
const userAta = await getAssociatedTokenAddress(
|
|
5946
|
+
liqsolMint,
|
|
5947
|
+
user,
|
|
5948
|
+
false,
|
|
5949
|
+
TOKEN_2022_PROGRAM_ID
|
|
5950
|
+
);
|
|
5951
|
+
const chainLinkFeed = CHAINLINK_FEED;
|
|
5952
|
+
const chainLinkProgram = CHAINLINK_PROGRAM;
|
|
5953
|
+
return {
|
|
5954
|
+
user,
|
|
5955
|
+
globalState,
|
|
5956
|
+
poolAuthority,
|
|
5957
|
+
liqsolMint,
|
|
5958
|
+
liqsolPoolAta,
|
|
5959
|
+
userAta,
|
|
5960
|
+
wireReceipt,
|
|
5961
|
+
poolUserRecord,
|
|
5962
|
+
userUserRecord,
|
|
5963
|
+
distributionState,
|
|
5964
|
+
payRateHistory,
|
|
5965
|
+
bucketAuthority,
|
|
5966
|
+
bucketTokenAccount,
|
|
5967
|
+
solBucket,
|
|
5968
|
+
trancheState,
|
|
5969
|
+
userWarrantRecord,
|
|
5970
|
+
chainLinkFeed,
|
|
5971
|
+
chainLinkProgram
|
|
5972
|
+
};
|
|
5973
|
+
}
|
|
5974
|
+
async function getEpochSnapshot(connection) {
|
|
5975
|
+
const info = await connection.getEpochInfo();
|
|
5976
|
+
let slotTimeMs = Number(process.env.SLOT_TIME_MS_FALLBACK ?? 400);
|
|
5977
|
+
try {
|
|
5978
|
+
const samples = await connection.getRecentPerformanceSamples(16);
|
|
5979
|
+
if (samples.length) {
|
|
5980
|
+
const avgMs = samples.reduce(
|
|
5981
|
+
(acc, s) => acc + s.samplePeriodSecs * 1e3 / s.numSlots,
|
|
5982
|
+
0
|
|
5983
|
+
) / samples.length;
|
|
5984
|
+
if (isFinite(avgMs) && avgMs > 0) {
|
|
5985
|
+
slotTimeMs = avgMs;
|
|
5986
|
+
}
|
|
5987
|
+
}
|
|
5988
|
+
} catch {
|
|
5989
|
+
}
|
|
5990
|
+
return {
|
|
5991
|
+
epoch: info.epoch,
|
|
5992
|
+
slot: info.slotIndex,
|
|
5993
|
+
firstSlot: info.absoluteSlot - info.slotIndex,
|
|
5994
|
+
slotsInEpoch: info.slotsInEpoch,
|
|
5995
|
+
slotMs: slotTimeMs
|
|
5996
|
+
};
|
|
5997
|
+
}
|
|
5998
|
+
function msToEpochEnd(snapshot) {
|
|
5999
|
+
const remainingSlots = snapshot.slotsInEpoch - snapshot.slot;
|
|
6000
|
+
return remainingSlots * snapshot.slotMs;
|
|
6001
|
+
}
|
|
6002
|
+
async function scheduledInstruction(connection, config, instruction) {
|
|
6003
|
+
const early = config.early ?? 0.1;
|
|
6004
|
+
const late = config.late ?? 0.9;
|
|
6005
|
+
const snapshot = await getEpochSnapshot(connection);
|
|
6006
|
+
const progress = snapshot.slot / snapshot.slotsInEpoch;
|
|
6007
|
+
if (progress >= early && progress <= late) {
|
|
6008
|
+
return instruction();
|
|
6009
|
+
}
|
|
6010
|
+
if (progress < early) {
|
|
6011
|
+
const targetSlot = snapshot.slotsInEpoch * early;
|
|
6012
|
+
const slotsRemaining = targetSlot - snapshot.slot;
|
|
6013
|
+
const msToWait = slotsRemaining * snapshot.slotMs;
|
|
6014
|
+
console.log(
|
|
6015
|
+
`Epoch early (${(progress * 100).toFixed(
|
|
6016
|
+
2
|
|
6017
|
+
)}%). Sleeping ${(msToWait / 1e3).toFixed(1)}s until ${early * 100}%...`
|
|
6018
|
+
);
|
|
6019
|
+
await sleep(Math.max(1e3, msToWait));
|
|
6020
|
+
return instruction();
|
|
6021
|
+
}
|
|
6022
|
+
const msToNextEpoch = msToEpochEnd(snapshot);
|
|
6023
|
+
const earlyWaitTime = snapshot.slotsInEpoch * early * snapshot.slotMs;
|
|
6024
|
+
const totalWaitTime = msToNextEpoch + earlyWaitTime + 1e3;
|
|
6025
|
+
console.log(
|
|
6026
|
+
`Epoch late (${(progress * 100).toFixed(
|
|
6027
|
+
2
|
|
6028
|
+
)}%). Sleeping ${(totalWaitTime / 1e3).toFixed(
|
|
6029
|
+
1
|
|
6030
|
+
)}s until next epoch + ${early * 100}%...`
|
|
6031
|
+
);
|
|
6032
|
+
await sleep(totalWaitTime);
|
|
6033
|
+
return instruction();
|
|
6034
|
+
}
|
|
6035
|
+
function getErrorMessage(error) {
|
|
6036
|
+
return error?.error?.errorCode?.code || error?.error?.errorMessage || error?.message || "";
|
|
6037
|
+
}
|
|
6038
|
+
function generateRandomDepositAmount(minSol = 2, maxSol = 100) {
|
|
6039
|
+
const randomSol = Math.random() * (maxSol - minSol) + minSol;
|
|
6040
|
+
return new BN(solToLamports(randomSol));
|
|
6041
|
+
}
|
|
6042
|
+
function generateTestKeypair() {
|
|
6043
|
+
return Keypair.generate();
|
|
6044
|
+
}
|
|
6045
|
+
async function airdropSol(connection, publicKey, amountSol) {
|
|
6046
|
+
const lamports = solToLamports(amountSol);
|
|
6047
|
+
const sig = await connection.requestAirdrop(publicKey, Number(lamports));
|
|
6048
|
+
await connection.confirmTransaction(sig, "confirmed");
|
|
6049
|
+
}
|
|
6050
|
+
async function waitForConfirmation(connection, signature) {
|
|
6051
|
+
await connection.confirmTransaction(signature, "confirmed");
|
|
6052
|
+
}
|
|
6053
|
+
function sleep(ms) {
|
|
6054
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
6055
|
+
}
|
|
6056
|
+
async function waitUntilSafeToExecuteFunction(connection, config = {}) {
|
|
6057
|
+
await scheduledInstruction(connection, config, async () => {
|
|
6058
|
+
return;
|
|
6059
|
+
});
|
|
6060
|
+
}
|
|
6061
|
+
|
|
6062
|
+
const _OutpostClient = class _OutpostClient {
|
|
6063
|
+
constructor(provider) {
|
|
6064
|
+
this.provider = provider;
|
|
6065
|
+
const svc = new SolanaProgramService(provider);
|
|
6066
|
+
this.program = svc.getProgram("liqsolCore");
|
|
6067
|
+
}
|
|
6068
|
+
get connection() {
|
|
6069
|
+
return this.provider.connection;
|
|
6070
|
+
}
|
|
6071
|
+
get wallet() {
|
|
6072
|
+
return this.provider.wallet;
|
|
6073
|
+
}
|
|
6074
|
+
getReadOnlyProgram() {
|
|
6075
|
+
return getLiqsolCoreProgram(this.connection);
|
|
6076
|
+
}
|
|
6077
|
+
static tokensToShares(amount, currentIndex) {
|
|
6078
|
+
const numerator = amount.mul(_OutpostClient.INDEX_SCALE);
|
|
6079
|
+
const shares = numerator.div(currentIndex);
|
|
6080
|
+
const remainder = numerator.mod(currentIndex);
|
|
6081
|
+
return remainder.eqn(0) ? shares : shares.addn(1);
|
|
6082
|
+
}
|
|
6083
|
+
static formatScale8(value) {
|
|
6084
|
+
const decimals = 8;
|
|
6085
|
+
const valueStr = value.toString();
|
|
6086
|
+
if (valueStr.length <= decimals) {
|
|
6087
|
+
const padding = "0".repeat(decimals - valueStr.length);
|
|
6088
|
+
return `0.${padding}${valueStr}`;
|
|
6089
|
+
}
|
|
6090
|
+
const intPart = valueStr.slice(0, valueStr.length - decimals);
|
|
6091
|
+
const decPart = valueStr.slice(valueStr.length - decimals);
|
|
6092
|
+
return `${intPart}.${decPart}`;
|
|
6093
|
+
}
|
|
6094
|
+
async previewExpectedShares(params) {
|
|
6095
|
+
const user = params.user ?? this.wallet.publicKey;
|
|
6096
|
+
const accounts = await buildOutpostAccounts(this.connection, user);
|
|
6097
|
+
const globalState = await this.program.account.globalState.fetch(accounts.globalState);
|
|
6098
|
+
const currentIndex = new BN(globalState.currentIndex.toString());
|
|
6099
|
+
const expectedShares = _OutpostClient.tokensToShares(
|
|
6100
|
+
params.amountLamports,
|
|
6101
|
+
currentIndex
|
|
6102
|
+
);
|
|
6103
|
+
return {
|
|
6104
|
+
amountLamports: params.amountLamports,
|
|
6105
|
+
currentIndex,
|
|
6106
|
+
indexScale: _OutpostClient.INDEX_SCALE,
|
|
6107
|
+
expectedShares
|
|
6108
|
+
};
|
|
6109
|
+
}
|
|
6110
|
+
async doesUserAtaExist(user = this.wallet.publicKey) {
|
|
6111
|
+
const accounts = await buildOutpostAccounts(this.connection, user);
|
|
6112
|
+
const info = await this.connection.getAccountInfo(accounts.userAta);
|
|
6113
|
+
return !!info;
|
|
6114
|
+
}
|
|
6115
|
+
async buildCreateUserAtaIx(user = this.wallet.publicKey) {
|
|
6116
|
+
const accounts = await buildOutpostAccounts(this.connection, user);
|
|
6117
|
+
return createAssociatedTokenAccountInstruction(
|
|
6118
|
+
this.wallet.publicKey,
|
|
6119
|
+
accounts.userAta,
|
|
6120
|
+
user,
|
|
6121
|
+
accounts.liqsolMint,
|
|
6122
|
+
TOKEN_2022_PROGRAM_ID,
|
|
6123
|
+
ASSOCIATED_TOKEN_PROGRAM_ID
|
|
6124
|
+
);
|
|
6125
|
+
}
|
|
6126
|
+
async maybeBuildCreateUserAtaIx(user = this.wallet.publicKey) {
|
|
6127
|
+
const accounts = await buildOutpostAccounts(this.connection, user);
|
|
6128
|
+
const info = await this.connection.getAccountInfo(accounts.userAta);
|
|
6129
|
+
if (info) return [];
|
|
6130
|
+
return [await this.buildCreateUserAtaIx(user)];
|
|
6131
|
+
}
|
|
6132
|
+
async getWireStateSnapshot(user = this.wallet.publicKey) {
|
|
6133
|
+
const accounts = await buildOutpostAccounts(this.connection, user);
|
|
6134
|
+
const [
|
|
6135
|
+
globalState,
|
|
6136
|
+
wireReceipt,
|
|
6137
|
+
distributionState,
|
|
6138
|
+
userWarrantRecord,
|
|
6139
|
+
trancheState
|
|
6140
|
+
] = await Promise.all([
|
|
6141
|
+
this.program.account.globalState.fetch(accounts.globalState),
|
|
6142
|
+
this.program.account.wireReceipt.fetchNullable(accounts.wireReceipt),
|
|
6143
|
+
this.program.account.distributionState.fetch(accounts.distributionState),
|
|
6144
|
+
this.program.account.userWarrantRecord.fetchNullable(accounts.userWarrantRecord),
|
|
6145
|
+
this.program.account.trancheState.fetchNullable(accounts.trancheState)
|
|
6146
|
+
]);
|
|
6147
|
+
const [
|
|
6148
|
+
liqsolPoolBalance,
|
|
6149
|
+
solBucketLamports,
|
|
6150
|
+
userLiqsolBalance
|
|
6151
|
+
] = await Promise.all([
|
|
6152
|
+
this.getTokenBalanceSafe(accounts.liqsolPoolAta),
|
|
6153
|
+
this.connection.getBalance(accounts.solBucket),
|
|
6154
|
+
this.getTokenBalanceSafe(accounts.userAta)
|
|
6155
|
+
]);
|
|
6156
|
+
return {
|
|
6157
|
+
globalState,
|
|
6158
|
+
distributionState,
|
|
6159
|
+
wireReceipt,
|
|
6160
|
+
trancheState,
|
|
6161
|
+
userWarrantRecord,
|
|
6162
|
+
liqsolPoolBalance,
|
|
6163
|
+
solBucketLamports,
|
|
6164
|
+
userLiqsolBalance
|
|
6165
|
+
};
|
|
6166
|
+
}
|
|
6167
|
+
async getWireReceipt(user = this.wallet.publicKey) {
|
|
6168
|
+
const accounts = await buildOutpostAccounts(this.connection, user);
|
|
6169
|
+
return this.program.account.wireReceipt.fetchNullable(accounts.wireReceipt);
|
|
6170
|
+
}
|
|
6171
|
+
async getTrancheState() {
|
|
6172
|
+
const accounts = await buildOutpostAccounts(this.connection, this.wallet.publicKey);
|
|
6173
|
+
return this.program.account.trancheState.fetchNullable(accounts.trancheState);
|
|
6174
|
+
}
|
|
6175
|
+
async getUserWarrantRecord(user = this.wallet.publicKey) {
|
|
6176
|
+
const accounts = await buildOutpostAccounts(this.connection, user);
|
|
6177
|
+
return this.program.account.userWarrantRecord.fetchNullable(accounts.userWarrantRecord);
|
|
6178
|
+
}
|
|
6179
|
+
async buildStakeLiqsolIx(amountLamports, userPubKey = this.wallet.publicKey) {
|
|
6180
|
+
const a = await buildOutpostAccounts(this.connection, userPubKey);
|
|
6181
|
+
const amount = new BN(amountLamports.toString());
|
|
6182
|
+
return this.program.methods.stakeLiqsol(amount).accounts({
|
|
6183
|
+
user: a.user,
|
|
6184
|
+
liqsolMint: a.liqsolMint,
|
|
6185
|
+
globalState: a.globalState,
|
|
6186
|
+
userAta: a.userAta,
|
|
6187
|
+
poolAuthority: a.poolAuthority,
|
|
6188
|
+
liqsolPoolAta: a.liqsolPoolAta,
|
|
6189
|
+
warrantDepositRecord: a.wireReceipt,
|
|
6190
|
+
liqsolPoolUserRecord: a.poolUserRecord,
|
|
6191
|
+
distributionState: a.distributionState,
|
|
6192
|
+
payRateHistory: a.payRateHistory,
|
|
6193
|
+
bucketAuthority: a.bucketAuthority,
|
|
6194
|
+
bucketTokenAccount: a.bucketTokenAccount,
|
|
6195
|
+
solBucket: a.solBucket,
|
|
6196
|
+
tokenProgram: TOKEN_2022_PROGRAM_ID,
|
|
6197
|
+
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
6198
|
+
systemProgram: SystemProgram.programId
|
|
6199
|
+
}).instruction();
|
|
6200
|
+
}
|
|
6201
|
+
async buildWithdrawStakeIx(amountLamports, userPubKey = this.wallet.publicKey) {
|
|
6202
|
+
const a = await buildOutpostAccounts(this.connection, userPubKey);
|
|
6203
|
+
const amount = new BN(amountLamports.toString());
|
|
6204
|
+
return this.program.methods.withdrawStake(amount).accounts({
|
|
6205
|
+
user: a.user,
|
|
6206
|
+
liqsolMint: a.liqsolMint,
|
|
6207
|
+
globalState: a.globalState,
|
|
6208
|
+
userAta: a.userAta,
|
|
6209
|
+
poolAuthority: a.poolAuthority,
|
|
6210
|
+
liqsolPoolAta: a.liqsolPoolAta,
|
|
6211
|
+
warrantDepositRecord: a.wireReceipt,
|
|
6212
|
+
liqsolPoolUserRecord: a.poolUserRecord,
|
|
6213
|
+
distributionState: a.distributionState,
|
|
6214
|
+
payRateHistory: a.payRateHistory,
|
|
6215
|
+
bucketAuthority: a.bucketAuthority,
|
|
6216
|
+
bucketTokenAccount: a.bucketTokenAccount,
|
|
6217
|
+
solBucket: a.solBucket,
|
|
6218
|
+
tokenProgram: TOKEN_2022_PROGRAM_ID,
|
|
6219
|
+
systemProgram: SystemProgram.programId
|
|
6220
|
+
}).instruction();
|
|
6221
|
+
}
|
|
6222
|
+
async buildPurchaseWithLiqsolIx(amountLamports, userPubKey = this.wallet.publicKey) {
|
|
6223
|
+
const a = await buildOutpostAccounts(this.connection, userPubKey);
|
|
6224
|
+
const amount = new BN(amountLamports.toString());
|
|
6225
|
+
return this.program.methods.purchaseWithLiqsol(amount).accounts({
|
|
6226
|
+
user: a.user,
|
|
6227
|
+
liqsolMint: a.liqsolMint,
|
|
6228
|
+
globalState: a.globalState,
|
|
6229
|
+
buyerAta: a.userAta,
|
|
6230
|
+
poolAuthority: a.poolAuthority,
|
|
6231
|
+
liqsolPoolAta: a.liqsolPoolAta,
|
|
6232
|
+
warrantDepositRecord: a.wireReceipt,
|
|
6233
|
+
liqsolPoolUserRecord: a.poolUserRecord,
|
|
6234
|
+
distributionState: a.distributionState,
|
|
6235
|
+
payRateHistory: a.payRateHistory,
|
|
6236
|
+
bucketAuthority: a.bucketAuthority,
|
|
6237
|
+
bucketTokenAccount: a.bucketTokenAccount,
|
|
6238
|
+
solBucket: a.solBucket,
|
|
6239
|
+
trancheState: a.trancheState,
|
|
6240
|
+
userWarrantRecord: a.userWarrantRecord,
|
|
6241
|
+
chainlinkFeed: a.chainLinkFeed,
|
|
6242
|
+
chainlinkProgram: a.chainLinkProgram,
|
|
6243
|
+
tokenProgram: TOKEN_2022_PROGRAM_ID,
|
|
6244
|
+
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
6245
|
+
systemProgram: SystemProgram.programId
|
|
6246
|
+
}).instruction();
|
|
6247
|
+
}
|
|
6248
|
+
async buildPurchaseWithSolIx(amountLamports, userPubKey = this.wallet.publicKey) {
|
|
6249
|
+
const a = await buildOutpostAccounts(this.connection, userPubKey);
|
|
6250
|
+
const amount = new BN(amountLamports.toString());
|
|
6251
|
+
return this.program.methods.purchaseWithSol(amount).accounts({
|
|
6252
|
+
user: a.user,
|
|
6253
|
+
liqsolMint: a.liqsolMint,
|
|
6254
|
+
globalState: a.globalState,
|
|
6255
|
+
poolAuthority: a.poolAuthority,
|
|
6256
|
+
liqsolPoolAta: a.liqsolPoolAta,
|
|
6257
|
+
liqsolPoolUserRecord: a.poolUserRecord,
|
|
6258
|
+
distributionState: a.distributionState,
|
|
6259
|
+
payRateHistory: a.payRateHistory,
|
|
6260
|
+
bucketAuthority: a.bucketAuthority,
|
|
6261
|
+
bucketTokenAccount: a.bucketTokenAccount,
|
|
6262
|
+
solBucket: a.solBucket,
|
|
6263
|
+
warrantDepositRecord: a.wireReceipt,
|
|
6264
|
+
trancheState: a.trancheState,
|
|
6265
|
+
userWarrantRecord: a.userWarrantRecord,
|
|
6266
|
+
chainlinkFeed: a.chainLinkFeed,
|
|
6267
|
+
chainlinkProgram: a.chainLinkProgram,
|
|
6268
|
+
tokenProgram: TOKEN_2022_PROGRAM_ID,
|
|
6269
|
+
systemProgram: SystemProgram.programId
|
|
6270
|
+
}).instruction();
|
|
6271
|
+
}
|
|
6272
|
+
async buildPurchaseFromYieldIx(userPubKey = this.wallet.publicKey) {
|
|
6273
|
+
const a = await buildOutpostAccounts(this.connection, userPubKey);
|
|
6274
|
+
return this.program.methods.purchaseWarrantsFromYield().accounts({
|
|
6275
|
+
user: a.user,
|
|
6276
|
+
globalState: a.globalState,
|
|
6277
|
+
liqsolMint: a.liqsolMint,
|
|
6278
|
+
poolAuthority: a.poolAuthority,
|
|
6279
|
+
liqsolPoolAta: a.liqsolPoolAta,
|
|
6280
|
+
solBucket: a.solBucket,
|
|
6281
|
+
liqsolPoolUserRecord: a.userUserRecord,
|
|
6282
|
+
distributionState: a.distributionState,
|
|
6283
|
+
payRateHistory: a.payRateHistory,
|
|
6284
|
+
bucketAuthority: a.bucketAuthority,
|
|
6285
|
+
bucketTokenAccount: a.bucketTokenAccount,
|
|
6286
|
+
tokenProgram: TOKEN_2022_PROGRAM_ID,
|
|
6287
|
+
systemProgram: SystemProgram.programId,
|
|
6288
|
+
trancheState: a.trancheState,
|
|
6289
|
+
userWarrantRecord: a.userWarrantRecord,
|
|
6290
|
+
chainlinkFeed: a.chainLinkFeed,
|
|
6291
|
+
chainlinkProgram: a.chainLinkProgram
|
|
6292
|
+
}).instruction();
|
|
6293
|
+
}
|
|
6294
|
+
async sendIx(ix, opts) {
|
|
6295
|
+
const tx = new Transaction();
|
|
6296
|
+
if (opts?.additionalIxs?.length) {
|
|
6297
|
+
tx.add(...opts.additionalIxs);
|
|
6298
|
+
}
|
|
6299
|
+
tx.add(ix);
|
|
6300
|
+
try {
|
|
6301
|
+
const sig = await this.provider.sendAndConfirm(tx, [], { commitment: "confirmed" });
|
|
6302
|
+
return sig;
|
|
6303
|
+
} catch (e) {
|
|
6304
|
+
const msg = getErrorMessage(e);
|
|
6305
|
+
throw new Error(`OutpostClient sendIx failed: ${msg}`);
|
|
6306
|
+
}
|
|
6307
|
+
}
|
|
6308
|
+
async stakeLiqsol(params) {
|
|
6309
|
+
const user = params.user ?? this.wallet.publicKey;
|
|
6310
|
+
const pre = [];
|
|
6311
|
+
if (params.ensureAta ?? true) {
|
|
6312
|
+
pre.push(...await this.maybeBuildCreateUserAtaIx(user));
|
|
6313
|
+
}
|
|
6314
|
+
const ix = await this.buildStakeLiqsolIx(params.amount, user);
|
|
6315
|
+
return this.sendIx(ix, { additionalIxs: pre });
|
|
6316
|
+
}
|
|
6317
|
+
async withdrawStake(params) {
|
|
6318
|
+
const user = params.user ?? this.wallet.publicKey;
|
|
6319
|
+
const pre = [];
|
|
6320
|
+
if (params.ensureAta ?? true) {
|
|
6321
|
+
pre.push(...await this.maybeBuildCreateUserAtaIx(user));
|
|
6322
|
+
}
|
|
6323
|
+
const ix = await this.buildWithdrawStakeIx(params.amount, user);
|
|
6324
|
+
return this.sendIx(ix, { additionalIxs: pre });
|
|
6325
|
+
}
|
|
6326
|
+
async purchaseWithLiqsol(params) {
|
|
6327
|
+
const user = params.user ?? this.wallet.publicKey;
|
|
6328
|
+
const pre = [];
|
|
6329
|
+
if (params.ensureAta ?? true) {
|
|
6330
|
+
pre.push(...await this.maybeBuildCreateUserAtaIx(user));
|
|
6331
|
+
}
|
|
6332
|
+
const ix = await this.buildPurchaseWithLiqsolIx(params.amount, user);
|
|
6333
|
+
return this.sendIx(ix, { additionalIxs: pre });
|
|
6334
|
+
}
|
|
6335
|
+
async purchaseWithSol(params) {
|
|
6336
|
+
const user = params.user ?? this.wallet.publicKey;
|
|
6337
|
+
const ix = await this.buildPurchaseWithSolIx(params.amount, user);
|
|
6338
|
+
return this.sendIx(ix);
|
|
6339
|
+
}
|
|
6340
|
+
async purchaseFromYield(params) {
|
|
6341
|
+
const user = params?.user ?? this.wallet.publicKey;
|
|
6342
|
+
const ix = await this.buildPurchaseFromYieldIx(user);
|
|
6343
|
+
return this.sendIx(ix);
|
|
6344
|
+
}
|
|
6345
|
+
async getTokenBalanceSafe(ata) {
|
|
6346
|
+
try {
|
|
6347
|
+
const bal = await this.connection.getTokenAccountBalance(ata);
|
|
6348
|
+
return new BN(bal.value.amount);
|
|
6349
|
+
} catch {
|
|
6350
|
+
return new BN(0);
|
|
6351
|
+
}
|
|
6352
|
+
}
|
|
6353
|
+
};
|
|
6354
|
+
_OutpostClient.INDEX_SCALE = new BN("1000000000000");
|
|
6355
|
+
let OutpostClient = _OutpostClient;
|
|
6356
|
+
|
|
6357
|
+
const commitment = "confirmed";
|
|
6358
|
+
class SolanaStakingClient {
|
|
6359
|
+
constructor(config) {
|
|
6360
|
+
this.config = config;
|
|
6361
|
+
const adapter = config.provider;
|
|
6362
|
+
if (!adapter?.publicKey) throw new Error("Solana wallet adapter not connected");
|
|
6363
|
+
if (!config.network.rpcUrls.length) throw new Error("No RPC URLs provided");
|
|
6364
|
+
const publicKey = adapter.publicKey;
|
|
6365
|
+
const wirePub = new PublicKey$1(KeyType.ED, publicKey.toBytes());
|
|
6366
|
+
if (!wirePub.equals(config.pubKey)) {
|
|
6367
|
+
throw new Error("Passed-in pubKey doesn't match adapter.publicKey");
|
|
6368
|
+
}
|
|
6369
|
+
const opts = { commitment };
|
|
6370
|
+
if (config.network.rpcUrls.length > 1 && config.network.rpcUrls[1].startsWith("ws")) {
|
|
6371
|
+
opts.wsEndpoint = config.network.rpcUrls[1];
|
|
6372
|
+
}
|
|
6373
|
+
const anchorWallet = {
|
|
6374
|
+
publicKey,
|
|
6375
|
+
async signTransaction(tx) {
|
|
6376
|
+
return adapter.signTransaction(tx);
|
|
6377
|
+
},
|
|
6378
|
+
async signAllTransactions(txs) {
|
|
6379
|
+
return Promise.all(txs.map((tx) => adapter.signTransaction(tx)));
|
|
6380
|
+
}
|
|
6381
|
+
};
|
|
6382
|
+
this.pubKey = wirePub;
|
|
6383
|
+
this.connection = new Connection(config.network.rpcUrls[0], opts);
|
|
6384
|
+
this.anchor = new AnchorProvider(this.connection, anchorWallet, { commitment });
|
|
6385
|
+
this.depositClient = new DepositClient(this.anchor);
|
|
6386
|
+
this.distributionClient = new DistributionClient(this.anchor);
|
|
6387
|
+
this.leaderboardClient = new LeaderboardClient(this.anchor);
|
|
6388
|
+
this.outpostClient = new OutpostClient(this.anchor);
|
|
6389
|
+
}
|
|
6390
|
+
get solPubKey() {
|
|
6391
|
+
return new PublicKey(this.pubKey.data.array);
|
|
6392
|
+
}
|
|
6393
|
+
get network() {
|
|
6394
|
+
return this.config.network;
|
|
6395
|
+
}
|
|
6396
|
+
async deposit(amountLamports) {
|
|
6397
|
+
if (amountLamports <= BigInt(0)) throw new Error("Deposit amount must be greater than zero.");
|
|
6398
|
+
const tx = await this.depositClient.buildDepositTx(amountLamports);
|
|
6399
|
+
const { tx: prepared, blockhash, lastValidBlockHeight } = await this.prepareTx(tx);
|
|
6400
|
+
const signed = await this.signTransaction(prepared);
|
|
6401
|
+
const result = await this.sendAndConfirmHttp(signed, { blockhash, lastValidBlockHeight });
|
|
6402
|
+
return result.signature;
|
|
6403
|
+
}
|
|
6404
|
+
async withdraw(amountLamports) {
|
|
6405
|
+
throw new Error("Withdraw method not yet implemented.");
|
|
6406
|
+
}
|
|
6407
|
+
async stake(amountLamports) {
|
|
6408
|
+
if (amountLamports <= BigInt(0)) throw new Error("Stake amount must be greater than zero.");
|
|
6409
|
+
const preIxs = await this.outpostClient.maybeBuildCreateUserAtaIx(this.solPubKey);
|
|
6410
|
+
const stakeIx = await this.outpostClient.buildStakeLiqsolIx(amountLamports);
|
|
6411
|
+
const tx = new Transaction().add(...preIxs, stakeIx);
|
|
6412
|
+
const prepared = await this.prepareTx(tx);
|
|
6413
|
+
const signed = await this.signTransaction(prepared.tx);
|
|
6414
|
+
const result = await this.sendAndConfirmHttp(signed, prepared);
|
|
6415
|
+
return result.signature;
|
|
6416
|
+
}
|
|
6417
|
+
async unstake(amountLamports) {
|
|
6418
|
+
if (amountLamports <= BigInt(0)) throw new Error("Unstake amount must be greater than zero.");
|
|
6419
|
+
const user = this.solPubKey;
|
|
6420
|
+
const preIxs = await this.outpostClient.maybeBuildCreateUserAtaIx(user);
|
|
6421
|
+
const withdrawIx = await this.outpostClient.buildWithdrawStakeIx(amountLamports);
|
|
6422
|
+
const tx = new Transaction().add(...preIxs, withdrawIx);
|
|
6423
|
+
const prepared = await this.prepareTx(tx);
|
|
6424
|
+
const signed = await this.signTransaction(prepared.tx);
|
|
6425
|
+
const result = await this.sendAndConfirmHttp(signed, prepared);
|
|
6426
|
+
return result.signature;
|
|
6427
|
+
}
|
|
6428
|
+
async getPortfolio() {
|
|
6429
|
+
const user = this.solPubKey;
|
|
6430
|
+
const reservePoolPDA = deriveReservePoolPda();
|
|
6431
|
+
const vaultPDA = deriveVaultPda();
|
|
6432
|
+
const liqsolMint = deriveLiqsolMintPda();
|
|
6433
|
+
const userLiqsolAta = getAssociatedTokenAddressSync(
|
|
6434
|
+
liqsolMint,
|
|
6435
|
+
user,
|
|
6436
|
+
false,
|
|
6437
|
+
TOKEN_2022_PROGRAM_ID,
|
|
6438
|
+
ASSOCIATED_TOKEN_PROGRAM_ID
|
|
6439
|
+
);
|
|
6440
|
+
const [nativeLamports, actualBalResp, userRecord, snapshot] = await Promise.all([
|
|
6441
|
+
this.connection.getBalance(user, "confirmed"),
|
|
6442
|
+
this.connection.getTokenAccountBalance(userLiqsolAta, "confirmed").catch(() => null),
|
|
6443
|
+
this.distributionClient.getUserRecord(user).catch(() => null),
|
|
6444
|
+
this.outpostClient.getWireStateSnapshot(user).catch(() => null)
|
|
6445
|
+
]);
|
|
6446
|
+
const LIQSOL_DECIMALS = 9;
|
|
6447
|
+
const actualAmountStr = actualBalResp?.value?.amount ?? "0";
|
|
6448
|
+
const trackedAmountStr = userRecord?.trackedBalance ? userRecord.trackedBalance.toString() : "0";
|
|
6449
|
+
const wireReceipt = snapshot?.wireReceipt ?? null;
|
|
6450
|
+
const stakedAmountStr = wireReceipt?.stakedLiqsol ? wireReceipt.stakedLiqsol.toString() : "0";
|
|
6451
|
+
return {
|
|
6452
|
+
native: {
|
|
6453
|
+
amount: BigInt(nativeLamports),
|
|
6454
|
+
symbol: "SOL",
|
|
6455
|
+
decimals: 9
|
|
6456
|
+
},
|
|
6457
|
+
liq: {
|
|
6458
|
+
amount: BigInt(actualAmountStr),
|
|
6459
|
+
symbol: "LiqSOL",
|
|
6460
|
+
decimals: LIQSOL_DECIMALS,
|
|
6461
|
+
ata: userLiqsolAta
|
|
6462
|
+
},
|
|
6463
|
+
staked: {
|
|
6464
|
+
amount: BigInt(stakedAmountStr),
|
|
6465
|
+
symbol: "LiqSOL",
|
|
6466
|
+
decimals: LIQSOL_DECIMALS
|
|
6467
|
+
},
|
|
6468
|
+
tracked: {
|
|
6469
|
+
amount: BigInt(trackedAmountStr),
|
|
6470
|
+
symbol: "LiqSOL",
|
|
6471
|
+
decimals: LIQSOL_DECIMALS
|
|
6472
|
+
},
|
|
6473
|
+
extras: {
|
|
6474
|
+
userLiqsolAta: userLiqsolAta.toBase58(),
|
|
6475
|
+
reservePoolPDA: reservePoolPDA.toBase58(),
|
|
6476
|
+
vaultPDA: vaultPDA.toBase58(),
|
|
6477
|
+
wireReceipt
|
|
6478
|
+
},
|
|
6479
|
+
chainID: this.network.chainId
|
|
6480
|
+
};
|
|
6481
|
+
}
|
|
6482
|
+
async getUserRecord() {
|
|
6483
|
+
return this.distributionClient.getUserRecord(this.solPubKey);
|
|
6484
|
+
}
|
|
6485
|
+
getProtocolFee() {
|
|
6486
|
+
}
|
|
6487
|
+
async correctBalance(amount) {
|
|
6488
|
+
const build = await this.distributionClient.buildCorrectRegisterTx({ amount });
|
|
6489
|
+
if (!build.canSucceed || !build.transaction) {
|
|
6490
|
+
throw new Error(build.reason ?? "Unable to build Correct&Register transaction");
|
|
6491
|
+
}
|
|
6492
|
+
const { tx, blockhash, lastValidBlockHeight } = await this.prepareTx(build.transaction);
|
|
6493
|
+
const signed = await this.signTransaction(tx);
|
|
6494
|
+
const result = await this.sendAndConfirmHttp(signed, { blockhash, lastValidBlockHeight });
|
|
6495
|
+
return result.signature;
|
|
6496
|
+
}
|
|
6497
|
+
async sendAndConfirmHttp(signed, ctx) {
|
|
6498
|
+
const signature = await this.connection.sendRawTransaction(signed.serialize(), {
|
|
6499
|
+
skipPreflight: false,
|
|
6500
|
+
preflightCommitment: commitment,
|
|
6501
|
+
maxRetries: 3
|
|
6502
|
+
});
|
|
6503
|
+
const conf = await this.connection.confirmTransaction(
|
|
6504
|
+
{ signature, blockhash: ctx.blockhash, lastValidBlockHeight: ctx.lastValidBlockHeight },
|
|
6505
|
+
commitment
|
|
6506
|
+
);
|
|
6507
|
+
if (conf.value.err) {
|
|
6508
|
+
throw new Error(`Transaction failed: ${JSON.stringify(conf.value.err)}`);
|
|
6509
|
+
}
|
|
6510
|
+
return { signature, slot: conf.context.slot, confirmed: true };
|
|
6511
|
+
}
|
|
6512
|
+
async signTransaction(tx) {
|
|
6513
|
+
return this.anchor.wallet.signTransaction(tx);
|
|
6514
|
+
}
|
|
6515
|
+
async sendTransaction(signed) {
|
|
6516
|
+
return this.anchor.sendAndConfirm(signed);
|
|
6517
|
+
}
|
|
6518
|
+
async prepareTx(tx) {
|
|
6519
|
+
const { blockhash, lastValidBlockHeight } = await this.connection.getLatestBlockhash("confirmed");
|
|
6520
|
+
tx.recentBlockhash = blockhash;
|
|
6521
|
+
tx.feePayer = this.solPubKey;
|
|
6522
|
+
return { tx, blockhash, lastValidBlockHeight };
|
|
6523
|
+
}
|
|
6524
|
+
}
|
|
6525
|
+
|
|
6526
|
+
var _format$a = "hh-sol-artifact-1";
|
|
6527
|
+
var contractName$a = "Accounting";
|
|
6528
|
+
var sourceName$a = "contracts/liqEth/accounting.sol";
|
|
6529
|
+
var abi$a = [
|
|
6530
|
+
{
|
|
6531
|
+
inputs: [
|
|
6532
|
+
{
|
|
6533
|
+
internalType: "address",
|
|
6534
|
+
name: "_token",
|
|
6535
|
+
type: "address"
|
|
6536
|
+
},
|
|
6537
|
+
{
|
|
6538
|
+
internalType: "address",
|
|
6539
|
+
name: "_burner",
|
|
6540
|
+
type: "address"
|
|
6541
|
+
},
|
|
6542
|
+
{
|
|
6543
|
+
internalType: "address",
|
|
6544
|
+
name: "_treasury",
|
|
6545
|
+
type: "address"
|
|
6546
|
+
},
|
|
6547
|
+
{
|
|
6548
|
+
internalType: "address",
|
|
6549
|
+
name: "admin",
|
|
6550
|
+
type: "address"
|
|
6551
|
+
}
|
|
6552
|
+
],
|
|
6553
|
+
stateMutability: "nonpayable",
|
|
6554
|
+
type: "constructor"
|
|
6555
|
+
},
|
|
6556
|
+
{
|
|
6557
|
+
inputs: [
|
|
6558
|
+
],
|
|
6559
|
+
name: "AccessControlBadConfirmation",
|
|
6560
|
+
type: "error"
|
|
6561
|
+
},
|
|
6562
|
+
{
|
|
6563
|
+
inputs: [
|
|
6564
|
+
{
|
|
6565
|
+
internalType: "address",
|
|
6566
|
+
name: "account",
|
|
6567
|
+
type: "address"
|
|
6568
|
+
},
|
|
6569
|
+
{
|
|
6570
|
+
internalType: "bytes32",
|
|
6571
|
+
name: "neededRole",
|
|
5692
6572
|
type: "bytes32"
|
|
5693
6573
|
}
|
|
5694
6574
|
],
|
|
@@ -13700,6 +14580,48 @@ class EthereumStakingClient {
|
|
|
13700
14580
|
const result = await this.performDeposit(amountWei);
|
|
13701
14581
|
return result.txHash;
|
|
13702
14582
|
}
|
|
14583
|
+
async withdraw() {
|
|
14584
|
+
throw new Error("Method not yet implemented.");
|
|
14585
|
+
}
|
|
14586
|
+
async stake() {
|
|
14587
|
+
throw new Error("Method not yet implemented.");
|
|
14588
|
+
}
|
|
14589
|
+
async unstake() {
|
|
14590
|
+
throw new Error("Method not yet implemented.");
|
|
14591
|
+
}
|
|
14592
|
+
async getPortfolio() {
|
|
14593
|
+
const walletAddress = await this.signer.getAddress();
|
|
14594
|
+
const nativeBalance = await this.provider.getBalance(walletAddress);
|
|
14595
|
+
const nativeDecimals = this.network?.nativeCurrency?.decimals ?? 18;
|
|
14596
|
+
const nativeSymbol = this.network?.nativeCurrency?.symbol ?? "ETH";
|
|
14597
|
+
const liqBalance = await this.contract.LiqEth.balanceOf(walletAddress);
|
|
14598
|
+
const liqDecimals = this.network?.nativeCurrency?.decimals ?? 18;
|
|
14599
|
+
const liqSymbol = "Liq" + (this.network?.nativeCurrency?.symbol ?? "ETH");
|
|
14600
|
+
const portfolio = {
|
|
14601
|
+
native: {
|
|
14602
|
+
amount: nativeBalance.toBigInt(),
|
|
14603
|
+
decimals: nativeDecimals,
|
|
14604
|
+
symbol: nativeSymbol
|
|
14605
|
+
},
|
|
14606
|
+
liq: {
|
|
14607
|
+
amount: liqBalance.toBigInt(),
|
|
14608
|
+
decimals: liqDecimals,
|
|
14609
|
+
symbol: liqSymbol
|
|
14610
|
+
},
|
|
14611
|
+
tracked: {
|
|
14612
|
+
amount: liqBalance.toBigInt(),
|
|
14613
|
+
decimals: liqDecimals,
|
|
14614
|
+
symbol: liqSymbol
|
|
14615
|
+
},
|
|
14616
|
+
staked: {
|
|
14617
|
+
amount: BigNumber.from(0).toBigInt(),
|
|
14618
|
+
decimals: liqDecimals,
|
|
14619
|
+
symbol: liqSymbol
|
|
14620
|
+
},
|
|
14621
|
+
chainID: this.network.chainId
|
|
14622
|
+
};
|
|
14623
|
+
return portfolio;
|
|
14624
|
+
}
|
|
13703
14625
|
async simulateDeposit(amount) {
|
|
13704
14626
|
const amountWei = BigNumber.isBigNumber(amount) ? amount : BigNumber.from(amount);
|
|
13705
14627
|
await this.contract.DepositManager.callStatic.deposit({
|
|
@@ -13734,34 +14656,6 @@ class EthereumStakingClient {
|
|
|
13734
14656
|
deposited
|
|
13735
14657
|
};
|
|
13736
14658
|
}
|
|
13737
|
-
async getPortfolio() {
|
|
13738
|
-
const walletAddress = await this.signer.getAddress();
|
|
13739
|
-
const nativeBalance = await this.provider.getBalance(walletAddress);
|
|
13740
|
-
const nativeDecimals = this.network?.nativeCurrency?.decimals ?? 18;
|
|
13741
|
-
const nativeSymbol = this.network?.nativeCurrency?.symbol ?? "ETH";
|
|
13742
|
-
const liqBalance = await this.contract.LiqEth.balanceOf(walletAddress);
|
|
13743
|
-
const liqDecimals = this.network?.nativeCurrency?.decimals ?? 18;
|
|
13744
|
-
const liqSymbol = "Liq" + (this.network?.nativeCurrency?.symbol ?? "ETH");
|
|
13745
|
-
const portfolio = {
|
|
13746
|
-
native: {
|
|
13747
|
-
amount: nativeBalance,
|
|
13748
|
-
decimals: nativeDecimals,
|
|
13749
|
-
symbol: nativeSymbol
|
|
13750
|
-
},
|
|
13751
|
-
liq: {
|
|
13752
|
-
amount: liqBalance,
|
|
13753
|
-
decimals: liqDecimals,
|
|
13754
|
-
symbol: liqSymbol
|
|
13755
|
-
},
|
|
13756
|
-
staked: {
|
|
13757
|
-
amount: BigNumber.from(0),
|
|
13758
|
-
decimals: liqDecimals,
|
|
13759
|
-
symbol: liqSymbol
|
|
13760
|
-
},
|
|
13761
|
-
chainID: this.network.chainId
|
|
13762
|
-
};
|
|
13763
|
-
return portfolio;
|
|
13764
|
-
}
|
|
13765
14659
|
}
|
|
13766
14660
|
|
|
13767
14661
|
class Staker {
|
|
@@ -13819,281 +14713,5 @@ var types = /*#__PURE__*/Object.freeze({
|
|
|
13819
14713
|
__proto__: null
|
|
13820
14714
|
});
|
|
13821
14715
|
|
|
13822
|
-
|
|
13823
|
-
function getLiqsolCoreProgram(connection) {
|
|
13824
|
-
if (_liqsolCoreProgram && _liqsolCoreProgram.provider.connection === connection) {
|
|
13825
|
-
return _liqsolCoreProgram;
|
|
13826
|
-
}
|
|
13827
|
-
const tmpKeypair = Keypair.generate();
|
|
13828
|
-
const wallet = { publicKey: tmpKeypair.publicKey, signAllTransactions: async () => [], signTransaction: async () => tmpKeypair };
|
|
13829
|
-
const provider = new AnchorProvider(connection, wallet, {
|
|
13830
|
-
commitment: "confirmed"
|
|
13831
|
-
});
|
|
13832
|
-
const program = new Program(
|
|
13833
|
-
liqsolCoreIDL,
|
|
13834
|
-
provider
|
|
13835
|
-
);
|
|
13836
|
-
_liqsolCoreProgram = program;
|
|
13837
|
-
return program;
|
|
13838
|
-
}
|
|
13839
|
-
async function buildDepositAccounts(connection, user) {
|
|
13840
|
-
const depositAuthority = deriveDepositAuthorityPda();
|
|
13841
|
-
const liqsolMint = deriveLiqsolMintPda();
|
|
13842
|
-
const liqsolMintAuthority = deriveLiqsolMintAuthorityPda();
|
|
13843
|
-
const stakeControllerVault = deriveStakeControllerVaultPda();
|
|
13844
|
-
const stakeControllerReservePool = deriveReservePoolPda();
|
|
13845
|
-
const stakeControllerState = deriveStakeControllerStatePda();
|
|
13846
|
-
const payoutState = derivePayoutStatePda();
|
|
13847
|
-
const bucketAuthority = deriveBucketAuthorityPda();
|
|
13848
|
-
const distributionState = deriveDistributionStatePda();
|
|
13849
|
-
const userRecord = deriveUserRecordPda(user);
|
|
13850
|
-
const payRateHistory = derivePayRateHistoryPda();
|
|
13851
|
-
const userAta = await getAssociatedTokenAddress(
|
|
13852
|
-
liqsolMint,
|
|
13853
|
-
user,
|
|
13854
|
-
false,
|
|
13855
|
-
TOKEN_2022_PROGRAM_ID
|
|
13856
|
-
);
|
|
13857
|
-
const bucketTokenAccount = await getAssociatedTokenAddress(
|
|
13858
|
-
liqsolMint,
|
|
13859
|
-
bucketAuthority,
|
|
13860
|
-
true,
|
|
13861
|
-
TOKEN_2022_PROGRAM_ID
|
|
13862
|
-
);
|
|
13863
|
-
const seed = Math.floor(Math.random() * 2 ** 32);
|
|
13864
|
-
const ephemeralSeed = `ephemeral_${seed}`;
|
|
13865
|
-
const ephemeralStake = await deriveEphemeralStakeAddress(user, ephemeralSeed);
|
|
13866
|
-
return {
|
|
13867
|
-
user,
|
|
13868
|
-
depositAuthority,
|
|
13869
|
-
liqsolMint,
|
|
13870
|
-
liqsolMintAuthority,
|
|
13871
|
-
userAta,
|
|
13872
|
-
stakeControllerVault,
|
|
13873
|
-
stakeControllerReservePool,
|
|
13874
|
-
stakeControllerState,
|
|
13875
|
-
payoutState,
|
|
13876
|
-
bucketAuthority,
|
|
13877
|
-
bucketTokenAccount,
|
|
13878
|
-
distributionState,
|
|
13879
|
-
userRecord,
|
|
13880
|
-
payRateHistory,
|
|
13881
|
-
ephemeralStake,
|
|
13882
|
-
ephemeralSeed
|
|
13883
|
-
};
|
|
13884
|
-
}
|
|
13885
|
-
async function getUserLiqSolBalance(connection, user) {
|
|
13886
|
-
const liqsolMint = deriveLiqsolMintPda();
|
|
13887
|
-
const ata = await getAssociatedTokenAddress(
|
|
13888
|
-
liqsolMint,
|
|
13889
|
-
user,
|
|
13890
|
-
false,
|
|
13891
|
-
TOKEN_2022_PROGRAM_ID
|
|
13892
|
-
);
|
|
13893
|
-
try {
|
|
13894
|
-
const bal = await connection.getTokenAccountBalance(ata);
|
|
13895
|
-
return Number(bal.value.amount);
|
|
13896
|
-
} catch {
|
|
13897
|
-
return 0;
|
|
13898
|
-
}
|
|
13899
|
-
}
|
|
13900
|
-
async function getBucketLiqSolBalance(connection) {
|
|
13901
|
-
const liqsolMint = deriveLiqsolMintPda();
|
|
13902
|
-
const bucketAuthority = deriveBucketAuthorityPda();
|
|
13903
|
-
const ata = await getAssociatedTokenAddress(
|
|
13904
|
-
liqsolMint,
|
|
13905
|
-
bucketAuthority,
|
|
13906
|
-
true,
|
|
13907
|
-
TOKEN_2022_PROGRAM_ID
|
|
13908
|
-
);
|
|
13909
|
-
try {
|
|
13910
|
-
const bal = await connection.getTokenAccountBalance(ata);
|
|
13911
|
-
return Number(bal.value.amount);
|
|
13912
|
-
} catch {
|
|
13913
|
-
return 0;
|
|
13914
|
-
}
|
|
13915
|
-
}
|
|
13916
|
-
async function getReservePoolBalance(connection) {
|
|
13917
|
-
const reservePool = deriveReservePoolPda();
|
|
13918
|
-
try {
|
|
13919
|
-
const lamports = await connection.getBalance(reservePool);
|
|
13920
|
-
return lamports;
|
|
13921
|
-
} catch {
|
|
13922
|
-
return 0;
|
|
13923
|
-
}
|
|
13924
|
-
}
|
|
13925
|
-
async function getStakeControllerStateRaw(connection) {
|
|
13926
|
-
const pda = deriveStakeControllerStatePda();
|
|
13927
|
-
const info = await connection.getAccountInfo(pda);
|
|
13928
|
-
return info?.data ?? null;
|
|
13929
|
-
}
|
|
13930
|
-
async function getPayoutStateRaw(connection) {
|
|
13931
|
-
const pda = derivePayoutStatePda();
|
|
13932
|
-
const info = await connection.getAccountInfo(pda);
|
|
13933
|
-
return info?.data ?? null;
|
|
13934
|
-
}
|
|
13935
|
-
async function getUserRecordRaw(connection, user) {
|
|
13936
|
-
const pda = deriveUserRecordPda(user);
|
|
13937
|
-
const info = await connection.getAccountInfo(pda);
|
|
13938
|
-
return info?.data ?? null;
|
|
13939
|
-
}
|
|
13940
|
-
async function getAveragePayRate(connection, lookback = DEFAULT_PAY_RATE_LOOKBACK) {
|
|
13941
|
-
const program = getLiqsolCoreProgram(connection);
|
|
13942
|
-
const payRateHistoryPda = derivePayRateHistoryPda();
|
|
13943
|
-
try {
|
|
13944
|
-
const anyProgram = program;
|
|
13945
|
-
const payRateHistoryAccount = await anyProgram.account.payRateHistory.fetch(
|
|
13946
|
-
payRateHistoryPda
|
|
13947
|
-
);
|
|
13948
|
-
const entries = payRateHistoryAccount.entries ?? [];
|
|
13949
|
-
const totalEntriesAdded = Number(
|
|
13950
|
-
payRateHistoryAccount.totalEntriesAdded ?? 0
|
|
13951
|
-
);
|
|
13952
|
-
const currentIndex = payRateHistoryAccount.currentIndex ?? 0;
|
|
13953
|
-
const maxEntries = payRateHistoryAccount.maxEntries ?? entries.length;
|
|
13954
|
-
if (!entries.length) {
|
|
13955
|
-
return DEFAULT_AVERAGE_PAY_RATE;
|
|
13956
|
-
}
|
|
13957
|
-
const entriesToFetch = Math.min(lookback, maxEntries, entries.length);
|
|
13958
|
-
let idx;
|
|
13959
|
-
if (totalEntriesAdded === 0) {
|
|
13960
|
-
idx = 0;
|
|
13961
|
-
} else if (currentIndex === 0) {
|
|
13962
|
-
idx = maxEntries - 1;
|
|
13963
|
-
} else {
|
|
13964
|
-
idx = currentIndex - 1;
|
|
13965
|
-
}
|
|
13966
|
-
let sum = BigInt(0);
|
|
13967
|
-
let validCount = BigInt(0);
|
|
13968
|
-
for (let i = 0; i < entriesToFetch; i++) {
|
|
13969
|
-
const entry = entries[idx];
|
|
13970
|
-
if (entry && typeof entry.scaledRate !== "undefined") {
|
|
13971
|
-
const rate = BigInt(entry.scaledRate.toString());
|
|
13972
|
-
if (rate > BigInt(0)) {
|
|
13973
|
-
sum += rate;
|
|
13974
|
-
validCount += BigInt(1);
|
|
13975
|
-
}
|
|
13976
|
-
}
|
|
13977
|
-
if (totalEntriesAdded === 0) {
|
|
13978
|
-
idx = (idx + 1) % maxEntries;
|
|
13979
|
-
} else {
|
|
13980
|
-
idx = idx === 0 ? maxEntries - 1 : idx - 1;
|
|
13981
|
-
}
|
|
13982
|
-
}
|
|
13983
|
-
if (validCount === BigInt(0)) {
|
|
13984
|
-
return DEFAULT_AVERAGE_PAY_RATE;
|
|
13985
|
-
}
|
|
13986
|
-
return sum / validCount;
|
|
13987
|
-
} catch (err) {
|
|
13988
|
-
return DEFAULT_AVERAGE_PAY_RATE;
|
|
13989
|
-
}
|
|
13990
|
-
}
|
|
13991
|
-
function calculateExpectedFee(depositAmountLamports, averagePayRate) {
|
|
13992
|
-
return averagePayRate.mul(new BN(4)).mul(depositAmountLamports).div(new BN(1e12));
|
|
13993
|
-
}
|
|
13994
|
-
function previewDepositEffects(params) {
|
|
13995
|
-
const { depositAmountLamports, averagePayRate } = params;
|
|
13996
|
-
const rent = new BN(
|
|
13997
|
-
params.rentExemptionLamports ?? EPHEMERAL_RENT_EXEMPTION
|
|
13998
|
-
);
|
|
13999
|
-
const fee = calculateExpectedFee(depositAmountLamports, averagePayRate);
|
|
14000
|
-
const userLiqSol = depositAmountLamports.sub(fee).add(rent);
|
|
14001
|
-
const bucketLiqSol = fee;
|
|
14002
|
-
const reserveIncrease = depositAmountLamports.add(rent);
|
|
14003
|
-
return {
|
|
14004
|
-
feeLamports: fee,
|
|
14005
|
-
userLiqSolLamports: userLiqSol,
|
|
14006
|
-
bucketLiqSolLamports: bucketLiqSol,
|
|
14007
|
-
reserveIncreaseLamports: reserveIncrease
|
|
14008
|
-
};
|
|
14009
|
-
}
|
|
14010
|
-
async function getEpochSnapshot(connection) {
|
|
14011
|
-
const info = await connection.getEpochInfo();
|
|
14012
|
-
let slotTimeMs = Number(process.env.SLOT_TIME_MS_FALLBACK ?? 400);
|
|
14013
|
-
try {
|
|
14014
|
-
const samples = await connection.getRecentPerformanceSamples(16);
|
|
14015
|
-
if (samples.length) {
|
|
14016
|
-
const avgMs = samples.reduce(
|
|
14017
|
-
(acc, s) => acc + s.samplePeriodSecs * 1e3 / s.numSlots,
|
|
14018
|
-
0
|
|
14019
|
-
) / samples.length;
|
|
14020
|
-
if (isFinite(avgMs) && avgMs > 0) {
|
|
14021
|
-
slotTimeMs = avgMs;
|
|
14022
|
-
}
|
|
14023
|
-
}
|
|
14024
|
-
} catch {
|
|
14025
|
-
}
|
|
14026
|
-
return {
|
|
14027
|
-
epoch: info.epoch,
|
|
14028
|
-
slot: info.slotIndex,
|
|
14029
|
-
firstSlot: info.absoluteSlot - info.slotIndex,
|
|
14030
|
-
slotsInEpoch: info.slotsInEpoch,
|
|
14031
|
-
slotMs: slotTimeMs
|
|
14032
|
-
};
|
|
14033
|
-
}
|
|
14034
|
-
function msToEpochEnd(snapshot) {
|
|
14035
|
-
const remainingSlots = snapshot.slotsInEpoch - snapshot.slot;
|
|
14036
|
-
return remainingSlots * snapshot.slotMs;
|
|
14037
|
-
}
|
|
14038
|
-
async function scheduledInstruction(connection, config, instruction) {
|
|
14039
|
-
const early = config.early ?? 0.1;
|
|
14040
|
-
const late = config.late ?? 0.9;
|
|
14041
|
-
const snapshot = await getEpochSnapshot(connection);
|
|
14042
|
-
const progress = snapshot.slot / snapshot.slotsInEpoch;
|
|
14043
|
-
if (progress >= early && progress <= late) {
|
|
14044
|
-
return instruction();
|
|
14045
|
-
}
|
|
14046
|
-
if (progress < early) {
|
|
14047
|
-
const targetSlot = snapshot.slotsInEpoch * early;
|
|
14048
|
-
const slotsRemaining = targetSlot - snapshot.slot;
|
|
14049
|
-
const msToWait = slotsRemaining * snapshot.slotMs;
|
|
14050
|
-
console.log(
|
|
14051
|
-
`Epoch early (${(progress * 100).toFixed(
|
|
14052
|
-
2
|
|
14053
|
-
)}%). Sleeping ${(msToWait / 1e3).toFixed(1)}s until ${early * 100}%...`
|
|
14054
|
-
);
|
|
14055
|
-
await sleep(Math.max(1e3, msToWait));
|
|
14056
|
-
return instruction();
|
|
14057
|
-
}
|
|
14058
|
-
const msToNextEpoch = msToEpochEnd(snapshot);
|
|
14059
|
-
const earlyWaitTime = snapshot.slotsInEpoch * early * snapshot.slotMs;
|
|
14060
|
-
const totalWaitTime = msToNextEpoch + earlyWaitTime + 1e3;
|
|
14061
|
-
console.log(
|
|
14062
|
-
`Epoch late (${(progress * 100).toFixed(
|
|
14063
|
-
2
|
|
14064
|
-
)}%). Sleeping ${(totalWaitTime / 1e3).toFixed(
|
|
14065
|
-
1
|
|
14066
|
-
)}s until next epoch + ${early * 100}%...`
|
|
14067
|
-
);
|
|
14068
|
-
await sleep(totalWaitTime);
|
|
14069
|
-
return instruction();
|
|
14070
|
-
}
|
|
14071
|
-
function getErrorMessage(error) {
|
|
14072
|
-
return error?.error?.errorCode?.code || error?.error?.errorMessage || error?.message || "";
|
|
14073
|
-
}
|
|
14074
|
-
function generateRandomDepositAmount(minSol = 2, maxSol = 100) {
|
|
14075
|
-
const randomSol = Math.random() * (maxSol - minSol) + minSol;
|
|
14076
|
-
return new BN(solToLamports(randomSol));
|
|
14077
|
-
}
|
|
14078
|
-
function generateTestKeypair() {
|
|
14079
|
-
return Keypair.generate();
|
|
14080
|
-
}
|
|
14081
|
-
async function airdropSol(connection, publicKey, amountSol) {
|
|
14082
|
-
const lamports = solToLamports(amountSol);
|
|
14083
|
-
const sig = await connection.requestAirdrop(publicKey, lamports);
|
|
14084
|
-
await connection.confirmTransaction(sig, "confirmed");
|
|
14085
|
-
}
|
|
14086
|
-
async function waitForConfirmation(connection, signature) {
|
|
14087
|
-
await connection.confirmTransaction(signature, "confirmed");
|
|
14088
|
-
}
|
|
14089
|
-
function sleep(ms) {
|
|
14090
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
14091
|
-
}
|
|
14092
|
-
async function waitUntilSafeToExecuteFunction(connection, config = {}) {
|
|
14093
|
-
await scheduledInstruction(connection, config, async () => {
|
|
14094
|
-
return;
|
|
14095
|
-
});
|
|
14096
|
-
}
|
|
14097
|
-
|
|
14098
|
-
export { ADDRESSES, CONTRACTS, DEFAULT_AVERAGE_PAY_RATE, DEFAULT_PAY_RATE_LOOKBACK, DepositClient, DistributionClient, EPHEMERAL_RENT_EXEMPTION, ERC1155Abi, ERC20Abi, ERC721Abi, types$1 as ETH, EthereumContractService, EthereumStakingClient, LAMPORTS_PER_SOL, LIQSOL_CORE, LIQSOL_TOKEN, LeaderboardClient, PAY_RATE_SCALE_FACTOR, PDA_SEEDS, PROGRAM_IDS, types as SOL, SolanaStakingClient, Staker, VALIDATOR_LEADERBOARD, airdropSol, buildDepositAccounts, calculateExpectedFee, deriveBucketAuthorityPda, deriveDepositAuthorityPda, deriveDistributionStatePda, deriveEphemeralStakeAddress, deriveLeaderboardStatePda, deriveLiqsolMintAuthorityPda, deriveLiqsolMintPda, derivePayRateHistoryPda, derivePayoutStatePda, deriveReservePoolPda, deriveStakeControllerStatePda, deriveStakeControllerVaultPda, deriveUserRecordPda, deriveValidatorRecordPda, deriveVaultPda, generateRandomDepositAmount, generateTestKeypair, getAveragePayRate, getBucketLiqSolBalance, getEpochSnapshot, getErrorMessage, getLiqsolCoreProgram, getPayoutStateRaw, getReservePoolBalance, getStakeControllerStateRaw, getUserLiqSolBalance, getUserRecordRaw, lamportsToSol, msToEpochEnd, previewDepositEffects, scheduledInstruction, sleep, solToLamports, waitForConfirmation, waitUntilSafeToExecuteFunction };
|
|
14716
|
+
export { ADDRESSES, CHAINLINK_FEED, CHAINLINK_PROGRAM, CONTRACTS, DEFAULT_AVERAGE_PAY_RATE, DEFAULT_PAY_RATE_LOOKBACK, DepositClient, DistributionClient, EPHEMERAL_RENT_EXEMPTION, ERC1155Abi, ERC20Abi, ERC721Abi, types$1 as ETH, EthereumContractService, EthereumStakingClient, LAMPORTS_PER_SOL, LIQSOL_CORE, LIQSOL_TOKEN, LeaderboardClient, OutpostClient, PAY_RATE_SCALE_FACTOR, PDA_SEEDS, PROGRAM_IDS, types as SOL, SolanaStakingClient, Staker, VALIDATOR_LEADERBOARD, airdropSol, buildOutpostAccounts, calculateExpectedFee, deriveBarConfigPda, deriveBondLevelPda, deriveBondedActorPda, deriveBucketAuthorityPda, deriveDepositAuthorityPda, deriveDistributionStatePda, deriveEphemeralStakeAddress, deriveLeaderboardStatePda, deriveLiqsolMintAuthorityPda, deriveLiqsolMintPda, deriveOutpostGlobalStatePda, deriveOutpostPoolAuthorityPda, derivePayRateHistoryPda, derivePayoutStatePda, derivePoolUserRecordPda, deriveReservePoolPda, deriveSolBucketPda, deriveStakeControllerStatePda, deriveStakeControllerVaultPda, deriveTrancheStatePda, deriveUserRecordPda, deriveUserUserRecordPda, deriveUserWarrantRecordPda, deriveValidatorRecordPda, deriveVaultPda, deriveWireReceiptPda, generateRandomDepositAmount, generateTestKeypair, getAveragePayRate, getBucketLiqSolBalance, getEpochSnapshot, getErrorMessage, getLiqsolCoreProgram, getPayoutStateRaw, getReservePoolBalance, getStakeControllerStateRaw, getUserLiqSolBalance, getUserRecordRaw, lamportsToSol, msToEpochEnd, previewDepositEffects, scheduledInstruction, sleep, solToLamports, waitForConfirmation, waitUntilSafeToExecuteFunction };
|
|
14099
14717
|
//# sourceMappingURL=stake.browser.js.map
|