@@ -30,13 +30,14 @@ pub enum StakePoolInstruction {
30
30
/// Initializes a new StakePool.
31
31
///
32
32
/// 0. `[w]` New StakePool to create.
33
- /// 1. `[s]` Owner
34
- /// 2. `[w]` Uninitialized validator stake list storage account
35
- /// 3. `[]` pool token Mint. Must be non zero, owned by withdraw authority.
36
- /// 4. `[]` Pool Account to deposit the generated fee for owner.
37
- /// 5. `[]` Clock sysvar
38
- /// 6. `[]` Rent sysvar
39
- /// 7. `[]` Token program id
33
+ /// 1. `[s]` Manager
34
+ /// 2. `[]` Staker
35
+ /// 3. `[w]` Uninitialized validator stake list storage account
36
+ /// 4. `[]` Pool token mint. Must be non zero, owned by withdraw authority.
37
+ /// 5. `[]` Pool account to deposit the generated fee for manager.
38
+ /// 6. `[]` Clock sysvar
39
+ /// 7. `[]` Rent sysvar
40
+ /// 8. `[]` Token program id
40
41
Initialize {
41
42
/// Deposit fee assessed
42
43
#[ allow( dead_code) ] // but it's not
@@ -46,10 +47,11 @@ pub enum StakePoolInstruction {
46
47
max_validators : u32 ,
47
48
} ,
48
49
49
- /// Creates new program account for accumulating stakes for a particular validator
50
+ /// (Staker only) Creates new program account for accumulating stakes for
51
+ /// a particular validator
50
52
///
51
53
/// 0. `[]` Stake pool account this stake will belong to
52
- /// 1. `[s]` Owner
54
+ /// 1. `[s]` Staker
53
55
/// 2. `[ws]` Funding account (must be a system account)
54
56
/// 3. `[w]` Stake account to be created
55
57
/// 4. `[]` Validator this stake account will vote for
@@ -58,11 +60,11 @@ pub enum StakePoolInstruction {
58
60
/// 7. `[]` Stake program
59
61
CreateValidatorStakeAccount ,
60
62
61
- /// Adds stake account delegated to validator to the pool's list of
62
- /// managed validators
63
+ /// (Staker only) Adds stake account delegated to validator to the pool's
64
+ /// list of managed validators
63
65
///
64
66
/// 0. `[w]` Stake pool
65
- /// 1. `[s]` Owner
67
+ /// 1. `[s]` Staker
66
68
/// 2. `[]` Stake pool deposit authority
67
69
/// 3. `[]` Stake pool withdraw authority
68
70
/// 4. `[w]` Validator stake list storage account
@@ -75,10 +77,10 @@ pub enum StakePoolInstruction {
75
77
/// 11. `[]` Stake program id,
76
78
AddValidatorToPool ,
77
79
78
- /// Removes validator stake account from the pool
80
+ /// (Staker only) Removes validator from the pool
79
81
///
80
82
/// 0. `[w]` Stake pool
81
- /// 1. `[s]` Owner
83
+ /// 1. `[s]` Staker
82
84
/// 2. `[]` Stake pool withdraw authority
83
85
/// 3. `[]` New withdraw/staker authority to set in the stake account
84
86
/// 4. `[w]` Validator stake list storage account
@@ -139,23 +141,31 @@ pub enum StakePoolInstruction {
139
141
/// userdata: amount to withdraw
140
142
Withdraw ( u64 ) ,
141
143
142
- /// Update owner
144
+ /// (Manager only) Update manager
143
145
///
144
- /// 0. `[w]` StakePool
145
- /// 1. `[s]` Owner
146
- /// 2. '[]` New owner pubkey
147
- /// 3. '[]` New owner fee account
148
- SetOwner ,
146
+ /// 0. `[w]` StakePool
147
+ /// 1. `[s]` Manager
148
+ /// 2. '[]` New manager pubkey
149
+ /// 3. '[]` New manager fee account
150
+ SetManager ,
151
+
152
+ /// (Manager or staker only) Update staker
153
+ ///
154
+ /// 0. `[w]` StakePool
155
+ /// 1. `[s]` Manager or current staker
156
+ /// 2. '[]` New staker pubkey
157
+ SetStaker ,
149
158
}
150
159
151
160
/// Creates an 'initialize' instruction.
152
161
pub fn initialize (
153
162
program_id : & Pubkey ,
154
163
stake_pool : & Pubkey ,
155
- owner : & Pubkey ,
164
+ manager : & Pubkey ,
165
+ staker : & Pubkey ,
156
166
validator_list : & Pubkey ,
157
167
pool_mint : & Pubkey ,
158
- owner_pool_account : & Pubkey ,
168
+ manager_pool_account : & Pubkey ,
159
169
token_program_id : & Pubkey ,
160
170
fee : Fee ,
161
171
max_validators : u32 ,
@@ -167,10 +177,11 @@ pub fn initialize(
167
177
let data = init_data. try_to_vec ( ) ?;
168
178
let accounts = vec ! [
169
179
AccountMeta :: new( * stake_pool, true ) ,
170
- AccountMeta :: new_readonly( * owner, true ) ,
180
+ AccountMeta :: new_readonly( * manager, true ) ,
181
+ AccountMeta :: new_readonly( * staker, false ) ,
171
182
AccountMeta :: new( * validator_list, false ) ,
172
183
AccountMeta :: new_readonly( * pool_mint, false ) ,
173
- AccountMeta :: new_readonly( * owner_pool_account , false ) ,
184
+ AccountMeta :: new_readonly( * manager_pool_account , false ) ,
174
185
AccountMeta :: new_readonly( sysvar:: clock:: id( ) , false ) ,
175
186
AccountMeta :: new_readonly( sysvar:: rent:: id( ) , false ) ,
176
187
AccountMeta :: new_readonly( * token_program_id, false ) ,
@@ -186,14 +197,14 @@ pub fn initialize(
186
197
pub fn create_validator_stake_account (
187
198
program_id : & Pubkey ,
188
199
stake_pool : & Pubkey ,
189
- owner : & Pubkey ,
200
+ staker : & Pubkey ,
190
201
funder : & Pubkey ,
191
202
stake_account : & Pubkey ,
192
203
validator : & Pubkey ,
193
204
) -> Result < Instruction , ProgramError > {
194
205
let accounts = vec ! [
195
206
AccountMeta :: new_readonly( * stake_pool, false ) ,
196
- AccountMeta :: new_readonly( * owner , true ) ,
207
+ AccountMeta :: new_readonly( * staker , true ) ,
197
208
AccountMeta :: new( * funder, true ) ,
198
209
AccountMeta :: new( * stake_account, false ) ,
199
210
AccountMeta :: new_readonly( * validator, false ) ,
@@ -215,7 +226,7 @@ pub fn create_validator_stake_account(
215
226
pub fn add_validator_to_pool (
216
227
program_id : & Pubkey ,
217
228
stake_pool : & Pubkey ,
218
- owner : & Pubkey ,
229
+ staker : & Pubkey ,
219
230
stake_pool_deposit : & Pubkey ,
220
231
stake_pool_withdraw : & Pubkey ,
221
232
validator_list : & Pubkey ,
@@ -226,7 +237,7 @@ pub fn add_validator_to_pool(
226
237
) -> Result < Instruction , ProgramError > {
227
238
let accounts = vec ! [
228
239
AccountMeta :: new( * stake_pool, false ) ,
229
- AccountMeta :: new_readonly( * owner , true ) ,
240
+ AccountMeta :: new_readonly( * staker , true ) ,
230
241
AccountMeta :: new_readonly( * stake_pool_deposit, false ) ,
231
242
AccountMeta :: new_readonly( * stake_pool_withdraw, false ) ,
232
243
AccountMeta :: new( * validator_list, false ) ,
@@ -249,7 +260,7 @@ pub fn add_validator_to_pool(
249
260
pub fn remove_validator_from_pool (
250
261
program_id : & Pubkey ,
251
262
stake_pool : & Pubkey ,
252
- owner : & Pubkey ,
263
+ staker : & Pubkey ,
253
264
stake_pool_withdraw : & Pubkey ,
254
265
new_stake_authority : & Pubkey ,
255
266
validator_list : & Pubkey ,
@@ -260,7 +271,7 @@ pub fn remove_validator_from_pool(
260
271
) -> Result < Instruction , ProgramError > {
261
272
let accounts = vec ! [
262
273
AccountMeta :: new( * stake_pool, false ) ,
263
- AccountMeta :: new_readonly( * owner , true ) ,
274
+ AccountMeta :: new_readonly( * staker , true ) ,
264
275
AccountMeta :: new_readonly( * stake_pool_withdraw, false ) ,
265
276
AccountMeta :: new_readonly( * new_stake_authority, false ) ,
266
277
AccountMeta :: new( * validator_list, false ) ,
@@ -385,23 +396,42 @@ pub fn withdraw(
385
396
} )
386
397
}
387
398
388
- /// Creates a 'set owner' instruction.
389
- pub fn set_owner (
399
+ /// Creates a 'set manager' instruction.
400
+ pub fn set_manager (
401
+ program_id : & Pubkey ,
402
+ stake_pool : & Pubkey ,
403
+ manager : & Pubkey ,
404
+ new_manager : & Pubkey ,
405
+ new_fee_receiver : & Pubkey ,
406
+ ) -> Result < Instruction , ProgramError > {
407
+ let accounts = vec ! [
408
+ AccountMeta :: new( * stake_pool, false ) ,
409
+ AccountMeta :: new_readonly( * manager, true ) ,
410
+ AccountMeta :: new_readonly( * new_manager, false ) ,
411
+ AccountMeta :: new_readonly( * new_fee_receiver, false ) ,
412
+ ] ;
413
+ Ok ( Instruction {
414
+ program_id : * program_id,
415
+ accounts,
416
+ data : StakePoolInstruction :: SetManager . try_to_vec ( ) ?,
417
+ } )
418
+ }
419
+
420
+ /// Creates a 'set staker' instruction.
421
+ pub fn set_staker (
390
422
program_id : & Pubkey ,
391
423
stake_pool : & Pubkey ,
392
- stake_pool_owner : & Pubkey ,
393
- stake_pool_new_owner : & Pubkey ,
394
- stake_pool_new_fee_receiver : & Pubkey ,
424
+ set_staker_authority : & Pubkey ,
425
+ new_staker : & Pubkey ,
395
426
) -> Result < Instruction , ProgramError > {
396
427
let accounts = vec ! [
397
428
AccountMeta :: new( * stake_pool, false ) ,
398
- AccountMeta :: new_readonly( * stake_pool_owner, true ) ,
399
- AccountMeta :: new_readonly( * stake_pool_new_owner, false ) ,
400
- AccountMeta :: new_readonly( * stake_pool_new_fee_receiver, false ) ,
429
+ AccountMeta :: new_readonly( * set_staker_authority, true ) ,
430
+ AccountMeta :: new_readonly( * new_staker, false ) ,
401
431
] ;
402
432
Ok ( Instruction {
403
433
program_id : * program_id,
404
434
accounts,
405
- data : StakePoolInstruction :: SetOwner . try_to_vec ( ) ?,
435
+ data : StakePoolInstruction :: SetStaker . try_to_vec ( ) ?,
406
436
} )
407
437
}
0 commit comments