Struct access_protocol::state::StakeAccount
source · pub struct StakeAccount {
pub tag: Tag,
pub owner: Pubkey,
pub stake_amount: u64,
pub stake_pool: Pubkey,
pub last_claimed_offset: u64,
pub pool_minimum_at_creation: u64,
}
Fields§
§tag: Tag
Tag
owner: Pubkey
Owner of the stake account
stake_amount: u64
Amount staked in the account
stake_pool: Pubkey
Stake pool to which the account belongs to
last_claimed_offset: u64
Offset of a last day where rewards were claimed from the contract creation date
pool_minimum_at_creation: u64
Minimum stakeable amount of the pool when the account was created
Implementations§
source§impl StakeAccount
impl StakeAccount
pub const SEED: &'static [u8; 13] = b"stake_account"
pub fn new( owner: Pubkey, stake_pool: Pubkey, pool_minimum_at_creation: u64 ) -> Self
pub fn create_key( nonce: &u8, owner: &Pubkey, stake_pool: &Pubkey, program_id: &Pubkey ) -> Result<Pubkey, ProgramError>
pub fn find_key( owner: &Pubkey, stake_pool: &Pubkey, program_id: &Pubkey ) -> (Pubkey, u8)
pub fn save(&self, dst: &mut [u8]) -> ProgramResult
pub fn from_account_info( a: &AccountInfo<'_> ) -> Result<StakeAccount, 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 StakeAccount
impl BorshDeserialize for StakeAccount
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 StakeAccount
impl BorshSerialize for StakeAccount
source§impl Clone for StakeAccount
impl Clone for StakeAccount
source§fn clone(&self) -> StakeAccount
fn clone(&self) -> StakeAccount
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 moreAuto Trait Implementations§
impl RefUnwindSafe for StakeAccount
impl Send for StakeAccount
impl Sync for StakeAccount
impl Unpin for StakeAccount
impl UnwindSafe for StakeAccount
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