1

I need to transfer USDT Token (Not ETH) using .call with solidity. ¿Some idea? Thanks.

3
  • 1
    USDT is transferred by calling the transfer function on the USDT contract. To avoid accidentally black-holing it, better to call the approve function and then the receiving contract calls transferFrom. Commented Dec 8, 2022 at 14:48
  • Thanks, but I don't know how I could do it using the low level function .call or .delegatecall?
    – Maurice
    Commented Dec 8, 2022 at 16:31
  • 1
    then you are basically asking how to call any function with call - it's not like those functions are special Commented Dec 9, 2022 at 17:53

1 Answer 1

0

I dont know why do you want to use .call() but .send().anyway here is the code for your reference:

pragma solidity ^0.5.0;

import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";

contract MyContract {
    // The contract address of the USDT token
    address usdtContractAddress = "0xdAC17F958D2ee523a2206206994597C13D831ec7";
    
    function transferUSDT(address _to, uint256 _value) public {
        // Call the transfer function on the USDT contract
        IERC20(usdtContractAddress).transfer(_to, _value).call();
    }
}

1
  • The code as it is doesn't compile.
    – Ismael
    Commented Dec 9, 2022 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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