Update writer, registry, expire, improve comments

This commit is contained in:
lash 2023-03-26 09:58:23 +01:00
parent 46cc35b54c
commit 1e11d8df08
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
7 changed files with 58 additions and 32 deletions

View File

@ -1,12 +1,13 @@
@subsection Accounts Index
Typically used for access control lists.
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}.
Also records time when account was added.
May optionally record time when account was added.
@table @dfn
@item ERC165 Interface identifier
@ -14,5 +15,22 @@ Also records time when account was added.
@item Solidity interface definition
@include ../../build/contract_AccountsIndex.texi
@item Reference implementation
@uref{git://holbrook.no/eth-accounts-index.git,}
@uref{git://holbrook.no/eth-accounts-index.git,} (v0.5.1)
@end table
@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}.
@table @dfn
@item ERC165 Interface identifier
@include ../../build/AccountsIndexMutable.interface
@item Solidity interface definition
@include ../../build/contract_AccountsIndexMutable.texi
@item Reference implementation
@uref{git://holbrook.no/eth-accounts-index.git,} (v0.5.1)
@end table

View File

@ -24,11 +24,16 @@ The following well-known solidity interfaces are used directly.
@uref{https://eips.ethereum.org/EIPS/eip-173, ERC173 - Contract Ownership Standard}
@item
@uref{https://eips.ethereum.org/EIPS/eip-721, ERC721 - Non-Fungible Token Standard}
@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
@subsection Partial use
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})
@ -41,6 +46,8 @@ The following well-known solidity interfaces are used directly.
@include burner.sol.texi
@include chrono.sol.texi
@include declarator.sol.texi
@include expire.sol.texi

View File

@ -2,39 +2,27 @@ pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: AGPL-3.0-or-later
// File-version: 5
// File-version: 6
interface IAccountsIndex {
event AddressAdded(address indexed addedAccount, uint256 indexed accountIndex); // AccountsIndex
event AddressActive(address indexed _executor, address indexed _account, bool _active);
event AddressRemoved(address indexed _executor, address _account);
// Address added to store, index in array.
event AddressAdded(uint256 indexed _idx, address _account);
// Return number of entries in index
// Return number of entries in index.
function entryCount() external view returns (uint256);
// Return entry at the spceificed index
// Return entry at the spceificed index.
// Will revert if index is beyond array length.
// An entry result of
// 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);
// Remove an entry from the index. Reduces the entry count.
function remove(address) external returns (bool);
// Verify that the entry exists in the index
// Verify that the entry exists in the index.
function have(address) external view returns (bool);
// Deactivate account but keep in index. Does not affect entry count.
function deactivate(address) external returns (bool);
// Activate previously deactivated account. Does not affect entry count.
function activate(address) external returns (bool);
// Check if account exists and is active;
function isActive(address) external view returns (bool);
// Retrieve the timestamp when account was added
// 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);
}

View File

@ -2,12 +2,22 @@ pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: AGPL-3.0-or-later
// File-version: 2
// File-version: 3
interface IExpire {
// Expiration timestamp has been changed.
// 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);
}

View File

@ -5,9 +5,9 @@ pragma solidity >=0.6.12;
// File-version: 3
interface ILocator {
// URI that may or may not point to a specific resource location
// 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
// URL pointing to a specific resource location.
function toURL(bytes memory _data) external view returns(string memory);
}

View File

@ -5,11 +5,14 @@ pragma solidity >=0.6.12;
// File-version: 3
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 identifiers(uint256) external view returns (bytes32);
function identifier(uint256) external view returns (bytes32);
// Number of registered interfaces
function identifierCount() external view returns (uint256);

View File

@ -2,14 +2,14 @@ pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: AGPL-3.0-or-later
// File-version: 3
// File-version: 4
interface IWriter {
// A writer has been added by _executor
event WriterAdded(address indexed _executor, address _writer);
event WriterAdded(address _writer);
// A writer has been removed by _executor
event WriterDeleted(address indexed _executor, address _writer);
event WriterDeleted(address _writer);
// Add a new writer to the contract.
function addWriter(address _writer) external returns (bool);