Cannot verify my ERC721URIStorage contract using brownie

Hi guys. I have a problem with my contract which inherits the openzeppelin ERC721URIStorage contract.
I just cannot verify it using brownie even if i have all the variables in place (etherscan api key and the infuria project id).
Note that i am able to verify other contracts.

The solidity code is the following:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract JonaNFT is ERC721URIStorage {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;
    uint256 private nftLimit = 4;

    constructor() ERC721("JonaNFT", "JNA") {}

    function mintJonaNft(string memory tokenURI) public returns (uint256) {
        require(_tokenIds.current() < 4, "All NFT minted");
        uint256 newItemId = _tokenIds.current();
        _mint(msg.sender, newItemId);
        _setTokenURI(newItemId, tokenURI);
        return newItemId;

the verify python code is:

from brownie import JonaNFT, network, config
from scripts.helpful_scripts import get_account
from web3 import Web3

tokenId_to_metadata = {
    "0": "",
    "1": "",
    "2": "",
    "3": "",

def deploy():
    account = get_account()
    jonaNFT = JonaNFT.deploy({"from": account})

def createAllNft():
    account = get_account()
    for index in range(0, 4, 1):
        creating_tx = JonaNFT[-1].mintJonaNft(
            tokenId_to_metadata[f"{index}"], {"from": account}
        print("New token has been created!")

def createSingeNft(toeknId):
    account = get_account()
    creating_tx = JonaNFT[-1].mintJonaNft(
        tokenId_to_metadata[f"{toeknId}"], {"from": account}
    print("New token has been created!")

def printNftInfo(tokenId):

def main():
    # deploy()
    # createAllNft()
    # createSingeNft(0)
    # printNftInfo(0)

The error i recive is:

Running 'scripts\'...
  File "C:\Users\andre\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\brownie\_cli\", line 49, in main
    return_value, frame = run(
  File "C:\Users\andre\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\brownie\project\", line 103, in run
    return_value = f_locals[method_name](*args, **kwargs)
  File ".\scripts\", line 47, in main
  File "C:\Users\andre\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\brownie\network\", line 410, in publish_source
    contract_info = self.get_verification_info()
  File "C:\Users\andre\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\brownie\network\", line 315, in get_verification_info
    build_json = self._project._build.get(name)
  File "C:\Users\andre\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\brownie\project\", line 124, in get
    return self._interfaces[key]
KeyError: 'OpenZeppelin/openzeppelin-contracts@4.6.0/Address'
1 Like

Sorry @Squallaz, I'm not very familiar with Brownie so I don't know what could be going wrong here.

Hello, I am having the same issue. @Squallaz by any chance did you get this resolved ? publish_source when implementing ERC721URIStorage or ERC721 using the latest Zeppelin Contracts version (4.6.0) is no longer working. This was working under 4.3.x. @frangio could this be related to a dependency for Address class that has moved to a different path with the latest version ?

Edit @Squallaz I found a similar post / thread interesting here :

Hello @Squallaz @frangio
I have resolved the issue for me and i posted the step to step solution here :

Basically your need brownie 1.18.1 to be able to deploy OpenZepplin v4.6.0. The issue for most of the people is that we are running on python 3.10 which doesn't allow to upgrade from brownie v.1.16.4 to higher. Hence you need to downgrade python from 3.10 to 3.9.12 , ensure your path are up to date with new python bin folder, uninstall brownie and reinstall brownie from pip install command.

The night was long :stuck_out_tongue:
Hope it helps :blush:

1 Like

Thank you dude! I'll try your soulution asap! :smiley: