use anchor_lang::prelude::*;
use crate::{Snapshot, StakePoolSnapshot, ASOL, SOL};
#[account]
#[derive(Debug, Default, PartialEq, Eq)]
pub struct Aggregate {
pub crate_token: Pubkey,
pub bump: u8,
pub curator: Pubkey,
pub curator_setter: Pubkey,
pub stake_pools: Vec<StakePoolMeta>,
pub latest_snapshot: Snapshot,
pub latest_snapshot_ts: i64,
}
#[derive(AnchorSerialize, AnchorDeserialize, Copy, Clone, Debug, Default, PartialEq, Eq)]
pub struct StakePoolMeta {
pub mint: Pubkey,
pub accounting_method: AccountingMethod,
}
#[account]
#[derive(Debug, Default, PartialEq, Eq)]
pub struct StakePool {
pub aggregate: Pubkey,
pub mint: Pubkey,
pub bump: u8,
pub accounting_method: AccountingMethod,
pub stats: StakePoolStats,
pub latest_snapshot: StakePoolStateSnapshot,
}
#[derive(AnchorSerialize, AnchorDeserialize, Copy, Clone, Debug, Default, PartialEq, Eq)]
pub struct StakePoolStats {
pub total_amount_deposited: u64,
pub total_amount_minted: ASOL,
}
#[derive(AnchorSerialize, AnchorDeserialize, Copy, Clone, Debug, Default, PartialEq, Eq)]
pub struct StakePoolStateSnapshot {
pub aggregate_balance_sol: SOL,
pub aggregate_supply: ASOL,
pub snapshot: StakePoolSnapshot,
pub snapshot_ts: i64,
}
#[repr(C)]
#[derive(
AnchorSerialize, AnchorDeserialize, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord,
)]
pub enum AccountingMethod {
Marinade,
Lido,
}
impl Default for AccountingMethod {
fn default() -> Self {
AccountingMethod::Marinade
}
}