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.

Key Error when deploying OpenZeppelin Contract with Etherscan verification ON

See original GitHub issue

Environment information

  • brownie Version: 1.16.4
  • ganache-cli Version: 6.12.2
  • solc Version: 0.8.2
  • Python Version: 3.9.5
  • OS: win

What was wrong?

Using OpenZeppelin@4.3.2 a simple ERC721 will deploy but verification by Etherscan will not occur due to KeyError

Code nft = MyNFT.deploy({‘from’:dev},publish_source=True)

Error

nft = MyNFT.deploy({‘from’:dev},publish_source=True) Transaction sent: 0x1da78e781c6bf817864d4c0c7769ce76111bc595d5774593ee947d0b1315477d Gas price: 1.000000008 gwei Gas limit: 1859082 Nonce: 13 MyNFT.constructor confirmed Block: 9333994 Gas used: 1690075 (90.91%) MyNFT deployed at: 0x072097bb99103EE2d99a92ef98D9ca49c6b33f3d

File “<console>”, line 1, in <module> File "d:\program, line line, in in return tx[“from”].deploy( File "d:\program, line line, in in contract.publish_source(deployed_contract, silent=silent) File "d:\program, line line, in in contract_info = self.get_verification_info() File "d:\program, line line, in in build_json = self._project._build.get(name) File "d:\program, line line, in in return self._interfaces[key] KeyError: ‘OpenZeppelin/openzeppelin-contracts@4.3.2/Address’

How can it be fixed?

Brownie may be loading interfaces with wrong key and it fails when it is iterated to flatten files

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

3reactions
jpez16commented, Oct 17, 2021

Looks as if it was fixed in 1.17. https://github.com/eth-brownie/brownie/pull/1283

3reactions
ImportNNcommented, Oct 3, 2021

Same problem here!

If you compile your contract with 0.8.0 solidity version, the error goes away. I believe there is something wrong with the 0.8.n versions. Not the best solution but if you are in a hurry, that should solve it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error verifying on Etherscan: Unable to generate Contract ...
Hi all, I have been writing my ERC20 contract on remix sol.0.5.0. Finally the coin is deployable but I cant verify it on...
Read more >
Issue publishing and verifying contracts to Etherscan with ...
I'm trying to publish a contract to Rinkeby etherscan. ... Error after I receive the deployment receipt and address:
Read more >
Incorrect error message when verifying a regular instance ...
Within the same project, if the same contract is first deployed as upgradeable and verified, and then deployed as regular, running verify on...
Read more >
Error in plugin @nomiclabs/hardhat-etherscan: The contract ...
Basically, deploy via Remix and verify through Hardhat. Because I'm using libraries, ... The degen way of pasting every Open Zeppelin file.
Read more >
How to Create and Deploy an Upgradeable Smart Contract ...
1. One hard rule about developing on the blockchain is that any smart contracts that are deployed cannot... 2. We will need a...
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