【发布时间】:2022-01-14 19:56:40
【问题描述】:
我想在批准合同后估算Gas:
WETH = weth.address;
USDC = usdc.address;
await usdc.approve(addr1, addr2).estimateGas;
当我尝试这个时,我遇到了这个错误:
TypeError: usdt.approve(...).estimateGas is not a function
【问题讨论】:
我想在批准合同后估算Gas:
WETH = weth.address;
USDC = usdc.address;
await usdc.approve(addr1, addr2).estimateGas;
当我尝试这个时,我遇到了这个错误:
TypeError: usdt.approve(...).estimateGas is not a function
【问题讨论】:
Truffle 使用不同的语法。您需要将函数参数传递给estimateGas(),而不是approve() 函数。
await usdc.approve.estimateGas(addr1, addr2);
注意:您的代码定义了usdc,然后错误消息指出usdt。我假设这只是创建问题时的拼写错误,与原始问题无关。
【讨论】: