Add custom errors to docs (#4480)

This commit is contained in:
Ernesto García
2023-07-27 17:18:45 -06:00
committed by GitHub
parent 9445f96223
commit 02ea01765a
5 changed files with 47 additions and 11 deletions

View File

@ -58,8 +58,7 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a custom error including the required role.
*
* with an {AccessControlUnauthorizedAccount} error including the required role.
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
@ -81,15 +80,16 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
}
/**
* @dev Revert with a custom error if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a custom error if `account` is missing `role`.
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
* is missing `role`.
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {

View File

@ -8,18 +8,21 @@ These interfaces are available as `.sol` files, and also as compiler `.json` ABI
are useful to interact with third party contracts that implement them.
- {IERC20}
- {IERC20Errors}
- {IERC20Metadata}
- {IERC165}
- {IERC721}
- {IERC721Receiver}
- {IERC721Enumerable}
- {IERC721Metadata}
- {IERC721Errors}
- {IERC777}
- {IERC777Recipient}
- {IERC777Sender}
- {IERC1155}
- {IERC1155Receiver}
- {IERC1155MetadataURI}
- {IERC1155Errors}
- {IERC1271}
- {IERC1363}
- {IERC1363Receiver}
@ -40,6 +43,12 @@ are useful to interact with third party contracts that implement them.
== Detailed ABI
{{IERC20Errors}}
{{IERC721Errors}}
{{IERC1155Errors}}
{{IERC1271}}
{{IERC1363}}

View File

@ -3,8 +3,7 @@ pragma solidity ^0.8.19;
/**
* @dev Standard ERC20 Errors
* Interface of the ERC6093 custom errors for ERC20 tokens
* as defined in https://eips.ethereum.org/EIPS/eip-6093
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
@ -50,8 +49,7 @@ interface IERC20Errors {
/**
* @dev Standard ERC721 Errors
* Interface of the ERC6093 custom errors for ERC721 tokens
* as defined in https://eips.ethereum.org/EIPS/eip-6093
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
@ -109,8 +107,7 @@ interface IERC721Errors {
/**
* @dev Standard ERC1155 Errors
* Interface of the ERC6093 custom errors for ERC1155 tokens
* as defined in https://eips.ethereum.org/EIPS/eip-6093
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**