Struct access_protocol::state::CentralStateV2
source · pub struct CentralStateV2 {Show 15 fields
pub tag: Tag,
pub bump_seed: u8,
pub daily_inflation: u64,
pub token_mint: Pubkey,
pub authority: Pubkey,
pub creation_time: i64,
pub total_staked: u64,
pub total_staked_snapshot: u64,
pub last_snapshot_offset: u64,
pub ix_gate: u128,
pub freeze_authority: Pubkey,
pub admin_ix_gate: u128,
pub fee_basis_points: u16,
pub last_fee_distribution_time: i64,
pub recipients: Vec<FeeRecipient>,
}
Fields§
§tag: Tag
Tag
bump_seed: u8
Central state bump seed
daily_inflation: u64
Daily inflation in token amount
token_mint: Pubkey
Mint of the token being emitted
Authority The public key that can do the admin operations
creation_time: i64
Creation timestamp
total_staked: u64
Total amount of staked tokens
total_staked_snapshot: u64
The daily total_staked snapshot to correctly calculate the pool rewards
last_snapshot_offset: u64
The offset of the total_staked_snapshot from the creation_time in days
ix_gate: u128
Map of ixs to their state of gating, used for freezing the program functionality 1 is chosen as enabled, 0 is disabled
An additional account able to freeze the program functionality. The program can be unfrozen only by the authority
admin_ix_gate: u128
Map of ixs and their state for renouncing the admin permissions 1 is chosen as enabled, 0 is disabled
fee_basis_points: u16
Protocol fee percentage basis points (i.e 1% = 100)
last_fee_distribution_time: i64
Last fee distribution timestamp
recipients: Vec<FeeRecipient>
List of the fee recipients and their share of the fees. The sum of the shares must be <=100%, the rest is getting burned
Implementations§
source§impl CentralStateV2
impl CentralStateV2
pub fn from_central_state( central_state: CentralState ) -> Result<Self, ProgramError>
pub fn create_key( signer_nonce: &u8, program_id: &Pubkey ) -> Result<Pubkey, ProgramError>
pub fn find_key(program_id: &Pubkey) -> (Pubkey, u8)
pub fn save(&self, dst: &mut [u8]) -> ProgramResult
pub fn from_account_info( a: &AccountInfo<'_> ) -> Result<CentralStateV2, ProgramError>
pub fn get_current_offset(&self) -> Result<u64, ProgramError>
sourcepub fn assert_instruction_allowed(
&self,
ix: &ProgramInstruction
) -> ProgramResult
pub fn assert_instruction_allowed( &self, ix: &ProgramInstruction ) -> ProgramResult
Check if the instruction is not frozen or renounced. AdminFreezeProgram instruction is allowed to be called even if frozen so that the program can be unfrozen
sourcepub fn calculate_fee(&self, amount: u64) -> Result<u64, ProgramError>
pub fn calculate_fee(&self, amount: u64) -> Result<u64, ProgramError>
Calculate the protocol fee for a given amount