We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TransferHelper
Github username: -- Twitter username: -- Submission hash (on-chain): 0x813181e42fd163f8e690aaf146d9cddfc36d53fcbcb68173accb75c6b00fce87 Severity: medium
Description: The safeTransferFrom() function used to transfer erc20 tokens
safeTransferFrom()
function safeTransferFrom( address token, address from, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF'); }
but the issue is this will not work with USDT because as we know USDT not implemented fully erc20 standard and it doesnt return bool.
USDT
therefor if protocol wanted to support USDT tokens in future, users will not be able to use it because all swaps will revert due to this issue.
POC please run this POC
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; import {Test, console} from "forge-std/Test.sol"; interface IERC20{ function transferFrom(address from, address to, uint256 value) external returns (bool); function balanceOf(address account) external view returns (uint256); } contract TransferTest is Test { IERC20 public usdt; function setUp() public { usdt = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF'); } function test_poc() public{ deal(address(usdt), address(this), 100e6); deal(address(usdt), address(msg.sender), 0); console.log(usdt.balanceOf(address(this))); safeTransferFrom(address(usdt), address(this), msg.sender, 100e6); console.log(usdt.balanceOf(address(this))); console.log(usdt.balanceOf(address(msg.sender))); } }
Recommendation to prevent this issue consider using OZ safeTransferFrom() and safeTransfer()
safeTransfer()
The text was updated successfully, but these errors were encountered:
There's no issue with the Oasis USDT contract
Sorry, something went wrong.
No branches or pull requests
Github username: --
Twitter username: --
Submission hash (on-chain): 0x813181e42fd163f8e690aaf146d9cddfc36d53fcbcb68173accb75c6b00fce87
Severity: medium
Description:
The
safeTransferFrom()
function used to transfer erc20 tokensbut the issue is this will not work with
USDT
because as we know USDT not implemented fully erc20 standard and it doesnt return bool.therefor if protocol wanted to support USDT tokens in future, users will not be able to use it because all swaps will revert due to this issue.
POC
please run this POC
Recommendation
to prevent this issue consider using OZ
safeTransferFrom()
andsafeTransfer()
The text was updated successfully, but these errors were encountered: