interfaces.adoc 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. :github-icon: pass:[<svg class="icon"><use href="#github-icon"/></svg>]
  2. :IERC20: pass:normal[xref:token/ERC20.adoc#IERC20[`IERC20`]]
  3. :IERC20Metadata: pass:normal[xref:token/ERC20.adoc#IERC20Metadata[`IERC20Metadata`]]
  4. :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]]
  5. :IERC721: pass:normal[xref:token/ERC721.adoc#IERC721[`IERC721`]]
  6. :IERC721Receiver: pass:normal[xref:token/ERC721.adoc#IERC721Receiver[`IERC721Receiver`]]
  7. :IERC721Enumerable: pass:normal[xref:token/ERC721.adoc#IERC721Enumerable[`IERC721Enumerable`]]
  8. :IERC721Metadata: pass:normal[xref:token/ERC721.adoc#IERC721Metadata[`IERC721Metadata`]]
  9. :IERC777: pass:normal[xref:token/ERC777.adoc#IERC777[`IERC777`]]
  10. :IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]]
  11. :IERC777Sender: pass:normal[xref:token/ERC777.adoc#IERC777Sender[`IERC777Sender`]]
  12. :IERC1155: pass:normal[xref:token/ERC1155.adoc#IERC1155[`IERC1155`]]
  13. :IERC1155Receiver: pass:normal[xref:token/ERC1155.adoc#IERC1155Receiver[`IERC1155Receiver`]]
  14. :IERC1155MetadataURI: pass:normal[xref:token/ERC1155.adoc#IERC1155MetadataURI[`IERC1155MetadataURI`]]
  15. :IERC1271: pass:normal[xref:interfaces.adoc#IERC1271[`IERC1271`]]
  16. :IERC1363: pass:normal[xref:interfaces.adoc#IERC1363[`IERC1363`]]
  17. :IERC1820Implementer: pass:normal[xref:utils.adoc#IERC1820Implementer[`IERC1820Implementer`]]
  18. :IERC1820Registry: pass:normal[xref:utils.adoc#IERC1820Registry[`IERC1820Registry`]]
  19. :IERC1822Proxiable: pass:normal[xref:interfaces.adoc#IERC1822Proxiable[`IERC1822Proxiable`]]
  20. :IERC2612: pass:normal[xref:interfaces.adoc#IERC2612[`IERC2612`]]
  21. :IERC2981: pass:normal[xref:interfaces.adoc#IERC2981[`IERC2981`]]
  22. :IERC3156FlashLender: pass:normal[xref:interfaces.adoc#IERC3156FlashLender[`IERC3156FlashLender`]]
  23. :IERC3156FlashBorrower: pass:normal[xref:interfaces.adoc#IERC3156FlashBorrower[`IERC3156FlashBorrower`]]
  24. :IERC4626: pass:normal[xref:interfaces.adoc#IERC4626[`IERC4626`]]
  25. :xref-IERC1271-isValidSignature-bytes32-bytes-: xref:interfaces.adoc#IERC1271-isValidSignature-bytes32-bytes-
  26. :xref-IERC1363-transferAndCall-address-uint256-: xref:interfaces.adoc#IERC1363-transferAndCall-address-uint256-
  27. :xref-IERC1363-transferAndCall-address-uint256-bytes-: xref:interfaces.adoc#IERC1363-transferAndCall-address-uint256-bytes-
  28. :xref-IERC1363-transferFromAndCall-address-address-uint256-: xref:interfaces.adoc#IERC1363-transferFromAndCall-address-address-uint256-
  29. :xref-IERC1363-transferFromAndCall-address-address-uint256-bytes-: xref:interfaces.adoc#IERC1363-transferFromAndCall-address-address-uint256-bytes-
  30. :xref-IERC1363-approveAndCall-address-uint256-: xref:interfaces.adoc#IERC1363-approveAndCall-address-uint256-
  31. :xref-IERC1363-approveAndCall-address-uint256-bytes-: xref:interfaces.adoc#IERC1363-approveAndCall-address-uint256-bytes-
  32. :xref-IERC20-totalSupply--: xref:token/ERC20.adoc#IERC20-totalSupply--
  33. :xref-IERC20-balanceOf-address-: xref:token/ERC20.adoc#IERC20-balanceOf-address-
  34. :xref-IERC20-transfer-address-uint256-: xref:token/ERC20.adoc#IERC20-transfer-address-uint256-
  35. :xref-IERC20-allowance-address-address-: xref:token/ERC20.adoc#IERC20-allowance-address-address-
  36. :xref-IERC20-approve-address-uint256-: xref:token/ERC20.adoc#IERC20-approve-address-uint256-
  37. :xref-IERC20-transferFrom-address-address-uint256-: xref:token/ERC20.adoc#IERC20-transferFrom-address-address-uint256-
  38. :xref-IERC165-supportsInterface-bytes4-: xref:utils.adoc#IERC165-supportsInterface-bytes4-
  39. :xref-IERC20-Transfer-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-
  40. :xref-IERC20-Approval-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Approval-address-address-uint256-
  41. :xref-IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-: xref:interfaces.adoc#IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-
  42. :xref-IERC1822Proxiable-proxiableUUID--: xref:interfaces.adoc#IERC1822Proxiable-proxiableUUID--
  43. :xref-IERC20Permit-permit-address-address-uint256-uint256-uint8-bytes32-bytes32-: xref:token/ERC20.adoc#IERC20Permit-permit-address-address-uint256-uint256-uint8-bytes32-bytes32-
  44. :xref-IERC20Permit-nonces-address-: xref:token/ERC20.adoc#IERC20Permit-nonces-address-
  45. :xref-IERC20Permit-DOMAIN_SEPARATOR--: xref:token/ERC20.adoc#IERC20Permit-DOMAIN_SEPARATOR--
  46. :xref-IERC2981-royaltyInfo-uint256-uint256-: xref:interfaces.adoc#IERC2981-royaltyInfo-uint256-uint256-
  47. :xref-IERC165-supportsInterface-bytes4-: xref:utils.adoc#IERC165-supportsInterface-bytes4-
  48. :xref-IERC3156FlashLender-maxFlashLoan-address-: xref:interfaces.adoc#IERC3156FlashLender-maxFlashLoan-address-
  49. :xref-IERC3156FlashLender-flashFee-address-uint256-: xref:interfaces.adoc#IERC3156FlashLender-flashFee-address-uint256-
  50. :xref-IERC3156FlashLender-flashLoan-contract-IERC3156FlashBorrower-address-uint256-bytes-: xref:interfaces.adoc#IERC3156FlashLender-flashLoan-contract-IERC3156FlashBorrower-address-uint256-bytes-
  51. :xref-IERC3156FlashBorrower-onFlashLoan-address-address-uint256-uint256-bytes-: xref:interfaces.adoc#IERC3156FlashBorrower-onFlashLoan-address-address-uint256-uint256-bytes-
  52. :xref-IERC4626-asset--: xref:interfaces.adoc#IERC4626-asset--
  53. :xref-IERC4626-totalAssets--: xref:interfaces.adoc#IERC4626-totalAssets--
  54. :xref-IERC4626-convertToShares-uint256-: xref:interfaces.adoc#IERC4626-convertToShares-uint256-
  55. :xref-IERC4626-convertToAssets-uint256-: xref:interfaces.adoc#IERC4626-convertToAssets-uint256-
  56. :xref-IERC4626-maxDeposit-address-: xref:interfaces.adoc#IERC4626-maxDeposit-address-
  57. :xref-IERC4626-previewDeposit-uint256-: xref:interfaces.adoc#IERC4626-previewDeposit-uint256-
  58. :xref-IERC4626-deposit-uint256-address-: xref:interfaces.adoc#IERC4626-deposit-uint256-address-
  59. :xref-IERC4626-maxMint-address-: xref:interfaces.adoc#IERC4626-maxMint-address-
  60. :xref-IERC4626-previewMint-uint256-: xref:interfaces.adoc#IERC4626-previewMint-uint256-
  61. :xref-IERC4626-mint-uint256-address-: xref:interfaces.adoc#IERC4626-mint-uint256-address-
  62. :xref-IERC4626-maxWithdraw-address-: xref:interfaces.adoc#IERC4626-maxWithdraw-address-
  63. :xref-IERC4626-previewWithdraw-uint256-: xref:interfaces.adoc#IERC4626-previewWithdraw-uint256-
  64. :xref-IERC4626-withdraw-uint256-address-address-: xref:interfaces.adoc#IERC4626-withdraw-uint256-address-address-
  65. :xref-IERC4626-maxRedeem-address-: xref:interfaces.adoc#IERC4626-maxRedeem-address-
  66. :xref-IERC4626-previewRedeem-uint256-: xref:interfaces.adoc#IERC4626-previewRedeem-uint256-
  67. :xref-IERC4626-redeem-uint256-address-address-: xref:interfaces.adoc#IERC4626-redeem-uint256-address-address-
  68. :xref-IERC20Metadata-name--: xref:token/ERC20.adoc#IERC20Metadata-name--
  69. :xref-IERC20Metadata-symbol--: xref:token/ERC20.adoc#IERC20Metadata-symbol--
  70. :xref-IERC20Metadata-decimals--: xref:token/ERC20.adoc#IERC20Metadata-decimals--
  71. :xref-IERC20-totalSupply--: xref:token/ERC20.adoc#IERC20-totalSupply--
  72. :xref-IERC20-balanceOf-address-: xref:token/ERC20.adoc#IERC20-balanceOf-address-
  73. :xref-IERC20-transfer-address-uint256-: xref:token/ERC20.adoc#IERC20-transfer-address-uint256-
  74. :xref-IERC20-allowance-address-address-: xref:token/ERC20.adoc#IERC20-allowance-address-address-
  75. :xref-IERC20-approve-address-uint256-: xref:token/ERC20.adoc#IERC20-approve-address-uint256-
  76. :xref-IERC20-transferFrom-address-address-uint256-: xref:token/ERC20.adoc#IERC20-transferFrom-address-address-uint256-
  77. :xref-IERC4626-Deposit-address-address-uint256-uint256-: xref:interfaces.adoc#IERC4626-Deposit-address-address-uint256-uint256-
  78. :xref-IERC4626-Withdraw-address-address-address-uint256-uint256-: xref:interfaces.adoc#IERC4626-Withdraw-address-address-address-uint256-uint256-
  79. :xref-IERC20-Transfer-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256-
  80. :xref-IERC20-Approval-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Approval-address-address-uint256-
  81. = Interfaces
  82. [.readme-notice]
  83. NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/interfaces
  84. == List of standardized interfaces
  85. These interfaces are available as `.sol` files, and also as compiler `.json` ABI files (through the npm package). These
  86. are useful to interact with third party contracts that implement them.
  87. - {IERC20}
  88. - {IERC20Metadata}
  89. - {IERC165}
  90. - {IERC721}
  91. - {IERC721Receiver}
  92. - {IERC721Enumerable}
  93. - {IERC721Metadata}
  94. - {IERC777}
  95. - {IERC777Recipient}
  96. - {IERC777Sender}
  97. - {IERC1155}
  98. - {IERC1155Receiver}
  99. - {IERC1155MetadataURI}
  100. - {IERC1271}
  101. - {IERC1363}
  102. - {IERC1820Implementer}
  103. - {IERC1820Registry}
  104. - {IERC1822Proxiable}
  105. - {IERC2612}
  106. - {IERC2981}
  107. - {IERC3156FlashLender}
  108. - {IERC3156FlashBorrower}
  109. - {IERC4626}
  110. == Detailed ABI
  111. :isValidSignature: pass:normal[xref:#IERC1271-isValidSignature-bytes32-bytes-[`++isValidSignature++`]]
  112. [.contract]
  113. [[IERC1271]]
  114. === `++IERC1271++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/IERC1271.sol[{github-icon},role=heading-link]
  115. [.hljs-theme-light.nopadding]
  116. ```solidity
  117. import "@openzeppelin/contracts/interfaces/IERC1271.sol";
  118. ```
  119. Interface of the ERC1271 standard signature validation method for
  120. contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
  121. _Available since v4.1._
  122. [.contract-index]
  123. .Functions
  124. --
  125. * {xref-IERC1271-isValidSignature-bytes32-bytes-}[`++isValidSignature(hash, signature)++`]
  126. --
  127. [.contract-item]
  128. [[IERC1271-isValidSignature-bytes32-bytes-]]
  129. ==== `[.contract-item-name]#++isValidSignature++#++(bytes32 hash, bytes signature) → bytes4 magicValue++` [.item-kind]#external#
  130. Should return whether the signature provided is valid for the provided data
  131. :transferAndCall: pass:normal[xref:#IERC1363-transferAndCall-address-uint256-[`++transferAndCall++`]]
  132. :transferAndCall: pass:normal[xref:#IERC1363-transferAndCall-address-uint256-bytes-[`++transferAndCall++`]]
  133. :transferFromAndCall: pass:normal[xref:#IERC1363-transferFromAndCall-address-address-uint256-[`++transferFromAndCall++`]]
  134. :transferFromAndCall: pass:normal[xref:#IERC1363-transferFromAndCall-address-address-uint256-bytes-[`++transferFromAndCall++`]]
  135. :approveAndCall: pass:normal[xref:#IERC1363-approveAndCall-address-uint256-[`++approveAndCall++`]]
  136. :approveAndCall: pass:normal[xref:#IERC1363-approveAndCall-address-uint256-bytes-[`++approveAndCall++`]]
  137. [.contract]
  138. [[IERC1363]]
  139. === `++IERC1363++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/IERC1363.sol[{github-icon},role=heading-link]
  140. [.hljs-theme-light.nopadding]
  141. ```solidity
  142. import "@openzeppelin/contracts/interfaces/IERC1363.sol";
  143. ```
  144. [.contract-index]
  145. .Functions
  146. --
  147. * {xref-IERC1363-transferAndCall-address-uint256-}[`++transferAndCall(to, value)++`]
  148. * {xref-IERC1363-transferAndCall-address-uint256-bytes-}[`++transferAndCall(to, value, data)++`]
  149. * {xref-IERC1363-transferFromAndCall-address-address-uint256-}[`++transferFromAndCall(from, to, value)++`]
  150. * {xref-IERC1363-transferFromAndCall-address-address-uint256-bytes-}[`++transferFromAndCall(from, to, value, data)++`]
  151. * {xref-IERC1363-approveAndCall-address-uint256-}[`++approveAndCall(spender, value)++`]
  152. * {xref-IERC1363-approveAndCall-address-uint256-bytes-}[`++approveAndCall(spender, value, data)++`]
  153. [.contract-subindex-inherited]
  154. .IERC20
  155. * {xref-IERC20-totalSupply--}[`++totalSupply()++`]
  156. * {xref-IERC20-balanceOf-address-}[`++balanceOf(account)++`]
  157. * {xref-IERC20-transfer-address-uint256-}[`++transfer(to, amount)++`]
  158. * {xref-IERC20-allowance-address-address-}[`++allowance(owner, spender)++`]
  159. * {xref-IERC20-approve-address-uint256-}[`++approve(spender, amount)++`]
  160. * {xref-IERC20-transferFrom-address-address-uint256-}[`++transferFrom(from, to, amount)++`]
  161. [.contract-subindex-inherited]
  162. .IERC165
  163. * {xref-IERC165-supportsInterface-bytes4-}[`++supportsInterface(interfaceId)++`]
  164. --
  165. [.contract-index]
  166. .Events
  167. --
  168. [.contract-subindex-inherited]
  169. .IERC20
  170. * {xref-IERC20-Transfer-address-address-uint256-}[`++Transfer(from, to, value)++`]
  171. * {xref-IERC20-Approval-address-address-uint256-}[`++Approval(owner, spender, value)++`]
  172. [.contract-subindex-inherited]
  173. .IERC165
  174. --
  175. [.contract-item]
  176. [[IERC1363-transferAndCall-address-uint256-]]
  177. ==== `[.contract-item-name]#++transferAndCall++#++(address to, uint256 value) → bool++` [.item-kind]#external#
  178. Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver
  179. [.contract-item]
  180. [[IERC1363-transferAndCall-address-uint256-bytes-]]
  181. ==== `[.contract-item-name]#++transferAndCall++#++(address to, uint256 value, bytes data) → bool++` [.item-kind]#external#
  182. Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver
  183. [.contract-item]
  184. [[IERC1363-transferFromAndCall-address-address-uint256-]]
  185. ==== `[.contract-item-name]#++transferFromAndCall++#++(address from, address to, uint256 value) → bool++` [.item-kind]#external#
  186. Transfer tokens from one address to another and then call `onTransferReceived` on receiver
  187. [.contract-item]
  188. [[IERC1363-transferFromAndCall-address-address-uint256-bytes-]]
  189. ==== `[.contract-item-name]#++transferFromAndCall++#++(address from, address to, uint256 value, bytes data) → bool++` [.item-kind]#external#
  190. Transfer tokens from one address to another and then call `onTransferReceived` on receiver
  191. [.contract-item]
  192. [[IERC1363-approveAndCall-address-uint256-]]
  193. ==== `[.contract-item-name]#++approveAndCall++#++(address spender, uint256 value) → bool++` [.item-kind]#external#
  194. Approve the passed address to spend the specified amount of tokens on behalf of msg.sender
  195. and then call `onApprovalReceived` on spender.
  196. [.contract-item]
  197. [[IERC1363-approveAndCall-address-uint256-bytes-]]
  198. ==== `[.contract-item-name]#++approveAndCall++#++(address spender, uint256 value, bytes data) → bool++` [.item-kind]#external#
  199. Approve the passed address to spend the specified amount of tokens on behalf of msg.sender
  200. and then call `onApprovalReceived` on spender.
  201. :onTransferReceived: pass:normal[xref:#IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-[`++onTransferReceived++`]]
  202. [.contract]
  203. [[IERC1363Receiver]]
  204. === `++IERC1363Receiver++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/IERC1363Receiver.sol[{github-icon},role=heading-link]
  205. [.hljs-theme-light.nopadding]
  206. ```solidity
  207. import "@openzeppelin/contracts/interfaces/IERC1363Receiver.sol";
  208. ```
  209. [.contract-index]
  210. .Functions
  211. --
  212. * {xref-IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-}[`++onTransferReceived(operator, from, value, data)++`]
  213. --
  214. [.contract-item]
  215. [[IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-]]
  216. ==== `[.contract-item-name]#++onTransferReceived++#++(address operator, address from, uint256 value, bytes data) → bytes4++` [.item-kind]#external#
  217. Any ERC1363 smart contract calls this function on the recipient
  218. after a `transfer` or a `transferFrom`. This function MAY throw to revert and reject the
  219. transfer. Return of other than the magic value MUST result in the
  220. transaction being reverted.
  221. Note: the token contract address is always the message sender.
  222. :proxiableUUID: pass:normal[xref:#IERC1822Proxiable-proxiableUUID--[`++proxiableUUID++`]]
  223. [.contract]
  224. [[IERC1822Proxiable]]
  225. === `++IERC1822Proxiable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/draft-IERC1822.sol[{github-icon},role=heading-link]
  226. [.hljs-theme-light.nopadding]
  227. ```solidity
  228. import "@openzeppelin/contracts/interfaces/draft-IERC1822.sol";
  229. ```
  230. ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
  231. proxy whose upgrades are fully controlled by the current implementation.
  232. [.contract-index]
  233. .Functions
  234. --
  235. * {xref-IERC1822Proxiable-proxiableUUID--}[`++proxiableUUID()++`]
  236. --
  237. [.contract-item]
  238. [[IERC1822Proxiable-proxiableUUID--]]
  239. ==== `[.contract-item-name]#++proxiableUUID++#++() → bytes32++` [.item-kind]#external#
  240. Returns the storage slot that the proxiable contract assumes is being used to store the implementation
  241. address.
  242. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
  243. bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
  244. function revert if invoked through a proxy.
  245. [.contract]
  246. [[IERC2612]]
  247. === `++IERC2612++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/draft-IERC2612.sol[{github-icon},role=heading-link]
  248. [.hljs-theme-light.nopadding]
  249. ```solidity
  250. import "@openzeppelin/contracts/interfaces/draft-IERC2612.sol";
  251. ```
  252. [.contract-index]
  253. .Functions
  254. --
  255. [.contract-subindex-inherited]
  256. .IERC20Permit
  257. * {xref-IERC20Permit-permit-address-address-uint256-uint256-uint8-bytes32-bytes32-}[`++permit(owner, spender, value, deadline, v, r, s)++`]
  258. * {xref-IERC20Permit-nonces-address-}[`++nonces(owner)++`]
  259. * {xref-IERC20Permit-DOMAIN_SEPARATOR--}[`++DOMAIN_SEPARATOR()++`]
  260. --
  261. :royaltyInfo: pass:normal[xref:#IERC2981-royaltyInfo-uint256-uint256-[`++royaltyInfo++`]]
  262. [.contract]
  263. [[IERC2981]]
  264. === `++IERC2981++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/IERC2981.sol[{github-icon},role=heading-link]
  265. [.hljs-theme-light.nopadding]
  266. ```solidity
  267. import "@openzeppelin/contracts/interfaces/IERC2981.sol";
  268. ```
  269. Interface for the NFT Royalty Standard.
  270. A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
  271. support for royalty payments across all NFT marketplaces and ecosystem participants.
  272. _Available since v4.5._
  273. [.contract-index]
  274. .Functions
  275. --
  276. * {xref-IERC2981-royaltyInfo-uint256-uint256-}[`++royaltyInfo(tokenId, salePrice)++`]
  277. [.contract-subindex-inherited]
  278. .IERC165
  279. * {xref-IERC165-supportsInterface-bytes4-}[`++supportsInterface(interfaceId)++`]
  280. --
  281. [.contract-item]
  282. [[IERC2981-royaltyInfo-uint256-uint256-]]
  283. ==== `[.contract-item-name]#++royaltyInfo++#++(uint256 tokenId, uint256 salePrice) → address receiver, uint256 royaltyAmount++` [.item-kind]#external#
  284. Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
  285. exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
  286. :maxFlashLoan: pass:normal[xref:#IERC3156FlashLender-maxFlashLoan-address-[`++maxFlashLoan++`]]
  287. :flashFee: pass:normal[xref:#IERC3156FlashLender-flashFee-address-uint256-[`++flashFee++`]]
  288. :flashLoan: pass:normal[xref:#IERC3156FlashLender-flashLoan-contract-IERC3156FlashBorrower-address-uint256-bytes-[`++flashLoan++`]]
  289. [.contract]
  290. [[IERC3156FlashLender]]
  291. === `++IERC3156FlashLender++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/IERC3156FlashLender.sol[{github-icon},role=heading-link]
  292. [.hljs-theme-light.nopadding]
  293. ```solidity
  294. import "@openzeppelin/contracts/interfaces/IERC3156FlashLender.sol";
  295. ```
  296. Interface of the ERC3156 FlashLender, as defined in
  297. https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].
  298. _Available since v4.1._
  299. [.contract-index]
  300. .Functions
  301. --
  302. * {xref-IERC3156FlashLender-maxFlashLoan-address-}[`++maxFlashLoan(token)++`]
  303. * {xref-IERC3156FlashLender-flashFee-address-uint256-}[`++flashFee(token, amount)++`]
  304. * {xref-IERC3156FlashLender-flashLoan-contract-IERC3156FlashBorrower-address-uint256-bytes-}[`++flashLoan(receiver, token, amount, data)++`]
  305. --
  306. [.contract-item]
  307. [[IERC3156FlashLender-maxFlashLoan-address-]]
  308. ==== `[.contract-item-name]#++maxFlashLoan++#++(address token) → uint256++` [.item-kind]#external#
  309. The amount of currency available to be lended.
  310. [.contract-item]
  311. [[IERC3156FlashLender-flashFee-address-uint256-]]
  312. ==== `[.contract-item-name]#++flashFee++#++(address token, uint256 amount) → uint256++` [.item-kind]#external#
  313. The fee to be charged for a given loan.
  314. [.contract-item]
  315. [[IERC3156FlashLender-flashLoan-contract-IERC3156FlashBorrower-address-uint256-bytes-]]
  316. ==== `[.contract-item-name]#++flashLoan++#++(contract IERC3156FlashBorrower receiver, address token, uint256 amount, bytes data) → bool++` [.item-kind]#external#
  317. Initiate a flash loan.
  318. :onFlashLoan: pass:normal[xref:#IERC3156FlashBorrower-onFlashLoan-address-address-uint256-uint256-bytes-[`++onFlashLoan++`]]
  319. [.contract]
  320. [[IERC3156FlashBorrower]]
  321. === `++IERC3156FlashBorrower++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/IERC3156FlashBorrower.sol[{github-icon},role=heading-link]
  322. [.hljs-theme-light.nopadding]
  323. ```solidity
  324. import "@openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol";
  325. ```
  326. Interface of the ERC3156 FlashBorrower, as defined in
  327. https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].
  328. _Available since v4.1._
  329. [.contract-index]
  330. .Functions
  331. --
  332. * {xref-IERC3156FlashBorrower-onFlashLoan-address-address-uint256-uint256-bytes-}[`++onFlashLoan(initiator, token, amount, fee, data)++`]
  333. --
  334. [.contract-item]
  335. [[IERC3156FlashBorrower-onFlashLoan-address-address-uint256-uint256-bytes-]]
  336. ==== `[.contract-item-name]#++onFlashLoan++#++(address initiator, address token, uint256 amount, uint256 fee, bytes data) → bytes32++` [.item-kind]#external#
  337. Receive a flash loan.
  338. :Deposit: pass:normal[xref:#IERC4626-Deposit-address-address-uint256-uint256-[`++Deposit++`]]
  339. :Withdraw: pass:normal[xref:#IERC4626-Withdraw-address-address-address-uint256-uint256-[`++Withdraw++`]]
  340. :asset: pass:normal[xref:#IERC4626-asset--[`++asset++`]]
  341. :totalAssets: pass:normal[xref:#IERC4626-totalAssets--[`++totalAssets++`]]
  342. :convertToShares: pass:normal[xref:#IERC4626-convertToShares-uint256-[`++convertToShares++`]]
  343. :convertToAssets: pass:normal[xref:#IERC4626-convertToAssets-uint256-[`++convertToAssets++`]]
  344. :maxDeposit: pass:normal[xref:#IERC4626-maxDeposit-address-[`++maxDeposit++`]]
  345. :previewDeposit: pass:normal[xref:#IERC4626-previewDeposit-uint256-[`++previewDeposit++`]]
  346. :deposit: pass:normal[xref:#IERC4626-deposit-uint256-address-[`++deposit++`]]
  347. :maxMint: pass:normal[xref:#IERC4626-maxMint-address-[`++maxMint++`]]
  348. :previewMint: pass:normal[xref:#IERC4626-previewMint-uint256-[`++previewMint++`]]
  349. :mint: pass:normal[xref:#IERC4626-mint-uint256-address-[`++mint++`]]
  350. :maxWithdraw: pass:normal[xref:#IERC4626-maxWithdraw-address-[`++maxWithdraw++`]]
  351. :previewWithdraw: pass:normal[xref:#IERC4626-previewWithdraw-uint256-[`++previewWithdraw++`]]
  352. :withdraw: pass:normal[xref:#IERC4626-withdraw-uint256-address-address-[`++withdraw++`]]
  353. :maxRedeem: pass:normal[xref:#IERC4626-maxRedeem-address-[`++maxRedeem++`]]
  354. :previewRedeem: pass:normal[xref:#IERC4626-previewRedeem-uint256-[`++previewRedeem++`]]
  355. :redeem: pass:normal[xref:#IERC4626-redeem-uint256-address-address-[`++redeem++`]]
  356. [.contract]
  357. [[IERC4626]]
  358. === `++IERC4626++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/IERC4626.sol[{github-icon},role=heading-link]
  359. [.hljs-theme-light.nopadding]
  360. ```solidity
  361. import "@openzeppelin/contracts/interfaces/IERC4626.sol";
  362. ```
  363. Interface of the ERC4626 "Tokenized Vault Standard", as defined in
  364. https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].
  365. _Available since v4.7._
  366. [.contract-index]
  367. .Functions
  368. --
  369. * {xref-IERC4626-asset--}[`++asset()++`]
  370. * {xref-IERC4626-totalAssets--}[`++totalAssets()++`]
  371. * {xref-IERC4626-convertToShares-uint256-}[`++convertToShares(assets)++`]
  372. * {xref-IERC4626-convertToAssets-uint256-}[`++convertToAssets(shares)++`]
  373. * {xref-IERC4626-maxDeposit-address-}[`++maxDeposit(receiver)++`]
  374. * {xref-IERC4626-previewDeposit-uint256-}[`++previewDeposit(assets)++`]
  375. * {xref-IERC4626-deposit-uint256-address-}[`++deposit(assets, receiver)++`]
  376. * {xref-IERC4626-maxMint-address-}[`++maxMint(receiver)++`]
  377. * {xref-IERC4626-previewMint-uint256-}[`++previewMint(shares)++`]
  378. * {xref-IERC4626-mint-uint256-address-}[`++mint(shares, receiver)++`]
  379. * {xref-IERC4626-maxWithdraw-address-}[`++maxWithdraw(owner)++`]
  380. * {xref-IERC4626-previewWithdraw-uint256-}[`++previewWithdraw(assets)++`]
  381. * {xref-IERC4626-withdraw-uint256-address-address-}[`++withdraw(assets, receiver, owner)++`]
  382. * {xref-IERC4626-maxRedeem-address-}[`++maxRedeem(owner)++`]
  383. * {xref-IERC4626-previewRedeem-uint256-}[`++previewRedeem(shares)++`]
  384. * {xref-IERC4626-redeem-uint256-address-address-}[`++redeem(shares, receiver, owner)++`]
  385. [.contract-subindex-inherited]
  386. .IERC20Metadata
  387. * {xref-IERC20Metadata-name--}[`++name()++`]
  388. * {xref-IERC20Metadata-symbol--}[`++symbol()++`]
  389. * {xref-IERC20Metadata-decimals--}[`++decimals()++`]
  390. [.contract-subindex-inherited]
  391. .IERC20
  392. * {xref-IERC20-totalSupply--}[`++totalSupply()++`]
  393. * {xref-IERC20-balanceOf-address-}[`++balanceOf(account)++`]
  394. * {xref-IERC20-transfer-address-uint256-}[`++transfer(to, amount)++`]
  395. * {xref-IERC20-allowance-address-address-}[`++allowance(owner, spender)++`]
  396. * {xref-IERC20-approve-address-uint256-}[`++approve(spender, amount)++`]
  397. * {xref-IERC20-transferFrom-address-address-uint256-}[`++transferFrom(from, to, amount)++`]
  398. --
  399. [.contract-index]
  400. .Events
  401. --
  402. * {xref-IERC4626-Deposit-address-address-uint256-uint256-}[`++Deposit(sender, owner, assets, shares)++`]
  403. * {xref-IERC4626-Withdraw-address-address-address-uint256-uint256-}[`++Withdraw(sender, receiver, owner, assets, shares)++`]
  404. [.contract-subindex-inherited]
  405. .IERC20Metadata
  406. [.contract-subindex-inherited]
  407. .IERC20
  408. * {xref-IERC20-Transfer-address-address-uint256-}[`++Transfer(from, to, value)++`]
  409. * {xref-IERC20-Approval-address-address-uint256-}[`++Approval(owner, spender, value)++`]
  410. --
  411. [.contract-item]
  412. [[IERC4626-asset--]]
  413. ==== `[.contract-item-name]#++asset++#++() → address assetTokenAddress++` [.item-kind]#external#
  414. Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
  415. - MUST be an ERC-20 token contract.
  416. - MUST NOT revert.
  417. [.contract-item]
  418. [[IERC4626-totalAssets--]]
  419. ==== `[.contract-item-name]#++totalAssets++#++() → uint256 totalManagedAssets++` [.item-kind]#external#
  420. Returns the total amount of the underlying asset that is “managed” by Vault.
  421. - SHOULD include any compounding that occurs from yield.
  422. - MUST be inclusive of any fees that are charged against assets in the Vault.
  423. - MUST NOT revert.
  424. [.contract-item]
  425. [[IERC4626-convertToShares-uint256-]]
  426. ==== `[.contract-item-name]#++convertToShares++#++(uint256 assets) → uint256 shares++` [.item-kind]#external#
  427. Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal
  428. scenario where all the conditions are met.
  429. - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
  430. - MUST NOT show any variations depending on the caller.
  431. - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
  432. - MUST NOT revert.
  433. NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
  434. “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
  435. from.
  436. [.contract-item]
  437. [[IERC4626-convertToAssets-uint256-]]
  438. ==== `[.contract-item-name]#++convertToAssets++#++(uint256 shares) → uint256 assets++` [.item-kind]#external#
  439. Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
  440. scenario where all the conditions are met.
  441. - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
  442. - MUST NOT show any variations depending on the caller.
  443. - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
  444. - MUST NOT revert.
  445. NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
  446. “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
  447. from.
  448. [.contract-item]
  449. [[IERC4626-maxDeposit-address-]]
  450. ==== `[.contract-item-name]#++maxDeposit++#++(address receiver) → uint256 maxAssets++` [.item-kind]#external#
  451. Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,
  452. through a deposit call.
  453. - MUST return a limited value if receiver is subject to some deposit limit.
  454. - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
  455. - MUST NOT revert.
  456. [.contract-item]
  457. [[IERC4626-previewDeposit-uint256-]]
  458. ==== `[.contract-item-name]#++previewDeposit++#++(uint256 assets) → uint256 shares++` [.item-kind]#external#
  459. Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given
  460. current on-chain conditions.
  461. - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit
  462. call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called
  463. in the same transaction.
  464. - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the
  465. deposit would be accepted, regardless if the user has enough tokens approved, etc.
  466. - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
  467. - MUST NOT revert.
  468. NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
  469. share price or some other type of condition, meaning the depositor will lose assets by depositing.
  470. [.contract-item]
  471. [[IERC4626-deposit-uint256-address-]]
  472. ==== `[.contract-item-name]#++deposit++#++(uint256 assets, address receiver) → uint256 shares++` [.item-kind]#external#
  473. Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.
  474. - MUST emit the Deposit event.
  475. - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
  476. deposit execution, and are accounted for during deposit.
  477. - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
  478. approving enough underlying tokens to the Vault contract, etc).
  479. NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
  480. [.contract-item]
  481. [[IERC4626-maxMint-address-]]
  482. ==== `[.contract-item-name]#++maxMint++#++(address receiver) → uint256 maxShares++` [.item-kind]#external#
  483. Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.
  484. - MUST return a limited value if receiver is subject to some mint limit.
  485. - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
  486. - MUST NOT revert.
  487. [.contract-item]
  488. [[IERC4626-previewMint-uint256-]]
  489. ==== `[.contract-item-name]#++previewMint++#++(uint256 shares) → uint256 assets++` [.item-kind]#external#
  490. Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given
  491. current on-chain conditions.
  492. - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call
  493. in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the
  494. same transaction.
  495. - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint
  496. would be accepted, regardless if the user has enough tokens approved, etc.
  497. - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
  498. - MUST NOT revert.
  499. NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
  500. share price or some other type of condition, meaning the depositor will lose assets by minting.
  501. [.contract-item]
  502. [[IERC4626-mint-uint256-address-]]
  503. ==== `[.contract-item-name]#++mint++#++(uint256 shares, address receiver) → uint256 assets++` [.item-kind]#external#
  504. Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.
  505. - MUST emit the Deposit event.
  506. - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint
  507. execution, and are accounted for during mint.
  508. - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not
  509. approving enough underlying tokens to the Vault contract, etc).
  510. NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
  511. [.contract-item]
  512. [[IERC4626-maxWithdraw-address-]]
  513. ==== `[.contract-item-name]#++maxWithdraw++#++(address owner) → uint256 maxAssets++` [.item-kind]#external#
  514. Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the
  515. Vault, through a withdraw call.
  516. - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
  517. - MUST NOT revert.
  518. [.contract-item]
  519. [[IERC4626-previewWithdraw-uint256-]]
  520. ==== `[.contract-item-name]#++previewWithdraw++#++(uint256 assets) → uint256 shares++` [.item-kind]#external#
  521. Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,
  522. given current on-chain conditions.
  523. - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
  524. call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if
  525. called
  526. in the same transaction.
  527. - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though
  528. the withdrawal would be accepted, regardless if the user has enough shares, etc.
  529. - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
  530. - MUST NOT revert.
  531. NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in
  532. share price or some other type of condition, meaning the depositor will lose assets by depositing.
  533. [.contract-item]
  534. [[IERC4626-withdraw-uint256-address-address-]]
  535. ==== `[.contract-item-name]#++withdraw++#++(uint256 assets, address receiver, address owner) → uint256 shares++` [.item-kind]#external#
  536. Burns shares from owner and sends exactly assets of underlying tokens to receiver.
  537. - MUST emit the Withdraw event.
  538. - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
  539. withdraw execution, and are accounted for during withdraw.
  540. - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner
  541. not having enough shares, etc).
  542. Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
  543. Those methods should be performed separately.
  544. [.contract-item]
  545. [[IERC4626-maxRedeem-address-]]
  546. ==== `[.contract-item-name]#++maxRedeem++#++(address owner) → uint256 maxShares++` [.item-kind]#external#
  547. Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,
  548. through a redeem call.
  549. - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
  550. - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.
  551. - MUST NOT revert.
  552. [.contract-item]
  553. [[IERC4626-previewRedeem-uint256-]]
  554. ==== `[.contract-item-name]#++previewRedeem++#++(uint256 shares) → uint256 assets++` [.item-kind]#external#
  555. Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,
  556. given current on-chain conditions.
  557. - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call
  558. in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the
  559. same transaction.
  560. - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
  561. redemption would be accepted, regardless if the user has enough shares, etc.
  562. - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
  563. - MUST NOT revert.
  564. NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
  565. share price or some other type of condition, meaning the depositor will lose assets by redeeming.
  566. [.contract-item]
  567. [[IERC4626-redeem-uint256-address-address-]]
  568. ==== `[.contract-item-name]#++redeem++#++(uint256 shares, address receiver, address owner) → uint256 assets++` [.item-kind]#external#
  569. Burns exactly shares from owner and sends assets of underlying tokens to receiver.
  570. - MUST emit the Withdraw event.
  571. - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
  572. redeem execution, and are accounted for during redeem.
  573. - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner
  574. not having enough shares, etc).
  575. NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
  576. Those methods should be performed separately.
  577. [.contract-item]
  578. [[IERC4626-Deposit-address-address-uint256-uint256-]]
  579. ==== `[.contract-item-name]#++Deposit++#++(address indexed sender, address indexed owner, uint256 assets, uint256 shares)++` [.item-kind]#event#
  580. [.contract-item]
  581. [[IERC4626-Withdraw-address-address-address-uint256-uint256-]]
  582. ==== `[.contract-item-name]#++Withdraw++#++(address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares)++` [.item-kind]#event#