use crate::types::StrategyType;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct StrategyWithdrawEvent {
pub strategy_type: StrategyType,
pub collateral_amount: u64,
pub estimated_token_amount: u64,
}
impl StrategyWithdrawEvent {
pub fn decode(data: &[u8]) -> Option<Self> {
if data.len() < 16 {
return None;
}
let discriminator = &data[0..16];
if discriminator
!= [
228, 69, 165, 46, 81, 203, 154, 29, 120, 76, 208, 95, 221, 210, 229, 189,
]
{
return None;
}
let mut data_slice = data;
data_slice = &data_slice[16..];
borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
}
}