use chrono::{DateTime, Utc}; use fixed::types::I80F48; use mango::state::PerpMarket; use serde::Serialize; use solana_program::{pubkey::Pubkey, slot_history::Slot}; use solana_sdk::signature::Signature; use std::fmt; #[derive(Clone, Debug, Serialize)] pub enum KeeperInstruction { ConsumeEvents, CachePrice, UpdateRootBanks, CacheRootBanks, UpdatePerpCache, UpdateAndCacheQuoteRootBank, UpdateFunding, } impl fmt::Display for KeeperInstruction { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { KeeperInstruction::ConsumeEvents => write!(f, "ConsumeEvents"), KeeperInstruction::CachePrice => write!(f, "CachePrice"), KeeperInstruction::UpdateRootBanks => write!(f, "UpdateRootBanks"), KeeperInstruction::CacheRootBanks => write!(f, "CacheRootBanks"), KeeperInstruction::UpdatePerpCache => write!(f, "UpdatePerpCache"), KeeperInstruction::UpdateAndCacheQuoteRootBank => { write!(f, "UpdateAndCacheQuoteRootBank") } KeeperInstruction::UpdateFunding => write!(f, "UpdateFunding"), } } } #[derive(Clone, Serialize)] pub struct TransactionSendRecord { pub signature: Signature, pub sent_at: DateTime, pub sent_slot: Slot, pub market_maker: Option, pub market: Option, pub keeper_instruction: Option, pub priority_fees: u64, } #[derive(Clone, Serialize)] pub struct TransactionConfirmRecord { pub signature: String, pub sent_slot: Slot, pub sent_at: String, pub confirmed_slot: Option, pub confirmed_at: Option, pub successful: bool, pub slot_leader: Option, pub error: Option, pub market_maker: Option, pub market: Option, pub block_hash: Option, pub slot_processed: Option, pub keeper_instruction: Option, pub timed_out: bool, pub priority_fees: u64, } #[derive(Clone)] pub struct PerpMarketCache { pub order_base_lots: i64, pub price: I80F48, pub price_quote_lots: i64, pub mango_program_pk: Pubkey, pub mango_group_pk: Pubkey, pub mango_cache_pk: Pubkey, pub perp_market_pk: Pubkey, pub perp_market: PerpMarket, pub price_oracle: Pubkey, pub root_bank: Pubkey, pub node_banks: Vec, pub bids: Pubkey, pub asks: Pubkey, } pub struct _TransactionInfo { pub signature: Signature, pub transaction_send_time: DateTime, pub send_slot: Slot, pub confirmation_retries: u32, pub error: String, pub confirmation_blockhash: Pubkey, pub leader_confirming_transaction: Pubkey, pub timeout: bool, pub market_maker: Pubkey, pub market: Pubkey, } #[derive(Clone, Serialize)] pub struct BlockData { pub block_hash: String, pub block_slot: Slot, pub block_leader: String, pub total_transactions: u64, pub number_of_mm_transactions: u64, pub block_time: u64, pub cu_consumed: u64, }