From 689ad1802534fd8ab2aecc26bfd9e9087cba7a2c Mon Sep 17 00:00:00 2001 From: nolash Date: Sat, 23 Oct 2021 20:42:52 +0200 Subject: [PATCH] Add comments to interfaces, add ERC721, rename EIP to ERC --- solidity/AccountsIndex.sol | 8 +++++-- solidity/Declarator.sol | 8 ++++++- solidity/EIP165.sol | 9 -------- solidity/EIP173.sol | 12 ----------- solidity/ERC165.sol | 13 +++++++++++ solidity/ERC173.sol | 16 ++++++++++++++ solidity/ERC20.sol | 4 ++++ solidity/ERC721.sol | 24 +++++++++++++++++++++ solidity/ERC721Enumerable.sol | 15 +++++++++++++ solidity/ERC721Metadata.sol | 15 +++++++++++++ solidity/ERC721Receiver.sol | 13 +++++++++++ solidity/Faucet.sol | 6 ++++++ solidity/Minter.sol | 1 + solidity/{FungibleMinter.sol => Writer.sol} | 5 +++-- 14 files changed, 123 insertions(+), 26 deletions(-) delete mode 100644 solidity/EIP165.sol delete mode 100644 solidity/EIP173.sol create mode 100644 solidity/ERC165.sol create mode 100644 solidity/ERC173.sol create mode 100644 solidity/ERC721.sol create mode 100644 solidity/ERC721Enumerable.sol create mode 100644 solidity/ERC721Metadata.sol create mode 100644 solidity/ERC721Receiver.sol rename solidity/{FungibleMinter.sol => Writer.sol} (55%) diff --git a/solidity/AccountsIndex.sol b/solidity/AccountsIndex.sol index 09a5a10..1d77c02 100644 --- a/solidity/AccountsIndex.sol +++ b/solidity/AccountsIndex.sol @@ -4,11 +4,15 @@ pragma solidity >=0.6.12; // SPDX-License-Identifier: GPL-3.0-or-later // File-version: 3 -interface AccountsIndex { - event AccountAdded(address indexed addedAccount, uint256 indexed accountIndex); // AccountsIndex +interface AddressIndex { + event AddressAdded(address indexed addedAccount, uint256 indexed accountIndex); // AccountsIndex + // Return number of entries in index function entryCount() external view returns (uint256); + // Return entry at the spceificed index function entry(uint256) external view returns (address); + // Add an entry to the index function add(address _account) external returns (bool); + // Verify that the entry exists in the index function have(address _account) external view returns (bool); } diff --git a/solidity/Declarator.sol b/solidity/Declarator.sol index 93825ce..4b4e6a5 100644 --- a/solidity/Declarator.sol +++ b/solidity/Declarator.sol @@ -6,11 +6,17 @@ pragma solidity >=0.6.12; interface Declarator { event DeclarationAdded(address _declarator, address _subject, bytes32 _proof); - + + // Get all declarations for a subject signed by a declarator function declaration(address _declarator, address _subject) 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 ); + // 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 ); } diff --git a/solidity/EIP165.sol b/solidity/EIP165.sol deleted file mode 100644 index 8bc4fea..0000000 --- a/solidity/EIP165.sol +++ /dev/null @@ -1,9 +0,0 @@ -pragma solidity ^0.8.0; - -// Author: Louis Holbrook 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 -// SPDX-License-Identifier: GPL-3.0-or-later -// File-version: 1 - -interface EIP165 { - function supportsInterface(bytes4 _sum) external pure returns (bool); -} diff --git a/solidity/EIP173.sol b/solidity/EIP173.sol deleted file mode 100644 index 3c685c8..0000000 --- a/solidity/EIP173.sol +++ /dev/null @@ -1,12 +0,0 @@ -pragma solidity ^0.8.0; - -// Author: Louis Holbrook 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 -// SPDX-License-Identifier: GPL-3.0-or-later -// File-version: 1 - -interface EIP173 { - event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); // EIP173 - - function owner() external view returns (address); - function transferOwnership(address _newOwner) external view returns (bool); -} diff --git a/solidity/ERC165.sol b/solidity/ERC165.sol new file mode 100644 index 0000000..47d29dc --- /dev/null +++ b/solidity/ERC165.sol @@ -0,0 +1,13 @@ +pragma solidity ^0.8.0; + +// Author: Louis Holbrook 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 +// SPDX-License-Identifier: GPL-3.0-or-later +// File-version: 2 + +// This is a representation of an officially approved Ethereum Improvement Proposal, written by Christian Reitwießner chris@ethereum.org, Nick Johnson nick@ethereum.org, Fabian Vogelsteller fabian@lukso.network, Jordi Baylina jordi@baylina.cat, Konrad Feldmeier konrad.feldmeier@brainbot.com and William Entriken github.com@phor.net. It was released under the CC0 license. +// The proposal source used as reference was a Markdown file with the following digests: +// - sha256:2fc8534206e1e5b7abbb9db21fa5b83d39c51b2dabad441a356b7d18320bfc51 +// - swarmhash:a1a2860be878a818a9207503fbbe49cdbd86c3e02a4fdac0a4faafa78f6bdd80 +interface ERC165 { + function supportsInterface(bytes4 _sum) external pure returns (bool); +} diff --git a/solidity/ERC173.sol b/solidity/ERC173.sol new file mode 100644 index 0000000..4fc19a7 --- /dev/null +++ b/solidity/ERC173.sol @@ -0,0 +1,16 @@ +pragma solidity ^0.8.0; + +// Author: Louis Holbrook 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 +// SPDX-License-Identifier: GPL-3.0-or-later +// File-version: 2 + +// This is a representation of an officially approved Ethereum Improvement Proposal, written by Nick Mudge and Dan Finlay and released under the CC0 license. +// The proposal source used as reference was a Markdown file with the following digests: +// - sha256:45e14ac315e380b5372a5ffc6783ab11d7eafb7fa5a123e0b8e5fc8c6c527c4c +// - swarmhash:0cadf6a7122d2da20dbab0ef31c692b1b24cf49ae5c1c80f7ce6dbae8885ce01 +interface ERC173 { + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); // EIP173 + + function owner() external view returns (address); + function transferOwnership(address _newOwner) external view returns (bool); +} diff --git a/solidity/ERC20.sol b/solidity/ERC20.sol index 6d5917c..bbaf767 100644 --- a/solidity/ERC20.sol +++ b/solidity/ERC20.sol @@ -4,6 +4,10 @@ pragma solidity >=0.6.12; // SPDX-License-Identifier: GPL-3.0-or-later // File-version: 1 +// This is a representation of an officially approved Ethereum Improvement Proposal, written by Fabian Vogelsteller fabian@ethereum.org, Vitalik Buterin vitalik.buterin@ethereum.org. It was released under the CC0 license. +// The proposal source used as reference was a Markdown file with the following digests: +// - sha256:d120f321f2bef19596a401fba86d13352693ccd39645c2bbc84ffb3ed551388f +// - swarmhash:598f13429ec42f50d7a6576ab20feffdaf2135a90805678d24e4ea297bf0e639 interface ERC20 { event Transfer(address indexed _from, address indexed _to, uint256 _value); event TransferFrom(address indexed _from, address indexed _to, address indexed _spender, uint256 _value); diff --git a/solidity/ERC721.sol b/solidity/ERC721.sol new file mode 100644 index 0000000..41fda4a --- /dev/null +++ b/solidity/ERC721.sol @@ -0,0 +1,24 @@ +pragma solidity >=0.6.12; + +// Author: Louis Holbrook 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 +// SPDX-License-Identifier: GPL-3.0-or-later +// File-version: 1 + +// This is a representation of an officially approved Ethereum Improvement Proposal, William Entriken (@fulldecent), Dieter Shirley dete@axiomzen.co, Jacob Evans jacob@dekz.net, Nastassia Sachs nastassia.sachs@protonmail.com +// The proposal source used as reference was a Markdown file with the following digests: +// - sha256:f25b41ad1bff14ec57e8c247f2ecf372fd86245d08ba3cbd005c21a42744a7ca +// - swarmhash:cf43d96b21b0b017ae32fb2ac8df9268f13344d9fd20aa1d959453eaf379a51b +interface ERC721 { + event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId); + event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId); + event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved); + + function balanceOf(address _owner) external view returns (uint256); + function ownerOf(uint256 _tokenId) external view returns (address); + function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes memory data) external payable; + function transferFrom(address _from, address _to, uint256 _tokenId) external payable; + function approve(address _approved, uint256 _tokenId) external payable; + function setApprovalForAll(address _operator, bool _approved) external; + function getApproved(uint256 _tokenId) external view returns (address); + function isApprovedForAll(address _owner, address _operator) external view returns (bool); +} diff --git a/solidity/ERC721Enumerable.sol b/solidity/ERC721Enumerable.sol new file mode 100644 index 0000000..1377a0c --- /dev/null +++ b/solidity/ERC721Enumerable.sol @@ -0,0 +1,15 @@ +pragma solidity >=0.6.12; + +// Author: Louis Holbrook 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 +// SPDX-License-Identifier: GPL-3.0-or-later +// File-version: 1 + +// This is a representation of an officially approved Ethereum Improvement Proposal, William Entriken (@fulldecent), Dieter Shirley dete@axiomzen.co, Jacob Evans jacob@dekz.net, Nastassia Sachs nastassia.sachs@protonmail.com +// The proposal source used as reference was a Markdown file with the following digests: +// - sha256:f25b41ad1bff14ec57e8c247f2ecf372fd86245d08ba3cbd005c21a42744a7ca +// - swarmhash:cf43d96b21b0b017ae32fb2ac8df9268f13344d9fd20aa1d959453eaf379a51b +interface ERC721Enumerable { + function totalSupply() external view returns (uint256); + function tokenByIndex(uint256 _index) external view returns (uint256); + function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256); +} diff --git a/solidity/ERC721Metadata.sol b/solidity/ERC721Metadata.sol new file mode 100644 index 0000000..5f6f97c --- /dev/null +++ b/solidity/ERC721Metadata.sol @@ -0,0 +1,15 @@ +pragma solidity >=0.6.12; + +// Author: Louis Holbrook 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 +// SPDX-License-Identifier: GPL-3.0-or-later +// File-version: 1 + +// This is a representation of an officially approved Ethereum Improvement Proposal, William Entriken (@fulldecent), Dieter Shirley dete@axiomzen.co, Jacob Evans jacob@dekz.net, Nastassia Sachs nastassia.sachs@protonmail.com +// The proposal source used as reference was a Markdown file with the following digests: +// - sha256:f25b41ad1bff14ec57e8c247f2ecf372fd86245d08ba3cbd005c21a42744a7ca +// - swarmhash:cf43d96b21b0b017ae32fb2ac8df9268f13344d9fd20aa1d959453eaf379a51b +interface ERC721Metadata { + function name() external view returns (string memory _name); + function symbol() external view returns (string memory _symbol); + function tokenURI(uint256 _tokenId) external view returns (string memory); +} diff --git a/solidity/ERC721Receiver.sol b/solidity/ERC721Receiver.sol new file mode 100644 index 0000000..32d9261 --- /dev/null +++ b/solidity/ERC721Receiver.sol @@ -0,0 +1,13 @@ +pragma solidity >=0.6.12; + +// Author: Louis Holbrook 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 +// SPDX-License-Identifier: GPL-3.0-or-later +// File-version: 1 + +// This is a representation of an officially approved Ethereum Improvement Proposal, William Entriken (@fulldecent), Dieter Shirley dete@axiomzen.co, Jacob Evans jacob@dekz.net, Nastassia Sachs nastassia.sachs@protonmail.com +// The proposal source used as reference was a Markdown file with the following digests: +// - sha256:f25b41ad1bff14ec57e8c247f2ecf372fd86245d08ba3cbd005c21a42744a7ca +// - swarmhash:cf43d96b21b0b017ae32fb2ac8df9268f13344d9fd20aa1d959453eaf379a51b +interface ERC721Receiver { + function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes memory _data) external returns(bytes4); +} diff --git a/solidity/Faucet.sol b/solidity/Faucet.sol index 5cd6ae4..63234f9 100644 --- a/solidity/Faucet.sol +++ b/solidity/Faucet.sol @@ -9,9 +9,15 @@ interface Faucet { event FaucetFail(address indexed _recipient, address indexed _token, uint256 _value); event FaucetAmountChange(uint256 _value); + // Address of token the faucet represents function token() external returns (address); + // Amount of tokens the faucet gives out function tokenAmount() external returns (uint256); + // Set the amount of tokens that the faucet gives out function setAmount(uint256 _amount) external returns (bool); + // Give tokens to the given recipient function giveTo(address _recipient) external returns (bool); + // Number of blocks that must be mined until faucet can be used for the same address + // max uint (-1) can be used to indicate that faucet may not be reused function cooldown(address _recipient) external returns (uint256); } diff --git a/solidity/Minter.sol b/solidity/Minter.sol index 6e81bf4..ad7e8ff 100644 --- a/solidity/Minter.sol +++ b/solidity/Minter.sol @@ -7,5 +7,6 @@ pragma solidity >=0.6.12; interface Minter { 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); } diff --git a/solidity/FungibleMinter.sol b/solidity/Writer.sol similarity index 55% rename from solidity/FungibleMinter.sol rename to solidity/Writer.sol index cb76fcf..f362499 100644 --- a/solidity/FungibleMinter.sol +++ b/solidity/Writer.sol @@ -4,6 +4,7 @@ pragma solidity >=0.6.12; // SPDX-License-Identifier: GPL-3.0-or-later // File-version: 1 -interface FungibleMinter { - function mintedAt(uint256 _tokenId) external view returns (uint256); +interface Writer { + function addWriter(address _writer) external returns (bool); + function deleteWriter(address _writer) external returns (bool); }