// Sends funds from the lockup program to a whitelisted program.
Sends funds from the lockup program to a whitelisted program.
Sends funds from the lockup program to a whitelisted program .
pub fn whitelist_withdraw<'a, 'b, 'c, 'info>(
        ctx: Context<'a, 'b, 'c, 'info, WhitelistWithdraw<'info>>,
        instruction_data: Vec<u8>,
        amount: u64,
    ) -> Result<()> {
        let before_amount = ctx.accounts.transfer.vault.amount;
        whitelist_relay_cpi(
            &ctx.accounts.transfer,
            ctx.remaining_accounts,
            instruction_data,
        )?;
        ctx.accounts.transfer.vault.reload()?;
        let after_amount = ctx.accounts.transfer.vault.amount;
        // CPI safety checks.
        let withdraw_amount = before_amount - after_amount;
        if withdraw_amount > amount {
            return Err(ErrorCode::WhitelistWithdrawLimit)?;
        }
        // Bookeeping.
        ctx.accounts.transfer.vesting.whitelist_owned += withdraw_amount;
        Ok(())
    }
pub fn whitelist_withdraw < ' a , ' b , ' c , ' info > ( ctx : Context < ' a , ' b , ' c , ' info , WhitelistWithdraw < ' info > > , instruction_data : Vec < u8 > , amount : u64 , ) -> Result < ( ) > { let before_amount = ctx . accounts . transfer . vault . amount ; whitelist_relay_cpi ( & ctx . accounts . transfer , ctx . remaining_accounts , instruction_data , ) ? ; ctx . accounts . transfer . vault . reload ( ) ? ; let after_amount = ctx . accounts . transfer . vault . amount ; // CPI safety checks. let withdraw_amount = before_amount - after_amount ; if withdraw_amount > amount { return Err ( ErrorCode :: WhitelistWithdrawLimit ) ? ; } // Bookeeping. ctx . accounts . transfer . vesting . whitelist_owned += withdraw_amount ; Ok ( ( ) ) }
Sends funds from the lockup program to a whitelisted program.
Sends funds from the lockup program to a whitelisted program .
ctx
Context<'a, 'b, 'c, 'info, WhitelistWithdraw<'info>>
instruction_data
Vec<u8>
amount
u64