The RockPaperScissors::createGameWithToken
and RockPaperScissors::joinGameWithToken
functions use a hardcoded value 1
for token transfers, a magic number that reduces code readability and maintainability. A named constant should be used instead.
In RockPaperScissors::createGameWithToken
and RockPaperScissors::joinGameWithToken
, the contract uses the hardcoded value 1
in the winningToken.transferFrom
calls to transfer tokens from the caller to the contract. This magic number lacks context, making it unclear what the value represents (e.g., the required token stake amount). Hardcoding such values reduces code readability and increases the risk of errors if the token amount needs to change in the future, as developers must manually update all instances of 1
across the codebase.
Reduced code readability, making it harder for developers to understand the purpose of the token transfer amount.
Increased maintenance burden, as changing the token stake amount requires updating hardcoded values in multiple places.
Potential for errors if the hardcoded value is inconsistently updated in future modifications.
No immediate security impact, but it violates best practices for maintainable smart contract development.
Manual Review
Code suggestions or observations that do not pose a direct security risk.
Code suggestions or observations that do not pose a direct security risk.
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.