use {crate::types::PoolState, solana_pubkey::Pubkey};
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct VirtualsPool {
pub creator: Pubkey,
pub mint: Pubkey,
pub virtual_y: u64,
pub graduation_x: u64,
pub state: PoolState,
pub bump: u8,
}
impl VirtualsPool {
pub fn decode(data: &[u8]) -> Option<Self> {
if data.len() < 8 {
return None;
}
let discriminator = &data[0..8];
if discriminator != [71, 118, 5, 203, 5, 98, 135, 116] {
return None;
}
let mut data_slice = data;
data_slice = &data_slice[8..];
borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
}
}