//! This code was AUTOGENERATED using the Codama library.
use crate::types::Dex;

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct SwapEventEvent {
    pub dex: Dex,
    pub amount_in: u64,
    pub amount_out: u64,
}

impl SwapEventEvent {
    pub fn decode(data: &[u8]) -> Option<Self> {
        if data.len() < 8 {
            return None;
        }
        let discriminator = &data[0..8];
        if discriminator != [64, 198, 205, 232, 38, 8, 113, 226] {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[8..];

        borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
    }
}
