Hi,

I'm unable to call approve function on a contract (not a getter) with ethers.js on Binance Smart Chain Testnet.


const tokenContract = new ethers.Contract(
addresses.token,
[
// 'function name() external view returns (string)',
'function name() public view virtual returns (string memory)',
'function symbol() external view returns (string)',
'function decimals() external view returns (uint8)',
'function approve(address spender, uint256 amount) public virtual override returns (bool)'
],
account
);

const options = {gasPrice: ethers.utils.parseUnits('100', 'gwei'), gasLimit: 1000000}

const res = await tokenContract.approve(addresses.router, 50, options)

Got different types of errors
* transaction underpriced
* insufficient funds for intrinsic transaction cost

Does anybody have any idea?

Sep 1, 2021, 9:27 PM

© 2024 Draquery.com All rights reserved.