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/[email protected]/token/ERC1155/ERC1155.sol";
import "@openzeppelin/[email protected]/access/Ownable.sol";
import "@openzeppelin/[email protected]/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