In the TokenManager.sol contract, specifically within the tillIn function, there is a vulnerability where native tokens can become stuck. The issue arises because of the way refunds are handled. The contract only allows full refunds of the msg.value if an error occurs. However, if the transfer is successful but does not require the full msg.value, the remaining tokens will become stuck in the contract, leading to a potential loss of funds for the user.
Two scenarios are identified:
On Error: If an error occurs, the full msg.value is refunded to a specified refund address.
On Success: If the transfer is successful, only a portion of msg.value (equal to _amount) is used for sending native tokens, and the remaining value is not refunded, becoming stuck in the contract.
This partial refund behavior is not what users typically expect, as they might assume that any excess funds would be automatically returned to them.
src/core/TokenManager.sol:tillIn_L89-L90
Native tokens that are not required for the transfer can become permanently stuck in the TokenManager.sol contract, leading to potential financial losses for users.
Manual Review
To avoid this issue, modify the tillIn method to ensure that any remaining value after the required amount is deducted is refunded to the user, preventing tokens from becoming stuck.
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.