use {crate::types::AccountEventHeader, solana_pubkey::Pubkey};
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct LendingAccountWithdrawEventEvent {
pub header: AccountEventHeader,
pub bank: Pubkey,
pub mint: Pubkey,
pub amount: u64,
pub close_balance: bool,
}
impl LendingAccountWithdrawEventEvent {
pub fn decode(data: &[u8]) -> Option<Self> {
if data.len() < 8 {
return None;
}
let discriminator = &data[0..8];
if discriminator != [3, 220, 148, 243, 33, 249, 54, 88] {
return None;
}
let mut data_slice = data;
data_slice = &data_slice[8..];
borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
}
}