-1

I need to transfer USDC Token (Not ETH) using low level .call in solidity. ¿Some idea or example? Thanks.

I can send ETH (native token) using .call method, but i cannot do it with USDC

2 Answers2

0

You can not transfer ERC20 tokens using low level .call. You should use transfer method from USDC contract to do it. Or transferFrom, but before dont forget to increase allowance in this case.

0

You can transfer doing low level calls:

(bool success, ) = address(token).call{value: 0 ether, gas: 90000}(abi.encodeWithSignature("transferFrom(address,address,uint256)", sender, address(this), _tokenAmount));
require(success, "transferfrom of token failed");

(bool success, ) = USDCADDRESS.call{value: 0 ether, gas: 70000}(abi.encodeWithSignature("transfer(address,uint256)", destinationAddress, _tokenAmount));
require(success, "transfer failed");```