migrate content to format for new docs site

Squashed commit of the following:

commit fcf35eb806100de300bd9803ce3150dde1ecc424
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Wed Jul 17 17:16:04 2019 -0300

    remove all docsite dependency

commit eeaee9a9d43d70704f6ab17b5126ddbd52b93a50
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Wed Jul 17 17:15:23 2019 -0300

    update solidity-docgen

commit f021ff951829ea0c155186749819403c6b76e803
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Wed Jul 17 17:05:06 2019 -0300

    update docsite script for new setup

commit ff887699d381cfbbe3acf1f1c0de8e22b58480f3
Merge: c938aa1d 84f85a41
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Wed Jul 17 16:46:46 2019 -0300

    Merge branch 'master' into antora

commit c938aa1d9ed05ac83a34e2cebd8353f8331ad6d6
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Tue Jul 16 18:24:29 2019 -0300

    make component name shorter

commit 5bbd6931e02cbbd8864c82655ad0f390ceead5f3
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Wed Jul 10 20:16:17 2019 -0300

    add all info to docs templates

commit 39682c4515d7cf0f0368ed557f50d2709174208a
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Wed Jul 10 20:13:49 2019 -0300

    fix npm docsite script

commit 7ae46bd4a0437abf66150d54d05adf46e3de2cab
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Wed Jul 10 18:48:05 2019 -0300

    convert inline docs to asciidoc

commit cfdfd3dee4b4bf582fde22c8cb6e17a603d6e0c8
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Wed Jul 10 17:34:52 2019 -0300

    add missing contract names in readmes

commit 15b6a2f9bfb546cf1d3bf4f104278b118bf1b3f4
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Wed Jul 10 17:16:47 2019 -0300

    fix script path

commit 80d82b909f9460d1450d401f00b3f309da506b29
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Wed Jul 10 17:13:53 2019 -0300

    update version of solidity-docgen

commit a870b6c607b9c2d0012f8a60a4ed1a1c8b7e8ebd
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Wed Jul 10 17:03:53 2019 -0300

    add nav generation of api ref

commit 069cff4a25b83752650b54b86d85608c2f547e5e
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Wed Jul 10 16:32:14 2019 -0300

    initial migration to asciidoc and new docgen version

commit 55216eed0a6551da913c8d1da4b2a0d0d3faa1a8
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Tue Jun 25 20:39:35 2019 -0300

    add basic api doc example

commit 0cbe50ce2173b6d1d9a698329d91220f58822a53
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Tue Jun 25 19:31:31 2019 -0300

    add sidebars

commit 256fc942845307258ac9dc25aace48117fa10f79
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Tue Jun 25 15:22:38 2019 -0300

    add page titles

commit f4d0effa70e1fc0662729863e8ee72a8821bc458
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Tue Jun 25 15:19:41 2019 -0300

    add contracts index file

commit b73b06359979f7d933df7f2b283c50cb1c31b2a0
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Tue Jun 25 15:14:52 2019 -0300

    fix header levels

commit fb57d9b820f09a1b7c04eed1a205be0e45866cac
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Tue Jun 25 15:11:47 2019 -0300

    switch format to preferred asciidoctor format

commit 032181d8804137332c71534753929d080a31a71f
Author: Francisco Giordano <frangio.1@gmail.com>
Date:   Tue Jun 25 15:05:38 2019 -0300

    initialize antora component and convert docs to asciidoc
This commit is contained in:
Francisco Giordano
2019-07-17 17:16:47 -03:00
parent 84f85a410f
commit 7552af95e4
82 changed files with 1554 additions and 6505 deletions

View File

