Embed solidity code, interfaces in documentation

This commit is contained in:
lash
2023-03-25 11:14:46 +00:00
parent 8507f202e7
commit 0877fe7769
27 changed files with 507 additions and 62 deletions

View File

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

View File

@@ -2,13 +2,25 @@ pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 2
// File-version: 3
interface Burner {
event Burn(uint256 _burned);
// Token(s) successfully burned; by who and how much.
event Burn(address indexed _burner, uint256 _burned);
// Satisfies ERC 5679
function burn(address _from, uint256 _amount, bytes calldata _data) external;
// Burn given amount of tokens held by signer.
function burn(uint256 _burn) external returns (bool);
// Burn all tokens held by signer.
function burn() external returns (bool);
// Total amount of tokens that have been burned.
function totalBurned() external returns (uint256);
// Total amount of tokens ever minted.
// If totalSupply() is available (ERC20, ERC721 Enumerable), this equals totalSupply() + totalBurned().
function totalMinted() external returns (uint256);
}

View File

@@ -1,7 +1,7 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-License-Identifier: AGPL-3.0-or-later
// File-version: 3
interface Declarator {
@@ -9,18 +9,25 @@ interface Declarator {
// Get all declarations for a subject (without topic) signed by a declarator
function declaration(address _declarator, address _subject) external view returns ( bytes32[] memory );
// Get all declarations for a subject for the given topic signed by a declarator
function declaration(address _declarator, address _subject, bytes32 _topic) external view returns ( bytes32[] memory );
// Get number of declarations the declarator has ever signed
function declarationCount(address _declarator) external view returns ( uint256 );
// Get the subject of a declarator's declarations at the specific index
function declarationAddressAt(address _declarator, uint256 _idx) external view returns ( address );
// Add a declaration for the subject
function addDeclaration(address _subject, bytes32 _proof) external returns ( bool );
// Add a declaration with topic for the subject
function addDeclaration(address _subject, bytes32 _proof, bytes32 _topic) external returns ( bool );
// Get the declarator that signed a declaration at the specificed index for a subject
function declaratorAddressAt(address _subject, uint256 _idx) external view returns ( address );
// Get the number of declarators that have signed for a subject
function declaratorCount(address _subject) external view returns ( uint256 );
}

View File

@@ -5,7 +5,9 @@ pragma solidity >=0.6.12;
// File-version: 2
interface Expire {
// Expiration timestamp has been changed.
event Expired(uint256 _timestamp);
// The current expiration timestamp.
function expires() external returns (uint256);
}

View File

@@ -5,20 +5,35 @@ pragma solidity >=0.6.12;
// File-version: 6
interface Faucet {
// Tokens were given to an address
event Give(address indexed _recipient, address indexed _token, uint256 _value);
// The amount that the faucet disperses has changed
event FaucetAmountChange(uint256 _value);
// Address of token the faucet represents
// The faucet will return gas tokens with the zero-address is returned.
function token() external returns (address);
// Amount of tokens the faucet gives out
function tokenAmount() external returns (uint256);
// Give tokens to the given recipient. Returns amount of tokens given.
function giveTo(address _recipient) external returns (uint256);
// Give tokens to yourself. Returns amount of tokens given.
function gimme() external returns (uint256);
// Check if faucet may be used in the current contract state by _recipient
function check(address _recipient) external view returns (bool);
// Returns timestamp when faucet may be used again by _recipient
// If 0 is returned, the address has not yet been used.
// A return value of max(uint256) indicates that the faucet may not be used again.
function nextTime(address _recipient) external returns (uint256);
// Returns the token balance under which faucet may be used again by _recipient
// A return value of max(uint256) indicates that the faucet may be used regardless
// of the token balance of _recipient
function nextBalance(address _recipient) external returns (uint256);
}

13
solidity/Locator.sol Normal file
View File

@@ -0,0 +1,13 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 3
interface ILocator {
// URI that may or may not point to a specific resource location
function toURI(bytes memory _data) external view returns (string memory);
// URL pointing to a specific resource location
function toURL(bytes memory _data) external view returns(string memory);
}

View File

@@ -2,11 +2,18 @@ pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 1
// File-version: 2
interface Minter {
// Tokens are successfully minted; by who, to whom and how much
event Mint(address indexed _minter, address indexed _beneficiary, uint256 value);
// Mint the specified value of tokens to the specified recipient
function mintTo(address _beneficiary, uint256 value) external returns (bool);
// Satisfies ERC5679 for ERC20
function mint(address _beneficiary, uint256 value, bytes calldata _data) external;
// Satisfies ERC5679 for ERC721
function safeMint(address _beneficiary, uint256 value, bytes calldata _data) external;
}

14
solidity/Msg.sol Normal file
View File

@@ -0,0 +1,14 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: AGPL-3.0-or-later
// File-version: 2
interface IMsg {
// Emitted when a new message digest has been set
// Should not be emitted if the digest set is identical to the previous
event Msg(bytes _msgDigest);
// Get the current message content hash
function getMsg() external view returns(bytes memory);
}

22
solidity/MultiHash.sol Normal file
View File

@@ -0,0 +1,22 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 2
interface IMultiHash {
// Represents a multicodec item.
struct MultiHash {
uint8 l;
uint8 codecRLength;
uint8 prefixRLength;
bytes16 prefix;
bytes8 codec;
}
// All registered multicodecs
function multiCodec(uint256 _codec) external view returns(MultiHash memory);
// Generate a multihash from the given digest and current selected multicodec
function toMultiHash(uint256 _codec, bytes memory _digest) external view returns(bytes memory);
}

View File

@@ -1,8 +1,8 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 2
// SPDX-License-Identifier: AGPL-3.0-or-later
// File-version: 3
interface Registry {
function set(bytes32, address) external returns (bool);

View File

@@ -1,10 +1,16 @@
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: GPL-3.0-or-later
// File-version: 2
// SPDX-License-Identifier: AGPL-3.0-or-later
// File-version: 3
interface RegistryClient {
// Return the address of the contract identified by the given byte string
function addressOf(bytes32) external view returns (address);
// Indexed accessor for the full list of registred identifiers
function identifiers(uint256) external view returns (bytes32);
// Number of registered interfaces
function identifierCount() external view returns (uint256);
}

View File

@@ -5,10 +5,18 @@ pragma solidity >=0.6.12;
// File-version: 2
interface Writer {
// A writer has been added by _executor
event WriterAdded(address indexed _executor, address _writer);
// A writer has been removed by _executor
event WriterDeleted(address indexed _executor, address _writer);
// Add a new writer to the contract.
function addWriter(address _writer) external returns (bool);
// Remove existing writer from the contract.
function deleteWriter(address _writer) external returns (bool);
// Check whether the given address is a writer.
function isWriter(address _writer) external returns (bool);
}