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 rent_collector: Option<Pubkey>,
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.
rent_collector: Option<Pubkey>The address where the rent for the accounts related to executed, rejected, or cancelled
transactions can be reclaimed. If set to None, the rent reclamation feature is turned off.
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: Option<AccountInfo<'a>>,
system_program: Option<AccountInfo<'a>>,
) -> Result<bool>
pub fn realloc_if_needed<'a>( multisig: AccountInfo<'a>, members_length: usize, rent_payer: Option<AccountInfo<'a>>, system_program: Option<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.
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.Source§fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self>
fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self>
Source§impl AccountSerialize for Multisig
impl AccountSerialize for Multisig
Source§impl BorshDeserialize for Multisig
impl BorshDeserialize for Multisig
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for Multisigwhere
Pubkey: BorshSerialize,
u16: BorshSerialize,
u32: BorshSerialize,
u64: BorshSerialize,
Option<Pubkey>: BorshSerialize,
u8: BorshSerialize,
Vec<Member>: BorshSerialize,
impl BorshSerialize for Multisigwhere
Pubkey: BorshSerialize,
u16: BorshSerialize,
u32: BorshSerialize,
u64: BorshSerialize,
Option<Pubkey>: BorshSerialize,
u8: BorshSerialize,
Vec<Member>: BorshSerialize,
Source§impl Discriminator for Multisig
impl Discriminator for Multisig
const DISCRIMINATOR: [u8; 8]
fn discriminator() -> [u8; 8]
Auto Trait Implementations§
impl Freeze for Multisig
impl RefUnwindSafe for Multisig
impl Send for Multisig
impl Sync for Multisig
impl Unpin for Multisig
impl UnwindSafe for Multisig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more