我把WETH打进合约地址里面,怎么通过代码怎么把合约地址里面的WETH转换成ETH提取到钱包地址里面呢?
我是这样弄的,定义了一个IWETH接口
interface IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function withdraw(uint256 value) external payable;
}
然后在函数利用转出ETH
function withdraw(uint256 value) public payable returns(uint) {
IWETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2).withdraw(value);