pub mod borrow;
pub mod flashloan;
pub mod liquidity;
pub mod math;
pub mod oracle;
pub mod programs;

pub use anchor_client;
use anchor_client::solana_sdk::signer::Signer;
pub use anchor_lang;
use anchor_lang::prelude::Pubkey;

#[derive(Debug, Clone)]
pub struct ReadKeypair {
    pub pubkey: Pubkey,
}

impl ReadKeypair {
    pub fn new() -> Self {
        ReadKeypair {
            pubkey: Pubkey::from_str_const("HEyJLdMfZhhQ7FHCtjD5DWDFNFQhaeAVAsHeWqoY6dSD"),
        }
    }

    pub fn from_pubkey(pubkey: Pubkey) -> Self {
        ReadKeypair { pubkey }
    }
}

impl Signer for ReadKeypair {
    fn pubkey(&self) -> Pubkey {
        self.pubkey
    }

    fn try_pubkey(&self) -> Result<Pubkey, anchor_client::solana_sdk::signer::SignerError> {
        Ok(self.pubkey())
    }

    fn try_sign_message(
        &self,
        _message: &[u8],
    ) -> Result<
        anchor_client::solana_sdk::signature::Signature,
        anchor_client::solana_sdk::signer::SignerError,
    > {
        Ok(anchor_client::solana_sdk::signature::Signature::default())
    }

    fn is_interactive(&self) -> bool {
        true
    }
}
