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: Tag
Tag
signer_nonce: u8
Central state nonce
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
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,
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where R: Read,
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