squads_multisig_program/state/
program_config.rs

1use anchor_lang::prelude::*;
2
3use crate::errors::MultisigError;
4
5/// Global program configuration account.
6#[account]
7#[derive(InitSpace)]
8pub struct ProgramConfig {
9    /// The authority which can update the config.
10    pub authority: Pubkey,
11    /// The lamports amount charged for creating a new multisig account.
12    /// This fee is sent to the `treasury` account.
13    pub multisig_creation_fee: u64,
14    /// The treasury account to send charged fees to.
15    pub treasury: Pubkey,
16    /// Reserved for future use.
17    pub _reserved: [u8; 64],
18}
19
20impl ProgramConfig {
21    pub fn invariant(&self) -> Result<()> {
22        // authority must be non-default.
23        require_keys_neq!(
24            self.authority,
25            Pubkey::default(),
26            MultisigError::InvalidAccount
27        );
28
29        // treasury must be non-default.
30        require_keys_neq!(
31            self.treasury,
32            Pubkey::default(),
33            MultisigError::InvalidAccount
34        );
35
36        Ok(())
37    }
38}