Skip to main content

tengu_api/state/
stake.rs

1use super::DojosAccount;
2use steel::*;
3
4/// One S2P tranche: `amount` DOJO vests linearly from `start_slot` over [`crate::consts::STAKE_VESTING_SLOTS`].
5#[repr(C)]
6#[derive(Clone, Copy, Debug, PartialEq, bytemuck::Pod, bytemuck::Zeroable)]
7pub struct VestingTranche {
8    pub amount: u64,
9    pub start_slot: u64,
10    /// DOJO already withdrawn from this tranche’s unlocked portion.
11    pub withdrawn: u64,
12    pub _pad: u64,
13}
14
15/// Stake-to-Play (Fren Pet S2P): DOJO in the stake ATA vests over 30 days; withdraw unlocked anytime.
16#[repr(C)]
17#[derive(Clone, Copy, Debug, PartialEq, bytemuck::Pod, bytemuck::Zeroable)]
18pub struct Stake {
19    /// The authority (owner) of this stake account.
20    pub authority: Pubkey,
21    /// Total $DOJO in the stake ATA (must match token account balance).
22    pub balance: u64,
23    /// Last slot used for time-weighted stake → XP accrual (`0` = not initialized yet).
24    pub last_xp_accrual_slot: u64,
25    /// Up to 8 independent 30-day vesting streams (FIFO on withdraw).
26    pub vesting: [VestingTranche; 8],
27}
28
29account!(DojosAccount, Stake);