Whether erc20 usdt can be sent to a smart contract so the owner will be a contract address, I mean balanceOf[] will use contract address or the contract owner address? If I send the erc20 again from the contract, I can just call the usdt contract function transfer within my contract? Thanks


Any address can be an owner of ERC20 tokens, so a contract is also fine.

The possible problem with contracts owning tokens is that the contract has to have functionality to transfer the tokens onwards (call the token contract). If the contract doesn't have such functionality the tokens are essentially lost/burned as they can never be transferred anywhere.

What you need in your contract is basically:

  1. Write an interface which says what functionality the other contract has

  2. Create a reference to the token contract with the interface and the token contract's address

  3. Call the token contract's functionality within your contract

Something like this:

pragma solidity ^0.7.0;

interface TokenContract {
    function a() external;
    function b() external;

contract RefContract
    function doStuff(address contrAddr) public {
        TokenContract contr = TokenContract(contrAddr);
  • Thanks How to call erc20 usdt contract with a smart contract of my own? I need to use call() or send() with my contract? I think that is web3 function but in solidity how to do this within a smart contract? – Louis Aug 22 '20 at 11:35
  • Hi. Thanks for the comment. I now extended my answer to include reference implementation. – Lauri Peltonen Aug 22 '20 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.