ERC777.adoc 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950
  1. :github-icon: pass:[<svg class="icon"><use href="#github-icon"/></svg>]
  2. :IERC777: pass:normal[xref:token/ERC777.adoc#IERC777[`IERC777`]]
  3. :ERC777: pass:normal[xref:token/ERC777.adoc#ERC777[`ERC777`]]
  4. :IERC777Sender: pass:normal[xref:token/ERC777.adoc#IERC777Sender[`IERC777Sender`]]
  5. :IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
  6. :IERC1820Registry: pass:normal[xref:utils.adoc#IERC1820Registry[`IERC1820Registry`]]
  7. :ERC1820Implementer: pass:normal[xref:utils.adoc#ERC1820Implementer[`ERC1820Implementer`]]
  8. :xref-IERC777-name--: xref:token/ERC777.adoc#IERC777-name--
  9. :xref-IERC777-symbol--: xref:token/ERC777.adoc#IERC777-symbol--
  10. :xref-IERC777-granularity--: xref:token/ERC777.adoc#IERC777-granularity--
  11. :xref-IERC777-totalSupply--: xref:token/ERC777.adoc#IERC777-totalSupply--
  12. :xref-IERC777-balanceOf-address-: xref:token/ERC777.adoc#IERC777-balanceOf-address-
  13. :xref-IERC777-send-address-uint256-bytes-: xref:token/ERC777.adoc#IERC777-send-address-uint256-bytes-
  14. :xref-IERC777-burn-uint256-bytes-: xref:token/ERC777.adoc#IERC777-burn-uint256-bytes-
  15. :xref-IERC777-isOperatorFor-address-address-: xref:token/ERC777.adoc#IERC777-isOperatorFor-address-address-
  16. :xref-IERC777-authorizeOperator-address-: xref:token/ERC777.adoc#IERC777-authorizeOperator-address-
  17. :xref-IERC777-revokeOperator-address-: xref:token/ERC777.adoc#IERC777-revokeOperator-address-
  18. :xref-IERC777-defaultOperators--: xref:token/ERC777.adoc#IERC777-defaultOperators--
  19. :xref-IERC777-operatorSend-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-operatorSend-address-address-uint256-bytes-bytes-
  20. :xref-IERC777-operatorBurn-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-operatorBurn-address-uint256-bytes-bytes-
  21. :xref-IERC777-Minted-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Minted-address-address-uint256-bytes-bytes-
  22. :xref-IERC777-Burned-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Burned-address-address-uint256-bytes-bytes-
  23. :xref-IERC777-AuthorizedOperator-address-address-: xref:token/ERC777.adoc#IERC777-AuthorizedOperator-address-address-
  24. :xref-IERC777-RevokedOperator-address-address-: xref:token/ERC777.adoc#IERC777-RevokedOperator-address-address-
  25. :xref-IERC777-Sent-address-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Sent-address-address-address-uint256-bytes-bytes-
  26. :IERC777Sender: pass:normal[xref:token/ERC777.adoc#IERC777Sender[`IERC777Sender`]]
  27. :IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
  28. :IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
  29. :IERC777Sender: pass:normal[xref:token/ERC777.adoc#IERC777Sender[`IERC777Sender`]]
  30. :IERC777Sender: pass:normal[xref:token/ERC777.adoc#IERC777Sender[`IERC777Sender`]]
  31. :IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
  32. :IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
  33. :IERC777Sender: pass:normal[xref:token/ERC777.adoc#IERC777Sender[`IERC777Sender`]]
  34. :IERC777: pass:normal[xref:token/ERC777.adoc#IERC777[`IERC777`]]
  35. :IERC777-Sent: pass:normal[xref:token/ERC777.adoc#IERC777-Sent-address-address-address-uint256-bytes-bytes-[`IERC777.Sent`]]
  36. :IERC20-Transfer: pass:normal[xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-[`IERC20.Transfer`]]
  37. :IERC777-granularity: pass:normal[xref:token/ERC777.adoc#IERC777-granularity--[`IERC777.granularity`]]
  38. :xref-ERC777-constructor-string-string-address---: xref:token/ERC777.adoc#ERC777-constructor-string-string-address---
  39. :xref-ERC777-name--: xref:token/ERC777.adoc#ERC777-name--
  40. :xref-ERC777-symbol--: xref:token/ERC777.adoc#ERC777-symbol--
  41. :xref-ERC777-decimals--: xref:token/ERC777.adoc#ERC777-decimals--
  42. :xref-ERC777-granularity--: xref:token/ERC777.adoc#ERC777-granularity--
  43. :xref-ERC777-totalSupply--: xref:token/ERC777.adoc#ERC777-totalSupply--
  44. :xref-ERC777-balanceOf-address-: xref:token/ERC777.adoc#ERC777-balanceOf-address-
  45. :xref-ERC777-send-address-uint256-bytes-: xref:token/ERC777.adoc#ERC777-send-address-uint256-bytes-
  46. :xref-ERC777-transfer-address-uint256-: xref:token/ERC777.adoc#ERC777-transfer-address-uint256-
  47. :xref-ERC777-burn-uint256-bytes-: xref:token/ERC777.adoc#ERC777-burn-uint256-bytes-
  48. :xref-ERC777-isOperatorFor-address-address-: xref:token/ERC777.adoc#ERC777-isOperatorFor-address-address-
  49. :xref-ERC777-authorizeOperator-address-: xref:token/ERC777.adoc#ERC777-authorizeOperator-address-
  50. :xref-ERC777-revokeOperator-address-: xref:token/ERC777.adoc#ERC777-revokeOperator-address-
  51. :xref-ERC777-defaultOperators--: xref:token/ERC777.adoc#ERC777-defaultOperators--
  52. :xref-ERC777-operatorSend-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#ERC777-operatorSend-address-address-uint256-bytes-bytes-
  53. :xref-ERC777-operatorBurn-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#ERC777-operatorBurn-address-uint256-bytes-bytes-
  54. :xref-ERC777-allowance-address-address-: xref:token/ERC777.adoc#ERC777-allowance-address-address-
  55. :xref-ERC777-approve-address-uint256-: xref:token/ERC777.adoc#ERC777-approve-address-uint256-
  56. :xref-ERC777-transferFrom-address-address-uint256-: xref:token/ERC777.adoc#ERC777-transferFrom-address-address-uint256-
  57. :xref-ERC777-_mint-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#ERC777-_mint-address-uint256-bytes-bytes-
  58. :xref-ERC777-_mint-address-uint256-bytes-bytes-bool-: xref:token/ERC777.adoc#ERC777-_mint-address-uint256-bytes-bytes-bool-
  59. :xref-ERC777-_send-address-address-uint256-bytes-bytes-bool-: xref:token/ERC777.adoc#ERC777-_send-address-address-uint256-bytes-bytes-bool-
  60. :xref-ERC777-_burn-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#ERC777-_burn-address-uint256-bytes-bytes-
  61. :xref-ERC777-_approve-address-address-uint256-: xref:token/ERC777.adoc#ERC777-_approve-address-address-uint256-
  62. :xref-ERC777-_spendAllowance-address-address-uint256-: xref:token/ERC777.adoc#ERC777-_spendAllowance-address-address-uint256-
  63. :xref-ERC777-_beforeTokenTransfer-address-address-address-uint256-: xref:token/ERC777.adoc#ERC777-_beforeTokenTransfer-address-address-address-uint256-
  64. :xref-IERC20-Transfer-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-
  65. :xref-IERC20-Approval-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Approval-address-address-uint256-
  66. :xref-IERC777-Minted-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Minted-address-address-uint256-bytes-bytes-
  67. :xref-IERC777-Burned-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Burned-address-address-uint256-bytes-bytes-
  68. :xref-IERC777-AuthorizedOperator-address-address-: xref:token/ERC777.adoc#IERC777-AuthorizedOperator-address-address-
  69. :xref-IERC777-RevokedOperator-address-address-: xref:token/ERC777.adoc#IERC777-RevokedOperator-address-address-
  70. :xref-IERC777-Sent-address-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Sent-address-address-address-uint256-bytes-bytes-
  71. :IERC777-name: pass:normal[xref:token/ERC777.adoc#IERC777-name--[`IERC777.name`]]
  72. :IERC777-symbol: pass:normal[xref:token/ERC777.adoc#IERC777-symbol--[`IERC777.symbol`]]
  73. :ERC20-decimals: pass:normal[xref:token/ERC20.adoc#ERC20-decimals--[`ERC20.decimals`]]
  74. :IERC777-granularity: pass:normal[xref:token/ERC777.adoc#IERC777-granularity--[`IERC777.granularity`]]
  75. :IERC777-totalSupply: pass:normal[xref:token/ERC777.adoc#IERC777-totalSupply--[`IERC777.totalSupply`]]
  76. :IERC777-send: pass:normal[xref:token/ERC777.adoc#IERC777-send-address-uint256-bytes-[`IERC777.send`]]
  77. :IERC20-Transfer: pass:normal[xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-[`IERC20.Transfer`]]
  78. :IERC20-transfer: pass:normal[xref:token/ERC20.adoc#IERC20-transfer-address-uint256-[`IERC20.transfer`]]
  79. :IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
  80. :IERC777-burn: pass:normal[xref:token/ERC777.adoc#IERC777-burn-uint256-bytes-[`IERC777.burn`]]
  81. :IERC20-Transfer: pass:normal[xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-[`IERC20.Transfer`]]
  82. :IERC777-isOperatorFor: pass:normal[xref:token/ERC777.adoc#IERC777-isOperatorFor-address-address-[`IERC777.isOperatorFor`]]
  83. :IERC777-authorizeOperator: pass:normal[xref:token/ERC777.adoc#IERC777-authorizeOperator-address-[`IERC777.authorizeOperator`]]
  84. :IERC777-revokeOperator: pass:normal[xref:token/ERC777.adoc#IERC777-revokeOperator-address-[`IERC777.revokeOperator`]]
  85. :IERC777-defaultOperators: pass:normal[xref:token/ERC777.adoc#IERC777-defaultOperators--[`IERC777.defaultOperators`]]
  86. :IERC777-operatorSend: pass:normal[xref:token/ERC777.adoc#IERC777-operatorSend-address-address-uint256-bytes-bytes-[`IERC777.operatorSend`]]
  87. :IERC20-Transfer: pass:normal[xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-[`IERC20.Transfer`]]
  88. :IERC777-operatorBurn: pass:normal[xref:token/ERC777.adoc#IERC777-operatorBurn-address-uint256-bytes-bytes-[`IERC777.operatorBurn`]]
  89. :IERC20-Transfer: pass:normal[xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-[`IERC20.Transfer`]]
  90. :IERC20-allowance: pass:normal[xref:token/ERC20.adoc#IERC20-allowance-address-address-[`IERC20.allowance`]]
  91. :IERC20-approve: pass:normal[xref:token/ERC20.adoc#IERC20-approve-address-uint256-[`IERC20.approve`]]
  92. :IERC20-transferFrom: pass:normal[xref:token/ERC20.adoc#IERC20-transferFrom-address-address-uint256-[`IERC20.transferFrom`]]
  93. :IERC20-Transfer: pass:normal[xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-[`IERC20.Transfer`]]
  94. :IERC20-Approval: pass:normal[xref:token/ERC20.adoc#IERC20-Approval-address-address-uint256-[`IERC20.Approval`]]
  95. :IERC777Sender: pass:normal[xref:token/ERC777.adoc#IERC777Sender[`IERC777Sender`]]
  96. :IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
  97. :IERC20-Transfer: pass:normal[xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-[`IERC20.Transfer`]]
  98. :IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
  99. :IERC777Sender: pass:normal[xref:token/ERC777.adoc#IERC777Sender[`IERC777Sender`]]
  100. :IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
  101. :IERC20-Transfer: pass:normal[xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-[`IERC20.Transfer`]]
  102. :IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
  103. :ERC20-_approve: pass:normal[xref:token/ERC20.adoc#ERC20-_approve-address-address-uint256-[`ERC20._approve`]]
  104. :IERC20-Approval: pass:normal[xref:token/ERC20.adoc#IERC20-Approval-address-address-uint256-[`IERC20.Approval`]]
  105. :IERC777: pass:normal[xref:token/ERC777.adoc#IERC777[`IERC777`]]
  106. :IERC1820Registry: pass:normal[xref:utils.adoc#IERC1820Registry[`IERC1820Registry`]]
  107. :ERC1820Implementer: pass:normal[xref:utils.adoc#ERC1820Implementer[`ERC1820Implementer`]]
  108. :xref-IERC777Sender-tokensToSend-address-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777Sender-tokensToSend-address-address-address-uint256-bytes-bytes-
  109. :IERC777: pass:normal[xref:token/ERC777.adoc#IERC777[`IERC777`]]
  110. :IERC777-balanceOf: pass:normal[xref:token/ERC777.adoc#IERC777-balanceOf-address-[`IERC777.balanceOf`]]
  111. :IERC777: pass:normal[xref:token/ERC777.adoc#IERC777[`IERC777`]]
  112. :IERC1820Registry: pass:normal[xref:utils.adoc#IERC1820Registry[`IERC1820Registry`]]
  113. :ERC1820Implementer: pass:normal[xref:utils.adoc#ERC1820Implementer[`ERC1820Implementer`]]
  114. :xref-IERC777Recipient-tokensReceived-address-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777Recipient-tokensReceived-address-address-address-uint256-bytes-bytes-
  115. :IERC777: pass:normal[xref:token/ERC777.adoc#IERC777[`IERC777`]]
  116. :IERC777-balanceOf: pass:normal[xref:token/ERC777.adoc#IERC777-balanceOf-address-[`IERC777.balanceOf`]]
  117. :ERC777: pass:normal[xref:token/ERC777.adoc#ERC777[`ERC777`]]
  118. :xref-ERC777PresetFixedSupply-constructor-string-string-address---uint256-address-: xref:token/ERC777.adoc#ERC777PresetFixedSupply-constructor-string-string-address---uint256-address-
  119. :xref-ERC777-name--: xref:token/ERC777.adoc#ERC777-name--
  120. :xref-ERC777-symbol--: xref:token/ERC777.adoc#ERC777-symbol--
  121. :xref-ERC777-decimals--: xref:token/ERC777.adoc#ERC777-decimals--
  122. :xref-ERC777-granularity--: xref:token/ERC777.adoc#ERC777-granularity--
  123. :xref-ERC777-totalSupply--: xref:token/ERC777.adoc#ERC777-totalSupply--
  124. :xref-ERC777-balanceOf-address-: xref:token/ERC777.adoc#ERC777-balanceOf-address-
  125. :xref-ERC777-send-address-uint256-bytes-: xref:token/ERC777.adoc#ERC777-send-address-uint256-bytes-
  126. :xref-ERC777-transfer-address-uint256-: xref:token/ERC777.adoc#ERC777-transfer-address-uint256-
  127. :xref-ERC777-burn-uint256-bytes-: xref:token/ERC777.adoc#ERC777-burn-uint256-bytes-
  128. :xref-ERC777-isOperatorFor-address-address-: xref:token/ERC777.adoc#ERC777-isOperatorFor-address-address-
  129. :xref-ERC777-authorizeOperator-address-: xref:token/ERC777.adoc#ERC777-authorizeOperator-address-
  130. :xref-ERC777-revokeOperator-address-: xref:token/ERC777.adoc#ERC777-revokeOperator-address-
  131. :xref-ERC777-defaultOperators--: xref:token/ERC777.adoc#ERC777-defaultOperators--
  132. :xref-ERC777-operatorSend-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#ERC777-operatorSend-address-address-uint256-bytes-bytes-
  133. :xref-ERC777-operatorBurn-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#ERC777-operatorBurn-address-uint256-bytes-bytes-
  134. :xref-ERC777-allowance-address-address-: xref:token/ERC777.adoc#ERC777-allowance-address-address-
  135. :xref-ERC777-approve-address-uint256-: xref:token/ERC777.adoc#ERC777-approve-address-uint256-
  136. :xref-ERC777-transferFrom-address-address-uint256-: xref:token/ERC777.adoc#ERC777-transferFrom-address-address-uint256-
  137. :xref-ERC777-_mint-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#ERC777-_mint-address-uint256-bytes-bytes-
  138. :xref-ERC777-_mint-address-uint256-bytes-bytes-bool-: xref:token/ERC777.adoc#ERC777-_mint-address-uint256-bytes-bytes-bool-
  139. :xref-ERC777-_send-address-address-uint256-bytes-bytes-bool-: xref:token/ERC777.adoc#ERC777-_send-address-address-uint256-bytes-bytes-bool-
  140. :xref-ERC777-_burn-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#ERC777-_burn-address-uint256-bytes-bytes-
  141. :xref-ERC777-_approve-address-address-uint256-: xref:token/ERC777.adoc#ERC777-_approve-address-address-uint256-
  142. :xref-ERC777-_spendAllowance-address-address-uint256-: xref:token/ERC777.adoc#ERC777-_spendAllowance-address-address-uint256-
  143. :xref-ERC777-_beforeTokenTransfer-address-address-address-uint256-: xref:token/ERC777.adoc#ERC777-_beforeTokenTransfer-address-address-address-uint256-
  144. :xref-IERC20-Transfer-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-
  145. :xref-IERC20-Approval-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Approval-address-address-uint256-
  146. :xref-IERC777-Minted-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Minted-address-address-uint256-bytes-bytes-
  147. :xref-IERC777-Burned-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Burned-address-address-uint256-bytes-bytes-
  148. :xref-IERC777-AuthorizedOperator-address-address-: xref:token/ERC777.adoc#IERC777-AuthorizedOperator-address-address-
  149. :xref-IERC777-RevokedOperator-address-address-: xref:token/ERC777.adoc#IERC777-RevokedOperator-address-address-
  150. :xref-IERC777-Sent-address-address-address-uint256-bytes-bytes-: xref:token/ERC777.adoc#IERC777-Sent-address-address-address-uint256-bytes-bytes-
  151. :ERC777-constructor: pass:normal[xref:token/ERC777.adoc#ERC777-constructor-string-string-address---[`ERC777.constructor`]]
  152. = ERC 777
  153. [.readme-notice]
  154. NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/token/erc777
  155. CAUTION: As of v4.9, OpenZeppelin's implementation of ERC-777 is deprecated and will be removed in the next major release.
  156. This set of interfaces and contracts are all related to the https://eips.ethereum.org/EIPS/eip-777[ERC777 token standard].
  157. 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].
  158. The token behavior itself is implemented in the core contracts: {IERC777}, {ERC777}.
  159. Additionally there are interfaces used to develop contracts that react to token movements: {IERC777Sender}, {IERC777Recipient}.
  160. == Core
  161. :Minted: pass:normal[xref:#IERC777-Minted-address-address-uint256-bytes-bytes-[`++Minted++`]]
  162. :Burned: pass:normal[xref:#IERC777-Burned-address-address-uint256-bytes-bytes-[`++Burned++`]]
  163. :AuthorizedOperator: pass:normal[xref:#IERC777-AuthorizedOperator-address-address-[`++AuthorizedOperator++`]]
  164. :RevokedOperator: pass:normal[xref:#IERC777-RevokedOperator-address-address-[`++RevokedOperator++`]]
  165. :name: pass:normal[xref:#IERC777-name--[`++name++`]]
  166. :symbol: pass:normal[xref:#IERC777-symbol--[`++symbol++`]]
  167. :granularity: pass:normal[xref:#IERC777-granularity--[`++granularity++`]]
  168. :totalSupply: pass:normal[xref:#IERC777-totalSupply--[`++totalSupply++`]]
  169. :balanceOf: pass:normal[xref:#IERC777-balanceOf-address-[`++balanceOf++`]]
  170. :send: pass:normal[xref:#IERC777-send-address-uint256-bytes-[`++send++`]]
  171. :burn: pass:normal[xref:#IERC777-burn-uint256-bytes-[`++burn++`]]
  172. :isOperatorFor: pass:normal[xref:#IERC777-isOperatorFor-address-address-[`++isOperatorFor++`]]
  173. :authorizeOperator: pass:normal[xref:#IERC777-authorizeOperator-address-[`++authorizeOperator++`]]
  174. :revokeOperator: pass:normal[xref:#IERC777-revokeOperator-address-[`++revokeOperator++`]]
  175. :defaultOperators: pass:normal[xref:#IERC777-defaultOperators--[`++defaultOperators++`]]
  176. :operatorSend: pass:normal[xref:#IERC777-operatorSend-address-address-uint256-bytes-bytes-[`++operatorSend++`]]
  177. :operatorBurn: pass:normal[xref:#IERC777-operatorBurn-address-uint256-bytes-bytes-[`++operatorBurn++`]]
  178. :Sent: pass:normal[xref:#IERC777-Sent-address-address-address-uint256-bytes-bytes-[`++Sent++`]]
  179. [.contract]
  180. [[IERC777]]
  181. === `++IERC777++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.5/contracts/token/ERC777/IERC777.sol[{github-icon},role=heading-link]
  182. [.hljs-theme-light.nopadding]
  183. ```solidity
  184. import "@openzeppelin/contracts/token/ERC777/IERC777.sol";
  185. ```
  186. Interface of the ERC777Token standard as defined in the EIP.
  187. This contract uses the
  188. https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let
  189. token holders and recipients react to token movements by using setting implementers
  190. for the associated interfaces in said registry. See {IERC1820Registry} and
  191. {ERC1820Implementer}.
  192. [.contract-index]
  193. .Functions
  194. --
  195. * {xref-IERC777-name--}[`++name()++`]
  196. * {xref-IERC777-symbol--}[`++symbol()++`]
  197. * {xref-IERC777-granularity--}[`++granularity()++`]
  198. * {xref-IERC777-totalSupply--}[`++totalSupply()++`]
  199. * {xref-IERC777-balanceOf-address-}[`++balanceOf(owner)++`]
  200. * {xref-IERC777-send-address-uint256-bytes-}[`++send(recipient, amount, data)++`]
  201. * {xref-IERC777-burn-uint256-bytes-}[`++burn(amount, data)++`]
  202. * {xref-IERC777-isOperatorFor-address-address-}[`++isOperatorFor(operator, tokenHolder)++`]
  203. * {xref-IERC777-authorizeOperator-address-}[`++authorizeOperator(operator)++`]
  204. * {xref-IERC777-revokeOperator-address-}[`++revokeOperator(operator)++`]
  205. * {xref-IERC777-defaultOperators--}[`++defaultOperators()++`]
  206. * {xref-IERC777-operatorSend-address-address-uint256-bytes-bytes-}[`++operatorSend(sender, recipient, amount, data, operatorData)++`]
  207. * {xref-IERC777-operatorBurn-address-uint256-bytes-bytes-}[`++operatorBurn(account, amount, data, operatorData)++`]
  208. --
  209. [.contract-index]
  210. .Events
  211. --
  212. * {xref-IERC777-Minted-address-address-uint256-bytes-bytes-}[`++Minted(operator, to, amount, data, operatorData)++`]
  213. * {xref-IERC777-Burned-address-address-uint256-bytes-bytes-}[`++Burned(operator, from, amount, data, operatorData)++`]
  214. * {xref-IERC777-AuthorizedOperator-address-address-}[`++AuthorizedOperator(operator, tokenHolder)++`]
  215. * {xref-IERC777-RevokedOperator-address-address-}[`++RevokedOperator(operator, tokenHolder)++`]
  216. * {xref-IERC777-Sent-address-address-address-uint256-bytes-bytes-}[`++Sent(operator, from, to, amount, data, operatorData)++`]
  217. --
  218. [.contract-item]
  219. [[IERC777-name--]]
  220. ==== `[.contract-item-name]#++name++#++() → string++` [.item-kind]#external#
  221. Returns the name of the token.
  222. [.contract-item]
  223. [[IERC777-symbol--]]
  224. ==== `[.contract-item-name]#++symbol++#++() → string++` [.item-kind]#external#
  225. Returns the symbol of the token, usually a shorter version of the
  226. name.
  227. [.contract-item]
  228. [[IERC777-granularity--]]
  229. ==== `[.contract-item-name]#++granularity++#++() → uint256++` [.item-kind]#external#
  230. Returns the smallest part of the token that is not divisible. This
  231. means all token operations (creation, movement and destruction) must have
  232. amounts that are a multiple of this number.
  233. For most token contracts, this value will equal 1.
  234. [.contract-item]
  235. [[IERC777-totalSupply--]]
  236. ==== `[.contract-item-name]#++totalSupply++#++() → uint256++` [.item-kind]#external#
  237. Returns the amount of tokens in existence.
  238. [.contract-item]
  239. [[IERC777-balanceOf-address-]]
  240. ==== `[.contract-item-name]#++balanceOf++#++(address owner) → uint256++` [.item-kind]#external#
  241. Returns the amount of tokens owned by an account (`owner`).
  242. [.contract-item]
  243. [[IERC777-send-address-uint256-bytes-]]
  244. ==== `[.contract-item-name]#++send++#++(address recipient, uint256 amount, bytes data)++` [.item-kind]#external#
  245. Moves `amount` tokens from the caller's account to `recipient`.
  246. If send or receive hooks are registered for the caller and `recipient`,
  247. the corresponding functions will be called with `data` and empty
  248. `operatorData`. See {IERC777Sender} and {IERC777Recipient}.
  249. Emits a {Sent} event.
  250. Requirements
  251. - the caller must have at least `amount` tokens.
  252. - `recipient` cannot be the zero address.
  253. - if `recipient` is a contract, it must implement the {IERC777Recipient}
  254. interface.
  255. [.contract-item]
  256. [[IERC777-burn-uint256-bytes-]]
  257. ==== `[.contract-item-name]#++burn++#++(uint256 amount, bytes data)++` [.item-kind]#external#
  258. Destroys `amount` tokens from the caller's account, reducing the
  259. total supply.
  260. If a send hook is registered for the caller, the corresponding function
  261. will be called with `data` and empty `operatorData`. See {IERC777Sender}.
  262. Emits a {Burned} event.
  263. Requirements
  264. - the caller must have at least `amount` tokens.
  265. [.contract-item]
  266. [[IERC777-isOperatorFor-address-address-]]
  267. ==== `[.contract-item-name]#++isOperatorFor++#++(address operator, address tokenHolder) → bool++` [.item-kind]#external#
  268. Returns true if an account is an operator of `tokenHolder`.
  269. Operators can send and burn tokens on behalf of their owners. All
  270. accounts are their own operator.
  271. See {operatorSend} and {operatorBurn}.
  272. [.contract-item]
  273. [[IERC777-authorizeOperator-address-]]
  274. ==== `[.contract-item-name]#++authorizeOperator++#++(address operator)++` [.item-kind]#external#
  275. Make an account an operator of the caller.
  276. See {isOperatorFor}.
  277. Emits an {AuthorizedOperator} event.
  278. Requirements
  279. - `operator` cannot be calling address.
  280. [.contract-item]
  281. [[IERC777-revokeOperator-address-]]
  282. ==== `[.contract-item-name]#++revokeOperator++#++(address operator)++` [.item-kind]#external#
  283. Revoke an account's operator status for the caller.
  284. See {isOperatorFor} and {defaultOperators}.
  285. Emits a {RevokedOperator} event.
  286. Requirements
  287. - `operator` cannot be calling address.
  288. [.contract-item]
  289. [[IERC777-defaultOperators--]]
  290. ==== `[.contract-item-name]#++defaultOperators++#++() → address[]++` [.item-kind]#external#
  291. Returns the list of default operators. These accounts are operators
  292. for all token holders, even if {authorizeOperator} was never called on
  293. them.
  294. This list is immutable, but individual holders may revoke these via
  295. {revokeOperator}, in which case {isOperatorFor} will return false.
  296. [.contract-item]
  297. [[IERC777-operatorSend-address-address-uint256-bytes-bytes-]]
  298. ==== `[.contract-item-name]#++operatorSend++#++(address sender, address recipient, uint256 amount, bytes data, bytes operatorData)++` [.item-kind]#external#
  299. Moves `amount` tokens from `sender` to `recipient`. The caller must
  300. be an operator of `sender`.
  301. If send or receive hooks are registered for `sender` and `recipient`,
  302. the corresponding functions will be called with `data` and
  303. `operatorData`. See {IERC777Sender} and {IERC777Recipient}.
  304. Emits a {Sent} event.
  305. Requirements
  306. - `sender` cannot be the zero address.
  307. - `sender` must have at least `amount` tokens.
  308. - the caller must be an operator for `sender`.
  309. - `recipient` cannot be the zero address.
  310. - if `recipient` is a contract, it must implement the {IERC777Recipient}
  311. interface.
  312. [.contract-item]
  313. [[IERC777-operatorBurn-address-uint256-bytes-bytes-]]
  314. ==== `[.contract-item-name]#++operatorBurn++#++(address account, uint256 amount, bytes data, bytes operatorData)++` [.item-kind]#external#
  315. Destroys `amount` tokens from `account`, reducing the total supply.
  316. The caller must be an operator of `account`.
  317. If a send hook is registered for `account`, the corresponding function
  318. will be called with `data` and `operatorData`. See {IERC777Sender}.
  319. Emits a {Burned} event.
  320. Requirements
  321. - `account` cannot be the zero address.
  322. - `account` must have at least `amount` tokens.
  323. - the caller must be an operator for `account`.
  324. [.contract-item]
  325. [[IERC777-Minted-address-address-uint256-bytes-bytes-]]
  326. ==== `[.contract-item-name]#++Minted++#++(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData)++` [.item-kind]#event#
  327. Emitted when `amount` tokens are created by `operator` and assigned to `to`.
  328. Note that some additional user `data` and `operatorData` can be logged in the event.
  329. [.contract-item]
  330. [[IERC777-Burned-address-address-uint256-bytes-bytes-]]
  331. ==== `[.contract-item-name]#++Burned++#++(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData)++` [.item-kind]#event#
  332. Emitted when `operator` destroys `amount` tokens from `account`.
  333. Note that some additional user `data` and `operatorData` can be logged in the event.
  334. [.contract-item]
  335. [[IERC777-AuthorizedOperator-address-address-]]
  336. ==== `[.contract-item-name]#++AuthorizedOperator++#++(address indexed operator, address indexed tokenHolder)++` [.item-kind]#event#
  337. Emitted when `operator` is made operator for `tokenHolder`.
  338. [.contract-item]
  339. [[IERC777-RevokedOperator-address-address-]]
  340. ==== `[.contract-item-name]#++RevokedOperator++#++(address indexed operator, address indexed tokenHolder)++` [.item-kind]#event#
  341. Emitted when `operator` is revoked its operator status for `tokenHolder`.
  342. [.contract-item]
  343. [[IERC777-Sent-address-address-address-uint256-bytes-bytes-]]
  344. ==== `[.contract-item-name]#++Sent++#++(address indexed operator, address indexed from, address indexed to, uint256 amount, bytes data, bytes operatorData)++` [.item-kind]#event#
  345. :_ERC1820_REGISTRY: pass:normal[xref:#ERC777-_ERC1820_REGISTRY-contract-IERC1820Registry[`++_ERC1820_REGISTRY++`]]
  346. :constructor: pass:normal[xref:#ERC777-constructor-string-string-address---[`++constructor++`]]
  347. :name: pass:normal[xref:#ERC777-name--[`++name++`]]
  348. :symbol: pass:normal[xref:#ERC777-symbol--[`++symbol++`]]
  349. :decimals: pass:normal[xref:#ERC777-decimals--[`++decimals++`]]
  350. :granularity: pass:normal[xref:#ERC777-granularity--[`++granularity++`]]
  351. :totalSupply: pass:normal[xref:#ERC777-totalSupply--[`++totalSupply++`]]
  352. :balanceOf: pass:normal[xref:#ERC777-balanceOf-address-[`++balanceOf++`]]
  353. :send: pass:normal[xref:#ERC777-send-address-uint256-bytes-[`++send++`]]
  354. :transfer: pass:normal[xref:#ERC777-transfer-address-uint256-[`++transfer++`]]
  355. :burn: pass:normal[xref:#ERC777-burn-uint256-bytes-[`++burn++`]]
  356. :isOperatorFor: pass:normal[xref:#ERC777-isOperatorFor-address-address-[`++isOperatorFor++`]]
  357. :authorizeOperator: pass:normal[xref:#ERC777-authorizeOperator-address-[`++authorizeOperator++`]]
  358. :revokeOperator: pass:normal[xref:#ERC777-revokeOperator-address-[`++revokeOperator++`]]
  359. :defaultOperators: pass:normal[xref:#ERC777-defaultOperators--[`++defaultOperators++`]]
  360. :operatorSend: pass:normal[xref:#ERC777-operatorSend-address-address-uint256-bytes-bytes-[`++operatorSend++`]]
  361. :operatorBurn: pass:normal[xref:#ERC777-operatorBurn-address-uint256-bytes-bytes-[`++operatorBurn++`]]
  362. :allowance: pass:normal[xref:#ERC777-allowance-address-address-[`++allowance++`]]
  363. :approve: pass:normal[xref:#ERC777-approve-address-uint256-[`++approve++`]]
  364. :transferFrom: pass:normal[xref:#ERC777-transferFrom-address-address-uint256-[`++transferFrom++`]]
  365. :_mint: pass:normal[xref:#ERC777-_mint-address-uint256-bytes-bytes-[`++_mint++`]]
  366. :_mint: pass:normal[xref:#ERC777-_mint-address-uint256-bytes-bytes-bool-[`++_mint++`]]
  367. :_send: pass:normal[xref:#ERC777-_send-address-address-uint256-bytes-bytes-bool-[`++_send++`]]
  368. :_burn: pass:normal[xref:#ERC777-_burn-address-uint256-bytes-bytes-[`++_burn++`]]
  369. :_approve: pass:normal[xref:#ERC777-_approve-address-address-uint256-[`++_approve++`]]
  370. :_spendAllowance: pass:normal[xref:#ERC777-_spendAllowance-address-address-uint256-[`++_spendAllowance++`]]
  371. :_beforeTokenTransfer: pass:normal[xref:#ERC777-_beforeTokenTransfer-address-address-address-uint256-[`++_beforeTokenTransfer++`]]
  372. [.contract]
  373. [[ERC777]]
  374. === `++ERC777++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.5/contracts/token/ERC777/ERC777.sol[{github-icon},role=heading-link]
  375. [.hljs-theme-light.nopadding]
  376. ```solidity
  377. import "@openzeppelin/contracts/token/ERC777/ERC777.sol";
  378. ```
  379. Implementation of the {IERC777} interface.
  380. This implementation is agnostic to the way tokens are created. This means
  381. that a supply mechanism has to be added in a derived contract using {_mint}.
  382. Support for ERC20 is included in this contract, as specified by the EIP: both
  383. the ERC777 and ERC20 interfaces can be safely used when interacting with it.
  384. Both {IERC777-Sent} and {IERC20-Transfer} events are emitted on token
  385. movements.
  386. Additionally, the {IERC777-granularity} value is hard-coded to `1`, meaning that there
  387. are no special restrictions in the amount of tokens that created, moved, or
  388. destroyed. This makes integration with ERC20 applications seamless.
  389. CAUTION: This file is deprecated as of v4.9 and will be removed in the next major release.
  390. [.contract-index]
  391. .Functions
  392. --
  393. * {xref-ERC777-constructor-string-string-address---}[`++constructor(name_, symbol_, defaultOperators_)++`]
  394. * {xref-ERC777-name--}[`++name()++`]
  395. * {xref-ERC777-symbol--}[`++symbol()++`]
  396. * {xref-ERC777-decimals--}[`++decimals()++`]
  397. * {xref-ERC777-granularity--}[`++granularity()++`]
  398. * {xref-ERC777-totalSupply--}[`++totalSupply()++`]
  399. * {xref-ERC777-balanceOf-address-}[`++balanceOf(tokenHolder)++`]
  400. * {xref-ERC777-send-address-uint256-bytes-}[`++send(recipient, amount, data)++`]
  401. * {xref-ERC777-transfer-address-uint256-}[`++transfer(recipient, amount)++`]
  402. * {xref-ERC777-burn-uint256-bytes-}[`++burn(amount, data)++`]
  403. * {xref-ERC777-isOperatorFor-address-address-}[`++isOperatorFor(operator, tokenHolder)++`]
  404. * {xref-ERC777-authorizeOperator-address-}[`++authorizeOperator(operator)++`]
  405. * {xref-ERC777-revokeOperator-address-}[`++revokeOperator(operator)++`]
  406. * {xref-ERC777-defaultOperators--}[`++defaultOperators()++`]
  407. * {xref-ERC777-operatorSend-address-address-uint256-bytes-bytes-}[`++operatorSend(sender, recipient, amount, data, operatorData)++`]
  408. * {xref-ERC777-operatorBurn-address-uint256-bytes-bytes-}[`++operatorBurn(account, amount, data, operatorData)++`]
  409. * {xref-ERC777-allowance-address-address-}[`++allowance(holder, spender)++`]
  410. * {xref-ERC777-approve-address-uint256-}[`++approve(spender, value)++`]
  411. * {xref-ERC777-transferFrom-address-address-uint256-}[`++transferFrom(holder, recipient, amount)++`]
  412. * {xref-ERC777-_mint-address-uint256-bytes-bytes-}[`++_mint(account, amount, userData, operatorData)++`]
  413. * {xref-ERC777-_mint-address-uint256-bytes-bytes-bool-}[`++_mint(account, amount, userData, operatorData, requireReceptionAck)++`]
  414. * {xref-ERC777-_send-address-address-uint256-bytes-bytes-bool-}[`++_send(from, to, amount, userData, operatorData, requireReceptionAck)++`]
  415. * {xref-ERC777-_burn-address-uint256-bytes-bytes-}[`++_burn(from, amount, data, operatorData)++`]
  416. * {xref-ERC777-_approve-address-address-uint256-}[`++_approve(holder, spender, value)++`]
  417. * {xref-ERC777-_spendAllowance-address-address-uint256-}[`++_spendAllowance(owner, spender, amount)++`]
  418. * {xref-ERC777-_beforeTokenTransfer-address-address-address-uint256-}[`++_beforeTokenTransfer(operator, from, to, amount)++`]
  419. [.contract-subindex-inherited]
  420. .IERC20
  421. [.contract-subindex-inherited]
  422. .IERC777
  423. --
  424. [.contract-index]
  425. .Events
  426. --
  427. [.contract-subindex-inherited]
  428. .IERC20
  429. * {xref-IERC20-Transfer-address-address-uint256-}[`++Transfer(from, to, value)++`]
  430. * {xref-IERC20-Approval-address-address-uint256-}[`++Approval(owner, spender, value)++`]
  431. [.contract-subindex-inherited]
  432. .IERC777
  433. * {xref-IERC777-Minted-address-address-uint256-bytes-bytes-}[`++Minted(operator, to, amount, data, operatorData)++`]
  434. * {xref-IERC777-Burned-address-address-uint256-bytes-bytes-}[`++Burned(operator, from, amount, data, operatorData)++`]
  435. * {xref-IERC777-AuthorizedOperator-address-address-}[`++AuthorizedOperator(operator, tokenHolder)++`]
  436. * {xref-IERC777-RevokedOperator-address-address-}[`++RevokedOperator(operator, tokenHolder)++`]
  437. * {xref-IERC777-Sent-address-address-address-uint256-bytes-bytes-}[`++Sent(operator, from, to, amount, data, operatorData)++`]
  438. --
  439. [.contract-item]
  440. [[ERC777-constructor-string-string-address---]]
  441. ==== `[.contract-item-name]#++constructor++#++(string name_, string symbol_, address[] defaultOperators_)++` [.item-kind]#public#
  442. `defaultOperators` may be an empty array.
  443. [.contract-item]
  444. [[ERC777-name--]]
  445. ==== `[.contract-item-name]#++name++#++() → string++` [.item-kind]#public#
  446. See {IERC777-name}.
  447. [.contract-item]
  448. [[ERC777-symbol--]]
  449. ==== `[.contract-item-name]#++symbol++#++() → string++` [.item-kind]#public#
  450. See {IERC777-symbol}.
  451. [.contract-item]
  452. [[ERC777-decimals--]]
  453. ==== `[.contract-item-name]#++decimals++#++() → uint8++` [.item-kind]#public#
  454. See {ERC20-decimals}.
  455. Always returns 18, as per the
  456. [ERC777 EIP](https://eips.ethereum.org/EIPS/eip-777#backward-compatibility).
  457. [.contract-item]
  458. [[ERC777-granularity--]]
  459. ==== `[.contract-item-name]#++granularity++#++() → uint256++` [.item-kind]#public#
  460. See {IERC777-granularity}.
  461. This implementation always returns `1`.
  462. [.contract-item]
  463. [[ERC777-totalSupply--]]
  464. ==== `[.contract-item-name]#++totalSupply++#++() → uint256++` [.item-kind]#public#
  465. See {IERC777-totalSupply}.
  466. [.contract-item]
  467. [[ERC777-balanceOf-address-]]
  468. ==== `[.contract-item-name]#++balanceOf++#++(address tokenHolder) → uint256++` [.item-kind]#public#
  469. Returns the amount of tokens owned by an account (`tokenHolder`).
  470. [.contract-item]
  471. [[ERC777-send-address-uint256-bytes-]]
  472. ==== `[.contract-item-name]#++send++#++(address recipient, uint256 amount, bytes data)++` [.item-kind]#public#
  473. See {IERC777-send}.
  474. Also emits a {IERC20-Transfer} event for ERC20 compatibility.
  475. [.contract-item]
  476. [[ERC777-transfer-address-uint256-]]
  477. ==== `[.contract-item-name]#++transfer++#++(address recipient, uint256 amount) → bool++` [.item-kind]#public#
  478. See {IERC20-transfer}.
  479. Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient}
  480. interface if it is a contract.
  481. Also emits a {Sent} event.
  482. [.contract-item]
  483. [[ERC777-burn-uint256-bytes-]]
  484. ==== `[.contract-item-name]#++burn++#++(uint256 amount, bytes data)++` [.item-kind]#public#
  485. See {IERC777-burn}.
  486. Also emits a {IERC20-Transfer} event for ERC20 compatibility.
  487. [.contract-item]
  488. [[ERC777-isOperatorFor-address-address-]]
  489. ==== `[.contract-item-name]#++isOperatorFor++#++(address operator, address tokenHolder) → bool++` [.item-kind]#public#
  490. See {IERC777-isOperatorFor}.
  491. [.contract-item]
  492. [[ERC777-authorizeOperator-address-]]
  493. ==== `[.contract-item-name]#++authorizeOperator++#++(address operator)++` [.item-kind]#public#
  494. See {IERC777-authorizeOperator}.
  495. [.contract-item]
  496. [[ERC777-revokeOperator-address-]]
  497. ==== `[.contract-item-name]#++revokeOperator++#++(address operator)++` [.item-kind]#public#
  498. See {IERC777-revokeOperator}.
  499. [.contract-item]
  500. [[ERC777-defaultOperators--]]
  501. ==== `[.contract-item-name]#++defaultOperators++#++() → address[]++` [.item-kind]#public#
  502. See {IERC777-defaultOperators}.
  503. [.contract-item]
  504. [[ERC777-operatorSend-address-address-uint256-bytes-bytes-]]
  505. ==== `[.contract-item-name]#++operatorSend++#++(address sender, address recipient, uint256 amount, bytes data, bytes operatorData)++` [.item-kind]#public#
  506. See {IERC777-operatorSend}.
  507. Emits {Sent} and {IERC20-Transfer} events.
  508. [.contract-item]
  509. [[ERC777-operatorBurn-address-uint256-bytes-bytes-]]
  510. ==== `[.contract-item-name]#++operatorBurn++#++(address account, uint256 amount, bytes data, bytes operatorData)++` [.item-kind]#public#
  511. See {IERC777-operatorBurn}.
  512. Emits {Burned} and {IERC20-Transfer} events.
  513. [.contract-item]
  514. [[ERC777-allowance-address-address-]]
  515. ==== `[.contract-item-name]#++allowance++#++(address holder, address spender) → uint256++` [.item-kind]#public#
  516. See {IERC20-allowance}.
  517. Note that operator and allowance concepts are orthogonal: operators may
  518. not have allowance, and accounts with allowance may not be operators
  519. themselves.
  520. [.contract-item]
  521. [[ERC777-approve-address-uint256-]]
  522. ==== `[.contract-item-name]#++approve++#++(address spender, uint256 value) → bool++` [.item-kind]#public#
  523. See {IERC20-approve}.
  524. NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
  525. `transferFrom`. This is semantically equivalent to an infinite approval.
  526. Note that accounts cannot have allowance issued by their operators.
  527. [.contract-item]
  528. [[ERC777-transferFrom-address-address-uint256-]]
  529. ==== `[.contract-item-name]#++transferFrom++#++(address holder, address recipient, uint256 amount) → bool++` [.item-kind]#public#
  530. See {IERC20-transferFrom}.
  531. NOTE: Does not update the allowance if the current allowance
  532. is the maximum `uint256`.
  533. Note that operator and allowance concepts are orthogonal: operators cannot
  534. call `transferFrom` (unless they have allowance), and accounts with
  535. allowance cannot call `operatorSend` (unless they are operators).
  536. Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events.
  537. [.contract-item]
  538. [[ERC777-_mint-address-uint256-bytes-bytes-]]
  539. ==== `[.contract-item-name]#++_mint++#++(address account, uint256 amount, bytes userData, bytes operatorData)++` [.item-kind]#internal#
  540. Creates `amount` tokens and assigns them to `account`, increasing
  541. the total supply.
  542. If a send hook is registered for `account`, the corresponding function
  543. will be called with the caller address as the `operator` and with
  544. `userData` and `operatorData`.
  545. See {IERC777Sender} and {IERC777Recipient}.
  546. Emits {Minted} and {IERC20-Transfer} events.
  547. Requirements
  548. - `account` cannot be the zero address.
  549. - if `account` is a contract, it must implement the {IERC777Recipient}
  550. interface.
  551. [.contract-item]
  552. [[ERC777-_mint-address-uint256-bytes-bytes-bool-]]
  553. ==== `[.contract-item-name]#++_mint++#++(address account, uint256 amount, bytes userData, bytes operatorData, bool requireReceptionAck)++` [.item-kind]#internal#
  554. Creates `amount` tokens and assigns them to `account`, increasing
  555. the total supply.
  556. If `requireReceptionAck` is set to true, and if a send hook is
  557. registered for `account`, the corresponding function will be called with
  558. `operator`, `data` and `operatorData`.
  559. See {IERC777Sender} and {IERC777Recipient}.
  560. Emits {Minted} and {IERC20-Transfer} events.
  561. Requirements
  562. - `account` cannot be the zero address.
  563. - if `account` is a contract, it must implement the {IERC777Recipient}
  564. interface.
  565. [.contract-item]
  566. [[ERC777-_send-address-address-uint256-bytes-bytes-bool-]]
  567. ==== `[.contract-item-name]#++_send++#++(address from, address to, uint256 amount, bytes userData, bytes operatorData, bool requireReceptionAck)++` [.item-kind]#internal#
  568. Send tokens
  569. [.contract-item]
  570. [[ERC777-_burn-address-uint256-bytes-bytes-]]
  571. ==== `[.contract-item-name]#++_burn++#++(address from, uint256 amount, bytes data, bytes operatorData)++` [.item-kind]#internal#
  572. Burn tokens
  573. [.contract-item]
  574. [[ERC777-_approve-address-address-uint256-]]
  575. ==== `[.contract-item-name]#++_approve++#++(address holder, address spender, uint256 value)++` [.item-kind]#internal#
  576. See {ERC20-_approve}.
  577. Note that accounts cannot have allowance issued by their operators.
  578. [.contract-item]
  579. [[ERC777-_spendAllowance-address-address-uint256-]]
  580. ==== `[.contract-item-name]#++_spendAllowance++#++(address owner, address spender, uint256 amount)++` [.item-kind]#internal#
  581. Updates `owner` s allowance for `spender` based on spent `amount`.
  582. Does not update the allowance amount in case of infinite allowance.
  583. Revert if not enough allowance is available.
  584. Might emit an {IERC20-Approval} event.
  585. [.contract-item]
  586. [[ERC777-_beforeTokenTransfer-address-address-address-uint256-]]
  587. ==== `[.contract-item-name]#++_beforeTokenTransfer++#++(address operator, address from, address to, uint256 amount)++` [.item-kind]#internal#
  588. Hook that is called before any token transfer. This includes
  589. calls to {send}, {transfer}, {operatorSend}, {transferFrom}, minting and burning.
  590. Calling conditions:
  591. - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
  592. will be to transferred to `to`.
  593. - when `from` is zero, `amount` tokens will be minted for `to`.
  594. - when `to` is zero, `amount` of ``from``'s tokens will be burned.
  595. - `from` and `to` are never both zero.
  596. To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
  597. == Hooks
  598. :tokensToSend: pass:normal[xref:#IERC777Sender-tokensToSend-address-address-address-uint256-bytes-bytes-[`++tokensToSend++`]]
  599. [.contract]
  600. [[IERC777Sender]]
  601. === `++IERC777Sender++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.5/contracts/token/ERC777/IERC777Sender.sol[{github-icon},role=heading-link]
  602. [.hljs-theme-light.nopadding]
  603. ```solidity
  604. import "@openzeppelin/contracts/token/ERC777/IERC777Sender.sol";
  605. ```
  606. Interface of the ERC777TokensSender standard as defined in the EIP.
  607. {IERC777} Token holders can be notified of operations performed on their
  608. tokens by having a contract implement this interface (contract holders can be
  609. their own implementer) and registering it on the
  610. https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].
  611. See {IERC1820Registry} and {ERC1820Implementer}.
  612. [.contract-index]
  613. .Functions
  614. --
  615. * {xref-IERC777Sender-tokensToSend-address-address-address-uint256-bytes-bytes-}[`++tokensToSend(operator, from, to, amount, userData, operatorData)++`]
  616. --
  617. [.contract-item]
  618. [[IERC777Sender-tokensToSend-address-address-address-uint256-bytes-bytes-]]
  619. ==== `[.contract-item-name]#++tokensToSend++#++(address operator, address from, address to, uint256 amount, bytes userData, bytes operatorData)++` [.item-kind]#external#
  620. Called by an {IERC777} token contract whenever a registered holder's
  621. (`from`) tokens are about to be moved or destroyed. The type of operation
  622. is conveyed by `to` being the zero address or not.
  623. This call occurs _before_ the token contract's state is updated, so
  624. {IERC777-balanceOf}, etc., can be used to query the pre-operation state.
  625. This function may revert to prevent the operation from being executed.
  626. :tokensReceived: pass:normal[xref:#IERC777Recipient-tokensReceived-address-address-address-uint256-bytes-bytes-[`++tokensReceived++`]]
  627. [.contract]
  628. [[IERC777Recipient]]
  629. === `++IERC777Recipient++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.5/contracts/token/ERC777/IERC777Recipient.sol[{github-icon},role=heading-link]
  630. [.hljs-theme-light.nopadding]
  631. ```solidity
  632. import "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol";
  633. ```
  634. Interface of the ERC777TokensRecipient standard as defined in the EIP.
  635. Accounts can be notified of {IERC777} tokens being sent to them by having a
  636. contract implement this interface (contract holders can be their own
  637. implementer) and registering it on the
  638. https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].
  639. See {IERC1820Registry} and {ERC1820Implementer}.
  640. [.contract-index]
  641. .Functions
  642. --
  643. * {xref-IERC777Recipient-tokensReceived-address-address-address-uint256-bytes-bytes-}[`++tokensReceived(operator, from, to, amount, userData, operatorData)++`]
  644. --
  645. [.contract-item]
  646. [[IERC777Recipient-tokensReceived-address-address-address-uint256-bytes-bytes-]]
  647. ==== `[.contract-item-name]#++tokensReceived++#++(address operator, address from, address to, uint256 amount, bytes userData, bytes operatorData)++` [.item-kind]#external#
  648. Called by an {IERC777} token contract whenever tokens are being
  649. moved or created into a registered account (`to`). The type of operation
  650. is conveyed by `from` being the zero address or not.
  651. This call occurs _after_ the token contract's state is updated, so
  652. {IERC777-balanceOf}, etc., can be used to query the post-operation state.
  653. This function may revert to prevent the operation from being executed.
  654. == Presets
  655. These contracts are preconfigured combinations of features. They can be used through inheritance or as models to copy and paste their source code.
  656. :constructor: pass:normal[xref:#ERC777PresetFixedSupply-constructor-string-string-address---uint256-address-[`++constructor++`]]
  657. [.contract]
  658. [[ERC777PresetFixedSupply]]
  659. === `++ERC777PresetFixedSupply++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.5/contracts/token/ERC777/presets/ERC777PresetFixedSupply.sol[{github-icon},role=heading-link]
  660. [.hljs-theme-light.nopadding]
  661. ```solidity
  662. import "@openzeppelin/contracts/token/ERC777/presets/ERC777PresetFixedSupply.sol";
  663. ```
  664. {ERC777} token, including:
  665. - Preminted initial supply
  666. - No access control mechanism (for minting/pausing) and hence no governance
  667. _Available since v3.4._
  668. [.contract-index]
  669. .Functions
  670. --
  671. * {xref-ERC777PresetFixedSupply-constructor-string-string-address---uint256-address-}[`++constructor(name, symbol, defaultOperators, initialSupply, owner)++`]
  672. [.contract-subindex-inherited]
  673. .ERC777
  674. * {xref-ERC777-name--}[`++name()++`]
  675. * {xref-ERC777-symbol--}[`++symbol()++`]
  676. * {xref-ERC777-decimals--}[`++decimals()++`]
  677. * {xref-ERC777-granularity--}[`++granularity()++`]
  678. * {xref-ERC777-totalSupply--}[`++totalSupply()++`]
  679. * {xref-ERC777-balanceOf-address-}[`++balanceOf(tokenHolder)++`]
  680. * {xref-ERC777-send-address-uint256-bytes-}[`++send(recipient, amount, data)++`]
  681. * {xref-ERC777-transfer-address-uint256-}[`++transfer(recipient, amount)++`]
  682. * {xref-ERC777-burn-uint256-bytes-}[`++burn(amount, data)++`]
  683. * {xref-ERC777-isOperatorFor-address-address-}[`++isOperatorFor(operator, tokenHolder)++`]
  684. * {xref-ERC777-authorizeOperator-address-}[`++authorizeOperator(operator)++`]
  685. * {xref-ERC777-revokeOperator-address-}[`++revokeOperator(operator)++`]
  686. * {xref-ERC777-defaultOperators--}[`++defaultOperators()++`]
  687. * {xref-ERC777-operatorSend-address-address-uint256-bytes-bytes-}[`++operatorSend(sender, recipient, amount, data, operatorData)++`]
  688. * {xref-ERC777-operatorBurn-address-uint256-bytes-bytes-}[`++operatorBurn(account, amount, data, operatorData)++`]
  689. * {xref-ERC777-allowance-address-address-}[`++allowance(holder, spender)++`]
  690. * {xref-ERC777-approve-address-uint256-}[`++approve(spender, value)++`]
  691. * {xref-ERC777-transferFrom-address-address-uint256-}[`++transferFrom(holder, recipient, amount)++`]
  692. * {xref-ERC777-_mint-address-uint256-bytes-bytes-}[`++_mint(account, amount, userData, operatorData)++`]
  693. * {xref-ERC777-_mint-address-uint256-bytes-bytes-bool-}[`++_mint(account, amount, userData, operatorData, requireReceptionAck)++`]
  694. * {xref-ERC777-_send-address-address-uint256-bytes-bytes-bool-}[`++_send(from, to, amount, userData, operatorData, requireReceptionAck)++`]
  695. * {xref-ERC777-_burn-address-uint256-bytes-bytes-}[`++_burn(from, amount, data, operatorData)++`]
  696. * {xref-ERC777-_approve-address-address-uint256-}[`++_approve(holder, spender, value)++`]
  697. * {xref-ERC777-_spendAllowance-address-address-uint256-}[`++_spendAllowance(owner, spender, amount)++`]
  698. * {xref-ERC777-_beforeTokenTransfer-address-address-address-uint256-}[`++_beforeTokenTransfer(operator, from, to, amount)++`]
  699. [.contract-subindex-inherited]
  700. .IERC20
  701. [.contract-subindex-inherited]
  702. .IERC777
  703. --
  704. [.contract-index]
  705. .Events
  706. --
  707. [.contract-subindex-inherited]
  708. .ERC777
  709. [.contract-subindex-inherited]
  710. .IERC20
  711. * {xref-IERC20-Transfer-address-address-uint256-}[`++Transfer(from, to, value)++`]
  712. * {xref-IERC20-Approval-address-address-uint256-}[`++Approval(owner, spender, value)++`]
  713. [.contract-subindex-inherited]
  714. .IERC777
  715. * {xref-IERC777-Minted-address-address-uint256-bytes-bytes-}[`++Minted(operator, to, amount, data, operatorData)++`]
  716. * {xref-IERC777-Burned-address-address-uint256-bytes-bytes-}[`++Burned(operator, from, amount, data, operatorData)++`]
  717. * {xref-IERC777-AuthorizedOperator-address-address-}[`++AuthorizedOperator(operator, tokenHolder)++`]
  718. * {xref-IERC777-RevokedOperator-address-address-}[`++RevokedOperator(operator, tokenHolder)++`]
  719. * {xref-IERC777-Sent-address-address-address-uint256-bytes-bytes-}[`++Sent(operator, from, to, amount, data, operatorData)++`]
  720. --
  721. [.contract-item]
  722. [[ERC777PresetFixedSupply-constructor-string-string-address---uint256-address-]]
  723. ==== `[.contract-item-name]#++constructor++#++(string name, string symbol, address[] defaultOperators, uint256 initialSupply, address owner)++` [.item-kind]#public#
  724. Mints `initialSupply` amount of token and transfers them to `owner`.
  725. See {ERC777-constructor}.