use crate::*;
#[derive(Accounts)]
pub struct CreateGovernor<'info> {
pub base: Signer<'info>,
#[account(
init,
seeds = [
b"TribecaGovernor".as_ref(),
base.key().as_ref()
],
bump,
payer = payer,
space = 8 + Governor::LEN
)]
pub governor: Account<'info, Governor>,
pub smart_wallet: Account<'info, SmartWallet>,
#[account(mut)]
pub payer: Signer<'info>,
pub system_program: Program<'info, System>,
}
#[derive(Accounts)]
#[instruction(_bump: u8, instructions: Vec<ProposalInstruction>)]
pub struct CreateProposal<'info> {
#[account(mut)]
pub governor: Account<'info, Governor>,
#[account(
init,
seeds = [
b"TribecaProposal".as_ref(),
governor.key().as_ref(),
governor.proposal_count.to_le_bytes().as_ref()
],
bump,
payer = payer,
space = Proposal::space(instructions),
)]
pub proposal: Box<Account<'info, Proposal>>,
pub proposer: Signer<'info>,
#[account(mut)]
pub payer: Signer<'info>,
pub system_program: Program<'info, System>,
}
#[derive(Accounts)]
pub struct ActivateProposal<'info> {
pub governor: Account<'info, Governor>,
#[account(mut)]
pub proposal: Account<'info, Proposal>,
pub electorate: Signer<'info>,
}
#[derive(Accounts)]
pub struct CancelProposal<'info> {
pub governor: Account<'info, Governor>,
#[account(mut)]
pub proposal: Account<'info, Proposal>,
pub proposer: Signer<'info>,
}
#[derive(Accounts)]
pub struct QueueProposal<'info> {
#[account(has_one = smart_wallet)]
pub governor: Account<'info, Governor>,
#[account(mut)]
pub proposal: Account<'info, Proposal>,
#[account(mut, constraint = transaction.to_account_info().data_is_empty())]
pub transaction: SystemAccount<'info>,
#[account(mut)]
pub smart_wallet: Account<'info, SmartWallet>,
#[account(mut)]
pub payer: Signer<'info>,
pub smart_wallet_program: Program<'info, smart_wallet::program::SmartWallet>,
pub system_program: Program<'info, System>,
}
#[derive(Accounts)]
#[instruction(_bump: u8, voter: Pubkey)]
pub struct NewVote<'info> {
pub proposal: Account<'info, Proposal>,
#[account(
init,
seeds = [
b"TribecaVote".as_ref(),
proposal.key().as_ref(),
voter.as_ref()
],
bump,
payer = payer,
space = 8 + Vote::LEN
)]
pub vote: Account<'info, Vote>,
#[account(mut)]
pub payer: Signer<'info>,
pub system_program: Program<'info, System>,
}
#[derive(Accounts)]
pub struct SetVote<'info> {
pub governor: Account<'info, Governor>,
#[account(mut)]
pub proposal: Account<'info, Proposal>,
#[account(mut)]
pub vote: Account<'info, Vote>,
pub electorate: Signer<'info>,
}
#[derive(Accounts)]
#[instruction(_bump: u8, title: String, description_link: String)]
pub struct CreateProposalMeta<'info> {
pub proposal: Box<Account<'info, Proposal>>,
pub proposer: Signer<'info>,
#[account(
init,
seeds = [
b"TribecaProposalMeta".as_ref(),
proposal.key().as_ref()
],
bump,
payer = payer,
space = 8 + std::mem::size_of::<ProposalMeta>()
+ 4 + title.as_bytes().len()
+ 4 + description_link.as_bytes().len()
)]
pub proposal_meta: Box<Account<'info, ProposalMeta>>,
#[account(mut)]
pub payer: Signer<'info>,
pub system_program: Program<'info, System>,
}
#[derive(Accounts)]
pub struct SetGovernanceParams<'info> {
#[account(mut)]
pub governor: Account<'info, Governor>,
pub smart_wallet: Signer<'info>,
}