carbon-jupiter-lend-decoder 2.0.0

Jupiter Lend Liquidity Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
use {
    carbon_core::graphql::primitives::{Pubkey, U64},
    juniper::GraphQLObject,
};

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "TokenReserve")]
pub struct TokenReserveGraphQL {
    pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
    pub mint: Pubkey,
    pub vault: Pubkey,
    pub borrow_rate: i32,
    pub fee_on_interest: i32,
    pub last_utilization: i32,
    pub last_update_timestamp: U64,
    pub supply_exchange_price: U64,
    pub borrow_exchange_price: U64,
    pub max_utilization: i32,
    pub total_supply_with_interest: U64,
    pub total_supply_interest_free: U64,
    pub total_borrow_with_interest: U64,
    pub total_borrow_interest_free: U64,
    pub total_claim_amount: U64,
    pub interacting_protocol: Pubkey,
    pub interacting_timestamp: U64,
    pub interacting_balance: U64,
}

impl TryFrom<crate::accounts::postgres::TokenReserveRow> for TokenReserveGraphQL {
    type Error = carbon_core::error::Error;
    fn try_from(row: crate::accounts::postgres::TokenReserveRow) -> Result<Self, Self::Error> {
        Ok(Self {
            account_metadata: row.account_metadata.into(),
            mint: carbon_core::graphql::primitives::Pubkey(row.mint.0),
            vault: carbon_core::graphql::primitives::Pubkey(row.vault.0),
            borrow_rate: *row.borrow_rate,
            fee_on_interest: *row.fee_on_interest,
            last_utilization: *row.last_utilization,
            last_update_timestamp: carbon_core::graphql::primitives::U64(
                *row.last_update_timestamp,
            ),
            supply_exchange_price: carbon_core::graphql::primitives::U64(
                *row.supply_exchange_price,
            ),
            borrow_exchange_price: carbon_core::graphql::primitives::U64(
                *row.borrow_exchange_price,
            ),
            max_utilization: *row.max_utilization,
            total_supply_with_interest: carbon_core::graphql::primitives::U64(
                *row.total_supply_with_interest,
            ),
            total_supply_interest_free: carbon_core::graphql::primitives::U64(
                *row.total_supply_interest_free,
            ),
            total_borrow_with_interest: carbon_core::graphql::primitives::U64(
                *row.total_borrow_with_interest,
            ),
            total_borrow_interest_free: carbon_core::graphql::primitives::U64(
                *row.total_borrow_interest_free,
            ),
            total_claim_amount: carbon_core::graphql::primitives::U64(*row.total_claim_amount),
            interacting_protocol: carbon_core::graphql::primitives::Pubkey(
                row.interacting_protocol.0,
            ),
            interacting_timestamp: carbon_core::graphql::primitives::U64(
                *row.interacting_timestamp,
            ),
            interacting_balance: carbon_core::graphql::primitives::U64(*row.interacting_balance),
        })
    }
}