61 lines
2.5 KiB
Plaintext
61 lines
2.5 KiB
Plaintext
@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).
|
||
|
||
@table @dfn
|
||
@item ERC165 Interface identifier
|
||
@include ../../build/Locator.interface
|
||
@item Solidity interface definition
|
||
@include ../../build/contract_Locator.texi
|
||
@item Example implementation
|
||
@uref{git://holbrook.no/eth-event-msg.git}
|
||
@end table
|
||
|
||
|
||
@subsubsection Expressing locators in terms of numetic 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
|