pub fn whitelist_deposit<'a, 'b, 'c, 'info>(
        ctx: Context<'a, 'b, 'c, 'info, WhitelistDeposit<'info>>,
        instruction_data: Vec<u8>,
    ) -> 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 deposit_amount = after_amount - before_amount;
        if deposit_amount <= 0 {
            return Err(ErrorCode::InsufficientWhitelistDepositAmount)?;
        }
        if deposit_amount > ctx.accounts.transfer.vesting.whitelist_owned {
            return Err(ErrorCode::WhitelistDepositOverflow)?;
        }

        // Bookkeeping.
        ctx.accounts.transfer.vesting.whitelist_owned -= deposit_amount;

        Ok(())
    }
// Sends funds from a whitelisted program back to the lockup program.
Sends funds from a whitelisted program back to the lockup program.
Sends funds from a whitelisted program back to the lockup program .
pub fn whitelist_deposit<'a, 'b, 'c, 'info>(
        ctx: Context<'a, 'b, 'c, 'info, WhitelistDeposit<'info>>,
        instruction_data: Vec<u8>,
    ) -> 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 deposit_amount = after_amount - before_amount;
        if deposit_amount <= 0 {
            return Err(ErrorCode::InsufficientWhitelistDepositAmount)?;
        }
        if deposit_amount > ctx.accounts.transfer.vesting.whitelist_owned {
            return Err(ErrorCode::WhitelistDepositOverflow)?;
        }
        // Bookkeeping.
        ctx.accounts.transfer.vesting.whitelist_owned -= deposit_amount;
        Ok(())
    }
pub fn whitelist_deposit < ' a , ' b , ' c , ' info > ( ctx : Context < ' a , ' b , ' c , ' info , WhitelistDeposit < ' info > > , instruction_data : Vec < u8 > , ) -> 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 deposit_amount = after_amount - before_amount ; if deposit_amount <= 0 { return Err ( ErrorCode :: InsufficientWhitelistDepositAmount ) ? ; } if deposit_amount > ctx . accounts . transfer . vesting . whitelist_owned { return Err ( ErrorCode :: WhitelistDepositOverflow ) ? ; } // Bookkeeping. ctx . accounts . transfer . vesting . whitelist_owned -= deposit_amount ; Ok ( ( ) ) }
Sends funds from a whitelisted program back to the lockup program.
Sends funds from a whitelisted program back to the lockup program .
ctx
Context<'a, 'b, 'c, 'info, WhitelistDeposit<'info>>
instruction_data
Vec<u8>
ctx
Context<'a, 'b, 'c, 'info, WhitelistDeposit<'info>>
instruction_data
Vec<u8>