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: Pubkey

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

§freeze_authority: Pubkey

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

source

pub fn from_central_state( central_state: CentralState ) -> Result<Self, ProgramError>

source

pub fn create_key( signer_nonce: &u8, program_id: &Pubkey ) -> Result<Pubkey, ProgramError>

source

pub fn find_key(program_id: &Pubkey) -> (Pubkey, u8)

source

pub fn save(&self, dst: &mut [u8]) -> ProgramResult

source

pub fn from_account_info( a: &AccountInfo<'_> ) -> Result<CentralStateV2, ProgramError>

source

pub fn get_current_offset(&self) -> Result<u64, ProgramError>

source

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

source

pub fn calculate_fee(&self, amount: u64) -> Result<u64, ProgramError>

Calculate the protocol fee for a given amount

Trait Implementations§

source§

impl BorshDeserialize for CentralStateV2

source§

fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>

source§

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>

Deserialize this instance from a slice of bytes.
source§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

source§

impl BorshSerialize for CentralStateV2

source§

fn serialize<W: Write>(&self, writer: &mut W) -> Result<(), Error>

source§

fn try_to_vec(&self) -> Result<Vec<u8>, Error>

Serialize this instance into a vector of bytes.
source§

impl BorshSize for CentralStateV2

source§

impl Debug for CentralStateV2

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> AbiExample for T

source§

default fn example() -> T

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V