We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Description
When the HaloToken is deployed, there are 2 state variables set:
https://github.com/monoceros-alpha/review-halodao-rewards-2021-06/blob/4757f51facd18a0fa205ffd9961df8c6b0409deb/code/contracts/HaloToken.sol#L24-L25
The canMint state variable is checked when the owner tries to mint additional tokens.
canMint
https://github.com/monoceros-alpha/review-halodao-rewards-2021-06/blob/4757f51facd18a0fa205ffd9961df8c6b0409deb/code/contracts/HaloToken.sol#L40-L41
The owner can renounce this power by calling setCapped.
setCapped
https://github.com/monoceros-alpha/review-halodao-rewards-2021-06/blob/4757f51facd18a0fa205ffd9961df8c6b0409deb/code/contracts/HaloToken.sol#L28-L30
When setCapped is called, the state variable isCappedFuncLocked is checked to be false.
isCappedFuncLocked
https://github.com/monoceros-alpha/review-halodao-rewards-2021-06/blob/4757f51facd18a0fa205ffd9961df8c6b0409deb/code/contracts/HaloToken.sol#L31
Once the check passes, canMint is set to false, blocking future token minting.
false
https://github.com/monoceros-alpha/review-halodao-rewards-2021-06/blob/4757f51facd18a0fa205ffd9961df8c6b0409deb/code/contracts/HaloToken.sol#L32
And isCappedFuncLocked is set to true; this prevents a second call to setCapped.
true
However, the 2 state variables are always synchronized. They can have the value true or false. And they only exist in these 2 states:
canMint = true isCappedFuncLocked = false
canMint = false isCappedFuncLocked = true
The code can be simplified if one of the 2 state variables is removed, the other one's value can be deduced by negating the remaining one.
Recommendation
Remove isCappedFuncLocked and use canMint to limit the setCapped execution.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
When the HaloToken is deployed, there are 2 state variables set:
https://github.com/monoceros-alpha/review-halodao-rewards-2021-06/blob/4757f51facd18a0fa205ffd9961df8c6b0409deb/code/contracts/HaloToken.sol#L24-L25
The
canMint
state variable is checked when the owner tries to mint additional tokens.https://github.com/monoceros-alpha/review-halodao-rewards-2021-06/blob/4757f51facd18a0fa205ffd9961df8c6b0409deb/code/contracts/HaloToken.sol#L40-L41
The owner can renounce this power by calling
setCapped
.https://github.com/monoceros-alpha/review-halodao-rewards-2021-06/blob/4757f51facd18a0fa205ffd9961df8c6b0409deb/code/contracts/HaloToken.sol#L28-L30
When
setCapped
is called, the state variableisCappedFuncLocked
is checked to be false.https://github.com/monoceros-alpha/review-halodao-rewards-2021-06/blob/4757f51facd18a0fa205ffd9961df8c6b0409deb/code/contracts/HaloToken.sol#L31
Once the check passes,
canMint
is set tofalse
, blocking future token minting.https://github.com/monoceros-alpha/review-halodao-rewards-2021-06/blob/4757f51facd18a0fa205ffd9961df8c6b0409deb/code/contracts/HaloToken.sol#L32
And
isCappedFuncLocked
is set totrue
; this prevents a second call tosetCapped
.However, the 2 state variables are always synchronized. They can have the value
true
orfalse
. And they only exist in these 2 states:The code can be simplified if one of the 2 state variables is removed, the other one's value can be deduced by negating the remaining one.
Recommendation
Remove
isCappedFuncLocked
and usecanMint
to limit thesetCapped
execution.The text was updated successfully, but these errors were encountered: