question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

V5 Beta, Overrides for Contract transactions not working

See original GitHub issue

I’m using the Ethersjs ^5.0.0-beta.188, and wondering if this is something I’m doing wrong, or what. The code worked previously when using V4, so not sure what I’ve done differently.

...
  const overrides = {
    gasLimit: estimatedGas,
    gasPrice,
    value: ethers.utils.parseEther("0"),
  }

try {
 const methodResult = await method(...methodParams, overrides)
} catch...

Gives the following error:

{
  "reason": "contract method is not payable",
  "code": "INVALID_ARGUMENT",
  "argument": "sendTransaction:shouldNotRevert(string)",
  "value": {
    "gasLimit": {
      "_hex": "0xa906",
      "_isBigNumber": true
    },
    "gasPrice": {
      "_hex": "0x3b9aca00",
      "_isBigNumber": true
    },
    "value": {
      "_hex": "0x00",
      "_isBigNumber": true
    },
    "to": {},
    "data": "0xd87f6dac00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004706c706c00000000000000000000000000000000000000000000000000000000"
  }
}

The argument I am passing is is a normal string. (It is not the string value listed as the argument) It is true this function method is not payable, but I am also not sending any value to it. (Value is 0). Additionally I think there might be a bug because the argument is listed as the function selector itself, which doesn’t make sense to me.

Thoughts?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
crazyrabbitLTCcommented, May 30, 2020

Seems to work! Thank you!

1reaction
ricmoocommented, May 30, 2020

This should be fixed in 5.0.0-beta.189. Please try it out and let me know if you are still having problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ethers-io/Lobby - Gitter
The docs for contract methods have [, overrides ] but I don't see where that is defined anywhere. https://docs.ethers.io/v5/api/contract/contract/#Contract- ...
Read more >
Access to inherited variable in solidity to overwrite it
The _setBaseURI() function alone can be overridden because it's visible from your contract. Private functions and state variables are only ...
Read more >
web3.eth API — Web3.py 5.31.3 documentation - Read the Docs
The parameter values will override the pending transaction's values to create the replacement transaction to send. The same validation and defaulting rules of ......
Read more >
How to Build a Full Stack NFT Marketplace - V2 (2022)
Was having the same problem and going crazy, my code was exactly like the ... This causes the NFT contract to not approve...
Read more >
Compile contracts - Truffle Suite
If you'd like to override this behavior, run the above command with the --all ... You should not edit these files as they'll...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found