The function receiveMarketFee calls IERC20(asset).safeTransferFrom(msg.sender, address(this), amount);
to transfer tokens from msg.sender
to the contract. However, it does not check if the sender has approved enough tokens before making the transfer call. If the sender has not approved the required amount, the transaction will revert, which could disrupt the intended operation.
If the msg.sender
has not approved enough tokens, the transaction will fail with a standard ERC-20 "transfer amount exceeds allowance" error.
Users may not understand why their transaction failed since the function does not explicitly check and revert with a clear error message.
Since the approval check is not done before calling safeTransferFrom, if the transaction fails, the sender still loses gas fees.
In a critical function repeated failures could disrupt operations, causing a Denial of Service (DoS).
It is advisable to add explicit validation using IERC20(asset).allowance(msg.sender, address(this))
.
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.