Struct quarry_mine::payroll::Payroll
source · [−]pub struct Payroll {
pub famine_ts: i64,
pub last_checkpoint_ts: i64,
pub annual_rewards_rate: u64,
pub rewards_per_token_stored: u128,
pub total_tokens_deposited: u64,
}
Expand description
Calculator for amount of tokens to pay out.
Fields
famine_ts: i64
Timestamp of when rewards should end.
last_checkpoint_ts: i64
Timestamp of the last update.
annual_rewards_rate: u64
Amount of tokens to issue per year.
rewards_per_token_stored: u128
Amount of tokens to issue per staked token, multiplied by u64::MAX for precision.
total_tokens_deposited: u64
Total number of tokens deposited into the Quarry.
Implementations
sourceimpl Payroll
impl Payroll
sourcepub fn new(
famine_ts: i64,
last_checkpoint_ts: i64,
annual_rewards_rate: u64,
rewards_per_token_stored: u128,
total_tokens_deposited: u64
) -> Self
pub fn new(
famine_ts: i64,
last_checkpoint_ts: i64,
annual_rewards_rate: u64,
rewards_per_token_stored: u128,
total_tokens_deposited: u64
) -> Self
Creates a new Payroll.
sourcepub fn calculate_reward_per_token(&self, current_ts: i64) -> Result<u128>
pub fn calculate_reward_per_token(&self, current_ts: i64) -> Result<u128>
Calculates the amount of rewards to pay for each staked token, performing safety checks.
sourcepub fn calculate_rewards_earned(
&self,
current_ts: i64,
tokens_deposited: u64,
rewards_per_token_paid: u128,
rewards_earned: u64
) -> Result<u128>
pub fn calculate_rewards_earned(
&self,
current_ts: i64,
tokens_deposited: u64,
rewards_per_token_paid: u128,
rewards_earned: u64
) -> Result<u128>
Calculates the amount of rewards earned for the given number of staked tokens, with safety checks. https://github.com/Synthetixio/synthetix/blob/4b9b2ee09b38638de6fe1c38dbe4255a11ebed86/contracts/StakingRewards.sol#L72
sourcepub fn sanity_check(
&self,
current_ts: i64,
amount_claimable: u64,
miner: &Miner
) -> Result<()>
pub fn sanity_check(
&self,
current_ts: i64,
amount_claimable: u64,
miner: &Miner
) -> Result<()>
Sanity check on the amount of rewards to be claimed by the miner.
sourcepub fn last_time_reward_applicable(&self, current_ts: i64) -> i64
pub fn last_time_reward_applicable(&self, current_ts: i64) -> i64
Gets the latest time rewards were being distributed.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Payroll
impl Send for Payroll
impl Sync for Payroll
impl Unpin for Payroll
impl UnwindSafe for Payroll
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