Cannot Verify Smart Contract -- Tried Flattening


I'm trying to help a friend verify their smart contract. It originally had some github references for the imports for OZ. I took the contract, replaced the github links in Truffle, flattened it, and removed the extraeneous LIcense calls. However I still cannot verify the contract. I've tried every single combination of compilers 0.8.0 and higher, optimzed and unoptimized, and still can't get it to work. Anything else I can do here?

Live Contract:

Flattened Solidity Contract:


this is the contract verified in the test network make change in the constructors I hope I have helped you

Hi thanks, sorry, I'm not quite following. What do you mean make change in the constructors?

modify them to not pass parameters, but declare directly to the variable, you can check the constructors so that you realize the change

I do not have a problem relaunching and verifying on rinkeby, the problem I'm having is trying to figure out how to verify a contract that was previously not flattened and had github references for OZ imports. Even when I don't pass parameters, I cannot verify it on the main net.

I modified the contract you published, to be deployed in the main network, there is currently a problem with the verification, if you pass parameters to inherited constructors

If it were a different network and not expensive ethereum network, I will gladly help you to deploy it

I guess I'm confused sorry. The contract is already deployed and live, and people are minting NFTs on it. I'm not trying to redeploy it, just verify it.

that will be somewhat difficult, since the file has to be exactly the same as the one that was displayed, so it is recommended as soon as it is displayed to verify it, so that the file does not suffer alterations

If you can figure it out I'll send you .1 ETH

did you unfold it flattened ??

To be very honest, it will be almost impossible to verify, if the file underwent a minor modification

To be very honest, it will be almost impossible to verify, if the file underwent a minor modification

Here is the original before I flattened it

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

import '';
import '';

contract Cryptorayrays is ERC721Enumerable, Ownable {

    using Strings for uint256;

    string _baseTokenURI;
    uint256 private _reserved = 500;
    uint256 private _giveAwayCount = 0;
    uint256 private _price = 0.0189 ether;
    bool public _paused = true;

    address t1 = 0xA934E7185D28A77d1c619601EA1F06b1f1D274B1;
    // Crypto rayrays
    // 9999 dogs in total
    constructor(string memory baseURI) ERC721("Cryptorayrays", "rayrays")  {

    function adopt(uint256 num) public payable {
        uint256 supply = totalSupply();
        require( !_paused,                              "Sale paused" );
        require( num < 10,                              "You can adopt a maximum of 10 NFT" );
        require( supply + num < 10000 - _reserved,      "Exceeds maximum NFT supply" );
        require( msg.value >= _price * num,             "Ether sent is not correct" );

        for(uint i = 0; i < num; i++) {
            uint mintIndex = totalSupply();
            if (totalSupply() < 10000) {
                _safeMint(msg.sender, 500 + mintIndex);

    function walletOfOwner(address _owner) public view returns(uint256[] memory) {
        uint256 tokenCount = balanceOf(_owner);

        uint256[] memory tokensId = new uint256[](tokenCount);
        for(uint256 i; i < tokenCount; i++){
            tokensId[i] = tokenOfOwnerByIndex(_owner, i);
        return tokensId;

    // Just in case Eth does some crazy stuff
    function setPrice(uint256 _newPrice) public onlyOwner() {
        _price = _newPrice;

    function _baseURI() internal view virtual override returns (string memory) {
        return _baseTokenURI;

    function setBaseURI(string memory baseURI) public onlyOwner {
        _baseTokenURI = baseURI;

    function getPrice() public view returns (uint256){
        return _price;

    function giveAway(address _to, uint256 _amount) external onlyOwner() {
        require( _amount <= _reserved, "Exceeds reserved NFT supply" );
        require(_giveAwayCount < 500, "Exceeds reserved NFT supplyCount");
        // uint256 supply = totalSupply();
        for(uint256 i; i < _amount; i++){
            if (_giveAwayCount < 500) {
                _safeMint( _to, _giveAwayCount);
                _giveAwayCount ++;

        _reserved -= _amount;

    function pause(bool val) public onlyOwner {
        _paused = val;

    function withdrawAll() public payable onlyOwner {

I just used truffle to include those OpenZeppelin files and flattened, then removed extra License pieces it puts in there.

but, perform the deployment of the flat file or this one that you just sent me?

I don't know how it was originally deployed, it was a different developer.

I'm sorry, it cannot be verified, recommendations for future deployments, flatten the files and deploy the flattened file, verify the contract immediately after being moved,

the problem you raise has already been seen several times and in 100% of the cases it cannot be verified

Ok thank you, I appreciate you looking into it