Compare commits
39 Commits
Author | SHA1 | Date |
---|---|---|
lash | b1c03932ad | |
lash | db35d389ec | |
lash | b9a29b7827 | |
lash | 48d69ce74c | |
lash | 9df26634fd | |
lash | da5d7d9d2d | |
lash | f9d2af2e3b | |
lash | e3d0704d4f | |
lash | 80671fdfaa | |
lash | 0fba11aeaf | |
lash | a7cc695045 | |
lash | 64e8df2573 | |
lash | 45ca79cf46 | |
lash | fe4f1c2c41 | |
lash | 80589e574a | |
lash | 5ff686e513 | |
lash | 6aa0319407 | |
lash | a7b0858baa | |
lash | 6f44c8304f | |
lash | 993d52ecab | |
lash | 02aa54f653 | |
lash | 360a288d77 | |
lash | ef3ee7caf0 | |
lash | 220b8afbeb | |
lash | c10d2c46f1 | |
lash | 3edc8bf021 | |
lash | 2c666cc2aa | |
lash | 2eba8c6254 | |
lash | c2c9581dab | |
lash | b3f6e45696 | |
lash | 1e11d8df08 | |
lash | 46cc35b54c | |
lash | a28cfdbb36 | |
lash | 0877fe7769 | |
lash | 8507f202e7 | |
lash | 0f2cc2d232 | |
lash | 99dce60a97 | |
William Luke | ba3e6e047f | |
William Luke | 105f85be1c |
|
@ -3,3 +3,7 @@ gmon.out
|
|||
dist
|
||||
build
|
||||
*.egg-info
|
||||
.venv
|
||||
solidity/*.json
|
||||
solidity/*.interface
|
||||
solidity/*.bin
|
||||
|
|
10
CHANGELOG
10
CHANGELOG
|
@ -1,7 +1,9 @@
|
|||
- 0.2.0
|
||||
- Bump chainlib-eth>=0.3.0,<0.4.0
|
||||
- 0.0.3
|
||||
* Update contracts to cic-base state 0.1.2-beta.5
|
||||
* Add interface digest generator script
|
||||
- Update contracts to cic-base state 0.1.2-beta.5
|
||||
- Add interface digest generator script
|
||||
- 0.0.2
|
||||
* Add token endorser contract
|
||||
- Add token endorser contract
|
||||
- 0.0.1
|
||||
* Consolidate all existing contract interfaces
|
||||
- Consolidate all existing contract interfaces
|
||||
|
|
28
Makefile
28
Makefile
|
@ -6,7 +6,7 @@ INPUTS = $(wildcard solidity/*.sol)
|
|||
OUTPUTS_JSON = $(patsubst %.sol, %.json, $(INPUTS))
|
||||
OUTPUTS_INTERFACE = $(patsubst %.sol, %.interface, $(INPUTS))
|
||||
OUTPUTS = $(OUTPUTS_JSON) $(OUTPUTS_INTERFACE)
|
||||
PREFIX = /usr/local/share/cic/solidity/abi
|
||||
PREFIX = $(DESTDIR)/usr/local/share/cic/solidity/abi
|
||||
|
||||
#%.abi.json: $(wildcard *.sol)
|
||||
# install -vDm0644 $@ $(PREFIX)/$@
|
||||
|
@ -19,14 +19,36 @@ 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
|
||||
|
||||
readme:
|
||||
make -C doc/texinfo readme
|
||||
pandoc -f docbook -t gfm doc/texinfo/build/docbook.xml > README.md
|
||||
cp -v README.md python/README.md
|
||||
|
||||
python: outs
|
||||
mkdir -vp python/cic_contracts/data
|
||||
cp -v solidity/*.interface python/cic_contracts/data
|
||||
cp -v solidity/*.json python/cic_contracts/data
|
||||
make -C python
|
||||
|
||||
.PHONY: clean install
|
||||
|
|
|
@ -0,0 +1,974 @@
|
|||
# Smart contract interfaces
|
||||
|
||||
## Technology
|
||||
|
||||
CIC smart contracts are implemented using the *solidity* programming
|
||||
language for the (Ethereum Virtual Machine (EVM).
|
||||
|
||||
## Adopted standards
|
||||
|
||||
### Signing
|
||||
|
||||
### ERC - Direct use
|
||||
|
||||
The following well-known solidity interfaces are used directly.
|
||||
|
||||
- [ERC20 - Token Standard](https://eips.ethereum.org/EIPS/eip-20)
|
||||
|
||||
- [ERC165 - Standard Interface
|
||||
Detection](https://eips.ethereum.org/EIPS/eip-165)
|
||||
|
||||
- [ERC173 - Contract Ownership
|
||||
Standard](https://eips.ethereum.org/EIPS/eip-173)
|
||||
|
||||
- [ERC191 - Signed Data
|
||||
Standard](https://eips.ethereum.org/EIPS/eip-191)
|
||||
|
||||
- [ERC712 - Typed structured data hashing and
|
||||
signing](https://eips.ethereum.org/EIPS/eip-712)
|
||||
|
||||
- [ERC721 - Non-Fungible Token
|
||||
Standard](https://eips.ethereum.org/EIPS/eip-721)
|
||||
|
||||
- [ERC5007 - Time NFT (EIP-721 Time
|
||||
Extension)](https://eips.ethereum.org/EIPS/eip-5007)
|
||||
|
||||
- [ERC5192 - Minimal Soulbound
|
||||
NFTs](https://eips.ethereum.org/EIPS/eip-5192)
|
||||
|
||||
### ERCs Partial use
|
||||
|
||||
The following well-known solidity interfaces are partially implemented
|
||||
in CIC native interfaces.
|
||||
|
||||
- [ERC5679 - Token Minting and
|
||||
Burning](https://eips.ethereum.org/EIPS/eip-5679) (See `Minter`,
|
||||
`Burner`)
|
||||
|
||||
## Native interfaces
|
||||
|
||||
### ACL
|
||||
|
||||
A simple Access Control List definition that returns true of false
|
||||
depending on whether an signatory (address) is allowed to operate in a
|
||||
given context.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
3ef25013
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IACL {
|
||||
// Returns true if the address has permission to operate in the given context.
|
||||
function have(address _address) external view returns(bool);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<git://holbrook.no/eth-accounts-index.git>
|
||||
|
||||
### Accounts Index
|
||||
|
||||
Append-only list of addresses. Typically used for access control lists.
|
||||
|
||||
Addresses may be *added*, *removed*, aswell as *deactivated* and
|
||||
*activated*. Deactivated accounts still count towards the `entryCount`.
|
||||
|
||||
The `entry` method is used to iterate the account list. The order of
|
||||
which accounts are returned is not guaranteed. Any returned value
|
||||
matching `address(0x00)` should be skipped, and not counted towards
|
||||
`entryCount`.
|
||||
|
||||
May optionally record time when account was added.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
b7bca625
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IAccountsIndex {
|
||||
// Address added to store, index in array.
|
||||
event AddressAdded(uint256 indexed _idx, 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 0 means the entry should be skipped, and not count towards entry count.
|
||||
function entry(uint256) external view returns (address);
|
||||
|
||||
// Add an entry to the index. Incresases the entry count.
|
||||
function add(address) external returns (bool);
|
||||
|
||||
// Verify that the entry exists in the index.
|
||||
// Implements ACL
|
||||
function have(address) external view returns (bool);
|
||||
|
||||
// Retrieve the timestamp when account was added.
|
||||
// If time is not being tracked, a value of 0 should be returned.
|
||||
function time(address) external view returns (uint256);
|
||||
}
|
||||
|
||||
#### Reference implementation
|
||||
|
||||
<git://holbrook.no/eth-accounts-index.git> (v0.5.1)
|
||||
|
||||
### Accounts Index Mutable
|
||||
|
||||
Extends the functionality of `Accounts Index` to allow changes to the
|
||||
address list.
|
||||
|
||||
Addresses may be *added*, *removed*, aswell as *deactivated* and
|
||||
*activated*. Deactivated accounts still count towards the `entryCount`.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
9479f0ae
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IAccountsIndexMutable {
|
||||
// Active status of address changed, and by whom changed.
|
||||
event AddressActive(address indexed _account, bool _active);
|
||||
|
||||
// Address removed from store, and by whom removed.
|
||||
event AddressRemoved(address _account);
|
||||
|
||||
// Remove an entry from the index. Reduces the entry count.
|
||||
function remove(address) external 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);
|
||||
}
|
||||
|
||||
#### Reference implementation
|
||||
|
||||
<git://holbrook.no/eth-accounts-index.git> (v0.5.1)
|
||||
|
||||
### Burner
|
||||
|
||||
Attached to `ERC20` and `ERC721` tokens that may be *burned*.
|
||||
|
||||
Implements the `burn(...)` part of `ERC5679` for interoperability.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
b1110c1b
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IBurner {
|
||||
// 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 _amount) external returns (bool);
|
||||
|
||||
// Burn all tokens held by signer.
|
||||
// Returns the amount of tokens burned.
|
||||
function burn() external returns (uint256);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
|
||||
|
||||
### Chrono
|
||||
|
||||
Define a creation time for a resource.
|
||||
|
||||
Complements `ERC5007`.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
4db1ccd4
|
||||
|
||||
#### 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
|
||||
|
||||
<https://git.defalsify.org/eth-erc721> (BadgeToken contract)
|
||||
|
||||
### 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 value of `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.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
21b7493b
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IDeclarator {
|
||||
event DeclarationAdded(address indexed _declarator, address indexed _subject, bytes32 indexed _topic, bytes32 _proof);
|
||||
|
||||
// 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 );
|
||||
}
|
||||
|
||||
#### Reference implementation
|
||||
|
||||
<git://holbrook.no/eth-address-index.git>
|
||||
|
||||
### Digest
|
||||
|
||||
Allows encoding of digests according to a specific encoding scheme.
|
||||
|
||||
Primary use-case is the abstraction of self-describing
|
||||
[Multhash](https://multiformats.io/multihash/) encoding.
|
||||
|
||||
A default encoding *must* always be defined, and the encoding of a valid
|
||||
digest *must* succeed with the default encoding.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
982ab05d
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IDigest {
|
||||
// Returns the default digest encoding used by the contract instance.
|
||||
function defaultDigestEncoding() external view returns (uint256 _encoding);
|
||||
|
||||
// Check if the given encoding has been implemented in the contract instance.
|
||||
function haveDigestEncoding(uint256 _codec) external view returns(bool);
|
||||
|
||||
// Verify and encode the given digest for a specific hashing algorithm.
|
||||
// Returns a zero-length byte array if digest is invalid.
|
||||
// Must succeed if called with the defaultDigestEncoding and a valid digest.
|
||||
function encodeDigest(bytes memory _data, uint256 _encoding) external view returns (bytes memory);
|
||||
|
||||
// Encodes the digest using the default digest encoding.
|
||||
// Returns a zero-length byte array if digest is invalid.
|
||||
// Must succeed with a valid digest.
|
||||
function encodeDigest(bytes memory _data) external view returns (bytes memory);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<git://holbrook.no/eth-event-msg.git>
|
||||
|
||||
### Expire
|
||||
|
||||
Defines an expiry time after which token balances and supply *cannot
|
||||
change*.
|
||||
|
||||
A contract defining an expiry *must not* allow changing the expiration
|
||||
time to a time in the past.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
841a0e94
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IExpire {
|
||||
// Contract has expired.
|
||||
event Expired(uint256 _timestamp);
|
||||
|
||||
// Expiry time has changed.
|
||||
event ExpiryChange(uint256 indexed _oldTimestamp, uint256 _newTimestamp);
|
||||
|
||||
// The current expiration timestamp.
|
||||
function expires() external returns (uint256);
|
||||
|
||||
// Check expiry and apply expiration if expired.
|
||||
// Return values must be:
|
||||
// 0: not yet expired.
|
||||
// 1: already expired.
|
||||
// >1: expiry executed.
|
||||
function applyExpiry() external returns(uint8);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
|
||||
|
||||
### Faucet
|
||||
|
||||
Used for dispensing tokens to any address.
|
||||
|
||||
It can be used for gas tokens and *ERC20* alike.
|
||||
|
||||
The interface is the same whether the faucet is dispensing from existing
|
||||
balance or minting new tokens.
|
||||
|
||||
The value dispersed *must* be the same for all addresses.
|
||||
|
||||
In general, four criteria are expected to exist in any combination for
|
||||
limiting access to the faucet:
|
||||
|
||||
Time
|
||||
A recipient may only use the faucet again after some time has passed.
|
||||
|
||||
Balance threshold
|
||||
A recipient may only use the faucet after its balance is below a certain
|
||||
amount.
|
||||
|
||||
Membership
|
||||
A recipient may only use the faucet if it has been added to an access
|
||||
control list.
|
||||
|
||||
Capacity
|
||||
The contract has sufficient token funds to dispense the current defined
|
||||
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
|
||||
|
||||
1a3ac634
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IFaucet {
|
||||
// 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);
|
||||
}
|
||||
|
||||
#### Reference implementations
|
||||
|
||||
- <git://holbrook.no/erc20-faucet.git>
|
||||
|
||||
- <git://holbrook.no/eth-faucet.git>
|
||||
|
||||
### Locator
|
||||
|
||||
This interface supports `ERC721 Metadata`, in particular the
|
||||
`tokenURI(uint256)` call.
|
||||
|
||||
Off-chain resources in the CIC network *must* be defined in terms of
|
||||
content addressed strings.
|
||||
|
||||
It *must* be possible to refer to all off-chain resources directly by
|
||||
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
|
||||
|
||||
ed75b333
|
||||
|
||||
#### 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);
|
||||
|
||||
// URL pointing to a specific resource location.
|
||||
function toURL(bytes memory _data) external view returns(string memory);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<git://holbrook.no/eth-event-msg.git>
|
||||
|
||||
#### 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
|
||||
of the methods may be as follows:
|
||||
|
||||
`toURI(toHex(1234567890987654321))`
|
||||
-\>
|
||||
`https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1`
|
||||
|
||||
`toURL(toHex(1234567890987654321))`
|
||||
-\>
|
||||
`https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1`
|
||||
|
||||
`tokenURI(1234567890987654321)`
|
||||
-\>
|
||||
`https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1`
|
||||
|
||||
#### Expressing locators in terms of a digest
|
||||
|
||||
Given the data `foo`, the digest algorithm `sha256` and a base url
|
||||
`https://contentgateway.grassecon.net`, the result of the methods may be
|
||||
as follows:
|
||||
|
||||
`toURI(sha256(foo))`
|
||||
-\>
|
||||
`"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
|
||||
|
||||
`toURL(sha256(foo))`
|
||||
-\>
|
||||
`"https://contentgateway.grassecon.net/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
|
||||
|
||||
`tokenURI(toUint(sha256(foo)))`
|
||||
-\>
|
||||
`"https://contentgateway.grassecon.net/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
|
||||
|
||||
#### Locator without URL
|
||||
|
||||
Given the data `foo`, the digest algorithm `sha256` and no base url, the
|
||||
result of the methods may be as follows:
|
||||
|
||||
`toURI(sha256(foo))`
|
||||
-\>
|
||||
`"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
|
||||
|
||||
`toURL(sha256(foo))`
|
||||
-\> `""`
|
||||
|
||||
`tokenURI(toUint(sha256(foo)))`
|
||||
-\>
|
||||
`"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
|
||||
|
||||
### Minter
|
||||
|
||||
Attached to `ERC20` and `ERC721` tokens that may be minted.
|
||||
|
||||
Implements the `mint(...)` and `safeMint(...)` parts of `ERC5679` for
|
||||
interoperability.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
5878bcf4
|
||||
|
||||
#### 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);
|
||||
|
||||
// The given token has been successfully minted; by who, to whom and how much
|
||||
event Mint(address indexed _minter, address indexed _beneficiary, address indexed _token, 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;
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
|
||||
|
||||
### 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 `Locator` and `MultiHash` to generate locators
|
||||
for how to resolve the reference.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
a3002595
|
||||
|
||||
#### 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
|
||||
event Msg(bytes _msgDigest);
|
||||
|
||||
// Get the current message content hash
|
||||
function getMsg() external view returns(bytes memory);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<git://holbrook.no/eth-event-msg.git>
|
||||
|
||||
### 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:
|
||||
|
||||
1. Entry-point to discover all relevant contracts of CIC networks.
|
||||
|
||||
2. Unique (ERC20) token symbol resolver.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
effbf671
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IRegistryClient {
|
||||
// Address added to store with the given key
|
||||
event AddressKey(bytes32 indexed _key, address _address);
|
||||
|
||||
// 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 identifier(uint256) external view returns (bytes32);
|
||||
|
||||
// Number of registered interfaces
|
||||
function identifierCount() external view returns (uint256);
|
||||
}
|
||||
|
||||
#### Contract registry implementation
|
||||
|
||||
<git://holbrook.no/eth-contract-registry.git>
|
||||
|
||||
#### Token index implementation
|
||||
|
||||
<git://holbrook.no/eth-contract-registry.git>
|
||||
|
||||
### 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 `sealState()` *must not* decrease, and must not exceed
|
||||
`maxSealState`.
|
||||
|
||||
`maxSealState` is used to define that *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:
|
||||
|
||||
- Whether more tokens can be minted
|
||||
|
||||
- Allow ownership of a contract to be transferred
|
||||
|
||||
- The expiry time of a token (see `Expire`)
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
0d7491f8
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface ISeal {
|
||||
// Seal state has changed.
|
||||
event SealStateChange(bool indexed _final, uint256 _sealState);
|
||||
|
||||
// The current seal state.
|
||||
function sealState() external view returns(uint256);
|
||||
|
||||
// The numeric seal state in everything sealable has been sealed.
|
||||
function maxSealState() external view returns(uint256);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
|
||||
|
||||
### Throttle
|
||||
|
||||
An backend contract to limit access to a resource by time.
|
||||
|
||||
The smart contract managing the resource calls ‘have(address)‘ on this
|
||||
contract to check if it can be made use of at the current point in time.
|
||||
This also implements [ACL](#acl).
|
||||
|
||||
When the resource is made use of, it calls ‘poke(address)‘ method to
|
||||
register when it has been made use of.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
8f5bc7bf
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IThrottle {
|
||||
// Returns true if the given address is authorized to make use of the resource at the current moment.
|
||||
// Implements ACL
|
||||
function have(address _address) external view returns(bool);
|
||||
|
||||
// Must be called when the resource is being used.
|
||||
function poke(address _address) external returns(bool);
|
||||
}
|
||||
|
||||
#### Reference implementation
|
||||
|
||||
<git://holbrook.no/eth-faucet.git> (PeriodSimple contract)
|
||||
|
||||
### TokenLimit
|
||||
|
||||
Define limits of value amounts of tokens that individual addresses can
|
||||
hold.
|
||||
|
||||
Limits are inclusive; a limit for 42 means transfer resulting in a token
|
||||
balance *higher* than 42 should be rejected.
|
||||
|
||||
A return value of 0 indicates that the token is categorically not
|
||||
accepted by the holder.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
23778613
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface ITokenLimit {
|
||||
// Returns limit of total value a holder will accept of a specific token.
|
||||
// The value limit returned is inclusive; A limit of 42 means any operation resulting in a balance OVER 42 should be rejected.
|
||||
// A value of 0 means that no value of the token is accepted.
|
||||
function limitOf(address _token, address _holder) external view returns(uint256);
|
||||
}
|
||||
|
||||
#### Reference implementations
|
||||
|
||||
- <git://holbrook.no/erc20-limiter.git>
|
||||
|
||||
### TokenQuote
|
||||
|
||||
Quote an output token value for a given value of input tokens.
|
||||
|
||||
Both input and output value is denominated in the smallest available
|
||||
unit of respective tokens.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
dbb21d40
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface ITokenQuote {
|
||||
// Returns, within a current context, what value of outTokens the given value of inTokens translates to.
|
||||
// The values are given in smallest unit of each respective token.
|
||||
function valueFor(address _outToken, address _inToken, uint256 value) external view returns (uint256);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
- <git://holbrook.no/erc20-limiter.git>
|
||||
|
||||
### TokenRateChange
|
||||
|
||||
Enables detection of properties for CIC tokens that change value over
|
||||
time, e.g. through demurrage.
|
||||
|
||||
It allows defining the granularity of the rate of change, aswell as a
|
||||
frequency for which the rate of change is applied.
|
||||
|
||||
A method for canonical value change calculations is also provided.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
b716af03
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface ITokenChangeRate {
|
||||
// Time unit resolution for rate of change.
|
||||
// A value of 0 indicates no rate of change,
|
||||
function changeTimeUnit() external view returns(uint256);
|
||||
|
||||
// Rate of change per changeTimeUnit(), signed integer.
|
||||
// An effective value of 0 indicates no rate of change.
|
||||
function changeRate() external view returns (int256);
|
||||
|
||||
// Number of decimals with which the changeRate is defined.
|
||||
// changeRate() should be divided by 10 ** changeRateDecimals() to obtain effective value
|
||||
function changeRateDecimals() external view returns(uint8);
|
||||
|
||||
// Timestamp from when rate of change should be applied.
|
||||
// A value of 0 indicates no rate of change,
|
||||
function changeStartTime() external view returns(uint256);
|
||||
|
||||
// Calculate value with change rate applied for given amount of time units.
|
||||
// Will calculate compounded change over the given amount of time units
|
||||
function applyChange(int256 _value, uint256 _changeTimeUnits) external view returns(int256);
|
||||
}
|
||||
|
||||
#### Reference implementations
|
||||
|
||||
- <git://holbrook.no/erc20-demurrage-token.git>
|
||||
|
||||
### TokenSwap
|
||||
|
||||
Token swap interface that can fit token escrow purposes aswell as token
|
||||
swap contracts.
|
||||
|
||||
Optionally may define a `defaultToken`, that may among other things be
|
||||
used for `withdraw()` calls without an `inToken`.
|
||||
|
||||
An explicit *ERC20 approval* of the balance to be transacted will
|
||||
usually be required for the implementing contract.
|
||||
|
||||
If the value 0 is passed as argument to `deposit` or `withdraw`,
|
||||
implementers can choose one of two possible outcomes:
|
||||
|
||||
- Noop. 0 *must* be returned.
|
||||
|
||||
- Use *balance* or the max available *allowance*. The actual (spent)
|
||||
value *must* be returned.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
4146b765
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface ITokenSwap {
|
||||
// Emitted when a new deposit has been made.
|
||||
event Deposit(address indexed _token, uint256 _value);
|
||||
|
||||
// Default token used to access the token swap.
|
||||
// Returns zero-address if no default token is defined.
|
||||
function defaultToken() external returns (address);
|
||||
|
||||
// Add inToken liquidity to the tune of given value.
|
||||
// Requires token approval for the corresponding value.
|
||||
// If value is 0, up to the full approval MAY be used for the transfer.
|
||||
function deposit(address _inToken, uint256 _value) external returns (uint256);
|
||||
|
||||
// Withdraw pending outToken balance of given value in the pool for the sender.
|
||||
// May require token approval for defaultToken if used by contract as exchange for the withdrawal.
|
||||
// If value is 0, up to the full approval value MAY be used for the transfer.
|
||||
function withdraw(address _outToken, uint256 _value) external returns (uint256);
|
||||
|
||||
// Exchange inToken equalling given value for outToken.
|
||||
// Requires token approval for the value of inToken.
|
||||
// If value is 0, up to the full approval value MAY be used for the transfer.
|
||||
function withdraw(address _outToken, address _inToken, uint256 _value) external returns (uint256);
|
||||
}
|
||||
|
||||
#### Reference implementations
|
||||
|
||||
- <git://holbrook.no/erc20-pool.git>
|
||||
|
||||
#### Handling deposits
|
||||
|
||||
The implementation is free to decide whether deposits can be recovered
|
||||
directly, or if they will be locked in the smart contract - temporarily
|
||||
or permanently.
|
||||
|
||||
For the duration deposits are locked, they are part of the smart
|
||||
contract’s swap liquidity. During this time, locked deposits may only be
|
||||
withdrawn in exchange for other tokens accepted by the contract.
|
||||
|
||||
Deposits that are not locked should be withdrawable using the
|
||||
`withdraw(address,uint256)` (`0xf3fef3a3`) method signature.
|
||||
|
||||
Of course, as with most swap contracts, the tokens available for
|
||||
withdrawal by the holder may not necessarily match the tokens that were
|
||||
deposited by the holder.
|
||||
|
||||
### TokenVote
|
||||
|
||||
Execute elections with granular ERC20 token votes.
|
||||
|
||||
A proposal submitted for vote may or may not contain multiple options.
|
||||
If multiple options are available, an ERC20 token holder may distribute
|
||||
its vote among the options with the granularity of the token balance.
|
||||
|
||||
Voted tokens **SHOULD** be locked until the voting has finalized.
|
||||
|
||||
Finalization of voting should be callable by anyone.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
f2e0bfeb
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface ITokenVote {
|
||||
|
||||
// A new proposal has been created.
|
||||
event ProposalAdded(uint256 indexed _blockDeadline, uint256 indexed voteTargetPpm, uint256 indexed _proposalIdx);
|
||||
|
||||
// A proposal vote has been completed.
|
||||
// The proposal is identified by the serial number in _proposalIdx. It is up to the implementer to define how the proposal should be retrieved by index.
|
||||
// The proposal result may be in one of three states:
|
||||
// * Ratified (_cancelled == false, _insufficient == false)
|
||||
// * Cancelled (_cancelled == true, _insufficient == false)
|
||||
// * Not reached quorum (_cancelled == false, _insufficient == true)
|
||||
event ProposalCompleted(uint256 indexed _proposalIdx, bool indexed _cancelled, bool indexed _insufficient, uint256 _totalVote);
|
||||
|
||||
// Propose a new vote.
|
||||
// Voting is active until one of:
|
||||
// * total cancel vote reach quorum (_targetVotePpm, ppm = parts-per-million).
|
||||
// * _blockWait blocks from now.
|
||||
function propose(bytes32 _description, uint256 _blockWait, uint24 _targetVotePpm) external returns (uint256);
|
||||
|
||||
// Add a voting option to a proposal
|
||||
function addOption(uint256 _proposalIdx, bytes32 _description) external;
|
||||
|
||||
// Get number of options available for the proposal.
|
||||
// This decides the boundary of the index that can be used with voteOptions(...)
|
||||
// If the result is 0, vote(...) can be used aswell.
|
||||
function optionCount(uint256 _proposalIdx) external view returns(uint256);
|
||||
|
||||
// Get proposal option. Assumes that proposal was created with proposeMulti(...)
|
||||
function getOption(uint256 _proposalIdx, uint256 _optionIdx) external view returns (bytes32);
|
||||
|
||||
// Get vote count for the given option.
|
||||
// If proposal has no options, it should be called with _optionIdx = 0
|
||||
function voteCount(uint256 _proposalIdx, uint256 _optionIdx) external view returns(uint256);
|
||||
|
||||
// Vote on a proposal without options.
|
||||
// Assumes that proposal was created with propose(...) and will fail otherwise.
|
||||
function vote(uint256 _value) external returns (bool);
|
||||
|
||||
// Vote on a proposal option. Assumes that proposal was created with proposeMulti(...).
|
||||
// Must work with a non-option proposal if _optionIndex is 0.
|
||||
function voteOption(uint256 _optionIndex, uint256 _value) external returns (bool);
|
||||
|
||||
// Vote to cancel a proposal.
|
||||
// If cancel has the majority:
|
||||
// * A vote without options will have rejected the proposal description.
|
||||
// * A vote with options will have rejected the proposal description as well as all option descriptions.
|
||||
function voteCancel(uint256 _value) external returns (bool);
|
||||
|
||||
// Finalize the vote for a proposal.
|
||||
// May be called if deadline has been passed, or if:
|
||||
// * quorum has been reached with cancel votes.
|
||||
// * quorum has been reached and proposal has no/only one option.
|
||||
function finalize() external returns (bool);
|
||||
}
|
||||
|
||||
#### Reference implementations
|
||||
|
||||
- <git://holbrook.no/evm-tokenvote.git>
|
||||
|
||||
### Writer
|
||||
|
||||
A complement to ERC173, which allows definition of a class of
|
||||
super-users for a contract.
|
||||
|
||||
A super-user address may perform *more* actions than a "normal" address,
|
||||
aswell as *some* actions normally limited to the *contract owner*.
|
||||
|
||||
If an *contract owner* is defined, No super-user should be able to
|
||||
perform actions that *contract owner* cannot perform.
|
||||
|
||||
Typically, only the *contract owner*, if it is defined, can add or
|
||||
remove a super-user.
|
||||
|
||||
Some use-case examples of super-user actions include:
|
||||
|
||||
- Mint new tokens.
|
||||
|
||||
- Change the amount dispensed by the faucet.
|
||||
|
||||
- Edit access control lists.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
abe1f1f5
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IWriter {
|
||||
// A writer has been added by _executor
|
||||
event WriterAdded(address _writer);
|
||||
|
||||
// A writer has been removed by _executor
|
||||
event WriterDeleted(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 view returns (bool);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
|
|
@ -1,3 +1,5 @@
|
|||
all:
|
||||
makeinfo --html index.texi
|
||||
|
||||
readme:
|
||||
makeinfo --docbook --no-split -o build/docbook.xml index.texi
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
@subsection Accounts Index
|
||||
|
||||
Append-only list of addresses. Typically used for access control lists.
|
||||
|
||||
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}.
|
||||
|
||||
May optionally record time when account was added.
|
||||
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/AccountsIndex.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_AccountsIndex.texi
|
||||
|
||||
@subsubsection Reference implementation
|
||||
|
||||
@uref{git://holbrook.no/eth-accounts-index.git,} (v0.5.1)
|
||||
|
||||
|
||||
@subsection Accounts Index Mutable
|
||||
|
||||
Extends the functionality of @code{Accounts Index} to allow changes to the address list.
|
||||
|
||||
Addresses may be @emph{added}, @emph{removed}, aswell as @emph{deactivated} and @emph{activated}. Deactivated accounts still count towards the @code{entryCount}.
|
||||
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/AccountsIndexMutable.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_AccountsIndexMutable.texi
|
||||
|
||||
@subsubsection Reference implementation
|
||||
|
||||
@uref{git://holbrook.no/eth-accounts-index.git,} (v0.5.1)
|
|
@ -0,0 +1,18 @@
|
|||
@anchor{acl}
|
||||
@subsection ACL
|
||||
|
||||
A simple Access Control List definition that returns true of false depending on whether an signatory (address) is allowed to operate in a given context.
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/ACL.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_ACL.texi
|
||||
|
||||
@subsubsection Example implementation
|
||||
|
||||
@uref{git://holbrook.no/eth-accounts-index.git,}
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
@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.
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/Burner.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_Burner.texi
|
||||
|
||||
@subsubsection Example implementation
|
||||
|
||||
@uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git}
|
|
@ -0,0 +1,18 @@
|
|||
@subsection Chrono
|
||||
|
||||
Define a creation time for a resource.
|
||||
|
||||
Complements @code{ERC5007}.
|
||||
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/Chrono.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_Chrono.texi
|
||||
|
||||
@subsubsection Example implementation
|
||||
|
||||
@uref{https://git.defalsify.org/eth-erc721} (BadgeToken contract)
|
|
@ -0,0 +1,23 @@
|
|||
@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 value 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.
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/Declarator.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_Declarator.texi
|
||||
|
||||
@subsubsection Reference implementation
|
||||
|
||||
@uref{git://holbrook.no/eth-address-index.git,}
|
|
@ -0,0 +1,20 @@
|
|||
@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.
|
||||
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/Digest.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_Digest.texi
|
||||
|
||||
@subsubsection Example implementation
|
||||
|
||||
@uref{git://holbrook.no/eth-event-msg.git}
|
|
@ -0,0 +1,18 @@
|
|||
@subsection Expire
|
||||
|
||||
Defines an expiry time after which token balances and supply @emph{cannot change}.
|
||||
|
||||
A contract defining an expiry @emph{must not} allow changing the expiration time to a time in the past.
|
||||
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/Expire.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_Expire.texi
|
||||
|
||||
@subsubsection Example implementation
|
||||
|
||||
@uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git}
|
|
@ -0,0 +1,42 @@
|
|||
@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.
|
||||
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/Faucet.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_Faucet.texi
|
||||
|
||||
@subsubsection Reference implementations
|
||||
|
||||
@itemize
|
||||
@item
|
||||
@uref{git://holbrook.no/erc20-faucet.git,}
|
||||
@item
|
||||
@uref{git://holbrook.no/eth-faucet.git,}
|
||||
@end itemize
|
|
@ -1,6 +1,6 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
|
||||
<!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Smart contract interfaces (Untitled Document)</title>
|
||||
|
@ -10,14 +10,16 @@
|
|||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
|
||||
<link href="#Smart-contract-interfaces" rel="start" title="Smart contract interfaces">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em}
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
|
@ -26,6 +28,7 @@ pre.menu-preformatted {font-family: serif}
|
|||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
span:hover a.copiable-anchor {visibility: visible}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
@ -34,45 +37,77 @@ ul.no-bullet {list-style: none}
|
|||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<span id="Smart-contract-interfaces"></span><span id="Smart-contract-interfaces-1"></span><h2 class="chapter">1 Smart contract interfaces</h2>
|
||||
<div class="chapter" id="Smart-contract-interfaces">
|
||||
<span id="Smart-contract-interfaces-1"></span><h2 class="chapter">1 Smart contract interfaces</h2>
|
||||
|
||||
|
||||
<span id="Smart-Contracts-in-the-CIC-Network"></span><h3 class="section">1.1 Smart Contracts in the CIC Network</h3>
|
||||
<ul class="section-toc">
|
||||
<li><a href="#Smart-Contracts-in-the-CIC-Network" accesskey="1">Smart Contracts in the CIC Network</a></li>
|
||||
</ul>
|
||||
<div class="section" id="Smart-Contracts-in-the-CIC-Network">
|
||||
<h3 class="section">1.1 Smart Contracts in the CIC Network</h3>
|
||||
|
||||
<span id="Technology"></span><h4 class="subsection">1.1.1 Technology</h4>
|
||||
<ul class="section-toc">
|
||||
<li><a href="#Technology" accesskey="1">Technology</a></li>
|
||||
<li><a href="#The-registry-contract" accesskey="2">The registry contract</a></li>
|
||||
<li><a href="#Auxiliary-contracts" accesskey="3">Auxiliary contracts</a></li>
|
||||
<li><a href="#Contract-interfaces" accesskey="4">Contract interfaces</a></li>
|
||||
</ul>
|
||||
<div class="subsection" id="Technology">
|
||||
<h4 class="subsection">1.1.1 Technology</h4>
|
||||
|
||||
<p>The long-term aim of the CIC network is to be agnostic of consensus engines. However, since we have to start <em>somewhere</em>, the current state of development only deals with Smart Contracts on the (Ethereum Virtual Machine (EVM).
|
||||
</p>
|
||||
|
||||
<span id="The-registry-contract"></span><h4 class="subsection">1.1.2 The registry contract</h4>
|
||||
</div>
|
||||
<div class="subsection" id="The-registry-contract">
|
||||
<h4 class="subsection">1.1.2 The registry contract</h4>
|
||||
|
||||
<p>The CICRegistry contract defines the entry-point to the entire CIC network. All other CIC network resources can be discovered through this contract.
|
||||
</p>
|
||||
<p>Its implementation is contained in the <samp>cic-registry</samp> repository. Details about it are documented further in that section.
|
||||
</p>
|
||||
<span id="Auxiliary-contracts"></span><h4 class="subsection">1.1.3 Auxiliary contracts</h4>
|
||||
</div>
|
||||
<div class="subsection" id="Auxiliary-contracts">
|
||||
<h4 class="subsection">1.1.3 Auxiliary contracts</h4>
|
||||
|
||||
<p>All other Smart Contracts in the network other than CICRegistry are essentially optional, and each applies <em>at least one</em> the interfaces defined in the <code>cic-contracts</code> repository.
|
||||
</p>
|
||||
|
||||
<span id="Contract-interfaces"></span><h4 class="subsection">1.1.4 Contract interfaces</h4>
|
||||
</div>
|
||||
<div class="subsection" id="Contract-interfaces">
|
||||
<h4 class="subsection">1.1.4 Contract interfaces</h4>
|
||||
|
||||
<p>All contracts interfaces also implement the <strong>EIP165</strong> Standard Interface Detection.
|
||||
</p>
|
||||
|
||||
<span id="Registry"></span><h4 class="subsubsection">1.1.4.1 Registry</h4>
|
||||
<ul class="section-toc">
|
||||
<li><a href="#Registry" accesskey="1">Registry</a></li>
|
||||
<li><a href="#Registry-Client" accesskey="2">Registry Client</a></li>
|
||||
<li><a href="#Faucet" accesskey="3">Faucet</a></li>
|
||||
<li><a href="#Transfer-approval" accesskey="4">Transfer approval</a></li>
|
||||
<li><a href="#Declarator" accesskey="5">Declarator</a></li>
|
||||
<li><a href="#Address-Index" accesskey="6">Address Index</a></li>
|
||||
<li><a href="#DEX-Index" accesskey="7">DEX Index</a></li>
|
||||
</ul>
|
||||
<div class="subsubsection" id="Registry">
|
||||
<h4 class="subsubsection">1.1.4.1 Registry</h4>
|
||||
|
||||
<p>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.
|
||||
</p>
|
||||
<p>It also provides numerical index access to all registered values in order of insertion.
|
||||
</p>
|
||||
|
||||
<span id="Registry-Client"></span><h4 class="subsubsection">1.1.4.2 Registry Client</h4>
|
||||
</div>
|
||||
<div class="subsubsection" id="Registry-Client">
|
||||
<h4 class="subsubsection">1.1.4.2 Registry Client</h4>
|
||||
|
||||
<p>A subset of the <code>Registry</code> interface, which defines only the non-transactional methods of the contract. The <code>Registry Client</code> interface is implemented by the <code>CICRegistry</code> contract.
|
||||
</p>
|
||||
|
||||
<span id="Faucet"></span><h4 class="subsubsection">1.1.4.3 Faucet</h4>
|
||||
</div>
|
||||
<div class="subsubsection" id="Faucet">
|
||||
<h4 class="subsubsection">1.1.4.3 Faucet</h4>
|
||||
|
||||
<p>Enables disbursement of a set amount of tokens to a requesting address.
|
||||
</p>
|
||||
|
@ -81,7 +116,9 @@ ul.no-bullet {list-style: none}
|
|||
<p>Can be implemented as a periodic or a one-time service per account.
|
||||
</p>
|
||||
|
||||
<span id="Transfer-approval"></span><h4 class="subsubsection">1.1.4.4 Transfer approval</h4>
|
||||
</div>
|
||||
<div class="subsubsection" id="Transfer-approval">
|
||||
<h4 class="subsubsection">1.1.4.4 Transfer approval</h4>
|
||||
|
||||
<p>Enables a third-party approval to spend an ERC20 token allowance.
|
||||
</p>
|
||||
|
@ -90,7 +127,9 @@ ul.no-bullet {list-style: none}
|
|||
<p>The contract allows the third-party address to either allow or reject the transfer.
|
||||
</p>
|
||||
|
||||
<span id="Declarator"></span><h4 class="subsubsection">1.1.4.5 Declarator</h4>
|
||||
</div>
|
||||
<div class="subsubsection" id="Declarator">
|
||||
<h4 class="subsubsection">1.1.4.5 Declarator</h4>
|
||||
|
||||
<p>Stores one or more 32-byte entries as a description of an Ethereum address, <em>signed</em> by another Ethereum address.
|
||||
</p>
|
||||
|
@ -101,15 +140,22 @@ ul.no-bullet {list-style: none}
|
|||
<p>Entries typically are text strings or content hashes.
|
||||
</p>
|
||||
|
||||
<span id="Address-Index"></span><h4 class="subsubsection">1.1.4.6 Address Index</h4>
|
||||
</div>
|
||||
<div class="subsubsection" id="Address-Index">
|
||||
<h4 class="subsubsection">1.1.4.6 Address Index</h4>
|
||||
|
||||
<p>A simple append-only list of addresses. Used to check whether an address is part of a particular group.
|
||||
</p>
|
||||
|
||||
<span id="DEX-Index"></span><h4 class="subsubsection">1.1.4.7 DEX Index</h4>
|
||||
</div>
|
||||
<div class="subsubsection" id="DEX-Index">
|
||||
<h4 class="subsubsection">1.1.4.7 DEX Index</h4>
|
||||
|
||||
<p>Methods required to convert between tokens.
|
||||
</p><hr>
|
||||
</p><hr></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
@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
|
|
@ -0,0 +1,17 @@
|
|||
@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.
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/Minter.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_Minter.texi
|
||||
|
||||
@subsubsection Example implementation
|
||||
|
||||
@uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git}
|
|
@ -0,0 +1,20 @@
|
|||
@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.
|
||||
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/Msg.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_Msg.texi
|
||||
|
||||
@subsubsection Example implementation
|
||||
|
||||
@uref{git://holbrook.no/eth-event-msg.git}
|
|
@ -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,90 @@
|
|||
@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 Adopted standards
|
||||
|
||||
The CICRegistry contract defines the entry-point to the entire CIC network. All other CIC network resources can be discovered through this contract.
|
||||
|
||||
Its implementation is contained in the @file{cic-registry} repository. Details about it are documented further in that section.
|
||||
|
||||
@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 Signing
|
||||
|
||||
|
||||
@subsection Contract interfaces
|
||||
@subsection ERC - Direct use
|
||||
|
||||
All contracts interfaces also implement the @strong{EIP165} Standard Interface Detection.
|
||||
The following well-known solidity interfaces are used directly.
|
||||
|
||||
|
||||
@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.
|
||||
@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-191, ERC191 - Signed Data Standard}
|
||||
@item
|
||||
@uref{https://eips.ethereum.org/EIPS/eip-712, ERC712 - Typed structured data hashing and signing}
|
||||
@item
|
||||
@uref{https://eips.ethereum.org/EIPS/eip-721, ERC721 - Non-Fungible Token Standard}
|
||||
@item
|
||||
@uref{https://eips.ethereum.org/EIPS/eip-5007, ERC5007 - Time NFT (EIP-721 Time Extension)}
|
||||
@item
|
||||
@uref{https://eips.ethereum.org/EIPS/eip-5192, ERC5192 - Minimal Soulbound NFTs}
|
||||
@end itemize
|
||||
|
||||
|
||||
@subsubsection Registry Client
|
||||
@subsection ERCs Partial use
|
||||
|
||||
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.
|
||||
The following well-known solidity interfaces are partially implemented in CIC native interfaces.
|
||||
@itemize @dfn
|
||||
|
||||
@item
|
||||
@uref{https://eips.ethereum.org/EIPS/eip-5679, ERC5679 - Token Minting and Burning} (See @code{Minter}, @code{Burner})
|
||||
@end itemize
|
||||
|
||||
|
||||
@subsubsection Faucet
|
||||
@section Native interfaces
|
||||
|
||||
Enables disbursement of a set amount of tokens to a requesting address.
|
||||
@include acl.sol.texi
|
||||
|
||||
Allows privileged accounts to adjust the amount of tokens to disburse.
|
||||
@include accountsindex.sol.texi
|
||||
|
||||
Can be implemented as a periodic or a one-time service per account.
|
||||
@include burner.sol.texi
|
||||
|
||||
@include chrono.sol.texi
|
||||
|
||||
@subsubsection Transfer approval
|
||||
@include declarator.sol.texi
|
||||
|
||||
Enables a third-party approval to spend an ERC20 token allowance.
|
||||
@include digest.sol.texi
|
||||
|
||||
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.
|
||||
@include expire.sol.texi
|
||||
|
||||
The contract allows the third-party address to either allow or reject the transfer.
|
||||
@include faucet.sol.texi
|
||||
|
||||
@include locator.sol.texi
|
||||
|
||||
@subsubsection Declarator
|
||||
@include minter.sol.texi
|
||||
|
||||
Stores one or more 32-byte entries as a description of an Ethereum address, @emph{signed} by another Ethereum address.
|
||||
@include msg.sol.texi
|
||||
|
||||
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.
|
||||
@include registry.sol.texi
|
||||
|
||||
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.
|
||||
@include seal.sol.texi
|
||||
|
||||
Entries typically are text strings or content hashes.
|
||||
@include throttle.sol.texi
|
||||
|
||||
@include tokenlimit.sol.texi
|
||||
|
||||
@subsubsection Address Index
|
||||
@include tokenquote.sol.texi
|
||||
|
||||
A simple append-only list of addresses. Used to check whether an address is part of a particular group.
|
||||
@include tokenratechange.sol.texi
|
||||
|
||||
@include tokenswap.sol.texi
|
||||
|
||||
@subsubsection DEX Index
|
||||
@include tokenvote.sol.texi
|
||||
|
||||
Methods required to convert between tokens.
|
||||
@include writer.sol.texi
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
@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
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/RegistryClient.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_RegistryClient.texi
|
||||
|
||||
@subsubsection Contract registry implementation
|
||||
|
||||
@uref{git://holbrook.no/eth-contract-registry.git,}
|
||||
|
||||
@subsubsection Token index implementation
|
||||
|
||||
@uref{git://holbrook.no/eth-contract-registry.git,}
|
|
@ -0,0 +1,34 @@
|
|||
@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
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/Seal.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_Seal.texi
|
||||
|
||||
@subsubsection Example implementation
|
||||
|
||||
@uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git}
|
|
@ -0,0 +1,20 @@
|
|||
@subsection Throttle
|
||||
|
||||
An backend contract to limit access to a resource by time.
|
||||
|
||||
The smart contract managing the resource calls `have(address)` on this contract to check if it can be made use of at the current point in time. This also implements @ref{acl, ACL}.
|
||||
|
||||
When the resource is made use of, it calls `poke(address)` method to register when it has been made use of.
|
||||
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/Throttle.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_Throttle.texi
|
||||
|
||||
@subsubsection Reference implementation
|
||||
|
||||
@uref{git://holbrook.no/eth-faucet.git,} (PeriodSimple contract)
|
|
@ -0,0 +1,22 @@
|
|||
@subsection TokenLimit
|
||||
|
||||
Define limits of value amounts of tokens that individual addresses can hold.
|
||||
|
||||
Limits are inclusive; a limit for 42 means transfer resulting in a token balance @emph{higher} than 42 should be rejected.
|
||||
|
||||
A return value of 0 indicates that the token is categorically not accepted by the holder.
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/TokenLimit.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_TokenLimit.texi
|
||||
|
||||
@subsubsection Reference implementations
|
||||
|
||||
@itemize
|
||||
@item
|
||||
@uref{git://holbrook.no/erc20-limiter.git,}
|
||||
@end itemize
|
|
@ -0,0 +1,20 @@
|
|||
@subsection TokenQuote
|
||||
|
||||
Quote an output token value for a given value of input tokens.
|
||||
|
||||
Both input and output value is denominated in the smallest available unit of respective tokens.
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/TokenQuote.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_TokenQuote.texi
|
||||
|
||||
@subsubsection Example implementation
|
||||
|
||||
@itemize
|
||||
@item
|
||||
@uref{git://holbrook.no/erc20-limiter.git,}
|
||||
@end itemize
|
|
@ -0,0 +1,22 @@
|
|||
@subsection TokenRateChange
|
||||
|
||||
Enables detection of properties for CIC tokens that change value over time, e.g. through demurrage.
|
||||
|
||||
It allows defining the granularity of the rate of change, aswell as a frequency for which the rate of change is applied.
|
||||
|
||||
A method for canonical value change calculations is also provided.
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/TokenRateChange.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_TokenRateChange.texi
|
||||
|
||||
@subsubsection Reference implementations
|
||||
|
||||
@itemize
|
||||
@item
|
||||
@uref{git://holbrook.no/erc20-demurrage-token.git,}
|
||||
@end itemize
|
|
@ -0,0 +1,40 @@
|
|||
@subsection TokenSwap
|
||||
|
||||
Token swap interface that can fit token escrow purposes aswell as token swap contracts.
|
||||
|
||||
Optionally may define a @code{defaultToken}, that may among other things be used for @code{withdraw()} calls without an @code{inToken}.
|
||||
|
||||
An explicit @emph{ERC20 approval} of the balance to be transacted will usually be required for the implementing contract.
|
||||
|
||||
If the value 0 is passed as argument to @code{deposit} or @code{withdraw}, implementers can choose one of two possible outcomes:
|
||||
|
||||
@itemize
|
||||
@item Noop. 0 @emph{must} be returned.
|
||||
@item Use @emph{balance} or the max available @emph{allowance}. The actual (spent) value @emph{must} be returned.
|
||||
@end itemize
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/TokenSwap.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_TokenSwap.texi
|
||||
|
||||
@subsubsection Reference implementations
|
||||
|
||||
@itemize
|
||||
@item
|
||||
@uref{git://holbrook.no/erc20-pool.git,}
|
||||
@end itemize
|
||||
|
||||
|
||||
@subsubsection Handling deposits
|
||||
|
||||
The implementation is free to decide whether deposits can be recovered directly, or if they will be locked in the smart contract - temporarily or permanently.
|
||||
|
||||
For the duration deposits are locked, they are part of the smart contract's swap liquidity. During this time, locked deposits may only be withdrawn in exchange for other tokens accepted by the contract.
|
||||
|
||||
Deposits that are not locked should be withdrawable using the @code{withdraw(address,uint256)} (@code{0xf3fef3a3}) method signature.
|
||||
|
||||
Of course, as with most swap contracts, the tokens available for withdrawal by the holder may not necessarily match the tokens that were deposited by the holder.
|
|
@ -0,0 +1,21 @@
|
|||
@subsection TokenVend
|
||||
|
||||
This interface defines the mechanism for which a specific ERC20 token may be exchanged for a different ERC20 token.
|
||||
|
||||
A typical use-case is generation of voting tokens based on a momentary voucher balance. This is especially useful if the original ERC20 token is subject to decay (demurrage).
|
||||
|
||||
The tokens used for exchange @strong{SHOULD} be locked for the full duration of holding the vended tokens.
|
||||
|
||||
The withdrawal function may or may not allow partial withdrawals.
|
||||
|
||||
@table @dfn
|
||||
@item ERC165 Interface identifier
|
||||
@include ../../build/TokenVend.interface
|
||||
@item Solidity interface definition
|
||||
@include ../../build/contract_TokenVend.texi
|
||||
@item Reference implementations
|
||||
@itemize
|
||||
@item
|
||||
@uref{git://holbrook.no/erc20-vend.git,}
|
||||
@end itemize
|
||||
@end table
|
|
@ -0,0 +1,25 @@
|
|||
@anchor{token_vote}
|
||||
@subsection TokenVote
|
||||
|
||||
Execute elections with granular ERC20 token votes.
|
||||
|
||||
A proposal submitted for vote may or may not contain multiple options. If multiple options are available, an ERC20 token holder may distribute its vote among the options with the granularity of the token balance.
|
||||
|
||||
Voted tokens @strong{SHOULD} be locked until the voting has finalized.
|
||||
|
||||
Finalization of voting should be callable by anyone.
|
||||
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/TokenVote.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_TokenVote.texi
|
||||
|
||||
@subsubsection Reference implementations
|
||||
@itemize
|
||||
@item
|
||||
@uref{git://holbrook.no/evm-tokenvote.git,}
|
||||
@end itemize
|
|
@ -0,0 +1,32 @@
|
|||
@subsection Writer
|
||||
|
||||
A complement to ERC173, which allows definition of a class of super-users for a contract.
|
||||
|
||||
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}.
|
||||
|
||||
If an @emph{contract owner} is defined, No super-user should be able to perform actions that @emph{contract owner} cannot perform.
|
||||
|
||||
Typically, only the @emph{contract owner}, if it is defined, 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
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
||||
@include ../../build/Writer.interface
|
||||
|
||||
@subsubsection Solidity interface definition
|
||||
|
||||
@include ../../build/contract_Writer.texi
|
||||
|
||||
@subsubsection Example implementation
|
||||
|
||||
@uref{https://git.grassecon.net/cicnet/erc20-demurrage-token.git}
|
|
@ -0,0 +1 @@
|
|||
include *requirements.txt solidity/* LICENSE README* cic_contracts/unittest/solidity/* cic_contracts/data/*
|
|
@ -0,0 +1,17 @@
|
|||
INPUTS = $(wildcard cic_contracts/unittest/solidity/*.sol)
|
||||
OUTPUTS = $(patsubst %.sol, %.bin, $(INPUTS))
|
||||
|
||||
all: outs package
|
||||
|
||||
.SUFFIXES: .sol .bin
|
||||
|
||||
solidity:
|
||||
|
||||
.sol.bin:
|
||||
solc $(basename $@).sol --evm-version=byzantium --bin | awk 'NR>3' > $@
|
||||
truncate -s -1 $@
|
||||
|
||||
outs: $(OUTPUTS)
|
||||
|
||||
package:
|
||||
python setup.py sdist
|
|
@ -0,0 +1,974 @@
|
|||
# Smart contract interfaces
|
||||
|
||||
## Technology
|
||||
|
||||
CIC smart contracts are implemented using the *solidity* programming
|
||||
language for the (Ethereum Virtual Machine (EVM).
|
||||
|
||||
## Adopted standards
|
||||
|
||||
### Signing
|
||||
|
||||
### ERC - Direct use
|
||||
|
||||
The following well-known solidity interfaces are used directly.
|
||||
|
||||
- [ERC20 - Token Standard](https://eips.ethereum.org/EIPS/eip-20)
|
||||
|
||||
- [ERC165 - Standard Interface
|
||||
Detection](https://eips.ethereum.org/EIPS/eip-165)
|
||||
|
||||
- [ERC173 - Contract Ownership
|
||||
Standard](https://eips.ethereum.org/EIPS/eip-173)
|
||||
|
||||
- [ERC191 - Signed Data
|
||||
Standard](https://eips.ethereum.org/EIPS/eip-191)
|
||||
|
||||
- [ERC712 - Typed structured data hashing and
|
||||
signing](https://eips.ethereum.org/EIPS/eip-712)
|
||||
|
||||
- [ERC721 - Non-Fungible Token
|
||||
Standard](https://eips.ethereum.org/EIPS/eip-721)
|
||||
|
||||
- [ERC5007 - Time NFT (EIP-721 Time
|
||||
Extension)](https://eips.ethereum.org/EIPS/eip-5007)
|
||||
|
||||
- [ERC5192 - Minimal Soulbound
|
||||
NFTs](https://eips.ethereum.org/EIPS/eip-5192)
|
||||
|
||||
### ERCs Partial use
|
||||
|
||||
The following well-known solidity interfaces are partially implemented
|
||||
in CIC native interfaces.
|
||||
|
||||
- [ERC5679 - Token Minting and
|
||||
Burning](https://eips.ethereum.org/EIPS/eip-5679) (See `Minter`,
|
||||
`Burner`)
|
||||
|
||||
## Native interfaces
|
||||
|
||||
### ACL
|
||||
|
||||
A simple Access Control List definition that returns true of false
|
||||
depending on whether an signatory (address) is allowed to operate in a
|
||||
given context.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
3ef25013
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IACL {
|
||||
// Returns true if the address has permission to operate in the given context.
|
||||
function have(address _address) external view returns(bool);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<git://holbrook.no/eth-accounts-index.git>
|
||||
|
||||
### Accounts Index
|
||||
|
||||
Append-only list of addresses. Typically used for access control lists.
|
||||
|
||||
Addresses may be *added*, *removed*, aswell as *deactivated* and
|
||||
*activated*. Deactivated accounts still count towards the `entryCount`.
|
||||
|
||||
The `entry` method is used to iterate the account list. The order of
|
||||
which accounts are returned is not guaranteed. Any returned value
|
||||
matching `address(0x00)` should be skipped, and not counted towards
|
||||
`entryCount`.
|
||||
|
||||
May optionally record time when account was added.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
b7bca625
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IAccountsIndex {
|
||||
// Address added to store, index in array.
|
||||
event AddressAdded(uint256 indexed _idx, 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 0 means the entry should be skipped, and not count towards entry count.
|
||||
function entry(uint256) external view returns (address);
|
||||
|
||||
// Add an entry to the index. Incresases the entry count.
|
||||
function add(address) external returns (bool);
|
||||
|
||||
// Verify that the entry exists in the index.
|
||||
// Implements ACL
|
||||
function have(address) external view returns (bool);
|
||||
|
||||
// Retrieve the timestamp when account was added.
|
||||
// If time is not being tracked, a value of 0 should be returned.
|
||||
function time(address) external view returns (uint256);
|
||||
}
|
||||
|
||||
#### Reference implementation
|
||||
|
||||
<git://holbrook.no/eth-accounts-index.git> (v0.5.1)
|
||||
|
||||
### Accounts Index Mutable
|
||||
|
||||
Extends the functionality of `Accounts Index` to allow changes to the
|
||||
address list.
|
||||
|
||||
Addresses may be *added*, *removed*, aswell as *deactivated* and
|
||||
*activated*. Deactivated accounts still count towards the `entryCount`.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
9479f0ae
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IAccountsIndexMutable {
|
||||
// Active status of address changed, and by whom changed.
|
||||
event AddressActive(address indexed _account, bool _active);
|
||||
|
||||
// Address removed from store, and by whom removed.
|
||||
event AddressRemoved(address _account);
|
||||
|
||||
// Remove an entry from the index. Reduces the entry count.
|
||||
function remove(address) external 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);
|
||||
}
|
||||
|
||||
#### Reference implementation
|
||||
|
||||
<git://holbrook.no/eth-accounts-index.git> (v0.5.1)
|
||||
|
||||
### Burner
|
||||
|
||||
Attached to `ERC20` and `ERC721` tokens that may be *burned*.
|
||||
|
||||
Implements the `burn(...)` part of `ERC5679` for interoperability.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
b1110c1b
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IBurner {
|
||||
// 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 _amount) external returns (bool);
|
||||
|
||||
// Burn all tokens held by signer.
|
||||
// Returns the amount of tokens burned.
|
||||
function burn() external returns (uint256);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
|
||||
|
||||
### Chrono
|
||||
|
||||
Define a creation time for a resource.
|
||||
|
||||
Complements `ERC5007`.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
4db1ccd4
|
||||
|
||||
#### 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
|
||||
|
||||
<https://git.defalsify.org/eth-erc721> (BadgeToken contract)
|
||||
|
||||
### 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 value of `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.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
21b7493b
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IDeclarator {
|
||||
event DeclarationAdded(address indexed _declarator, address indexed _subject, bytes32 indexed _topic, bytes32 _proof);
|
||||
|
||||
// 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 );
|
||||
}
|
||||
|
||||
#### Reference implementation
|
||||
|
||||
<git://holbrook.no/eth-address-index.git>
|
||||
|
||||
### Digest
|
||||
|
||||
Allows encoding of digests according to a specific encoding scheme.
|
||||
|
||||
Primary use-case is the abstraction of self-describing
|
||||
[Multhash](https://multiformats.io/multihash/) encoding.
|
||||
|
||||
A default encoding *must* always be defined, and the encoding of a valid
|
||||
digest *must* succeed with the default encoding.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
982ab05d
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IDigest {
|
||||
// Returns the default digest encoding used by the contract instance.
|
||||
function defaultDigestEncoding() external view returns (uint256 _encoding);
|
||||
|
||||
// Check if the given encoding has been implemented in the contract instance.
|
||||
function haveDigestEncoding(uint256 _codec) external view returns(bool);
|
||||
|
||||
// Verify and encode the given digest for a specific hashing algorithm.
|
||||
// Returns a zero-length byte array if digest is invalid.
|
||||
// Must succeed if called with the defaultDigestEncoding and a valid digest.
|
||||
function encodeDigest(bytes memory _data, uint256 _encoding) external view returns (bytes memory);
|
||||
|
||||
// Encodes the digest using the default digest encoding.
|
||||
// Returns a zero-length byte array if digest is invalid.
|
||||
// Must succeed with a valid digest.
|
||||
function encodeDigest(bytes memory _data) external view returns (bytes memory);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<git://holbrook.no/eth-event-msg.git>
|
||||
|
||||
### Expire
|
||||
|
||||
Defines an expiry time after which token balances and supply *cannot
|
||||
change*.
|
||||
|
||||
A contract defining an expiry *must not* allow changing the expiration
|
||||
time to a time in the past.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
841a0e94
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IExpire {
|
||||
// Contract has expired.
|
||||
event Expired(uint256 _timestamp);
|
||||
|
||||
// Expiry time has changed.
|
||||
event ExpiryChange(uint256 indexed _oldTimestamp, uint256 _newTimestamp);
|
||||
|
||||
// The current expiration timestamp.
|
||||
function expires() external returns (uint256);
|
||||
|
||||
// Check expiry and apply expiration if expired.
|
||||
// Return values must be:
|
||||
// 0: not yet expired.
|
||||
// 1: already expired.
|
||||
// >1: expiry executed.
|
||||
function applyExpiry() external returns(uint8);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
|
||||
|
||||
### Faucet
|
||||
|
||||
Used for dispensing tokens to any address.
|
||||
|
||||
It can be used for gas tokens and *ERC20* alike.
|
||||
|
||||
The interface is the same whether the faucet is dispensing from existing
|
||||
balance or minting new tokens.
|
||||
|
||||
The value dispersed *must* be the same for all addresses.
|
||||
|
||||
In general, four criteria are expected to exist in any combination for
|
||||
limiting access to the faucet:
|
||||
|
||||
Time
|
||||
A recipient may only use the faucet again after some time has passed.
|
||||
|
||||
Balance threshold
|
||||
A recipient may only use the faucet after its balance is below a certain
|
||||
amount.
|
||||
|
||||
Membership
|
||||
A recipient may only use the faucet if it has been added to an access
|
||||
control list.
|
||||
|
||||
Capacity
|
||||
The contract has sufficient token funds to dispense the current defined
|
||||
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
|
||||
|
||||
1a3ac634
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IFaucet {
|
||||
// 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);
|
||||
}
|
||||
|
||||
#### Reference implementations
|
||||
|
||||
- <git://holbrook.no/erc20-faucet.git>
|
||||
|
||||
- <git://holbrook.no/eth-faucet.git>
|
||||
|
||||
### Locator
|
||||
|
||||
This interface supports `ERC721 Metadata`, in particular the
|
||||
`tokenURI(uint256)` call.
|
||||
|
||||
Off-chain resources in the CIC network *must* be defined in terms of
|
||||
content addressed strings.
|
||||
|
||||
It *must* be possible to refer to all off-chain resources directly by
|
||||
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
|
||||
|
||||
ed75b333
|
||||
|
||||
#### 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);
|
||||
|
||||
// URL pointing to a specific resource location.
|
||||
function toURL(bytes memory _data) external view returns(string memory);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<git://holbrook.no/eth-event-msg.git>
|
||||
|
||||
#### 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
|
||||
of the methods may be as follows:
|
||||
|
||||
`toURI(toHex(1234567890987654321))`
|
||||
-\>
|
||||
`https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1`
|
||||
|
||||
`toURL(toHex(1234567890987654321))`
|
||||
-\>
|
||||
`https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1`
|
||||
|
||||
`tokenURI(1234567890987654321)`
|
||||
-\>
|
||||
`https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1`
|
||||
|
||||
#### Expressing locators in terms of a digest
|
||||
|
||||
Given the data `foo`, the digest algorithm `sha256` and a base url
|
||||
`https://contentgateway.grassecon.net`, the result of the methods may be
|
||||
as follows:
|
||||
|
||||
`toURI(sha256(foo))`
|
||||
-\>
|
||||
`"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
|
||||
|
||||
`toURL(sha256(foo))`
|
||||
-\>
|
||||
`"https://contentgateway.grassecon.net/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
|
||||
|
||||
`tokenURI(toUint(sha256(foo)))`
|
||||
-\>
|
||||
`"https://contentgateway.grassecon.net/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
|
||||
|
||||
#### Locator without URL
|
||||
|
||||
Given the data `foo`, the digest algorithm `sha256` and no base url, the
|
||||
result of the methods may be as follows:
|
||||
|
||||
`toURI(sha256(foo))`
|
||||
-\>
|
||||
`"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
|
||||
|
||||
`toURL(sha256(foo))`
|
||||
-\> `""`
|
||||
|
||||
`tokenURI(toUint(sha256(foo)))`
|
||||
-\>
|
||||
`"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"`
|
||||
|
||||
### Minter
|
||||
|
||||
Attached to `ERC20` and `ERC721` tokens that may be minted.
|
||||
|
||||
Implements the `mint(...)` and `safeMint(...)` parts of `ERC5679` for
|
||||
interoperability.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
5878bcf4
|
||||
|
||||
#### 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);
|
||||
|
||||
// The given token has been successfully minted; by who, to whom and how much
|
||||
event Mint(address indexed _minter, address indexed _beneficiary, address indexed _token, 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;
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
|
||||
|
||||
### 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 `Locator` and `MultiHash` to generate locators
|
||||
for how to resolve the reference.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
a3002595
|
||||
|
||||
#### 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
|
||||
event Msg(bytes _msgDigest);
|
||||
|
||||
// Get the current message content hash
|
||||
function getMsg() external view returns(bytes memory);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<git://holbrook.no/eth-event-msg.git>
|
||||
|
||||
### 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:
|
||||
|
||||
1. Entry-point to discover all relevant contracts of CIC networks.
|
||||
|
||||
2. Unique (ERC20) token symbol resolver.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
effbf671
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IRegistryClient {
|
||||
// Address added to store with the given key
|
||||
event AddressKey(bytes32 indexed _key, address _address);
|
||||
|
||||
// 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 identifier(uint256) external view returns (bytes32);
|
||||
|
||||
// Number of registered interfaces
|
||||
function identifierCount() external view returns (uint256);
|
||||
}
|
||||
|
||||
#### Contract registry implementation
|
||||
|
||||
<git://holbrook.no/eth-contract-registry.git>
|
||||
|
||||
#### Token index implementation
|
||||
|
||||
<git://holbrook.no/eth-contract-registry.git>
|
||||
|
||||
### 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 `sealState()` *must not* decrease, and must not exceed
|
||||
`maxSealState`.
|
||||
|
||||
`maxSealState` is used to define that *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:
|
||||
|
||||
- Whether more tokens can be minted
|
||||
|
||||
- Allow ownership of a contract to be transferred
|
||||
|
||||
- The expiry time of a token (see `Expire`)
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
0d7491f8
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface ISeal {
|
||||
// Seal state has changed.
|
||||
event SealStateChange(bool indexed _final, uint256 _sealState);
|
||||
|
||||
// The current seal state.
|
||||
function sealState() external view returns(uint256);
|
||||
|
||||
// The numeric seal state in everything sealable has been sealed.
|
||||
function maxSealState() external view returns(uint256);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
|
||||
|
||||
### Throttle
|
||||
|
||||
An backend contract to limit access to a resource by time.
|
||||
|
||||
The smart contract managing the resource calls ‘have(address)‘ on this
|
||||
contract to check if it can be made use of at the current point in time.
|
||||
This also implements [ACL](#acl).
|
||||
|
||||
When the resource is made use of, it calls ‘poke(address)‘ method to
|
||||
register when it has been made use of.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
8f5bc7bf
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IThrottle {
|
||||
// Returns true if the given address is authorized to make use of the resource at the current moment.
|
||||
// Implements ACL
|
||||
function have(address _address) external view returns(bool);
|
||||
|
||||
// Must be called when the resource is being used.
|
||||
function poke(address _address) external returns(bool);
|
||||
}
|
||||
|
||||
#### Reference implementation
|
||||
|
||||
<git://holbrook.no/eth-faucet.git> (PeriodSimple contract)
|
||||
|
||||
### TokenLimit
|
||||
|
||||
Define limits of value amounts of tokens that individual addresses can
|
||||
hold.
|
||||
|
||||
Limits are inclusive; a limit for 42 means transfer resulting in a token
|
||||
balance *higher* than 42 should be rejected.
|
||||
|
||||
A return value of 0 indicates that the token is categorically not
|
||||
accepted by the holder.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
23778613
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface ITokenLimit {
|
||||
// Returns limit of total value a holder will accept of a specific token.
|
||||
// The value limit returned is inclusive; A limit of 42 means any operation resulting in a balance OVER 42 should be rejected.
|
||||
// A value of 0 means that no value of the token is accepted.
|
||||
function limitOf(address _token, address _holder) external view returns(uint256);
|
||||
}
|
||||
|
||||
#### Reference implementations
|
||||
|
||||
- <git://holbrook.no/erc20-limiter.git>
|
||||
|
||||
### TokenQuote
|
||||
|
||||
Quote an output token value for a given value of input tokens.
|
||||
|
||||
Both input and output value is denominated in the smallest available
|
||||
unit of respective tokens.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
dbb21d40
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface ITokenQuote {
|
||||
// Returns, within a current context, what value of outTokens the given value of inTokens translates to.
|
||||
// The values are given in smallest unit of each respective token.
|
||||
function valueFor(address _outToken, address _inToken, uint256 value) external view returns (uint256);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
- <git://holbrook.no/erc20-limiter.git>
|
||||
|
||||
### TokenRateChange
|
||||
|
||||
Enables detection of properties for CIC tokens that change value over
|
||||
time, e.g. through demurrage.
|
||||
|
||||
It allows defining the granularity of the rate of change, aswell as a
|
||||
frequency for which the rate of change is applied.
|
||||
|
||||
A method for canonical value change calculations is also provided.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
b716af03
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface ITokenChangeRate {
|
||||
// Time unit resolution for rate of change.
|
||||
// A value of 0 indicates no rate of change,
|
||||
function changeTimeUnit() external view returns(uint256);
|
||||
|
||||
// Rate of change per changeTimeUnit(), signed integer.
|
||||
// An effective value of 0 indicates no rate of change.
|
||||
function changeRate() external view returns (int256);
|
||||
|
||||
// Number of decimals with which the changeRate is defined.
|
||||
// changeRate() should be divided by 10 ** changeRateDecimals() to obtain effective value
|
||||
function changeRateDecimals() external view returns(uint8);
|
||||
|
||||
// Timestamp from when rate of change should be applied.
|
||||
// A value of 0 indicates no rate of change,
|
||||
function changeStartTime() external view returns(uint256);
|
||||
|
||||
// Calculate value with change rate applied for given amount of time units.
|
||||
// Will calculate compounded change over the given amount of time units
|
||||
function applyChange(int256 _value, uint256 _changeTimeUnits) external view returns(int256);
|
||||
}
|
||||
|
||||
#### Reference implementations
|
||||
|
||||
- <git://holbrook.no/erc20-demurrage-token.git>
|
||||
|
||||
### TokenSwap
|
||||
|
||||
Token swap interface that can fit token escrow purposes aswell as token
|
||||
swap contracts.
|
||||
|
||||
Optionally may define a `defaultToken`, that may among other things be
|
||||
used for `withdraw()` calls without an `inToken`.
|
||||
|
||||
An explicit *ERC20 approval* of the balance to be transacted will
|
||||
usually be required for the implementing contract.
|
||||
|
||||
If the value 0 is passed as argument to `deposit` or `withdraw`,
|
||||
implementers can choose one of two possible outcomes:
|
||||
|
||||
- Noop. 0 *must* be returned.
|
||||
|
||||
- Use *balance* or the max available *allowance*. The actual (spent)
|
||||
value *must* be returned.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
4146b765
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface ITokenSwap {
|
||||
// Emitted when a new deposit has been made.
|
||||
event Deposit(address indexed _token, uint256 _value);
|
||||
|
||||
// Default token used to access the token swap.
|
||||
// Returns zero-address if no default token is defined.
|
||||
function defaultToken() external returns (address);
|
||||
|
||||
// Add inToken liquidity to the tune of given value.
|
||||
// Requires token approval for the corresponding value.
|
||||
// If value is 0, up to the full approval MAY be used for the transfer.
|
||||
function deposit(address _inToken, uint256 _value) external returns (uint256);
|
||||
|
||||
// Withdraw pending outToken balance of given value in the pool for the sender.
|
||||
// May require token approval for defaultToken if used by contract as exchange for the withdrawal.
|
||||
// If value is 0, up to the full approval value MAY be used for the transfer.
|
||||
function withdraw(address _outToken, uint256 _value) external returns (uint256);
|
||||
|
||||
// Exchange inToken equalling given value for outToken.
|
||||
// Requires token approval for the value of inToken.
|
||||
// If value is 0, up to the full approval value MAY be used for the transfer.
|
||||
function withdraw(address _outToken, address _inToken, uint256 _value) external returns (uint256);
|
||||
}
|
||||
|
||||
#### Reference implementations
|
||||
|
||||
- <git://holbrook.no/erc20-pool.git>
|
||||
|
||||
#### Handling deposits
|
||||
|
||||
The implementation is free to decide whether deposits can be recovered
|
||||
directly, or if they will be locked in the smart contract - temporarily
|
||||
or permanently.
|
||||
|
||||
For the duration deposits are locked, they are part of the smart
|
||||
contract’s swap liquidity. During this time, locked deposits may only be
|
||||
withdrawn in exchange for other tokens accepted by the contract.
|
||||
|
||||
Deposits that are not locked should be withdrawable using the
|
||||
`withdraw(address,uint256)` (`0xf3fef3a3`) method signature.
|
||||
|
||||
Of course, as with most swap contracts, the tokens available for
|
||||
withdrawal by the holder may not necessarily match the tokens that were
|
||||
deposited by the holder.
|
||||
|
||||
### TokenVote
|
||||
|
||||
Execute elections with granular ERC20 token votes.
|
||||
|
||||
A proposal submitted for vote may or may not contain multiple options.
|
||||
If multiple options are available, an ERC20 token holder may distribute
|
||||
its vote among the options with the granularity of the token balance.
|
||||
|
||||
Voted tokens **SHOULD** be locked until the voting has finalized.
|
||||
|
||||
Finalization of voting should be callable by anyone.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
f2e0bfeb
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface ITokenVote {
|
||||
|
||||
// A new proposal has been created.
|
||||
event ProposalAdded(uint256 indexed _blockDeadline, uint256 indexed voteTargetPpm, uint256 indexed _proposalIdx);
|
||||
|
||||
// A proposal vote has been completed.
|
||||
// The proposal is identified by the serial number in _proposalIdx. It is up to the implementer to define how the proposal should be retrieved by index.
|
||||
// The proposal result may be in one of three states:
|
||||
// * Ratified (_cancelled == false, _insufficient == false)
|
||||
// * Cancelled (_cancelled == true, _insufficient == false)
|
||||
// * Not reached quorum (_cancelled == false, _insufficient == true)
|
||||
event ProposalCompleted(uint256 indexed _proposalIdx, bool indexed _cancelled, bool indexed _insufficient, uint256 _totalVote);
|
||||
|
||||
// Propose a new vote.
|
||||
// Voting is active until one of:
|
||||
// * total cancel vote reach quorum (_targetVotePpm, ppm = parts-per-million).
|
||||
// * _blockWait blocks from now.
|
||||
function propose(bytes32 _description, uint256 _blockWait, uint24 _targetVotePpm) external returns (uint256);
|
||||
|
||||
// Add a voting option to a proposal
|
||||
function addOption(uint256 _proposalIdx, bytes32 _description) external;
|
||||
|
||||
// Get number of options available for the proposal.
|
||||
// This decides the boundary of the index that can be used with voteOptions(...)
|
||||
// If the result is 0, vote(...) can be used aswell.
|
||||
function optionCount(uint256 _proposalIdx) external view returns(uint256);
|
||||
|
||||
// Get proposal option. Assumes that proposal was created with proposeMulti(...)
|
||||
function getOption(uint256 _proposalIdx, uint256 _optionIdx) external view returns (bytes32);
|
||||
|
||||
// Get vote count for the given option.
|
||||
// If proposal has no options, it should be called with _optionIdx = 0
|
||||
function voteCount(uint256 _proposalIdx, uint256 _optionIdx) external view returns(uint256);
|
||||
|
||||
// Vote on a proposal without options.
|
||||
// Assumes that proposal was created with propose(...) and will fail otherwise.
|
||||
function vote(uint256 _value) external returns (bool);
|
||||
|
||||
// Vote on a proposal option. Assumes that proposal was created with proposeMulti(...).
|
||||
// Must work with a non-option proposal if _optionIndex is 0.
|
||||
function voteOption(uint256 _optionIndex, uint256 _value) external returns (bool);
|
||||
|
||||
// Vote to cancel a proposal.
|
||||
// If cancel has the majority:
|
||||
// * A vote without options will have rejected the proposal description.
|
||||
// * A vote with options will have rejected the proposal description as well as all option descriptions.
|
||||
function voteCancel(uint256 _value) external returns (bool);
|
||||
|
||||
// Finalize the vote for a proposal.
|
||||
// May be called if deadline has been passed, or if:
|
||||
// * quorum has been reached with cancel votes.
|
||||
// * quorum has been reached and proposal has no/only one option.
|
||||
function finalize() external returns (bool);
|
||||
}
|
||||
|
||||
#### Reference implementations
|
||||
|
||||
- <git://holbrook.no/evm-tokenvote.git>
|
||||
|
||||
### Writer
|
||||
|
||||
A complement to ERC173, which allows definition of a class of
|
||||
super-users for a contract.
|
||||
|
||||
A super-user address may perform *more* actions than a "normal" address,
|
||||
aswell as *some* actions normally limited to the *contract owner*.
|
||||
|
||||
If an *contract owner* is defined, No super-user should be able to
|
||||
perform actions that *contract owner* cannot perform.
|
||||
|
||||
Typically, only the *contract owner*, if it is defined, can add or
|
||||
remove a super-user.
|
||||
|
||||
Some use-case examples of super-user actions include:
|
||||
|
||||
- Mint new tokens.
|
||||
|
||||
- Change the amount dispensed by the faucet.
|
||||
|
||||
- Edit access control lists.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
abe1f1f5
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
interface IWriter {
|
||||
// A writer has been added by _executor
|
||||
event WriterAdded(address _writer);
|
||||
|
||||
// A writer has been removed by _executor
|
||||
event WriterDeleted(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 view returns (bool);
|
||||
}
|
||||
|
||||
#### Example implementation
|
||||
|
||||
<https://git.grassecon.net/cicnet/erc20-demurrage-token.git>
|
|
@ -0,0 +1,8 @@
|
|||
# local imports
|
||||
from cic_contracts.search import search
|
||||
from cic_contracts.names import Name
|
||||
|
||||
erc165_for = search
|
||||
|
||||
def abi(v):
|
||||
return search(v, ext='json')
|
|
@ -0,0 +1 @@
|
|||
b7bca625
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_idx","type":"uint256"},{"indexed":false,"internalType":"address","name":"_account","type":"address"}],"name":"AddressAdded","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"have","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"time","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
9479f0ae
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_account","type":"address"},{"indexed":false,"internalType":"bool","name":"_active","type":"bool"}],"name":"AddressActive","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_account","type":"address"}],"name":"AddressRemoved","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"activate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"deactivate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"remove","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
b1110c1b
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_burner","type":"address"},{"indexed":false,"internalType":"uint256","name":"_burned","type":"uint256"}],"name":"Burn","type":"event"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"burn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalBurned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
869f7594
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_oldCap","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newCap","type":"uint256"}],"name":"Cap","type":"event"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
4db1ccd4
|
|
@ -0,0 +1 @@
|
|||
[{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"createTime","outputs":[{"internalType":"int64","name":"","type":"int64"}],"stateMutability":"nonpayable","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
21b7493b
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_declarator","type":"address"},{"indexed":true,"internalType":"address","name":"_subject","type":"address"},{"indexed":true,"internalType":"bytes32","name":"_topic","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"_proof","type":"bytes32"}],"name":"DeclarationAdded","type":"event"},{"inputs":[{"internalType":"address","name":"_subject","type":"address"},{"internalType":"bytes32","name":"_proof","type":"bytes32"},{"internalType":"bytes32","name":"_topic","type":"bytes32"}],"name":"addDeclaration","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_subject","type":"address"},{"internalType":"bytes32","name":"_proof","type":"bytes32"}],"name":"addDeclaration","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_declarator","type":"address"},{"internalType":"address","name":"_subject","type":"address"}],"name":"declaration","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_declarator","type":"address"},{"internalType":"address","name":"_subject","type":"address"},{"internalType":"bytes32","name":"_topic","type":"bytes32"}],"name":"declaration","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_declarator","type":"address"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"declarationAddressAt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_declarator","type":"address"}],"name":"declarationCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subject","type":"address"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"declaratorAddressAt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subject","type":"address"}],"name":"declaratorCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
982ab05d
|
|
@ -0,0 +1 @@
|
|||
[{"inputs":[],"name":"defaultDigestEncoding","outputs":[{"internalType":"uint256","name":"_encoding","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"encodeDigest","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"},{"internalType":"uint256","name":"_encoding","type":"uint256"}],"name":"encodeDigest","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_codec","type":"uint256"}],"name":"haveDigestEncoding","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
01ffc9a7
|
|
@ -0,0 +1 @@
|
|||
[{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
9493f8b2
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
b61bc941
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_holder","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
7a0cdf92
|
|
@ -0,0 +1 @@
|
|||
[{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"endTime","outputs":[{"internalType":"int64","name":"","type":"int64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"startTime","outputs":[{"internalType":"int64","name":"","type":"int64"}],"stateMutability":"view","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
b45a3c0e
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Locked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Unlocked","type":"event"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"locked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
d0017968
|
|
@ -0,0 +1 @@
|
|||
[{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
cce39764
|
|
@ -0,0 +1 @@
|
|||
[{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeMint","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
c22876c3
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_operator","type":"address"},{"indexed":false,"internalType":"bool","name":"_approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"_approved","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
dd9d2087
|
|
@ -0,0 +1 @@
|
|||
[{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
d283ef1d
|
|
@ -0,0 +1 @@
|
|||
[{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"_name","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"_symbol","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
150b7a02
|
|
@ -0,0 +1 @@
|
|||
[{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
841a0e94
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"Expired","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_oldTimestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newTimestamp","type":"uint256"}],"name":"ExpiryChange","type":"event"},{"inputs":[],"name":"applyExpiry","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"expires","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
1a3ac634
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"FaucetAmountChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Give","type":"event"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"check","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gimme","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"giveTo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"nextBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"nextTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tokenAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
ed75b333
|
|
@ -0,0 +1 @@
|
|||
[{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"toURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"toURL","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
5878bcf4
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_minter","type":"address"},{"indexed":true,"internalType":"address","name":"_beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Mint","type":"event"},{"inputs":[{"internalType":"address","name":"_beneficiary","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_beneficiary","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"mintTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_beneficiary","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeMint","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
a3002595
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"_msgDigest","type":"bytes"}],"name":"Msg","type":"event"},{"inputs":[],"name":"getMsg","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
cd8391b0
|
|
@ -0,0 +1 @@
|
|||
[{"inputs":[{"internalType":"uint256","name":"_codec","type":"uint256"}],"name":"digestCodec","outputs":[{"components":[{"internalType":"uint8","name":"l","type":"uint8"},{"internalType":"uint8","name":"codecRLength","type":"uint8"},{"internalType":"uint8","name":"prefixRLength","type":"uint8"},{"internalType":"bytes16","name":"prefix","type":"bytes16"},{"internalType":"bytes8","name":"codec","type":"bytes8"}],"internalType":"struct IMultiHash.MultiHash","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_codec","type":"uint256"},{"internalType":"bytes","name":"_digest","type":"bytes"}],"name":"encodeDigest","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_codec","type":"uint256"}],"name":"haveDigestEncoding","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
52e86958
|
|
@ -0,0 +1 @@
|
|||
[{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"executeOfflineRequest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"isOfflineValid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"verifyOfflineRequest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
37a47be4
|
|
@ -0,0 +1 @@
|
|||
[{"inputs":[],"name":"acceptOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
6b578339
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_result","type":"address"}],"name":"OwnershipTaken","type":"event"},{"inputs":[{"internalType":"address","name":"_target","type":"address"}],"name":"takeOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
d719b0cc
|
|
@ -0,0 +1 @@
|
|||
[{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"bind","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"address","name":"","type":"address"}],"name":"set","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
effbf671
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_key","type":"bytes32"},{"indexed":false,"internalType":"address","name":"_address","type":"address"}],"name":"AddressKey","type":"event"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"identifier","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"identifierCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
0d7491f8
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bool","name":"_final","type":"bool"},{"indexed":false,"internalType":"uint256","name":"_sealState","type":"uint256"}],"name":"SealStateChange","type":"event"},{"inputs":[],"name":"maxSealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
8a13249c
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_tokenIdx","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_supply","type":"uint256"},{"indexed":false,"internalType":"address","name":"_token","type":"address"}],"name":"TokenCreated","type":"event"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"withdrawFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
ac3142f7
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_blockDeadline","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"voteTargetPpm","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_proposalIdx","type":"uint256"}],"name":"ProposalAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_proposalIdx","type":"uint256"},{"indexed":true,"internalType":"bool","name":"_cancelled","type":"bool"},{"indexed":true,"internalType":"bool","name":"_insufficient","type":"bool"},{"indexed":false,"internalType":"uint256","name":"_totalVote","type":"uint256"}],"name":"ProposalCompleted","type":"event"},{"inputs":[],"name":"finalize","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalIdx","type":"uint256"},{"internalType":"uint256","name":"_optionIdx","type":"uint256"}],"name":"getOption","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalIdx","type":"uint256"}],"name":"optionCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_description","type":"bytes32"},{"internalType":"uint256","name":"_blockWait","type":"uint256"},{"internalType":"uint24","name":"_targetVotePpm","type":"uint24"}],"name":"propose","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_description","type":"bytes32"},{"internalType":"bytes32[]","name":"_options","type":"bytes32[]"},{"internalType":"uint256","name":"_blockWait","type":"uint256"},{"internalType":"uint24","name":"_targetVotePpm","type":"uint24"}],"name":"proposeMulti","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"vote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"voteCancel","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalIdx","type":"uint256"},{"internalType":"uint256","name":"_optionIdx","type":"uint256"}],"name":"voteCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_optionIndex","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"voteOption","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
|
|
@ -0,0 +1 @@
|
|||
abe1f1f5
|
|
@ -0,0 +1 @@
|
|||
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_writer","type":"address"}],"name":"WriterAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_writer","type":"address"}],"name":"WriterDeleted","type":"event"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"addWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"deleteWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"isWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue