123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- pragma solidity ^0.5.0;
- /**
- * @dev Interface of the ERC777Token standard as defined in the EIP.
- *
- * This contract uses the
- * [ERC1820 registry standard](https://eips.ethereum.org/EIPS/eip-1820) to let
- * token holders and recipients react to token movements by using setting implementers
- * for the associated interfaces in said registry. See `IERC1820Registry` and
- * `ERC1820Implementer`.
- */
- 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`).
- */
- function balanceOf(address owner) external view returns (uint256);
- /**
- * @dev Moves `amount` tokens from the caller's account to `recipient`.
- *
- * If send or receive hooks are registered for the caller and `recipient`,
- * the corresponding functions will be called with `data` and empty
- * `operatorData`. See `IERC777Sender` and `IERC777Recipient`.
- *
- * Emits a `Sent` event.
- *
- * Requirements
- *
- * - the caller must have at least `amount` tokens.
- * - `recipient` cannot be the zero address.
- * - if `recipient` is a contract, it must implement the `tokensReceived`
- * interface.
- */
- function send(address recipient, uint256 amount, bytes calldata data) external;
- /**
- * @dev Destroys `amount` tokens from the caller's account, reducing the
- * total supply.
- *
- * If a send hook is registered for the caller, the corresponding function
- * will be called with `data` and empty `operatorData`. See `IERC777Sender`.
- *
- * Emits a `Burned` event.
- *
- * Requirements
- *
- * - the caller must have at least `amount` tokens.
- */
- function burn(uint256 amount, bytes calldata data) external;
- /**
- * @dev 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 `sender` to `recipient`. The caller must
- * be an operator of `sender`.
- *
- * If send or receive hooks are registered for `sender` and `recipient`,
- * the corresponding functions will be called with `data` and
- * `operatorData`. See `IERC777Sender` and `IERC777Recipient`.
- *
- * Emits a `Sent` event.
- *
- * Requirements
- *
- * - `sender` cannot be the zero address.
- * - `sender` must have at least `amount` tokens.
- * - the caller must be an operator for `sender`.
- * - `recipient` cannot be the zero address.
- * - if `recipient` is a contract, it must implement the `tokensReceived`
- * interface.
- */
- function operatorSend(
- address sender,
- address recipient,
- uint256 amount,
- bytes calldata data,
- bytes calldata operatorData
- ) external;
- /**
- * @dev Destoys `amount` tokens from `account`, reducing the total supply.
- * The caller must be an operator of `account`.
- *
- * If a send hook is registered for `account`, the corresponding function
- * will be called with `data` and `operatorData`. See `IERC777Sender`.
- *
- * Emits a `Burned` event.
- *
- * Requirements
- *
- * - `account` cannot be the zero address.
- * - `account` must have at least `amount` tokens.
- * - the caller must be an operator for `account`.
- */
- function operatorBurn(
- address account,
- uint256 amount,
- bytes calldata data,
- bytes calldata operatorData
- ) external;
- event Sent(
- address indexed operator,
- address indexed from,
- address indexed to,
- uint256 amount,
- 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);
- }
|