I have been trying to verify NFT contract that was deployed on June 28th 2022. The developer who deployed the contract is no longer in contact but I have the source code for it. I tried to verify it using Remix, Hardhat and manually through etherscan but it is failing. I think the openzeppelin contracts that were used during deployment were old version as the contract was deployed an year back almost. I do not know exactly what version of OpenZeppelin contracts were used but I know the compiler was 0.8.7 that was used for deployment.
The mainnet NFT contract
The contract code is as following
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract ElonGoat is ERC721, Ownable, ReentrancyGuard {
using Strings for uint256;
string baseURI;
string public baseExtension = ".json";
uint256 totalSupply;
uint256 currentSupply;
uint256 NFTCost;
constructor(string memory uri) ERC721("EGT", "EGT") {
totalSupply = 628;
currentSupply = 0;
NFTCost = 0.085 ether;
setBaseURI(uri);
}
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
function mint(uint256 amount) public payable {
require(msg.sender != address(0), "ERC721Mint: INVALID_ADDRESS.");
require(
totalSupply >= currentSupply + amount,
"NOT ENOUGH NFTS AVAILABLE TO MINT."
);
if (msg.sender != owner()) {
require(
msg.value >= NFTCost * amount,
"PLEASE SEND THE REQUIRED ETHER AMOUNT."
);
}
for (uint256 i = 0; i < amount; i++) {
_safeMint(msg.sender, currentSupply + 1);
currentSupply++;
}
}
function getTotalSupply() public view returns (uint256 supply) {
return totalSupply;
}
function getCurrentSupply() public view returns (uint256 supply) {
return currentSupply;
}
function tokenURI(
uint256 tokenId
) public view virtual override returns (string memory) {
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory currentBaseURI = _baseURI();
return
bytes(currentBaseURI).length > 0
? string(
abi.encodePacked(
currentBaseURI,
tokenId.toString(),
baseExtension
)
)
: "";
}
function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseURI = _newBaseURI;
}
function setNFTCost(uint256 newNFTCost) public onlyOwner nonReentrant {
NFTCost = newNFTCost;
}
function getBaseURI() public view returns (string memory) {
return baseURI;
}
function getNFTCost() public view returns (uint256) {
return NFTCost;
}
function setBaseExtension(
string memory _newBaseExtension
) public onlyOwner {
baseExtension = _newBaseExtension;
}
function adminIncreaseMaxSupply(
uint16 newMaxSupply
) external onlyOwner nonReentrant {
totalSupply = newMaxSupply;
}
function withdraw() public payable onlyOwner {
(bool success, ) = payable(msg.sender).call{
value: address(this).balance
}("");
require(success);
}
}
Any idea what could I be doing wrong?