1

Trying to verify contract 0x0568a87e64e65f4cc7898e08f0e57ffe2aa6241f, compiler 0.8.7 with source code

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

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract NFT is ERC721,Ownable {
    using Counters for Counters.Counter;
    Counters.Counter private currentTokenId;
    /// @dev Base token URI used as a prefix by tokenURI().
    string public baseTokenURI;
    uint256 maxNftAmount;
    constructor() ERC721("My Breathtaking Pixel Bois", "BOI") {
      baseTokenURI = "QmdjAPjtUTVGfPKumoUqMnsvDER28hcwB3jMAUgFaiGRQk/";
       maxNftAmount = 888;
    }
    
    function contractURI() public pure returns (string memory) {
       return "QmdzNse3GwYaDBxshS1jnBXAFqX3hepJtBBBQxEutn1Ave";
    }

    function mintFree()
        public
        returns (uint256)
    {
        require(currentTokenId.current() < maxNftAmount);
        require(balanceOf(address(msg.sender)) < 2);
        currentTokenId.increment();
        uint256 newItemId = currentTokenId.current();
        _safeMint(address(msg.sender), newItemId);
        return newItemId;
    }
  
    /// @dev Returns an URI for a given token ID
  function _baseURI() internal view virtual override returns (string memory) {
    return baseTokenURI;
  }

  /// @dev Sets the base token URI prefix.
  function setBaseTokenURI(string memory _baseTokenURI) public onlyOwner {
    baseTokenURI = _baseTokenURI;
  }

  function changeMaxMint(uint256 _maxAmount)public onlyOwner {
    maxNftAmount = _maxAmount;
  }

  function totalMinted() public view returns (uint) {
        return currentTokenId.current();
    }

}

Have tried flattening code and verifying it on ether scan but get error about wrong constructor ABI (516d646a41506a745554564766504b756d6f55714d6e7376444552323868637742336a4d4155674661694752516b2f) Error! Invalid constructor arguments provided. Please verify that they are in ABI-encoded format , have tried to grab bigger constructor ABI from byte code but still get error Error! Unable to generate Contract ByteCode and ABI (even tho the bytecode its looking for is the same as nft bytecode)

Other abi I used : 0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b612fc3816128bf565b8114612fce57600080fd5b50565b612fda816128d1565b8114612fe557600080fd5b50565b612ff1816128dd565b8114612ffc57600080fd5b50565b61300881612929565b811461301357600080fd5b5056fe516d647a4e73653347775961444278736853316a6e425841467158336865704a7442424251784575746e31417665a2646970667358221220b8fcb9769944ddfa092a397452a6c6daa97f00d18c4359521e96e32522374f1964736f6c63430008070033516d646a41506a745554564766504b756d6f55714d6e7376444552323868637742336a4d4155674661694752516b2f Also dont know why but cant generate abi on https://abi.hashex.org/ - it just stays blank when trying to parse. Any help greatly appreciated!

1
  • How did you deploy the contract? You should use the same settings (e.g: compiler optimization) to verify the contract. Aug 30 at 5:14

1 Answer 1

0

I tried to deploy your contract and verify it myself and it worked.. https://rinkeby.etherscan.io/address/0x09fCA943D2E8c9990f2a12617f58186De4ab4649#code Did you use hardhat to verify it ?

2
  • no Im just trying to verify it old school through etherscan form, can you please specify what abi constructor did you use, or hardhat does it automaticly ?
    – klauf
    Aug 30 at 13:46
  • once it is deployed, hardhat will do it automatically, no need to specify the abi
    – GiorgioDG
    Aug 30 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.