0
votes

I'm not having so much experience with ERC721 token standard, currently I'm working on a real-estate DAPP. I have a question. if I want to add external information related to a specific property like Location, Price, property number etc. every time if a new property register, what will be the best way to do that..?? but I don't want this with solidity Struct, is it possible to extend the ERC721 Metadata Interface Contract?? or any other solution??

I have tried almost everything but I think I'm missing something.

1

1 Answers

1
votes

If you want to store the data on-chain, a mapping (uint256 => Property), where the uint256 is the token ID and Property is "struct(location, price, ...)", containing the data is probably the cheapest option gas-wise.

But since your question states you don't want to use struct, you can chose to store the data on-chain with a series of mappings:

mapping (uint256 => string) tokenIdToLocation;
mapping (uint256 => uint64) tokenIdToUsdPrice;
// etc.

You can also decide to store the data off-chain, and link to this storage from your contract. In that case, you'd implement the tokenURI() function of the ERC721Metadata interface (both defined in the ERC-721 standard). The tokenUri() would return a (string) URL of an off-chain resource where you can display the (off-chain) data.