Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions vote-interface/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,17 @@ pub enum VoteInstruction {
/// account is not reserved.
/// 2. `[SIGNER]` Vote account withdraw authority
UpdateCommissionCollector(CommissionKind),

/// Update the commission rate in basis points for the specified commission
/// rate kind in a vote account.
///
/// # Account references
/// 0. `[WRITE]` Vote account to be updated with the new commission
/// 1. `[SIGNER]` Vote account withdraw authority
UpdateCommissionBps {
commission_bps: u16,
kind: CommissionKind,
},
}

impl VoteInstruction {
Expand Down Expand Up @@ -547,6 +558,28 @@ pub fn update_commission_collector(
)
}

#[cfg(feature = "bincode")]
pub fn update_commission_bps(
vote_pubkey: &Pubkey,
authorized_withdrawer_pubkey: &Pubkey,
kind: CommissionKind,
commission_bps: u16,
) -> Instruction {
let account_metas = vec![
AccountMeta::new(*vote_pubkey, false),
AccountMeta::new_readonly(*authorized_withdrawer_pubkey, true),
];

Instruction::new_with_bincode(
id(),
&VoteInstruction::UpdateCommissionBps {
kind,
commission_bps,
},
account_metas,
)
}

#[cfg(feature = "bincode")]
pub fn vote(vote_pubkey: &Pubkey, authorized_voter_pubkey: &Pubkey, vote: Vote) -> Instruction {
let account_metas = vec![
Expand Down