Struct access_protocol::state::StakePoolHeader
source · #[repr(C)]pub struct StakePoolHeader {
pub tag: u8,
pub nonce: u8,
pub current_day_idx: u16,
pub _padding: [u8; 4],
pub minimum_stake_amount: u64,
pub total_staked: u64,
pub last_claimed_offset: u64,
pub stakers_part: u64,
pub owner: [u8; 32],
pub vault: [u8; 32],
}
Fields§
§tag: u8
Tag
nonce: u8
Stake pool nonce
current_day_idx: u16
Updated by a trustless cranker
_padding: [u8; 4]
Padding
minimum_stake_amount: u64
Minimum amount to stake to get access to the pool
total_staked: u64
Total amount staked in the pool
last_claimed_offset: u64
Last time the stake pool owner claimed as an offset from the central state’s creation time
stakers_part: u64
The % of pool rewards going to stakers
owner: [u8; 32]
Owner of the stake pool
vault: [u8; 32]
Stake pool vault
Implementations§
source§impl StakePoolHeader
impl StakePoolHeader
pub const SEED: &'static [u8; 10] = b"stake_pool"
pub fn new( owner: Pubkey, nonce: u8, vault: Pubkey, minimum_stake_amount: u64 ) -> Result<Self, ProgramError>
pub fn close(&mut self)
pub fn deposit(&mut self, amount: u64) -> ProgramResult
pub fn withdraw(&mut self, amount: u64) -> ProgramResult
Trait Implementations§
source§impl BorshDeserialize for StakePoolHeaderwhere
u8: BorshDeserialize,
u16: BorshDeserialize,
[u8; 4]: BorshDeserialize,
u64: BorshDeserialize,
[u8; 32]: BorshDeserialize,
impl BorshDeserialize for StakePoolHeaderwhere
u8: BorshDeserialize,
u16: BorshDeserialize,
[u8; 4]: BorshDeserialize,
u64: BorshDeserialize,
[u8; 32]: 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 StakePoolHeaderwhere
u8: BorshSerialize,
u16: BorshSerialize,
[u8; 4]: BorshSerialize,
u64: BorshSerialize,
[u8; 32]: BorshSerialize,
impl BorshSerialize for StakePoolHeaderwhere
u8: BorshSerialize,
u16: BorshSerialize,
[u8; 4]: BorshSerialize,
u64: BorshSerialize,
[u8; 32]: BorshSerialize,
source§impl Clone for StakePoolHeader
impl Clone for StakePoolHeader
source§fn clone(&self) -> StakePoolHeader
fn clone(&self) -> StakePoolHeader
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for StakePoolHeader
impl Debug for StakePoolHeader
impl Copy for StakePoolHeader
impl Pod for StakePoolHeader
Auto Trait Implementations§
impl Freeze for StakePoolHeader
impl RefUnwindSafe for StakePoolHeader
impl Send for StakePoolHeader
impl Sync for StakePoolHeader
impl Unpin for StakePoolHeader
impl UnwindSafe for StakePoolHeader
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
source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self
.