The collectCreationFee function in the contract contains an unnecessary check (fee.amount == 0) before calling the _route function. Since the _route function already checks if the fee amount is zero, the additional check in collectCreationFee is redundant and can be safely removed.
Vulnerability Detail
The collectCreationFee function includes a check to ensure that the fee amount is not zero before routing the fee using the _route function. However, the _route function itself performs the same check to verify if the fee amount is zero before proceeding with routing. As a result, the check in collectCreationFee is redundant and does not provide any additional safety measures.
Impact
The presence of an unnecessary check in the collectCreationFee function may lead to code redundancy and increased complexity without providing any meaningful benefits. While the impact may be minimal, removing the redundant check can improve code readability and maintainability.
To streamline the code and eliminate redundancy, it is recommended to remove the unnecessary check (fee.amount == 0) from the collectCreationFee function. Since the _route function already includes a check for zero fee amounts, removing the redundant check does not compromise safety and improves code clarity.
Unnecessary Check in collectCreationFee Function
Low/Info issue submitted by Bigsam
Summary
The
collectCreationFee
function in the contract contains an unnecessary check(fee.amount == 0)
before calling the_route
function. Since the_route
function already checks if the fee amount is zero, the additional check incollectCreationFee
is redundant and can be safely removed.Vulnerability Detail
The
collectCreationFee
function includes a check to ensure that the fee amount is not zero before routing the fee using the_route
function. However, the_route
function itself performs the same check to verify if the fee amount is zero before proceeding with routing. As a result, the check incollectCreationFee
is redundant and does not provide any additional safety measures.Impact
The presence of an unnecessary check in the
collectCreationFee
function may lead to code redundancy and increased complexity without providing any meaningful benefits. While the impact may be minimal, removing the redundant check can improve code readability and maintainability.Code Snippet
https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L171
https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L173
https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L162-L175
https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L448-L451
https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L451
Tool used
Manual Review
Recommendation
To streamline the code and eliminate redundancy, it is recommended to remove the unnecessary check
(fee.amount == 0)
from thecollectCreationFee
function. Since the_route
function already includes a check for zero fee amounts, removing the redundant check does not compromise safety and improves code clarity.