The TokenManager::tillIn function is marked as payable, allowing it to receive Ether. However, when the function is called with a non-native token address (i.e., an ERC20 token address that is not the wrappedNativeToken), any Ether sent with the transaction is not used or returned.
This Ether becomes permanently locked in the TokenManager contract, leading to a loss of funds for users.
The root cause is that the tillIn function only handles the msg.value when the token address matches the wrappedNativeToken. For all other token addresses, it ignores any Ether sent with the transaction.
Consider the following scenario based on the provided test:
A taker wants to create a taker position for an ERC20 token (MockedUSDC in this case).
The taker accidentally sends 1 Ether along with the createTaker transaction.
The createTaker function calls TokenManager::tillIn .
Since MockedUSDC is not the wrappedNativeToken, the Ether is ignored and becomes locked in the contract.
In this scenario, the taker loses 1 Ether, which becomes permanently locked in the TokenManager contract.
Users can permanently lose Ether by accidentally sending it when interacting with ERC20 tokens through functions that call tillIn , for example createTaker
This could lead to significant financial losses, especially if high-value transactions are involved.
Manual Review - Testing
Modify the TokenManager::tillIn function to revert if Ether is sent with a non-native token transaction:
This change will prevent users from accidentally sending Ether when interacting with ERC20 tokens, thus avoiding the potential for locked funds.
Invalid, these are by default, invalid based on codehawks [general guidelines](https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity#findings-that-may-be-invalid). The check implemented is simply a sufficiency check, it is users responsibility to only send an appropriate amount of native tokens where amount == msg.value when native token is intended to be used as collateral (which will subsequently be deposited as wrapped token). All excess ETH can be rescued using the `Rescuable.sol` contract. > Users sending ETH/native tokens > If contracts allow users to send tokens acc111identally.
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.