loom-js
loom-js copied to clipboard
Cannot execute ethers.js contract method without specifying optional transaction overrides argument
Description
When I try to run EthereumGatewayV2.withdrawAsync
method without providing overrides
argument (which is marked as optional in loom-js
code) it throws this error:
Error: incorrect number of arguments
at Object.withdrawETH (node_modules/loom-js/node_modules/ethers/contract.js:130:19)
at EthereumGatewayV2.<anonymous> (node_modules/loom-js/dist/ethereum-gateways.js:78:66)
at step (node_modules/tslib/tslib.js:136:27)
at Object.next (node_modules/tslib/tslib.js:117:57)
at fulfilled (node_modules/tslib/tslib.js:107:62)
at process._tickCallback (internal/process/next_tick.js:68:7)
When I pass an overrides
object with a gasLimit
property specified, everything works fine. At least, this argument have to be marked as required in withdrawAsync
function signature.
Versions
- ethers:
4.0.38
- loom-js:
1.70.0
I also want to note that this issue can also appear in other loom-js parts which use ethers.Contract
object to interact with a smart contract. So, I hope that you will test some other code where ethers.Contract
is being used
Which network is it? Ext-dev or plasma?
@redben We use it with extdev and rinkeby
Please provide a snippet of code that can be used to reproduce this error.
Please provide a snippet of code that can be used to reproduce this error.
You can just call EthereumGatewayV2
instance withdrawAsync
method without passing an overrides
object. I think you can fork truffle-dappchain-example repo, remove { gasLimit: gas }
object from this line and run the corresponding CLI subcommand to trigger this function
@enlight Same issue reported by Sorare. They're using ethers 4.0.37 and they tried to call the withdrawAsync
function with a single argument like:
withdrawAsync(receipt)
This resulted in the following error:
incorrect number of arguments
I asked them to pass the gasLimit
as the second argument:
await gatewayContract.withdrawAsync(receipt, { gasLimit: gas })
and this worked.
I don't know if there's an issue with loom-js or ethers though.
@andreipope maybe it's because loom-js doesn't set default gas limit for basechain and ethers just requires developers to explicitly specify it? With ethereum network there's no such issue.
I also can mention that when using our own contracts with ethers.js and loom-js we also need to provide the gas limit. So, in my opinion it's because LoomProvider
instances doesn't have the default gas limit at all and it's quite logical that ethers.js forces developers to provide some gas value to send transactions with.