How to transfer Tether received in a contract to a specific address safely using OpenZeppelin Contracts?

:computer: Environment


I am new to openZeppelin contracts and maybe I need to use some of contracts to implement safe transfer of tether token in my smart contract. In my case someone with EOA account having tether should be able to transfer tether to a specific address not contract address. As I know from here

USDT approve doesn’t comply with the ERC20 standard.

so how can I safely transfer tether in a function call in my smart contract? Is there any special contract needed from openzeppelin to do it safely?

Thank you.
:1234: Code to reproduce

1 Like

Hi @kourosh,

Welcome to the community :wave:

I suggesting looking at using SafeERC20 when interacting with non-standard ERC20 tokens:

Wrappers around ERC20 operations that throw on failure (when the token contract returns false). Tokens that return no value (and instead revert or throw on failure) are also supported, non-reverting calls are assumed to be successful. To use this library you can add a using SafeERC20 for IERC20; statement to your contract, which allows you to call the safe operations as token.safeTransfer(…​) , etc.

1 Like