Allows participants in the Zesty Market to stake their ZESTY tokens for more ZESTY tokens. This contract is designed to reduce the token velocity of ZESTY tokens. Note that tokens have to be unstaked and re-delegated should a user want to participate in governance decisions. Alternatively, users can call getReward to retrieve rewarded ZESTY tokens to participate in governance too.
Specify the owner of the StakingReward contract (this should be Zesty DAO), the reward distributor contract address, the address of the rewards and staking token.
) RewardsRecipient(owner_, rewardsDistributor_)
Returns the total amount of staked tokens in the contract
function totalSupply() external view override returns (uint256)
Returns the balance of a given account which had staked tokens
function balanceOf(address account) external view override returns (uint256)
Returns the current block.timestamp or the last period where rewards token were given to the contract.
function lastTimeRewardApplicable() public view override returns (uint256)
Returns the reward per staked token given the rewardRate.
function rewardPerToken() public view override returns (uint256)
Returns the earnings of an account
function earned(address account) public view override returns (uint256)
Returns the reward token address
function rewardsToken() external view override returns (address)
Returns the staking token address
function stakingToken() external view override returns (address)
Returns the reward distributor contract address
function rewardsDistributor() external view override(IStakingRewards, RewardsRecipient) returns (address)
State Changing Functions
Stake the staking token into the contract
function stake(uint256 amount) external override nonReentrant updateReward(msg.sender)
Withdraw deposited staking token from the contract
function withdraw(uint256 amount) public override nonReentrant updateReward(msg.sender)
Get the rewards for staking done
function getReward() public override nonReentrant updateReward(msg.sender)
Calls withdraw and getReward
function exit() external override
Updates the contract state variables
balance of the StakingRewards contract,
periodFinish after the RewardDistributor has given tokens to the contract.
function notifyRewardAmount(uint256 reward) external override onlyRewardsDistributor updateReward(address(0))
Allows ZestyDAO to change the periodFinish variable which would end rewards emissions earlier or later. Note that changing this would modify the
lastTimeRewardApplicable function and the
function updatePeriodFinish(uint timestamp) external onlyOwner updateReward(address(0))
Allows ZestyDAO to recover tokens that are not staking tokens from the contract.
function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner
Sets the reward duration. Note that changing the reward duration would modify the
notifyRewardAmount is called by RewardsDistributor.
function setRewardsDuration(uint256 _rewardsDuration) external onlyOwner
Updates the reward tokens earned by an account. Updates the
rewardPerTokenStored variable and the
modifier updateReward(address account)