Embed solidity code, interfaces in documentation
This commit is contained in:
parent
8507f202e7
commit
0877fe7769
15
Makefile
15
Makefile
@ -19,14 +19,25 @@ PREFIX = /usr/local/share/cic/solidity/abi
|
||||
.sol.interface:
|
||||
bash to_interface.sh $(basename $@).sol > $@
|
||||
|
||||
all: $(OUTPUTS)
|
||||
all: outs doc
|
||||
|
||||
outs: $(OUTPUTS)
|
||||
echo $(OUTPUTS)
|
||||
|
||||
install: $(OUTPUTS)
|
||||
install-code: $(OUTPUTS)
|
||||
install -vDm0644 -t $(PREFIX) $?
|
||||
|
||||
install-doc:
|
||||
bash texify.sh
|
||||
|
||||
install: outs install-code install-doc doc
|
||||
|
||||
clean:
|
||||
rm -vf solidity/*.json
|
||||
rm -vf solidity/*.interface
|
||||
|
||||
doc:
|
||||
bash texify.sh
|
||||
make -C doc/texinfo
|
||||
|
||||
.PHONY: clean install
|
||||
|
18
doc/texinfo/accountsindex.sol.texi
Normal file
18
doc/texinfo/accountsindex.sol.texi
Normal file
@ -0,0 +1,18 @@
|
||||
@subsection Accounts Index
|
||||
|
||||
Account address membership list.
|
||||
|
||||
Records time when account was added.
|
||||
|
||||
Addresses may be @emph{added}, @emph{removed}, aswell as @emph{deactivated} and @emph{activated}. Deactivated accounts still count towards the @code{entryCount}.
|
||||
|
||||
The @code{entry} method is used to iterate the account list. The order of which accounts are returned is not guaranteed. Any returned value matching @code{address(0x00)} should be skipped, and not counted towards @code{entryCount}.
|
||||
|
||||
@table @dfn
|
||||
@item ERC165 Interface identifier
|
||||
@include ../../build/AccountsIndex.interface
|
||||
@item Solidity interface definition
|
||||
@include ../../build/contract_AccountsIndex.texi
|
||||
@item Reference implementation
|
||||
@uref{git://holbrook.no/eth-accounts-index.git,}
|
||||
@end table
|
14
doc/texinfo/burner.sol.texi
Normal file
14
doc/texinfo/burner.sol.texi
Normal file
@ -0,0 +1,14 @@
|
||||
@subsection Burner
|
||||
|
||||
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
|
||||
@include ../../build/Burner.interface
|
||||
@item Solidity interface definition
|
||||
@include ../../build/contract_Burner.texi
|
||||
@item Example implementation
|
||||
@uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git}
|
||||
@end table
|
20
doc/texinfo/declarator.sol.texi
Normal file
20
doc/texinfo/declarator.sol.texi
Normal file
@ -0,0 +1,20 @@
|
||||
@subsection Declarator
|
||||
|
||||
Permissionless store of signed claims made by an address about other addresses, or addresses about themselves.
|
||||
|
||||
It is used to declare or respond to certifications of vouchers, NFT, voucher members.
|
||||
|
||||
Addresses may be Externally Owned Accounts or smart contracts.
|
||||
|
||||
Claims may be made with or without topics. A missing topic is synonymous with a topic valud of @code{bytes32(0x00)}.
|
||||
|
||||
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
|
||||
@include ../../build/Declarator.interface
|
||||
@item Solidity interface definition
|
||||
@include ../../build/contract_Declarator.texi
|
||||
@item Reference implementation
|
||||
@uref{git://holbrook.no/eth-address-index.git,}
|
||||
@end table
|
13
doc/texinfo/expire.sol.texi
Normal file
13
doc/texinfo/expire.sol.texi
Normal file
@ -0,0 +1,13 @@
|
||||
@subsection Expire
|
||||
|
||||
Defines a token contract that may not be used after a certain time.
|
||||
|
||||
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
|
||||
@include ../../build/Expire.interface
|
||||
@item Solidity interface definition
|
||||
@include ../../build/contract_Expire.texi
|
||||
@end table
|
39
doc/texinfo/faucet.sol.texi
Normal file
39
doc/texinfo/faucet.sol.texi
Normal file
@ -0,0 +1,39 @@
|
||||
@subsection Faucet
|
||||
|
||||
Used for dispensing tokens to any address.
|
||||
|
||||
It can be used for gas tokens and @emph{ERC20} alike.
|
||||
|
||||
The interface is the same whether the faucet is dispensing from existing balance or minting new tokens.
|
||||
|
||||
The value dispersed @emph{must} be the same for all addresses.
|
||||
|
||||
In general, four criteria are expected to exist in any combination for limiting access to the faucet:
|
||||
|
||||
@table @dfn
|
||||
@item Time
|
||||
A recipient may only use the faucet again after some time has passed.
|
||||
@item Balance threshold
|
||||
A recipient may only use the faucet after its balance is below a certain amount.
|
||||
@item Membership
|
||||
A recipient may only use the faucet if it has been added to an access control list.
|
||||
@item Capacity
|
||||
The contract has sufficient token funds to dispense the current defined amount to dispense.
|
||||
@end table
|
||||
|
||||
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
|
||||
@include ../../build/Faucet.interface
|
||||
@item Solidity interface definition
|
||||
@include ../../build/contract_Faucet.texi
|
||||
@item Reference implementations
|
||||
@itemize
|
||||
@item
|
||||
@uref{git://holbrook.no/erc20-faucet.git,}
|
||||
@item
|
||||
@uref{git://holbrook.no/eth-faucet.git,}
|
||||
@end itemize
|
||||
@end table
|
58
doc/texinfo/locator.sol.texi
Normal file
58
doc/texinfo/locator.sol.texi
Normal file
@ -0,0 +1,58 @@
|
||||
@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
|
||||
@end table
|
||||
|
||||
|
||||
@subsubsection Expressing locators in terms of numetic token id
|
||||
|
||||
Given the numeric token id @code{1234567890987654321}, and a base url @code{https://contentgateway.grassecon.net}, the result of the methods may be as follows:
|
||||
|
||||
@table @code
|
||||
@item toURI(000000000000000000000000000000000000000000000000112210f4b16c1cb1)
|
||||
-> @code{https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1}
|
||||
@item toURL(000000000000000000000000000000000000000000000000112210f4b16c1cb1)
|
||||
-> @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
|
14
doc/texinfo/minter.sol.texi
Normal file
14
doc/texinfo/minter.sol.texi
Normal file
@ -0,0 +1,14 @@
|
||||
@subsection Minter
|
||||
|
||||
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
|
||||
@include ../../build/Minter.interface
|
||||
@item Solidity interface definition
|
||||
@include ../../build/contract_Minter.texi
|
||||
@item Example implementation
|
||||
@uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git}
|
||||
@end table
|
15
doc/texinfo/msg.sol.texi
Normal file
15
doc/texinfo/msg.sol.texi
Normal file
@ -0,0 +1,15 @@
|
||||
@subsection Msg
|
||||
|
||||
Enables a reference "message" to describe the contract using an off-chain resource.
|
||||
|
||||
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
|
||||
@include ../../build/Msg.interface
|
||||
@item Solidity interface definition
|
||||
@include ../../build/contract_Msg.texi
|
||||
@end table
|
25
doc/texinfo/multihash.sol.texi
Normal file
25
doc/texinfo/multihash.sol.texi
Normal file
@ -0,0 +1,25 @@
|
||||
@subsection Multihash
|
||||
|
||||
A complement to @code{Locator}, enabling validation and generation for multihashes 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
|
59
doc/texinfo/old.texi
Normal file
59
doc/texinfo/old.texi
Normal file
@ -0,0 +1,59 @@
|
||||
@subsection Auxiliary contracts
|
||||
|
||||
All other Smart Contracts in the network other than CICRegistry are essentially optional, and each applies @emph{at least one} the interfaces defined in the @code{cic-contracts} repository.
|
||||
|
||||
|
||||
@subsection Contract interfaces
|
||||
|
||||
All contracts interfaces also implement the @strong{EIP165} Standard Interface Detection.
|
||||
|
||||
|
||||
@subsubsection Registry
|
||||
|
||||
A key-value store, which resolves arbitrary 32-byte pointers to Ethereum addresses. Typically, this is used to resolve an address from a well-known identifier, either as a UTF-8 value or a 256-bit hash.
|
||||
|
||||
It also provides numerical index access to all registered values in order of insertion.
|
||||
|
||||
|
||||
@subsubsection Registry Client
|
||||
|
||||
A subset of the @code{Registry} interface, which defines only the non-transactional methods of the contract. The @code{Registry Client} interface is implemented by the @code{CICRegistry} contract.
|
||||
|
||||
|
||||
@subsubsection Faucet
|
||||
|
||||
Enables disbursement of a set amount of tokens to a requesting address.
|
||||
|
||||
Allows privileged accounts to adjust the amount of tokens to disburse.
|
||||
|
||||
Can be implemented as a periodic or a one-time service per account.
|
||||
|
||||
|
||||
@subsubsection Transfer approval
|
||||
|
||||
Enables a third-party approval to spend an ERC20 token allowance.
|
||||
|
||||
This is useful in the case of a custodial key store, where a transaction has been initiated by another entity than the owner of the key.
|
||||
|
||||
The contract allows the third-party address to either allow or reject the transfer.
|
||||
|
||||
|
||||
@subsubsection Declarator
|
||||
|
||||
Stores one or more 32-byte entries as a description of an Ethereum address, @emph{signed} by another Ethereum address.
|
||||
|
||||
This can be used to @emph{describe} network resources, be it tokens, contracts or user accounts. Examples of uses are KYC documentation proofs for users, token metadata used for display, or fraud alerts.
|
||||
|
||||
Entries are stored by the transacting address that adds address/description pairs. In other words, any address may have different "opinions" registered about it, depending on which signing address it is queried in the context of. This, in turn, allows the quering entity to compile its own "opinion" of an address by combining data from signatures it trusts.
|
||||
|
||||
Entries typically are text strings or content hashes.
|
||||
|
||||
|
||||
@subsubsection Address Index
|
||||
|
||||
A simple append-only list of addresses. Used to check whether an address is part of a particular group.
|
||||
|
||||
|
||||
@subsubsection DEX Index
|
||||
|
||||
Methods required to convert between tokens.
|
@ -2,75 +2,59 @@
|
||||
@chapter Smart contract interfaces
|
||||
|
||||
|
||||
@section Smart Contracts in the CIC Network
|
||||
|
||||
@subsection Technology
|
||||
@section Technology
|
||||
|
||||
The long-term aim of the CIC network is to be agnostic of consensus engines. However, since we have to start @emph{somewhere}, the current state of development only deals with Smart Contracts on the (Ethereum Virtual Machine (EVM).
|
||||
CIC smart contracts are implemented using the @emph{solidity} programming language for the (Ethereum Virtual Machine (EVM).
|
||||
|
||||
|
||||
@subsection The registry contract
|
||||
@section Inherited ERC definitions
|
||||
|
||||
The CICRegistry contract defines the entry-point to the entire CIC network. All other CIC network resources can be discovered through this contract.
|
||||
@subsection Direct use
|
||||
|
||||
Its implementation is contained in the @file{cic-registry} repository. Details about it are documented further in that section.
|
||||
The following well-known solidity interfaces are used directly.
|
||||
|
||||
@subsection Auxiliary contracts
|
||||
|
||||
All other Smart Contracts in the network other than CICRegistry are essentially optional, and each applies @emph{at least one} the interfaces defined in the @code{cic-contracts} repository.
|
||||
@itemize @bullet
|
||||
@item
|
||||
@uref{https://eips.ethereum.org/EIPS/eip-20, ERC20 - Token Standard}
|
||||
@item
|
||||
@uref{https://eips.ethereum.org/EIPS/eip-165, ERC165 - Standard Interface Detection}
|
||||
@item
|
||||
@uref{https://eips.ethereum.org/EIPS/eip-173, ERC173 - Contract Ownership Standard}
|
||||
@item
|
||||
@uref{https://eips.ethereum.org/EIPS/eip-721, ERC721 - Non-Fungible Token Standard}
|
||||
@end itemize
|
||||
|
||||
|
||||
@subsection Contract interfaces
|
||||
@subsection Extended ERC definitions
|
||||
|
||||
All contracts interfaces also implement the @strong{EIP165} Standard Interface Detection.
|
||||
@itemize @dfn
|
||||
@item
|
||||
@uref{https://eips.ethereum.org/EIPS/eip-5679, ERC5679 - Token Minting and Burning} (See @code{Minter}, @code{Burner})
|
||||
@end itemize
|
||||
|
||||
|
||||
@subsubsection Registry
|
||||
@section Native implementations
|
||||
|
||||
A key-value store, which resolves arbitrary 32-byte pointers to Ethereum addresses. Typically, this is used to resolve an address from a well-known identifier, either as a UTF-8 value or a 256-bit hash.
|
||||
@include accountsindex.sol.texi
|
||||
|
||||
It also provides numerical index access to all registered values in order of insertion.
|
||||
@include burner.sol.texi
|
||||
|
||||
@include declarator.sol.texi
|
||||
|
||||
@subsubsection Registry Client
|
||||
@include expire.sol.texi
|
||||
|
||||
A subset of the @code{Registry} interface, which defines only the non-transactional methods of the contract. The @code{Registry Client} interface is implemented by the @code{CICRegistry} contract.
|
||||
@include faucet.sol.texi
|
||||
|
||||
@include locator.sol.texi
|
||||
|
||||
@subsubsection Faucet
|
||||
@include minter.sol.texi
|
||||
|
||||
Enables disbursement of a set amount of tokens to a requesting address.
|
||||
@include msg.sol.texi
|
||||
|
||||
Allows privileged accounts to adjust the amount of tokens to disburse.
|
||||
@include multihash.sol.texi
|
||||
|
||||
Can be implemented as a periodic or a one-time service per account.
|
||||
@include registry.sol.texi
|
||||
|
||||
@include writer.sol.texi
|
||||
|
||||
@subsubsection Transfer approval
|
||||
|
||||
Enables a third-party approval to spend an ERC20 token allowance.
|
||||
|
||||
This is useful in the case of a custodial key store, where a transaction has been initiated by another entity than the owner of the key.
|
||||
|
||||
The contract allows the third-party address to either allow or reject the transfer.
|
||||
|
||||
|
||||
@subsubsection Declarator
|
||||
|
||||
Stores one or more 32-byte entries as a description of an Ethereum address, @emph{signed} by another Ethereum address.
|
||||
|
||||
This can be used to @emph{describe} network resources, be it tokens, contracts or user accounts. Examples of uses are KYC documentation proofs for users, token metadata used for display, or fraud alerts.
|
||||
|
||||
Entries are stored by the transacting address that adds address/description pairs. In other words, any address may have different "opinions" registered about it, depending on which signing address it is queried in the context of. This, in turn, allows the quering entity to compile its own "opinion" of an address by combining data from signatures it trusts.
|
||||
|
||||
Entries typically are text strings or content hashes.
|
||||
|
||||
|
||||
@subsubsection Address Index
|
||||
|
||||
A simple append-only list of addresses. Used to check whether an address is part of a particular group.
|
||||
|
||||
|
||||
@subsubsection DEX Index
|
||||
|
||||
Methods required to convert between tokens.
|
||||
|
23
doc/texinfo/registry.sol.texi
Normal file
23
doc/texinfo/registry.sol.texi
Normal file
@ -0,0 +1,23 @@
|
||||
@subsection Registry
|
||||
|
||||
The Registry interface is a key-value store resolving well-known contract identifier names to contract addresses.
|
||||
|
||||
It currently has two distinct uses in the CIC context:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Entry-point to discover all relevant contracts of CIC networks.
|
||||
@item
|
||||
Unique (ERC20) token symbol resolver.
|
||||
@end enumerate
|
||||
|
||||
@table @dfn
|
||||
@item ERC165 Interface identifier
|
||||
@include ../../build/RegistryClient.interface
|
||||
@item Solidity interface definition
|
||||
@include ../../build/contract_RegistryClient.texi
|
||||
@item Reference implementation
|
||||
@uref{git://holbrook.no/eth-contract-registry.git,}
|
||||
@item Token index implementation
|
||||
@uref{git://holbrook.no/eth-contract-registry.git,}
|
||||
@end table
|
25
doc/texinfo/writer.sol.texi
Normal file
25
doc/texinfo/writer.sol.texi
Normal file
@ -0,0 +1,25 @@
|
||||
@subsection Writer
|
||||
|
||||
A complement to ERC173, which allows definition of a class of super-users for a contract.
|
||||
|
||||
Typically, a super-user address may perform @emph{more} actions than a "normal" address, aswell as @emph{some} actions normally limited to the @emph{contract owner}.
|
||||
|
||||
Typically, only the @emph{contract owner} can add or remove a super-user.
|
||||
|
||||
Some use-case examples of super-user actions include:
|
||||
|
||||
@itemize
|
||||
@item
|
||||
Mint new tokens.
|
||||
@item
|
||||
Change the amount dispensed by the faucet.
|
||||
@item
|
||||
Edit access control lists.
|
||||
@end itemize
|
||||
|
||||
@table @dfn
|
||||
@item ERC165 Interface identifier
|
||||
@include ../../build/Writer.interface
|
||||
@item Solidity interface definition
|
||||
@include ../../build/contract_Writer.texi
|
||||
@end table
|
@ -1,29 +1,40 @@
|
||||
pragma solidity >=0.6.12;
|
||||
|
||||
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// File-version: 4
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
// File-version: 5
|
||||
|
||||
interface AddressIndex {
|
||||
interface AccountsIndex {
|
||||
event AddressAdded(address indexed addedAccount, uint256 indexed accountIndex); // AccountsIndex
|
||||
event AddressActive(address indexed _executor, address indexed _account, bool _active);
|
||||
event AddressRemoved(address indexed _executor, address _account);
|
||||
|
||||
// Return number of entries in index
|
||||
function entryCount() external view returns (uint256);
|
||||
|
||||
// Return entry at the spceificed index
|
||||
// Will revert if index is beyond array length.
|
||||
// An entry result of
|
||||
function entry(uint256) external view returns (address);
|
||||
|
||||
// Add an entry to the index. Incresases the entry count.
|
||||
function add(address) external returns (bool);
|
||||
|
||||
// Remove an entry from the index. Reduces the entry count.
|
||||
function remove(address) external returns (bool);
|
||||
|
||||
// Verify that the entry exists in the index
|
||||
function have(address) external view returns (bool);
|
||||
|
||||
// Deactivate account but keep in index. Does not affect entry count.
|
||||
function deactivate(address) external returns (bool);
|
||||
|
||||
// Activate previously deactivated account. Does not affect entry count.
|
||||
function activate(address) external returns (bool);
|
||||
|
||||
// Check if account exists and is active;
|
||||
function isActive(address) external view returns (bool);
|
||||
|
||||
// Retrieve the timestamp when account was added
|
||||
function time(address) external view returns (uint256);
|
||||
}
|
||||
|
@ -2,13 +2,25 @@ pragma solidity >=0.6.12;
|
||||
|
||||
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// File-version: 2
|
||||
// File-version: 3
|
||||
|
||||
interface Burner {
|
||||
event Burn(uint256 _burned);
|
||||
// Token(s) successfully burned; by who and how much.
|
||||
event Burn(address indexed _burner, uint256 _burned);
|
||||
|
||||
// Satisfies ERC 5679
|
||||
function burn(address _from, uint256 _amount, bytes calldata _data) external;
|
||||
|
||||
// Burn given amount of tokens held by signer.
|
||||
function burn(uint256 _burn) external returns (bool);
|
||||
|
||||
// Burn all tokens held by signer.
|
||||
function burn() external returns (bool);
|
||||
|
||||
// Total amount of tokens that have been burned.
|
||||
function totalBurned() external returns (uint256);
|
||||
|
||||
// Total amount of tokens ever minted.
|
||||
// If totalSupply() is available (ERC20, ERC721 Enumerable), this equals totalSupply() + totalBurned().
|
||||
function totalMinted() external returns (uint256);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
pragma solidity >=0.6.12;
|
||||
|
||||
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
// File-version: 3
|
||||
|
||||
interface Declarator {
|
||||
@ -9,18 +9,25 @@ interface Declarator {
|
||||
|
||||
// Get all declarations for a subject (without topic) signed by a declarator
|
||||
function declaration(address _declarator, address _subject) external view returns ( bytes32[] memory );
|
||||
|
||||
// Get all declarations for a subject for the given topic signed by a declarator
|
||||
function declaration(address _declarator, address _subject, bytes32 _topic) external view returns ( bytes32[] memory );
|
||||
|
||||
// Get number of declarations the declarator has ever signed
|
||||
function declarationCount(address _declarator) external view returns ( uint256 );
|
||||
|
||||
// Get the subject of a declarator's declarations at the specific index
|
||||
function declarationAddressAt(address _declarator, uint256 _idx) external view returns ( address );
|
||||
|
||||
// Add a declaration for the subject
|
||||
function addDeclaration(address _subject, bytes32 _proof) external returns ( bool );
|
||||
|
||||
// Add a declaration with topic for the subject
|
||||
function addDeclaration(address _subject, bytes32 _proof, bytes32 _topic) external returns ( bool );
|
||||
|
||||
// Get the declarator that signed a declaration at the specificed index for a subject
|
||||
function declaratorAddressAt(address _subject, uint256 _idx) external view returns ( address );
|
||||
|
||||
// Get the number of declarators that have signed for a subject
|
||||
function declaratorCount(address _subject) external view returns ( uint256 );
|
||||
}
|
||||
|
@ -5,7 +5,9 @@ pragma solidity >=0.6.12;
|
||||
// File-version: 2
|
||||
|
||||
interface Expire {
|
||||
// Expiration timestamp has been changed.
|
||||
event Expired(uint256 _timestamp);
|
||||
|
||||
// The current expiration timestamp.
|
||||
function expires() external returns (uint256);
|
||||
}
|
||||
|
@ -5,20 +5,35 @@ pragma solidity >=0.6.12;
|
||||
// File-version: 6
|
||||
|
||||
interface Faucet {
|
||||
// Tokens were given to an address
|
||||
event Give(address indexed _recipient, address indexed _token, uint256 _value);
|
||||
|
||||
// The amount that the faucet disperses has changed
|
||||
event FaucetAmountChange(uint256 _value);
|
||||
|
||||
// Address of token the faucet represents
|
||||
// The faucet will return gas tokens with the zero-address is returned.
|
||||
function token() external returns (address);
|
||||
|
||||
// Amount of tokens the faucet gives out
|
||||
function tokenAmount() external returns (uint256);
|
||||
|
||||
// Give tokens to the given recipient. Returns amount of tokens given.
|
||||
function giveTo(address _recipient) external returns (uint256);
|
||||
|
||||
// Give tokens to yourself. Returns amount of tokens given.
|
||||
function gimme() external returns (uint256);
|
||||
|
||||
// Check if faucet may be used in the current contract state by _recipient
|
||||
function check(address _recipient) external view returns (bool);
|
||||
|
||||
// Returns timestamp when faucet may be used again by _recipient
|
||||
// If 0 is returned, the address has not yet been used.
|
||||
// A return value of max(uint256) indicates that the faucet may not be used again.
|
||||
function nextTime(address _recipient) external returns (uint256);
|
||||
|
||||
// Returns the token balance under which faucet may be used again by _recipient
|
||||
// A return value of max(uint256) indicates that the faucet may be used regardless
|
||||
// of the token balance of _recipient
|
||||
function nextBalance(address _recipient) external returns (uint256);
|
||||
}
|
||||
|
13
solidity/Locator.sol
Normal file
13
solidity/Locator.sol
Normal file
@ -0,0 +1,13 @@
|
||||
pragma solidity >=0.6.12;
|
||||
|
||||
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// File-version: 3
|
||||
|
||||
interface ILocator {
|
||||
// URI that may or may not point to a specific resource location
|
||||
function toURI(bytes memory _data) external view returns (string memory);
|
||||
|
||||
// URL pointing to a specific resource location
|
||||
function toURL(bytes memory _data) external view returns(string memory);
|
||||
}
|
@ -2,11 +2,18 @@ pragma solidity >=0.6.12;
|
||||
|
||||
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// File-version: 1
|
||||
// File-version: 2
|
||||
|
||||
interface Minter {
|
||||
// Tokens are successfully minted; by who, to whom and how much
|
||||
event Mint(address indexed _minter, address indexed _beneficiary, uint256 value);
|
||||
|
||||
// Mint the specified value of tokens to the specified recipient
|
||||
function mintTo(address _beneficiary, uint256 value) external returns (bool);
|
||||
|
||||
// Satisfies ERC5679 for ERC20
|
||||
function mint(address _beneficiary, uint256 value, bytes calldata _data) external;
|
||||
|
||||
// Satisfies ERC5679 for ERC721
|
||||
function safeMint(address _beneficiary, uint256 value, bytes calldata _data) external;
|
||||
}
|
||||
|
14
solidity/Msg.sol
Normal file
14
solidity/Msg.sol
Normal file
@ -0,0 +1,14 @@
|
||||
pragma solidity >=0.6.12;
|
||||
|
||||
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
// File-version: 2
|
||||
|
||||
interface IMsg {
|
||||
// Emitted when a new message digest has been set
|
||||
// Should not be emitted if the digest set is identical to the previous
|
||||
event Msg(bytes _msgDigest);
|
||||
|
||||
// Get the current message content hash
|
||||
function getMsg() external view returns(bytes memory);
|
||||
}
|
22
solidity/MultiHash.sol
Normal file
22
solidity/MultiHash.sol
Normal file
@ -0,0 +1,22 @@
|
||||
pragma solidity >=0.6.12;
|
||||
|
||||
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// File-version: 2
|
||||
|
||||
interface IMultiHash {
|
||||
// Represents a multicodec item.
|
||||
struct MultiHash {
|
||||
uint8 l;
|
||||
uint8 codecRLength;
|
||||
uint8 prefixRLength;
|
||||
bytes16 prefix;
|
||||
bytes8 codec;
|
||||
}
|
||||
|
||||
// All registered multicodecs
|
||||
function multiCodec(uint256 _codec) external view returns(MultiHash memory);
|
||||
|
||||
// Generate a multihash from the given digest and current selected multicodec
|
||||
function toMultiHash(uint256 _codec, bytes memory _digest) external view returns(bytes memory);
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
pragma solidity >=0.6.12;
|
||||
|
||||
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// File-version: 2
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
// File-version: 3
|
||||
|
||||
interface Registry {
|
||||
function set(bytes32, address) external returns (bool);
|
||||
|
@ -1,10 +1,16 @@
|
||||
pragma solidity >=0.6.12;
|
||||
|
||||
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// File-version: 2
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
// File-version: 3
|
||||
|
||||
interface RegistryClient {
|
||||
// Return the address of the contract identified by the given byte string
|
||||
function addressOf(bytes32) external view returns (address);
|
||||
|
||||
// Indexed accessor for the full list of registred identifiers
|
||||
function identifiers(uint256) external view returns (bytes32);
|
||||
|
||||
// Number of registered interfaces
|
||||
function identifierCount() external view returns (uint256);
|
||||
}
|
||||
|
@ -5,10 +5,18 @@ pragma solidity >=0.6.12;
|
||||
// File-version: 2
|
||||
|
||||
interface Writer {
|
||||
// A writer has been added by _executor
|
||||
event WriterAdded(address indexed _executor, address _writer);
|
||||
|
||||
// A writer has been removed by _executor
|
||||
event WriterDeleted(address indexed _executor, address _writer);
|
||||
|
||||
// Add a new writer to the contract.
|
||||
function addWriter(address _writer) external returns (bool);
|
||||
|
||||
// Remove existing writer from the contract.
|
||||
function deleteWriter(address _writer) external returns (bool);
|
||||
|
||||
// Check whether the given address is a writer.
|
||||
function isWriter(address _writer) external returns (bool);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user