Struct quarry_mine::payroll::Payroll [−][src]
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
Creates a new Payroll.
Calculates the amount of rewards to pay for each staked token, performing safety checks.
pub fn calculate_rewards_earned(
&self,
current_ts: i64,
tokens_deposited: u64,
rewards_per_token_paid: u128,
rewards_earned: u64
) -> Result<u128, ProgramError>
pub fn calculate_rewards_earned(
&self,
current_ts: i64,
tokens_deposited: u64,
rewards_per_token_paid: u128,
rewards_earned: u64
) -> Result<u128, ProgramError>
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
pub fn sanity_check(
&self,
current_ts: i64,
amount_claimable: u64,
miner: &Miner
) -> ProgramResult
pub fn sanity_check(
&self,
current_ts: i64,
amount_claimable: u64,
miner: &Miner
) -> ProgramResult
Sanity check on the amount of rewards to be claimed by the miner.
Gets the latest time rewards were being distributed.