Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPFS URI for tokenId #81

Closed
5 tasks done
Tracked by #75
benjaminbollen opened this issue Feb 3, 2024 · 3 comments · Fixed by #84
Closed
5 tasks done
Tracked by #75

IPFS URI for tokenId #81

benjaminbollen opened this issue Feb 3, 2024 · 3 comments · Fixed by #84

Comments

@benjaminbollen
Copy link
Member

benjaminbollen commented Feb 3, 2024

  • check if we should store the multihash prefix, or predetermine it: conclusion, store CIDv0 digest as bytes32 separate from {ERC1155-uri}
  • store CIDv0 digest as bytes32 for tokenID
  • return ERC1155 uri(tokenId) as valid ipfs:// URI if CID stored; or return empty bytes if not stored (see below)
  • charge 1 CRC for setting URI CIDv0 digest
  • add 1155 required event add custom event for CIDv0 update
@benjaminbollen
Copy link
Member Author

benjaminbollen commented Feb 3, 2024

IPFS has CIDv0 which has less flexibility but will keep being supported. It is easily stored on-chain as the 32byte digest fits in one word. If later a need for support of CIDv1 is desired we can make a separate registration contract that supports the variable length prefix and variable digest length.

Because

I propose it is better to keep the uri of ERC1155 to return the "https://fallback.aboutcircles.com/v1/circles/{id}.json" as a (trusted) helper converting the IPFS CIDv0 into a simple HTTP request; and complementary introduce a setIpfsCidV0Digest, and returning the bytes32 of the digest only; leaving it the SDK to convert it to a CIDv0. In exchange there is no need for a setUri function. (It is clear that there is no guarantee about who the owner of the set DNS name aboutcircles.com will be in the future, but the community can always resolve to no-longer call on that URL if it is deemed untrust-worthy.)

Only supporting CIDv0 keeps the contract code trivial, by paying in CRC for storing the bytes32 digest; if later a CIDv1 auxiliary contract is deployed, than the fallback URI of 1155 can take this into account and resolve both CIDv0 and CIDv1 registry under the {ERC1155-URI} fallback.aboutcircles.com/v1/circles/{id}.json URL

@benjaminbollen
Copy link
Member Author

fixed by #84

@github-project-automation github-project-automation bot moved this from 🧐Review to 💪Done in circles-contracts-v2 Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 💪Done
Development

Successfully merging a pull request may close this issue.

1 participant