BSC SCAN is unable to verify contract code

When I try to verify the code below, the following error appears:

Compiler debug log:
Error! Unable to generate Contract ByteCode and ABI (General Exception, unable to get compiled [bytecode])

Contract address:
Enabled Optimization
200 runs

This error also appears, but I already solved it:

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts@4.7.3/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts@4.7.3/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts@4.7.3/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts@4.7.3/security/Pausable.sol";
import "@openzeppelin/contracts@4.7.3/access/Ownable.sol";
import "@openzeppelin/contracts@4.7.3/utils/Counters.sol";

contract ERC1155_nft is ERC721, ERC721Enumerable, ERC721URIStorage, Pausable, Ownable {
    using Counters for Counters.Counter;

    Counters.Counter private _tokenIdCounter;
    uint256 MAX_SUPPLY = 200;
    string uriString = 

    mapping(address => bool) private mappingAuth;

    constructor() ERC721("ERC1155", "ERC1155") {}

    modifier onlyAuth() {
        require(_msgSender() == owner() || mappingAuth[_msgSender()], "No authorized");

    function pause() public onlyOwner {

    function unpause() public onlyOwner {

    function safeMint(address to, string memory uri) public onlyOwner {
        require(_tokenIdCounter.current() <= MAX_SUPPLY, "I'm sorry we reached the cap");
        uint256 tokenId = _tokenIdCounter.current();
        _safeMint(to, tokenId);
        _setTokenURI(tokenId, uri);

    function safeMinter(address to) public onlyOwner {

    function _beforeTokenTransfer(address from, address to, uint256 tokenId)
        override(ERC721, ERC721Enumerable)
        super._beforeTokenTransfer(from, to, tokenId);

    // The following functions are overrides required by Solidity.
    function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {

    function tokenURI(uint256 tokenId)
        override(ERC721, ERC721URIStorage)
        returns (string memory)
        return super.tokenURI(tokenId);

    function supportsInterface(bytes4 interfaceId)
        override(ERC721, ERC721Enumerable)
        returns (bool)
        return super.supportsInterface(interfaceId);

    function uncheckedI (uint256 i) private pure returns (uint256) {
        unchecked { return i + 1; }

    function airdropRayonsNFT (
        address[] memory addresses) external onlyAuth {
        for (uint i = 0; i < addresses.length; i = uncheckedI(i)) {  

    function setMappingAuth(address account, bool boolean) external onlyOwner {
        mappingAuth[account] = boolean;

    function setUriString(string memory _uriString) external onlyAuth {
        uriString = _uriString;
1 Like

Goto plugins and activate flattener on remix. then, click on flattener to copy all of the files, then proceed to bscscan. if you need any guide, you can check my profile, @Boluwatife_Adegbola

1 Like

Thanks for your help. I tried it now and managed to verify the code.

The Etherscan plugin didn't work on my remix. "Invalid network" appears.

The flattener worked. He created a single file code. I had tried to do that, but the imports have too many other imports. It looks like the flattener checks what is needed and only imports what the contract actually uses.

Another detail: BSCSCAN always shows the constructor argument error for ERC1155 and ERC721 contracts, I don't understand why. It only works when we remove the argument they autocomplete.

Thank you very much.

1 Like

It should not result in error. you may need to use a tool to convert the constructor argument to a 0x options. Can't remember the name right now.

1 Like

Someone please help, tried everything couldn't verify this: