Skip to content

Commit 4dd9b57

Browse files
authored
SIMD-0291: UpdateCommissionBps (#475)
1 parent 24391dd commit 4dd9b57

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

vote-interface/src/instruction.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,17 @@ pub enum VoteInstruction {
208208
/// account is not reserved.
209209
/// 2. `[SIGNER]` Vote account withdraw authority
210210
UpdateCommissionCollector(CommissionKind),
211+
212+
/// Update the commission rate in basis points for the specified commission
213+
/// rate kind in a vote account.
214+
///
215+
/// # Account references
216+
/// 0. `[WRITE]` Vote account to be updated with the new commission
217+
/// 1. `[SIGNER]` Vote account withdraw authority
218+
UpdateCommissionBps {
219+
commission_bps: u16,
220+
kind: CommissionKind,
221+
},
211222
}
212223

213224
impl VoteInstruction {
@@ -547,6 +558,28 @@ pub fn update_commission_collector(
547558
)
548559
}
549560

561+
#[cfg(feature = "bincode")]
562+
pub fn update_commission_bps(
563+
vote_pubkey: &Pubkey,
564+
authorized_withdrawer_pubkey: &Pubkey,
565+
kind: CommissionKind,
566+
commission_bps: u16,
567+
) -> Instruction {
568+
let account_metas = vec![
569+
AccountMeta::new(*vote_pubkey, false),
570+
AccountMeta::new_readonly(*authorized_withdrawer_pubkey, true),
571+
];
572+
573+
Instruction::new_with_bincode(
574+
id(),
575+
&VoteInstruction::UpdateCommissionBps {
576+
kind,
577+
commission_bps,
578+
},
579+
account_metas,
580+
)
581+
}
582+
550583
#[cfg(feature = "bincode")]
551584
pub fn vote(vote_pubkey: &Pubkey, authorized_voter_pubkey: &Pubkey, vote: Vote) -> Instruction {
552585
let account_metas = vec![

0 commit comments

Comments
 (0)