@ -3,9 +3,9 @@ pragma solidity ^0.5.0;
import "./IERC165.sol";
/**
* @dev Implementation of the `IERC165` interface.
* @dev Implementation of the {IERC165} interface.
*
* Contracts may inherit from this and call `_registerInterface` to declare
* Contracts may inherit from this and call {_registerInterface} to declare
* their support of an interface.
*/
contract ERC165 is IERC165 {
@ -26,7 +26,7 @@ contract ERC165 is IERC165 {
}
/**
* @dev See `IERC165.supportsInterface`.
* @dev See {IERC165-supportsInterface}.
*
* Time complexity O(1), guaranteed to always use less than 30 000 gas.
*/
@ -39,7 +39,7 @@ contract ERC165 is IERC165 {
* `interfaceId`. Support of the actual ERC165 interface is automatic and
* registering its interface id is not required.
*
* See `IERC165.supportsInterface`.
* See {IERC165-supportsInterface}.
*
* Requirements:
*

View File

@ -1,7 +1,7 @@
pragma solidity ^0.5.0;
/**
* @dev Library used to query support of an interface declared via `IERC165`.
* @dev Library used to query support of an interface declared via {IERC165}.
*
* Note that these functions return the actual result of the query: they do not
* `revert` if an interface is not supported. It is up to the caller to decide
@ -17,7 +17,7 @@ library ERC165Checker {
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
/**
* @dev Returns true if `account` supports the `IERC165` interface,
* @dev Returns true if `account` supports the {IERC165} interface,
*/
function _supportsERC165(address account) internal view returns (bool) {
// Any contract that implements ERC165 must explicitly indicate support of
@ -28,9 +28,9 @@ library ERC165Checker {
/**
* @dev Returns true if `account` supports the interface defined by
* `interfaceId`. Support for `IERC165` itself is queried automatically.
* `interfaceId`. Support for {IERC165} itself is queried automatically.
*
* See `IERC165.supportsInterface`.
* See {IERC165-supportsInterface}.
*/
function _supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
// query support of both ERC165 as per the spec and support of _interfaceId
@ -40,12 +40,12 @@ library ERC165Checker {
/**
* @dev Returns true if `account` supports all the interfaces defined in
* `interfaceIds`. Support for `IERC165` itself is queried automatically.
* `interfaceIds`. Support for {IERC165} itself is queried automatically.
*
* Batch-querying can lead to gas savings by skipping repeated checks for
* `IERC165` support.
* {IERC165} support.
*
* See `IERC165.supportsInterface`.
* See {IERC165-supportsInterface}.
*/
function _supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
// query support of ERC165 itself

View File

@ -3,11 +3,11 @@ pragma solidity ^0.5.0;
import "./IERC1820Implementer.sol";
/**
* @dev Implementation of the `IERC1820Implementer` interface.
* @dev Implementation of the {IERC1820Implementer} interface.
*
* Contracts may inherit from this and call `_registerInterfaceForAddress` to
* Contracts may inherit from this and call {_registerInterfaceForAddress} to
* declare their willingness to be implementers.
* `IERC1820Registry.setInterfaceImplementer` should then be called for the
* {IERC1820Registry-setInterfaceImplementer} should then be called for the
* registration to be complete.
*/
contract ERC1820Implementer is IERC1820Implementer {
@ -16,7 +16,7 @@ contract ERC1820Implementer is IERC1820Implementer {
mapping(bytes32 => mapping(address => bool)) private _supportedInterfaces;
/**
* See `IERC1820Implementer.canImplementInterfaceForAddress`.
* See {IERC1820Implementer-canImplementInterfaceForAddress}.
*/
function canImplementInterfaceForAddress(bytes32 interfaceHash, address account) external view returns (bytes32) {
return _supportedInterfaces[interfaceHash][account] ? ERC1820_ACCEPT_MAGIC : bytes32(0x00);
@ -26,8 +26,8 @@ contract ERC1820Implementer is IERC1820Implementer {
* @dev Declares the contract as willing to be an implementer of
* `interfaceHash` for `account`.
*
* See `IERC1820Registry.setInterfaceImplementer` and
* `IERC1820Registry.interfaceHash`.
* See {IERC1820Registry-setInterfaceImplementer} and
* {IERC1820Registry-interfaceHash}.
*/
function _registerInterfaceForAddress(bytes32 interfaceHash, address account) internal {
_supportedInterfaces[interfaceHash][account] = true;

View File

@ -2,18 +2,18 @@ pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* [EIP](https://eips.ethereum.org/EIPS/eip-165).
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others (`ERC165Checker`).
* queried by others ({ERC165Checker}).
*
* For an implementation, see `ERC165`.
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.

View File

@ -2,16 +2,16 @@ pragma solidity ^0.5.0;
/**
* @dev Interface for an ERC1820 implementer, as defined in the
* [EIP](https://eips.ethereum.org/EIPS/eip-1820#interface-implementation-erc1820implementerinterface).
* https://eips.ethereum.org/EIPS/eip-1820#interface-implementation-erc1820implementerinterface[EIP].
* Used by contracts that will be registered as implementers in the
* `IERC1820Registry`.
* {IERC1820Registry}.
*/
interface IERC1820Implementer {
/**
* @dev Returns a special value (`ERC1820_ACCEPT_MAGIC`) if this contract
* implements `interfaceHash` for `account`.
*
* See `IERC1820Registry.setInterfaceImplementer`.
* See {IERC1820Registry-setInterfaceImplementer}.
*/
function canImplementInterfaceForAddress(bytes32 interfaceHash, address account) external view returns (bytes32);
}

View File

@ -2,7 +2,7 @@ pragma solidity ^0.5.0;
/**
* @dev Interface of the global ERC1820 Registry, as defined in the
* [EIP](https://eips.ethereum.org/EIPS/eip-1820). Accounts may register
* https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register
* implementers for interfaces in this registry, as well as query support.
*
* Implementers may be shared by multiple accounts, and can also implement more
@ -10,7 +10,7 @@ pragma solidity ^0.5.0;
* for themselves, but externally-owned accounts (EOA) must delegate this to a
* contract.
*
* `IERC165` interfaces can also be queried via the registry.
* {IERC165} interfaces can also be queried via the registry.
*
* For an in-depth explanation and source code analysis, see the EIP text.
*/
@ -22,7 +22,7 @@ interface IERC1820Registry {
* By default, each account is its own manager. Passing a value of `0x0` in
* `newManager` will reset the manager to this initial state.
*
* Emits a `ManagerChanged` event.
* Emits a {ManagerChanged} event.
*
* Requirements:
*
@ -33,7 +33,7 @@ interface IERC1820Registry {
/**
* @dev Returns the manager for `account`.
*
* See `setManager`.
* See {setManager}.
*/
function getManager(address account) external view returns (address);
@ -44,18 +44,18 @@ interface IERC1820Registry {
* `account` being the zero address is an alias for the caller's address.
* The zero address can also be used in `implementer` to remove an old one.
*
* See `interfaceHash` to learn how these are created.
* See {interfaceHash} to learn how these are created.
*
* Emits an `InterfaceImplementerSet` event.
* Emits an {InterfaceImplementerSet} event.
*
* Requirements:
*
* - the caller must be the current manager for `account`.
* - `interfaceHash` must not be an `IERC165` interface id (i.e. it must not
* - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not
* end in 28 zeroes).
* - `implementer` must implement `IERC1820Implementer` and return true when
* - `implementer` must implement {IERC1820Implementer} and return true when
* queried for support, unless `implementer` is the caller. See
* `IERC1820Implementer.canImplementInterfaceForAddress`.
* {IERC1820Implementer-canImplementInterfaceForAddress}.
*/
function setInterfaceImplementer(address account, bytes32 interfaceHash, address implementer) external;
@ -63,7 +63,7 @@ interface IERC1820Registry {
* @dev Returns the implementer of `interfaceHash` for `account`. If no such
* implementer is registered, returns the zero address.
*
* If `interfaceHash` is an `IERC165` interface id (i.e. it ends with 28
* If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28
* zeroes), `account` will be queried for support of it.
*
* `account` being the zero address is an alias for the caller's address.
@ -73,7 +73,7 @@ interface IERC1820Registry {
/**
* @dev Returns the interface hash for an `interfaceName`, as defined in the
* corresponding
* [section of the EIP](https://eips.ethereum.org/EIPS/eip-1820#interface-name).
* https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP].
*/
function interfaceHash(string calldata interfaceName) external pure returns (bytes32);
@ -88,10 +88,10 @@ interface IERC1820Registry {
* @notice Checks whether a contract implements an ERC165 interface or not.
* If the result is not cached a direct lookup on the contract address is performed.
* If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling
* 'updateERC165Cache' with the contract address.
* {updateERC165Cache} with the contract address.
* @param account Address of the contract to check.
* @param interfaceId ERC165 interface to check.
* @return True if `account.address()` implements `interfaceId`, false otherwise.
* @return True if `account` implements `interfaceId`, false otherwise.
*/
function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool);
@ -99,7 +99,7 @@ interface IERC1820Registry {
* @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.
* @param account Address of the contract to check.
* @param interfaceId ERC165 interface to check.
* @return True if `account.address()` implements `interfaceId`, false otherwise.
* @return True if `account` implements `interfaceId`, false otherwise.
*/
function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool);

View File

@ -1,16 +1,4 @@
---
sections:
- title: Local
contracts:
- IERC165
- ERC165
- ERC165Checker
- title: Global
contracts:
- IERC1820Registry
- IERC1820Implementer
- ERC1820Implementer
---
= Introspection
This set of interfaces and contracts deal with [type introspection](https://en.wikipedia.org/wiki/Type_introspection) of contracts, that is, examining which functions can be called on them. This is usually referred to as a contract's _interface_.
@ -21,3 +9,19 @@ There are two main ways to approach this.
- Globally, where a global and unique registry (`IERC1820Registry`) is used to register implementers of a certain interface (`IERC1820Implementer`). It is then the registry that is queried, which allows for more complex setups, like contracts implementing interfaces for externally-owned accounts.
Note that, in all cases, accounts simply _declare_ their interfaces, but they are not required to actually implement them. This mechanism can therefore be used to both prevent errors and allow for complex interactions (see `ERC777`), but it must not be relied on for security.
== Local
{{IERC165}}
{{ERC165}}
{{ERC165Checker}}
== Global
{{IERC1820Registry}}
{{IERC1820Implementer}}
{{ERC1820Implementer}}