0

Using openzepplin version 2.0.0 and solc version 0.5. I am writing an ERC721 token contract on truffle. Truffle compiles with no error on solc 0.4.23. I had to upgrade to 0.5 due to openzepplin version.

Here's declaration for mapping:

struct Coordinates {
        string ra;
        string dec;
        string mag;
    }

    struct Star { 
        string name;
        string story;
        Coordinates coordinates;
    }

mapping(uint256 => Star) public tokenIdToStarInfo;

Here's the method for returning Star mapping:

function tokenIdToStarInfo(tokenId) public view returns(string, string, string, string, string) {
        return (tokenIdToStarInfo[tokenId].name, 
        tokenIdToStarInfo[tokenId].story, 
        tokenIdToStarInfo[tokenId].coordinates.ra, 
        tokenIdToStarInfo[tokenId].coordinates.dec, 
        tokenIdToStarInfo[tokenId].coordinates.mag);
    }

Here's console for the truffle compilation error:

starNotary.sol:21:5: The previous declaration is here: mapping(uint256 => Star) public tokenIdToStarInfo; ^-----------------------------------------------^

starNotary.sol:80:32: DeclarationError: Identifier not found or not unique. function tokenIdToStarInfo(tokenId) public view returns(string, string, string, string, string) { ^-----^

  • Open Zeppelin 2.0.0 relies on Solc 0.4.24. So I had to upgrade to 0.5 due to openzepplin version doesn't quite add up here. – goodvibration Jan 14 at 16:32
  • I guess the Open Zeppelin version was 2.1. Anyways I have downgraded to Solc 0.4.24 and the issue is resolved. – Sagar Atalatti Jan 14 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.