Struct squads_multisig_program::state::Multisig
source · pub struct Multisig {
pub create_key: Pubkey,
pub config_authority: Pubkey,
pub threshold: u16,
pub time_lock: u32,
pub transaction_index: u64,
pub stale_transaction_index: u64,
pub _reserved: u8,
pub bump: u8,
pub members: Vec<Member>,
}Fields§
§create_key: PubkeyKey that is used to seed the multisig PDA.
The authority that can change the multisig config. This is a very important parameter as this authority can change the members and threshold.
The convention is to set this to Pubkey::default().
In this case, the multisig becomes autonomous, so every config change goes through
the normal process of voting by the members.
However, if this parameter is set to any other key, all the config changes for this multisig
will need to be signed by the config_authority. We call such a multisig a “controlled multisig”.
threshold: u16Threshold for signatures.
time_lock: u32How many seconds must pass between transaction voting settlement and execution.
transaction_index: u64Last transaction index. 0 means no transactions have been created.
stale_transaction_index: u64Last stale transaction index. All transactions up until this index are stale. This index is updated when multisig config (members/threshold/time_lock) changes.
_reserved: u8Reserved for future use.
bump: u8Bump for the multisig PDA seed.
members: Vec<Member>Members of the multisig.
Implementations§
source§impl Multisig
impl Multisig
pub fn size(members_length: usize) -> usize
pub fn num_voters(members: &[Member]) -> usize
pub fn num_proposers(members: &[Member]) -> usize
pub fn num_executors(members: &[Member]) -> usize
sourcepub fn realloc_if_needed<'a>(
multisig: AccountInfo<'a>,
members_length: usize,
rent_payer: AccountInfo<'a>,
system_program: AccountInfo<'a>
) -> Result<bool>
pub fn realloc_if_needed<'a>( multisig: AccountInfo<'a>, members_length: usize, rent_payer: AccountInfo<'a>, system_program: AccountInfo<'a> ) -> Result<bool>
Check if the multisig account space needs to be reallocated to accommodate members_length.
Returns true if the account was reallocated.
pub fn invariant(&self) -> Result<()>
sourcepub fn invalidate_prior_transactions(&mut self)
pub fn invalidate_prior_transactions(&mut self)
Makes the transactions created up until this moment stale. Should be called whenever any multisig parameter related to the voting consensus is changed.
sourcepub fn is_member(&self, member_pubkey: Pubkey) -> Option<usize>
pub fn is_member(&self, member_pubkey: Pubkey) -> Option<usize>
Returns Some(index) if member_pubkey is a member, with index into the members vec.
None otherwise.
pub fn member_has_permission( &self, member_pubkey: Pubkey, permission: Permission ) -> bool
sourcepub fn cutoff(&self) -> usize
pub fn cutoff(&self) -> usize
How many “reject” votes are enough to make the transaction “Rejected”. The cutoff must be such that it is impossible for the remaining voters to reach the approval threshold. For example: total voters = 7, threshold = 3, cutoff = 5.
sourcepub fn add_member(&mut self, new_member: Member)
pub fn add_member(&mut self, new_member: Member)
Add new_member to the multisig members vec and sort the vec.
sourcepub fn remove_member(&mut self, member_pubkey: Pubkey) -> Result<()>
pub fn remove_member(&mut self, member_pubkey: Pubkey) -> Result<()>
Remove member_pubkey from the multisig members vec.
Errors
MultisigError::NotAMemberifmember_pubkeyis not a member.
Trait Implementations§
source§impl AccountDeserialize for Multisig
impl AccountDeserialize for Multisig
source§fn try_deserialize(buf: &mut &[u8]) -> Result<Self>
fn try_deserialize(buf: &mut &[u8]) -> Result<Self>
Mint account into a token
Account.