This report compiles all low-severity findings identified during the audit of the TokenDivider and ERC20ToGenerateNftFraccion contracts. These findings include issues related to code redundancy, state variable ordering, reentrancy risks, function visibility, naming conventions, missing events, and magic numbers. While these issues do not pose immediate risks to funds or protocol functionality, they impact code quality, maintainability, and gas efficiency. Recommendations are provided to address each finding.
Description: The onlyNftOwner modifier is applied twice in the divideNft function, adding unnecessary overhead and reducing code readability.
Impact: Increases gas costs and reduces maintainability.
Proof of Concept:
Recommendation:
Remove the duplicate modifier:
Description: State variables are updated after an external call to safeTransferFrom, increasing the risk of incorrect state if the call fails or behaves maliciously.
Impact: Potential for incorrect state and reentrancy risks.
Proof of Concept:
Recommendation: Update state variables before external calls and implement reentrancy guards.
Description: External calls to transfer are made before state updates, exposing the contract to reentrancy attacks.
Impact: Malicious actors could manipulate state variables or steal tokens.
Proof of Concept:
Recommendation: Update state variables before external calls and use a reentrancy guard.
Description: External calls to burnFrom and safeTransferFrom are made without reentrancy protection.
Impact: Malicious actors could repeatedly claim NFTs or manipulate state.
Proof of Concept:
Recommendation: Follow the Checks-Effects-Interactions pattern and use a reentrancy guard
Description: Public view functions (getBalanceOf, getErc20TotalMintedAmount, etc.) are not used internally but are marked as public.
Impact: Slightly higher gas costs for external calls.
Recommendation: Change visibility to external:
Description: Parameter names (_to, _amount) use an outdated naming convention.
Impact: Reduces code readability and maintainability.
Recommendation: Use modern naming conventions:
Description: Several critical state changes do not emit events, reducing transparency.
Impact: Harder to track contract activity and debug issues.
Recommendation: Emit events for all significant state changes:
Description: Magic numbers (e.g., 100, 2) are used in fee calculations, reducing code readability.
Impact: Increases risk of future errors and maintenance challenges.
Recommendation: Replace magic numbers with constants:
Description: The mint function does not emit an event when tokens are minted.
Impact: Reduces off-chain monitoring capabilities.
Recommendation: Emit an event:
Description: Constructor parameters (_name, _symbol) shadow internal variables.
Impact: Reduces code readability and can lead to confusion.
Recommendation: Rename parameters to avoid shadowing:
The low-severity findings primarily affect code quality, maintainability, and gas efficiency. While they do not pose immediate risks to funds or protocol functionality, addressing these issues will improve the overall robustness and transparency of the contracts.
Manual Review
Foundry
Remove redundant modifiers and improve code readability.
Follow the Checks-Effects-Interactions pattern to prevent reentrancy.
Mark public functions as external if they are not used internally.
Use modern naming conventions for functions and parameters.
Emit events for all critical state changes to improve transparency.
Replace magic numbers with constants to enhance code maintainability.
Avoid local variable shadowing in constructors.
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.