A Multisig account gets derived the following way. The program for the derivation is the Squads program ID.
[createKey]
The createKey is a unique Public Key, made specifically to derive the Multisig PDA.
Multisig Account Content
#[account]pubstructMultisig {/// Key that is used to seed the multisig PDA.pub create_key:Pubkey,/// 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".pub config_authority:Pubkey,/// Threshold for signatures.pub threshold:u16,/// How many seconds must pass between transaction voting settlement and execution.pub time_lock:u32,/// Last transaction index. 0 means no transactions have been created.pub transaction_index:u64,/// Last stale transaction index. All transactions up until this index are stale./// This index is updated when multisig config (members/threshold/time_lock) changes.pub stale_transaction_index:u64,/// Reserved for future use.pub _reserved:u8,/// Bump for the multisig PDA seed.pub bump:u8,/// Members of the multisig.pub members:Vec<Member>,}
Proposal
Proposal PDA Derivation
A Proposal account gets derived the following way. The program for the derivation is the Squads program ID.
[Multisig Public Key Buffer, Transaction Index]
The transaction index is a number auto incrementing based on your Multisigs total transactions.
Proposal Account Content
#[account]pubstructProposal {/// The multisig this belongs to.pub multisig:Pubkey,/// Index of the multisig transaction this proposal is associated with.pub transaction_index:u64,/// The status of the transaction.pub status:ProposalStatus,/// PDA bump.pub bump:u8,/// Keys that have approved/signed.pub approved:Vec<Pubkey>,/// Keys that have rejected.pub rejected:Vec<Pubkey>,/// Keys that have cancelled (Approved only).pub cancelled:Vec<Pubkey>,}
Transaction accounts
Transaction PDA Derivation
A Proposal account gets derived the following way. The program for the derivation is the Squads program ID.
[Multisig Public Key Buffer, Transaction Index]
The transaction index is a number auto incrementing based on your Multisigs total transactions.
Batch Transaction Account Content
#[account]#[derive(InitSpace)]pubstructBatch {/// The multisig this belongs to.pub multisig:Pubkey,/// Member of the Multisig who submitted the batch.pub creator:Pubkey,/// Index of this batch within the multisig transactions.pub index:u64,/// PDA bump.pub bump:u8,/// Index of the vault this batch belongs to.pub vault_index:u8,/// Derivation bump of the vault PDA this batch belongs to.pub vault_bump:u8,/// Number of transactions in the batch.pub size:u32,/// Index of the last executed transaction within the batch./// 0 means that no transactions have been executed yet.pub executed_transaction_index:u32,}
Vault Transaction Acount Content
#[account]pub struct VaultTransaction {/// The multisig this belongs to. pub multisig: Pubkey,/// Member of the Multisig who submitted the transaction. pub creator: Pubkey,/// Index of this transaction within the multisig. pub index: u64,/// bump for the transaction seeds. pub bump: u8,/// Index of the vault this transaction belongs to. pub vault_index: u8,/// Derivation bump of the vault PDA this transaction belongs to. pub vault_bump: u8,/// Derivation bumps for additional signers./// Some transactions require multiple signers. Often these additional signers are "ephemeral" keypairs/// that are generated on the client with a sole purpose of signing the transaction and be discarded immediately after./// When wrapping such transactions into multisig ones, we replace these "ephemeral" signing keypairs/// with PDAs derived from the MultisigTransaction's `transaction_index` and controlled by the Multisig Program;/// during execution the program includes the seeds of these PDAs into the `invoke_signed` calls,/// thus "signing" on behalf of these PDAs. pub ephemeral_signer_bumps: Vec<u8>,/// data required for executing the transaction. pub message: VaultTransactionMessage,}
Config Transaction Account Content
#[account]pubstructConfigTransaction {/// The multisig this belongs to.pub multisig:Pubkey,/// Member of the Multisig who submitted the transaction.pub creator:Pubkey,/// Index of this transaction within the multisig.pub index:u64,/// bump for the transaction seeds.pub bump:u8,/// Action to be performed on the multisig.pub actions:Vec<ConfigAction>,}