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) { ^-----^
I had to upgrade to 0.5 due to openzepplin version
doesn't quite add up here. – goodvibration Jan 14 '19 at 16:32