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 rewardPoolInfo
s and then add a new rewardPoolInfo
.
Inputs
_rewardToken
Control: Arbitrary.
Constraints: None.
Impact: Address of the
rewardPool
token contract.
_startTime
Control: Arbitrary.
Constraints: Must be less than
_endRewardTime
. Usually greater thanblock.timestamp
; otherwise, it will be treated asblock.timestamp
.Impact: Start reward time that
rewardPool
distribution occurs.
_endRewardTime
Control: Arbitrary.
Constraints: Must be greater than
_startTime
.Impact: Time that
rewardPool
distribution ends.
_rewardPerSecond
Control: Arbitrary.
Constraints: None.
Impact: Reward-token amount to distribute per second.
Branches and code coverage
Intended branches
Check if
_startTime
is smaller thanblock.timestamp
. If so, change_startTime
toblock.timestamp
directly.Make sure
_startTime
is less than_endRewardTime
.Call the
updateReward
function to update the existingrewardPoolInfo
status.Create a new
rewardPool
and add it to therewardPoolInfo
array.
Negative behavior
Revert if the
_endRewardTime
of the newrewardPool
is greater than or equal to_startTime
.