我需要使用可靠的.call传输USDT令牌(而不是ETH)。什么主意?谢谢。
发布于 2022-12-09 07:45:35
我不知道您为什么要使用.call(),但是.send().anyway这里是供您参考的代码:
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();
}
}https://ethereum.stackexchange.com/questions/140840
复制相似问题