ILM_PC_Staking_v1.sol
Functions
getStakingToken
Returns address of the token users can stake.
Returns
<none>
address
The address of the token.
getTotalSupply
Returns the total supply of staked tokens of this contract.
Returns
<none>
uint256
The total supply of staked tokens.
getRewardRate
Returns how much Tokens will be distributed per second to all users that staked in this contract.
Returns
<none>
uint256
The reward rate.
getRewardsEnd
Returns when the rewards will not be distributed anymore.
Returns
<none>
uint256
The timestamp of when the rewards will end.
getBalance
Returns the amount of tokens a user staked in this contract.
Parameters
user
address
The address of a user that staked.
getEarned
Returns the amount of tokens earned up until now by the current stake of a user.
Parameters
user
address
The address of a user that staked.
Returns
<none>
uint256
The amount of tokens earned.
getEstimatedReward
Returns a estimation of how much rewards will be earned with the current state of the staking contract.
This calculation uses the current reward rate and the current totalSupply to calculate the rewards.
the estimated result could be 0 if the estimated rewards are not high enough.
Parameters
amount
uint256
How much token are staked.
duration
uint256
How long the tokens will be staked.
Returns
<none>
uint256
The estimated amount of tokens earned.
getRewardValue
Returns the reward value.
Returns
<none>
uint256
The reward value.
getLastUpdate
Returns the timestamp of last state change.
Returns
<none>
uint256
The timestamp of last state change.
stake
Stake a specified amount of tokens to earn rewards.
Should tokens already be staked, then the sending address will collect the rewards up until this point.
Fee on transfer tokens are currently not supported.
Parameters
amount
uint256
How much token should be staked.
unstake
Unstake a specified amount of tokens and collect rewards.
Reaps the rewards collected up to this point for the msg.Sender().
Fee on transfer tokens are currently not supported.
Parameters
amount
uint256
How much token should be unstaked.
claimRewards
Collects the rewards that are earned up until now.
Reaps the rewards collected up to this point for the msg.Sender().
setRewards
Sets the rewards that are to be distributed.
Equally distributes the reward amount over the given time period.
Parameters
amount
uint256
How much token should be distributed.
duration
uint256
How much time it will take to distribute the token.
Events
RewardSet
Event emitted when a reward is added.
Parameters
rewardAmount
uint256
The amount of tokens to distribute.
duration
uint256
The duration of the reward period.
newRewardRate
uint256
The new reward rate.
newRewardsEnd
uint256
The new timestamp of when the rewards will end.
Staked
Event emitted when a user stakes an amount.
Parameters
user
address
The address of the user.
amount
uint256
The amount of tokens staked.
Unstaked
Event emitted when a user unstakes an amount.
Parameters
user
address
The address of the user.
amount
uint256
The amount of tokens unstaked.
RewardsDistributed
Event emitted when a user receives Rewards.
Parameters
user
address
The address of the user.
amount
uint256
The amount of tokens earned.
Updated
Event emitted for each major change of state.
Parameters
triggerAddress
address
Address of user if state change was triggered by a staking action. Else can be zero.
rewardValue
uint256
Variable necessary to calculate how much rewards a staker is eligible for.
lastUpdate
uint256
Timestamp of last state change.
earnedRewards
uint256
How much a user earned up to point of state change.
StakingTokenSet
Event emitted when staking token is set.
Parameters
token
address
Address of token that can be staked.
Errors
Module__LM_PC_Staking_v1__InvalidStakingToken
Given staking token address is invalid.
Module__LM_PC_Staking_v1__InvalidDuration
Given Duration is invalid.
Module__LM_PC_Staking_v1__InvalidRewardRate
The calculated Reward rate is too low to be used.
Last updated