FluidLendingStakingRewards
rewardsToken
contract IERC20 rewardsToken
stakingToken
contract IERC20 stakingToken
_periodFinish
uint40 _periodFinish
lastUpdateTime
uint40 lastUpdateTime
_rewardsDuration
uint40 _rewardsDuration
_rewardRate
uint136 _rewardRate
rewardPerTokenStored
uint128 rewardPerTokenStored
_totalSupply
uint128 _totalSupply
nextRewardsDuration
uint40 nextRewardsDuration
nextRewards
uint216 nextRewards
userRewardPerTokenPaid
mapping(address => uint256) userRewardPerTokenPaid
rewards
mapping(address => uint256) rewards
_balances
mapping(address => uint256) _balances
constructor
constructor(address owner_, contract IERC20 rewardsToken_, contract IERC20 stakingToken_, uint40 rewardsDuration_) public
nextPeriodFinish
function nextPeriodFinish() public view returns (uint256)
nextRewardRate
function nextRewardRate() public view returns (uint256)
periodFinish
function periodFinish() public view returns (uint256)
rewardRate
function rewardRate() public view returns (uint256)
rewardsDuration
function rewardsDuration() public view returns (uint256)
totalSupply
function totalSupply() public view returns (uint256)
balanceOf
function balanceOf(address account) public view returns (uint256)
lastTimeRewardApplicable
function lastTimeRewardApplicable() public view returns (uint256)
gets last time where rewards accrue, also considering already queued next rewards
rewardPerToken
function rewardPerToken() public view returns (uint256 rewardPerToken_)
gets reward amount per token, also considering automatic transition to queued next rewards
earned
function earned(address account) public view returns (uint256)
gets earned reward amount for an account
, also considering automatic transition to queued next rewards
getRewardForDuration
function getRewardForDuration() public view returns (uint256)
gets reward amount for current duration, also considering automatic transition to queued next rewards
stakeWithPermit
function stakeWithPermit(uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external
stake
function stake(uint256 amount) external
withdraw
function withdraw(uint256 amount) public
getReward
function getReward() public
exit
function exit() external
updateRewards
function updateRewards() public
updates rewards until current block.timestamp or periodFinish
. Transitions to next rewards
if previous rewards ended and next ones were queued.
queueNextRewardAmount
function queueNextRewardAmount(uint216 nextReward_, uint40 nextDuration_) external
queues next rewards that will be transitioned to automatically after current rewards reach periodFinish
.
notifyRewardAmountWithDuration
function notifyRewardAmountWithDuration(uint256 reward_, uint40 newDuration_) external
add new rewards and update reward duration AFTER a reward period has ended.
notifyRewardAmount
function notifyRewardAmount(uint256 reward_) public
add new rewards or top-up adding to current rewards, adjusting rewardRate going forward for leftover + newReward until block.timestamp + duration
spell
function spell(address target_, bytes data_) external returns (bytes response_)
Spell allows owner aka governance to do any arbitrary call
Parameters
Name | Type | Description |
---|---|---|
target_ | address | Address to which the call needs to be delegated |
data_ | bytes | Data to execute at the delegated address |
updateReward
modifier updateReward(address account)
RewardAdded
event RewardAdded(uint256 reward)
Staked
event Staked(address user, uint256 amount)
Withdrawn
event Withdrawn(address user, uint256 amount)
RewardPaid
event RewardPaid(address user, uint256 reward)
NextRewardQueued
event NextRewardQueued(uint256 reward, uint256 duration)