Initial draft of IERC777.
This commit is contained in:
@ -1,9 +1,34 @@
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
/**
|
||||
* @dev Interface of the ERC777Tken standard as defined in the EIP.
|
||||
* @dev Interface of the ERC777Token standard as defined in the EIP.
|
||||
*/
|
||||
interface IERC777 {
|
||||
/**
|
||||
* @dev Returns the name of the token.
|
||||
*/
|
||||
function name() external view returns (string memory);
|
||||
|
||||
/**
|
||||
* @dev Returns the symbol of the token, usually a shorter version of the
|
||||
* name.
|
||||
*/
|
||||
function symbol() external view returns (string memory);
|
||||
|
||||
/**
|
||||
* @dev Returns the smallest part of the token that is not divisible. This
|
||||
* means all token operations (creation, movement and destruction) must have
|
||||
* amounts that are a multiple of this number.
|
||||
*
|
||||
* For most token contracts, this value will equal 1.
|
||||
*/
|
||||
function granularity() external view returns (uint256);
|
||||
|
||||
/**
|
||||
* @dev Returns the amount of tokens in existence.
|
||||
*/
|
||||
function totalSupply() external view returns (uint256);
|
||||
|
||||
/**
|
||||
* @dev Returns the amount of tokens owned by an account (`owner`).
|
||||
*/
|
||||
@ -32,11 +57,61 @@ interface IERC777 {
|
||||
*/
|
||||
function burn(uint256 amount, bytes calldata data) external;
|
||||
|
||||
/**
|
||||
* @devs Returns true if an account is an operator of `tokenHolder`.
|
||||
* Operators can send and burn tokens on behalf of their owners. All
|
||||
* accounts are their own operator.
|
||||
*
|
||||
* See `operatorSend` and `operatorBurn`.
|
||||
*/
|
||||
function isOperatorFor(address operator, address tokenHolder) external view returns (bool);
|
||||
|
||||
/**
|
||||
* @dev Make an account an operator of the caller.
|
||||
*
|
||||
* See `isOperatorFor`.
|
||||
*
|
||||
* Emits an `AuthorizedOperator` event.
|
||||
*
|
||||
* Requirements
|
||||
*
|
||||
* - `operator` cannot be calling address.
|
||||
*/
|
||||
function authorizeOperator(address operator) external;
|
||||
|
||||
/**
|
||||
* @dev Make an account an operator of the caller.
|
||||
*
|
||||
* See `isOperatorFor` and `defaultOperators`.
|
||||
*
|
||||
* Emits a `RevokedOperator` event.
|
||||
*
|
||||
* Requirements
|
||||
*
|
||||
* - `operator` cannot be calling address.
|
||||
*/
|
||||
function revokeOperator(address operator) external;
|
||||
|
||||
/**
|
||||
* @dev Returns the list of default operators. These accounts are operators
|
||||
* for all token holders, even if `authorizeOperator` was never called on
|
||||
* them.
|
||||
*
|
||||
* This list is immutable, but individual holders may revoke these via
|
||||
*`revokeOperator`, in which case `isOperatorFor` will return false.
|
||||
*/
|
||||
function defaultOperators() external view returns (address[] memory);
|
||||
|
||||
/**
|
||||
* @dev Moves `amount` tokens from a token holder's account (`from`) to a
|
||||
* specified recipient (`to`). The caller must be an operator of `from`.
|
||||
*
|
||||
* If send or receive hooks are registered for the holder and receiver,
|
||||
* the corresponding functions will be called with `data` and
|
||||
* `operatorData`. See `IERC777Sender` and `IERC777Recipient`.
|
||||
*
|
||||
* Emits a `Sent` event.
|
||||
*/
|
||||
function operatorSend(
|
||||
address from,
|
||||
address to,
|
||||
@ -45,6 +120,15 @@ interface IERC777 {
|
||||
bytes calldata operatorData
|
||||
) external;
|
||||
|
||||
/**
|
||||
* @dev Destoys `amount` tokens from a token holder's account (`from`),
|
||||
* reducing the total supply. The caller must be an operator of `from`.
|
||||
*
|
||||
* If a send hook is registered for the holder, the corresponding function
|
||||
* will be called with `data` and `operatorData`. See `IERC777Sender`.
|
||||
*
|
||||
* Emits a `Burned` event.
|
||||
*/
|
||||
function operatorBurn(
|
||||
address from,
|
||||
uint256 amount,
|
||||
@ -52,18 +136,6 @@ interface IERC777 {
|
||||
bytes calldata operatorData
|
||||
) external;
|
||||
|
||||
function name() external view returns (string memory);
|
||||
|
||||
function symbol() external view returns (string memory);
|
||||
|
||||
function totalSupply() external view returns (uint256);
|
||||
|
||||
function granularity() external view returns (uint256);
|
||||
|
||||
function defaultOperators() external view returns (address[] memory);
|
||||
|
||||
function isOperatorFor(address operator, address tokenHolder) external view returns (bool);
|
||||
|
||||
event Sent(
|
||||
address indexed operator,
|
||||
address indexed from,
|
||||
|
||||
Reference in New Issue
Block a user