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.

Incorrect Throw Error `cannot have constant payable function` due to Vyper ABI output

See original GitHub issue

When initializing contracts using `new ethers.Contract(address, abi, provider) I occasionally get the following error.

cannot have constant payable function

However this seems to be incorrect, because both values are set to false and the reason why this throws is due to the lack of stateMutability: 'nonpayable' in the function ABI.

Using the ABI from the uniswap_factory.json file, which can be found at https://github.com/Uniswap/uniswap-v1/tree/master/abi you will notice the ABI has both the constant and payable set too false for the initializeFactory and createExchange functions, but is missing the stateMutability: 'nonpayable' entry.

I’ve run vyper -f abi contracts/uniswap_factory.vy to ensure the output as the same as the saved uniswap_factory.json - it was.

Is there a way to support Vyper compiled contracts in the verifyState function without breaking expected functionality?

Or should I leave a ticket on the Vyper repo?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ricmoocommented, Apr 5, 2020

Awesome! 😃

I’ve also (on my local machine) updated the Fragments file to use the proper ethers logger, so this should be easier to catch in the future (since the error would include the ethers version).

Thanks! 😃

1reaction
kamescgcommented, Apr 5, 2020

Woops… sorry about that. It was that silly yarn.lock file that got me.

Working now!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vyper Documentation
method will throw an error and revert the transaction. If the two assert statements and the check that the previous bid.
Read more >
Vyper and ethereum: how do I read a public constant function ...
I'd like to call a constant function on one contract (X) from another contract (Y). I have the ABI and address for X....
Read more >
Chapter 7: Smart Contracts and Solidity · GitBook
A function description is a JSON object with fields type , name , inputs , outputs , constant , and payable . An...
Read more >
Interface - Ethers.js
Create a new Interface from a JSON string or object representing abi. ... which is payable "function mint(uint amount) payable", // Constant method...
Read more >
What is an ABI? explained - step-by-step beginners guides
Smart contracts written in high-level languages like Solidity or Vyper need to be compiled in EVM executable bytecode; when a smart contract is...
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