-
Notifications
You must be signed in to change notification settings - Fork 12.2k
refactor(ERC20FlashMint): remove unused parameter suppression in _flashFee #5982
New issue
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
base: master
Are you sure you want to change the base?
Conversation
|
WalkthroughThe change updates contracts/token/ERC20/extensions/ERC20FlashMint.sol by modifying the internal helper function signature from function _flashFee(address token, uint256 value) to function _flashFee(address, uint256). Only the first parameter’s name is removed; types, visibility, and implementation remain the same. The function still returns 0 and exhibits no control-flow or error-handling changes. There are no alterations to public or exported interfaces. Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
contracts/token/ERC20/extensions/ERC20FlashMint.sol (1)
67-77
: Fix NatSpec documentation to match function signature.The pipeline failure indicates that the NatSpec documentation at lines 71-72 still references
@param token
and@param value
, but the function signature at line 75 no longer has named parameters. This causes a documentation mismatch error.Apply this diff to fix the documentation:
/** * @dev Returns the fee applied when doing flash loans. By default this * implementation has 0 fees. This function can be overloaded to make * the flash loan mechanism deflationary. - * @param token The token to be flash loaned. - * @param value The amount of tokens to be loaned. * @return The fees applied to the corresponding flash loan. */ function _flashFee(address, uint256) internal view virtual returns (uint256) { return 0; }
🧹 Nitpick comments (1)
contracts/token/ERC20/extensions/ERC20FlashMint.sol (1)
75-75
: Reconsider removing parameter names from virtual functions.While anonymous parameters are valid for unused parameters, this function is
internal view virtual
and explicitly documented (lines 68-70) to be overridden by child contracts to implement custom fee logic. Removing parameter names reduces clarity for implementers who need to understand what the parameters represent without referring to the caller or interface documentation.Consider keeping the parameter names for better developer experience:
- function _flashFee(address, uint256) internal view virtual returns (uint256) { + function _flashFee(address token, uint256 value) internal view virtual returns (uint256) { return 0; }If the goal is to avoid unused-parameter warnings in older Solidity versions, modern compilers (0.8.0+) already handle this gracefully without requiring suppression statements like
token;
orvalue;
.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
contracts/token/ERC20/extensions/ERC20FlashMint.sol
(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: formal verification
contracts/token/ERC20/extensions/ERC20FlashMint.sol
[error] 67-67: Documented parameter "token" not found in the parameter list of the function. Documented parameter "value" not found in the parameter list of the function.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: slither
Co-authored-by: Hadrien Croubois <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI was failing because the @param
NatSpec tags were referencing unnamed arguments. I removed them since our documentation doesn't render them anyway.
LGTM but it would need a second approval
Problem:
The
_flashFee
function inERC20FlashMint
was using unused parameter suppression by referencingtoken
andvalue
variables without using them. This approach adds unnecessary bytecode and creates misleading code that suggests these parameters are used.Solution:
token;
andvalue;
)address, uint256
)Benefits: