961 lines
49 KiB
Plaintext
961 lines
49 KiB
Plaintext
:github-icon: pass:[<svg class="icon"><use href="#github-icon"/></svg>]
|
|
:IERC777: pass:normal[xref:token/ERC777.adoc#IERC777[`IERC777`]]
|
|
:ERC777: pass:normal[xref:token/ERC777.adoc#ERC777[`ERC777`]]
|
|
:IERC777Sender: pass:normal[xref:token/ERC777.adoc#IERC777Sender[`IERC777Sender`]]
|
|
:IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
|
|
:IERC1820Registry: pass:normal[xref:utils.adoc#IERC1820Registry[`IERC1820Registry`]]
|
|
:ERC1820Implementer: pass:normal[xref:utils.adoc#ERC1820Implementer[`ERC1820Implementer`]]
|
|
:xref-IERC777-name--: xref:token/ERC777.adoc#IERC777-name--
|
|
:xref-IERC777-symbol--: xref:token/ERC777.adoc#IERC777-symbol--
|
|
:xref-IERC777-granularity--: xref:token/ERC777.adoc#IERC777-granularity--
|
|
:xref-IERC777-totalSupply--: xref:token/ERC777.adoc#IERC777-totalSupply--
|
|
:xref-IERC777-balanceOf-address-: xref:token/ERC777.adoc#IERC777-balanceOf-address-
|
|
:xref-IERC777-send-address-uint256-bytes-: xref:token/ERC777.adoc#IERC777-send-address-uint256-bytes-
|
|
:xref-IERC777-burn-uint256-bytes-: xref:token/ERC777.adoc#IERC777-burn-uint256-bytes-
|
|
:xref-IERC777-isOperatorFor-address-address-: xref:token/ERC777.adoc#IERC777-isOperatorFor-address-address-
|
|
:xref-IERC777-authorizeOperator-address-: xref:token/ERC777.adoc#IERC777-authorizeOperator-address-
|
|
:xref-IERC777-revokeOperator-address-: xref:token/ERC777.adoc#IERC777-revokeOperator-address-
|
|
:xref-IERC777-defaultOperators--: xref:token/ERC777.adoc#IERC777-defaultOperators--
|
|
:xref-IERC777-operatorSend-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-operatorSend-address-address-uint256-bytes-bytes-
|
|
:xref-IERC777-operatorBurn-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-operatorBurn-address-uint256-bytes-bytes-
|
|
:xref-IERC777-Minted-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Minted-address-address-uint256-bytes-bytes-
|
|
:xref-IERC777-Burned-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Burned-address-address-uint256-bytes-bytes-
|
|
:xref-IERC777-AuthorizedOperator-address-address-: xref:token/ERC777.adoc#IERC777-AuthorizedOperator-address-address-
|
|
:xref-IERC777-RevokedOperator-address-address-: xref:token/ERC777.adoc#IERC777-RevokedOperator-address-address-
|
|
:xref-IERC777-Sent-address-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Sent-address-address-address-uint256-bytes-bytes-
|
|
:IERC777Sender: pass:normal[xref:token/ERC777.adoc#IERC777Sender[`IERC777Sender`]]
|
|
:IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
|
|
:IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
|
|
:IERC777Sender: pass:normal[xref:token/ERC777.adoc#IERC777Sender[`IERC777Sender`]]
|
|
:IERC777Sender: pass:normal[xref:token/ERC777.adoc#IERC777Sender[`IERC777Sender`]]
|
|
:IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
|
|
:IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
|
|
:IERC777Sender: pass:normal[xref:token/ERC777.adoc#IERC777Sender[`IERC777Sender`]]
|
|
:IERC777: pass:normal[xref:token/ERC777.adoc#IERC777[`IERC777`]]
|
|
:IERC777-Sent: pass:normal[xref:token/ERC777.adoc#IERC777-Sent-address-address-address-uint256-bytes-bytes-[`IERC777.Sent`]]
|
|
:IERC20-Transfer: pass:normal[xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-[`IERC20.Transfer`]]
|
|
:IERC777-granularity: pass:normal[xref:token/ERC777.adoc#IERC777-granularity--[`IERC777.granularity`]]
|
|
:xref-ERC777-constructor-string-string-address---: xref:token/ERC777.adoc#ERC777-constructor-string-string-address---
|
|
:xref-ERC777-name--: xref:token/ERC777.adoc#ERC777-name--
|
|
:xref-ERC777-symbol--: xref:token/ERC777.adoc#ERC777-symbol--
|
|
:xref-ERC777-decimals--: xref:token/ERC777.adoc#ERC777-decimals--
|
|
:xref-ERC777-granularity--: xref:token/ERC777.adoc#ERC777-granularity--
|
|
:xref-ERC777-totalSupply--: xref:token/ERC777.adoc#ERC777-totalSupply--
|
|
:xref-ERC777-balanceOf-address-: xref:token/ERC777.adoc#ERC777-balanceOf-address-
|
|
:xref-ERC777-send-address-uint256-bytes-: xref:token/ERC777.adoc#ERC777-send-address-uint256-bytes-
|
|
:xref-ERC777-transfer-address-uint256-: xref:token/ERC777.adoc#ERC777-transfer-address-uint256-
|
|
:xref-ERC777-burn-uint256-bytes-: xref:token/ERC777.adoc#ERC777-burn-uint256-bytes-
|
|
:xref-ERC777-isOperatorFor-address-address-: xref:token/ERC777.adoc#ERC777-isOperatorFor-address-address-
|
|
:xref-ERC777-authorizeOperator-address-: xref:token/ERC777.adoc#ERC777-authorizeOperator-address-
|
|
:xref-ERC777-revokeOperator-address-: xref:token/ERC777.adoc#ERC777-revokeOperator-address-
|
|
:xref-ERC777-defaultOperators--: xref:token/ERC777.adoc#ERC777-defaultOperators--
|
|
:xref-ERC777-operatorSend-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#ERC777-operatorSend-address-address-uint256-bytes-bytes-
|
|
:xref-ERC777-operatorBurn-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#ERC777-operatorBurn-address-uint256-bytes-bytes-
|
|
:xref-ERC777-allowance-address-address-: xref:token/ERC777.adoc#ERC777-allowance-address-address-
|
|
:xref-ERC777-approve-address-uint256-: xref:token/ERC777.adoc#ERC777-approve-address-uint256-
|
|
:xref-ERC777-transferFrom-address-address-uint256-: xref:token/ERC777.adoc#ERC777-transferFrom-address-address-uint256-
|
|
:xref-ERC777-_mint-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#ERC777-_mint-address-uint256-bytes-bytes-
|
|
:xref-ERC777-_mint-address-uint256-bytes-bytes-bool-: xref:token/ERC777.adoc#ERC777-_mint-address-uint256-bytes-bytes-bool-
|
|
:xref-ERC777-_send-address-address-uint256-bytes-bytes-bool-: xref:token/ERC777.adoc#ERC777-_send-address-address-uint256-bytes-bytes-bool-
|
|
:xref-ERC777-_burn-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#ERC777-_burn-address-uint256-bytes-bytes-
|
|
:xref-ERC777-_approve-address-address-uint256-: xref:token/ERC777.adoc#ERC777-_approve-address-address-uint256-
|
|
:xref-ERC777-_spendAllowance-address-address-uint256-: xref:token/ERC777.adoc#ERC777-_spendAllowance-address-address-uint256-
|
|
:xref-ERC777-_beforeTokenTransfer-address-address-address-uint256-: xref:token/ERC777.adoc#ERC777-_beforeTokenTransfer-address-address-address-uint256-
|
|
:xref-IERC20-Transfer-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-
|
|
:xref-IERC20-Approval-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Approval-address-address-uint256-
|
|
:xref-IERC777-Minted-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Minted-address-address-uint256-bytes-bytes-
|
|
:xref-IERC777-Burned-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Burned-address-address-uint256-bytes-bytes-
|
|
:xref-IERC777-AuthorizedOperator-address-address-: xref:token/ERC777.adoc#IERC777-AuthorizedOperator-address-address-
|
|
:xref-IERC777-RevokedOperator-address-address-: xref:token/ERC777.adoc#IERC777-RevokedOperator-address-address-
|
|
:xref-IERC777-Sent-address-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Sent-address-address-address-uint256-bytes-bytes-
|
|
:IERC777-name: pass:normal[xref:token/ERC777.adoc#IERC777-name--[`IERC777.name`]]
|
|
:IERC777-symbol: pass:normal[xref:token/ERC777.adoc#IERC777-symbol--[`IERC777.symbol`]]
|
|
:ERC20-decimals: pass:normal[xref:token/ERC20.adoc#ERC20-decimals--[`ERC20.decimals`]]
|
|
:IERC777-granularity: pass:normal[xref:token/ERC777.adoc#IERC777-granularity--[`IERC777.granularity`]]
|
|
:IERC777-totalSupply: pass:normal[xref:token/ERC777.adoc#IERC777-totalSupply--[`IERC777.totalSupply`]]
|
|
:IERC777-send: pass:normal[xref:token/ERC777.adoc#IERC777-send-address-uint256-bytes-[`IERC777.send`]]
|
|
:IERC20-Transfer: pass:normal[xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-[`IERC20.Transfer`]]
|
|
:IERC20-transfer: pass:normal[xref:token/ERC20.adoc#IERC20-transfer-address-uint256-[`IERC20.transfer`]]
|
|
:IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
|
|
:IERC777-burn: pass:normal[xref:token/ERC777.adoc#IERC777-burn-uint256-bytes-[`IERC777.burn`]]
|
|
:IERC20-Transfer: pass:normal[xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-[`IERC20.Transfer`]]
|
|
:IERC777-isOperatorFor: pass:normal[xref:token/ERC777.adoc#IERC777-isOperatorFor-address-address-[`IERC777.isOperatorFor`]]
|
|
:IERC777-authorizeOperator: pass:normal[xref:token/ERC777.adoc#IERC777-authorizeOperator-address-[`IERC777.authorizeOperator`]]
|
|
:IERC777-revokeOperator: pass:normal[xref:token/ERC777.adoc#IERC777-revokeOperator-address-[`IERC777.revokeOperator`]]
|
|
:IERC777-defaultOperators: pass:normal[xref:token/ERC777.adoc#IERC777-defaultOperators--[`IERC777.defaultOperators`]]
|
|
:IERC777-operatorSend: pass:normal[xref:token/ERC777.adoc#IERC777-operatorSend-address-address-uint256-bytes-bytes-[`IERC777.operatorSend`]]
|
|
:IERC20-Transfer: pass:normal[xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-[`IERC20.Transfer`]]
|
|
:IERC777-operatorBurn: pass:normal[xref:token/ERC777.adoc#IERC777-operatorBurn-address-uint256-bytes-bytes-[`IERC777.operatorBurn`]]
|
|
:IERC20-Transfer: pass:normal[xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-[`IERC20.Transfer`]]
|
|
:IERC20-allowance: pass:normal[xref:token/ERC20.adoc#IERC20-allowance-address-address-[`IERC20.allowance`]]
|
|
:IERC20-approve: pass:normal[xref:token/ERC20.adoc#IERC20-approve-address-uint256-[`IERC20.approve`]]
|
|
:IERC20-transferFrom: pass:normal[xref:token/ERC20.adoc#IERC20-transferFrom-address-address-uint256-[`IERC20.transferFrom`]]
|
|
:IERC20-Transfer: pass:normal[xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-[`IERC20.Transfer`]]
|
|
:IERC20-Approval: pass:normal[xref:token/ERC20.adoc#IERC20-Approval-address-address-uint256-[`IERC20.Approval`]]
|
|
:IERC777Sender: pass:normal[xref:token/ERC777.adoc#IERC777Sender[`IERC777Sender`]]
|
|
:IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
|
|
:IERC20-Transfer: pass:normal[xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-[`IERC20.Transfer`]]
|
|
:IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
|
|
:IERC777Sender: pass:normal[xref:token/ERC777.adoc#IERC777Sender[`IERC777Sender`]]
|
|
:IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
|
|
:IERC20-Transfer: pass:normal[xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-[`IERC20.Transfer`]]
|
|
:IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
|
|
:ERC20-_approve: pass:normal[xref:token/ERC20.adoc#ERC20-_approve-address-address-uint256-[`ERC20._approve`]]
|
|
:IERC20-Approval: pass:normal[xref:token/ERC20.adoc#IERC20-Approval-address-address-uint256-[`IERC20.Approval`]]
|
|
:IERC777: pass:normal[xref:token/ERC777.adoc#IERC777[`IERC777`]]
|
|
:IERC1820Registry: pass:normal[xref:utils.adoc#IERC1820Registry[`IERC1820Registry`]]
|
|
:ERC1820Implementer: pass:normal[xref:utils.adoc#ERC1820Implementer[`ERC1820Implementer`]]
|
|
:xref-IERC777Sender-tokensToSend-address-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777Sender-tokensToSend-address-address-address-uint256-bytes-bytes-
|
|
:IERC777: pass:normal[xref:token/ERC777.adoc#IERC777[`IERC777`]]
|
|
:IERC777-balanceOf: pass:normal[xref:token/ERC777.adoc#IERC777-balanceOf-address-[`IERC777.balanceOf`]]
|
|
:IERC777: pass:normal[xref:token/ERC777.adoc#IERC777[`IERC777`]]
|
|
:IERC1820Registry: pass:normal[xref:utils.adoc#IERC1820Registry[`IERC1820Registry`]]
|
|
:ERC1820Implementer: pass:normal[xref:utils.adoc#ERC1820Implementer[`ERC1820Implementer`]]
|
|
:xref-IERC777Recipient-tokensReceived-address-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777Recipient-tokensReceived-address-address-address-uint256-bytes-bytes-
|
|
:IERC777: pass:normal[xref:token/ERC777.adoc#IERC777[`IERC777`]]
|
|
:IERC777-balanceOf: pass:normal[xref:token/ERC777.adoc#IERC777-balanceOf-address-[`IERC777.balanceOf`]]
|
|
:ERC777: pass:normal[xref:token/ERC777.adoc#ERC777[`ERC777`]]
|
|
:xref-ERC777PresetFixedSupply-constructor-string-string-address---uint256-address-: xref:token/ERC777.adoc#ERC777PresetFixedSupply-constructor-string-string-address---uint256-address-
|
|
:xref-ERC777-name--: xref:token/ERC777.adoc#ERC777-name--
|
|
:xref-ERC777-symbol--: xref:token/ERC777.adoc#ERC777-symbol--
|
|
:xref-ERC777-decimals--: xref:token/ERC777.adoc#ERC777-decimals--
|
|
:xref-ERC777-granularity--: xref:token/ERC777.adoc#ERC777-granularity--
|
|
:xref-ERC777-totalSupply--: xref:token/ERC777.adoc#ERC777-totalSupply--
|
|
:xref-ERC777-balanceOf-address-: xref:token/ERC777.adoc#ERC777-balanceOf-address-
|
|
:xref-ERC777-send-address-uint256-bytes-: xref:token/ERC777.adoc#ERC777-send-address-uint256-bytes-
|
|
:xref-ERC777-transfer-address-uint256-: xref:token/ERC777.adoc#ERC777-transfer-address-uint256-
|
|
:xref-ERC777-burn-uint256-bytes-: xref:token/ERC777.adoc#ERC777-burn-uint256-bytes-
|
|
:xref-ERC777-isOperatorFor-address-address-: xref:token/ERC777.adoc#ERC777-isOperatorFor-address-address-
|
|
:xref-ERC777-authorizeOperator-address-: xref:token/ERC777.adoc#ERC777-authorizeOperator-address-
|
|
:xref-ERC777-revokeOperator-address-: xref:token/ERC777.adoc#ERC777-revokeOperator-address-
|
|
:xref-ERC777-defaultOperators--: xref:token/ERC777.adoc#ERC777-defaultOperators--
|
|
:xref-ERC777-operatorSend-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#ERC777-operatorSend-address-address-uint256-bytes-bytes-
|
|
:xref-ERC777-operatorBurn-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#ERC777-operatorBurn-address-uint256-bytes-bytes-
|
|
:xref-ERC777-allowance-address-address-: xref:token/ERC777.adoc#ERC777-allowance-address-address-
|
|
:xref-ERC777-approve-address-uint256-: xref:token/ERC777.adoc#ERC777-approve-address-uint256-
|
|
:xref-ERC777-transferFrom-address-address-uint256-: xref:token/ERC777.adoc#ERC777-transferFrom-address-address-uint256-
|
|
:xref-ERC777-_mint-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#ERC777-_mint-address-uint256-bytes-bytes-
|
|
:xref-ERC777-_mint-address-uint256-bytes-bytes-bool-: xref:token/ERC777.adoc#ERC777-_mint-address-uint256-bytes-bytes-bool-
|
|
:xref-ERC777-_send-address-address-uint256-bytes-bytes-bool-: xref:token/ERC777.adoc#ERC777-_send-address-address-uint256-bytes-bytes-bool-
|
|
:xref-ERC777-_burn-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#ERC777-_burn-address-uint256-bytes-bytes-
|
|
:xref-ERC777-_approve-address-address-uint256-: xref:token/ERC777.adoc#ERC777-_approve-address-address-uint256-
|
|
:xref-ERC777-_spendAllowance-address-address-uint256-: xref:token/ERC777.adoc#ERC777-_spendAllowance-address-address-uint256-
|
|
:xref-ERC777-_beforeTokenTransfer-address-address-address-uint256-: xref:token/ERC777.adoc#ERC777-_beforeTokenTransfer-address-address-address-uint256-
|
|
:xref-IERC20-Transfer-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-
|
|
:xref-IERC20-Approval-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Approval-address-address-uint256-
|
|
:xref-IERC777-Minted-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Minted-address-address-uint256-bytes-bytes-
|
|
:xref-IERC777-Burned-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Burned-address-address-uint256-bytes-bytes-
|
|
:xref-IERC777-AuthorizedOperator-address-address-: xref:token/ERC777.adoc#IERC777-AuthorizedOperator-address-address-
|
|
:xref-IERC777-RevokedOperator-address-address-: xref:token/ERC777.adoc#IERC777-RevokedOperator-address-address-
|
|
:xref-IERC777-Sent-address-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Sent-address-address-address-uint256-bytes-bytes-
|
|
:ERC777-constructor: pass:normal[xref:token/ERC777.adoc#ERC777-constructor-string-string-address---[`ERC777.constructor`]]
|
|
= ERC 777
|
|
|
|
[.readme-notice]
|
|
NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/token/erc777
|
|
|
|
This set of interfaces and contracts are all related to the https://eips.ethereum.org/EIPS/eip-777[ERC777 token standard].
|
|
|
|
TIP: For an overview of ERC777 tokens and a walk through on how to create a token contract read our xref:ROOT:erc777.adoc[ERC777 guide].
|
|
|
|
The token behavior itself is implemented in the core contracts: {IERC777}, {ERC777}.
|
|
|
|
Additionally there are interfaces used to develop contracts that react to token movements: {IERC777Sender}, {IERC777Recipient}.
|
|
|
|
== Core
|
|
|
|
:Minted: pass:normal[xref:#IERC777-Minted-address-address-uint256-bytes-bytes-[`++Minted++`]]
|
|
:Burned: pass:normal[xref:#IERC777-Burned-address-address-uint256-bytes-bytes-[`++Burned++`]]
|
|
:AuthorizedOperator: pass:normal[xref:#IERC777-AuthorizedOperator-address-address-[`++AuthorizedOperator++`]]
|
|
:RevokedOperator: pass:normal[xref:#IERC777-RevokedOperator-address-address-[`++RevokedOperator++`]]
|
|
:name: pass:normal[xref:#IERC777-name--[`++name++`]]
|
|
:symbol: pass:normal[xref:#IERC777-symbol--[`++symbol++`]]
|
|
:granularity: pass:normal[xref:#IERC777-granularity--[`++granularity++`]]
|
|
:totalSupply: pass:normal[xref:#IERC777-totalSupply--[`++totalSupply++`]]
|
|
:balanceOf: pass:normal[xref:#IERC777-balanceOf-address-[`++balanceOf++`]]
|
|
:send: pass:normal[xref:#IERC777-send-address-uint256-bytes-[`++send++`]]
|
|
:burn: pass:normal[xref:#IERC777-burn-uint256-bytes-[`++burn++`]]
|
|
:isOperatorFor: pass:normal[xref:#IERC777-isOperatorFor-address-address-[`++isOperatorFor++`]]
|
|
:authorizeOperator: pass:normal[xref:#IERC777-authorizeOperator-address-[`++authorizeOperator++`]]
|
|
:revokeOperator: pass:normal[xref:#IERC777-revokeOperator-address-[`++revokeOperator++`]]
|
|
:defaultOperators: pass:normal[xref:#IERC777-defaultOperators--[`++defaultOperators++`]]
|
|
:operatorSend: pass:normal[xref:#IERC777-operatorSend-address-address-uint256-bytes-bytes-[`++operatorSend++`]]
|
|
:operatorBurn: pass:normal[xref:#IERC777-operatorBurn-address-uint256-bytes-bytes-[`++operatorBurn++`]]
|
|
:Sent: pass:normal[xref:#IERC777-Sent-address-address-address-uint256-bytes-bytes-[`++Sent++`]]
|
|
|
|
[.contract]
|
|
[[IERC777]]
|
|
=== `++IERC777++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.0/contracts/token/ERC777/IERC777.sol[{github-icon},role=heading-link]
|
|
|
|
[.hljs-theme-light.nopadding]
|
|
```solidity
|
|
import "@openzeppelin/contracts/token/ERC777/IERC777.sol";
|
|
```
|
|
|
|
Interface of the ERC777Token standard as defined in the EIP.
|
|
|
|
This contract uses the
|
|
https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] 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}.
|
|
|
|
[.contract-index]
|
|
.Functions
|
|
--
|
|
* {xref-IERC777-name--}[`++name()++`]
|
|
* {xref-IERC777-symbol--}[`++symbol()++`]
|
|
* {xref-IERC777-granularity--}[`++granularity()++`]
|
|
* {xref-IERC777-totalSupply--}[`++totalSupply()++`]
|
|
* {xref-IERC777-balanceOf-address-}[`++balanceOf(owner)++`]
|
|
* {xref-IERC777-send-address-uint256-bytes-}[`++send(recipient, amount, data)++`]
|
|
* {xref-IERC777-burn-uint256-bytes-}[`++burn(amount, data)++`]
|
|
* {xref-IERC777-isOperatorFor-address-address-}[`++isOperatorFor(operator, tokenHolder)++`]
|
|
* {xref-IERC777-authorizeOperator-address-}[`++authorizeOperator(operator)++`]
|
|
* {xref-IERC777-revokeOperator-address-}[`++revokeOperator(operator)++`]
|
|
* {xref-IERC777-defaultOperators--}[`++defaultOperators()++`]
|
|
* {xref-IERC777-operatorSend-address-address-uint256-bytes-bytes-}[`++operatorSend(sender, recipient, amount, data, operatorData)++`]
|
|
* {xref-IERC777-operatorBurn-address-uint256-bytes-bytes-}[`++operatorBurn(account, amount, data, operatorData)++`]
|
|
|
|
--
|
|
|
|
[.contract-index]
|
|
.Events
|
|
--
|
|
* {xref-IERC777-Minted-address-address-uint256-bytes-bytes-}[`++Minted(operator, to, amount, data, operatorData)++`]
|
|
* {xref-IERC777-Burned-address-address-uint256-bytes-bytes-}[`++Burned(operator, from, amount, data, operatorData)++`]
|
|
* {xref-IERC777-AuthorizedOperator-address-address-}[`++AuthorizedOperator(operator, tokenHolder)++`]
|
|
* {xref-IERC777-RevokedOperator-address-address-}[`++RevokedOperator(operator, tokenHolder)++`]
|
|
* {xref-IERC777-Sent-address-address-address-uint256-bytes-bytes-}[`++Sent(operator, from, to, amount, data, operatorData)++`]
|
|
|
|
--
|
|
|
|
[.contract-item]
|
|
[[IERC777-name--]]
|
|
==== `[.contract-item-name]#++name++#++() → string++` [.item-kind]#external#
|
|
|
|
Returns the name of the token.
|
|
|
|
[.contract-item]
|
|
[[IERC777-symbol--]]
|
|
==== `[.contract-item-name]#++symbol++#++() → string++` [.item-kind]#external#
|
|
|
|
Returns the symbol of the token, usually a shorter version of the
|
|
name.
|
|
|
|
[.contract-item]
|
|
[[IERC777-granularity--]]
|
|
==== `[.contract-item-name]#++granularity++#++() → uint256++` [.item-kind]#external#
|
|
|
|
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.
|
|
|
|
[.contract-item]
|
|
[[IERC777-totalSupply--]]
|
|
==== `[.contract-item-name]#++totalSupply++#++() → uint256++` [.item-kind]#external#
|
|
|
|
Returns the amount of tokens in existence.
|
|
|
|
[.contract-item]
|
|
[[IERC777-balanceOf-address-]]
|
|
==== `[.contract-item-name]#++balanceOf++#++(address owner) → uint256++` [.item-kind]#external#
|
|
|
|
Returns the amount of tokens owned by an account (`owner`).
|
|
|
|
[.contract-item]
|
|
[[IERC777-send-address-uint256-bytes-]]
|
|
==== `[.contract-item-name]#++send++#++(address recipient, uint256 amount, bytes data)++` [.item-kind]#external#
|
|
|
|
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 {IERC777Recipient}
|
|
interface.
|
|
|
|
[.contract-item]
|
|
[[IERC777-burn-uint256-bytes-]]
|
|
==== `[.contract-item-name]#++burn++#++(uint256 amount, bytes data)++` [.item-kind]#external#
|
|
|
|
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.
|
|
|
|
[.contract-item]
|
|
[[IERC777-isOperatorFor-address-address-]]
|
|
==== `[.contract-item-name]#++isOperatorFor++#++(address operator, address tokenHolder) → bool++` [.item-kind]#external#
|
|
|
|
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}.
|
|
|
|
[.contract-item]
|
|
[[IERC777-authorizeOperator-address-]]
|
|
==== `[.contract-item-name]#++authorizeOperator++#++(address operator)++` [.item-kind]#external#
|
|
|
|
Make an account an operator of the caller.
|
|
|
|
See {isOperatorFor}.
|
|
|
|
Emits an {AuthorizedOperator} event.
|
|
|
|
Requirements
|
|
|
|
- `operator` cannot be calling address.
|
|
|
|
[.contract-item]
|
|
[[IERC777-revokeOperator-address-]]
|
|
==== `[.contract-item-name]#++revokeOperator++#++(address operator)++` [.item-kind]#external#
|
|
|
|
Revoke an account's operator status for the caller.
|
|
|
|
See {isOperatorFor} and {defaultOperators}.
|
|
|
|
Emits a {RevokedOperator} event.
|
|
|
|
Requirements
|
|
|
|
- `operator` cannot be calling address.
|
|
|
|
[.contract-item]
|
|
[[IERC777-defaultOperators--]]
|
|
==== `[.contract-item-name]#++defaultOperators++#++() → address[]++` [.item-kind]#external#
|
|
|
|
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.
|
|
|
|
[.contract-item]
|
|
[[IERC777-operatorSend-address-address-uint256-bytes-bytes-]]
|
|
==== `[.contract-item-name]#++operatorSend++#++(address sender, address recipient, uint256 amount, bytes data, bytes operatorData)++` [.item-kind]#external#
|
|
|
|
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 {IERC777Recipient}
|
|
interface.
|
|
|
|
[.contract-item]
|
|
[[IERC777-operatorBurn-address-uint256-bytes-bytes-]]
|
|
==== `[.contract-item-name]#++operatorBurn++#++(address account, uint256 amount, bytes data, bytes operatorData)++` [.item-kind]#external#
|
|
|
|
Destroys `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`.
|
|
|
|
[.contract-item]
|
|
[[IERC777-Minted-address-address-uint256-bytes-bytes-]]
|
|
==== `[.contract-item-name]#++Minted++#++(address operator, address to, uint256 amount, bytes data, bytes operatorData)++` [.item-kind]#event#
|
|
|
|
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.
|
|
|
|
[.contract-item]
|
|
[[IERC777-Burned-address-address-uint256-bytes-bytes-]]
|
|
==== `[.contract-item-name]#++Burned++#++(address operator, address from, uint256 amount, bytes data, bytes operatorData)++` [.item-kind]#event#
|
|
|
|
Emitted when `operator` destroys `amount` tokens from `account`.
|
|
|
|
Note that some additional user `data` and `operatorData` can be logged in the event.
|
|
|
|
[.contract-item]
|
|
[[IERC777-AuthorizedOperator-address-address-]]
|
|
==== `[.contract-item-name]#++AuthorizedOperator++#++(address operator, address tokenHolder)++` [.item-kind]#event#
|
|
|
|
Emitted when `operator` is made operator for `tokenHolder`.
|
|
|
|
[.contract-item]
|
|
[[IERC777-RevokedOperator-address-address-]]
|
|
==== `[.contract-item-name]#++RevokedOperator++#++(address operator, address tokenHolder)++` [.item-kind]#event#
|
|
|
|
Emitted when `operator` is revoked its operator status for `tokenHolder`.
|
|
|
|
[.contract-item]
|
|
[[IERC777-Sent-address-address-address-uint256-bytes-bytes-]]
|
|
==== `[.contract-item-name]#++Sent++#++(address operator, address from, address to, uint256 amount, bytes data, bytes operatorData)++` [.item-kind]#event#
|
|
|
|
:_ERC1820_REGISTRY: pass:normal[xref:#ERC777-_ERC1820_REGISTRY-contract-IERC1820Registry[`++_ERC1820_REGISTRY++`]]
|
|
:_balances: pass:normal[xref:#ERC777-_balances-mapping-address----uint256-[`++_balances++`]]
|
|
:_totalSupply: pass:normal[xref:#ERC777-_totalSupply-uint256[`++_totalSupply++`]]
|
|
:_name: pass:normal[xref:#ERC777-_name-string[`++_name++`]]
|
|
:_symbol: pass:normal[xref:#ERC777-_symbol-string[`++_symbol++`]]
|
|
:_TOKENS_SENDER_INTERFACE_HASH: pass:normal[xref:#ERC777-_TOKENS_SENDER_INTERFACE_HASH-bytes32[`++_TOKENS_SENDER_INTERFACE_HASH++`]]
|
|
:_TOKENS_RECIPIENT_INTERFACE_HASH: pass:normal[xref:#ERC777-_TOKENS_RECIPIENT_INTERFACE_HASH-bytes32[`++_TOKENS_RECIPIENT_INTERFACE_HASH++`]]
|
|
:_defaultOperatorsArray: pass:normal[xref:#ERC777-_defaultOperatorsArray-address--[`++_defaultOperatorsArray++`]]
|
|
:_defaultOperators: pass:normal[xref:#ERC777-_defaultOperators-mapping-address----bool-[`++_defaultOperators++`]]
|
|
:_operators: pass:normal[xref:#ERC777-_operators-mapping-address----mapping-address----bool--[`++_operators++`]]
|
|
:_revokedDefaultOperators: pass:normal[xref:#ERC777-_revokedDefaultOperators-mapping-address----mapping-address----bool--[`++_revokedDefaultOperators++`]]
|
|
:_allowances: pass:normal[xref:#ERC777-_allowances-mapping-address----mapping-address----uint256--[`++_allowances++`]]
|
|
:constructor: pass:normal[xref:#ERC777-constructor-string-string-address---[`++constructor++`]]
|
|
:name: pass:normal[xref:#ERC777-name--[`++name++`]]
|
|
:symbol: pass:normal[xref:#ERC777-symbol--[`++symbol++`]]
|
|
:decimals: pass:normal[xref:#ERC777-decimals--[`++decimals++`]]
|
|
:granularity: pass:normal[xref:#ERC777-granularity--[`++granularity++`]]
|
|
:totalSupply: pass:normal[xref:#ERC777-totalSupply--[`++totalSupply++`]]
|
|
:balanceOf: pass:normal[xref:#ERC777-balanceOf-address-[`++balanceOf++`]]
|
|
:send: pass:normal[xref:#ERC777-send-address-uint256-bytes-[`++send++`]]
|
|
:transfer: pass:normal[xref:#ERC777-transfer-address-uint256-[`++transfer++`]]
|
|
:burn: pass:normal[xref:#ERC777-burn-uint256-bytes-[`++burn++`]]
|
|
:isOperatorFor: pass:normal[xref:#ERC777-isOperatorFor-address-address-[`++isOperatorFor++`]]
|
|
:authorizeOperator: pass:normal[xref:#ERC777-authorizeOperator-address-[`++authorizeOperator++`]]
|
|
:revokeOperator: pass:normal[xref:#ERC777-revokeOperator-address-[`++revokeOperator++`]]
|
|
:defaultOperators: pass:normal[xref:#ERC777-defaultOperators--[`++defaultOperators++`]]
|
|
:operatorSend: pass:normal[xref:#ERC777-operatorSend-address-address-uint256-bytes-bytes-[`++operatorSend++`]]
|
|
:operatorBurn: pass:normal[xref:#ERC777-operatorBurn-address-uint256-bytes-bytes-[`++operatorBurn++`]]
|
|
:allowance: pass:normal[xref:#ERC777-allowance-address-address-[`++allowance++`]]
|
|
:approve: pass:normal[xref:#ERC777-approve-address-uint256-[`++approve++`]]
|
|
:transferFrom: pass:normal[xref:#ERC777-transferFrom-address-address-uint256-[`++transferFrom++`]]
|
|
:_mint: pass:normal[xref:#ERC777-_mint-address-uint256-bytes-bytes-[`++_mint++`]]
|
|
:_mint: pass:normal[xref:#ERC777-_mint-address-uint256-bytes-bytes-bool-[`++_mint++`]]
|
|
:_send: pass:normal[xref:#ERC777-_send-address-address-uint256-bytes-bytes-bool-[`++_send++`]]
|
|
:_burn: pass:normal[xref:#ERC777-_burn-address-uint256-bytes-bytes-[`++_burn++`]]
|
|
:_move: pass:normal[xref:#ERC777-_move-address-address-address-uint256-bytes-bytes-[`++_move++`]]
|
|
:_approve: pass:normal[xref:#ERC777-_approve-address-address-uint256-[`++_approve++`]]
|
|
:_callTokensToSend: pass:normal[xref:#ERC777-_callTokensToSend-address-address-address-uint256-bytes-bytes-[`++_callTokensToSend++`]]
|
|
:_callTokensReceived: pass:normal[xref:#ERC777-_callTokensReceived-address-address-address-uint256-bytes-bytes-bool-[`++_callTokensReceived++`]]
|
|
:_spendAllowance: pass:normal[xref:#ERC777-_spendAllowance-address-address-uint256-[`++_spendAllowance++`]]
|
|
:_beforeTokenTransfer: pass:normal[xref:#ERC777-_beforeTokenTransfer-address-address-address-uint256-[`++_beforeTokenTransfer++`]]
|
|
|
|
[.contract]
|
|
[[ERC777]]
|
|
=== `++ERC777++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.0/contracts/token/ERC777/ERC777.sol[{github-icon},role=heading-link]
|
|
|
|
[.hljs-theme-light.nopadding]
|
|
```solidity
|
|
import "@openzeppelin/contracts/token/ERC777/ERC777.sol";
|
|
```
|
|
|
|
Implementation of the {IERC777} interface.
|
|
|
|
This implementation is agnostic to the way tokens are created. This means
|
|
that a supply mechanism has to be added in a derived contract using {_mint}.
|
|
|
|
Support for ERC20 is included in this contract, as specified by the EIP: both
|
|
the ERC777 and ERC20 interfaces can be safely used when interacting with it.
|
|
Both {IERC777-Sent} and {IERC20-Transfer} events are emitted on token
|
|
movements.
|
|
|
|
Additionally, the {IERC777-granularity} value is hard-coded to `1`, meaning that there
|
|
are no special restrictions in the amount of tokens that created, moved, or
|
|
destroyed. This makes integration with ERC20 applications seamless.
|
|
|
|
[.contract-index]
|
|
.Functions
|
|
--
|
|
* {xref-ERC777-constructor-string-string-address---}[`++constructor(name_, symbol_, defaultOperators_)++`]
|
|
* {xref-ERC777-name--}[`++name()++`]
|
|
* {xref-ERC777-symbol--}[`++symbol()++`]
|
|
* {xref-ERC777-decimals--}[`++decimals()++`]
|
|
* {xref-ERC777-granularity--}[`++granularity()++`]
|
|
* {xref-ERC777-totalSupply--}[`++totalSupply()++`]
|
|
* {xref-ERC777-balanceOf-address-}[`++balanceOf(tokenHolder)++`]
|
|
* {xref-ERC777-send-address-uint256-bytes-}[`++send(recipient, amount, data)++`]
|
|
* {xref-ERC777-transfer-address-uint256-}[`++transfer(recipient, amount)++`]
|
|
* {xref-ERC777-burn-uint256-bytes-}[`++burn(amount, data)++`]
|
|
* {xref-ERC777-isOperatorFor-address-address-}[`++isOperatorFor(operator, tokenHolder)++`]
|
|
* {xref-ERC777-authorizeOperator-address-}[`++authorizeOperator(operator)++`]
|
|
* {xref-ERC777-revokeOperator-address-}[`++revokeOperator(operator)++`]
|
|
* {xref-ERC777-defaultOperators--}[`++defaultOperators()++`]
|
|
* {xref-ERC777-operatorSend-address-address-uint256-bytes-bytes-}[`++operatorSend(sender, recipient, amount, data, operatorData)++`]
|
|
* {xref-ERC777-operatorBurn-address-uint256-bytes-bytes-}[`++operatorBurn(account, amount, data, operatorData)++`]
|
|
* {xref-ERC777-allowance-address-address-}[`++allowance(holder, spender)++`]
|
|
* {xref-ERC777-approve-address-uint256-}[`++approve(spender, value)++`]
|
|
* {xref-ERC777-transferFrom-address-address-uint256-}[`++transferFrom(holder, recipient, amount)++`]
|
|
* {xref-ERC777-_mint-address-uint256-bytes-bytes-}[`++_mint(account, amount, userData, operatorData)++`]
|
|
* {xref-ERC777-_mint-address-uint256-bytes-bytes-bool-}[`++_mint(account, amount, userData, operatorData, requireReceptionAck)++`]
|
|
* {xref-ERC777-_send-address-address-uint256-bytes-bytes-bool-}[`++_send(from, to, amount, userData, operatorData, requireReceptionAck)++`]
|
|
* {xref-ERC777-_burn-address-uint256-bytes-bytes-}[`++_burn(from, amount, data, operatorData)++`]
|
|
* {xref-ERC777-_approve-address-address-uint256-}[`++_approve(holder, spender, value)++`]
|
|
* {xref-ERC777-_spendAllowance-address-address-uint256-}[`++_spendAllowance(owner, spender, amount)++`]
|
|
* {xref-ERC777-_beforeTokenTransfer-address-address-address-uint256-}[`++_beforeTokenTransfer(operator, from, to, amount)++`]
|
|
|
|
[.contract-subindex-inherited]
|
|
.IERC20
|
|
|
|
[.contract-subindex-inherited]
|
|
.IERC777
|
|
|
|
--
|
|
|
|
[.contract-index]
|
|
.Events
|
|
--
|
|
|
|
[.contract-subindex-inherited]
|
|
.IERC20
|
|
* {xref-IERC20-Transfer-address-address-uint256-}[`++Transfer(from, to, value)++`]
|
|
* {xref-IERC20-Approval-address-address-uint256-}[`++Approval(owner, spender, value)++`]
|
|
|
|
[.contract-subindex-inherited]
|
|
.IERC777
|
|
* {xref-IERC777-Minted-address-address-uint256-bytes-bytes-}[`++Minted(operator, to, amount, data, operatorData)++`]
|
|
* {xref-IERC777-Burned-address-address-uint256-bytes-bytes-}[`++Burned(operator, from, amount, data, operatorData)++`]
|
|
* {xref-IERC777-AuthorizedOperator-address-address-}[`++AuthorizedOperator(operator, tokenHolder)++`]
|
|
* {xref-IERC777-RevokedOperator-address-address-}[`++RevokedOperator(operator, tokenHolder)++`]
|
|
* {xref-IERC777-Sent-address-address-address-uint256-bytes-bytes-}[`++Sent(operator, from, to, amount, data, operatorData)++`]
|
|
|
|
--
|
|
|
|
[.contract-item]
|
|
[[ERC777-constructor-string-string-address---]]
|
|
==== `[.contract-item-name]#++constructor++#++(string name_, string symbol_, address[] defaultOperators_)++` [.item-kind]#public#
|
|
|
|
`defaultOperators` may be an empty array.
|
|
|
|
[.contract-item]
|
|
[[ERC777-name--]]
|
|
==== `[.contract-item-name]#++name++#++() → string++` [.item-kind]#public#
|
|
|
|
See {IERC777-name}.
|
|
|
|
[.contract-item]
|
|
[[ERC777-symbol--]]
|
|
==== `[.contract-item-name]#++symbol++#++() → string++` [.item-kind]#public#
|
|
|
|
See {IERC777-symbol}.
|
|
|
|
[.contract-item]
|
|
[[ERC777-decimals--]]
|
|
==== `[.contract-item-name]#++decimals++#++() → uint8++` [.item-kind]#public#
|
|
|
|
See {ERC20-decimals}.
|
|
|
|
Always returns 18, as per the
|
|
[ERC777 EIP](https://eips.ethereum.org/EIPS/eip-777#backward-compatibility).
|
|
|
|
[.contract-item]
|
|
[[ERC777-granularity--]]
|
|
==== `[.contract-item-name]#++granularity++#++() → uint256++` [.item-kind]#public#
|
|
|
|
See {IERC777-granularity}.
|
|
|
|
This implementation always returns `1`.
|
|
|
|
[.contract-item]
|
|
[[ERC777-totalSupply--]]
|
|
==== `[.contract-item-name]#++totalSupply++#++() → uint256++` [.item-kind]#public#
|
|
|
|
See {IERC777-totalSupply}.
|
|
|
|
[.contract-item]
|
|
[[ERC777-balanceOf-address-]]
|
|
==== `[.contract-item-name]#++balanceOf++#++(address tokenHolder) → uint256++` [.item-kind]#public#
|
|
|
|
Returns the amount of tokens owned by an account (`tokenHolder`).
|
|
|
|
[.contract-item]
|
|
[[ERC777-send-address-uint256-bytes-]]
|
|
==== `[.contract-item-name]#++send++#++(address recipient, uint256 amount, bytes data)++` [.item-kind]#public#
|
|
|
|
See {IERC777-send}.
|
|
|
|
Also emits a {IERC20-Transfer} event for ERC20 compatibility.
|
|
|
|
[.contract-item]
|
|
[[ERC777-transfer-address-uint256-]]
|
|
==== `[.contract-item-name]#++transfer++#++(address recipient, uint256 amount) → bool++` [.item-kind]#public#
|
|
|
|
See {IERC20-transfer}.
|
|
|
|
Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient}
|
|
interface if it is a contract.
|
|
|
|
Also emits a {Sent} event.
|
|
|
|
[.contract-item]
|
|
[[ERC777-burn-uint256-bytes-]]
|
|
==== `[.contract-item-name]#++burn++#++(uint256 amount, bytes data)++` [.item-kind]#public#
|
|
|
|
See {IERC777-burn}.
|
|
|
|
Also emits a {IERC20-Transfer} event for ERC20 compatibility.
|
|
|
|
[.contract-item]
|
|
[[ERC777-isOperatorFor-address-address-]]
|
|
==== `[.contract-item-name]#++isOperatorFor++#++(address operator, address tokenHolder) → bool++` [.item-kind]#public#
|
|
|
|
See {IERC777-isOperatorFor}.
|
|
|
|
[.contract-item]
|
|
[[ERC777-authorizeOperator-address-]]
|
|
==== `[.contract-item-name]#++authorizeOperator++#++(address operator)++` [.item-kind]#public#
|
|
|
|
See {IERC777-authorizeOperator}.
|
|
|
|
[.contract-item]
|
|
[[ERC777-revokeOperator-address-]]
|
|
==== `[.contract-item-name]#++revokeOperator++#++(address operator)++` [.item-kind]#public#
|
|
|
|
See {IERC777-revokeOperator}.
|
|
|
|
[.contract-item]
|
|
[[ERC777-defaultOperators--]]
|
|
==== `[.contract-item-name]#++defaultOperators++#++() → address[]++` [.item-kind]#public#
|
|
|
|
See {IERC777-defaultOperators}.
|
|
|
|
[.contract-item]
|
|
[[ERC777-operatorSend-address-address-uint256-bytes-bytes-]]
|
|
==== `[.contract-item-name]#++operatorSend++#++(address sender, address recipient, uint256 amount, bytes data, bytes operatorData)++` [.item-kind]#public#
|
|
|
|
See {IERC777-operatorSend}.
|
|
|
|
Emits {Sent} and {IERC20-Transfer} events.
|
|
|
|
[.contract-item]
|
|
[[ERC777-operatorBurn-address-uint256-bytes-bytes-]]
|
|
==== `[.contract-item-name]#++operatorBurn++#++(address account, uint256 amount, bytes data, bytes operatorData)++` [.item-kind]#public#
|
|
|
|
See {IERC777-operatorBurn}.
|
|
|
|
Emits {Burned} and {IERC20-Transfer} events.
|
|
|
|
[.contract-item]
|
|
[[ERC777-allowance-address-address-]]
|
|
==== `[.contract-item-name]#++allowance++#++(address holder, address spender) → uint256++` [.item-kind]#public#
|
|
|
|
See {IERC20-allowance}.
|
|
|
|
Note that operator and allowance concepts are orthogonal: operators may
|
|
not have allowance, and accounts with allowance may not be operators
|
|
themselves.
|
|
|
|
[.contract-item]
|
|
[[ERC777-approve-address-uint256-]]
|
|
==== `[.contract-item-name]#++approve++#++(address spender, uint256 value) → bool++` [.item-kind]#public#
|
|
|
|
See {IERC20-approve}.
|
|
|
|
NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
|
|
`transferFrom`. This is semantically equivalent to an infinite approval.
|
|
|
|
Note that accounts cannot have allowance issued by their operators.
|
|
|
|
[.contract-item]
|
|
[[ERC777-transferFrom-address-address-uint256-]]
|
|
==== `[.contract-item-name]#++transferFrom++#++(address holder, address recipient, uint256 amount) → bool++` [.item-kind]#public#
|
|
|
|
See {IERC20-transferFrom}.
|
|
|
|
NOTE: Does not update the allowance if the current allowance
|
|
is the maximum `uint256`.
|
|
|
|
Note that operator and allowance concepts are orthogonal: operators cannot
|
|
call `transferFrom` (unless they have allowance), and accounts with
|
|
allowance cannot call `operatorSend` (unless they are operators).
|
|
|
|
Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events.
|
|
|
|
[.contract-item]
|
|
[[ERC777-_mint-address-uint256-bytes-bytes-]]
|
|
==== `[.contract-item-name]#++_mint++#++(address account, uint256 amount, bytes userData, bytes operatorData)++` [.item-kind]#internal#
|
|
|
|
Creates `amount` tokens and assigns them to `account`, increasing
|
|
the total supply.
|
|
|
|
If a send hook is registered for `account`, the corresponding function
|
|
will be called with the caller address as the `operator` and with
|
|
`userData` and `operatorData`.
|
|
|
|
See {IERC777Sender} and {IERC777Recipient}.
|
|
|
|
Emits {Minted} and {IERC20-Transfer} events.
|
|
|
|
Requirements
|
|
|
|
- `account` cannot be the zero address.
|
|
- if `account` is a contract, it must implement the {IERC777Recipient}
|
|
interface.
|
|
|
|
[.contract-item]
|
|
[[ERC777-_mint-address-uint256-bytes-bytes-bool-]]
|
|
==== `[.contract-item-name]#++_mint++#++(address account, uint256 amount, bytes userData, bytes operatorData, bool requireReceptionAck)++` [.item-kind]#internal#
|
|
|
|
Creates `amount` tokens and assigns them to `account`, increasing
|
|
the total supply.
|
|
|
|
If `requireReceptionAck` is set to true, and if a send hook is
|
|
registered for `account`, the corresponding function will be called with
|
|
`operator`, `data` and `operatorData`.
|
|
|
|
See {IERC777Sender} and {IERC777Recipient}.
|
|
|
|
Emits {Minted} and {IERC20-Transfer} events.
|
|
|
|
Requirements
|
|
|
|
- `account` cannot be the zero address.
|
|
- if `account` is a contract, it must implement the {IERC777Recipient}
|
|
interface.
|
|
|
|
[.contract-item]
|
|
[[ERC777-_send-address-address-uint256-bytes-bytes-bool-]]
|
|
==== `[.contract-item-name]#++_send++#++(address from, address to, uint256 amount, bytes userData, bytes operatorData, bool requireReceptionAck)++` [.item-kind]#internal#
|
|
|
|
Send tokens
|
|
|
|
[.contract-item]
|
|
[[ERC777-_burn-address-uint256-bytes-bytes-]]
|
|
==== `[.contract-item-name]#++_burn++#++(address from, uint256 amount, bytes data, bytes operatorData)++` [.item-kind]#internal#
|
|
|
|
Burn tokens
|
|
|
|
[.contract-item]
|
|
[[ERC777-_approve-address-address-uint256-]]
|
|
==== `[.contract-item-name]#++_approve++#++(address holder, address spender, uint256 value)++` [.item-kind]#internal#
|
|
|
|
See {ERC20-_approve}.
|
|
|
|
Note that accounts cannot have allowance issued by their operators.
|
|
|
|
[.contract-item]
|
|
[[ERC777-_spendAllowance-address-address-uint256-]]
|
|
==== `[.contract-item-name]#++_spendAllowance++#++(address owner, address spender, uint256 amount)++` [.item-kind]#internal#
|
|
|
|
Updates `owner` s allowance for `spender` based on spent `amount`.
|
|
|
|
Does not update the allowance amount in case of infinite allowance.
|
|
Revert if not enough allowance is available.
|
|
|
|
Might emit an {IERC20-Approval} event.
|
|
|
|
[.contract-item]
|
|
[[ERC777-_beforeTokenTransfer-address-address-address-uint256-]]
|
|
==== `[.contract-item-name]#++_beforeTokenTransfer++#++(address operator, address from, address to, uint256 amount)++` [.item-kind]#internal#
|
|
|
|
Hook that is called before any token transfer. This includes
|
|
calls to {send}, {transfer}, {operatorSend}, minting and burning.
|
|
|
|
Calling conditions:
|
|
|
|
- when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
|
|
will be to transferred to `to`.
|
|
- when `from` is zero, `amount` tokens will be minted for `to`.
|
|
- when `to` is zero, `amount` of ``from``'s tokens will be burned.
|
|
- `from` and `to` are never both zero.
|
|
|
|
To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
|
|
|
|
== Hooks
|
|
|
|
:tokensToSend: pass:normal[xref:#IERC777Sender-tokensToSend-address-address-address-uint256-bytes-bytes-[`++tokensToSend++`]]
|
|
|
|
[.contract]
|
|
[[IERC777Sender]]
|
|
=== `++IERC777Sender++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.0/contracts/token/ERC777/IERC777Sender.sol[{github-icon},role=heading-link]
|
|
|
|
[.hljs-theme-light.nopadding]
|
|
```solidity
|
|
import "@openzeppelin/contracts/token/ERC777/IERC777Sender.sol";
|
|
```
|
|
|
|
Interface of the ERC777TokensSender standard as defined in the EIP.
|
|
|
|
{IERC777} Token holders can be notified of operations performed on their
|
|
tokens by having a contract implement this interface (contract holders can be
|
|
their own implementer) and registering it on the
|
|
https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].
|
|
|
|
See {IERC1820Registry} and {ERC1820Implementer}.
|
|
|
|
[.contract-index]
|
|
.Functions
|
|
--
|
|
* {xref-IERC777Sender-tokensToSend-address-address-address-uint256-bytes-bytes-}[`++tokensToSend(operator, from, to, amount, userData, operatorData)++`]
|
|
|
|
--
|
|
|
|
[.contract-item]
|
|
[[IERC777Sender-tokensToSend-address-address-address-uint256-bytes-bytes-]]
|
|
==== `[.contract-item-name]#++tokensToSend++#++(address operator, address from, address to, uint256 amount, bytes userData, bytes operatorData)++` [.item-kind]#external#
|
|
|
|
Called by an {IERC777} token contract whenever a registered holder's
|
|
(`from`) tokens are about to be moved or destroyed. The type of operation
|
|
is conveyed by `to` being the zero address or not.
|
|
|
|
This call occurs _before_ the token contract's state is updated, so
|
|
{IERC777-balanceOf}, etc., can be used to query the pre-operation state.
|
|
|
|
This function may revert to prevent the operation from being executed.
|
|
|
|
:tokensReceived: pass:normal[xref:#IERC777Recipient-tokensReceived-address-address-address-uint256-bytes-bytes-[`++tokensReceived++`]]
|
|
|
|
[.contract]
|
|
[[IERC777Recipient]]
|
|
=== `++IERC777Recipient++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.0/contracts/token/ERC777/IERC777Recipient.sol[{github-icon},role=heading-link]
|
|
|
|
[.hljs-theme-light.nopadding]
|
|
```solidity
|
|
import "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol";
|
|
```
|
|
|
|
Interface of the ERC777TokensRecipient standard as defined in the EIP.
|
|
|
|
Accounts can be notified of {IERC777} tokens being sent to them by having a
|
|
contract implement this interface (contract holders can be their own
|
|
implementer) and registering it on the
|
|
https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].
|
|
|
|
See {IERC1820Registry} and {ERC1820Implementer}.
|
|
|
|
[.contract-index]
|
|
.Functions
|
|
--
|
|
* {xref-IERC777Recipient-tokensReceived-address-address-address-uint256-bytes-bytes-}[`++tokensReceived(operator, from, to, amount, userData, operatorData)++`]
|
|
|
|
--
|
|
|
|
[.contract-item]
|
|
[[IERC777Recipient-tokensReceived-address-address-address-uint256-bytes-bytes-]]
|
|
==== `[.contract-item-name]#++tokensReceived++#++(address operator, address from, address to, uint256 amount, bytes userData, bytes operatorData)++` [.item-kind]#external#
|
|
|
|
Called by an {IERC777} token contract whenever tokens are being
|
|
moved or created into a registered account (`to`). The type of operation
|
|
is conveyed by `from` being the zero address or not.
|
|
|
|
This call occurs _after_ the token contract's state is updated, so
|
|
{IERC777-balanceOf}, etc., can be used to query the post-operation state.
|
|
|
|
This function may revert to prevent the operation from being executed.
|
|
|
|
== Presets
|
|
|
|
These contracts are preconfigured combinations of features. They can be used through inheritance or as models to copy and paste their source code.
|
|
|
|
:constructor: pass:normal[xref:#ERC777PresetFixedSupply-constructor-string-string-address---uint256-address-[`++constructor++`]]
|
|
|
|
[.contract]
|
|
[[ERC777PresetFixedSupply]]
|
|
=== `++ERC777PresetFixedSupply++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.0/contracts/token/ERC777/presets/ERC777PresetFixedSupply.sol[{github-icon},role=heading-link]
|
|
|
|
[.hljs-theme-light.nopadding]
|
|
```solidity
|
|
import "@openzeppelin/contracts/token/ERC777/presets/ERC777PresetFixedSupply.sol";
|
|
```
|
|
|
|
{ERC777} token, including:
|
|
|
|
- Preminted initial supply
|
|
- No access control mechanism (for minting/pausing) and hence no governance
|
|
|
|
_Available since v3.4._
|
|
|
|
[.contract-index]
|
|
.Functions
|
|
--
|
|
* {xref-ERC777PresetFixedSupply-constructor-string-string-address---uint256-address-}[`++constructor(name, symbol, defaultOperators, initialSupply, owner)++`]
|
|
|
|
[.contract-subindex-inherited]
|
|
.ERC777
|
|
* {xref-ERC777-name--}[`++name()++`]
|
|
* {xref-ERC777-symbol--}[`++symbol()++`]
|
|
* {xref-ERC777-decimals--}[`++decimals()++`]
|
|
* {xref-ERC777-granularity--}[`++granularity()++`]
|
|
* {xref-ERC777-totalSupply--}[`++totalSupply()++`]
|
|
* {xref-ERC777-balanceOf-address-}[`++balanceOf(tokenHolder)++`]
|
|
* {xref-ERC777-send-address-uint256-bytes-}[`++send(recipient, amount, data)++`]
|
|
* {xref-ERC777-transfer-address-uint256-}[`++transfer(recipient, amount)++`]
|
|
* {xref-ERC777-burn-uint256-bytes-}[`++burn(amount, data)++`]
|
|
* {xref-ERC777-isOperatorFor-address-address-}[`++isOperatorFor(operator, tokenHolder)++`]
|
|
* {xref-ERC777-authorizeOperator-address-}[`++authorizeOperator(operator)++`]
|
|
* {xref-ERC777-revokeOperator-address-}[`++revokeOperator(operator)++`]
|
|
* {xref-ERC777-defaultOperators--}[`++defaultOperators()++`]
|
|
* {xref-ERC777-operatorSend-address-address-uint256-bytes-bytes-}[`++operatorSend(sender, recipient, amount, data, operatorData)++`]
|
|
* {xref-ERC777-operatorBurn-address-uint256-bytes-bytes-}[`++operatorBurn(account, amount, data, operatorData)++`]
|
|
* {xref-ERC777-allowance-address-address-}[`++allowance(holder, spender)++`]
|
|
* {xref-ERC777-approve-address-uint256-}[`++approve(spender, value)++`]
|
|
* {xref-ERC777-transferFrom-address-address-uint256-}[`++transferFrom(holder, recipient, amount)++`]
|
|
* {xref-ERC777-_mint-address-uint256-bytes-bytes-}[`++_mint(account, amount, userData, operatorData)++`]
|
|
* {xref-ERC777-_mint-address-uint256-bytes-bytes-bool-}[`++_mint(account, amount, userData, operatorData, requireReceptionAck)++`]
|
|
* {xref-ERC777-_send-address-address-uint256-bytes-bytes-bool-}[`++_send(from, to, amount, userData, operatorData, requireReceptionAck)++`]
|
|
* {xref-ERC777-_burn-address-uint256-bytes-bytes-}[`++_burn(from, amount, data, operatorData)++`]
|
|
* {xref-ERC777-_approve-address-address-uint256-}[`++_approve(holder, spender, value)++`]
|
|
* {xref-ERC777-_spendAllowance-address-address-uint256-}[`++_spendAllowance(owner, spender, amount)++`]
|
|
* {xref-ERC777-_beforeTokenTransfer-address-address-address-uint256-}[`++_beforeTokenTransfer(operator, from, to, amount)++`]
|
|
|
|
[.contract-subindex-inherited]
|
|
.IERC20
|
|
|
|
[.contract-subindex-inherited]
|
|
.IERC777
|
|
|
|
--
|
|
|
|
[.contract-index]
|
|
.Events
|
|
--
|
|
|
|
[.contract-subindex-inherited]
|
|
.ERC777
|
|
|
|
[.contract-subindex-inherited]
|
|
.IERC20
|
|
* {xref-IERC20-Transfer-address-address-uint256-}[`++Transfer(from, to, value)++`]
|
|
* {xref-IERC20-Approval-address-address-uint256-}[`++Approval(owner, spender, value)++`]
|
|
|
|
[.contract-subindex-inherited]
|
|
.IERC777
|
|
* {xref-IERC777-Minted-address-address-uint256-bytes-bytes-}[`++Minted(operator, to, amount, data, operatorData)++`]
|
|
* {xref-IERC777-Burned-address-address-uint256-bytes-bytes-}[`++Burned(operator, from, amount, data, operatorData)++`]
|
|
* {xref-IERC777-AuthorizedOperator-address-address-}[`++AuthorizedOperator(operator, tokenHolder)++`]
|
|
* {xref-IERC777-RevokedOperator-address-address-}[`++RevokedOperator(operator, tokenHolder)++`]
|
|
* {xref-IERC777-Sent-address-address-address-uint256-bytes-bytes-}[`++Sent(operator, from, to, amount, data, operatorData)++`]
|
|
|
|
--
|
|
|
|
[.contract-item]
|
|
[[ERC777PresetFixedSupply-constructor-string-string-address---uint256-address-]]
|
|
==== `[.contract-item-name]#++constructor++#++(string name, string symbol, address[] defaultOperators, uint256 initialSupply, address owner)++` [.item-kind]#public#
|
|
|
|
Mints `initialSupply` amount of token and transfers them to `owner`.
|
|
|
|
See {ERC777-constructor}.
|
|
|