DeFiFoundry
60,000 USDC
View results
Submission Details
Severity: low
Valid

Redundant Payable Function in `createTradingAccountAndMulticall` function

Summary

An issue has been identified in the createTradingAccountAndMulticall function where the function is marked as payable despite the fact that msg.value is never utilized within the function. This redundancy could lead to confusion and potential misuse, as it implies the function can handle Ether transfers when it does not.

Vulnerability Details

Location: createTradingAccountAndMulticall function

Code Snippet:

function createTradingAccountAndMulticall(
bytes[] calldata data,
bytes memory referralCode,
bool isCustomReferralCode
)
external
payable
virtual
returns (bytes[] memory results)
{

Issue: The function is declared as payable, allowing it to receive Ether, but msg.value is never used within the function body. This makes the payable keyword redundant and potentially misleading.

Explanation: Functions marked as payable suggest that they are intended to handle Ether transfers. However, since msg.value is not used or needed in this function, marking it as payable serves no purpose and could confuse developers or users interacting with the contract.

Impact

Confusion: Developers or users may be misled into thinking that Ether transfers are necessary or utilized in this function, leading to confusion and potential misuse.

Gas Costs: Unnecessary use of the payable keyword can lead to slight increases in gas costs for transactions, as the EVM has to account for the potential Ether transfer.

Code Clarity: Redundant code reduces overall code clarity and maintainability, making it harder to understand the contract's intended behavior.

Tools Used

Manual Code Review: In-depth review of the createTradingAccountAndMulticall function to identify unnecessary or redundant elements.

Recommendations

Remove payable Keyword: Modify the function signature to remove the payable keyword, ensuring it accurately reflects the function's behavior:

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

`createTradingAccountAndMulticall` shouldn't be payable

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.