@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/cjs/index.cjs
CHANGED
|
@@ -5,12 +5,12 @@ var splToken = require('@solana/spl-token');
|
|
|
5
5
|
var web3_js = require('@solana/web3.js');
|
|
6
6
|
var common = require('@streamflow/common');
|
|
7
7
|
var solana = require('@streamflow/common/solana');
|
|
8
|
-
var
|
|
8
|
+
var BN4 = require('bn.js');
|
|
9
9
|
require('@solana/wallet-adapter-base');
|
|
10
10
|
|
|
11
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var BN4__default = /*#__PURE__*/_interopDefault(BN4);
|
|
14
14
|
|
|
15
15
|
var __defProp = Object.defineProperty;
|
|
16
16
|
var __export = (target, all) => {
|
|
@@ -62,14 +62,14 @@ __export(constants_exports, {
|
|
|
62
62
|
U64_MAX: () => U64_MAX
|
|
63
63
|
});
|
|
64
64
|
var FEE_PRECISION_FACTOR = 1e4;
|
|
65
|
-
var FEE_PRECISION_FACTOR_BN = new
|
|
65
|
+
var FEE_PRECISION_FACTOR_BN = new BN4__default.default(FEE_PRECISION_FACTOR);
|
|
66
66
|
var DEFAULT_FEE = 19;
|
|
67
|
-
var DEFAULT_FEE_BN = new
|
|
67
|
+
var DEFAULT_FEE_BN = new BN4__default.default(DEFAULT_FEE);
|
|
68
68
|
var SCALE_PRECISION_FACTOR = 1e9;
|
|
69
|
-
var SCALE_PRECISION_FACTOR_BN = new
|
|
69
|
+
var SCALE_PRECISION_FACTOR_BN = new BN4__default.default(SCALE_PRECISION_FACTOR);
|
|
70
70
|
var REWARD_AMOUNT_DECIMALS = 9;
|
|
71
71
|
var REWARD_AMOUNT_PRECISION_FACTOR = 1e9;
|
|
72
|
-
var REWARD_AMOUNT_PRECISION_FACTOR_BN = new
|
|
72
|
+
var REWARD_AMOUNT_PRECISION_FACTOR_BN = new BN4__default.default(REWARD_AMOUNT_PRECISION_FACTOR);
|
|
73
73
|
var U64_MAX = 18446744073709551615n;
|
|
74
74
|
var STAKE_ENTRY_DISCRIMINATOR = [187, 127, 9, 35, 155, 68, 86, 40];
|
|
75
75
|
var STAKE_ENTRY_PREFIX = Buffer.from("stake-entry", "utf-8");
|
|
@@ -134,12 +134,946 @@ var FEE_PROGRAM_ID = {
|
|
|
134
134
|
[common.ICluster.Local]: "FEELzfBhsWXTNJX53zZcDVfRNoFYZQ6cZA3jLiGVL16V"
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
+
// solana/descriptor/idl/governor.json
|
|
138
|
+
var governor_default = {
|
|
139
|
+
address: "GVERNASJFxi8vjjJtwCKYQTeN51XsV1y2B1ap1GtKrKR",
|
|
140
|
+
metadata: {
|
|
141
|
+
name: "governor",
|
|
142
|
+
version: "2.3.0",
|
|
143
|
+
spec: "0.1.0",
|
|
144
|
+
description: "Governor program to allow users to vote with stake tokens"
|
|
145
|
+
},
|
|
146
|
+
instructions: [
|
|
147
|
+
{
|
|
148
|
+
name: "add_proposal",
|
|
149
|
+
discriminator: [
|
|
150
|
+
130,
|
|
151
|
+
139,
|
|
152
|
+
214,
|
|
153
|
+
107,
|
|
154
|
+
93,
|
|
155
|
+
13,
|
|
156
|
+
84,
|
|
157
|
+
152
|
|
158
|
+
],
|
|
159
|
+
accounts: [
|
|
160
|
+
{
|
|
161
|
+
name: "stake_pool",
|
|
162
|
+
docs: [
|
|
163
|
+
"The stake pool associated with the governor"
|
|
164
|
+
],
|
|
165
|
+
relations: [
|
|
166
|
+
"governor"
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: "governor",
|
|
171
|
+
docs: [
|
|
172
|
+
"The governor to which the proposal is being added"
|
|
173
|
+
],
|
|
174
|
+
writable: true
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: "proposal",
|
|
178
|
+
docs: [
|
|
179
|
+
"The new proposal account to be created"
|
|
180
|
+
],
|
|
181
|
+
writable: true,
|
|
182
|
+
pda: {
|
|
183
|
+
seeds: [
|
|
184
|
+
{
|
|
185
|
+
kind: "const",
|
|
186
|
+
value: [
|
|
187
|
+
112,
|
|
188
|
+
114,
|
|
189
|
+
111,
|
|
190
|
+
112,
|
|
191
|
+
111,
|
|
192
|
+
115,
|
|
193
|
+
97,
|
|
194
|
+
108
|
|
195
|
+
]
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
kind: "account",
|
|
199
|
+
path: "governor"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
kind: "arg",
|
|
203
|
+
path: "nonce"
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: "authority",
|
|
210
|
+
docs: [
|
|
211
|
+
"Authority of the governor"
|
|
212
|
+
],
|
|
213
|
+
writable: true,
|
|
214
|
+
signer: true
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: "system_program",
|
|
218
|
+
address: "11111111111111111111111111111111"
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
args: [
|
|
222
|
+
{
|
|
223
|
+
name: "nonce",
|
|
224
|
+
type: "u32"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
name: "text",
|
|
228
|
+
type: "string"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: "options",
|
|
232
|
+
type: {
|
|
233
|
+
vec: "string"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: "voting_start_ts",
|
|
238
|
+
type: "u64"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: "voting_end_ts",
|
|
242
|
+
type: "u64"
|
|
243
|
+
}
|
|
244
|
+
]
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
name: "change_authority",
|
|
248
|
+
discriminator: [
|
|
249
|
+
50,
|
|
250
|
+
106,
|
|
251
|
+
66,
|
|
252
|
+
104,
|
|
253
|
+
99,
|
|
254
|
+
118,
|
|
255
|
+
145,
|
|
256
|
+
88
|
|
257
|
+
],
|
|
258
|
+
accounts: [
|
|
259
|
+
{
|
|
260
|
+
name: "governor",
|
|
261
|
+
docs: [
|
|
262
|
+
"Reward Pool"
|
|
263
|
+
],
|
|
264
|
+
writable: true
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
name: "authority",
|
|
268
|
+
docs: [
|
|
269
|
+
"Current Authority"
|
|
270
|
+
],
|
|
271
|
+
writable: true,
|
|
272
|
+
signer: true
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
name: "new_authority"
|
|
276
|
+
}
|
|
277
|
+
],
|
|
278
|
+
args: []
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
name: "create_governor",
|
|
282
|
+
discriminator: [
|
|
283
|
+
103,
|
|
284
|
+
30,
|
|
285
|
+
78,
|
|
286
|
+
252,
|
|
287
|
+
28,
|
|
288
|
+
128,
|
|
289
|
+
40,
|
|
290
|
+
3
|
|
291
|
+
],
|
|
292
|
+
accounts: [
|
|
293
|
+
{
|
|
294
|
+
name: "stake_pool",
|
|
295
|
+
docs: [
|
|
296
|
+
"The stake pool for which the governor is being created"
|
|
297
|
+
]
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
name: "governor",
|
|
301
|
+
docs: [
|
|
302
|
+
"The governor account to be created"
|
|
303
|
+
],
|
|
304
|
+
writable: true,
|
|
305
|
+
pda: {
|
|
306
|
+
seeds: [
|
|
307
|
+
{
|
|
308
|
+
kind: "const",
|
|
309
|
+
value: [
|
|
310
|
+
103,
|
|
311
|
+
111,
|
|
312
|
+
118,
|
|
313
|
+
101,
|
|
314
|
+
114,
|
|
315
|
+
110,
|
|
316
|
+
111,
|
|
317
|
+
114
|
|
318
|
+
]
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
kind: "account",
|
|
322
|
+
path: "stake_pool"
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
kind: "arg",
|
|
326
|
+
path: "nonce"
|
|
327
|
+
}
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: "authority",
|
|
333
|
+
docs: [
|
|
334
|
+
"Authority of the stake pool"
|
|
335
|
+
],
|
|
336
|
+
writable: true,
|
|
337
|
+
signer: true
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
name: "system_program",
|
|
341
|
+
address: "11111111111111111111111111111111"
|
|
342
|
+
}
|
|
343
|
+
],
|
|
344
|
+
args: [
|
|
345
|
+
{
|
|
346
|
+
name: "nonce",
|
|
347
|
+
type: "u8"
|
|
348
|
+
}
|
|
349
|
+
]
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
name: "set_active_proposal",
|
|
353
|
+
discriminator: [
|
|
354
|
+
41,
|
|
355
|
+
14,
|
|
356
|
+
222,
|
|
357
|
+
18,
|
|
358
|
+
33,
|
|
359
|
+
232,
|
|
360
|
+
43,
|
|
361
|
+
82
|
|
362
|
+
],
|
|
363
|
+
accounts: [
|
|
364
|
+
{
|
|
365
|
+
name: "governor",
|
|
366
|
+
docs: [
|
|
367
|
+
"The governor for which to set the active proposal"
|
|
368
|
+
],
|
|
369
|
+
writable: true,
|
|
370
|
+
relations: [
|
|
371
|
+
"proposal"
|
|
372
|
+
]
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
name: "proposal",
|
|
376
|
+
docs: [
|
|
377
|
+
"The proposal to set as active"
|
|
378
|
+
],
|
|
379
|
+
writable: true
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
name: "authority",
|
|
383
|
+
docs: [
|
|
384
|
+
"Authority of the governor"
|
|
385
|
+
],
|
|
386
|
+
signer: true
|
|
387
|
+
}
|
|
388
|
+
],
|
|
389
|
+
args: []
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
name: "vote_on_proposal",
|
|
393
|
+
discriminator: [
|
|
394
|
+
188,
|
|
395
|
+
239,
|
|
396
|
+
13,
|
|
397
|
+
88,
|
|
398
|
+
119,
|
|
399
|
+
199,
|
|
400
|
+
251,
|
|
401
|
+
119
|
|
402
|
+
],
|
|
403
|
+
accounts: [
|
|
404
|
+
{
|
|
405
|
+
name: "stake_pool",
|
|
406
|
+
docs: [
|
|
407
|
+
"Original Stake Pool"
|
|
408
|
+
],
|
|
409
|
+
relations: [
|
|
410
|
+
"governor"
|
|
411
|
+
]
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
name: "governor",
|
|
415
|
+
docs: [
|
|
416
|
+
"The governor account that manages the voting process"
|
|
417
|
+
],
|
|
418
|
+
writable: true,
|
|
419
|
+
relations: [
|
|
420
|
+
"proposal"
|
|
421
|
+
]
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
name: "proposal",
|
|
425
|
+
docs: [
|
|
426
|
+
"The proposal being voted on"
|
|
427
|
+
]
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
name: "vote",
|
|
431
|
+
docs: [
|
|
432
|
+
"The vote account that will be created to record the vote"
|
|
433
|
+
],
|
|
434
|
+
writable: true,
|
|
435
|
+
pda: {
|
|
436
|
+
seeds: [
|
|
437
|
+
{
|
|
438
|
+
kind: "const",
|
|
439
|
+
value: [
|
|
440
|
+
118,
|
|
441
|
+
111,
|
|
442
|
+
116,
|
|
443
|
+
101
|
|
444
|
+
]
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
kind: "account",
|
|
448
|
+
path: "proposal"
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
kind: "account",
|
|
452
|
+
path: "voter"
|
|
453
|
+
}
|
|
454
|
+
]
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
name: "stake_mint_account",
|
|
459
|
+
docs: [
|
|
460
|
+
"The user's stake token account that holds the stake tokens"
|
|
461
|
+
]
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
name: "voter",
|
|
465
|
+
docs: [
|
|
466
|
+
"The user who is voting"
|
|
467
|
+
],
|
|
468
|
+
writable: true,
|
|
469
|
+
signer: true
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
name: "rent_sponsor",
|
|
473
|
+
writable: true,
|
|
474
|
+
pda: {
|
|
475
|
+
seeds: [
|
|
476
|
+
{
|
|
477
|
+
kind: "const",
|
|
478
|
+
value: [
|
|
479
|
+
114,
|
|
480
|
+
101,
|
|
481
|
+
110,
|
|
482
|
+
116,
|
|
483
|
+
45,
|
|
484
|
+
115,
|
|
485
|
+
112,
|
|
486
|
+
111,
|
|
487
|
+
110,
|
|
488
|
+
115,
|
|
489
|
+
111,
|
|
490
|
+
114
|
|
491
|
+
]
|
|
492
|
+
}
|
|
493
|
+
]
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
name: "system_program",
|
|
498
|
+
address: "11111111111111111111111111111111"
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
name: "event_authority",
|
|
502
|
+
pda: {
|
|
503
|
+
seeds: [
|
|
504
|
+
{
|
|
505
|
+
kind: "const",
|
|
506
|
+
value: [
|
|
507
|
+
95,
|
|
508
|
+
95,
|
|
509
|
+
101,
|
|
510
|
+
118,
|
|
511
|
+
101,
|
|
512
|
+
110,
|
|
513
|
+
116,
|
|
514
|
+
95,
|
|
515
|
+
97,
|
|
516
|
+
117,
|
|
517
|
+
116,
|
|
518
|
+
104,
|
|
519
|
+
111,
|
|
520
|
+
114,
|
|
521
|
+
105,
|
|
522
|
+
116,
|
|
523
|
+
121
|
|
524
|
+
]
|
|
525
|
+
}
|
|
526
|
+
]
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
name: "program"
|
|
531
|
+
}
|
|
532
|
+
],
|
|
533
|
+
args: [
|
|
534
|
+
{
|
|
535
|
+
name: "option_index",
|
|
536
|
+
type: "u8"
|
|
537
|
+
}
|
|
538
|
+
]
|
|
539
|
+
}
|
|
540
|
+
],
|
|
541
|
+
accounts: [
|
|
542
|
+
{
|
|
543
|
+
name: "Governor",
|
|
544
|
+
discriminator: [
|
|
545
|
+
37,
|
|
546
|
+
136,
|
|
547
|
+
44,
|
|
548
|
+
80,
|
|
549
|
+
68,
|
|
550
|
+
85,
|
|
551
|
+
213,
|
|
552
|
+
178
|
|
553
|
+
]
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
name: "Proposal",
|
|
557
|
+
discriminator: [
|
|
558
|
+
26,
|
|
559
|
+
94,
|
|
560
|
+
189,
|
|
561
|
+
187,
|
|
562
|
+
116,
|
|
563
|
+
136,
|
|
564
|
+
53,
|
|
565
|
+
33
|
|
566
|
+
]
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
name: "StakePool",
|
|
570
|
+
discriminator: [
|
|
571
|
+
121,
|
|
572
|
+
34,
|
|
573
|
+
206,
|
|
574
|
+
21,
|
|
575
|
+
79,
|
|
576
|
+
127,
|
|
577
|
+
255,
|
|
578
|
+
28
|
|
579
|
+
]
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
name: "Vote",
|
|
583
|
+
discriminator: [
|
|
584
|
+
96,
|
|
585
|
+
91,
|
|
586
|
+
104,
|
|
587
|
+
57,
|
|
588
|
+
145,
|
|
589
|
+
35,
|
|
590
|
+
172,
|
|
591
|
+
155
|
|
592
|
+
]
|
|
593
|
+
}
|
|
594
|
+
],
|
|
595
|
+
events: [
|
|
596
|
+
{
|
|
597
|
+
name: "VoteEvent",
|
|
598
|
+
discriminator: [
|
|
599
|
+
195,
|
|
600
|
+
71,
|
|
601
|
+
250,
|
|
602
|
+
105,
|
|
603
|
+
120,
|
|
604
|
+
119,
|
|
605
|
+
234,
|
|
606
|
+
134
|
|
607
|
+
]
|
|
608
|
+
}
|
|
609
|
+
],
|
|
610
|
+
errors: [
|
|
611
|
+
{
|
|
612
|
+
code: 6e3,
|
|
613
|
+
name: "ArithmeticError",
|
|
614
|
+
msg: "Arithmetic Error (overflow/underflow)"
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
code: 6001,
|
|
618
|
+
name: "Unauthorized",
|
|
619
|
+
msg: "Account is not authorized to execute this instruction"
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
code: 6002,
|
|
623
|
+
name: "InvalidStakeMint",
|
|
624
|
+
msg: "Provided Stake Mint does not equal the Pool Stake Mint"
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
code: 6003,
|
|
628
|
+
name: "InvalidStakePool",
|
|
629
|
+
msg: "Provided Stake Pool does not equal the Entry Stake Pool"
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
code: 6004,
|
|
633
|
+
name: "InvalidGovernor",
|
|
634
|
+
msg: "Provided Governor does not match the proposal Governor"
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
code: 6005,
|
|
638
|
+
name: "InvalidProposalText",
|
|
639
|
+
msg: "Invalid proposal text provided"
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
code: 6006,
|
|
643
|
+
name: "InvalidProposalOptions",
|
|
644
|
+
msg: "Invalid proposal options provided"
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
code: 6007,
|
|
648
|
+
name: "InvalidProposalDuration",
|
|
649
|
+
msg: "Invalid proposal duration"
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
code: 6008,
|
|
653
|
+
name: "ProposalAlreadyActive",
|
|
654
|
+
msg: "This proposal is already active"
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
code: 6009,
|
|
658
|
+
name: "VotingNotStarted",
|
|
659
|
+
msg: "Voting not started yet"
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
code: 6010,
|
|
663
|
+
name: "VotingEnded",
|
|
664
|
+
msg: "Voting has already ended"
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
code: 6011,
|
|
668
|
+
name: "InvalidOptionIndex",
|
|
669
|
+
msg: "Provided option is not a valid proposal option"
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
code: 6012,
|
|
673
|
+
name: "InsufficientStakeTokens",
|
|
674
|
+
msg: "Insufficient tokens for voting"
|
|
675
|
+
}
|
|
676
|
+
],
|
|
677
|
+
types: [
|
|
678
|
+
{
|
|
679
|
+
name: "Governor",
|
|
680
|
+
type: {
|
|
681
|
+
kind: "struct",
|
|
682
|
+
fields: [
|
|
683
|
+
{
|
|
684
|
+
name: "bump",
|
|
685
|
+
docs: [
|
|
686
|
+
"Bump Seed used to sign transactions"
|
|
687
|
+
],
|
|
688
|
+
type: "u8"
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
name: "nonce",
|
|
692
|
+
docs: [
|
|
693
|
+
"Nonce to support multiple governors for the same pool"
|
|
694
|
+
],
|
|
695
|
+
type: "u8"
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
name: "stake_pool",
|
|
699
|
+
docs: [
|
|
700
|
+
"Stake Pool for which Reward Pool was added"
|
|
701
|
+
],
|
|
702
|
+
type: "pubkey"
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
name: "authority",
|
|
706
|
+
docs: [
|
|
707
|
+
"Authority of the Governor that can add proposals and set the current one"
|
|
708
|
+
],
|
|
709
|
+
type: "pubkey"
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
name: "current_proposal",
|
|
713
|
+
docs: [
|
|
714
|
+
"Address of the current proposal"
|
|
715
|
+
],
|
|
716
|
+
type: "pubkey"
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
name: "total_proposals",
|
|
720
|
+
docs: [
|
|
721
|
+
"Total number of created proposals"
|
|
722
|
+
],
|
|
723
|
+
type: "u64"
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
name: "_buffer",
|
|
727
|
+
docs: [
|
|
728
|
+
"Buffer for additional fields"
|
|
729
|
+
],
|
|
730
|
+
type: {
|
|
731
|
+
array: [
|
|
732
|
+
"u8",
|
|
733
|
+
128
|
|
734
|
+
]
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
]
|
|
738
|
+
}
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
name: "Proposal",
|
|
742
|
+
type: {
|
|
743
|
+
kind: "struct",
|
|
744
|
+
fields: [
|
|
745
|
+
{
|
|
746
|
+
name: "nonce",
|
|
747
|
+
docs: [
|
|
748
|
+
"Nonce used to derive proposal address"
|
|
749
|
+
],
|
|
750
|
+
type: "u32"
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
name: "governor",
|
|
754
|
+
docs: [
|
|
755
|
+
"Stake Pool for which Reward Pool was added"
|
|
756
|
+
],
|
|
757
|
+
type: "pubkey"
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
name: "text",
|
|
761
|
+
docs: [
|
|
762
|
+
"Text of the proposals we reserve up to 512 bytes (ascii symbols take 1 byte)"
|
|
763
|
+
],
|
|
764
|
+
type: "string"
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
name: "options",
|
|
768
|
+
docs: [
|
|
769
|
+
"Potential options that will be used when answering, we reserve enough space for up to 8x32 = 256 ascii symbols in total"
|
|
770
|
+
],
|
|
771
|
+
type: {
|
|
772
|
+
vec: "string"
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
name: "voting_start_ts",
|
|
777
|
+
docs: [
|
|
778
|
+
"Time when voting starts, 0 means that voting start immediately after proposal was created"
|
|
779
|
+
],
|
|
780
|
+
type: "u64"
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
name: "voting_end_ts",
|
|
784
|
+
docs: [
|
|
785
|
+
"Time when voting ends, 0 means that voting will be possible anytime"
|
|
786
|
+
],
|
|
787
|
+
type: "u64"
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
name: "created_ts",
|
|
791
|
+
docs: [
|
|
792
|
+
"Time when proposal was created"
|
|
793
|
+
],
|
|
794
|
+
type: "u64"
|
|
795
|
+
},
|
|
796
|
+
{
|
|
797
|
+
name: "last_active_ts",
|
|
798
|
+
docs: [
|
|
799
|
+
"Last time when proposal was made active"
|
|
800
|
+
],
|
|
801
|
+
type: "u64"
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
name: "_buffer",
|
|
805
|
+
docs: [
|
|
806
|
+
"Buffer for additional fields"
|
|
807
|
+
],
|
|
808
|
+
type: {
|
|
809
|
+
array: [
|
|
810
|
+
"u8",
|
|
811
|
+
64
|
|
812
|
+
]
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
]
|
|
816
|
+
}
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
name: "StakePool",
|
|
820
|
+
type: {
|
|
821
|
+
kind: "struct",
|
|
822
|
+
fields: [
|
|
823
|
+
{
|
|
824
|
+
name: "bump",
|
|
825
|
+
docs: [
|
|
826
|
+
"Bump Seed used to sign transactions"
|
|
827
|
+
],
|
|
828
|
+
type: "u8"
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
name: "nonce",
|
|
832
|
+
docs: [
|
|
833
|
+
"Nonce to differentiate pools for the same mint"
|
|
834
|
+
],
|
|
835
|
+
type: "u8"
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
name: "mint",
|
|
839
|
+
docs: [
|
|
840
|
+
"Mint of the Stake Pool"
|
|
841
|
+
],
|
|
842
|
+
type: "pubkey"
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
name: "creator",
|
|
846
|
+
docs: [
|
|
847
|
+
"Initial Creator"
|
|
848
|
+
],
|
|
849
|
+
type: "pubkey"
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
name: "authority",
|
|
853
|
+
docs: [
|
|
854
|
+
"Current authority"
|
|
855
|
+
],
|
|
856
|
+
type: "pubkey"
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
name: "min_weight",
|
|
860
|
+
docs: [
|
|
861
|
+
"The lowest weight awarded for staking, measured as a fraction of `1 / SCALE_FACTOR_BASE`.",
|
|
862
|
+
"For instance:",
|
|
863
|
+
"* `min_weight = 1 x SCALE_FACTOR_BASE` signifies a minimum multiplier of 1x for min staking duration",
|
|
864
|
+
"* `min_weight = 2 x SCALE_FACTOR_BASE` indicates a minimum multiplier of 2x for min staking duration"
|
|
865
|
+
],
|
|
866
|
+
type: "u64"
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
name: "max_weight",
|
|
870
|
+
docs: [
|
|
871
|
+
"The highest weight awarded for staking, measured as a fraction of `1 / SCALE_FACTOR_BASE`.",
|
|
872
|
+
"For instance:",
|
|
873
|
+
"* `max_weight = 1 x SCALE_FACTOR_BASE` signifies a max multiplier of 1x for max staking duration",
|
|
874
|
+
"* `max_weight = 2 x SCALE_FACTOR_BASE` indicates a max multiplier of 2x for max staking duration"
|
|
875
|
+
],
|
|
876
|
+
type: "u64"
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
name: "min_duration",
|
|
880
|
+
docs: [
|
|
881
|
+
"Min Duration of stake in seconds"
|
|
882
|
+
],
|
|
883
|
+
type: "u64"
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
name: "max_duration",
|
|
887
|
+
docs: [
|
|
888
|
+
"Max Duration of stake in seconds, the more duration, the more weight the stake has"
|
|
889
|
+
],
|
|
890
|
+
type: "u64"
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
name: "permissionless",
|
|
894
|
+
docs: [
|
|
895
|
+
"Whether anyone can add Reward Pools or just admin"
|
|
896
|
+
],
|
|
897
|
+
type: "bool"
|
|
898
|
+
},
|
|
899
|
+
{
|
|
900
|
+
name: "vault",
|
|
901
|
+
docs: [
|
|
902
|
+
"Escrow Account that stores staked tokens"
|
|
903
|
+
],
|
|
904
|
+
type: "pubkey"
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
name: "stake_mint",
|
|
908
|
+
docs: [
|
|
909
|
+
"Stake Mint, will be returned in exchange for stake tokens"
|
|
910
|
+
],
|
|
911
|
+
type: "pubkey"
|
|
912
|
+
},
|
|
913
|
+
{
|
|
914
|
+
name: "total_stake",
|
|
915
|
+
docs: [
|
|
916
|
+
"Total number of Staked tokens"
|
|
917
|
+
],
|
|
918
|
+
type: "u64"
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
name: "total_effective_stake",
|
|
922
|
+
docs: [
|
|
923
|
+
"Total staked tokens accounting for each stake weight, does not equal `total_stake`,",
|
|
924
|
+
"represents a sum of effective stake multiplied by 10^9 for precision"
|
|
925
|
+
],
|
|
926
|
+
type: "u128"
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
name: "freeze_stake_mint",
|
|
930
|
+
docs: [
|
|
931
|
+
"Whether we should freeze stake mint token accounts"
|
|
932
|
+
],
|
|
933
|
+
type: "bool"
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
name: "unstake_period",
|
|
937
|
+
docs: [
|
|
938
|
+
"Period for unstaking, if set unstake at first should be requested, and the real unstake can only happen after this period"
|
|
939
|
+
],
|
|
940
|
+
type: "u64"
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
name: "total_stake_capped",
|
|
944
|
+
docs: [
|
|
945
|
+
"Whether amount of total staked tokens is limited by `remaining_total_stake` - stored as separate flag to not deal with `Option`"
|
|
946
|
+
],
|
|
947
|
+
type: "bool"
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
name: "remaining_total_stake",
|
|
951
|
+
docs: [
|
|
952
|
+
"Remaining total amount of staked tokens (cumulative)"
|
|
953
|
+
],
|
|
954
|
+
type: "u64"
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
name: "expiry_ts",
|
|
958
|
+
docs: [
|
|
959
|
+
"Time when stake pool expires, staking is not possible after expiration"
|
|
960
|
+
],
|
|
961
|
+
type: "u64"
|
|
962
|
+
},
|
|
963
|
+
{
|
|
964
|
+
name: "auto_unstake",
|
|
965
|
+
docs: [
|
|
966
|
+
"Whether auto unstaking is enabled, stake entries will be unstaked after duration"
|
|
967
|
+
],
|
|
968
|
+
type: "bool"
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
name: "_buffer",
|
|
972
|
+
docs: [
|
|
973
|
+
"Buffer for additional fields"
|
|
974
|
+
],
|
|
975
|
+
type: {
|
|
976
|
+
array: [
|
|
977
|
+
"u8",
|
|
978
|
+
37
|
|
979
|
+
]
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
]
|
|
983
|
+
}
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
name: "Vote",
|
|
987
|
+
type: {
|
|
988
|
+
kind: "struct",
|
|
989
|
+
fields: [
|
|
990
|
+
{
|
|
991
|
+
name: "proposal",
|
|
992
|
+
docs: [
|
|
993
|
+
"Question to which vote was provided"
|
|
994
|
+
],
|
|
995
|
+
type: "pubkey"
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
name: "voter",
|
|
999
|
+
docs: [
|
|
1000
|
+
"Voter that voted on the proposal"
|
|
1001
|
+
],
|
|
1002
|
+
type: "pubkey"
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
name: "option_index",
|
|
1006
|
+
docs: [
|
|
1007
|
+
"Index of the option used for voting"
|
|
1008
|
+
],
|
|
1009
|
+
type: "u8"
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
name: "weight",
|
|
1013
|
+
docs: [
|
|
1014
|
+
"Weight of the vote, correspond to number of sTokens used"
|
|
1015
|
+
],
|
|
1016
|
+
type: "u64"
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
name: "is_sponsored",
|
|
1020
|
+
docs: [
|
|
1021
|
+
"Whether the vote rent has been sponsored by the rent vault"
|
|
1022
|
+
],
|
|
1023
|
+
type: "bool"
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
name: "_buffer",
|
|
1027
|
+
docs: [
|
|
1028
|
+
"Buffer for additional fields"
|
|
1029
|
+
],
|
|
1030
|
+
type: {
|
|
1031
|
+
array: [
|
|
1032
|
+
"u8",
|
|
1033
|
+
63
|
|
1034
|
+
]
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
]
|
|
1038
|
+
}
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
name: "VoteEvent",
|
|
1042
|
+
type: {
|
|
1043
|
+
kind: "struct",
|
|
1044
|
+
fields: [
|
|
1045
|
+
{
|
|
1046
|
+
name: "governor",
|
|
1047
|
+
type: "pubkey"
|
|
1048
|
+
},
|
|
1049
|
+
{
|
|
1050
|
+
name: "proposal",
|
|
1051
|
+
type: "pubkey"
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
name: "voter",
|
|
1055
|
+
type: "pubkey"
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
name: "option_index",
|
|
1059
|
+
type: "u8"
|
|
1060
|
+
},
|
|
1061
|
+
{
|
|
1062
|
+
name: "value",
|
|
1063
|
+
type: "u64"
|
|
1064
|
+
}
|
|
1065
|
+
]
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
]
|
|
1069
|
+
};
|
|
1070
|
+
|
|
137
1071
|
// solana/descriptor/idl/fee_manager.json
|
|
138
1072
|
var fee_manager_default = {
|
|
139
1073
|
address: "FEELzfBhsWXTNJX53zZcDVfRNoFYZQ6cZA3jLiGVL16V",
|
|
140
1074
|
metadata: {
|
|
141
1075
|
name: "fee_manager",
|
|
142
|
-
version: "2.
|
|
1076
|
+
version: "2.3.0",
|
|
143
1077
|
spec: "0.1.0",
|
|
144
1078
|
description: "Stores Fees and other admin configuration for the Staking protocol"
|
|
145
1079
|
},
|
|
@@ -577,7 +1511,7 @@ var reward_pool_default = {
|
|
|
577
1511
|
address: "RWRDdfRbi3339VgKxTAXg4cjyniF7cbhNbMxZWiSKmj",
|
|
578
1512
|
metadata: {
|
|
579
1513
|
name: "reward_pool",
|
|
580
|
-
version: "2.
|
|
1514
|
+
version: "2.3.0",
|
|
581
1515
|
spec: "0.1.0",
|
|
582
1516
|
description: "Program to manage Reward Pools for Stake Pools and claim rewards from them"
|
|
583
1517
|
},
|
|
@@ -722,6 +1656,225 @@ var reward_pool_default = {
|
|
|
722
1656
|
],
|
|
723
1657
|
args: []
|
|
724
1658
|
},
|
|
1659
|
+
{
|
|
1660
|
+
name: "claim_rewards_as_worker",
|
|
1661
|
+
discriminator: [
|
|
1662
|
+
120,
|
|
1663
|
+
246,
|
|
1664
|
+
117,
|
|
1665
|
+
149,
|
|
1666
|
+
120,
|
|
1667
|
+
210,
|
|
1668
|
+
52,
|
|
1669
|
+
193
|
|
1670
|
+
],
|
|
1671
|
+
accounts: [
|
|
1672
|
+
{
|
|
1673
|
+
name: "reward_pool",
|
|
1674
|
+
docs: [
|
|
1675
|
+
"Reward Pool"
|
|
1676
|
+
],
|
|
1677
|
+
writable: true
|
|
1678
|
+
},
|
|
1679
|
+
{
|
|
1680
|
+
name: "stake_pool",
|
|
1681
|
+
docs: [
|
|
1682
|
+
"Stake Pool"
|
|
1683
|
+
],
|
|
1684
|
+
writable: true,
|
|
1685
|
+
relations: [
|
|
1686
|
+
"reward_pool"
|
|
1687
|
+
]
|
|
1688
|
+
},
|
|
1689
|
+
{
|
|
1690
|
+
name: "stake_entry",
|
|
1691
|
+
docs: [
|
|
1692
|
+
"Stake Entry for which rewards are being claimed"
|
|
1693
|
+
],
|
|
1694
|
+
writable: true
|
|
1695
|
+
},
|
|
1696
|
+
{
|
|
1697
|
+
name: "reward_entry",
|
|
1698
|
+
docs: [
|
|
1699
|
+
"Reward Entry that stores metadata about claimed rewards"
|
|
1700
|
+
],
|
|
1701
|
+
writable: true,
|
|
1702
|
+
pda: {
|
|
1703
|
+
seeds: [
|
|
1704
|
+
{
|
|
1705
|
+
kind: "const",
|
|
1706
|
+
value: [
|
|
1707
|
+
114,
|
|
1708
|
+
101,
|
|
1709
|
+
119,
|
|
1710
|
+
97,
|
|
1711
|
+
114,
|
|
1712
|
+
100,
|
|
1713
|
+
45,
|
|
1714
|
+
101,
|
|
1715
|
+
110,
|
|
1716
|
+
116,
|
|
1717
|
+
114,
|
|
1718
|
+
121
|
|
1719
|
+
]
|
|
1720
|
+
},
|
|
1721
|
+
{
|
|
1722
|
+
kind: "account",
|
|
1723
|
+
path: "reward_pool"
|
|
1724
|
+
},
|
|
1725
|
+
{
|
|
1726
|
+
kind: "account",
|
|
1727
|
+
path: "stake_entry"
|
|
1728
|
+
}
|
|
1729
|
+
]
|
|
1730
|
+
}
|
|
1731
|
+
},
|
|
1732
|
+
{
|
|
1733
|
+
name: "vault",
|
|
1734
|
+
docs: [
|
|
1735
|
+
"Reward Pool Vault that stores tokens"
|
|
1736
|
+
],
|
|
1737
|
+
writable: true,
|
|
1738
|
+
relations: [
|
|
1739
|
+
"reward_pool"
|
|
1740
|
+
]
|
|
1741
|
+
},
|
|
1742
|
+
{
|
|
1743
|
+
name: "stake_vault",
|
|
1744
|
+
writable: true
|
|
1745
|
+
},
|
|
1746
|
+
{
|
|
1747
|
+
name: "to",
|
|
1748
|
+
writable: true
|
|
1749
|
+
},
|
|
1750
|
+
{
|
|
1751
|
+
name: "stake_mint_from",
|
|
1752
|
+
writable: true
|
|
1753
|
+
},
|
|
1754
|
+
{
|
|
1755
|
+
name: "claimant",
|
|
1756
|
+
writable: true
|
|
1757
|
+
},
|
|
1758
|
+
{
|
|
1759
|
+
name: "worker",
|
|
1760
|
+
docs: [
|
|
1761
|
+
"Auto unstake worker"
|
|
1762
|
+
],
|
|
1763
|
+
writable: true,
|
|
1764
|
+
signer: true,
|
|
1765
|
+
address: "wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u"
|
|
1766
|
+
},
|
|
1767
|
+
{
|
|
1768
|
+
name: "mint",
|
|
1769
|
+
docs: [
|
|
1770
|
+
"The mint to claim."
|
|
1771
|
+
],
|
|
1772
|
+
writable: true,
|
|
1773
|
+
relations: [
|
|
1774
|
+
"reward_pool"
|
|
1775
|
+
]
|
|
1776
|
+
},
|
|
1777
|
+
{
|
|
1778
|
+
name: "stake_mint",
|
|
1779
|
+
docs: [
|
|
1780
|
+
"Mint for sTokens issued by the stake pool"
|
|
1781
|
+
],
|
|
1782
|
+
writable: true
|
|
1783
|
+
},
|
|
1784
|
+
{
|
|
1785
|
+
name: "stake_pool_program",
|
|
1786
|
+
address: "STAKEvGqQTtzJZH6BWDcbpzXXn2BBerPAgQ3EGLN2GH"
|
|
1787
|
+
},
|
|
1788
|
+
{
|
|
1789
|
+
name: "associated_token_program",
|
|
1790
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
1791
|
+
},
|
|
1792
|
+
{
|
|
1793
|
+
name: "token_program"
|
|
1794
|
+
},
|
|
1795
|
+
{
|
|
1796
|
+
name: "system_program",
|
|
1797
|
+
address: "11111111111111111111111111111111"
|
|
1798
|
+
}
|
|
1799
|
+
],
|
|
1800
|
+
args: []
|
|
1801
|
+
},
|
|
1802
|
+
{
|
|
1803
|
+
name: "clawback",
|
|
1804
|
+
discriminator: [
|
|
1805
|
+
111,
|
|
1806
|
+
92,
|
|
1807
|
+
142,
|
|
1808
|
+
79,
|
|
1809
|
+
33,
|
|
1810
|
+
234,
|
|
1811
|
+
82,
|
|
1812
|
+
27
|
|
1813
|
+
],
|
|
1814
|
+
accounts: [
|
|
1815
|
+
{
|
|
1816
|
+
name: "reward_pool",
|
|
1817
|
+
docs: [
|
|
1818
|
+
"Reward Pool"
|
|
1819
|
+
],
|
|
1820
|
+
writable: true
|
|
1821
|
+
},
|
|
1822
|
+
{
|
|
1823
|
+
name: "stake_pool",
|
|
1824
|
+
docs: [
|
|
1825
|
+
"Stake Pool to Which Reward Pool belongs"
|
|
1826
|
+
],
|
|
1827
|
+
relations: [
|
|
1828
|
+
"reward_pool"
|
|
1829
|
+
]
|
|
1830
|
+
},
|
|
1831
|
+
{
|
|
1832
|
+
name: "vault",
|
|
1833
|
+
docs: [
|
|
1834
|
+
"Reward Pool Vault that stores tokens"
|
|
1835
|
+
],
|
|
1836
|
+
writable: true,
|
|
1837
|
+
relations: [
|
|
1838
|
+
"reward_pool"
|
|
1839
|
+
]
|
|
1840
|
+
},
|
|
1841
|
+
{
|
|
1842
|
+
name: "to",
|
|
1843
|
+
docs: [
|
|
1844
|
+
"Account to send the reward tokens to."
|
|
1845
|
+
],
|
|
1846
|
+
writable: true
|
|
1847
|
+
},
|
|
1848
|
+
{
|
|
1849
|
+
name: "authority",
|
|
1850
|
+
docs: [
|
|
1851
|
+
"Current Authority"
|
|
1852
|
+
],
|
|
1853
|
+
writable: true,
|
|
1854
|
+
signer: true,
|
|
1855
|
+
relations: [
|
|
1856
|
+
"reward_pool"
|
|
1857
|
+
]
|
|
1858
|
+
},
|
|
1859
|
+
{
|
|
1860
|
+
name: "mint",
|
|
1861
|
+
docs: [
|
|
1862
|
+
"The mint to claim."
|
|
1863
|
+
],
|
|
1864
|
+
relations: [
|
|
1865
|
+
"reward_pool"
|
|
1866
|
+
]
|
|
1867
|
+
},
|
|
1868
|
+
{
|
|
1869
|
+
name: "token_program"
|
|
1870
|
+
},
|
|
1871
|
+
{
|
|
1872
|
+
name: "system_program",
|
|
1873
|
+
address: "11111111111111111111111111111111"
|
|
1874
|
+
}
|
|
1875
|
+
],
|
|
1876
|
+
args: []
|
|
1877
|
+
},
|
|
725
1878
|
{
|
|
726
1879
|
name: "close_entry",
|
|
727
1880
|
discriminator: [
|
|
@@ -1487,7 +2640,7 @@ var reward_pool_default = {
|
|
|
1487
2640
|
{
|
|
1488
2641
|
code: 6002,
|
|
1489
2642
|
name: "InvalidRewardPeriod",
|
|
1490
|
-
msg: "Reward period should be more than 0"
|
|
2643
|
+
msg: "Reward period should be more than 0 and less or equal than staking duration if auto unstake is enabled"
|
|
1491
2644
|
},
|
|
1492
2645
|
{
|
|
1493
2646
|
code: 6003,
|
|
@@ -1548,6 +2701,36 @@ var reward_pool_default = {
|
|
|
1548
2701
|
code: 6014,
|
|
1549
2702
|
name: "InvalidLastClaimPeriod",
|
|
1550
2703
|
msg: "Invalid last claim period provided"
|
|
2704
|
+
},
|
|
2705
|
+
{
|
|
2706
|
+
code: 6015,
|
|
2707
|
+
name: "ClawbackNotPossible",
|
|
2708
|
+
msg: "Clawback is not possible for the provided Stake Pool"
|
|
2709
|
+
},
|
|
2710
|
+
{
|
|
2711
|
+
code: 6016,
|
|
2712
|
+
name: "ClawbackTooEarly",
|
|
2713
|
+
msg: "Clawback requested too early, wait for the Pool to expire and cooldown to pass"
|
|
2714
|
+
},
|
|
2715
|
+
{
|
|
2716
|
+
code: 6017,
|
|
2717
|
+
name: "UpdateNotPossible",
|
|
2718
|
+
msg: "Reward pool can not be updated"
|
|
2719
|
+
},
|
|
2720
|
+
{
|
|
2721
|
+
code: 6018,
|
|
2722
|
+
name: "EntryCreationNotPossibleAfterUnlock",
|
|
2723
|
+
msg: "Reward entry can not be created after stake has been unlocked for this reward pool"
|
|
2724
|
+
},
|
|
2725
|
+
{
|
|
2726
|
+
code: 6019,
|
|
2727
|
+
name: "RefundNotPossible",
|
|
2728
|
+
msg: "Refund not possible for this reward entry"
|
|
2729
|
+
},
|
|
2730
|
+
{
|
|
2731
|
+
code: 6020,
|
|
2732
|
+
name: "PoolCreationLimited",
|
|
2733
|
+
msg: "Pool creation limited, use nonce 0"
|
|
1551
2734
|
}
|
|
1552
2735
|
],
|
|
1553
2736
|
types: [
|
|
@@ -1850,6 +3033,13 @@ var reward_pool_default = {
|
|
|
1850
3033
|
],
|
|
1851
3034
|
type: "u64"
|
|
1852
3035
|
},
|
|
3036
|
+
{
|
|
3037
|
+
name: "clawed_back_ts",
|
|
3038
|
+
docs: [
|
|
3039
|
+
"Timestamp when reward pool was clawed back"
|
|
3040
|
+
],
|
|
3041
|
+
type: "u64"
|
|
3042
|
+
},
|
|
1853
3043
|
{
|
|
1854
3044
|
name: "_buffer",
|
|
1855
3045
|
docs: [
|
|
@@ -1858,7 +3048,7 @@ var reward_pool_default = {
|
|
|
1858
3048
|
type: {
|
|
1859
3049
|
array: [
|
|
1860
3050
|
"u8",
|
|
1861
|
-
|
|
3051
|
+
40
|
|
1862
3052
|
]
|
|
1863
3053
|
}
|
|
1864
3054
|
}
|
|
@@ -1954,6 +3144,13 @@ var reward_pool_default = {
|
|
|
1954
3144
|
],
|
|
1955
3145
|
type: "bool"
|
|
1956
3146
|
},
|
|
3147
|
+
{
|
|
3148
|
+
name: "auto_unstake",
|
|
3149
|
+
docs: [
|
|
3150
|
+
"Whether auto unstaking is enabled, copied from the stake pool for use in instructions that don't require the stake pool account"
|
|
3151
|
+
],
|
|
3152
|
+
type: "bool"
|
|
3153
|
+
},
|
|
1957
3154
|
{
|
|
1958
3155
|
name: "_buffer",
|
|
1959
3156
|
docs: [
|
|
@@ -1962,7 +3159,7 @@ var reward_pool_default = {
|
|
|
1962
3159
|
type: {
|
|
1963
3160
|
array: [
|
|
1964
3161
|
"u8",
|
|
1965
|
-
|
|
3162
|
+
38
|
|
1966
3163
|
]
|
|
1967
3164
|
}
|
|
1968
3165
|
}
|
|
@@ -2093,6 +3290,34 @@ var reward_pool_default = {
|
|
|
2093
3290
|
],
|
|
2094
3291
|
type: "u64"
|
|
2095
3292
|
},
|
|
3293
|
+
{
|
|
3294
|
+
name: "total_stake_capped",
|
|
3295
|
+
docs: [
|
|
3296
|
+
"Whether amount of total staked tokens is limited by `remaining_total_stake` - stored as separate flag to not deal with `Option`"
|
|
3297
|
+
],
|
|
3298
|
+
type: "bool"
|
|
3299
|
+
},
|
|
3300
|
+
{
|
|
3301
|
+
name: "remaining_total_stake",
|
|
3302
|
+
docs: [
|
|
3303
|
+
"Remaining total amount of staked tokens (cumulative)"
|
|
3304
|
+
],
|
|
3305
|
+
type: "u64"
|
|
3306
|
+
},
|
|
3307
|
+
{
|
|
3308
|
+
name: "expiry_ts",
|
|
3309
|
+
docs: [
|
|
3310
|
+
"Time when stake pool expires, staking is not possible after expiration"
|
|
3311
|
+
],
|
|
3312
|
+
type: "u64"
|
|
3313
|
+
},
|
|
3314
|
+
{
|
|
3315
|
+
name: "auto_unstake",
|
|
3316
|
+
docs: [
|
|
3317
|
+
"Whether auto unstaking is enabled, stake entries will be unstaked after duration"
|
|
3318
|
+
],
|
|
3319
|
+
type: "bool"
|
|
3320
|
+
},
|
|
2096
3321
|
{
|
|
2097
3322
|
name: "_buffer",
|
|
2098
3323
|
docs: [
|
|
@@ -2101,7 +3326,7 @@ var reward_pool_default = {
|
|
|
2101
3326
|
type: {
|
|
2102
3327
|
array: [
|
|
2103
3328
|
"u8",
|
|
2104
|
-
|
|
3329
|
+
37
|
|
2105
3330
|
]
|
|
2106
3331
|
}
|
|
2107
3332
|
}
|
|
@@ -2116,7 +3341,7 @@ var reward_pool_dynamic_default = {
|
|
|
2116
3341
|
address: "RWRDyfZa6Rk9UYi85yjYYfGmoUqffLqjo6vZdFawEez",
|
|
2117
3342
|
metadata: {
|
|
2118
3343
|
name: "reward_pool_dynamic",
|
|
2119
|
-
version: "2.
|
|
3344
|
+
version: "2.3.0",
|
|
2120
3345
|
spec: "0.1.0",
|
|
2121
3346
|
description: "Reward pools with dynamic rewards distribution"
|
|
2122
3347
|
},
|
|
@@ -3629,6 +4854,13 @@ var reward_pool_dynamic_default = {
|
|
|
3629
4854
|
],
|
|
3630
4855
|
type: "bool"
|
|
3631
4856
|
},
|
|
4857
|
+
{
|
|
4858
|
+
name: "auto_unstake",
|
|
4859
|
+
docs: [
|
|
4860
|
+
"Whether auto unstaking is enabled, copied from the stake pool for use in instructions that don't require the stake pool account"
|
|
4861
|
+
],
|
|
4862
|
+
type: "bool"
|
|
4863
|
+
},
|
|
3632
4864
|
{
|
|
3633
4865
|
name: "_buffer",
|
|
3634
4866
|
docs: [
|
|
@@ -3637,7 +4869,7 @@ var reward_pool_dynamic_default = {
|
|
|
3637
4869
|
type: {
|
|
3638
4870
|
array: [
|
|
3639
4871
|
"u8",
|
|
3640
|
-
|
|
4872
|
+
38
|
|
3641
4873
|
]
|
|
3642
4874
|
}
|
|
3643
4875
|
}
|
|
@@ -3768,6 +5000,34 @@ var reward_pool_dynamic_default = {
|
|
|
3768
5000
|
],
|
|
3769
5001
|
type: "u64"
|
|
3770
5002
|
},
|
|
5003
|
+
{
|
|
5004
|
+
name: "total_stake_capped",
|
|
5005
|
+
docs: [
|
|
5006
|
+
"Whether amount of total staked tokens is limited by `remaining_total_stake` - stored as separate flag to not deal with `Option`"
|
|
5007
|
+
],
|
|
5008
|
+
type: "bool"
|
|
5009
|
+
},
|
|
5010
|
+
{
|
|
5011
|
+
name: "remaining_total_stake",
|
|
5012
|
+
docs: [
|
|
5013
|
+
"Remaining total amount of staked tokens (cumulative)"
|
|
5014
|
+
],
|
|
5015
|
+
type: "u64"
|
|
5016
|
+
},
|
|
5017
|
+
{
|
|
5018
|
+
name: "expiry_ts",
|
|
5019
|
+
docs: [
|
|
5020
|
+
"Time when stake pool expires, staking is not possible after expiration"
|
|
5021
|
+
],
|
|
5022
|
+
type: "u64"
|
|
5023
|
+
},
|
|
5024
|
+
{
|
|
5025
|
+
name: "auto_unstake",
|
|
5026
|
+
docs: [
|
|
5027
|
+
"Whether auto unstaking is enabled, stake entries will be unstaked after duration"
|
|
5028
|
+
],
|
|
5029
|
+
type: "bool"
|
|
5030
|
+
},
|
|
3771
5031
|
{
|
|
3772
5032
|
name: "_buffer",
|
|
3773
5033
|
docs: [
|
|
@@ -3776,7 +5036,7 @@ var reward_pool_dynamic_default = {
|
|
|
3776
5036
|
type: {
|
|
3777
5037
|
array: [
|
|
3778
5038
|
"u8",
|
|
3779
|
-
|
|
5039
|
+
37
|
|
3780
5040
|
]
|
|
3781
5041
|
}
|
|
3782
5042
|
}
|
|
@@ -3816,6 +5076,13 @@ var reward_pool_dynamic_default = {
|
|
|
3816
5076
|
],
|
|
3817
5077
|
type: "u64"
|
|
3818
5078
|
},
|
|
5079
|
+
{
|
|
5080
|
+
name: "is_sponsored",
|
|
5081
|
+
docs: [
|
|
5082
|
+
"Whether the vote rent has been sponsored by the rent vault"
|
|
5083
|
+
],
|
|
5084
|
+
type: "bool"
|
|
5085
|
+
},
|
|
3819
5086
|
{
|
|
3820
5087
|
name: "_buffer",
|
|
3821
5088
|
docs: [
|
|
@@ -3824,7 +5091,7 @@ var reward_pool_dynamic_default = {
|
|
|
3824
5091
|
type: {
|
|
3825
5092
|
array: [
|
|
3826
5093
|
"u8",
|
|
3827
|
-
|
|
5094
|
+
63
|
|
3828
5095
|
]
|
|
3829
5096
|
}
|
|
3830
5097
|
}
|
|
@@ -3839,7 +5106,7 @@ var stake_pool_default = {
|
|
|
3839
5106
|
address: "STAKEvGqQTtzJZH6BWDcbpzXXn2BBerPAgQ3EGLN2GH",
|
|
3840
5107
|
metadata: {
|
|
3841
5108
|
name: "stake_pool",
|
|
3842
|
-
version: "2.
|
|
5109
|
+
version: "2.3.0",
|
|
3843
5110
|
spec: "0.1.0",
|
|
3844
5111
|
description: "Program to manage Stake Pools and stake/unstake tokens"
|
|
3845
5112
|
},
|
|
@@ -4194,6 +5461,174 @@ var stake_pool_default = {
|
|
|
4194
5461
|
}
|
|
4195
5462
|
]
|
|
4196
5463
|
},
|
|
5464
|
+
{
|
|
5465
|
+
name: "create_pool_v2",
|
|
5466
|
+
discriminator: [
|
|
5467
|
+
133,
|
|
5468
|
+
27,
|
|
5469
|
+
21,
|
|
5470
|
+
38,
|
|
5471
|
+
67,
|
|
5472
|
+
86,
|
|
5473
|
+
91,
|
|
5474
|
+
132
|
|
5475
|
+
],
|
|
5476
|
+
accounts: [
|
|
5477
|
+
{
|
|
5478
|
+
name: "stake_pool",
|
|
5479
|
+
writable: true,
|
|
5480
|
+
pda: {
|
|
5481
|
+
seeds: [
|
|
5482
|
+
{
|
|
5483
|
+
kind: "const",
|
|
5484
|
+
value: [
|
|
5485
|
+
115,
|
|
5486
|
+
116,
|
|
5487
|
+
97,
|
|
5488
|
+
107,
|
|
5489
|
+
101,
|
|
5490
|
+
45,
|
|
5491
|
+
112,
|
|
5492
|
+
111,
|
|
5493
|
+
111,
|
|
5494
|
+
108
|
|
5495
|
+
]
|
|
5496
|
+
},
|
|
5497
|
+
{
|
|
5498
|
+
kind: "account",
|
|
5499
|
+
path: "mint"
|
|
5500
|
+
},
|
|
5501
|
+
{
|
|
5502
|
+
kind: "account",
|
|
5503
|
+
path: "creator"
|
|
5504
|
+
},
|
|
5505
|
+
{
|
|
5506
|
+
kind: "arg",
|
|
5507
|
+
path: "nonce"
|
|
5508
|
+
}
|
|
5509
|
+
]
|
|
5510
|
+
}
|
|
5511
|
+
},
|
|
5512
|
+
{
|
|
5513
|
+
name: "mint",
|
|
5514
|
+
docs: [
|
|
5515
|
+
"Mint used for staking"
|
|
5516
|
+
]
|
|
5517
|
+
},
|
|
5518
|
+
{
|
|
5519
|
+
name: "vault",
|
|
5520
|
+
writable: true,
|
|
5521
|
+
pda: {
|
|
5522
|
+
seeds: [
|
|
5523
|
+
{
|
|
5524
|
+
kind: "const",
|
|
5525
|
+
value: [
|
|
5526
|
+
115,
|
|
5527
|
+
116,
|
|
5528
|
+
97,
|
|
5529
|
+
107,
|
|
5530
|
+
101,
|
|
5531
|
+
45,
|
|
5532
|
+
118,
|
|
5533
|
+
97,
|
|
5534
|
+
117,
|
|
5535
|
+
108,
|
|
5536
|
+
116
|
|
5537
|
+
]
|
|
5538
|
+
},
|
|
5539
|
+
{
|
|
5540
|
+
kind: "account",
|
|
5541
|
+
path: "stake_pool"
|
|
5542
|
+
}
|
|
5543
|
+
]
|
|
5544
|
+
}
|
|
5545
|
+
},
|
|
5546
|
+
{
|
|
5547
|
+
name: "stake_mint",
|
|
5548
|
+
writable: true,
|
|
5549
|
+
pda: {
|
|
5550
|
+
seeds: [
|
|
5551
|
+
{
|
|
5552
|
+
kind: "const",
|
|
5553
|
+
value: [
|
|
5554
|
+
115,
|
|
5555
|
+
116,
|
|
5556
|
+
97,
|
|
5557
|
+
107,
|
|
5558
|
+
101,
|
|
5559
|
+
45,
|
|
5560
|
+
109,
|
|
5561
|
+
105,
|
|
5562
|
+
110,
|
|
5563
|
+
116
|
|
5564
|
+
]
|
|
5565
|
+
},
|
|
5566
|
+
{
|
|
5567
|
+
kind: "account",
|
|
5568
|
+
path: "stake_pool"
|
|
5569
|
+
}
|
|
5570
|
+
]
|
|
5571
|
+
}
|
|
5572
|
+
},
|
|
5573
|
+
{
|
|
5574
|
+
name: "creator",
|
|
5575
|
+
docs: [
|
|
5576
|
+
"Stake Pool creator"
|
|
5577
|
+
],
|
|
5578
|
+
writable: true,
|
|
5579
|
+
signer: true
|
|
5580
|
+
},
|
|
5581
|
+
{
|
|
5582
|
+
name: "token_program"
|
|
5583
|
+
},
|
|
5584
|
+
{
|
|
5585
|
+
name: "system_program",
|
|
5586
|
+
address: "11111111111111111111111111111111"
|
|
5587
|
+
}
|
|
5588
|
+
],
|
|
5589
|
+
args: [
|
|
5590
|
+
{
|
|
5591
|
+
name: "nonce",
|
|
5592
|
+
type: "u8"
|
|
5593
|
+
},
|
|
5594
|
+
{
|
|
5595
|
+
name: "max_weight",
|
|
5596
|
+
type: "u64"
|
|
5597
|
+
},
|
|
5598
|
+
{
|
|
5599
|
+
name: "min_duration",
|
|
5600
|
+
type: "u64"
|
|
5601
|
+
},
|
|
5602
|
+
{
|
|
5603
|
+
name: "max_duration",
|
|
5604
|
+
type: "u64"
|
|
5605
|
+
},
|
|
5606
|
+
{
|
|
5607
|
+
name: "permissionless",
|
|
5608
|
+
type: "bool"
|
|
5609
|
+
},
|
|
5610
|
+
{
|
|
5611
|
+
name: "freeze_stake_mint",
|
|
5612
|
+
type: "bool"
|
|
5613
|
+
},
|
|
5614
|
+
{
|
|
5615
|
+
name: "unstake_period",
|
|
5616
|
+
type: "u64"
|
|
5617
|
+
},
|
|
5618
|
+
{
|
|
5619
|
+
name: "max_total_stake_cumulative",
|
|
5620
|
+
type: "u64"
|
|
5621
|
+
},
|
|
5622
|
+
{
|
|
5623
|
+
name: "expiry_ts",
|
|
5624
|
+
type: "u64"
|
|
5625
|
+
},
|
|
5626
|
+
{
|
|
5627
|
+
name: "auto_unstake",
|
|
5628
|
+
type: "bool"
|
|
5629
|
+
}
|
|
5630
|
+
]
|
|
5631
|
+
},
|
|
4197
5632
|
{
|
|
4198
5633
|
name: "migrate_entry",
|
|
4199
5634
|
discriminator: [
|
|
@@ -4653,7 +6088,60 @@ var stake_pool_default = {
|
|
|
4653
6088
|
docs: [
|
|
4654
6089
|
"Token Account to transfer Stake Mint tokens to"
|
|
4655
6090
|
],
|
|
4656
|
-
writable: true
|
|
6091
|
+
writable: true,
|
|
6092
|
+
pda: {
|
|
6093
|
+
seeds: [
|
|
6094
|
+
{
|
|
6095
|
+
kind: "account",
|
|
6096
|
+
path: "authority"
|
|
6097
|
+
},
|
|
6098
|
+
{
|
|
6099
|
+
kind: "account",
|
|
6100
|
+
path: "token_program"
|
|
6101
|
+
},
|
|
6102
|
+
{
|
|
6103
|
+
kind: "account",
|
|
6104
|
+
path: "stake_mint"
|
|
6105
|
+
}
|
|
6106
|
+
],
|
|
6107
|
+
program: {
|
|
6108
|
+
kind: "const",
|
|
6109
|
+
value: [
|
|
6110
|
+
140,
|
|
6111
|
+
151,
|
|
6112
|
+
37,
|
|
6113
|
+
143,
|
|
6114
|
+
78,
|
|
6115
|
+
36,
|
|
6116
|
+
137,
|
|
6117
|
+
241,
|
|
6118
|
+
187,
|
|
6119
|
+
61,
|
|
6120
|
+
16,
|
|
6121
|
+
41,
|
|
6122
|
+
20,
|
|
6123
|
+
142,
|
|
6124
|
+
13,
|
|
6125
|
+
131,
|
|
6126
|
+
11,
|
|
6127
|
+
90,
|
|
6128
|
+
19,
|
|
6129
|
+
153,
|
|
6130
|
+
218,
|
|
6131
|
+
255,
|
|
6132
|
+
16,
|
|
6133
|
+
132,
|
|
6134
|
+
4,
|
|
6135
|
+
142,
|
|
6136
|
+
123,
|
|
6137
|
+
216,
|
|
6138
|
+
219,
|
|
6139
|
+
233,
|
|
6140
|
+
248,
|
|
6141
|
+
89
|
|
6142
|
+
]
|
|
6143
|
+
}
|
|
6144
|
+
}
|
|
4657
6145
|
},
|
|
4658
6146
|
{
|
|
4659
6147
|
name: "payer",
|
|
@@ -4766,7 +6254,60 @@ var stake_pool_default = {
|
|
|
4766
6254
|
docs: [
|
|
4767
6255
|
"Stake Mint Token account"
|
|
4768
6256
|
],
|
|
4769
|
-
writable: true
|
|
6257
|
+
writable: true,
|
|
6258
|
+
pda: {
|
|
6259
|
+
seeds: [
|
|
6260
|
+
{
|
|
6261
|
+
kind: "account",
|
|
6262
|
+
path: "authority"
|
|
6263
|
+
},
|
|
6264
|
+
{
|
|
6265
|
+
kind: "account",
|
|
6266
|
+
path: "token_program"
|
|
6267
|
+
},
|
|
6268
|
+
{
|
|
6269
|
+
kind: "account",
|
|
6270
|
+
path: "stake_mint"
|
|
6271
|
+
}
|
|
6272
|
+
],
|
|
6273
|
+
program: {
|
|
6274
|
+
kind: "const",
|
|
6275
|
+
value: [
|
|
6276
|
+
140,
|
|
6277
|
+
151,
|
|
6278
|
+
37,
|
|
6279
|
+
143,
|
|
6280
|
+
78,
|
|
6281
|
+
36,
|
|
6282
|
+
137,
|
|
6283
|
+
241,
|
|
6284
|
+
187,
|
|
6285
|
+
61,
|
|
6286
|
+
16,
|
|
6287
|
+
41,
|
|
6288
|
+
20,
|
|
6289
|
+
142,
|
|
6290
|
+
13,
|
|
6291
|
+
131,
|
|
6292
|
+
11,
|
|
6293
|
+
90,
|
|
6294
|
+
19,
|
|
6295
|
+
153,
|
|
6296
|
+
218,
|
|
6297
|
+
255,
|
|
6298
|
+
16,
|
|
6299
|
+
132,
|
|
6300
|
+
4,
|
|
6301
|
+
142,
|
|
6302
|
+
123,
|
|
6303
|
+
216,
|
|
6304
|
+
219,
|
|
6305
|
+
233,
|
|
6306
|
+
248,
|
|
6307
|
+
89
|
|
6308
|
+
]
|
|
6309
|
+
}
|
|
6310
|
+
}
|
|
4770
6311
|
},
|
|
4771
6312
|
{
|
|
4772
6313
|
name: "vault",
|
|
@@ -4850,6 +6391,154 @@ var stake_pool_default = {
|
|
|
4850
6391
|
}
|
|
4851
6392
|
}
|
|
4852
6393
|
]
|
|
6394
|
+
},
|
|
6395
|
+
{
|
|
6396
|
+
name: "unstake_as_worker",
|
|
6397
|
+
discriminator: [
|
|
6398
|
+
18,
|
|
6399
|
+
36,
|
|
6400
|
+
224,
|
|
6401
|
+
241,
|
|
6402
|
+
46,
|
|
6403
|
+
185,
|
|
6404
|
+
228,
|
|
6405
|
+
142
|
|
6406
|
+
],
|
|
6407
|
+
accounts: [
|
|
6408
|
+
{
|
|
6409
|
+
name: "stake_pool",
|
|
6410
|
+
writable: true,
|
|
6411
|
+
relations: [
|
|
6412
|
+
"stake_entry"
|
|
6413
|
+
]
|
|
6414
|
+
},
|
|
6415
|
+
{
|
|
6416
|
+
name: "stake_entry",
|
|
6417
|
+
docs: [
|
|
6418
|
+
"Entry that stores Stake Metadata"
|
|
6419
|
+
],
|
|
6420
|
+
writable: true
|
|
6421
|
+
},
|
|
6422
|
+
{
|
|
6423
|
+
name: "from",
|
|
6424
|
+
docs: [
|
|
6425
|
+
"Stake Mint Token account"
|
|
6426
|
+
],
|
|
6427
|
+
writable: true,
|
|
6428
|
+
pda: {
|
|
6429
|
+
seeds: [
|
|
6430
|
+
{
|
|
6431
|
+
kind: "account",
|
|
6432
|
+
path: "authority"
|
|
6433
|
+
},
|
|
6434
|
+
{
|
|
6435
|
+
kind: "account",
|
|
6436
|
+
path: "token_program"
|
|
6437
|
+
},
|
|
6438
|
+
{
|
|
6439
|
+
kind: "account",
|
|
6440
|
+
path: "stake_mint"
|
|
6441
|
+
}
|
|
6442
|
+
],
|
|
6443
|
+
program: {
|
|
6444
|
+
kind: "const",
|
|
6445
|
+
value: [
|
|
6446
|
+
140,
|
|
6447
|
+
151,
|
|
6448
|
+
37,
|
|
6449
|
+
143,
|
|
6450
|
+
78,
|
|
6451
|
+
36,
|
|
6452
|
+
137,
|
|
6453
|
+
241,
|
|
6454
|
+
187,
|
|
6455
|
+
61,
|
|
6456
|
+
16,
|
|
6457
|
+
41,
|
|
6458
|
+
20,
|
|
6459
|
+
142,
|
|
6460
|
+
13,
|
|
6461
|
+
131,
|
|
6462
|
+
11,
|
|
6463
|
+
90,
|
|
6464
|
+
19,
|
|
6465
|
+
153,
|
|
6466
|
+
218,
|
|
6467
|
+
255,
|
|
6468
|
+
16,
|
|
6469
|
+
132,
|
|
6470
|
+
4,
|
|
6471
|
+
142,
|
|
6472
|
+
123,
|
|
6473
|
+
216,
|
|
6474
|
+
219,
|
|
6475
|
+
233,
|
|
6476
|
+
248,
|
|
6477
|
+
89
|
|
6478
|
+
]
|
|
6479
|
+
}
|
|
6480
|
+
}
|
|
6481
|
+
},
|
|
6482
|
+
{
|
|
6483
|
+
name: "vault",
|
|
6484
|
+
docs: [
|
|
6485
|
+
"Escrow Account that stores Staked tokens"
|
|
6486
|
+
],
|
|
6487
|
+
writable: true,
|
|
6488
|
+
relations: [
|
|
6489
|
+
"stake_pool"
|
|
6490
|
+
]
|
|
6491
|
+
},
|
|
6492
|
+
{
|
|
6493
|
+
name: "to",
|
|
6494
|
+
writable: true
|
|
6495
|
+
},
|
|
6496
|
+
{
|
|
6497
|
+
name: "authority",
|
|
6498
|
+
writable: true
|
|
6499
|
+
},
|
|
6500
|
+
{
|
|
6501
|
+
name: "worker",
|
|
6502
|
+
docs: [
|
|
6503
|
+
"Auto unstake worker"
|
|
6504
|
+
],
|
|
6505
|
+
writable: true,
|
|
6506
|
+
signer: true,
|
|
6507
|
+
address: "wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u"
|
|
6508
|
+
},
|
|
6509
|
+
{
|
|
6510
|
+
name: "mint",
|
|
6511
|
+
docs: [
|
|
6512
|
+
"Original mint of staked tokens"
|
|
6513
|
+
],
|
|
6514
|
+
writable: true,
|
|
6515
|
+
relations: [
|
|
6516
|
+
"stake_pool"
|
|
6517
|
+
]
|
|
6518
|
+
},
|
|
6519
|
+
{
|
|
6520
|
+
name: "stake_mint",
|
|
6521
|
+
docs: [
|
|
6522
|
+
"Stake Mint used to exchanged Staked tokens to"
|
|
6523
|
+
],
|
|
6524
|
+
writable: true,
|
|
6525
|
+
relations: [
|
|
6526
|
+
"stake_pool"
|
|
6527
|
+
]
|
|
6528
|
+
},
|
|
6529
|
+
{
|
|
6530
|
+
name: "associated_token_program",
|
|
6531
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
6532
|
+
},
|
|
6533
|
+
{
|
|
6534
|
+
name: "token_program"
|
|
6535
|
+
},
|
|
6536
|
+
{
|
|
6537
|
+
name: "system_program",
|
|
6538
|
+
address: "11111111111111111111111111111111"
|
|
6539
|
+
}
|
|
6540
|
+
],
|
|
6541
|
+
args: []
|
|
4853
6542
|
}
|
|
4854
6543
|
],
|
|
4855
6544
|
accounts: [
|
|
@@ -4897,7 +6586,7 @@ var stake_pool_default = {
|
|
|
4897
6586
|
{
|
|
4898
6587
|
code: 6e3,
|
|
4899
6588
|
name: "InvalidDuration",
|
|
4900
|
-
msg: "Minimum duration must be less than the maximum"
|
|
6589
|
+
msg: "Minimum duration must be less than the maximum, maximum should be a realistic number of seconds"
|
|
4901
6590
|
},
|
|
4902
6591
|
{
|
|
4903
6592
|
code: 6001,
|
|
@@ -4992,7 +6681,42 @@ var stake_pool_default = {
|
|
|
4992
6681
|
{
|
|
4993
6682
|
code: 6019,
|
|
4994
6683
|
name: "InvalidMinDuration",
|
|
4995
|
-
msg: "Minimum duration should be at least 1"
|
|
6684
|
+
msg: "Minimum duration should be at least 1, for auto-unstake 7 days at least"
|
|
6685
|
+
},
|
|
6686
|
+
{
|
|
6687
|
+
code: 6020,
|
|
6688
|
+
name: "AutoUnstakeNotPossible",
|
|
6689
|
+
msg: "Auto unstake is not possible with unstake period or with a permissionless pool"
|
|
6690
|
+
},
|
|
6691
|
+
{
|
|
6692
|
+
code: 6021,
|
|
6693
|
+
name: "InvalidExpiry",
|
|
6694
|
+
msg: "Expiry can not be less than max duration"
|
|
6695
|
+
},
|
|
6696
|
+
{
|
|
6697
|
+
code: 6022,
|
|
6698
|
+
name: "StakePayerNotSupported",
|
|
6699
|
+
msg: "Separate payer account is not supported when staking in a pool with auto-unstake"
|
|
6700
|
+
},
|
|
6701
|
+
{
|
|
6702
|
+
code: 6023,
|
|
6703
|
+
name: "StakeAmountExceedsMax",
|
|
6704
|
+
msg: "Stake amount exceeds max total stake"
|
|
6705
|
+
},
|
|
6706
|
+
{
|
|
6707
|
+
code: 6024,
|
|
6708
|
+
name: "StakeDurationExceedsExpiry",
|
|
6709
|
+
msg: "Stake duration exceeds stake pool expiry"
|
|
6710
|
+
},
|
|
6711
|
+
{
|
|
6712
|
+
code: 6025,
|
|
6713
|
+
name: "AccountDelegateRevoked",
|
|
6714
|
+
msg: "Token account delegate has been revoked by staker, can't burn tokens"
|
|
6715
|
+
},
|
|
6716
|
+
{
|
|
6717
|
+
code: 6026,
|
|
6718
|
+
name: "RefundNotPossible",
|
|
6719
|
+
msg: "Refund not possible for this stake entry"
|
|
4996
6720
|
}
|
|
4997
6721
|
],
|
|
4998
6722
|
types: [
|
|
@@ -5133,6 +6857,13 @@ var stake_pool_default = {
|
|
|
5133
6857
|
],
|
|
5134
6858
|
type: "bool"
|
|
5135
6859
|
},
|
|
6860
|
+
{
|
|
6861
|
+
name: "auto_unstake",
|
|
6862
|
+
docs: [
|
|
6863
|
+
"Whether auto unstaking is enabled, copied from the stake pool for use in instructions that don't require the stake pool account"
|
|
6864
|
+
],
|
|
6865
|
+
type: "bool"
|
|
6866
|
+
},
|
|
5136
6867
|
{
|
|
5137
6868
|
name: "_buffer",
|
|
5138
6869
|
docs: [
|
|
@@ -5141,7 +6872,7 @@ var stake_pool_default = {
|
|
|
5141
6872
|
type: {
|
|
5142
6873
|
array: [
|
|
5143
6874
|
"u8",
|
|
5144
|
-
|
|
6875
|
+
38
|
|
5145
6876
|
]
|
|
5146
6877
|
}
|
|
5147
6878
|
}
|
|
@@ -5272,6 +7003,34 @@ var stake_pool_default = {
|
|
|
5272
7003
|
],
|
|
5273
7004
|
type: "u64"
|
|
5274
7005
|
},
|
|
7006
|
+
{
|
|
7007
|
+
name: "total_stake_capped",
|
|
7008
|
+
docs: [
|
|
7009
|
+
"Whether amount of total staked tokens is limited by `remaining_total_stake` - stored as separate flag to not deal with `Option`"
|
|
7010
|
+
],
|
|
7011
|
+
type: "bool"
|
|
7012
|
+
},
|
|
7013
|
+
{
|
|
7014
|
+
name: "remaining_total_stake",
|
|
7015
|
+
docs: [
|
|
7016
|
+
"Remaining total amount of staked tokens (cumulative)"
|
|
7017
|
+
],
|
|
7018
|
+
type: "u64"
|
|
7019
|
+
},
|
|
7020
|
+
{
|
|
7021
|
+
name: "expiry_ts",
|
|
7022
|
+
docs: [
|
|
7023
|
+
"Time when stake pool expires, staking is not possible after expiration"
|
|
7024
|
+
],
|
|
7025
|
+
type: "u64"
|
|
7026
|
+
},
|
|
7027
|
+
{
|
|
7028
|
+
name: "auto_unstake",
|
|
7029
|
+
docs: [
|
|
7030
|
+
"Whether auto unstaking is enabled, stake entries will be unstaked after duration"
|
|
7031
|
+
],
|
|
7032
|
+
type: "bool"
|
|
7033
|
+
},
|
|
5275
7034
|
{
|
|
5276
7035
|
name: "_buffer",
|
|
5277
7036
|
docs: [
|
|
@@ -5280,7 +7039,7 @@ var stake_pool_default = {
|
|
|
5280
7039
|
type: {
|
|
5281
7040
|
array: [
|
|
5282
7041
|
"u8",
|
|
5283
|
-
|
|
7042
|
+
37
|
|
5284
7043
|
]
|
|
5285
7044
|
}
|
|
5286
7045
|
}
|
|
@@ -5291,7 +7050,7 @@ var stake_pool_default = {
|
|
|
5291
7050
|
};
|
|
5292
7051
|
var deriveStakePoolPDA = (programId, mint, authority, nonce) => {
|
|
5293
7052
|
return web3_js.PublicKey.findProgramAddressSync(
|
|
5294
|
-
[STAKE_POOL_PREFIX, mint.toBuffer(), authority.toBuffer(), new
|
|
7053
|
+
[STAKE_POOL_PREFIX, mint.toBuffer(), authority.toBuffer(), new BN4__default.default(nonce).toArrayLike(Buffer, "le", 1)],
|
|
5295
7054
|
programId
|
|
5296
7055
|
)[0];
|
|
5297
7056
|
};
|
|
@@ -5303,13 +7062,13 @@ var deriveStakeMintPDA = (programId, stakePool) => {
|
|
|
5303
7062
|
};
|
|
5304
7063
|
var deriveStakeEntryPDA = (programId, stakePool, authority, nonce) => {
|
|
5305
7064
|
return web3_js.PublicKey.findProgramAddressSync(
|
|
5306
|
-
[STAKE_ENTRY_PREFIX, stakePool.toBuffer(), authority.toBuffer(), new
|
|
7065
|
+
[STAKE_ENTRY_PREFIX, stakePool.toBuffer(), authority.toBuffer(), new BN4__default.default(nonce).toArrayLike(Buffer, "le", 4)],
|
|
5307
7066
|
programId
|
|
5308
7067
|
)[0];
|
|
5309
7068
|
};
|
|
5310
7069
|
var deriveRewardPoolPDA = (programId, stakePool, mint, nonce) => {
|
|
5311
7070
|
return web3_js.PublicKey.findProgramAddressSync(
|
|
5312
|
-
[REWARD_POOL_PREFIX, stakePool.toBuffer(), mint.toBuffer(), new
|
|
7071
|
+
[REWARD_POOL_PREFIX, stakePool.toBuffer(), mint.toBuffer(), new BN4__default.default(nonce).toArrayLike(Buffer, "le", 1)],
|
|
5313
7072
|
programId
|
|
5314
7073
|
)[0];
|
|
5315
7074
|
};
|
|
@@ -5362,6 +7121,10 @@ var SolanaStakingClient = class {
|
|
|
5362
7121
|
...fee_manager_default,
|
|
5363
7122
|
address: programIds?.feeManager ?? fee_manager_default.address
|
|
5364
7123
|
};
|
|
7124
|
+
const governorIdl = {
|
|
7125
|
+
...governor_default,
|
|
7126
|
+
address: programIds?.governor ?? governor_default.address
|
|
7127
|
+
};
|
|
5365
7128
|
this.programs = {
|
|
5366
7129
|
stakePoolProgram: new anchor.Program(stakePoolIdl, {
|
|
5367
7130
|
connection: this.connection
|
|
@@ -5374,6 +7137,9 @@ var SolanaStakingClient = class {
|
|
|
5374
7137
|
}),
|
|
5375
7138
|
feeManagerProgram: new anchor.Program(feeManagerIdl, {
|
|
5376
7139
|
connection: this.connection
|
|
7140
|
+
}),
|
|
7141
|
+
governor: new anchor.Program(governorIdl, {
|
|
7142
|
+
connection: this.connection
|
|
5377
7143
|
})
|
|
5378
7144
|
};
|
|
5379
7145
|
}
|
|
@@ -5443,13 +7209,36 @@ var SolanaStakingClient = class {
|
|
|
5443
7209
|
permissionless = false,
|
|
5444
7210
|
freezeStakeMint = null,
|
|
5445
7211
|
unstakePeriod = null,
|
|
7212
|
+
maxTotalStakeCumulative,
|
|
7213
|
+
expiryTs,
|
|
7214
|
+
autoUnstake,
|
|
5446
7215
|
nonce,
|
|
5447
7216
|
tokenProgramId = splToken.TOKEN_PROGRAM_ID
|
|
5448
7217
|
}, extParams) {
|
|
5449
7218
|
const { stakePoolProgram } = this.programs;
|
|
5450
7219
|
const creator = extParams.invoker.publicKey;
|
|
7220
|
+
const v2ParamsSet = maxTotalStakeCumulative !== void 0 || expiryTs !== void 0 || autoUnstake !== void 0;
|
|
5451
7221
|
common.invariant(creator, "Undefined invoker publicKey");
|
|
5452
|
-
const createInstruction = await stakePoolProgram.methods.
|
|
7222
|
+
const createInstruction = await (v2ParamsSet ? stakePoolProgram.methods.createPoolV2(
|
|
7223
|
+
nonce,
|
|
7224
|
+
maxWeight,
|
|
7225
|
+
minDuration,
|
|
7226
|
+
maxDuration,
|
|
7227
|
+
permissionless,
|
|
7228
|
+
freezeStakeMint ?? false,
|
|
7229
|
+
unstakePeriod ?? new BN4__default.default(0),
|
|
7230
|
+
maxTotalStakeCumulative ?? new BN4__default.default(0),
|
|
7231
|
+
expiryTs ?? new BN4__default.default(0),
|
|
7232
|
+
autoUnstake ?? false
|
|
7233
|
+
) : stakePoolProgram.methods.createPool(
|
|
7234
|
+
nonce,
|
|
7235
|
+
maxWeight,
|
|
7236
|
+
minDuration,
|
|
7237
|
+
maxDuration,
|
|
7238
|
+
permissionless,
|
|
7239
|
+
freezeStakeMint,
|
|
7240
|
+
unstakePeriod
|
|
7241
|
+
)).accounts({
|
|
5453
7242
|
creator,
|
|
5454
7243
|
mint,
|
|
5455
7244
|
tokenProgram: tokenProgramId
|
|
@@ -5505,14 +7294,11 @@ var SolanaStakingClient = class {
|
|
|
5505
7294
|
const { stakePoolProgram } = this.programs;
|
|
5506
7295
|
const staker = extParams.invoker.publicKey;
|
|
5507
7296
|
common.invariant(staker, "Undefined invoker publicKey");
|
|
5508
|
-
const mint = deriveStakeMintPDA(stakePoolProgram.programId, solana.pk(stakePool));
|
|
5509
|
-
const stakeMintAccountKey = splToken.getAssociatedTokenAddressSync(mint, staker, true, solana.pk(tokenProgramId));
|
|
5510
7297
|
const poolMintAccountKey = splToken.getAssociatedTokenAddressSync(solana.pk(stakePoolMint), staker, true, solana.pk(tokenProgramId));
|
|
5511
7298
|
const instruction = await stakePoolProgram.methods.stake(nonce, amount, duration).accounts({
|
|
5512
7299
|
stakePool,
|
|
5513
7300
|
tokenProgram: tokenProgramId,
|
|
5514
7301
|
from: poolMintAccountKey,
|
|
5515
|
-
to: stakeMintAccountKey,
|
|
5516
7302
|
authority: staker,
|
|
5517
7303
|
payer: staker
|
|
5518
7304
|
}).instruction();
|
|
@@ -5606,14 +7392,11 @@ var SolanaStakingClient = class {
|
|
|
5606
7392
|
const { stakePoolProgram } = this.programs;
|
|
5607
7393
|
const staker = extParams.invoker.publicKey;
|
|
5608
7394
|
common.invariant(staker, "Undefined invoker publicKey");
|
|
5609
|
-
const stakeMintKey = deriveStakeMintPDA(stakePoolProgram.programId, solana.pk(stakePool));
|
|
5610
7395
|
const stakeEntryKey = deriveStakeEntryPDA(stakePoolProgram.programId, solana.pk(stakePool), staker, nonce);
|
|
5611
7396
|
const poolMintAccountKey = splToken.getAssociatedTokenAddressSync(solana.pk(stakePoolMint), staker, true, solana.pk(tokenProgramId));
|
|
5612
|
-
const stakeMintAccountKey = splToken.getAssociatedTokenAddressSync(stakeMintKey, staker, true, solana.pk(tokenProgramId));
|
|
5613
7397
|
const instruction = await stakePoolProgram.methods.unstake(shouldClose).accounts({
|
|
5614
7398
|
stakeEntry: stakeEntryKey,
|
|
5615
7399
|
to: poolMintAccountKey,
|
|
5616
|
-
from: stakeMintAccountKey,
|
|
5617
7400
|
authority: staker,
|
|
5618
7401
|
tokenProgram: tokenProgramId
|
|
5619
7402
|
}).instruction();
|
|
@@ -5900,10 +7683,10 @@ var RewardEntryAccumulator = class {
|
|
|
5900
7683
|
}
|
|
5901
7684
|
// Calculate accountable amount by calculating how many seconds have passed since last claim/stake time
|
|
5902
7685
|
getAccountableAmount(stakedTs, accountableTs, effectiveStakedAmount, rewardAmount, rewardPeriod) {
|
|
5903
|
-
const lastAccountedTs = this.lastAccountedTs.gt(new
|
|
7686
|
+
const lastAccountedTs = this.lastAccountedTs.gt(new BN4__default.default(0)) ? this.lastAccountedTs : stakedTs;
|
|
5904
7687
|
const secondsPassed = accountableTs.sub(lastAccountedTs);
|
|
5905
7688
|
if (secondsPassed.lt(rewardPeriod)) {
|
|
5906
|
-
return new
|
|
7689
|
+
return new BN4__default.default(0);
|
|
5907
7690
|
}
|
|
5908
7691
|
const periodsPassed = secondsPassed.div(rewardPeriod);
|
|
5909
7692
|
const claimablePerEffectiveStake = periodsPassed.mul(rewardAmount);
|
|
@@ -5937,11 +7720,11 @@ var createDefaultRewardEntry = (stakeEntry, rewardPool) => {
|
|
|
5937
7720
|
stakeEntry: new web3_js.PublicKey(stakeEntry.publicKey),
|
|
5938
7721
|
rewardPool: new web3_js.PublicKey(rewardPool.publicKey),
|
|
5939
7722
|
createdTs: stakeEntry.account.createdTs,
|
|
5940
|
-
lastAccountedTs: new
|
|
5941
|
-
lastRewardAmount: new
|
|
5942
|
-
lastRewardPeriod: new
|
|
5943
|
-
accountedAmount: new
|
|
5944
|
-
claimedAmount: new
|
|
7723
|
+
lastAccountedTs: new BN4__default.default(0),
|
|
7724
|
+
lastRewardAmount: new BN4__default.default(0),
|
|
7725
|
+
lastRewardPeriod: new BN4__default.default(0),
|
|
7726
|
+
accountedAmount: new BN4__default.default(0),
|
|
7727
|
+
claimedAmount: new BN4__default.default(0),
|
|
5945
7728
|
isSponsored: false,
|
|
5946
7729
|
buffer: []
|
|
5947
7730
|
};
|
|
@@ -5955,8 +7738,8 @@ var calcRewards = (rewardEntryAccount, stakeEntryAccount, rewardPoolAccount) =>
|
|
|
5955
7738
|
throw new Error("InvalidRewardEntry");
|
|
5956
7739
|
}
|
|
5957
7740
|
const currTs = Math.floor(Date.now() / 1e3);
|
|
5958
|
-
const stakedTs = rewardPool.createdTs ?
|
|
5959
|
-
const claimableTs = stakeEntry.closedTs.gtn(0) ? stakeEntry.closedTs : new
|
|
7741
|
+
const stakedTs = rewardPool.createdTs ? BN4__default.default.max(stakeEntry.createdTs, rewardPool.createdTs) : stakeEntry.createdTs;
|
|
7742
|
+
const claimableTs = stakeEntry.closedTs.gtn(0) ? stakeEntry.closedTs : new BN4__default.default(currTs);
|
|
5960
7743
|
const amountUpdated = !rewardPool.rewardAmount.eq(rewardPool.lastRewardAmount) && rewardPool.lastAmountUpdateTs.gt(stakeEntry.createdTs) && rewardPool.lastAmountUpdateTs.gt(stakeEntry.closedTs);
|
|
5961
7744
|
const periodUpdated = !rewardPool.rewardPeriod.eq(rewardPool.lastRewardPeriod) && rewardPool.lastPeriodUpdateTs.gt(stakeEntry.createdTs) && rewardPool.lastPeriodUpdateTs.gt(stakeEntry.closedTs);
|
|
5962
7745
|
if (amountUpdated || periodUpdated) {
|
|
@@ -5974,12 +7757,12 @@ var calcRewards = (rewardEntryAccount, stakeEntryAccount, rewardPoolAccount) =>
|
|
|
5974
7757
|
rewardPeriod = rewardPool.rewardPeriod;
|
|
5975
7758
|
}
|
|
5976
7759
|
} else if (amountUpdated) {
|
|
5977
|
-
firstUpdateTs = new
|
|
7760
|
+
firstUpdateTs = new BN4__default.default(0);
|
|
5978
7761
|
secondUpdateTs = rewardPool.lastAmountUpdateTs;
|
|
5979
7762
|
rewardAmount = rewardEntryAccumulator.lastRewardAmount;
|
|
5980
7763
|
rewardPeriod = rewardEntryAccumulator.lastRewardPeriod;
|
|
5981
7764
|
} else {
|
|
5982
|
-
firstUpdateTs = new
|
|
7765
|
+
firstUpdateTs = new BN4__default.default(0);
|
|
5983
7766
|
secondUpdateTs = rewardPool.lastPeriodUpdateTs;
|
|
5984
7767
|
rewardAmount = rewardEntryAccumulator.lastRewardAmount;
|
|
5985
7768
|
rewardPeriod = rewardEntryAccumulator.lastRewardPeriod;
|
|
@@ -6032,7 +7815,7 @@ var calculateRewardAmountFromValue = (rewardTokenValue, stakeTokenDecimals) => {
|
|
|
6032
7815
|
if (decimalsDiff === 0) {
|
|
6033
7816
|
return rewardTokenValue;
|
|
6034
7817
|
}
|
|
6035
|
-
const diffFactor = new
|
|
7818
|
+
const diffFactor = new BN4__default.default(10).pow(new BN4__default.default(Math.abs(decimalsDiff)));
|
|
6036
7819
|
if (decimalsDiff > 0) {
|
|
6037
7820
|
return rewardTokenValue.mul(diffFactor);
|
|
6038
7821
|
}
|
|
@@ -6077,13 +7860,13 @@ async function calculateAmountWithTransferFees(connection, transferFeeConfig, tr
|
|
|
6077
7860
|
}
|
|
6078
7861
|
var calculateStakeWeight = (minDuration, maxDuration, maxWeight, duration) => {
|
|
6079
7862
|
const durationSpan = maxDuration.sub(minDuration);
|
|
6080
|
-
if (durationSpan.eq(new
|
|
7863
|
+
if (durationSpan.eq(new BN4__default.default(0))) {
|
|
6081
7864
|
return SCALE_PRECISION_FACTOR_BN;
|
|
6082
7865
|
}
|
|
6083
7866
|
const durationExceedingMin = duration.sub(minDuration);
|
|
6084
7867
|
const normalizedWeight = durationExceedingMin.mul(SCALE_PRECISION_FACTOR_BN).div(durationSpan);
|
|
6085
7868
|
const weightDiff = maxWeight.sub(SCALE_PRECISION_FACTOR_BN);
|
|
6086
|
-
return
|
|
7869
|
+
return BN4__default.default.max(
|
|
6087
7870
|
SCALE_PRECISION_FACTOR_BN.add(normalizedWeight.mul(weightDiff).div(SCALE_PRECISION_FACTOR_BN)),
|
|
6088
7871
|
SCALE_PRECISION_FACTOR_BN
|
|
6089
7872
|
);
|