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:
0x07efcfe49b1fc21ec63ee120a862032888e7b361
v0.8.4
Enabled Optimization
200 runs
This error also appears, but I already solved it: https://forum.openzeppelin.com/t/error-invalid-constructor-arguments-provided-please-verify-that-they-are-in-abi-encoded-format
// 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 =
"https://x.ipfs.nftstorage.link";
mapping(address => bool) private mappingAuth;
constructor() ERC721("ERC1155", "ERC1155") {}
modifier onlyAuth() {
require(_msgSender() == owner() || mappingAuth[_msgSender()], "No authorized");
_;
}
function pause() public onlyOwner {
_pause();
}
function unpause() public onlyOwner {
_unpause();
}
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();
_tokenIdCounter.increment();
_safeMint(to, tokenId);
_setTokenURI(tokenId, uri);
}
function safeMinter(address to) public onlyOwner {
safeMint(to,uriString);
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
whenNotPaused
override(ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
// The following functions are overrides required by Solidity.
function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
super._burn(tokenId);
}
function tokenURI(uint256 tokenId)
public
view
override(ERC721, ERC721URIStorage)
returns (string memory)
{
return super.tokenURI(tokenId);
}
function supportsInterface(bytes4 interfaceId)
public
view
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)) {
safeMint(addresses[i],uriString);
}
}
function setMappingAuth(address account, bool boolean) external onlyOwner {
mappingAuth[account] = boolean;
}
function setUriString(string memory _uriString) external onlyAuth {
uriString = _uriString;
}
}