0

Trying to validate a Smart Contract but keep getting ByteCode error as Etherscan can't match the correct one.

In Solidity everything works perfect but unable to validate in Etherscan.

Contract address: 0xa788612af215b661ed064895b34fcb620866c377

Error message:

Compiler debug log:
Error! Unable to generate Contract ByteCode and ABI
Found the following ContractName(s) in source code : Address, Cloudy, Context, ERC1155, ERC1155Supply, ERC165, IERC1155, IERC1155MetadataURI, IERC1155Receiver, IERC165, Math, Ownable, Strings

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

import "@openzeppelin/contracts@4.8.2/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts@4.8.2/access/Ownable.sol";
import "@openzeppelin/contracts@4.8.2/token/ERC1155/extensions/ERC1155Supply.sol";
import "@openzeppelin/contracts/utils/Strings.sol";



contract Cloudy is ERC1155, Ownable, ERC1155Supply {

    uint256 constant SleepyPinkDragon = 1;
    uint256 constant ThickCloud = 2;
    uint256 constant BlackHairPelicanCloud = 3;
    uint256 constant Superhuman = 4;
    uint256 constant Rattle = 5;

    mapping (uint256 => string) private _uris;

    constructor() ERC1155("https://arweave.net/sJa3zzrBzb2ejG_96_dzv_Jt9IdTdLNMbquxwa0Q/clo.json")
    {
        
     _mint(msg.sender, SleepyPinkDragon, 22, "");
     _mint(msg.sender, ThickCloud, 5, "");
     _mint(msg.sender, BlackHairPelicanCloud, 5, "");
     _mint(msg.sender, Superhuman, 3, "");
     _mint(msg.sender, Rattle, 3, "");
    }


  function uri(uint256 _tokenId) override public pure returns (string memory) {
        return string(abi.encodePacked("https://arweave.net/sJa3zzrBzb2ejG_96_dzv_Jt9IdTdLNMbquxwa0Q/clo", Strings.toString(_tokenId),".json"));
    }


    function setURI(string memory newuri) external onlyOwner {
        _setURI(newuri);
    }


    function mint(address account, uint256 id, uint256 amount, bytes memory data)
        public
        onlyOwner
    {
        _mint(account, id, amount, data);
    }

    function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data)
        public
        onlyOwner
    {
        _mintBatch(to, ids, amounts, data);
    }

    // The following functions are overrides required by Solidity.

    function _beforeTokenTransfer(address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data)
        internal
        override(ERC1155, ERC1155Supply)
    {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
    }
}

I used the Solidity flattener and copy and paste everything in the Etherscan Verify and Publish option. Still getting that Bytecode unable to match error.

example: I get a very long binary number

ByteCode (what we are looking for):
60806040523480156200001157600080fd5b506040518060800160405280604881526020016...etc
Dank1212
  • 1
  • 3

1 Answers1

0

The error Error! Unable to generate Contract ByteCode and ABI generally indicates that your submitted source code does not match the one generated on chain.

This is typically due to having different Solidity compiler settings on Etherscan vs when you deployed it, such as Solidity version, optimisation runs.

Would you be able to double check on your compiler settings if they match ?

  • Thanks I wanted to add to your point using the CONTRACT VERIFICATION - ETHERSCAN I can't seem to input a Selected Network it shows (VM NOT Support) this might be the main problem in allowing me to verify these Smart Contract. Thoughts.... – Dank1212 Jul 28 '23 at 22:52