Add Digest interface

This commit is contained in:
lash
2023-03-26 12:04:31 +01:00
parent 1e11d8df08
commit b3f6e45696
16 changed files with 171 additions and 30 deletions

View File

@@ -0,0 +1,15 @@
@subsection Chrono
Define a creation time for a resource.
Complements @code{ERC5007}.
@table @dfn
@item ERC165 Interface identifier
@include ../../build/Chrono.interface
@item Solidity interface definition
@include ../../build/contract_Chrono.texi
@item Example implementation
@uref{https://git.defalsify.org/eth-erc721} (BadgeToken contract)
@end table

View File

@@ -0,0 +1,17 @@
@subsection Digest
Allows encoding of digests according to a specific encoding scheme.
Primary use-case is the abstraction of self-describing @uref{https://multiformats.io/multihash/,Multhash} encoding.
A default encoding @emph{must} always be defined, and the encoding of a valid digest @emph{must} succeed with the default encoding.
@table @dfn
@item ERC165 Interface identifier
@include ../../build/Digest.interface
@item Solidity interface definition
@include ../../build/contract_Digest.texi
@item Example implementation
@uref{git://holbrook.no/eth-event-msg.git}
@end table

View File

@@ -10,4 +10,6 @@ A contract defining an expiry @emph{must not} allow changing the expiration time
@include ../../build/Expire.interface
@item Solidity interface definition
@include ../../build/contract_Expire.texi
@item Example implementation
@uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git}
@end table

View File

@@ -13,6 +13,8 @@ Furthermore, it @emph{should} be possible to refer to a resource by a fully-qua
@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

View File

@@ -12,4 +12,6 @@ The interface complements @code{Locator} and @code{MultiHash} to generate locat
@include ../../build/Msg.interface
@item Solidity interface definition
@include ../../build/contract_Msg.texi
@item Example implementation
@uref{git://holbrook.no/eth-event-msg.git}
@end table

View File

@@ -1,25 +0,0 @@
@subsection Multihash
A complement to @code{Locator}, enabling validation and generation of multihashes for multicodecs that have been registered to the contract.
@table @dfn
@item ERC165 Interface identifier
@include ../../build/MultiHash.interface
@item Solidity interface definition
@include ../../build/contract_MultiHash.texi
@end table
@subsubsection Using @code{Multihash} with @code{Locator}
Given the data @code{foo}, the digest algorithm @code{sha256} (multihash prefix @code{1220}) 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/12202c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"}
@item tokenURI(toUint(sha256(foo)))
-> @code{"https://contentgateway.grassecon.net/12202c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"}
@end table

View File

@@ -50,6 +50,8 @@ The following well-known solidity interfaces are partially implemented in CIC na
@include declarator.sol.texi
@include digest.sol.texi
@include expire.sol.texi
@include faucet.sol.texi
@@ -60,8 +62,6 @@ The following well-known solidity interfaces are partially implemented in CIC na
@include msg.sol.texi
@include multihash.sol.texi
@include registry.sol.texi
@include seal.sol.texi

31
doc/texinfo/seal.sol.texi Normal file
View File

@@ -0,0 +1,31 @@
@subsection Seal
Some smart contract parameters may need to be mutable over part of a smart contract's lifetime.
This interface provides a method to explicitly signal when certain parameters have been rendered immutable.
The value of @code{sealState()} @emph{must not} decrease, and must not exceed @code{maxSealState}.
@code{maxSealState} is used to define that @emph{all mutable parameters} have been rendered immutable. The practical implications of this will vary between contracts.
The implementer is encouraged to use simple, descriptive names in the source code to describe the applicable seal states.
Use cases of sealing include:
@itemize
@item
Whether more tokens can be minted
@item
Allow ownership of a contract to be transferred
@item
The expiry time of a token (see @code{Expire})
@end itemize
@table @dfn
@item ERC165 Interface identifier
@include ../../build/Seal.interface
@item Solidity interface definition
@include ../../build/contract_Seal.texi
@item Example implementation
@uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git}
@end table

View File

@@ -24,4 +24,6 @@ Edit access control lists.
@include ../../build/Writer.interface
@item Solidity interface definition
@include ../../build/contract_Writer.texi
@item Example implementation
@uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git}
@end table