Function: addRewardPool(address _rewardToken, uint256 _startTime, uint256 _endRewardTime, uint256 _rewardPerSecond)
This function is used by the owner to first update the status of all existing rewardPoolInfos and then add a new rewardPoolInfo.
Inputs
_rewardTokenControl: Arbitrary.
Constraints: None.
Impact: Address of the
rewardPooltoken contract.
_startTimeControl: Arbitrary.
Constraints: Must be less than
_endRewardTime. Usually greater thanblock.timestamp; otherwise, it will be treated asblock.timestamp.Impact: Start reward time that
rewardPooldistribution occurs.
_endRewardTimeControl: Arbitrary.
Constraints: Must be greater than
_startTime.Impact: Time that
rewardPooldistribution ends.
_rewardPerSecondControl: Arbitrary.
Constraints: None.
Impact: Reward-token amount to distribute per second.
Branches and code coverage
Intended branches
Check if
_startTimeis smaller thanblock.timestamp. If so, change_startTimetoblock.timestampdirectly.Make sure
_startTimeis less than_endRewardTime.Call the
updateRewardfunction to update the existingrewardPoolInfostatus.Create a new
rewardPooland add it to therewardPoolInfoarray.
Negative behavior
Revert if the
_endRewardTimeof the newrewardPoolis greater than or equal to_startTime.