Struct access_protocol::state::CentralState  
source · pub struct CentralState {
    pub tag: Tag,
    pub signer_nonce: 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,
}Fields§
§tag: TagTag
signer_nonce: u8Central state nonce
daily_inflation: u64Daily inflation in token amount
token_mint: PubkeyMint of the token being emitted
Authority The public key that can do the admin operations
creation_time: i64Creation timestamp
total_staked: u64Total amount of staked tokens
total_staked_snapshot: u64The daily total_staked snapshot to correctly calculate the pool rewards
last_snapshot_offset: u64The offset of the total_staked_snapshot from the creation_time in days
Implementations§
source§impl CentralState
 
impl CentralState
pub fn new( signer_nonce: u8, daily_inflation: u64, token_mint: Pubkey, authority: Pubkey, total_staked: u64 ) -> 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<CentralState, ProgramError>
pub fn get_current_offset(&self) -> Result<u64, ProgramError>
Trait Implementations§
source§impl BorshDeserialize for CentralStatewhere
    Tag: BorshDeserialize,
    u8: BorshDeserialize,
    u64: BorshDeserialize,
    Pubkey: BorshDeserialize,
    i64: BorshDeserialize,
 
impl BorshDeserialize for CentralStatewhere
    Tag: BorshDeserialize,
    u8: BorshDeserialize,
    u64: BorshDeserialize,
    Pubkey: BorshDeserialize,
    i64: BorshDeserialize,
source§impl BorshSerialize for CentralStatewhere
    Tag: BorshSerialize,
    u8: BorshSerialize,
    u64: BorshSerialize,
    Pubkey: BorshSerialize,
    i64: BorshSerialize,
 
impl BorshSerialize for CentralStatewhere
    Tag: BorshSerialize,
    u8: BorshSerialize,
    u64: BorshSerialize,
    Pubkey: BorshSerialize,
    i64: BorshSerialize,
Auto Trait Implementations§
impl RefUnwindSafe for CentralState
impl Send for CentralState
impl Sync for CentralState
impl Unpin for CentralState
impl UnwindSafe for CentralState
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more