Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: medium
Valid

Wrapper native token can't be used as collateral token

Summary

According to README.md, the protocol should support all ERC20 standard token, but in current implementation, the protocol can't support wrapper native token

Vulnerability Details

According to TokenManager.sol#L79-L91, if the token is wrapped native token, the function check if msg.value > _amount, which means that if TokenManager.tillIn is called with wrapped native token, the caller has to send native token

56 function tillIn(
57 address _accountAddress,
58 address _tokenAddress,
59 uint256 _amount,
60 bool _isPointToken
61 )
62 external
63 payable
64 onlyRelatedContracts(tadleFactory, _msgSender())
65 onlyInTokenWhiteList(_isPointToken, _tokenAddress)
66 {
...
79 if (_tokenAddress == wrappedNativeToken) {
80 /**
81 * @dev token is native token
82 * @notice check msg value
83 * @dev if msg value is less than _amount, revert
84 * @dev wrap native token and transfer to capital pool
85 */
86 if (msg.value < _amount) { <<< --- because this check, the user has to use native token instead of wrapped native token
87 revert Errors.NotEnoughMsgValue(msg.value, _amount);
88 }
89 IWrappedNativeToken(wrappedNativeToken).deposit{value: _amount}();
90 _safe_transfer(wrappedNativeToken, capitalPoolAddr, _amount);
91 } else {
...
103 }

Impact

the protocol can't support wrapper native token

Tools Used

Recommendations

Updates

Lead Judging Commences

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

finding-TokenManager-tillin-wrapper-inconsistent

Valid medium severity, given it is noted in contest READ.ME that any standard ERC20 tokens should be supported. Although arguably could be low severity, given users can simply unwrap WETH to native ETH and perform the deposits via `tillIn()`, I will leave open for discussions, but taking READ.ME as the source of truth, I believe medium severity is appropriate, given it is explicitly noted that this token should be compatible#9##. The fix would be to utilize a zero address or equivalent to represent native ETH when wrapping to WETH. > Tokens: - ETH - WETH - ERC20 (any token that follows the ERC20 standard)

Support

FAQs

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