pub fn unpack(input: &[u8]) -> Result<Self, ProgramError> {
        let (&tag, rest) = input
            .split_first()
            .ok_or(PoolingError::InstructionUnpackError)?;
        Ok(match tag {
            0 => {
                let (owner, rest) = unpack_pubkey(rest)?;
                let (quote_currency, _rest) = unpack_bytes32(rest)?;

                Self::InitPoolingManager {
                    owner,
                    quote_currency: *quote_currency,
                }
            }
            1 => {
                let (new_owner, _rest) = unpack_pubkey(rest)?;
                Self::SetPoolingManagerOwner { new_owner }
            }
            2 => {
                let (total_mining_speed, rest) = unpack_u64(rest)?;
                let (kink_util_rate, rest) = unpack_u64(rest)?;
                let (use_pyth_oracle, _rest) = unpack_bool(rest)?;
                Self::InitPool {
                    config: PoolConfig {
                        deposit_paused: false,
                    },
                    total_mining_speed,
                    kink_util_rate,
                    use_pyth_oracle,
                }
            }
            3 => Self::RefreshPool,
            4 => {
                let (liquidity_amount, _rest) = unpack_u64(rest)?;
                Self::DepositPoolLiquidity { liquidity_amount }
            }
            5 => {
                let (collateral_amount, _rest) = unpack_u64(rest)?;
                Self::RedeemPoolCollateral { collateral_amount }
            }
            6 => Self::InitTicket,
            7 => Self::RefreshTicket,
            8 => {
                Self::LotteryDraw
            }
            _ => {
                msg!("Instruction cannot be unpacked");
                return Err(PoolingError::InstructionUnpackError.into());
            }
        })
    }
/// Unpacks a byte buffer into a [LendingInstruction](enum.LendingInstruction.html).

Unpacks a byte buffer into a [LendingInstruction](enum.LendingInstruction.html).
Unpacks a byte buffer into a [ LendingInstruction ] ( enum . LendingInstruction . html ) .
pub fn unpack(input: &[u8]) -> Result<Self, ProgramError> {
        let (&tag, rest) = input
            .split_first()
            .ok_or(PoolingError::InstructionUnpackError)?;
        Ok(match tag {
            0 => {
                let (owner, rest) = unpack_pubkey(rest)?;
                let (quote_currency, _rest) = unpack_bytes32(rest)?;
                Self::InitPoolingManager {
                    owner,
                    quote_currency: *quote_currency,
                }
            }
            1 => {
                let (new_owner, _rest) = unpack_pubkey(rest)?;
                Self::SetPoolingManagerOwner { new_owner }
            }
            2 => {
                let (total_mining_speed, rest) = unpack_u64(rest)?;
                let (kink_util_rate, rest) = unpack_u64(rest)?;
                let (use_pyth_oracle, _rest) = unpack_bool(rest)?;
                Self::InitPool {
                    config: PoolConfig {
                        deposit_paused: false,
                    },
                    total_mining_speed,
                    kink_util_rate,
                    use_pyth_oracle,
                }
            }
            3 => Self::RefreshPool,
            4 => {
                let (liquidity_amount, _rest) = unpack_u64(rest)?;
                Self::DepositPoolLiquidity { liquidity_amount }
            }
            5 => {
                let (collateral_amount, _rest) = unpack_u64(rest)?;
                Self::RedeemPoolCollateral { collateral_amount }
            }
            6 => Self::InitTicket,
            7 => Self::RefreshTicket,
            8 => {
                Self::LotteryDraw
            }
            _ => {
                msg!("Instruction cannot be unpacked");
                return Err(PoolingError::InstructionUnpackError.into());
            }
        })
    }
pub fn unpack ( input : & [ u8 ] ) -> Result < Self , ProgramError > { let ( & tag , rest ) = input . split_first ( ) . ok_or ( PoolingError :: InstructionUnpackError ) ? ; Ok ( match tag { 0 => { let ( owner , rest ) = unpack_pubkey ( rest ) ? ; let ( quote_currency , _rest ) = unpack_bytes32 ( rest ) ? ; Self :: InitPoolingManager { owner , quote_currency : * quote_currency , } } 1 => { let ( new_owner , _rest ) = unpack_pubkey ( rest ) ? ; Self :: SetPoolingManagerOwner { new_owner } } 2 => { let ( total_mining_speed , rest ) = unpack_u64 ( rest ) ? ; let ( kink_util_rate , rest ) = unpack_u64 ( rest ) ? ; let ( use_pyth_oracle , _rest ) = unpack_bool ( rest ) ? ; Self :: InitPool { config : PoolConfig { deposit_paused : false , } , total_mining_speed , kink_util_rate , use_pyth_oracle , } } 3 => Self :: RefreshPool , 4 => { let ( liquidity_amount , _rest ) = unpack_u64 ( rest ) ? ; Self :: DepositPoolLiquidity { liquidity_amount } } 5 => { let ( collateral_amount , _rest ) = unpack_u64 ( rest ) ? ; Self :: RedeemPoolCollateral { collateral_amount } } 6 => Self :: InitTicket , 7 => Self :: RefreshTicket , 8 => { Self :: LotteryDraw } _ => { msg ! ( " " ) ; return Err ( PoolingError :: InstructionUnpackError . into ( ) ) ; } } ) }
Unpacks a byte buffer into a [LendingInstruction](enum.LendingInstruction.html).
Unpacks a byte buffer into a [ LendingInstruction ] ( enum . LendingInstruction . html ) .
input
&[u8]
input
&[u8]