1

I have a slightly modified version of the OZ721, but gets rejected by Etherscan with the following:

Found the following ContractName(s) in source code : Address, Context, ERC165, ERC721, ERC721URIStorage, IERC165, IERC721, IERC721Metadata, IERC721Receiver, PS, Strings But we were unable to locate a matching bytecode (err_code_2)

This is the code that compiles correctly in Remix, so I'm just flattening (using the Remix plugin).

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

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

contract PS is ERC721URIStorage {
    uint8 public counter=0;
    address payable[] public team;
    uint256[] public shares;
    uint256 basePrice=1000000000000000;
    
    constructor() ERC721("Project Snooze", "SHP")  {
        team=[
            payable(0x85F407ad0d51900d0F9A0a0dcBc13d7Ab15315C4),    
            payable(0xDE5Debf6dd2a839088c02eAe3837Da4bC167C46e),
            payable(0x892fA83481E4b3dDE0Fcc349336d8460801bD7e3),
            payable(0xca028E9BF547b172Bc70085bCd56DA21562d13fb),
            payable(0x259AC567f6C03DE50fbbF7540501C5e1042D1C3F),
            payable(0xAA21774eCdfb34765545bA86667Be04d5331c938),
            payable(0x2653E8Da3D9Eb397362FEEF66a5266D778792BDF)
        ];
        shares=[22,22,22,22,4,4,4];
    }
    
    function dividends()public payable{
        uint256 total = address(this).balance;
        for (uint256 i = 0; i < team.length; i++) {
            team[i].transfer((total * (shares[i] * 100)) / 10000);
        } 
    }

    function createToken(string memory tokenURI) public payable returns (uint) {
        require(counter<7778, "No more");
        require(msg.value>=basePrice,"Minimum token price is 0.07777 ETH.");
        counter+=1;
        _mint(msg.sender, counter);
        _setTokenURI(counter, tokenURI);
        return counter;
    }
}

What gives?

1
  • Seriously? Nobody will touch this?
    – Eight Rice
    Commented Oct 17, 2021 at 10:53

1 Answer 1

0

I've tried your code and used the remix FLATTENER plugin to flatten the source code, verify and publish to Rinkeby Testnet via Rinkeby etherscan, no issues. You have to make sure:

  • The compiler version is the same as the one you used in remix.
  • If you checked the Enable optimization, then you need to select the yes option on Optimization enabled when you verify and publish your source code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.