cic-contracts/doc/texinfo/locator.sol.texi

64 lines
2.5 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@subsection Locator
This interface supports @code{ERC721 Metadata}, in particular the @code{tokenURI(uint256)} call.
Off-chain resources in the CIC network @emph{must} be defined in terms of content addressed strings.
It @emph{must} be possible to refer to all off-chain resources directly by the content address.
Furthermore, it @emph{should} be possible to refer to a resource by a fully-qualified location on the web or an overlay network (e.g. tor).
@subsubsection ERC165 Interface identifier
@include ../../build/Locator.interface
@subsubsection Solidity interface definition
@include ../../build/contract_Locator.texi
@subsubsection Example implementation
@uref{git://holbrook.no/eth-event-msg.git}
@subsubsection Expressing locators in terms of numeric token id
Given the numeric token id @code{1234567890987654321} (@code{0x112210f4b16c1cb1} hex), and a base url @code{https://contentgateway.grassecon.net}, the result of the methods may be as follows:
@table @code
@item toURI(toHex(1234567890987654321))
-> @code{https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1}
@item toURL(toHex(1234567890987654321))
-> @code{https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1}
@item tokenURI(1234567890987654321)
-> @code{https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1}
@end table
@subsubsection Expressing locators in terms of a digest
Given the data @code{foo}, the digest algorithm @code{sha256} and a base url @code{https://contentgateway.grassecon.net}, the result of the methods may be as follows:
@table @code
@item toURI(sha256(foo))
-> @code{"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"}
@item toURL(sha256(foo))
-> @code{"https://contentgateway.grassecon.net/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"}
@item tokenURI(toUint(sha256(foo)))
-> @code{"https://contentgateway.grassecon.net/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"}
@end table
@subsubsection Locator without URL
Given the data @code{foo}, the digest algorithm @code{sha256} and no base url, the result of the methods may be as follows:
@table @code
@item toURI(sha256(foo))
-> @code{"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"}
@item toURL(sha256(foo))
-> @code{""}
@item tokenURI(toUint(sha256(foo)))
-> @code{"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"}
@end table