7. Implementation Details

Data Structures

StakingPool

#[account]
pub struct StakingPool {
    pub path_mint: Pubkey,
    pub staking_vault: Pubkey,
    pub total_staked: u64,
    pub total_locked: u64,
    pub total_rewards_distributed: u64,
    pub reward_per_token: u128,
    pub bump: u8,
    pub staking_vault_bump: u8,
    pub total_proposals: u64,              // For voter tracking
}

StakerAccount

#[account]
pub struct StakerAccount {
    pub owner: Pubkey,
    pub staked_amount: u64,
    pub staked_at: i64,
    pub reward_debt: u128,
    pub unclaimed_rewards: u64,
    pub bump: u8,
    
    // Locking fields
    pub lock_type: LockType,
    pub lock_schedule: Option<LockSchedule>,
    pub locked_amount: u64,
    pub unlocked_amount: u64,
    pub reward_multiplier_bps: u16,         // Lock-based multiplier
    
    // Voting fields
    pub voter_account: Option<Pubkey>,
    pub voter_bonus_multiplier_bps: u16,    // Voter bonus (0-2000 = 0-20%)
    pub is_platform_stake: bool,
}

LockSchedule

PlatformLockSchedule

VoterAccount

Key Functions

Stake

Unstake

Claim Rewards

Record Vote

Error Codes

Last updated