carbon-vertigo-decoder 2.0.0

Vertigo DEX Program Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
use {
    crate::types::graphql::FeeParamsGraphQL,
    carbon_core::graphql::primitives::{Pubkey, U128, U64, U8},
    juniper::GraphQLObject,
};

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "Pool")]
pub struct PoolGraphQL {
    pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
    pub enabled: bool,
    pub owner: Pubkey,
    pub mint_a: Pubkey,
    pub mint_b: Pubkey,
    pub token_a_reserves: U128,
    pub token_b_reserves: U128,
    pub shift: U128,
    pub royalties: U64,
    pub vertigo_fees: U64,
    pub bump: U8,
    pub fee_params: FeeParamsGraphQL,
}

impl TryFrom<crate::accounts::postgres::PoolRow> for PoolGraphQL {
    type Error = carbon_core::error::Error;
    fn try_from(row: crate::accounts::postgres::PoolRow) -> Result<Self, Self::Error> {
        Ok(Self {
            account_metadata: row.account_metadata.into(),
            enabled: row.enabled,
            owner: carbon_core::graphql::primitives::Pubkey(row.owner.0),
            mint_a: carbon_core::graphql::primitives::Pubkey(row.mint_a.0),
            mint_b: carbon_core::graphql::primitives::Pubkey(row.mint_b.0),
            token_a_reserves: carbon_core::graphql::primitives::U128(*row.token_a_reserves),
            token_b_reserves: carbon_core::graphql::primitives::U128(*row.token_b_reserves),
            shift: carbon_core::graphql::primitives::U128(*row.shift),
            royalties: carbon_core::graphql::primitives::U64(*row.royalties),
            vertigo_fees: carbon_core::graphql::primitives::U64(*row.vertigo_fees),
            bump: carbon_core::graphql::primitives::U8((*row.bump) as u8),
            fee_params: row.fee_params.0.into(),
        })
    }
}