From f9d2af2e3b13a04a9aa67091fb366c4171a21ef9 Mon Sep 17 00:00:00 2001 From: lash Date: Wed, 2 Aug 2023 10:19:33 +0100 Subject: [PATCH] Restructure texinfo to improve readme formatting for code example --- README.md | 140 ++++++++++++++++++--------- doc/texinfo/burner.sol.texi | 13 ++- doc/texinfo/chrono.sol.texi | 13 ++- doc/texinfo/declarator.sol.texi | 13 ++- doc/texinfo/digest.sol.texi | 13 ++- doc/texinfo/expire.sol.texi | 13 ++- doc/texinfo/faucet.sol.texi | 13 ++- doc/texinfo/locator.sol.texi | 15 +-- doc/texinfo/minter.sol.texi | 13 ++- doc/texinfo/msg.sol.texi | 13 ++- doc/texinfo/registry.sol.texi | 17 ++-- doc/texinfo/seal.sol.texi | 13 ++- doc/texinfo/tokenratechange.sol.texi | 13 ++- doc/texinfo/tokenswap.sol.texi | 13 ++- doc/texinfo/tokenvote.sol.texi | 12 ++- doc/texinfo/writer.sol.texi | 13 ++- python/README.md | 140 ++++++++++++++++++--------- texify.sh | 6 +- 18 files changed, 313 insertions(+), 173 deletions(-) diff --git a/README.md b/README.md index b15b463..aeb5cfe 100644 --- a/README.md +++ b/README.md @@ -132,10 +132,12 @@ Attached to `ERC20` and `ERC721` tokens that may be *burned*. Implements the `burn(...)` part of `ERC5679` for interoperability. -ERC165 Interface identifier +#### ERC165 Interface identifier + b1110c1b -Solidity interface definition +#### Solidity interface definition + interface IBurner { // Token(s) successfully burned; by who and how much. event Burn(address indexed _burner, uint256 _burned); @@ -158,7 +160,8 @@ Solidity interface definition function totalMinted() external returns (uint256); } -Example implementation +#### Example implementation + ### Chrono @@ -167,17 +170,20 @@ Define a creation time for a resource. Complements `ERC5007`. -ERC165 Interface identifier +#### ERC165 Interface identifier + 4db1ccd4 -Solidity interface definition +#### Solidity interface definition + interface IChrono { // Returns the timestamp of when a resource corresponding to _idx was first created. // int64 chosen as return value for simpler interoperability with ERC5007. function createTime(uint256 _idx) external returns(int64); } -Example implementation +#### Example implementation + (BadgeToken contract) ### Declarator @@ -197,10 +203,12 @@ Any number of claims can be made about an address under any number of topics. All claims must be stored, and returned in the order which they were added. -ERC165 Interface identifier +#### ERC165 Interface identifier + 21b7493b -Solidity interface definition +#### Solidity interface definition + interface IDeclarator { event DeclarationAdded(address indexed _declarator, address indexed _subject, bytes32 indexed _topic, bytes32 _proof); @@ -229,7 +237,8 @@ Solidity interface definition function declaratorCount(address _subject) external view returns ( uint256 ); } -Reference implementation +#### Reference implementation + ### Digest @@ -242,10 +251,12 @@ Primary use-case is the abstraction of self-describing A default encoding *must* always be defined, and the encoding of a valid digest *must* succeed with the default encoding. -ERC165 Interface identifier +#### ERC165 Interface identifier + 982ab05d -Solidity interface definition +#### Solidity interface definition + interface IDigest { // Returns the default digest encoding used by the contract instance. function defaultDigestEncoding() external view returns (uint256 _encoding); @@ -264,7 +275,8 @@ Solidity interface definition function encodeDigest(bytes memory _data) external view returns (bytes memory); } -Example implementation +#### Example implementation + ### Expire @@ -275,10 +287,12 @@ change*. A contract defining an expiry *must not* allow changing the expiration time to a time in the past. -ERC165 Interface identifier +#### ERC165 Interface identifier + 841a0e94 -Solidity interface definition +#### Solidity interface definition + interface IExpire { // Contract has expired. event Expired(uint256 _timestamp); @@ -297,7 +311,8 @@ Solidity interface definition function applyExpiry() external returns(uint8); } -Example implementation +#### Example implementation + ### Faucet @@ -332,10 +347,12 @@ amount to dispense. The *check(address)* contract call *must* evaluate all four criteria, and *must* return `false` if any of the criteria are not met. -ERC165 Interface identifier +#### ERC165 Interface identifier + 1a3ac634 -Solidity interface definition +#### Solidity interface definition + interface IFaucet { // Tokens were given to an address event Give(address indexed _recipient, address indexed _token, uint256 _value); @@ -370,7 +387,8 @@ Solidity interface definition function nextBalance(address _recipient) external returns (uint256); } -Reference implementations +#### Reference implementations + - - @@ -389,10 +407,12 @@ the content address. Furthermore, it *should* be possible to refer to a resource by a fully-qualified location on the web or an overlay network (e.g. tor). -ERC165 Interface identifier +#### ERC165 Interface identifier + ed75b333 -Solidity interface definition +#### Solidity interface definition + interface ILocator { // URI that may or may not point to a specific resource location. function toURI(bytes memory _data) external view returns (string memory); @@ -401,10 +421,11 @@ Solidity interface definition function toURL(bytes memory _data) external view returns(string memory); } -Example implementation +#### Example implementation + -#### Expressing locators in terms of numetic token id +#### Expressing locators in terms of numeric token id Given the numeric token id `1234567890987654321` (`0x112210f4b16c1cb1` hex), and a base url `https://contentgateway.grassecon.net`, the result @@ -463,10 +484,12 @@ Attached to `ERC20` and `ERC721` tokens that may be minted. Implements the `mint(...)` and `safeMint(...)` parts of `ERC5679` for interoperability. -ERC165 Interface identifier +#### ERC165 Interface identifier + 5878bcf4 -Solidity interface definition +#### Solidity interface definition + interface IMinter { // Tokens are successfully minted; by who, to whom and how much event Mint(address indexed _minter, address indexed _beneficiary, uint256 value); @@ -484,7 +507,8 @@ Solidity interface definition function safeMint(address _beneficiary, uint256 value, bytes calldata _data) external; } -Example implementation +#### Example implementation + ### Msg @@ -497,10 +521,12 @@ The reference may or may not be mutable. The interface complements `Locator` and `MultiHash` to generate locators for how to resolve the reference. -ERC165 Interface identifier +#### ERC165 Interface identifier + a3002595 -Solidity interface definition +#### Solidity interface definition + interface IMsg { // Emitted when a new message digest has been set // Should not be emitted if the digest set is identical to the previous @@ -510,7 +536,8 @@ Solidity interface definition function getMsg() external view returns(bytes memory); } -Example implementation +#### Example implementation + ### Registry @@ -524,10 +551,12 @@ It currently has two distinct uses in the CIC context: 2. Unique (ERC20) token symbol resolver. -ERC165 Interface identifier +#### ERC165 Interface identifier + effbf671 -Solidity interface definition +#### Solidity interface definition + interface IRegistryClient { // Address added to store with the given key event AddressKey(bytes32 indexed _key, address _address); @@ -542,10 +571,12 @@ Solidity interface definition function identifierCount() external view returns (uint256); } -Contract registry implementation +#### Contract registry implementation + -Token index implementation +#### Token index implementation + ### Seal @@ -574,10 +605,12 @@ Use cases of sealing include: - The expiry time of a token (see `Expire`) -ERC165 Interface identifier +#### ERC165 Interface identifier + 0d7491f8 -Solidity interface definition +#### Solidity interface definition + interface ISeal { // Seal state has changed. event SealStateChange(bool indexed _final, uint256 _sealState); @@ -589,7 +622,8 @@ Solidity interface definition function maxSealState() external view returns(uint256); } -Example implementation +#### Example implementation + ### TokenRateChange @@ -602,10 +636,12 @@ frequency for which the rate of change is applied. A method for canonical value change calculations is also provided. -ERC165 Interface identifier +#### ERC165 Interface identifier + b716af03 -Solidity interface definition +#### Solidity interface definition + interface ITokenChangeRate { // Time unit resolution for rate of change. // A value of 0 indicates no rate of change, @@ -628,7 +664,8 @@ Solidity interface definition function applyChange(int256 _value, uint256 _changeTimeUnits) external view returns(int256); } -Reference implementations +#### Reference implementations + - ### TokenSwap @@ -636,10 +673,12 @@ Reference implementations Token swap interface that can fit token escrow aswell as token swap contracts. -ERC165 Interface identifier +#### ERC165 Interface identifier + 9e2d0236 -Solidity interface definition +#### Solidity interface definition + interface ITokenSwap { // Add inToken liquidity of the full balance of the sender // Requires token approval for the balance. @@ -660,7 +699,8 @@ Solidity interface definition function withdraw(address _outToken, address _inToken, uint256 _value) external returns (uint256); } -Reference implementations +#### Reference implementations + - ### TokenVote @@ -675,10 +715,12 @@ Voted tokens **SHOULD** be locked until the voting has finalized. Finalization of voting should be callable by anyone. -ERC165 Interface identifier +#### ERC165 Interface identifier + f2e0bfeb -Solidity interface definition +#### Solidity interface definition + interface ITokenVote { // A new proposal has been created. @@ -734,7 +776,8 @@ Solidity interface definition function finalize() external returns (bool); } -Reference implementations +#### Reference implementations + - ### Writer @@ -759,10 +802,12 @@ Some use-case examples of super-user actions include: - Edit access control lists. -ERC165 Interface identifier +#### ERC165 Interface identifier + abe1f1f5 -Solidity interface definition +#### Solidity interface definition + interface IWriter { // A writer has been added by _executor event WriterAdded(address _writer); @@ -780,5 +825,6 @@ Solidity interface definition function isWriter(address _writer) external view returns (bool); } -Example implementation +#### Example implementation + diff --git a/doc/texinfo/burner.sol.texi b/doc/texinfo/burner.sol.texi index 1c8d23f..e8aabca 100644 --- a/doc/texinfo/burner.sol.texi +++ b/doc/texinfo/burner.sol.texi @@ -4,11 +4,14 @@ Attached to @code{ERC20} and @code{ERC721} tokens that may be @emph{burned}. Implements the @code{burn(...)} part of @code{ERC5679} for interoperability. -@table @dfn -@item ERC165 Interface identifier +@subsubsection ERC165 Interface identifier + @include ../../build/Burner.interface -@item Solidity interface definition + +@subsubsection Solidity interface definition + @include ../../build/contract_Burner.texi -@item Example implementation + +@subsubsection Example implementation + @uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git} -@end table diff --git a/doc/texinfo/chrono.sol.texi b/doc/texinfo/chrono.sol.texi index 6d47a49..b2f832a 100644 --- a/doc/texinfo/chrono.sol.texi +++ b/doc/texinfo/chrono.sol.texi @@ -5,11 +5,14 @@ Define a creation time for a resource. Complements @code{ERC5007}. -@table @dfn -@item ERC165 Interface identifier +@subsubsection ERC165 Interface identifier + @include ../../build/Chrono.interface -@item Solidity interface definition + +@subsubsection Solidity interface definition + @include ../../build/contract_Chrono.texi -@item Example implementation + +@subsubsection Example implementation + @uref{https://git.defalsify.org/eth-erc721} (BadgeToken contract) -@end table diff --git a/doc/texinfo/declarator.sol.texi b/doc/texinfo/declarator.sol.texi index ff25d97..7fea9ad 100644 --- a/doc/texinfo/declarator.sol.texi +++ b/doc/texinfo/declarator.sol.texi @@ -10,11 +10,14 @@ Claims may be made with or without topics. A missing topic is synonymous with a Any number of claims can be made about an address under any number of topics. All claims must be stored, and returned in the order which they were added. -@table @dfn -@item ERC165 Interface identifier +@subsubsection ERC165 Interface identifier + @include ../../build/Declarator.interface -@item Solidity interface definition + +@subsubsection Solidity interface definition + @include ../../build/contract_Declarator.texi -@item Reference implementation + +@subsubsection Reference implementation + @uref{git://holbrook.no/eth-address-index.git,} -@end table diff --git a/doc/texinfo/digest.sol.texi b/doc/texinfo/digest.sol.texi index 9447986..15bef46 100644 --- a/doc/texinfo/digest.sol.texi +++ b/doc/texinfo/digest.sol.texi @@ -7,11 +7,14 @@ Primary use-case is the abstraction of self-describing @uref{https://multiformat 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 +@subsubsection ERC165 Interface identifier + @include ../../build/Digest.interface -@item Solidity interface definition + +@subsubsection Solidity interface definition + @include ../../build/contract_Digest.texi -@item Example implementation + +@subsubsection Example implementation + @uref{git://holbrook.no/eth-event-msg.git} -@end table diff --git a/doc/texinfo/expire.sol.texi b/doc/texinfo/expire.sol.texi index 9ecacda..f300672 100644 --- a/doc/texinfo/expire.sol.texi +++ b/doc/texinfo/expire.sol.texi @@ -5,11 +5,14 @@ Defines an expiry time after which token balances or supply @emph{cannot change} A contract defining an expiry @emph{must not} allow changing the expiration time to a time in the past. -@table @dfn -@item ERC165 Interface identifier +@subsubsection ERC165 Interface identifier + @include ../../build/Expire.interface -@item Solidity interface definition + +@subsubsection Solidity interface definition + @include ../../build/contract_Expire.texi -@item Example implementation + +@subsubsection Example implementation + @uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git} -@end table diff --git a/doc/texinfo/faucet.sol.texi b/doc/texinfo/faucet.sol.texi index 92acab3..a5982cb 100644 --- a/doc/texinfo/faucet.sol.texi +++ b/doc/texinfo/faucet.sol.texi @@ -24,16 +24,19 @@ The contract has sufficient token funds to dispense the current defined amount t The @emph{check(address)} contract call @emph{must} evaluate all four criteria, and @emph{must} return @code{false} if any of the criteria are not met. -@table @dfn -@item ERC165 Interface identifier +@subsubsection ERC165 Interface identifier + @include ../../build/Faucet.interface -@item Solidity interface definition + +@subsubsection Solidity interface definition + @include ../../build/contract_Faucet.texi -@item Reference implementations + +@subsubsection Reference implementations + @itemize @item @uref{git://holbrook.no/erc20-faucet.git,} @item @uref{git://holbrook.no/eth-faucet.git,} @end itemize -@end table diff --git a/doc/texinfo/locator.sol.texi b/doc/texinfo/locator.sol.texi index 5e88a33..682ad03 100644 --- a/doc/texinfo/locator.sol.texi +++ b/doc/texinfo/locator.sol.texi @@ -8,17 +8,20 @@ It @emph{must} be possible to refer to all off-chain resources directly by the c 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 +@subsubsection ERC165 Interface identifier + @include ../../build/Locator.interface -@item Solidity interface definition + +@subsubsection Solidity interface definition + @include ../../build/contract_Locator.texi -@item Example implementation + +@subsubsection Example implementation + @uref{git://holbrook.no/eth-event-msg.git} -@end table -@subsubsection Expressing locators in terms of numetic token id +@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: diff --git a/doc/texinfo/minter.sol.texi b/doc/texinfo/minter.sol.texi index 31fdbb9..403f585 100644 --- a/doc/texinfo/minter.sol.texi +++ b/doc/texinfo/minter.sol.texi @@ -4,11 +4,14 @@ Attached to @code{ERC20} and @code{ERC721} tokens that may be minted. Implements the @code{mint(...)} and @code{safeMint(...)} parts of @code{ERC5679} for interoperability. -@table @dfn -@item ERC165 Interface identifier +@subsubsection ERC165 Interface identifier + @include ../../build/Minter.interface -@item Solidity interface definition + +@subsubsection Solidity interface definition + @include ../../build/contract_Minter.texi -@item Example implementation + +@subsubsection Example implementation + @uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git} -@end table diff --git a/doc/texinfo/msg.sol.texi b/doc/texinfo/msg.sol.texi index aaa7e33..3d4162d 100644 --- a/doc/texinfo/msg.sol.texi +++ b/doc/texinfo/msg.sol.texi @@ -7,11 +7,14 @@ The reference may or may not be mutable. The interface complements @code{Locator} and @code{MultiHash} to generate locators for how to resolve the reference. -@table @dfn -@item ERC165 Interface identifier +@subsubsection ERC165 Interface identifier + @include ../../build/Msg.interface -@item Solidity interface definition + +@subsubsection Solidity interface definition + @include ../../build/contract_Msg.texi -@item Example implementation + +@subsubsection Example implementation + @uref{git://holbrook.no/eth-event-msg.git} -@end table diff --git a/doc/texinfo/registry.sol.texi b/doc/texinfo/registry.sol.texi index a19c3f0..f84237d 100644 --- a/doc/texinfo/registry.sol.texi +++ b/doc/texinfo/registry.sol.texi @@ -11,13 +11,18 @@ Entry-point to discover all relevant contracts of CIC networks. Unique (ERC20) token symbol resolver. @end enumerate -@table @dfn -@item ERC165 Interface identifier +@subsubsection ERC165 Interface identifier + @include ../../build/RegistryClient.interface -@item Solidity interface definition + +@subsubsection Solidity interface definition + @include ../../build/contract_RegistryClient.texi -@item Contract registry implementation + +@subsubsection Contract registry implementation + @uref{git://holbrook.no/eth-contract-registry.git,} -@item Token index implementation + +@subsubsection Token index implementation + @uref{git://holbrook.no/eth-contract-registry.git,} -@end table diff --git a/doc/texinfo/seal.sol.texi b/doc/texinfo/seal.sol.texi index de03540..48126bb 100644 --- a/doc/texinfo/seal.sol.texi +++ b/doc/texinfo/seal.sol.texi @@ -21,11 +21,14 @@ Allow ownership of a contract to be transferred The expiry time of a token (see @code{Expire}) @end itemize -@table @dfn -@item ERC165 Interface identifier +@subsubsection ERC165 Interface identifier + @include ../../build/Seal.interface -@item Solidity interface definition + +@subsubsection Solidity interface definition + @include ../../build/contract_Seal.texi -@item Example implementation + +@subsubsection Example implementation + @uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git} -@end table diff --git a/doc/texinfo/tokenratechange.sol.texi b/doc/texinfo/tokenratechange.sol.texi index 801ef90..7ae391b 100644 --- a/doc/texinfo/tokenratechange.sol.texi +++ b/doc/texinfo/tokenratechange.sol.texi @@ -6,14 +6,17 @@ It allows defining the granularity of the rate of change, aswell as a frequency A method for canonical value change calculations is also provided. -@table @dfn -@item ERC165 Interface identifier +@subsubsection ERC165 Interface identifier + @include ../../build/TokenRateChange.interface -@item Solidity interface definition + +@subsubsection Solidity interface definition + @include ../../build/contract_TokenRateChange.texi -@item Reference implementations + +@subsubsection Reference implementations + @itemize @item @uref{git://holbrook.no/erc20-demurrage-token.git,} @end itemize -@end table diff --git a/doc/texinfo/tokenswap.sol.texi b/doc/texinfo/tokenswap.sol.texi index c666e0d..33267d5 100644 --- a/doc/texinfo/tokenswap.sol.texi +++ b/doc/texinfo/tokenswap.sol.texi @@ -2,14 +2,17 @@ Token swap interface that can fit token escrow aswell as token swap contracts. -@table @dfn -@item ERC165 Interface identifier +@subsubsection ERC165 Interface identifier + @include ../../build/TokenSwap.interface -@item Solidity interface definition + +@subsubsection Solidity interface definition + @include ../../build/contract_TokenSwap.texi -@item Reference implementations + +@subsubsection Reference implementations + @itemize @item @uref{git://holbrook.no/erc20-vend.git,} @end itemize -@end table diff --git a/doc/texinfo/tokenvote.sol.texi b/doc/texinfo/tokenvote.sol.texi index bb0c16d..05f4c95 100644 --- a/doc/texinfo/tokenvote.sol.texi +++ b/doc/texinfo/tokenvote.sol.texi @@ -10,14 +10,16 @@ Voted tokens @strong{SHOULD} be locked until the voting has finalized. Finalization of voting should be callable by anyone. -@table @dfn -@item ERC165 Interface identifier +@subsubsection ERC165 Interface identifier + @include ../../build/TokenVote.interface -@item Solidity interface definition + +@subsubsection Solidity interface definition + @include ../../build/contract_TokenVote.texi -@item Reference implementations + +@subsubsection Reference implementations @itemize @item @uref{git://holbrook.no/evm-tokenvote.git,} @end itemize -@end table diff --git a/doc/texinfo/writer.sol.texi b/doc/texinfo/writer.sol.texi index a9a9586..9239dec 100644 --- a/doc/texinfo/writer.sol.texi +++ b/doc/texinfo/writer.sol.texi @@ -19,11 +19,14 @@ Change the amount dispensed by the faucet. Edit access control lists. @end itemize -@table @dfn -@item ERC165 Interface identifier +@subsubsection ERC165 Interface identifier + @include ../../build/Writer.interface -@item Solidity interface definition + +@subsubsection Solidity interface definition + @include ../../build/contract_Writer.texi -@item Example implementation + +@subsubsection Example implementation + @uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git} -@end table diff --git a/python/README.md b/python/README.md index b15b463..aeb5cfe 100644 --- a/python/README.md +++ b/python/README.md @@ -132,10 +132,12 @@ Attached to `ERC20` and `ERC721` tokens that may be *burned*. Implements the `burn(...)` part of `ERC5679` for interoperability. -ERC165 Interface identifier +#### ERC165 Interface identifier + b1110c1b -Solidity interface definition +#### Solidity interface definition + interface IBurner { // Token(s) successfully burned; by who and how much. event Burn(address indexed _burner, uint256 _burned); @@ -158,7 +160,8 @@ Solidity interface definition function totalMinted() external returns (uint256); } -Example implementation +#### Example implementation + ### Chrono @@ -167,17 +170,20 @@ Define a creation time for a resource. Complements `ERC5007`. -ERC165 Interface identifier +#### ERC165 Interface identifier + 4db1ccd4 -Solidity interface definition +#### Solidity interface definition + interface IChrono { // Returns the timestamp of when a resource corresponding to _idx was first created. // int64 chosen as return value for simpler interoperability with ERC5007. function createTime(uint256 _idx) external returns(int64); } -Example implementation +#### Example implementation + (BadgeToken contract) ### Declarator @@ -197,10 +203,12 @@ Any number of claims can be made about an address under any number of topics. All claims must be stored, and returned in the order which they were added. -ERC165 Interface identifier +#### ERC165 Interface identifier + 21b7493b -Solidity interface definition +#### Solidity interface definition + interface IDeclarator { event DeclarationAdded(address indexed _declarator, address indexed _subject, bytes32 indexed _topic, bytes32 _proof); @@ -229,7 +237,8 @@ Solidity interface definition function declaratorCount(address _subject) external view returns ( uint256 ); } -Reference implementation +#### Reference implementation + ### Digest @@ -242,10 +251,12 @@ Primary use-case is the abstraction of self-describing A default encoding *must* always be defined, and the encoding of a valid digest *must* succeed with the default encoding. -ERC165 Interface identifier +#### ERC165 Interface identifier + 982ab05d -Solidity interface definition +#### Solidity interface definition + interface IDigest { // Returns the default digest encoding used by the contract instance. function defaultDigestEncoding() external view returns (uint256 _encoding); @@ -264,7 +275,8 @@ Solidity interface definition function encodeDigest(bytes memory _data) external view returns (bytes memory); } -Example implementation +#### Example implementation + ### Expire @@ -275,10 +287,12 @@ change*. A contract defining an expiry *must not* allow changing the expiration time to a time in the past. -ERC165 Interface identifier +#### ERC165 Interface identifier + 841a0e94 -Solidity interface definition +#### Solidity interface definition + interface IExpire { // Contract has expired. event Expired(uint256 _timestamp); @@ -297,7 +311,8 @@ Solidity interface definition function applyExpiry() external returns(uint8); } -Example implementation +#### Example implementation + ### Faucet @@ -332,10 +347,12 @@ amount to dispense. The *check(address)* contract call *must* evaluate all four criteria, and *must* return `false` if any of the criteria are not met. -ERC165 Interface identifier +#### ERC165 Interface identifier + 1a3ac634 -Solidity interface definition +#### Solidity interface definition + interface IFaucet { // Tokens were given to an address event Give(address indexed _recipient, address indexed _token, uint256 _value); @@ -370,7 +387,8 @@ Solidity interface definition function nextBalance(address _recipient) external returns (uint256); } -Reference implementations +#### Reference implementations + - - @@ -389,10 +407,12 @@ the content address. Furthermore, it *should* be possible to refer to a resource by a fully-qualified location on the web or an overlay network (e.g. tor). -ERC165 Interface identifier +#### ERC165 Interface identifier + ed75b333 -Solidity interface definition +#### Solidity interface definition + interface ILocator { // URI that may or may not point to a specific resource location. function toURI(bytes memory _data) external view returns (string memory); @@ -401,10 +421,11 @@ Solidity interface definition function toURL(bytes memory _data) external view returns(string memory); } -Example implementation +#### Example implementation + -#### Expressing locators in terms of numetic token id +#### Expressing locators in terms of numeric token id Given the numeric token id `1234567890987654321` (`0x112210f4b16c1cb1` hex), and a base url `https://contentgateway.grassecon.net`, the result @@ -463,10 +484,12 @@ Attached to `ERC20` and `ERC721` tokens that may be minted. Implements the `mint(...)` and `safeMint(...)` parts of `ERC5679` for interoperability. -ERC165 Interface identifier +#### ERC165 Interface identifier + 5878bcf4 -Solidity interface definition +#### Solidity interface definition + interface IMinter { // Tokens are successfully minted; by who, to whom and how much event Mint(address indexed _minter, address indexed _beneficiary, uint256 value); @@ -484,7 +507,8 @@ Solidity interface definition function safeMint(address _beneficiary, uint256 value, bytes calldata _data) external; } -Example implementation +#### Example implementation + ### Msg @@ -497,10 +521,12 @@ The reference may or may not be mutable. The interface complements `Locator` and `MultiHash` to generate locators for how to resolve the reference. -ERC165 Interface identifier +#### ERC165 Interface identifier + a3002595 -Solidity interface definition +#### Solidity interface definition + interface IMsg { // Emitted when a new message digest has been set // Should not be emitted if the digest set is identical to the previous @@ -510,7 +536,8 @@ Solidity interface definition function getMsg() external view returns(bytes memory); } -Example implementation +#### Example implementation + ### Registry @@ -524,10 +551,12 @@ It currently has two distinct uses in the CIC context: 2. Unique (ERC20) token symbol resolver. -ERC165 Interface identifier +#### ERC165 Interface identifier + effbf671 -Solidity interface definition +#### Solidity interface definition + interface IRegistryClient { // Address added to store with the given key event AddressKey(bytes32 indexed _key, address _address); @@ -542,10 +571,12 @@ Solidity interface definition function identifierCount() external view returns (uint256); } -Contract registry implementation +#### Contract registry implementation + -Token index implementation +#### Token index implementation + ### Seal @@ -574,10 +605,12 @@ Use cases of sealing include: - The expiry time of a token (see `Expire`) -ERC165 Interface identifier +#### ERC165 Interface identifier + 0d7491f8 -Solidity interface definition +#### Solidity interface definition + interface ISeal { // Seal state has changed. event SealStateChange(bool indexed _final, uint256 _sealState); @@ -589,7 +622,8 @@ Solidity interface definition function maxSealState() external view returns(uint256); } -Example implementation +#### Example implementation + ### TokenRateChange @@ -602,10 +636,12 @@ frequency for which the rate of change is applied. A method for canonical value change calculations is also provided. -ERC165 Interface identifier +#### ERC165 Interface identifier + b716af03 -Solidity interface definition +#### Solidity interface definition + interface ITokenChangeRate { // Time unit resolution for rate of change. // A value of 0 indicates no rate of change, @@ -628,7 +664,8 @@ Solidity interface definition function applyChange(int256 _value, uint256 _changeTimeUnits) external view returns(int256); } -Reference implementations +#### Reference implementations + - ### TokenSwap @@ -636,10 +673,12 @@ Reference implementations Token swap interface that can fit token escrow aswell as token swap contracts. -ERC165 Interface identifier +#### ERC165 Interface identifier + 9e2d0236 -Solidity interface definition +#### Solidity interface definition + interface ITokenSwap { // Add inToken liquidity of the full balance of the sender // Requires token approval for the balance. @@ -660,7 +699,8 @@ Solidity interface definition function withdraw(address _outToken, address _inToken, uint256 _value) external returns (uint256); } -Reference implementations +#### Reference implementations + - ### TokenVote @@ -675,10 +715,12 @@ Voted tokens **SHOULD** be locked until the voting has finalized. Finalization of voting should be callable by anyone. -ERC165 Interface identifier +#### ERC165 Interface identifier + f2e0bfeb -Solidity interface definition +#### Solidity interface definition + interface ITokenVote { // A new proposal has been created. @@ -734,7 +776,8 @@ Solidity interface definition function finalize() external returns (bool); } -Reference implementations +#### Reference implementations + - ### Writer @@ -759,10 +802,12 @@ Some use-case examples of super-user actions include: - Edit access control lists. -ERC165 Interface identifier +#### ERC165 Interface identifier + abe1f1f5 -Solidity interface definition +#### Solidity interface definition + interface IWriter { // A writer has been added by _executor event WriterAdded(address _writer); @@ -780,5 +825,6 @@ Solidity interface definition function isWriter(address _writer) external view returns (bool); } -Example implementation +#### Example implementation + diff --git a/texify.sh b/texify.sh index 7a5743b..3405faa 100644 --- a/texify.sh +++ b/texify.sh @@ -4,7 +4,9 @@ for f in $(ls solidity/*.sol); do fn=$(basename $f) fb=${fn%.*} fn="build/contract_${fb}.texi" - echo "@verbatim" > $fn + #echo "@verbatim" > $fn + echo -e "@example\n@verbatim" > $fn awk 'f;/interface [a-zA-Z0-9]* /{print;f=1}' $f >> $fn - echo "@end verbatim" >> $fn + #echo "@end verbatim" >> $fn + echo -e "@end verbatim\n@end example" >> $fn done