@streamflow/staking 8.7.0 → 8.8.0-alpha.p305.1e86aff
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +1830 -47
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +991 -5
- package/dist/cjs/solana/descriptor/fee_manager.d.cts +1 -1
- package/dist/cjs/solana/descriptor/reward_pool.d.cts +296 -5
- package/dist/cjs/solana/descriptor/stake_pool.d.cts +497 -5
- package/dist/esm/index.d.ts +991 -5
- package/dist/esm/index.js +1829 -46
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/descriptor/fee_manager.d.ts +1 -1
- package/dist/esm/solana/descriptor/idl/fee_manager.json +1 -1
- package/dist/esm/solana/descriptor/idl/governor.json +932 -0
- package/dist/esm/solana/descriptor/idl/reward_pool.json +296 -5
- package/dist/esm/solana/descriptor/idl/reward_pool_dynamic.json +46 -4
- package/dist/esm/solana/descriptor/idl/stake_pool.json +499 -7
- package/dist/esm/solana/descriptor/reward_pool.d.ts +296 -5
- package/dist/esm/solana/descriptor/stake_pool.d.ts +497 -5
- package/package.json +4 -4
package/dist/esm/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync } from '@solana/spl-tok
|
|
|
3
3
|
import { PublicKey, Connection } from '@solana/web3.js';
|
|
4
4
|
import { ICluster, invariant, ContractError, getNumberFromBN, getBN, divCeilN } from '@streamflow/common';
|
|
5
5
|
import { buildSendThrottler, getFilters, pk, checkOrCreateAtaBatch, unwrapExecutionParams, createAndEstimateTransaction, prepareBaseInstructions, prepareTransaction, signAndExecuteTransaction } from '@streamflow/common/solana';
|
|
6
|
-
import
|
|
6
|
+
import BN4 from 'bn.js';
|
|
7
7
|
import '@solana/wallet-adapter-base';
|
|
8
8
|
|
|
9
9
|
var __defProp = Object.defineProperty;
|
|
@@ -56,14 +56,14 @@ __export(constants_exports, {
|
|
|
56
56
|
U64_MAX: () => U64_MAX
|
|
57
57
|
});
|
|
58
58
|
var FEE_PRECISION_FACTOR = 1e4;
|
|
59
|
-
var FEE_PRECISION_FACTOR_BN = new
|
|
59
|
+
var FEE_PRECISION_FACTOR_BN = new BN4(FEE_PRECISION_FACTOR);
|
|
60
60
|
var DEFAULT_FEE = 19;
|
|
61
|
-
var DEFAULT_FEE_BN = new
|
|
61
|
+
var DEFAULT_FEE_BN = new BN4(DEFAULT_FEE);
|
|
62
62
|
var SCALE_PRECISION_FACTOR = 1e9;
|
|
63
|
-
var SCALE_PRECISION_FACTOR_BN = new
|
|
63
|
+
var SCALE_PRECISION_FACTOR_BN = new BN4(SCALE_PRECISION_FACTOR);
|
|
64
64
|
var REWARD_AMOUNT_DECIMALS = 9;
|
|
65
65
|
var REWARD_AMOUNT_PRECISION_FACTOR = 1e9;
|
|
66
|
-
var REWARD_AMOUNT_PRECISION_FACTOR_BN = new
|
|
66
|
+
var REWARD_AMOUNT_PRECISION_FACTOR_BN = new BN4(REWARD_AMOUNT_PRECISION_FACTOR);
|
|
67
67
|
var U64_MAX = 18446744073709551615n;
|
|
68
68
|
var STAKE_ENTRY_DISCRIMINATOR = [187, 127, 9, 35, 155, 68, 86, 40];
|
|
69
69
|
var STAKE_ENTRY_PREFIX = Buffer.from("stake-entry", "utf-8");
|
|
@@ -128,12 +128,946 @@ var FEE_PROGRAM_ID = {
|
|
|
128
128
|
[ICluster.Local]: "FEELzfBhsWXTNJX53zZcDVfRNoFYZQ6cZA3jLiGVL16V"
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
+
// solana/descriptor/idl/governor.json
|
|
132
|
+
var governor_default = {
|
|
133
|
+
address: "GVERNASJFxi8vjjJtwCKYQTeN51XsV1y2B1ap1GtKrKR",
|
|
134
|
+
metadata: {
|
|
135
|
+
name: "governor",
|
|
136
|
+
version: "2.3.0",
|
|
137
|
+
spec: "0.1.0",
|
|
138
|
+
description: "Governor program to allow users to vote with stake tokens"
|
|
139
|
+
},
|
|
140
|
+
instructions: [
|
|
141
|
+
{
|
|
142
|
+
name: "add_proposal",
|
|
143
|
+
discriminator: [
|
|
144
|
+
130,
|
|
145
|
+
139,
|
|
146
|
+
214,
|
|
147
|
+
107,
|
|
148
|
+
93,
|
|
149
|
+
13,
|
|
150
|
+
84,
|
|
151
|
+
152
|
|
152
|
+
],
|
|
153
|
+
accounts: [
|
|
154
|
+
{
|
|
155
|
+
name: "stake_pool",
|
|
156
|
+
docs: [
|
|
157
|
+
"The stake pool associated with the governor"
|
|
158
|
+
],
|
|
159
|
+
relations: [
|
|
160
|
+
"governor"
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: "governor",
|
|
165
|
+
docs: [
|
|
166
|
+
"The governor to which the proposal is being added"
|
|
167
|
+
],
|
|
168
|
+
writable: true
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "proposal",
|
|
172
|
+
docs: [
|
|
173
|
+
"The new proposal account to be created"
|
|
174
|
+
],
|
|
175
|
+
writable: true,
|
|
176
|
+
pda: {
|
|
177
|
+
seeds: [
|
|
178
|
+
{
|
|
179
|
+
kind: "const",
|
|
180
|
+
value: [
|
|
181
|
+
112,
|
|
182
|
+
114,
|
|
183
|
+
111,
|
|
184
|
+
112,
|
|
185
|
+
111,
|
|
186
|
+
115,
|
|
187
|
+
97,
|
|
188
|
+
108
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
kind: "account",
|
|
193
|
+
path: "governor"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
kind: "arg",
|
|
197
|
+
path: "nonce"
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
name: "authority",
|
|
204
|
+
docs: [
|
|
205
|
+
"Authority of the governor"
|
|
206
|
+
],
|
|
207
|
+
writable: true,
|
|
208
|
+
signer: true
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: "system_program",
|
|
212
|
+
address: "11111111111111111111111111111111"
|
|
213
|
+
}
|
|
214
|
+
],
|
|
215
|
+
args: [
|
|
216
|
+
{
|
|
217
|
+
name: "nonce",
|
|
218
|
+
type: "u32"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: "text",
|
|
222
|
+
type: "string"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: "options",
|
|
226
|
+
type: {
|
|
227
|
+
vec: "string"
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: "voting_start_ts",
|
|
232
|
+
type: "u64"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: "voting_end_ts",
|
|
236
|
+
type: "u64"
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: "change_authority",
|
|
242
|
+
discriminator: [
|
|
243
|
+
50,
|
|
244
|
+
106,
|
|
245
|
+
66,
|
|
246
|
+
104,
|
|
247
|
+
99,
|
|
248
|
+
118,
|
|
249
|
+
145,
|
|
250
|
+
88
|
|
251
|
+
],
|
|
252
|
+
accounts: [
|
|
253
|
+
{
|
|
254
|
+
name: "governor",
|
|
255
|
+
docs: [
|
|
256
|
+
"Reward Pool"
|
|
257
|
+
],
|
|
258
|
+
writable: true
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: "authority",
|
|
262
|
+
docs: [
|
|
263
|
+
"Current Authority"
|
|
264
|
+
],
|
|
265
|
+
writable: true,
|
|
266
|
+
signer: true
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: "new_authority"
|
|
270
|
+
}
|
|
271
|
+
],
|
|
272
|
+
args: []
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
name: "create_governor",
|
|
276
|
+
discriminator: [
|
|
277
|
+
103,
|
|
278
|
+
30,
|
|
279
|
+
78,
|
|
280
|
+
252,
|
|
281
|
+
28,
|
|
282
|
+
128,
|
|
283
|
+
40,
|
|
284
|
+
3
|
|
285
|
+
],
|
|
286
|
+
accounts: [
|
|
287
|
+
{
|
|
288
|
+
name: "stake_pool",
|
|
289
|
+
docs: [
|
|
290
|
+
"The stake pool for which the governor is being created"
|
|
291
|
+
]
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: "governor",
|
|
295
|
+
docs: [
|
|
296
|
+
"The governor account to be created"
|
|
297
|
+
],
|
|
298
|
+
writable: true,
|
|
299
|
+
pda: {
|
|
300
|
+
seeds: [
|
|
301
|
+
{
|
|
302
|
+
kind: "const",
|
|
303
|
+
value: [
|
|
304
|
+
103,
|
|
305
|
+
111,
|
|
306
|
+
118,
|
|
307
|
+
101,
|
|
308
|
+
114,
|
|
309
|
+
110,
|
|
310
|
+
111,
|
|
311
|
+
114
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
kind: "account",
|
|
316
|
+
path: "stake_pool"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
kind: "arg",
|
|
320
|
+
path: "nonce"
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
name: "authority",
|
|
327
|
+
docs: [
|
|
328
|
+
"Authority of the stake pool"
|
|
329
|
+
],
|
|
330
|
+
writable: true,
|
|
331
|
+
signer: true
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
name: "system_program",
|
|
335
|
+
address: "11111111111111111111111111111111"
|
|
336
|
+
}
|
|
337
|
+
],
|
|
338
|
+
args: [
|
|
339
|
+
{
|
|
340
|
+
name: "nonce",
|
|
341
|
+
type: "u8"
|
|
342
|
+
}
|
|
343
|
+
]
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
name: "set_active_proposal",
|
|
347
|
+
discriminator: [
|
|
348
|
+
41,
|
|
349
|
+
14,
|
|
350
|
+
222,
|
|
351
|
+
18,
|
|
352
|
+
33,
|
|
353
|
+
232,
|
|
354
|
+
43,
|
|
355
|
+
82
|
|
356
|
+
],
|
|
357
|
+
accounts: [
|
|
358
|
+
{
|
|
359
|
+
name: "governor",
|
|
360
|
+
docs: [
|
|
361
|
+
"The governor for which to set the active proposal"
|
|
362
|
+
],
|
|
363
|
+
writable: true,
|
|
364
|
+
relations: [
|
|
365
|
+
"proposal"
|
|
366
|
+
]
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
name: "proposal",
|
|
370
|
+
docs: [
|
|
371
|
+
"The proposal to set as active"
|
|
372
|
+
],
|
|
373
|
+
writable: true
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
name: "authority",
|
|
377
|
+
docs: [
|
|
378
|
+
"Authority of the governor"
|
|
379
|
+
],
|
|
380
|
+
signer: true
|
|
381
|
+
}
|
|
382
|
+
],
|
|
383
|
+
args: []
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
name: "vote_on_proposal",
|
|
387
|
+
discriminator: [
|
|
388
|
+
188,
|
|
389
|
+
239,
|
|
390
|
+
13,
|
|
391
|
+
88,
|
|
392
|
+
119,
|
|
393
|
+
199,
|
|
394
|
+
251,
|
|
395
|
+
119
|
|
396
|
+
],
|
|
397
|
+
accounts: [
|
|
398
|
+
{
|
|
399
|
+
name: "stake_pool",
|
|
400
|
+
docs: [
|
|
401
|
+
"Original Stake Pool"
|
|
402
|
+
],
|
|
403
|
+
relations: [
|
|
404
|
+
"governor"
|
|
405
|
+
]
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
name: "governor",
|
|
409
|
+
docs: [
|
|
410
|
+
"The governor account that manages the voting process"
|
|
411
|
+
],
|
|
412
|
+
writable: true,
|
|
413
|
+
relations: [
|
|
414
|
+
"proposal"
|
|
415
|
+
]
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
name: "proposal",
|
|
419
|
+
docs: [
|
|
420
|
+
"The proposal being voted on"
|
|
421
|
+
]
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
name: "vote",
|
|
425
|
+
docs: [
|
|
426
|
+
"The vote account that will be created to record the vote"
|
|
427
|
+
],
|
|
428
|
+
writable: true,
|
|
429
|
+
pda: {
|
|
430
|
+
seeds: [
|
|
431
|
+
{
|
|
432
|
+
kind: "const",
|
|
433
|
+
value: [
|
|
434
|
+
118,
|
|
435
|
+
111,
|
|
436
|
+
116,
|
|
437
|
+
101
|
|
438
|
+
]
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
kind: "account",
|
|
442
|
+
path: "proposal"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
kind: "account",
|
|
446
|
+
path: "voter"
|
|
447
|
+
}
|
|
448
|
+
]
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
name: "stake_mint_account",
|
|
453
|
+
docs: [
|
|
454
|
+
"The user's stake token account that holds the stake tokens"
|
|
455
|
+
]
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
name: "voter",
|
|
459
|
+
docs: [
|
|
460
|
+
"The user who is voting"
|
|
461
|
+
],
|
|
462
|
+
writable: true,
|
|
463
|
+
signer: true
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
name: "rent_sponsor",
|
|
467
|
+
writable: true,
|
|
468
|
+
pda: {
|
|
469
|
+
seeds: [
|
|
470
|
+
{
|
|
471
|
+
kind: "const",
|
|
472
|
+
value: [
|
|
473
|
+
114,
|
|
474
|
+
101,
|
|
475
|
+
110,
|
|
476
|
+
116,
|
|
477
|
+
45,
|
|
478
|
+
115,
|
|
479
|
+
112,
|
|
480
|
+
111,
|
|
481
|
+
110,
|
|
482
|
+
115,
|
|
483
|
+
111,
|
|
484
|
+
114
|
|
485
|
+
]
|
|
486
|
+
}
|
|
487
|
+
]
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
name: "system_program",
|
|
492
|
+
address: "11111111111111111111111111111111"
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
name: "event_authority",
|
|
496
|
+
pda: {
|
|
497
|
+
seeds: [
|
|
498
|
+
{
|
|
499
|
+
kind: "const",
|
|
500
|
+
value: [
|
|
501
|
+
95,
|
|
502
|
+
95,
|
|
503
|
+
101,
|
|
504
|
+
118,
|
|
505
|
+
101,
|
|
506
|
+
110,
|
|
507
|
+
116,
|
|
508
|
+
95,
|
|
509
|
+
97,
|
|
510
|
+
117,
|
|
511
|
+
116,
|
|
512
|
+
104,
|
|
513
|
+
111,
|
|
514
|
+
114,
|
|
515
|
+
105,
|
|
516
|
+
116,
|
|
517
|
+
121
|
|
518
|
+
]
|
|
519
|
+
}
|
|
520
|
+
]
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
name: "program"
|
|
525
|
+
}
|
|
526
|
+
],
|
|
527
|
+
args: [
|
|
528
|
+
{
|
|
529
|
+
name: "option_index",
|
|
530
|
+
type: "u8"
|
|
531
|
+
}
|
|
532
|
+
]
|
|
533
|
+
}
|
|
534
|
+
],
|
|
535
|
+
accounts: [
|
|
536
|
+
{
|
|
537
|
+
name: "Governor",
|
|
538
|
+
discriminator: [
|
|
539
|
+
37,
|
|
540
|
+
136,
|
|
541
|
+
44,
|
|
542
|
+
80,
|
|
543
|
+
68,
|
|
544
|
+
85,
|
|
545
|
+
213,
|
|
546
|
+
178
|
|
547
|
+
]
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
name: "Proposal",
|
|
551
|
+
discriminator: [
|
|
552
|
+
26,
|
|
553
|
+
94,
|
|
554
|
+
189,
|
|
555
|
+
187,
|
|
556
|
+
116,
|
|
557
|
+
136,
|
|
558
|
+
53,
|
|
559
|
+
33
|
|
560
|
+
]
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
name: "StakePool",
|
|
564
|
+
discriminator: [
|
|
565
|
+
121,
|
|
566
|
+
34,
|
|
567
|
+
206,
|
|
568
|
+
21,
|
|
569
|
+
79,
|
|
570
|
+
127,
|
|
571
|
+
255,
|
|
572
|
+
28
|
|
573
|
+
]
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
name: "Vote",
|
|
577
|
+
discriminator: [
|
|
578
|
+
96,
|
|
579
|
+
91,
|
|
580
|
+
104,
|
|
581
|
+
57,
|
|
582
|
+
145,
|
|
583
|
+
35,
|
|
584
|
+
172,
|
|
585
|
+
155
|
|
586
|
+
]
|
|
587
|
+
}
|
|
588
|
+
],
|
|
589
|
+
events: [
|
|
590
|
+
{
|
|
591
|
+
name: "VoteEvent",
|
|
592
|
+
discriminator: [
|
|
593
|
+
195,
|
|
594
|
+
71,
|
|
595
|
+
250,
|
|
596
|
+
105,
|
|
597
|
+
120,
|
|
598
|
+
119,
|
|
599
|
+
234,
|
|
600
|
+
134
|
|
601
|
+
]
|
|
602
|
+
}
|
|
603
|
+
],
|
|
604
|
+
errors: [
|
|
605
|
+
{
|
|
606
|
+
code: 6e3,
|
|
607
|
+
name: "ArithmeticError",
|
|
608
|
+
msg: "Arithmetic Error (overflow/underflow)"
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
code: 6001,
|
|
612
|
+
name: "Unauthorized",
|
|
613
|
+
msg: "Account is not authorized to execute this instruction"
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
code: 6002,
|
|
617
|
+
name: "InvalidStakeMint",
|
|
618
|
+
msg: "Provided Stake Mint does not equal the Pool Stake Mint"
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
code: 6003,
|
|
622
|
+
name: "InvalidStakePool",
|
|
623
|
+
msg: "Provided Stake Pool does not equal the Entry Stake Pool"
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
code: 6004,
|
|
627
|
+
name: "InvalidGovernor",
|
|
628
|
+
msg: "Provided Governor does not match the proposal Governor"
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
code: 6005,
|
|
632
|
+
name: "InvalidProposalText",
|
|
633
|
+
msg: "Invalid proposal text provided"
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
code: 6006,
|
|
637
|
+
name: "InvalidProposalOptions",
|
|
638
|
+
msg: "Invalid proposal options provided"
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
code: 6007,
|
|
642
|
+
name: "InvalidProposalDuration",
|
|
643
|
+
msg: "Invalid proposal duration"
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
code: 6008,
|
|
647
|
+
name: "ProposalAlreadyActive",
|
|
648
|
+
msg: "This proposal is already active"
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
code: 6009,
|
|
652
|
+
name: "VotingNotStarted",
|
|
653
|
+
msg: "Voting not started yet"
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
code: 6010,
|
|
657
|
+
name: "VotingEnded",
|
|
658
|
+
msg: "Voting has already ended"
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
code: 6011,
|
|
662
|
+
name: "InvalidOptionIndex",
|
|
663
|
+
msg: "Provided option is not a valid proposal option"
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
code: 6012,
|
|
667
|
+
name: "InsufficientStakeTokens",
|
|
668
|
+
msg: "Insufficient tokens for voting"
|
|
669
|
+
}
|
|
670
|
+
],
|
|
671
|
+
types: [
|
|
672
|
+
{
|
|
673
|
+
name: "Governor",
|
|
674
|
+
type: {
|
|
675
|
+
kind: "struct",
|
|
676
|
+
fields: [
|
|
677
|
+
{
|
|
678
|
+
name: "bump",
|
|
679
|
+
docs: [
|
|
680
|
+
"Bump Seed used to sign transactions"
|
|
681
|
+
],
|
|
682
|
+
type: "u8"
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
name: "nonce",
|
|
686
|
+
docs: [
|
|
687
|
+
"Nonce to support multiple governors for the same pool"
|
|
688
|
+
],
|
|
689
|
+
type: "u8"
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
name: "stake_pool",
|
|
693
|
+
docs: [
|
|
694
|
+
"Stake Pool for which Reward Pool was added"
|
|
695
|
+
],
|
|
696
|
+
type: "pubkey"
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
name: "authority",
|
|
700
|
+
docs: [
|
|
701
|
+
"Authority of the Governor that can add proposals and set the current one"
|
|
702
|
+
],
|
|
703
|
+
type: "pubkey"
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
name: "current_proposal",
|
|
707
|
+
docs: [
|
|
708
|
+
"Address of the current proposal"
|
|
709
|
+
],
|
|
710
|
+
type: "pubkey"
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
name: "total_proposals",
|
|
714
|
+
docs: [
|
|
715
|
+
"Total number of created proposals"
|
|
716
|
+
],
|
|
717
|
+
type: "u64"
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
name: "_buffer",
|
|
721
|
+
docs: [
|
|
722
|
+
"Buffer for additional fields"
|
|
723
|
+
],
|
|
724
|
+
type: {
|
|
725
|
+
array: [
|
|
726
|
+
"u8",
|
|
727
|
+
128
|
|
728
|
+
]
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
]
|
|
732
|
+
}
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
name: "Proposal",
|
|
736
|
+
type: {
|
|
737
|
+
kind: "struct",
|
|
738
|
+
fields: [
|
|
739
|
+
{
|
|
740
|
+
name: "nonce",
|
|
741
|
+
docs: [
|
|
742
|
+
"Nonce used to derive proposal address"
|
|
743
|
+
],
|
|
744
|
+
type: "u32"
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
name: "governor",
|
|
748
|
+
docs: [
|
|
749
|
+
"Stake Pool for which Reward Pool was added"
|
|
750
|
+
],
|
|
751
|
+
type: "pubkey"
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
name: "text",
|
|
755
|
+
docs: [
|
|
756
|
+
"Text of the proposals we reserve up to 512 bytes (ascii symbols take 1 byte)"
|
|
757
|
+
],
|
|
758
|
+
type: "string"
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
name: "options",
|
|
762
|
+
docs: [
|
|
763
|
+
"Potential options that will be used when answering, we reserve enough space for up to 8x32 = 256 ascii symbols in total"
|
|
764
|
+
],
|
|
765
|
+
type: {
|
|
766
|
+
vec: "string"
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
name: "voting_start_ts",
|
|
771
|
+
docs: [
|
|
772
|
+
"Time when voting starts, 0 means that voting start immediately after proposal was created"
|
|
773
|
+
],
|
|
774
|
+
type: "u64"
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
name: "voting_end_ts",
|
|
778
|
+
docs: [
|
|
779
|
+
"Time when voting ends, 0 means that voting will be possible anytime"
|
|
780
|
+
],
|
|
781
|
+
type: "u64"
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
name: "created_ts",
|
|
785
|
+
docs: [
|
|
786
|
+
"Time when proposal was created"
|
|
787
|
+
],
|
|
788
|
+
type: "u64"
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
name: "last_active_ts",
|
|
792
|
+
docs: [
|
|
793
|
+
"Last time when proposal was made active"
|
|
794
|
+
],
|
|
795
|
+
type: "u64"
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
name: "_buffer",
|
|
799
|
+
docs: [
|
|
800
|
+
"Buffer for additional fields"
|
|
801
|
+
],
|
|
802
|
+
type: {
|
|
803
|
+
array: [
|
|
804
|
+
"u8",
|
|
805
|
+
64
|
|
806
|
+
]
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
]
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
name: "StakePool",
|
|
814
|
+
type: {
|
|
815
|
+
kind: "struct",
|
|
816
|
+
fields: [
|
|
817
|
+
{
|
|
818
|
+
name: "bump",
|
|
819
|
+
docs: [
|
|
820
|
+
"Bump Seed used to sign transactions"
|
|
821
|
+
],
|
|
822
|
+
type: "u8"
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
name: "nonce",
|
|
826
|
+
docs: [
|
|
827
|
+
"Nonce to differentiate pools for the same mint"
|
|
828
|
+
],
|
|
829
|
+
type: "u8"
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
name: "mint",
|
|
833
|
+
docs: [
|
|
834
|
+
"Mint of the Stake Pool"
|
|
835
|
+
],
|
|
836
|
+
type: "pubkey"
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
name: "creator",
|
|
840
|
+
docs: [
|
|
841
|
+
"Initial Creator"
|
|
842
|
+
],
|
|
843
|
+
type: "pubkey"
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
name: "authority",
|
|
847
|
+
docs: [
|
|
848
|
+
"Current authority"
|
|
849
|
+
],
|
|
850
|
+
type: "pubkey"
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
name: "min_weight",
|
|
854
|
+
docs: [
|
|
855
|
+
"The lowest weight awarded for staking, measured as a fraction of `1 / SCALE_FACTOR_BASE`.",
|
|
856
|
+
"For instance:",
|
|
857
|
+
"* `min_weight = 1 x SCALE_FACTOR_BASE` signifies a minimum multiplier of 1x for min staking duration",
|
|
858
|
+
"* `min_weight = 2 x SCALE_FACTOR_BASE` indicates a minimum multiplier of 2x for min staking duration"
|
|
859
|
+
],
|
|
860
|
+
type: "u64"
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
name: "max_weight",
|
|
864
|
+
docs: [
|
|
865
|
+
"The highest weight awarded for staking, measured as a fraction of `1 / SCALE_FACTOR_BASE`.",
|
|
866
|
+
"For instance:",
|
|
867
|
+
"* `max_weight = 1 x SCALE_FACTOR_BASE` signifies a max multiplier of 1x for max staking duration",
|
|
868
|
+
"* `max_weight = 2 x SCALE_FACTOR_BASE` indicates a max multiplier of 2x for max staking duration"
|
|
869
|
+
],
|
|
870
|
+
type: "u64"
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
name: "min_duration",
|
|
874
|
+
docs: [
|
|
875
|
+
"Min Duration of stake in seconds"
|
|
876
|
+
],
|
|
877
|
+
type: "u64"
|
|
878
|
+
},
|
|
879
|
+
{
|
|
880
|
+
name: "max_duration",
|
|
881
|
+
docs: [
|
|
882
|
+
"Max Duration of stake in seconds, the more duration, the more weight the stake has"
|
|
883
|
+
],
|
|
884
|
+
type: "u64"
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
name: "permissionless",
|
|
888
|
+
docs: [
|
|
889
|
+
"Whether anyone can add Reward Pools or just admin"
|
|
890
|
+
],
|
|
891
|
+
type: "bool"
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
name: "vault",
|
|
895
|
+
docs: [
|
|
896
|
+
"Escrow Account that stores staked tokens"
|
|
897
|
+
],
|
|
898
|
+
type: "pubkey"
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
name: "stake_mint",
|
|
902
|
+
docs: [
|
|
903
|
+
"Stake Mint, will be returned in exchange for stake tokens"
|
|
904
|
+
],
|
|
905
|
+
type: "pubkey"
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
name: "total_stake",
|
|
909
|
+
docs: [
|
|
910
|
+
"Total number of Staked tokens"
|
|
911
|
+
],
|
|
912
|
+
type: "u64"
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
name: "total_effective_stake",
|
|
916
|
+
docs: [
|
|
917
|
+
"Total staked tokens accounting for each stake weight, does not equal `total_stake`,",
|
|
918
|
+
"represents a sum of effective stake multiplied by 10^9 for precision"
|
|
919
|
+
],
|
|
920
|
+
type: "u128"
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
name: "freeze_stake_mint",
|
|
924
|
+
docs: [
|
|
925
|
+
"Whether we should freeze stake mint token accounts"
|
|
926
|
+
],
|
|
927
|
+
type: "bool"
|
|
928
|
+
},
|
|
929
|
+
{
|
|
930
|
+
name: "unstake_period",
|
|
931
|
+
docs: [
|
|
932
|
+
"Period for unstaking, if set unstake at first should be requested, and the real unstake can only happen after this period"
|
|
933
|
+
],
|
|
934
|
+
type: "u64"
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
name: "total_stake_capped",
|
|
938
|
+
docs: [
|
|
939
|
+
"Whether amount of total staked tokens is limited by `remaining_total_stake` - stored as separate flag to not deal with `Option`"
|
|
940
|
+
],
|
|
941
|
+
type: "bool"
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
name: "remaining_total_stake",
|
|
945
|
+
docs: [
|
|
946
|
+
"Remaining total amount of staked tokens (cumulative)"
|
|
947
|
+
],
|
|
948
|
+
type: "u64"
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
name: "expiry_ts",
|
|
952
|
+
docs: [
|
|
953
|
+
"Time when stake pool expires, staking is not possible after expiration"
|
|
954
|
+
],
|
|
955
|
+
type: "u64"
|
|
956
|
+
},
|
|
957
|
+
{
|
|
958
|
+
name: "auto_unstake",
|
|
959
|
+
docs: [
|
|
960
|
+
"Whether auto unstaking is enabled, stake entries will be unstaked after duration"
|
|
961
|
+
],
|
|
962
|
+
type: "bool"
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
name: "_buffer",
|
|
966
|
+
docs: [
|
|
967
|
+
"Buffer for additional fields"
|
|
968
|
+
],
|
|
969
|
+
type: {
|
|
970
|
+
array: [
|
|
971
|
+
"u8",
|
|
972
|
+
37
|
|
973
|
+
]
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
]
|
|
977
|
+
}
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
name: "Vote",
|
|
981
|
+
type: {
|
|
982
|
+
kind: "struct",
|
|
983
|
+
fields: [
|
|
984
|
+
{
|
|
985
|
+
name: "proposal",
|
|
986
|
+
docs: [
|
|
987
|
+
"Question to which vote was provided"
|
|
988
|
+
],
|
|
989
|
+
type: "pubkey"
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
name: "voter",
|
|
993
|
+
docs: [
|
|
994
|
+
"Voter that voted on the proposal"
|
|
995
|
+
],
|
|
996
|
+
type: "pubkey"
|
|
997
|
+
},
|
|
998
|
+
{
|
|
999
|
+
name: "option_index",
|
|
1000
|
+
docs: [
|
|
1001
|
+
"Index of the option used for voting"
|
|
1002
|
+
],
|
|
1003
|
+
type: "u8"
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
name: "weight",
|
|
1007
|
+
docs: [
|
|
1008
|
+
"Weight of the vote, correspond to number of sTokens used"
|
|
1009
|
+
],
|
|
1010
|
+
type: "u64"
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
name: "is_sponsored",
|
|
1014
|
+
docs: [
|
|
1015
|
+
"Whether the vote rent has been sponsored by the rent vault"
|
|
1016
|
+
],
|
|
1017
|
+
type: "bool"
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
name: "_buffer",
|
|
1021
|
+
docs: [
|
|
1022
|
+
"Buffer for additional fields"
|
|
1023
|
+
],
|
|
1024
|
+
type: {
|
|
1025
|
+
array: [
|
|
1026
|
+
"u8",
|
|
1027
|
+
63
|
|
1028
|
+
]
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
]
|
|
1032
|
+
}
|
|
1033
|
+
},
|
|
1034
|
+
{
|
|
1035
|
+
name: "VoteEvent",
|
|
1036
|
+
type: {
|
|
1037
|
+
kind: "struct",
|
|
1038
|
+
fields: [
|
|
1039
|
+
{
|
|
1040
|
+
name: "governor",
|
|
1041
|
+
type: "pubkey"
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
name: "proposal",
|
|
1045
|
+
type: "pubkey"
|
|
1046
|
+
},
|
|
1047
|
+
{
|
|
1048
|
+
name: "voter",
|
|
1049
|
+
type: "pubkey"
|
|
1050
|
+
},
|
|
1051
|
+
{
|
|
1052
|
+
name: "option_index",
|
|
1053
|
+
type: "u8"
|
|
1054
|
+
},
|
|
1055
|
+
{
|
|
1056
|
+
name: "value",
|
|
1057
|
+
type: "u64"
|
|
1058
|
+
}
|
|
1059
|
+
]
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
]
|
|
1063
|
+
};
|
|
1064
|
+
|
|
131
1065
|
// solana/descriptor/idl/fee_manager.json
|
|
132
1066
|
var fee_manager_default = {
|
|
133
1067
|
address: "FEELzfBhsWXTNJX53zZcDVfRNoFYZQ6cZA3jLiGVL16V",
|
|
134
1068
|
metadata: {
|
|
135
1069
|
name: "fee_manager",
|
|
136
|
-
version: "2.
|
|
1070
|
+
version: "2.3.0",
|
|
137
1071
|
spec: "0.1.0",
|
|
138
1072
|
description: "Stores Fees and other admin configuration for the Staking protocol"
|
|
139
1073
|
},
|
|
@@ -571,7 +1505,7 @@ var reward_pool_default = {
|
|
|
571
1505
|
address: "RWRDdfRbi3339VgKxTAXg4cjyniF7cbhNbMxZWiSKmj",
|
|
572
1506
|
metadata: {
|
|
573
1507
|
name: "reward_pool",
|
|
574
|
-
version: "2.
|
|
1508
|
+
version: "2.3.0",
|
|
575
1509
|
spec: "0.1.0",
|
|
576
1510
|
description: "Program to manage Reward Pools for Stake Pools and claim rewards from them"
|
|
577
1511
|
},
|
|
@@ -716,6 +1650,225 @@ var reward_pool_default = {
|
|
|
716
1650
|
],
|
|
717
1651
|
args: []
|
|
718
1652
|
},
|
|
1653
|
+
{
|
|
1654
|
+
name: "claim_rewards_as_worker",
|
|
1655
|
+
discriminator: [
|
|
1656
|
+
120,
|
|
1657
|
+
246,
|
|
1658
|
+
117,
|
|
1659
|
+
149,
|
|
1660
|
+
120,
|
|
1661
|
+
210,
|
|
1662
|
+
52,
|
|
1663
|
+
193
|
|
1664
|
+
],
|
|
1665
|
+
accounts: [
|
|
1666
|
+
{
|
|
1667
|
+
name: "reward_pool",
|
|
1668
|
+
docs: [
|
|
1669
|
+
"Reward Pool"
|
|
1670
|
+
],
|
|
1671
|
+
writable: true
|
|
1672
|
+
},
|
|
1673
|
+
{
|
|
1674
|
+
name: "stake_pool",
|
|
1675
|
+
docs: [
|
|
1676
|
+
"Stake Pool"
|
|
1677
|
+
],
|
|
1678
|
+
writable: true,
|
|
1679
|
+
relations: [
|
|
1680
|
+
"reward_pool"
|
|
1681
|
+
]
|
|
1682
|
+
},
|
|
1683
|
+
{
|
|
1684
|
+
name: "stake_entry",
|
|
1685
|
+
docs: [
|
|
1686
|
+
"Stake Entry for which rewards are being claimed"
|
|
1687
|
+
],
|
|
1688
|
+
writable: true
|
|
1689
|
+
},
|
|
1690
|
+
{
|
|
1691
|
+
name: "reward_entry",
|
|
1692
|
+
docs: [
|
|
1693
|
+
"Reward Entry that stores metadata about claimed rewards"
|
|
1694
|
+
],
|
|
1695
|
+
writable: true,
|
|
1696
|
+
pda: {
|
|
1697
|
+
seeds: [
|
|
1698
|
+
{
|
|
1699
|
+
kind: "const",
|
|
1700
|
+
value: [
|
|
1701
|
+
114,
|
|
1702
|
+
101,
|
|
1703
|
+
119,
|
|
1704
|
+
97,
|
|
1705
|
+
114,
|
|
1706
|
+
100,
|
|
1707
|
+
45,
|
|
1708
|
+
101,
|
|
1709
|
+
110,
|
|
1710
|
+
116,
|
|
1711
|
+
114,
|
|
1712
|
+
121
|
|
1713
|
+
]
|
|
1714
|
+
},
|
|
1715
|
+
{
|
|
1716
|
+
kind: "account",
|
|
1717
|
+
path: "reward_pool"
|
|
1718
|
+
},
|
|
1719
|
+
{
|
|
1720
|
+
kind: "account",
|
|
1721
|
+
path: "stake_entry"
|
|
1722
|
+
}
|
|
1723
|
+
]
|
|
1724
|
+
}
|
|
1725
|
+
},
|
|
1726
|
+
{
|
|
1727
|
+
name: "vault",
|
|
1728
|
+
docs: [
|
|
1729
|
+
"Reward Pool Vault that stores tokens"
|
|
1730
|
+
],
|
|
1731
|
+
writable: true,
|
|
1732
|
+
relations: [
|
|
1733
|
+
"reward_pool"
|
|
1734
|
+
]
|
|
1735
|
+
},
|
|
1736
|
+
{
|
|
1737
|
+
name: "stake_vault",
|
|
1738
|
+
writable: true
|
|
1739
|
+
},
|
|
1740
|
+
{
|
|
1741
|
+
name: "to",
|
|
1742
|
+
writable: true
|
|
1743
|
+
},
|
|
1744
|
+
{
|
|
1745
|
+
name: "stake_mint_from",
|
|
1746
|
+
writable: true
|
|
1747
|
+
},
|
|
1748
|
+
{
|
|
1749
|
+
name: "claimant",
|
|
1750
|
+
writable: true
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
name: "worker",
|
|
1754
|
+
docs: [
|
|
1755
|
+
"Auto unstake worker"
|
|
1756
|
+
],
|
|
1757
|
+
writable: true,
|
|
1758
|
+
signer: true,
|
|
1759
|
+
address: "wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u"
|
|
1760
|
+
},
|
|
1761
|
+
{
|
|
1762
|
+
name: "mint",
|
|
1763
|
+
docs: [
|
|
1764
|
+
"The mint to claim."
|
|
1765
|
+
],
|
|
1766
|
+
writable: true,
|
|
1767
|
+
relations: [
|
|
1768
|
+
"reward_pool"
|
|
1769
|
+
]
|
|
1770
|
+
},
|
|
1771
|
+
{
|
|
1772
|
+
name: "stake_mint",
|
|
1773
|
+
docs: [
|
|
1774
|
+
"Mint for sTokens issued by the stake pool"
|
|
1775
|
+
],
|
|
1776
|
+
writable: true
|
|
1777
|
+
},
|
|
1778
|
+
{
|
|
1779
|
+
name: "stake_pool_program",
|
|
1780
|
+
address: "STAKEvGqQTtzJZH6BWDcbpzXXn2BBerPAgQ3EGLN2GH"
|
|
1781
|
+
},
|
|
1782
|
+
{
|
|
1783
|
+
name: "associated_token_program",
|
|
1784
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
1785
|
+
},
|
|
1786
|
+
{
|
|
1787
|
+
name: "token_program"
|
|
1788
|
+
},
|
|
1789
|
+
{
|
|
1790
|
+
name: "system_program",
|
|
1791
|
+
address: "11111111111111111111111111111111"
|
|
1792
|
+
}
|
|
1793
|
+
],
|
|
1794
|
+
args: []
|
|
1795
|
+
},
|
|
1796
|
+
{
|
|
1797
|
+
name: "clawback",
|
|
1798
|
+
discriminator: [
|
|
1799
|
+
111,
|
|
1800
|
+
92,
|
|
1801
|
+
142,
|
|
1802
|
+
79,
|
|
1803
|
+
33,
|
|
1804
|
+
234,
|
|
1805
|
+
82,
|
|
1806
|
+
27
|
|
1807
|
+
],
|
|
1808
|
+
accounts: [
|
|
1809
|
+
{
|
|
1810
|
+
name: "reward_pool",
|
|
1811
|
+
docs: [
|
|
1812
|
+
"Reward Pool"
|
|
1813
|
+
],
|
|
1814
|
+
writable: true
|
|
1815
|
+
},
|
|
1816
|
+
{
|
|
1817
|
+
name: "stake_pool",
|
|
1818
|
+
docs: [
|
|
1819
|
+
"Stake Pool to Which Reward Pool belongs"
|
|
1820
|
+
],
|
|
1821
|
+
relations: [
|
|
1822
|
+
"reward_pool"
|
|
1823
|
+
]
|
|
1824
|
+
},
|
|
1825
|
+
{
|
|
1826
|
+
name: "vault",
|
|
1827
|
+
docs: [
|
|
1828
|
+
"Reward Pool Vault that stores tokens"
|
|
1829
|
+
],
|
|
1830
|
+
writable: true,
|
|
1831
|
+
relations: [
|
|
1832
|
+
"reward_pool"
|
|
1833
|
+
]
|
|
1834
|
+
},
|
|
1835
|
+
{
|
|
1836
|
+
name: "to",
|
|
1837
|
+
docs: [
|
|
1838
|
+
"Account to send the reward tokens to."
|
|
1839
|
+
],
|
|
1840
|
+
writable: true
|
|
1841
|
+
},
|
|
1842
|
+
{
|
|
1843
|
+
name: "authority",
|
|
1844
|
+
docs: [
|
|
1845
|
+
"Current Authority"
|
|
1846
|
+
],
|
|
1847
|
+
writable: true,
|
|
1848
|
+
signer: true,
|
|
1849
|
+
relations: [
|
|
1850
|
+
"reward_pool"
|
|
1851
|
+
]
|
|
1852
|
+
},
|
|
1853
|
+
{
|
|
1854
|
+
name: "mint",
|
|
1855
|
+
docs: [
|
|
1856
|
+
"The mint to claim."
|
|
1857
|
+
],
|
|
1858
|
+
relations: [
|
|
1859
|
+
"reward_pool"
|
|
1860
|
+
]
|
|
1861
|
+
},
|
|
1862
|
+
{
|
|
1863
|
+
name: "token_program"
|
|
1864
|
+
},
|
|
1865
|
+
{
|
|
1866
|
+
name: "system_program",
|
|
1867
|
+
address: "11111111111111111111111111111111"
|
|
1868
|
+
}
|
|
1869
|
+
],
|
|
1870
|
+
args: []
|
|
1871
|
+
},
|
|
719
1872
|
{
|
|
720
1873
|
name: "close_entry",
|
|
721
1874
|
discriminator: [
|
|
@@ -1481,7 +2634,7 @@ var reward_pool_default = {
|
|
|
1481
2634
|
{
|
|
1482
2635
|
code: 6002,
|
|
1483
2636
|
name: "InvalidRewardPeriod",
|
|
1484
|
-
msg: "Reward period should be more than 0"
|
|
2637
|
+
msg: "Reward period should be more than 0 and less or equal than staking duration if auto unstake is enabled"
|
|
1485
2638
|
},
|
|
1486
2639
|
{
|
|
1487
2640
|
code: 6003,
|
|
@@ -1542,6 +2695,36 @@ var reward_pool_default = {
|
|
|
1542
2695
|
code: 6014,
|
|
1543
2696
|
name: "InvalidLastClaimPeriod",
|
|
1544
2697
|
msg: "Invalid last claim period provided"
|
|
2698
|
+
},
|
|
2699
|
+
{
|
|
2700
|
+
code: 6015,
|
|
2701
|
+
name: "ClawbackNotPossible",
|
|
2702
|
+
msg: "Clawback is not possible for the provided Stake Pool"
|
|
2703
|
+
},
|
|
2704
|
+
{
|
|
2705
|
+
code: 6016,
|
|
2706
|
+
name: "ClawbackTooEarly",
|
|
2707
|
+
msg: "Clawback requested too early, wait for the Pool to expire and cooldown to pass"
|
|
2708
|
+
},
|
|
2709
|
+
{
|
|
2710
|
+
code: 6017,
|
|
2711
|
+
name: "UpdateNotPossible",
|
|
2712
|
+
msg: "Reward pool can not be updated"
|
|
2713
|
+
},
|
|
2714
|
+
{
|
|
2715
|
+
code: 6018,
|
|
2716
|
+
name: "EntryCreationNotPossibleAfterUnlock",
|
|
2717
|
+
msg: "Reward entry can not be created after stake has been unlocked for this reward pool"
|
|
2718
|
+
},
|
|
2719
|
+
{
|
|
2720
|
+
code: 6019,
|
|
2721
|
+
name: "RefundNotPossible",
|
|
2722
|
+
msg: "Refund not possible for this reward entry"
|
|
2723
|
+
},
|
|
2724
|
+
{
|
|
2725
|
+
code: 6020,
|
|
2726
|
+
name: "PoolCreationLimited",
|
|
2727
|
+
msg: "Pool creation limited, use nonce 0"
|
|
1545
2728
|
}
|
|
1546
2729
|
],
|
|
1547
2730
|
types: [
|
|
@@ -1844,6 +3027,13 @@ var reward_pool_default = {
|
|
|
1844
3027
|
],
|
|
1845
3028
|
type: "u64"
|
|
1846
3029
|
},
|
|
3030
|
+
{
|
|
3031
|
+
name: "clawed_back_ts",
|
|
3032
|
+
docs: [
|
|
3033
|
+
"Timestamp when reward pool was clawed back"
|
|
3034
|
+
],
|
|
3035
|
+
type: "u64"
|
|
3036
|
+
},
|
|
1847
3037
|
{
|
|
1848
3038
|
name: "_buffer",
|
|
1849
3039
|
docs: [
|
|
@@ -1852,7 +3042,7 @@ var reward_pool_default = {
|
|
|
1852
3042
|
type: {
|
|
1853
3043
|
array: [
|
|
1854
3044
|
"u8",
|
|
1855
|
-
|
|
3045
|
+
40
|
|
1856
3046
|
]
|
|
1857
3047
|
}
|
|
1858
3048
|
}
|
|
@@ -1948,6 +3138,13 @@ var reward_pool_default = {
|
|
|
1948
3138
|
],
|
|
1949
3139
|
type: "bool"
|
|
1950
3140
|
},
|
|
3141
|
+
{
|
|
3142
|
+
name: "auto_unstake",
|
|
3143
|
+
docs: [
|
|
3144
|
+
"Whether auto unstaking is enabled, copied from the stake pool for use in instructions that don't require the stake pool account"
|
|
3145
|
+
],
|
|
3146
|
+
type: "bool"
|
|
3147
|
+
},
|
|
1951
3148
|
{
|
|
1952
3149
|
name: "_buffer",
|
|
1953
3150
|
docs: [
|
|
@@ -1956,7 +3153,7 @@ var reward_pool_default = {
|
|
|
1956
3153
|
type: {
|
|
1957
3154
|
array: [
|
|
1958
3155
|
"u8",
|
|
1959
|
-
|
|
3156
|
+
38
|
|
1960
3157
|
]
|
|
1961
3158
|
}
|
|
1962
3159
|
}
|
|
@@ -2087,6 +3284,34 @@ var reward_pool_default = {
|
|
|
2087
3284
|
],
|
|
2088
3285
|
type: "u64"
|
|
2089
3286
|
},
|
|
3287
|
+
{
|
|
3288
|
+
name: "total_stake_capped",
|
|
3289
|
+
docs: [
|
|
3290
|
+
"Whether amount of total staked tokens is limited by `remaining_total_stake` - stored as separate flag to not deal with `Option`"
|
|
3291
|
+
],
|
|
3292
|
+
type: "bool"
|
|
3293
|
+
},
|
|
3294
|
+
{
|
|
3295
|
+
name: "remaining_total_stake",
|
|
3296
|
+
docs: [
|
|
3297
|
+
"Remaining total amount of staked tokens (cumulative)"
|
|
3298
|
+
],
|
|
3299
|
+
type: "u64"
|
|
3300
|
+
},
|
|
3301
|
+
{
|
|
3302
|
+
name: "expiry_ts",
|
|
3303
|
+
docs: [
|
|
3304
|
+
"Time when stake pool expires, staking is not possible after expiration"
|
|
3305
|
+
],
|
|
3306
|
+
type: "u64"
|
|
3307
|
+
},
|
|
3308
|
+
{
|
|
3309
|
+
name: "auto_unstake",
|
|
3310
|
+
docs: [
|
|
3311
|
+
"Whether auto unstaking is enabled, stake entries will be unstaked after duration"
|
|
3312
|
+
],
|
|
3313
|
+
type: "bool"
|
|
3314
|
+
},
|
|
2090
3315
|
{
|
|
2091
3316
|
name: "_buffer",
|
|
2092
3317
|
docs: [
|
|
@@ -2095,7 +3320,7 @@ var reward_pool_default = {
|
|
|
2095
3320
|
type: {
|
|
2096
3321
|
array: [
|
|
2097
3322
|
"u8",
|
|
2098
|
-
|
|
3323
|
+
37
|
|
2099
3324
|
]
|
|
2100
3325
|
}
|
|
2101
3326
|
}
|
|
@@ -2110,7 +3335,7 @@ var reward_pool_dynamic_default = {
|
|
|
2110
3335
|
address: "RWRDyfZa6Rk9UYi85yjYYfGmoUqffLqjo6vZdFawEez",
|
|
2111
3336
|
metadata: {
|
|
2112
3337
|
name: "reward_pool_dynamic",
|
|
2113
|
-
version: "2.
|
|
3338
|
+
version: "2.3.0",
|
|
2114
3339
|
spec: "0.1.0",
|
|
2115
3340
|
description: "Reward pools with dynamic rewards distribution"
|
|
2116
3341
|
},
|
|
@@ -3623,6 +4848,13 @@ var reward_pool_dynamic_default = {
|
|
|
3623
4848
|
],
|
|
3624
4849
|
type: "bool"
|
|
3625
4850
|
},
|
|
4851
|
+
{
|
|
4852
|
+
name: "auto_unstake",
|
|
4853
|
+
docs: [
|
|
4854
|
+
"Whether auto unstaking is enabled, copied from the stake pool for use in instructions that don't require the stake pool account"
|
|
4855
|
+
],
|
|
4856
|
+
type: "bool"
|
|
4857
|
+
},
|
|
3626
4858
|
{
|
|
3627
4859
|
name: "_buffer",
|
|
3628
4860
|
docs: [
|
|
@@ -3631,7 +4863,7 @@ var reward_pool_dynamic_default = {
|
|
|
3631
4863
|
type: {
|
|
3632
4864
|
array: [
|
|
3633
4865
|
"u8",
|
|
3634
|
-
|
|
4866
|
+
38
|
|
3635
4867
|
]
|
|
3636
4868
|
}
|
|
3637
4869
|
}
|
|
@@ -3762,6 +4994,34 @@ var reward_pool_dynamic_default = {
|
|
|
3762
4994
|
],
|
|
3763
4995
|
type: "u64"
|
|
3764
4996
|
},
|
|
4997
|
+
{
|
|
4998
|
+
name: "total_stake_capped",
|
|
4999
|
+
docs: [
|
|
5000
|
+
"Whether amount of total staked tokens is limited by `remaining_total_stake` - stored as separate flag to not deal with `Option`"
|
|
5001
|
+
],
|
|
5002
|
+
type: "bool"
|
|
5003
|
+
},
|
|
5004
|
+
{
|
|
5005
|
+
name: "remaining_total_stake",
|
|
5006
|
+
docs: [
|
|
5007
|
+
"Remaining total amount of staked tokens (cumulative)"
|
|
5008
|
+
],
|
|
5009
|
+
type: "u64"
|
|
5010
|
+
},
|
|
5011
|
+
{
|
|
5012
|
+
name: "expiry_ts",
|
|
5013
|
+
docs: [
|
|
5014
|
+
"Time when stake pool expires, staking is not possible after expiration"
|
|
5015
|
+
],
|
|
5016
|
+
type: "u64"
|
|
5017
|
+
},
|
|
5018
|
+
{
|
|
5019
|
+
name: "auto_unstake",
|
|
5020
|
+
docs: [
|
|
5021
|
+
"Whether auto unstaking is enabled, stake entries will be unstaked after duration"
|
|
5022
|
+
],
|
|
5023
|
+
type: "bool"
|
|
5024
|
+
},
|
|
3765
5025
|
{
|
|
3766
5026
|
name: "_buffer",
|
|
3767
5027
|
docs: [
|
|
@@ -3770,7 +5030,7 @@ var reward_pool_dynamic_default = {
|
|
|
3770
5030
|
type: {
|
|
3771
5031
|
array: [
|
|
3772
5032
|
"u8",
|
|
3773
|
-
|
|
5033
|
+
37
|
|
3774
5034
|
]
|
|
3775
5035
|
}
|
|
3776
5036
|
}
|
|
@@ -3810,6 +5070,13 @@ var reward_pool_dynamic_default = {
|
|
|
3810
5070
|
],
|
|
3811
5071
|
type: "u64"
|
|
3812
5072
|
},
|
|
5073
|
+
{
|
|
5074
|
+
name: "is_sponsored",
|
|
5075
|
+
docs: [
|
|
5076
|
+
"Whether the vote rent has been sponsored by the rent vault"
|
|
5077
|
+
],
|
|
5078
|
+
type: "bool"
|
|
5079
|
+
},
|
|
3813
5080
|
{
|
|
3814
5081
|
name: "_buffer",
|
|
3815
5082
|
docs: [
|
|
@@ -3818,7 +5085,7 @@ var reward_pool_dynamic_default = {
|
|
|
3818
5085
|
type: {
|
|
3819
5086
|
array: [
|
|
3820
5087
|
"u8",
|
|
3821
|
-
|
|
5088
|
+
63
|
|
3822
5089
|
]
|
|
3823
5090
|
}
|
|
3824
5091
|
}
|
|
@@ -3833,7 +5100,7 @@ var stake_pool_default = {
|
|
|
3833
5100
|
address: "STAKEvGqQTtzJZH6BWDcbpzXXn2BBerPAgQ3EGLN2GH",
|
|
3834
5101
|
metadata: {
|
|
3835
5102
|
name: "stake_pool",
|
|
3836
|
-
version: "2.
|
|
5103
|
+
version: "2.3.0",
|
|
3837
5104
|
spec: "0.1.0",
|
|
3838
5105
|
description: "Program to manage Stake Pools and stake/unstake tokens"
|
|
3839
5106
|
},
|
|
@@ -4188,6 +5455,174 @@ var stake_pool_default = {
|
|
|
4188
5455
|
}
|
|
4189
5456
|
]
|
|
4190
5457
|
},
|
|
5458
|
+
{
|
|
5459
|
+
name: "create_pool_v2",
|
|
5460
|
+
discriminator: [
|
|
5461
|
+
133,
|
|
5462
|
+
27,
|
|
5463
|
+
21,
|
|
5464
|
+
38,
|
|
5465
|
+
67,
|
|
5466
|
+
86,
|
|
5467
|
+
91,
|
|
5468
|
+
132
|
|
5469
|
+
],
|
|
5470
|
+
accounts: [
|
|
5471
|
+
{
|
|
5472
|
+
name: "stake_pool",
|
|
5473
|
+
writable: true,
|
|
5474
|
+
pda: {
|
|
5475
|
+
seeds: [
|
|
5476
|
+
{
|
|
5477
|
+
kind: "const",
|
|
5478
|
+
value: [
|
|
5479
|
+
115,
|
|
5480
|
+
116,
|
|
5481
|
+
97,
|
|
5482
|
+
107,
|
|
5483
|
+
101,
|
|
5484
|
+
45,
|
|
5485
|
+
112,
|
|
5486
|
+
111,
|
|
5487
|
+
111,
|
|
5488
|
+
108
|
|
5489
|
+
]
|
|
5490
|
+
},
|
|
5491
|
+
{
|
|
5492
|
+
kind: "account",
|
|
5493
|
+
path: "mint"
|
|
5494
|
+
},
|
|
5495
|
+
{
|
|
5496
|
+
kind: "account",
|
|
5497
|
+
path: "creator"
|
|
5498
|
+
},
|
|
5499
|
+
{
|
|
5500
|
+
kind: "arg",
|
|
5501
|
+
path: "nonce"
|
|
5502
|
+
}
|
|
5503
|
+
]
|
|
5504
|
+
}
|
|
5505
|
+
},
|
|
5506
|
+
{
|
|
5507
|
+
name: "mint",
|
|
5508
|
+
docs: [
|
|
5509
|
+
"Mint used for staking"
|
|
5510
|
+
]
|
|
5511
|
+
},
|
|
5512
|
+
{
|
|
5513
|
+
name: "vault",
|
|
5514
|
+
writable: true,
|
|
5515
|
+
pda: {
|
|
5516
|
+
seeds: [
|
|
5517
|
+
{
|
|
5518
|
+
kind: "const",
|
|
5519
|
+
value: [
|
|
5520
|
+
115,
|
|
5521
|
+
116,
|
|
5522
|
+
97,
|
|
5523
|
+
107,
|
|
5524
|
+
101,
|
|
5525
|
+
45,
|
|
5526
|
+
118,
|
|
5527
|
+
97,
|
|
5528
|
+
117,
|
|
5529
|
+
108,
|
|
5530
|
+
116
|
|
5531
|
+
]
|
|
5532
|
+
},
|
|
5533
|
+
{
|
|
5534
|
+
kind: "account",
|
|
5535
|
+
path: "stake_pool"
|
|
5536
|
+
}
|
|
5537
|
+
]
|
|
5538
|
+
}
|
|
5539
|
+
},
|
|
5540
|
+
{
|
|
5541
|
+
name: "stake_mint",
|
|
5542
|
+
writable: true,
|
|
5543
|
+
pda: {
|
|
5544
|
+
seeds: [
|
|
5545
|
+
{
|
|
5546
|
+
kind: "const",
|
|
5547
|
+
value: [
|
|
5548
|
+
115,
|
|
5549
|
+
116,
|
|
5550
|
+
97,
|
|
5551
|
+
107,
|
|
5552
|
+
101,
|
|
5553
|
+
45,
|
|
5554
|
+
109,
|
|
5555
|
+
105,
|
|
5556
|
+
110,
|
|
5557
|
+
116
|
|
5558
|
+
]
|
|
5559
|
+
},
|
|
5560
|
+
{
|
|
5561
|
+
kind: "account",
|
|
5562
|
+
path: "stake_pool"
|
|
5563
|
+
}
|
|
5564
|
+
]
|
|
5565
|
+
}
|
|
5566
|
+
},
|
|
5567
|
+
{
|
|
5568
|
+
name: "creator",
|
|
5569
|
+
docs: [
|
|
5570
|
+
"Stake Pool creator"
|
|
5571
|
+
],
|
|
5572
|
+
writable: true,
|
|
5573
|
+
signer: true
|
|
5574
|
+
},
|
|
5575
|
+
{
|
|
5576
|
+
name: "token_program"
|
|
5577
|
+
},
|
|
5578
|
+
{
|
|
5579
|
+
name: "system_program",
|
|
5580
|
+
address: "11111111111111111111111111111111"
|
|
5581
|
+
}
|
|
5582
|
+
],
|
|
5583
|
+
args: [
|
|
5584
|
+
{
|
|
5585
|
+
name: "nonce",
|
|
5586
|
+
type: "u8"
|
|
5587
|
+
},
|
|
5588
|
+
{
|
|
5589
|
+
name: "max_weight",
|
|
5590
|
+
type: "u64"
|
|
5591
|
+
},
|
|
5592
|
+
{
|
|
5593
|
+
name: "min_duration",
|
|
5594
|
+
type: "u64"
|
|
5595
|
+
},
|
|
5596
|
+
{
|
|
5597
|
+
name: "max_duration",
|
|
5598
|
+
type: "u64"
|
|
5599
|
+
},
|
|
5600
|
+
{
|
|
5601
|
+
name: "permissionless",
|
|
5602
|
+
type: "bool"
|
|
5603
|
+
},
|
|
5604
|
+
{
|
|
5605
|
+
name: "freeze_stake_mint",
|
|
5606
|
+
type: "bool"
|
|
5607
|
+
},
|
|
5608
|
+
{
|
|
5609
|
+
name: "unstake_period",
|
|
5610
|
+
type: "u64"
|
|
5611
|
+
},
|
|
5612
|
+
{
|
|
5613
|
+
name: "max_total_stake_cumulative",
|
|
5614
|
+
type: "u64"
|
|
5615
|
+
},
|
|
5616
|
+
{
|
|
5617
|
+
name: "expiry_ts",
|
|
5618
|
+
type: "u64"
|
|
5619
|
+
},
|
|
5620
|
+
{
|
|
5621
|
+
name: "auto_unstake",
|
|
5622
|
+
type: "bool"
|
|
5623
|
+
}
|
|
5624
|
+
]
|
|
5625
|
+
},
|
|
4191
5626
|
{
|
|
4192
5627
|
name: "migrate_entry",
|
|
4193
5628
|
discriminator: [
|
|
@@ -4647,7 +6082,60 @@ var stake_pool_default = {
|
|
|
4647
6082
|
docs: [
|
|
4648
6083
|
"Token Account to transfer Stake Mint tokens to"
|
|
4649
6084
|
],
|
|
4650
|
-
writable: true
|
|
6085
|
+
writable: true,
|
|
6086
|
+
pda: {
|
|
6087
|
+
seeds: [
|
|
6088
|
+
{
|
|
6089
|
+
kind: "account",
|
|
6090
|
+
path: "authority"
|
|
6091
|
+
},
|
|
6092
|
+
{
|
|
6093
|
+
kind: "account",
|
|
6094
|
+
path: "token_program"
|
|
6095
|
+
},
|
|
6096
|
+
{
|
|
6097
|
+
kind: "account",
|
|
6098
|
+
path: "stake_mint"
|
|
6099
|
+
}
|
|
6100
|
+
],
|
|
6101
|
+
program: {
|
|
6102
|
+
kind: "const",
|
|
6103
|
+
value: [
|
|
6104
|
+
140,
|
|
6105
|
+
151,
|
|
6106
|
+
37,
|
|
6107
|
+
143,
|
|
6108
|
+
78,
|
|
6109
|
+
36,
|
|
6110
|
+
137,
|
|
6111
|
+
241,
|
|
6112
|
+
187,
|
|
6113
|
+
61,
|
|
6114
|
+
16,
|
|
6115
|
+
41,
|
|
6116
|
+
20,
|
|
6117
|
+
142,
|
|
6118
|
+
13,
|
|
6119
|
+
131,
|
|
6120
|
+
11,
|
|
6121
|
+
90,
|
|
6122
|
+
19,
|
|
6123
|
+
153,
|
|
6124
|
+
218,
|
|
6125
|
+
255,
|
|
6126
|
+
16,
|
|
6127
|
+
132,
|
|
6128
|
+
4,
|
|
6129
|
+
142,
|
|
6130
|
+
123,
|
|
6131
|
+
216,
|
|
6132
|
+
219,
|
|
6133
|
+
233,
|
|
6134
|
+
248,
|
|
6135
|
+
89
|
|
6136
|
+
]
|
|
6137
|
+
}
|
|
6138
|
+
}
|
|
4651
6139
|
},
|
|
4652
6140
|
{
|
|
4653
6141
|
name: "payer",
|
|
@@ -4760,7 +6248,60 @@ var stake_pool_default = {
|
|
|
4760
6248
|
docs: [
|
|
4761
6249
|
"Stake Mint Token account"
|
|
4762
6250
|
],
|
|
4763
|
-
writable: true
|
|
6251
|
+
writable: true,
|
|
6252
|
+
pda: {
|
|
6253
|
+
seeds: [
|
|
6254
|
+
{
|
|
6255
|
+
kind: "account",
|
|
6256
|
+
path: "authority"
|
|
6257
|
+
},
|
|
6258
|
+
{
|
|
6259
|
+
kind: "account",
|
|
6260
|
+
path: "token_program"
|
|
6261
|
+
},
|
|
6262
|
+
{
|
|
6263
|
+
kind: "account",
|
|
6264
|
+
path: "stake_mint"
|
|
6265
|
+
}
|
|
6266
|
+
],
|
|
6267
|
+
program: {
|
|
6268
|
+
kind: "const",
|
|
6269
|
+
value: [
|
|
6270
|
+
140,
|
|
6271
|
+
151,
|
|
6272
|
+
37,
|
|
6273
|
+
143,
|
|
6274
|
+
78,
|
|
6275
|
+
36,
|
|
6276
|
+
137,
|
|
6277
|
+
241,
|
|
6278
|
+
187,
|
|
6279
|
+
61,
|
|
6280
|
+
16,
|
|
6281
|
+
41,
|
|
6282
|
+
20,
|
|
6283
|
+
142,
|
|
6284
|
+
13,
|
|
6285
|
+
131,
|
|
6286
|
+
11,
|
|
6287
|
+
90,
|
|
6288
|
+
19,
|
|
6289
|
+
153,
|
|
6290
|
+
218,
|
|
6291
|
+
255,
|
|
6292
|
+
16,
|
|
6293
|
+
132,
|
|
6294
|
+
4,
|
|
6295
|
+
142,
|
|
6296
|
+
123,
|
|
6297
|
+
216,
|
|
6298
|
+
219,
|
|
6299
|
+
233,
|
|
6300
|
+
248,
|
|
6301
|
+
89
|
|
6302
|
+
]
|
|
6303
|
+
}
|
|
6304
|
+
}
|
|
4764
6305
|
},
|
|
4765
6306
|
{
|
|
4766
6307
|
name: "vault",
|
|
@@ -4844,6 +6385,154 @@ var stake_pool_default = {
|
|
|
4844
6385
|
}
|
|
4845
6386
|
}
|
|
4846
6387
|
]
|
|
6388
|
+
},
|
|
6389
|
+
{
|
|
6390
|
+
name: "unstake_as_worker",
|
|
6391
|
+
discriminator: [
|
|
6392
|
+
18,
|
|
6393
|
+
36,
|
|
6394
|
+
224,
|
|
6395
|
+
241,
|
|
6396
|
+
46,
|
|
6397
|
+
185,
|
|
6398
|
+
228,
|
|
6399
|
+
142
|
|
6400
|
+
],
|
|
6401
|
+
accounts: [
|
|
6402
|
+
{
|
|
6403
|
+
name: "stake_pool",
|
|
6404
|
+
writable: true,
|
|
6405
|
+
relations: [
|
|
6406
|
+
"stake_entry"
|
|
6407
|
+
]
|
|
6408
|
+
},
|
|
6409
|
+
{
|
|
6410
|
+
name: "stake_entry",
|
|
6411
|
+
docs: [
|
|
6412
|
+
"Entry that stores Stake Metadata"
|
|
6413
|
+
],
|
|
6414
|
+
writable: true
|
|
6415
|
+
},
|
|
6416
|
+
{
|
|
6417
|
+
name: "from",
|
|
6418
|
+
docs: [
|
|
6419
|
+
"Stake Mint Token account"
|
|
6420
|
+
],
|
|
6421
|
+
writable: true,
|
|
6422
|
+
pda: {
|
|
6423
|
+
seeds: [
|
|
6424
|
+
{
|
|
6425
|
+
kind: "account",
|
|
6426
|
+
path: "authority"
|
|
6427
|
+
},
|
|
6428
|
+
{
|
|
6429
|
+
kind: "account",
|
|
6430
|
+
path: "token_program"
|
|
6431
|
+
},
|
|
6432
|
+
{
|
|
6433
|
+
kind: "account",
|
|
6434
|
+
path: "stake_mint"
|
|
6435
|
+
}
|
|
6436
|
+
],
|
|
6437
|
+
program: {
|
|
6438
|
+
kind: "const",
|
|
6439
|
+
value: [
|
|
6440
|
+
140,
|
|
6441
|
+
151,
|
|
6442
|
+
37,
|
|
6443
|
+
143,
|
|
6444
|
+
78,
|
|
6445
|
+
36,
|
|
6446
|
+
137,
|
|
6447
|
+
241,
|
|
6448
|
+
187,
|
|
6449
|
+
61,
|
|
6450
|
+
16,
|
|
6451
|
+
41,
|
|
6452
|
+
20,
|
|
6453
|
+
142,
|
|
6454
|
+
13,
|
|
6455
|
+
131,
|
|
6456
|
+
11,
|
|
6457
|
+
90,
|
|
6458
|
+
19,
|
|
6459
|
+
153,
|
|
6460
|
+
218,
|
|
6461
|
+
255,
|
|
6462
|
+
16,
|
|
6463
|
+
132,
|
|
6464
|
+
4,
|
|
6465
|
+
142,
|
|
6466
|
+
123,
|
|
6467
|
+
216,
|
|
6468
|
+
219,
|
|
6469
|
+
233,
|
|
6470
|
+
248,
|
|
6471
|
+
89
|
|
6472
|
+
]
|
|
6473
|
+
}
|
|
6474
|
+
}
|
|
6475
|
+
},
|
|
6476
|
+
{
|
|
6477
|
+
name: "vault",
|
|
6478
|
+
docs: [
|
|
6479
|
+
"Escrow Account that stores Staked tokens"
|
|
6480
|
+
],
|
|
6481
|
+
writable: true,
|
|
6482
|
+
relations: [
|
|
6483
|
+
"stake_pool"
|
|
6484
|
+
]
|
|
6485
|
+
},
|
|
6486
|
+
{
|
|
6487
|
+
name: "to",
|
|
6488
|
+
writable: true
|
|
6489
|
+
},
|
|
6490
|
+
{
|
|
6491
|
+
name: "authority",
|
|
6492
|
+
writable: true
|
|
6493
|
+
},
|
|
6494
|
+
{
|
|
6495
|
+
name: "worker",
|
|
6496
|
+
docs: [
|
|
6497
|
+
"Auto unstake worker"
|
|
6498
|
+
],
|
|
6499
|
+
writable: true,
|
|
6500
|
+
signer: true,
|
|
6501
|
+
address: "wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u"
|
|
6502
|
+
},
|
|
6503
|
+
{
|
|
6504
|
+
name: "mint",
|
|
6505
|
+
docs: [
|
|
6506
|
+
"Original mint of staked tokens"
|
|
6507
|
+
],
|
|
6508
|
+
writable: true,
|
|
6509
|
+
relations: [
|
|
6510
|
+
"stake_pool"
|
|
6511
|
+
]
|
|
6512
|
+
},
|
|
6513
|
+
{
|
|
6514
|
+
name: "stake_mint",
|
|
6515
|
+
docs: [
|
|
6516
|
+
"Stake Mint used to exchanged Staked tokens to"
|
|
6517
|
+
],
|
|
6518
|
+
writable: true,
|
|
6519
|
+
relations: [
|
|
6520
|
+
"stake_pool"
|
|
6521
|
+
]
|
|
6522
|
+
},
|
|
6523
|
+
{
|
|
6524
|
+
name: "associated_token_program",
|
|
6525
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
6526
|
+
},
|
|
6527
|
+
{
|
|
6528
|
+
name: "token_program"
|
|
6529
|
+
},
|
|
6530
|
+
{
|
|
6531
|
+
name: "system_program",
|
|
6532
|
+
address: "11111111111111111111111111111111"
|
|
6533
|
+
}
|
|
6534
|
+
],
|
|
6535
|
+
args: []
|
|
4847
6536
|
}
|
|
4848
6537
|
],
|
|
4849
6538
|
accounts: [
|
|
@@ -4891,7 +6580,7 @@ var stake_pool_default = {
|
|
|
4891
6580
|
{
|
|
4892
6581
|
code: 6e3,
|
|
4893
6582
|
name: "InvalidDuration",
|
|
4894
|
-
msg: "Minimum duration must be less than the maximum"
|
|
6583
|
+
msg: "Minimum duration must be less than the maximum, maximum should be a realistic number of seconds"
|
|
4895
6584
|
},
|
|
4896
6585
|
{
|
|
4897
6586
|
code: 6001,
|
|
@@ -4986,7 +6675,42 @@ var stake_pool_default = {
|
|
|
4986
6675
|
{
|
|
4987
6676
|
code: 6019,
|
|
4988
6677
|
name: "InvalidMinDuration",
|
|
4989
|
-
msg: "Minimum duration should be at least 1"
|
|
6678
|
+
msg: "Minimum duration should be at least 1, for auto-unstake 7 days at least"
|
|
6679
|
+
},
|
|
6680
|
+
{
|
|
6681
|
+
code: 6020,
|
|
6682
|
+
name: "AutoUnstakeNotPossible",
|
|
6683
|
+
msg: "Auto unstake is not possible with unstake period or with a permissionless pool"
|
|
6684
|
+
},
|
|
6685
|
+
{
|
|
6686
|
+
code: 6021,
|
|
6687
|
+
name: "InvalidExpiry",
|
|
6688
|
+
msg: "Expiry can not be less than max duration"
|
|
6689
|
+
},
|
|
6690
|
+
{
|
|
6691
|
+
code: 6022,
|
|
6692
|
+
name: "StakePayerNotSupported",
|
|
6693
|
+
msg: "Separate payer account is not supported when staking in a pool with auto-unstake"
|
|
6694
|
+
},
|
|
6695
|
+
{
|
|
6696
|
+
code: 6023,
|
|
6697
|
+
name: "StakeAmountExceedsMax",
|
|
6698
|
+
msg: "Stake amount exceeds max total stake"
|
|
6699
|
+
},
|
|
6700
|
+
{
|
|
6701
|
+
code: 6024,
|
|
6702
|
+
name: "StakeDurationExceedsExpiry",
|
|
6703
|
+
msg: "Stake duration exceeds stake pool expiry"
|
|
6704
|
+
},
|
|
6705
|
+
{
|
|
6706
|
+
code: 6025,
|
|
6707
|
+
name: "AccountDelegateRevoked",
|
|
6708
|
+
msg: "Token account delegate has been revoked by staker, can't burn tokens"
|
|
6709
|
+
},
|
|
6710
|
+
{
|
|
6711
|
+
code: 6026,
|
|
6712
|
+
name: "RefundNotPossible",
|
|
6713
|
+
msg: "Refund not possible for this stake entry"
|
|
4990
6714
|
}
|
|
4991
6715
|
],
|
|
4992
6716
|
types: [
|
|
@@ -5127,6 +6851,13 @@ var stake_pool_default = {
|
|
|
5127
6851
|
],
|
|
5128
6852
|
type: "bool"
|
|
5129
6853
|
},
|
|
6854
|
+
{
|
|
6855
|
+
name: "auto_unstake",
|
|
6856
|
+
docs: [
|
|
6857
|
+
"Whether auto unstaking is enabled, copied from the stake pool for use in instructions that don't require the stake pool account"
|
|
6858
|
+
],
|
|
6859
|
+
type: "bool"
|
|
6860
|
+
},
|
|
5130
6861
|
{
|
|
5131
6862
|
name: "_buffer",
|
|
5132
6863
|
docs: [
|
|
@@ -5135,7 +6866,7 @@ var stake_pool_default = {
|
|
|
5135
6866
|
type: {
|
|
5136
6867
|
array: [
|
|
5137
6868
|
"u8",
|
|
5138
|
-
|
|
6869
|
+
38
|
|
5139
6870
|
]
|
|
5140
6871
|
}
|
|
5141
6872
|
}
|
|
@@ -5266,6 +6997,34 @@ var stake_pool_default = {
|
|
|
5266
6997
|
],
|
|
5267
6998
|
type: "u64"
|
|
5268
6999
|
},
|
|
7000
|
+
{
|
|
7001
|
+
name: "total_stake_capped",
|
|
7002
|
+
docs: [
|
|
7003
|
+
"Whether amount of total staked tokens is limited by `remaining_total_stake` - stored as separate flag to not deal with `Option`"
|
|
7004
|
+
],
|
|
7005
|
+
type: "bool"
|
|
7006
|
+
},
|
|
7007
|
+
{
|
|
7008
|
+
name: "remaining_total_stake",
|
|
7009
|
+
docs: [
|
|
7010
|
+
"Remaining total amount of staked tokens (cumulative)"
|
|
7011
|
+
],
|
|
7012
|
+
type: "u64"
|
|
7013
|
+
},
|
|
7014
|
+
{
|
|
7015
|
+
name: "expiry_ts",
|
|
7016
|
+
docs: [
|
|
7017
|
+
"Time when stake pool expires, staking is not possible after expiration"
|
|
7018
|
+
],
|
|
7019
|
+
type: "u64"
|
|
7020
|
+
},
|
|
7021
|
+
{
|
|
7022
|
+
name: "auto_unstake",
|
|
7023
|
+
docs: [
|
|
7024
|
+
"Whether auto unstaking is enabled, stake entries will be unstaked after duration"
|
|
7025
|
+
],
|
|
7026
|
+
type: "bool"
|
|
7027
|
+
},
|
|
5269
7028
|
{
|
|
5270
7029
|
name: "_buffer",
|
|
5271
7030
|
docs: [
|
|
@@ -5274,7 +7033,7 @@ var stake_pool_default = {
|
|
|
5274
7033
|
type: {
|
|
5275
7034
|
array: [
|
|
5276
7035
|
"u8",
|
|
5277
|
-
|
|
7036
|
+
37
|
|
5278
7037
|
]
|
|
5279
7038
|
}
|
|
5280
7039
|
}
|
|
@@ -5285,7 +7044,7 @@ var stake_pool_default = {
|
|
|
5285
7044
|
};
|
|
5286
7045
|
var deriveStakePoolPDA = (programId, mint, authority, nonce) => {
|
|
5287
7046
|
return PublicKey.findProgramAddressSync(
|
|
5288
|
-
[STAKE_POOL_PREFIX, mint.toBuffer(), authority.toBuffer(), new
|
|
7047
|
+
[STAKE_POOL_PREFIX, mint.toBuffer(), authority.toBuffer(), new BN4(nonce).toArrayLike(Buffer, "le", 1)],
|
|
5289
7048
|
programId
|
|
5290
7049
|
)[0];
|
|
5291
7050
|
};
|
|
@@ -5297,13 +7056,13 @@ var deriveStakeMintPDA = (programId, stakePool) => {
|
|
|
5297
7056
|
};
|
|
5298
7057
|
var deriveStakeEntryPDA = (programId, stakePool, authority, nonce) => {
|
|
5299
7058
|
return PublicKey.findProgramAddressSync(
|
|
5300
|
-
[STAKE_ENTRY_PREFIX, stakePool.toBuffer(), authority.toBuffer(), new
|
|
7059
|
+
[STAKE_ENTRY_PREFIX, stakePool.toBuffer(), authority.toBuffer(), new BN4(nonce).toArrayLike(Buffer, "le", 4)],
|
|
5301
7060
|
programId
|
|
5302
7061
|
)[0];
|
|
5303
7062
|
};
|
|
5304
7063
|
var deriveRewardPoolPDA = (programId, stakePool, mint, nonce) => {
|
|
5305
7064
|
return PublicKey.findProgramAddressSync(
|
|
5306
|
-
[REWARD_POOL_PREFIX, stakePool.toBuffer(), mint.toBuffer(), new
|
|
7065
|
+
[REWARD_POOL_PREFIX, stakePool.toBuffer(), mint.toBuffer(), new BN4(nonce).toArrayLike(Buffer, "le", 1)],
|
|
5307
7066
|
programId
|
|
5308
7067
|
)[0];
|
|
5309
7068
|
};
|
|
@@ -5356,6 +7115,10 @@ var SolanaStakingClient = class {
|
|
|
5356
7115
|
...fee_manager_default,
|
|
5357
7116
|
address: programIds?.feeManager ?? fee_manager_default.address
|
|
5358
7117
|
};
|
|
7118
|
+
const governorIdl = {
|
|
7119
|
+
...governor_default,
|
|
7120
|
+
address: programIds?.governor ?? governor_default.address
|
|
7121
|
+
};
|
|
5359
7122
|
this.programs = {
|
|
5360
7123
|
stakePoolProgram: new Program(stakePoolIdl, {
|
|
5361
7124
|
connection: this.connection
|
|
@@ -5368,6 +7131,9 @@ var SolanaStakingClient = class {
|
|
|
5368
7131
|
}),
|
|
5369
7132
|
feeManagerProgram: new Program(feeManagerIdl, {
|
|
5370
7133
|
connection: this.connection
|
|
7134
|
+
}),
|
|
7135
|
+
governor: new Program(governorIdl, {
|
|
7136
|
+
connection: this.connection
|
|
5371
7137
|
})
|
|
5372
7138
|
};
|
|
5373
7139
|
}
|
|
@@ -5437,13 +7203,36 @@ var SolanaStakingClient = class {
|
|
|
5437
7203
|
permissionless = false,
|
|
5438
7204
|
freezeStakeMint = null,
|
|
5439
7205
|
unstakePeriod = null,
|
|
7206
|
+
maxTotalStakeCumulative,
|
|
7207
|
+
expiryTs,
|
|
7208
|
+
autoUnstake,
|
|
5440
7209
|
nonce,
|
|
5441
7210
|
tokenProgramId = TOKEN_PROGRAM_ID
|
|
5442
7211
|
}, extParams) {
|
|
5443
7212
|
const { stakePoolProgram } = this.programs;
|
|
5444
7213
|
const creator = extParams.invoker.publicKey;
|
|
7214
|
+
const v2ParamsSet = maxTotalStakeCumulative !== void 0 || expiryTs !== void 0 || autoUnstake !== void 0;
|
|
5445
7215
|
invariant(creator, "Undefined invoker publicKey");
|
|
5446
|
-
const createInstruction = await stakePoolProgram.methods.
|
|
7216
|
+
const createInstruction = await (v2ParamsSet ? stakePoolProgram.methods.createPoolV2(
|
|
7217
|
+
nonce,
|
|
7218
|
+
maxWeight,
|
|
7219
|
+
minDuration,
|
|
7220
|
+
maxDuration,
|
|
7221
|
+
permissionless,
|
|
7222
|
+
freezeStakeMint ?? false,
|
|
7223
|
+
unstakePeriod ?? new BN4(0),
|
|
7224
|
+
maxTotalStakeCumulative ?? new BN4(0),
|
|
7225
|
+
expiryTs ?? new BN4(0),
|
|
7226
|
+
autoUnstake ?? false
|
|
7227
|
+
) : stakePoolProgram.methods.createPool(
|
|
7228
|
+
nonce,
|
|
7229
|
+
maxWeight,
|
|
7230
|
+
minDuration,
|
|
7231
|
+
maxDuration,
|
|
7232
|
+
permissionless,
|
|
7233
|
+
freezeStakeMint,
|
|
7234
|
+
unstakePeriod
|
|
7235
|
+
)).accounts({
|
|
5447
7236
|
creator,
|
|
5448
7237
|
mint,
|
|
5449
7238
|
tokenProgram: tokenProgramId
|
|
@@ -5499,14 +7288,11 @@ var SolanaStakingClient = class {
|
|
|
5499
7288
|
const { stakePoolProgram } = this.programs;
|
|
5500
7289
|
const staker = extParams.invoker.publicKey;
|
|
5501
7290
|
invariant(staker, "Undefined invoker publicKey");
|
|
5502
|
-
const mint = deriveStakeMintPDA(stakePoolProgram.programId, pk(stakePool));
|
|
5503
|
-
const stakeMintAccountKey = getAssociatedTokenAddressSync(mint, staker, true, pk(tokenProgramId));
|
|
5504
7291
|
const poolMintAccountKey = getAssociatedTokenAddressSync(pk(stakePoolMint), staker, true, pk(tokenProgramId));
|
|
5505
7292
|
const instruction = await stakePoolProgram.methods.stake(nonce, amount, duration).accounts({
|
|
5506
7293
|
stakePool,
|
|
5507
7294
|
tokenProgram: tokenProgramId,
|
|
5508
7295
|
from: poolMintAccountKey,
|
|
5509
|
-
to: stakeMintAccountKey,
|
|
5510
7296
|
authority: staker,
|
|
5511
7297
|
payer: staker
|
|
5512
7298
|
}).instruction();
|
|
@@ -5600,14 +7386,11 @@ var SolanaStakingClient = class {
|
|
|
5600
7386
|
const { stakePoolProgram } = this.programs;
|
|
5601
7387
|
const staker = extParams.invoker.publicKey;
|
|
5602
7388
|
invariant(staker, "Undefined invoker publicKey");
|
|
5603
|
-
const stakeMintKey = deriveStakeMintPDA(stakePoolProgram.programId, pk(stakePool));
|
|
5604
7389
|
const stakeEntryKey = deriveStakeEntryPDA(stakePoolProgram.programId, pk(stakePool), staker, nonce);
|
|
5605
7390
|
const poolMintAccountKey = getAssociatedTokenAddressSync(pk(stakePoolMint), staker, true, pk(tokenProgramId));
|
|
5606
|
-
const stakeMintAccountKey = getAssociatedTokenAddressSync(stakeMintKey, staker, true, pk(tokenProgramId));
|
|
5607
7391
|
const instruction = await stakePoolProgram.methods.unstake(shouldClose).accounts({
|
|
5608
7392
|
stakeEntry: stakeEntryKey,
|
|
5609
7393
|
to: poolMintAccountKey,
|
|
5610
|
-
from: stakeMintAccountKey,
|
|
5611
7394
|
authority: staker,
|
|
5612
7395
|
tokenProgram: tokenProgramId
|
|
5613
7396
|
}).instruction();
|
|
@@ -5894,10 +7677,10 @@ var RewardEntryAccumulator = class {
|
|
|
5894
7677
|
}
|
|
5895
7678
|
// Calculate accountable amount by calculating how many seconds have passed since last claim/stake time
|
|
5896
7679
|
getAccountableAmount(stakedTs, accountableTs, effectiveStakedAmount, rewardAmount, rewardPeriod) {
|
|
5897
|
-
const lastAccountedTs = this.lastAccountedTs.gt(new
|
|
7680
|
+
const lastAccountedTs = this.lastAccountedTs.gt(new BN4(0)) ? this.lastAccountedTs : stakedTs;
|
|
5898
7681
|
const secondsPassed = accountableTs.sub(lastAccountedTs);
|
|
5899
7682
|
if (secondsPassed.lt(rewardPeriod)) {
|
|
5900
|
-
return new
|
|
7683
|
+
return new BN4(0);
|
|
5901
7684
|
}
|
|
5902
7685
|
const periodsPassed = secondsPassed.div(rewardPeriod);
|
|
5903
7686
|
const claimablePerEffectiveStake = periodsPassed.mul(rewardAmount);
|
|
@@ -5931,11 +7714,11 @@ var createDefaultRewardEntry = (stakeEntry, rewardPool) => {
|
|
|
5931
7714
|
stakeEntry: new PublicKey(stakeEntry.publicKey),
|
|
5932
7715
|
rewardPool: new PublicKey(rewardPool.publicKey),
|
|
5933
7716
|
createdTs: stakeEntry.account.createdTs,
|
|
5934
|
-
lastAccountedTs: new
|
|
5935
|
-
lastRewardAmount: new
|
|
5936
|
-
lastRewardPeriod: new
|
|
5937
|
-
accountedAmount: new
|
|
5938
|
-
claimedAmount: new
|
|
7717
|
+
lastAccountedTs: new BN4(0),
|
|
7718
|
+
lastRewardAmount: new BN4(0),
|
|
7719
|
+
lastRewardPeriod: new BN4(0),
|
|
7720
|
+
accountedAmount: new BN4(0),
|
|
7721
|
+
claimedAmount: new BN4(0),
|
|
5939
7722
|
isSponsored: false,
|
|
5940
7723
|
buffer: []
|
|
5941
7724
|
};
|
|
@@ -5949,8 +7732,8 @@ var calcRewards = (rewardEntryAccount, stakeEntryAccount, rewardPoolAccount) =>
|
|
|
5949
7732
|
throw new Error("InvalidRewardEntry");
|
|
5950
7733
|
}
|
|
5951
7734
|
const currTs = Math.floor(Date.now() / 1e3);
|
|
5952
|
-
const stakedTs = rewardPool.createdTs ?
|
|
5953
|
-
const claimableTs = stakeEntry.closedTs.gtn(0) ? stakeEntry.closedTs : new
|
|
7735
|
+
const stakedTs = rewardPool.createdTs ? BN4.max(stakeEntry.createdTs, rewardPool.createdTs) : stakeEntry.createdTs;
|
|
7736
|
+
const claimableTs = stakeEntry.closedTs.gtn(0) ? stakeEntry.closedTs : new BN4(currTs);
|
|
5954
7737
|
const amountUpdated = !rewardPool.rewardAmount.eq(rewardPool.lastRewardAmount) && rewardPool.lastAmountUpdateTs.gt(stakeEntry.createdTs) && rewardPool.lastAmountUpdateTs.gt(stakeEntry.closedTs);
|
|
5955
7738
|
const periodUpdated = !rewardPool.rewardPeriod.eq(rewardPool.lastRewardPeriod) && rewardPool.lastPeriodUpdateTs.gt(stakeEntry.createdTs) && rewardPool.lastPeriodUpdateTs.gt(stakeEntry.closedTs);
|
|
5956
7739
|
if (amountUpdated || periodUpdated) {
|
|
@@ -5968,12 +7751,12 @@ var calcRewards = (rewardEntryAccount, stakeEntryAccount, rewardPoolAccount) =>
|
|
|
5968
7751
|
rewardPeriod = rewardPool.rewardPeriod;
|
|
5969
7752
|
}
|
|
5970
7753
|
} else if (amountUpdated) {
|
|
5971
|
-
firstUpdateTs = new
|
|
7754
|
+
firstUpdateTs = new BN4(0);
|
|
5972
7755
|
secondUpdateTs = rewardPool.lastAmountUpdateTs;
|
|
5973
7756
|
rewardAmount = rewardEntryAccumulator.lastRewardAmount;
|
|
5974
7757
|
rewardPeriod = rewardEntryAccumulator.lastRewardPeriod;
|
|
5975
7758
|
} else {
|
|
5976
|
-
firstUpdateTs = new
|
|
7759
|
+
firstUpdateTs = new BN4(0);
|
|
5977
7760
|
secondUpdateTs = rewardPool.lastPeriodUpdateTs;
|
|
5978
7761
|
rewardAmount = rewardEntryAccumulator.lastRewardAmount;
|
|
5979
7762
|
rewardPeriod = rewardEntryAccumulator.lastRewardPeriod;
|
|
@@ -6026,7 +7809,7 @@ var calculateRewardAmountFromValue = (rewardTokenValue, stakeTokenDecimals) => {
|
|
|
6026
7809
|
if (decimalsDiff === 0) {
|
|
6027
7810
|
return rewardTokenValue;
|
|
6028
7811
|
}
|
|
6029
|
-
const diffFactor = new
|
|
7812
|
+
const diffFactor = new BN4(10).pow(new BN4(Math.abs(decimalsDiff)));
|
|
6030
7813
|
if (decimalsDiff > 0) {
|
|
6031
7814
|
return rewardTokenValue.mul(diffFactor);
|
|
6032
7815
|
}
|
|
@@ -6071,13 +7854,13 @@ async function calculateAmountWithTransferFees(connection, transferFeeConfig, tr
|
|
|
6071
7854
|
}
|
|
6072
7855
|
var calculateStakeWeight = (minDuration, maxDuration, maxWeight, duration) => {
|
|
6073
7856
|
const durationSpan = maxDuration.sub(minDuration);
|
|
6074
|
-
if (durationSpan.eq(new
|
|
7857
|
+
if (durationSpan.eq(new BN4(0))) {
|
|
6075
7858
|
return SCALE_PRECISION_FACTOR_BN;
|
|
6076
7859
|
}
|
|
6077
7860
|
const durationExceedingMin = duration.sub(minDuration);
|
|
6078
7861
|
const normalizedWeight = durationExceedingMin.mul(SCALE_PRECISION_FACTOR_BN).div(durationSpan);
|
|
6079
7862
|
const weightDiff = maxWeight.sub(SCALE_PRECISION_FACTOR_BN);
|
|
6080
|
-
return
|
|
7863
|
+
return BN4.max(
|
|
6081
7864
|
SCALE_PRECISION_FACTOR_BN.add(normalizedWeight.mul(weightDiff).div(SCALE_PRECISION_FACTOR_BN)),
|
|
6082
7865
|
SCALE_PRECISION_FACTOR_BN
|
|
6083
7866
|
);
|