Treasury and Fund Security
Objective
Structure
Anchor Code
#[account(mut, has_one = authority)]
pub struct DaoTreasury {
pub authority: Pubkey,
pub balance: u64,
...
}
pub fn withdraw(ctx: Context<Withdraw>, amount: u64) -> Result<()> {
require!(ctx.accounts.authority.key() == ctx.accounts.dao_account.authority, CustomError::Unauthorized);
// transfer logic
Ok(())
}
Security Notes
Last updated