π’initialize_controller
Permissionless - Callable once per deployed program
Last updated
Permissionless - Callable once per deployed program
Last updated
// ...
/// Takes 7 accounts - 4 used locally - 0 for CPI - 2 Programs - 1 Sysvar
#[derive(Accounts)]
#[instruction(
redeemable_mint_decimals: u8,
)]
pub struct InitializeController<'info> {
/// #1 Authored call accessible only to the signer matching Controller.authority
pub authority: Signer<'info>,
/// #2
#[account(mut)]
pub payer: Signer<'info>,
/// #3 The top level UXDProgram on chain account managing the redeemable mint
#[account(
init,
seeds = [CONTROLLER_NAMESPACE],
bump,
payer = payer,
space = CONTROLLER_SPACE
)]
pub controller: AccountLoader<'info, Controller>,
/// #4 The redeemable mint managed by the `controller` instance
#[account(
init,
seeds = [REDEEMABLE_MINT_NAMESPACE],
bump,
mint::authority = controller,
mint::decimals = redeemable_mint_decimals,
payer = payer,
constraint = redeemable_mint_decimals <= SOLANA_MAX_MINT_DECIMALS
)]
pub redeemable_mint: Account<'info, Mint>,
/// #5 System Program
pub system_program: Program<'info, System>,
/// #6 Token Program
pub token_program: Program<'info, Token>,
/// #7 Rent Sysvar
pub rent: Sysvar<'info, Rent>,
}
// ...