FluidLendingStakingRewards ​
Inherits: Owned, ReentrancyGuard
State Variables ​
rewardsToken ​
IERC20 public immutable rewardsToken;
stakingToken ​
IERC20 public immutable stakingToken;
_periodFinish ​
uint40 internal _periodFinish;
lastUpdateTime ​
uint40 public lastUpdateTime;
_rewardsDuration ​
uint40 internal _rewardsDuration;
_rewardRate ​
uint136 internal _rewardRate;
rewardPerTokenStored ​
uint128 public rewardPerTokenStored;
_totalSupply ​
uint128 internal _totalSupply;
nextRewardsDuration ​
uint40 public nextRewardsDuration;
nextRewards ​
uint216 public nextRewards;
userRewardPerTokenPaid ​
mapping(address => uint256) public userRewardPerTokenPaid;
rewards ​
mapping(address => uint256) public rewards;
_balances ​
mapping(address => uint256) internal _balances;
Functions ​
constructor ​
constructor(address owner_, IERC20 rewardsToken_, IERC20 stakingToken_, uint40 rewardsDuration_) Owned(owner_);
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 ​
gets last time where rewards accrue, also considering already queued next rewards
function lastTimeRewardApplicable() public view returns (uint256);
rewardPerToken ​
gets reward amount per token, also considering automatic transition to queued next rewards
function rewardPerToken() public view returns (uint256 rewardPerToken_);
earned ​
gets earned reward amount for an account
, also considering automatic transition to queued next rewards
function earned(address account) public view returns (uint256);
getRewardForDuration ​
gets reward amount for current duration, also considering automatic transition to queued next rewards
function getRewardForDuration() public view returns (uint256);
stakeWithPermit ​
function stakeWithPermit(uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
external
nonReentrant
updateReward(msg.sender);
stake ​
function stake(uint256 amount) external nonReentrant updateReward(msg.sender);
withdraw ​
function withdraw(uint256 amount) public nonReentrant updateReward(msg.sender);
getReward ​
function getReward() public nonReentrant updateReward(msg.sender);
exit ​
function exit() external;
updateRewards ​
updates rewards until current block.timestamp or periodFinish
. Transitions to next rewards if previous rewards ended and next ones were queued.
function updateRewards() public nonReentrant updateReward(address(0));
queueNextRewardAmount ​
queues next rewards that will be transitioned to automatically after current rewards reach periodFinish
.
function queueNextRewardAmount(uint216 nextReward_, uint40 nextDuration_) external onlyOwner;
notifyRewardAmountWithDuration ​
add new rewards and update reward duration AFTER a reward period has ended.
function notifyRewardAmountWithDuration(uint256 reward_, uint40 newDuration_)
external
onlyOwner
updateReward(address(0));
notifyRewardAmount ​
add new rewards or top-up adding to current rewards, adjusting rewardRate going forward for leftover + newReward until block.timestamp + duration
function notifyRewardAmount(uint256 reward_) public onlyOwner updateReward(address(0));
spell ​
Spell allows owner aka governance to do any arbitrary call
function spell(address target_, bytes memory data_) external onlyOwner returns (bytes memory response_);
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);
Events ​
RewardAdded ​
event RewardAdded(uint256 reward);
Staked ​
event Staked(address indexed user, uint256 amount);
Withdrawn ​
event Withdrawn(address indexed user, uint256 amount);
RewardPaid ​
event RewardPaid(address indexed user, uint256 reward);
NextRewardQueued ​
event NextRewardQueued(uint256 reward, uint256 duration);