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

msg.value is ignored in function createTradingAccountAndMulticall which is payable

Summary

the function createTradingAccountAndMulticall is payable which accepts ether and the msg.value is ignored and not used.

Vulnerability Details

From this function is payable, if a user sends ether when calling this function the ether will forever be stuck in this contract because msg.value has been ignored in this function.

function createTradingAccountAndMulticall(
bytes[] calldata data,
bytes memory referralCode,
bool isCustomReferralCode
)
external
payable
virtual
returns (bytes[] memory results)
{
uint128 tradingAccountId = createTradingAccount(referralCode, isCustomReferralCode);
results = new bytes[](data.length);
for (uint256 i; i < data.length; i++) {
bytes memory dataWithAccountId = bytes.concat(data[i][0:4], abi.encode(tradingAccountId), data[i][4:]);
(bool success, bytes memory result) = address(this).delegatecall(dataWithAccountId);
if (!success) {
uint256 len = result.length;
assembly {
revert(add(result, 0x20), len)
}
}
results[i] = result;
}
}

Impact

Could lead to user funds being stuck in the contract forever.

Tools Used

Manual review

Recommendations

If there is no intention to recieve ether there should be a check for msg.value if not 0 it should revert. this way it prevents users from sending ether to the contract.

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.