interface IERC20 {
function transfer(address recipient, uint256 amount) external;
function balanceOf(address account) external view returns (uint256);
function transferFrom(address sender, address recipient, uint256 amount) external ;
function decimals() external view returns (uint8);
function approve(address spender, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
}
contract MyContract {
IERC20 JY;
constructor(IERC20 _jy) public {
JY = _jy;
}
function approve(uint256 _amount)external{
JY.approve(address(this),_amount);
}
function transferF(uint _amount) external {
JY.transferFrom(msg.sender,address(this), _amount);
}
}
授权之后接收代币总是失败