ERC777.adoc 49 KB

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