Browse Source

Move event definition at the top of IERC20, IERC777 and IERC1820 (#3228)

Jean Cvllr 3 years ago
parent
commit
3f49408fb6

+ 14 - 14
contracts/token/ERC20/IERC20.sol

@@ -7,6 +7,20 @@ pragma solidity ^0.8.0;
  * @dev Interface of the ERC20 standard as defined in the EIP.
  */
 interface IERC20 {
+    /**
+     * @dev Emitted when `value` tokens are moved from one account (`from`) to
+     * another (`to`).
+     *
+     * Note that `value` may be zero.
+     */
+    event Transfer(address indexed from, address indexed to, uint256 value);
+
+    /**
+     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
+     * a call to {approve}. `value` is the new allowance.
+     */
+    event Approval(address indexed owner, address indexed spender, uint256 value);
+
     /**
      * @dev Returns the amount of tokens in existence.
      */
@@ -65,18 +79,4 @@ interface IERC20 {
         address to,
         uint256 amount
     ) external returns (bool);
-
-    /**
-     * @dev Emitted when `value` tokens are moved from one account (`from`) to
-     * another (`to`).
-     *
-     * Note that `value` may be zero.
-     */
-    event Transfer(address indexed from, address indexed to, uint256 value);
-
-    /**
-     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
-     * a call to {approve}. `value` is the new allowance.
-     */
-    event Approval(address indexed owner, address indexed spender, uint256 value);
 }

+ 24 - 8
contracts/token/ERC777/IERC777.sol

@@ -13,6 +13,30 @@ pragma solidity ^0.8.0;
  * {ERC1820Implementer}.
  */
 interface IERC777 {
+    /**
+     * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.
+     *
+     * Note that some additional user `data` and `operatorData` can be logged in the event.
+     */
+    event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);
+
+    /**
+     * @dev Emitted when `operator` destroys `amount` tokens from `account`.
+     *
+     * Note that some additional user `data` and `operatorData` can be logged in the event.
+     */
+    event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);
+
+    /**
+     * @dev Emitted when `operator` is made operator for `tokenHolder`
+     */
+    event AuthorizedOperator(address indexed operator, address indexed tokenHolder);
+
+    /**
+     * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`
+     */
+    event RevokedOperator(address indexed operator, address indexed tokenHolder);
+
     /**
      * @dev Returns the name of the token.
      */
@@ -182,12 +206,4 @@ interface IERC777 {
         bytes data,
         bytes operatorData
     );
-
-    event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);
-
-    event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);
-
-    event AuthorizedOperator(address indexed operator, address indexed tokenHolder);
-
-    event RevokedOperator(address indexed operator, address indexed tokenHolder);
 }

+ 4 - 4
contracts/utils/introspection/IERC1820Registry.sol

@@ -18,6 +18,10 @@ pragma solidity ^0.8.0;
  * For an in-depth explanation and source code analysis, see the EIP text.
  */
 interface IERC1820Registry {
+    event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer);
+
+    event ManagerChanged(address indexed account, address indexed newManager);
+
     /**
      * @dev Sets `newManager` as the manager for `account`. A manager of an
      * account is able to set interface implementers for it.
@@ -109,8 +113,4 @@ interface IERC1820Registry {
      * @return True if `account` implements `interfaceId`, false otherwise.
      */
     function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool);
-
-    event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer);
-
-    event ManagerChanged(address indexed account, address indexed newManager);
 }