Struct spl_stake_pool::state::Fee
source · [−]Expand description
Fee rate as a ratio, minted on UpdateStakePoolBalance
as a proportion of
the rewards
If either the numerator or the denominator is 0, the fee is considered to be 0
Fields
denominator: u64
denominator of the fee ratio
numerator: u64
numerator of the fee ratio
Implementations
sourceimpl Fee
impl Fee
sourcepub fn apply(&self, amt: u64) -> Option<u128>
pub fn apply(&self, amt: u64) -> Option<u128>
Applies the Fee’s rates to a given amount, amt
returning the amount to be subtracted from it as fees
(0 if denominator is 0 or amt is 0),
or None if overflow occurs
sourcepub fn check_withdrawal(
&self,
old_withdrawal_fee: &Fee
) -> Result<(), StakePoolError>
pub fn check_withdrawal(
&self,
old_withdrawal_fee: &Fee
) -> Result<(), StakePoolError>
Withdrawal fees have some additional restrictions, this fn checks if those are met, returning an error if not. Does nothing and returns Ok if fee type is not withdrawal
Trait Implementations
sourceimpl BorshDeserialize for Fee where
u64: BorshDeserialize,
u64: BorshDeserialize,
impl BorshDeserialize for Fee where
u64: BorshDeserialize,
u64: BorshDeserialize,
sourceimpl BorshSchema for Fee where
u64: BorshSchema,
u64: BorshSchema,
impl BorshSchema for Fee where
u64: BorshSchema,
u64: BorshSchema,
sourcefn declaration() -> Declaration
fn declaration() -> Declaration
Get the name of the type without brackets.
sourcefn add_definitions_recursively(
definitions: &mut HashMap<Declaration, Definition>
)
fn add_definitions_recursively(
definitions: &mut HashMap<Declaration, Definition>
)
Recursively, using DFS, add type definitions required for this type. For primitive types this is an empty map. Type definition explains how to serialize/deserialize a type. Read more
sourcefn add_definition(
declaration: String,
definition: Definition,
definitions: &mut HashMap<String, Definition, RandomState>
)
fn add_definition(
declaration: String,
definition: Definition,
definitions: &mut HashMap<String, Definition, RandomState>
)
Helper method to add a single type definition to the map.
fn schema_container() -> BorshSchemaContainer
sourceimpl BorshSerialize for Fee where
u64: BorshSerialize,
u64: BorshSerialize,
impl BorshSerialize for Fee where
u64: BorshSerialize,
u64: BorshSerialize,
impl Copy for Fee
impl StructuralPartialEq for Fee
Auto Trait Implementations
impl RefUnwindSafe for Fee
impl Send for Fee
impl Sync for Fee
impl Unpin for Fee
impl UnwindSafe for Fee
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more