Struct access_protocol::state::StakePool
source · pub struct StakePool<H, B> {
pub header: H,
pub balances: B,
}
Fields§
§header: H
§balances: B
Circular buffer of length STAKE_BUFFER_LEN storing (inflation * pool_total_staked / total_staked) in FP32 format
Implementations§
source§impl<'a> StakePool<RefMut<'a, StakePoolHeader>, RefMut<'a, [RewardsTuple]>>
impl<'a> StakePool<RefMut<'a, StakePoolHeader>, RefMut<'a, [RewardsTuple]>>
pub fn get_checked<'b: 'a>( account_info: &'a AccountInfo<'b>, allowed_tags: Vec<Tag> ) -> Result<Self, ProgramError>
source§impl StakePool<Box<StakePoolHeader>, Box<[RewardsTuple]>>
impl StakePool<Box<StakePoolHeader>, Box<[RewardsTuple]>>
pub fn from_buffer(buf: &[u8]) -> Self
source§impl<H: DerefMut<Target = StakePoolHeader>, B: DerefMut<Target = [RewardsTuple]>> StakePool<H, B>
impl<H: DerefMut<Target = StakePoolHeader>, B: DerefMut<Target = [RewardsTuple]>> StakePool<H, B>
pub fn push_balances_buff( &mut self, current_offset: u64, rewards: RewardsTuple ) -> Result<(), ProgramError>
pub fn create_key( nonce: &u8, owner: &Pubkey, program_id: &Pubkey ) -> Result<Pubkey, ProgramError>
Trait Implementations§
source§impl<H, B> BorshDeserialize for StakePool<H, B>where
H: BorshDeserialize,
B: BorshDeserialize,
impl<H, B> BorshDeserialize for StakePool<H, B>where H: BorshDeserialize, B: 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<H, B> BorshSerialize for StakePool<H, B>where
H: BorshSerialize,
B: BorshSerialize,
impl<H, B> BorshSerialize for StakePool<H, B>where H: BorshSerialize, B: BorshSerialize,
Auto Trait Implementations§
impl<H, B> RefUnwindSafe for StakePool<H, B>where B: RefUnwindSafe, H: RefUnwindSafe,
impl<H, B> Send for StakePool<H, B>where B: Send, H: Send,
impl<H, B> Sync for StakePool<H, B>where B: Sync, H: Sync,
impl<H, B> Unpin for StakePool<H, B>where B: Unpin, H: Unpin,
impl<H, B> UnwindSafe for StakePool<H, B>where B: UnwindSafe, H: UnwindSafe,
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