Skip to content

FluidLendingStakingRewards ​

Git Source

Inherits: Owned, ReentrancyGuard

State Variables ​

rewardsToken ​

solidity
IERC20 public immutable rewardsToken;

stakingToken ​

solidity
IERC20 public immutable stakingToken;

_periodFinish ​

solidity
uint40 internal _periodFinish;

lastUpdateTime ​

solidity
uint40 public lastUpdateTime;

_rewardsDuration ​

solidity
uint40 internal _rewardsDuration;

_rewardRate ​

solidity
uint136 internal _rewardRate;

rewardPerTokenStored ​

solidity
uint128 public rewardPerTokenStored;

_totalSupply ​

solidity
uint128 internal _totalSupply;

nextRewardsDuration ​

solidity
uint40 public nextRewardsDuration;

nextRewards ​

solidity
uint216 public nextRewards;

userRewardPerTokenPaid ​

solidity
mapping(address => uint256) public userRewardPerTokenPaid;

rewards ​

solidity
mapping(address => uint256) public rewards;

_balances ​

solidity
mapping(address => uint256) internal _balances;

Functions ​

constructor ​

solidity
constructor(address owner_, IERC20 rewardsToken_, IERC20 stakingToken_, uint40 rewardsDuration_) Owned(owner_);

nextPeriodFinish ​

solidity
function nextPeriodFinish() public view returns (uint256);

nextRewardRate ​

solidity
function nextRewardRate() public view returns (uint256);

periodFinish ​

solidity
function periodFinish() public view returns (uint256);

rewardRate ​

solidity
function rewardRate() public view returns (uint256);

rewardsDuration ​

solidity
function rewardsDuration() public view returns (uint256);

totalSupply ​

solidity
function totalSupply() public view returns (uint256);

balanceOf ​

solidity
function balanceOf(address account) public view returns (uint256);

lastTimeRewardApplicable ​

gets last time where rewards accrue, also considering already queued next rewards

solidity
function lastTimeRewardApplicable() public view returns (uint256);

rewardPerToken ​

gets reward amount per token, also considering automatic transition to queued next rewards

solidity
function rewardPerToken() public view returns (uint256 rewardPerToken_);

earned ​

gets earned reward amount for an account, also considering automatic transition to queued next rewards

solidity
function earned(address account) public view returns (uint256);

getRewardForDuration ​

gets reward amount for current duration, also considering automatic transition to queued next rewards

solidity
function getRewardForDuration() public view returns (uint256);

stakeWithPermit ​

solidity
function stakeWithPermit(uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
    external
    nonReentrant
    updateReward(msg.sender);

stake ​

solidity
function stake(uint256 amount) external nonReentrant updateReward(msg.sender);

withdraw ​

solidity
function withdraw(uint256 amount) public nonReentrant updateReward(msg.sender);

getReward ​

solidity
function getReward() public nonReentrant updateReward(msg.sender);

exit ​

solidity
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.

solidity
function updateRewards() public nonReentrant updateReward(address(0));

queueNextRewardAmount ​

queues next rewards that will be transitioned to automatically after current rewards reach periodFinish.

solidity
function queueNextRewardAmount(uint216 nextReward_, uint40 nextDuration_) external onlyOwner;

notifyRewardAmountWithDuration ​

add new rewards and update reward duration AFTER a reward period has ended.

solidity
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

solidity
function notifyRewardAmount(uint256 reward_) public onlyOwner updateReward(address(0));

spell ​

Spell allows owner aka governance to do any arbitrary call

solidity
function spell(address target_, bytes memory data_) external onlyOwner returns (bytes memory response_);

Parameters

NameTypeDescription
target_addressAddress to which the call needs to be delegated
data_bytesData to execute at the delegated address

updateReward ​

solidity
modifier updateReward(address account);

Events ​

RewardAdded ​

solidity
event RewardAdded(uint256 reward);

Staked ​

solidity
event Staked(address indexed user, uint256 amount);

Withdrawn ​

solidity
event Withdrawn(address indexed user, uint256 amount);

RewardPaid ​

solidity
event RewardPaid(address indexed user, uint256 reward);

NextRewardQueued ​

solidity
event NextRewardQueued(uint256 reward, uint256 duration);