mod commands;
mod config;
mod log;
mod transaction;

use anyhow::Result;
use clap::Parser;
use config::Config;
use solana_pubkey::{pubkey, Pubkey};

pub const INIT_AUTHORITY: Pubkey = pubkey!("CGYAxnDF1bYwmbzTtVx2pdo8xd3aviqE58WumVYRLYRH");
pub const ORACLE_AUTHORITY: Pubkey = pubkey!("6rC1hVD8eyA5w8jwP4FUwmQ1CKu4tChQjPpVGFAkzCE");

fn main() -> Result<()> {
    dotenvy::dotenv().ok();
    let config = Config::try_parse()?;
    log::NO_DECORATION
        .set(config.no_decoration)
        .expect("Failed to set NO_DECORATION");
    log::DEBUG.set(config.debug).expect("Failed to set DEBUG");
    transaction::SKIP_SIMULATION
        .set(config.skip_simulation)
        .expect("Failed to set SKIP_SIMULATION");
    commands::handle(&config)
}
