Function: createLock(uint256 _value, uint256 _days)
This function allows users to lock a certain amount of lockedToken to gain voting power. A user can choose to increase the amount of lockedToken or extend the lock time.
Inputs
_value
Control: Arbitrary.
Constraints: Greater than or equal to
minLockedAmount
.Impact: The amount of lockedToken the user wants to lock.
_days
Control: Arbitrary.
Constraints: Greater than or equal to seven days. Less than or equal to two years.
Impact: The amount of days the user wants to lock the lockedToken.
Branches and code coverage
Intended branches
Call
_deposit_for
, and the user can choose to increase the amount of lockedToken or extend the lock time.Calculate voting power, update lock information, and perform token transfers.
Negative behavior
Revert if locked amount is less than the minimum amount.
Revert if old tokens have not been withdrawn.
Revert if the user wants to lock the token for less than seven days.
Revert if the user wants to lock the token for more than two years.
Revert if increasing the amount and extending the lock time at the same time.
Revert if there is no benefit to lock.