Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot execute ethers.js contract method without specifying optional transaction overrides argument #322

Open
rjkz808 opened this issue Oct 23, 2019 · 8 comments

Comments

@rjkz808
Copy link

rjkz808 commented Oct 23, 2019

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
@rjkz808
Copy link
Author

rjkz808 commented Oct 23, 2019

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

@redben
Copy link
Contributor

redben commented Oct 23, 2019

Which network is it? Ext-dev or plasma?

@rjkz808
Copy link
Author

rjkz808 commented Oct 23, 2019

@redben We use it with extdev and rinkeby

@enlight
Copy link
Contributor

enlight commented Oct 24, 2019

Please provide a snippet of code that can be used to reproduce this error.

@rjkz808
Copy link
Author

rjkz808 commented Oct 24, 2019

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

@andreipope
Copy link
Contributor

@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.

@rjkz808
Copy link
Author

rjkz808 commented Dec 7, 2019

@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.

@rjkz808
Copy link
Author

rjkz808 commented Dec 7, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants