Z
Z
Zesty Market
Search…
StakingRewards
Forked from Synthetix StakindRewards

Introduction

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.

Specifications

Constructor

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.
1
constructor(
2
address owner_,
3
address rewardsDistributor_,
4
address rewardsToken_,
5
address stakingToken_
6
) RewardsRecipient(owner_, rewardsDistributor_)
Copied!

Getter Functions

totalSupply

Returns the total amount of staked tokens in the contract
1
function totalSupply() external view override returns (uint256)
Copied!

balanceOf

Returns the balance of a given account which had staked tokens
1
function balanceOf(address account) external view override returns (uint256)
Copied!

lastTimeRewardApplicable

Returns the current block.timestamp or the last period where rewards token were given to the contract.
1
function lastTimeRewardApplicable() public view override returns (uint256)
Copied!

rewardPerToken

Returns the reward per staked token given the rewardRate.
1
function rewardPerToken() public view override returns (uint256)
Copied!

earned

Returns the earnings of an account
1
function earned(address account) public view override returns (uint256)
Copied!

rewardsToken

Returns the reward token address
1
function rewardsToken() external view override returns (address)
Copied!

stakingToken

Returns the staking token address
1
function stakingToken() external view override returns (address)
Copied!

rewardsDistributor

Returns the reward distributor contract address
1
function rewardsDistributor() external view override(IStakingRewards, RewardsRecipient) returns (address)
Copied!

State Changing Functions

stake

Stake the staking token into the contract
1
function stake(uint256 amount) external override nonReentrant updateReward(msg.sender)
Copied!

withdraw

Withdraw deposited staking token from the contract
1
function withdraw(uint256 amount) public override nonReentrant updateReward(msg.sender)
Copied!

getReward

Get the rewards for staking done
1
function getReward() public override nonReentrant updateReward(msg.sender)
Copied!

exit

Calls withdraw and getReward
1
function exit() external override
Copied!

notifyRewardAmount

Updates the contract state variables rewardRate,balance of the StakingRewards contract, lastUpdateTime and periodFinish after the RewardDistributor has given tokens to the contract.
1
function notifyRewardAmount(uint256 reward) external override onlyRewardsDistributor updateReward(address(0))
Copied!

updatePeriodFinish

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 rewardPerToken function.
1
function updatePeriodFinish(uint timestamp) external onlyOwner updateReward(address(0))
Copied!

recoverERC20

Allows ZestyDAO to recover tokens that are not staking tokens from the contract.
1
function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner
Copied!

setRewardDuration

Sets the reward duration. Note that changing the reward duration would modify the rewardRate when notifyRewardAmount is called by RewardsDistributor.
1
function setRewardsDuration(uint256 _rewardsDuration) external onlyOwner
Copied!

Modifiers

updateReward

Updates the reward tokens earned by an account. Updates the rewardPerTokenStored variable and the lastUpdateTime variable.
1
modifier updateReward(address account)
Copied!
Last modified 3mo ago