πregister_mercurial_vault_depository
Permissionned - Callable as long as the max number of registered mercurial vault depository isn't reached
Last updated
Permissionned - Callable as long as the max number of registered mercurial vault depository isn't reached
Last updated
// ...
#[derive(Accounts)]
pub struct RegisterMercurialVaultDepository<'info> {
/// #1
pub authority: Signer<'info>,
/// #2
#[account(mut)]
pub payer: Signer<'info>,
/// #3
#[account(
mut,
seeds = [CONTROLLER_NAMESPACE],
bump = controller.load()?.bump,
has_one = authority @UxdError::InvalidAuthority,
)]
pub controller: AccountLoader<'info, Controller>,
/// #4
#[account(
init,
seeds = [MERCURIAL_VAULT_DEPOSITORY_NAMESPACE, mercurial_vault.key().as_ref(), collateral_mint.key().as_ref()],
bump,
payer = payer,
space = MERCURIAL_VAULT_DEPOSITORY_SPACE,
)]
pub depository: AccountLoader<'info, MercurialVaultDepository>,
/// #5
pub collateral_mint: Box<Account<'info, Mint>>,
/// #6
#[account(
constraint = mercurial_vault.lp_mint == mercurial_vault_lp_mint.key() @UxdError::InvalidMercurialVaultLpMint,
)]
pub mercurial_vault: Box<Account<'info, mercurial_vault::state::Vault>>,
/// #7
pub mercurial_vault_lp_mint: Box<Account<'info, Mint>>,
/// #8
/// Token account holding the LP tokens minted by depositing collateral on mercurial vault
#[account(
init,
seeds = [MERCURIAL_VAULT_DEPOSITORY_LP_TOKEN_VAULT_NAMESPACE, mercurial_vault.key().as_ref(), collateral_mint.key().as_ref()],
token::authority = depository,
token::mint = mercurial_vault_lp_mint,
bump,
payer = payer,
)]
pub depository_lp_token_vault: Box<Account<'info, TokenAccount>>,
/// #9
pub system_program: Program<'info, System>,
/// #10
pub token_program: Program<'info, Token>,
/// #11
pub rent: Sysvar<'info, Rent>,
}
// ...