Resolve warnings for Staking and DAO smart contracts found by Slither #79
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What was the problem?
This PR resolves #69.
How was it solved?
How was it tested?
Unit tests were modified accordingly to all changes.
Additional Information
One
Low level
warning was not resolved:uses timestamp for comparisons
; Recommendation: Avoid relying onblock.timestamp
One
Informational level
warning was not resolved:compares to a boolean constant
; Recommendation: Remove the equality to the boolean constant.Contracts are calculating todays day based on
block.timestamp
and in my opinion it's safe to useblock.timestamp
.This recommendation would be valid if we'll be using
block.timestamp
for calculation of randomness. In this case block proposer could influence onblock.timestamp
and took his advantage on others.For informational warning, it advises to instead of using:
require(isLockingPositionNull(lock) == false, "L2Staking: locking position does not exist");
we should use:
require(!isLockingPositionNull(lock), "L2Staking: locking position does not exist");
which is in my opinion more error prone than the first version.