Some informational findings in Pot.sol
:
Error: Pot__InsufficientFunds();
This error is declared but not used anywhere in the contract.
Variables should be immutable: i_players
and i_rewards
should be marked as immutable
since they do not change after initialization. They are already prefixed with i_
, which suggests immutability, but they are not actually declared as such.
Unused commented line in the constructor: There is a commented-out line in the constructor that is not being used and should be removed for clarity.
Magic number in closePot
: The value 90 days
is a magic number and should be replaced with a named constant for better readability and maintainability.
Incorrect formula for managerCutPercent
: The current formula for calculating the manager's cut only works correctly when managerCutPercent
is 10%. It will not produce correct results for other values.
Delete the unused error declaration:
Remove the Pot__InsufficientFunds();
line if it's not being used in the contract.
Make variables immutable:
Since i_players
and i_rewards
do not change after they are initialized, mark them as immutable
:
Remove the unused commented line:
Delete the line // i_token.transfer(address(this), i_totalRewards);
from the constructor to keep the code clean and readable.
Use a named constant instead of a magic number:
Replace 90 days
with a named constant to make the code more understandable:
Correct the formula for the manager's cut:
Update the formula to correctly calculate the manager's cut for any percentage, not just 10%:
This formula ensures that the manager's cut is correctly calculated as a percentage of the remaining unclaimed rewards.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.