:github-icon: pass:[] :IERC20: pass:normal[xref:token/ERC20.adoc#IERC20[`IERC20`]] :IERC20Metadata: pass:normal[xref:token/ERC20.adoc#IERC20Metadata[`IERC20Metadata`]] :IERC165: pass:normal[xref:utils.adoc#IERC165[`IERC165`]] :IERC721: pass:normal[xref:token/ERC721.adoc#IERC721[`IERC721`]] :IERC721Receiver: pass:normal[xref:token/ERC721.adoc#IERC721Receiver[`IERC721Receiver`]] :IERC721Enumerable: pass:normal[xref:token/ERC721.adoc#IERC721Enumerable[`IERC721Enumerable`]] :IERC721Metadata: pass:normal[xref:token/ERC721.adoc#IERC721Metadata[`IERC721Metadata`]] :IERC777: pass:normal[xref:token/ERC777.adoc#IERC777[`IERC777`]] :IERC777Recipient: pass:normal[xref:token/ERC777.adoc#IERC777Recipient[`IERC777Recipient`]] :IERC777Sender: pass:normal[xref:token/ERC777.adoc#IERC777Sender[`IERC777Sender`]] :IERC1155: pass:normal[xref:token/ERC1155.adoc#IERC1155[`IERC1155`]] :IERC1155Receiver: pass:normal[xref:token/ERC1155.adoc#IERC1155Receiver[`IERC1155Receiver`]] :IERC1155MetadataURI: pass:normal[xref:token/ERC1155.adoc#IERC1155MetadataURI[`IERC1155MetadataURI`]] :IERC1271: pass:normal[xref:interfaces.adoc#IERC1271[`IERC1271`]] :IERC1363: pass:normal[xref:interfaces.adoc#IERC1363[`IERC1363`]] :IERC1820Implementer: pass:normal[xref:utils.adoc#IERC1820Implementer[`IERC1820Implementer`]] :IERC1820Registry: pass:normal[xref:utils.adoc#IERC1820Registry[`IERC1820Registry`]] :IERC1822Proxiable: pass:normal[xref:interfaces.adoc#IERC1822Proxiable[`IERC1822Proxiable`]] :IERC2612: pass:normal[xref:interfaces.adoc#IERC2612[`IERC2612`]] :IERC2981: pass:normal[xref:interfaces.adoc#IERC2981[`IERC2981`]] :IERC3156FlashLender: pass:normal[xref:interfaces.adoc#IERC3156FlashLender[`IERC3156FlashLender`]] :IERC3156FlashBorrower: pass:normal[xref:interfaces.adoc#IERC3156FlashBorrower[`IERC3156FlashBorrower`]] :IERC4626: pass:normal[xref:interfaces.adoc#IERC4626[`IERC4626`]] :xref-IERC1271-isValidSignature-bytes32-bytes-: xref:interfaces.adoc#IERC1271-isValidSignature-bytes32-bytes- :xref-IERC1363-transferAndCall-address-uint256-: xref:interfaces.adoc#IERC1363-transferAndCall-address-uint256- :xref-IERC1363-transferAndCall-address-uint256-bytes-: xref:interfaces.adoc#IERC1363-transferAndCall-address-uint256-bytes- :xref-IERC1363-transferFromAndCall-address-address-uint256-: xref:interfaces.adoc#IERC1363-transferFromAndCall-address-address-uint256- :xref-IERC1363-transferFromAndCall-address-address-uint256-bytes-: xref:interfaces.adoc#IERC1363-transferFromAndCall-address-address-uint256-bytes- :xref-IERC1363-approveAndCall-address-uint256-: xref:interfaces.adoc#IERC1363-approveAndCall-address-uint256- :xref-IERC1363-approveAndCall-address-uint256-bytes-: xref:interfaces.adoc#IERC1363-approveAndCall-address-uint256-bytes- :xref-IERC20-totalSupply--: xref:token/ERC20.adoc#IERC20-totalSupply-- :xref-IERC20-balanceOf-address-: xref:token/ERC20.adoc#IERC20-balanceOf-address- :xref-IERC20-transfer-address-uint256-: xref:token/ERC20.adoc#IERC20-transfer-address-uint256- :xref-IERC20-allowance-address-address-: xref:token/ERC20.adoc#IERC20-allowance-address-address- :xref-IERC20-approve-address-uint256-: xref:token/ERC20.adoc#IERC20-approve-address-uint256- :xref-IERC20-transferFrom-address-address-uint256-: xref:token/ERC20.adoc#IERC20-transferFrom-address-address-uint256- :xref-IERC165-supportsInterface-bytes4-: xref:utils.adoc#IERC165-supportsInterface-bytes4- :xref-IERC20-Transfer-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256- :xref-IERC20-Approval-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Approval-address-address-uint256- :xref-IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-: xref:interfaces.adoc#IERC1363Receiver-onTransferReceived-address-address-uint256-bytes- :xref-IERC1822Proxiable-proxiableUUID--: xref:interfaces.adoc#IERC1822Proxiable-proxiableUUID-- :xref-IERC20Permit-permit-address-address-uint256-uint256-uint8-bytes32-bytes32-: xref:token/ERC20.adoc#IERC20Permit-permit-address-address-uint256-uint256-uint8-bytes32-bytes32- :xref-IERC20Permit-nonces-address-: xref:token/ERC20.adoc#IERC20Permit-nonces-address- :xref-IERC20Permit-DOMAIN_SEPARATOR--: xref:token/ERC20.adoc#IERC20Permit-DOMAIN_SEPARATOR-- :xref-IERC2981-royaltyInfo-uint256-uint256-: xref:interfaces.adoc#IERC2981-royaltyInfo-uint256-uint256- :xref-IERC165-supportsInterface-bytes4-: xref:utils.adoc#IERC165-supportsInterface-bytes4- :xref-IERC3156FlashLender-maxFlashLoan-address-: xref:interfaces.adoc#IERC3156FlashLender-maxFlashLoan-address- :xref-IERC3156FlashLender-flashFee-address-uint256-: xref:interfaces.adoc#IERC3156FlashLender-flashFee-address-uint256- :xref-IERC3156FlashLender-flashLoan-contract-IERC3156FlashBorrower-address-uint256-bytes-: xref:interfaces.adoc#IERC3156FlashLender-flashLoan-contract-IERC3156FlashBorrower-address-uint256-bytes- :xref-IERC3156FlashBorrower-onFlashLoan-address-address-uint256-uint256-bytes-: xref:interfaces.adoc#IERC3156FlashBorrower-onFlashLoan-address-address-uint256-uint256-bytes- :xref-IERC4626-asset--: xref:interfaces.adoc#IERC4626-asset-- :xref-IERC4626-totalAssets--: xref:interfaces.adoc#IERC4626-totalAssets-- :xref-IERC4626-convertToShares-uint256-: xref:interfaces.adoc#IERC4626-convertToShares-uint256- :xref-IERC4626-convertToAssets-uint256-: xref:interfaces.adoc#IERC4626-convertToAssets-uint256- :xref-IERC4626-maxDeposit-address-: xref:interfaces.adoc#IERC4626-maxDeposit-address- :xref-IERC4626-previewDeposit-uint256-: xref:interfaces.adoc#IERC4626-previewDeposit-uint256- :xref-IERC4626-deposit-uint256-address-: xref:interfaces.adoc#IERC4626-deposit-uint256-address- :xref-IERC4626-maxMint-address-: xref:interfaces.adoc#IERC4626-maxMint-address- :xref-IERC4626-previewMint-uint256-: xref:interfaces.adoc#IERC4626-previewMint-uint256- :xref-IERC4626-mint-uint256-address-: xref:interfaces.adoc#IERC4626-mint-uint256-address- :xref-IERC4626-maxWithdraw-address-: xref:interfaces.adoc#IERC4626-maxWithdraw-address- :xref-IERC4626-previewWithdraw-uint256-: xref:interfaces.adoc#IERC4626-previewWithdraw-uint256- :xref-IERC4626-withdraw-uint256-address-address-: xref:interfaces.adoc#IERC4626-withdraw-uint256-address-address- :xref-IERC4626-maxRedeem-address-: xref:interfaces.adoc#IERC4626-maxRedeem-address- :xref-IERC4626-previewRedeem-uint256-: xref:interfaces.adoc#IERC4626-previewRedeem-uint256- :xref-IERC4626-redeem-uint256-address-address-: xref:interfaces.adoc#IERC4626-redeem-uint256-address-address- :xref-IERC20Metadata-name--: xref:token/ERC20.adoc#IERC20Metadata-name-- :xref-IERC20Metadata-symbol--: xref:token/ERC20.adoc#IERC20Metadata-symbol-- :xref-IERC20Metadata-decimals--: xref:token/ERC20.adoc#IERC20Metadata-decimals-- :xref-IERC20-totalSupply--: xref:token/ERC20.adoc#IERC20-totalSupply-- :xref-IERC20-balanceOf-address-: xref:token/ERC20.adoc#IERC20-balanceOf-address- :xref-IERC20-transfer-address-uint256-: xref:token/ERC20.adoc#IERC20-transfer-address-uint256- :xref-IERC20-allowance-address-address-: xref:token/ERC20.adoc#IERC20-allowance-address-address- :xref-IERC20-approve-address-uint256-: xref:token/ERC20.adoc#IERC20-approve-address-uint256- :xref-IERC20-transferFrom-address-address-uint256-: xref:token/ERC20.adoc#IERC20-transferFrom-address-address-uint256- :xref-IERC4626-Deposit-address-address-uint256-uint256-: xref:interfaces.adoc#IERC4626-Deposit-address-address-uint256-uint256- :xref-IERC4626-Withdraw-address-address-address-uint256-uint256-: xref:interfaces.adoc#IERC4626-Withdraw-address-address-address-uint256-uint256- :xref-IERC20-Transfer-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256- :xref-IERC20-Approval-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Approval-address-address-uint256- = Interfaces [.readme-notice] NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/interfaces == List of standardized interfaces These interfaces are available as `.sol` files, and also as compiler `.json` ABI files (through the npm package). These are useful to interact with third party contracts that implement them. - {IERC20} - {IERC20Metadata} - {IERC165} - {IERC721} - {IERC721Receiver} - {IERC721Enumerable} - {IERC721Metadata} - {IERC777} - {IERC777Recipient} - {IERC777Sender} - {IERC1155} - {IERC1155Receiver} - {IERC1155MetadataURI} - {IERC1271} - {IERC1363} - {IERC1820Implementer} - {IERC1820Registry} - {IERC1822Proxiable} - {IERC2612} - {IERC2981} - {IERC3156FlashLender} - {IERC3156FlashBorrower} - {IERC4626} == Detailed ABI :isValidSignature: pass:normal[xref:#IERC1271-isValidSignature-bytes32-bytes-[`++isValidSignature++`]] [.contract] [[IERC1271]] === `++IERC1271++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/IERC1271.sol[{github-icon},role=heading-link] [.hljs-theme-light.nopadding] ```solidity import "@openzeppelin/contracts/interfaces/IERC1271.sol"; ``` Interface of the ERC1271 standard signature validation method for contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271]. _Available since v4.1._ [.contract-index] .Functions -- * {xref-IERC1271-isValidSignature-bytes32-bytes-}[`++isValidSignature(hash, signature)++`] -- [.contract-item] [[IERC1271-isValidSignature-bytes32-bytes-]] ==== `[.contract-item-name]#++isValidSignature++#++(bytes32 hash, bytes signature) → bytes4 magicValue++` [.item-kind]#external# Should return whether the signature provided is valid for the provided data :transferAndCall: pass:normal[xref:#IERC1363-transferAndCall-address-uint256-[`++transferAndCall++`]] :transferAndCall: pass:normal[xref:#IERC1363-transferAndCall-address-uint256-bytes-[`++transferAndCall++`]] :transferFromAndCall: pass:normal[xref:#IERC1363-transferFromAndCall-address-address-uint256-[`++transferFromAndCall++`]] :transferFromAndCall: pass:normal[xref:#IERC1363-transferFromAndCall-address-address-uint256-bytes-[`++transferFromAndCall++`]] :approveAndCall: pass:normal[xref:#IERC1363-approveAndCall-address-uint256-[`++approveAndCall++`]] :approveAndCall: pass:normal[xref:#IERC1363-approveAndCall-address-uint256-bytes-[`++approveAndCall++`]] [.contract] [[IERC1363]] === `++IERC1363++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/IERC1363.sol[{github-icon},role=heading-link] [.hljs-theme-light.nopadding] ```solidity import "@openzeppelin/contracts/interfaces/IERC1363.sol"; ``` [.contract-index] .Functions -- * {xref-IERC1363-transferAndCall-address-uint256-}[`++transferAndCall(to, value)++`] * {xref-IERC1363-transferAndCall-address-uint256-bytes-}[`++transferAndCall(to, value, data)++`] * {xref-IERC1363-transferFromAndCall-address-address-uint256-}[`++transferFromAndCall(from, to, value)++`] * {xref-IERC1363-transferFromAndCall-address-address-uint256-bytes-}[`++transferFromAndCall(from, to, value, data)++`] * {xref-IERC1363-approveAndCall-address-uint256-}[`++approveAndCall(spender, value)++`] * {xref-IERC1363-approveAndCall-address-uint256-bytes-}[`++approveAndCall(spender, value, data)++`] [.contract-subindex-inherited] .IERC20 * {xref-IERC20-totalSupply--}[`++totalSupply()++`] * {xref-IERC20-balanceOf-address-}[`++balanceOf(account)++`] * {xref-IERC20-transfer-address-uint256-}[`++transfer(to, amount)++`] * {xref-IERC20-allowance-address-address-}[`++allowance(owner, spender)++`] * {xref-IERC20-approve-address-uint256-}[`++approve(spender, amount)++`] * {xref-IERC20-transferFrom-address-address-uint256-}[`++transferFrom(from, to, amount)++`] [.contract-subindex-inherited] .IERC165 * {xref-IERC165-supportsInterface-bytes4-}[`++supportsInterface(interfaceId)++`] -- [.contract-index] .Events -- [.contract-subindex-inherited] .IERC20 * {xref-IERC20-Transfer-address-address-uint256-}[`++Transfer(from, to, value)++`] * {xref-IERC20-Approval-address-address-uint256-}[`++Approval(owner, spender, value)++`] [.contract-subindex-inherited] .IERC165 -- [.contract-item] [[IERC1363-transferAndCall-address-uint256-]] ==== `[.contract-item-name]#++transferAndCall++#++(address to, uint256 value) → bool++` [.item-kind]#external# Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver [.contract-item] [[IERC1363-transferAndCall-address-uint256-bytes-]] ==== `[.contract-item-name]#++transferAndCall++#++(address to, uint256 value, bytes data) → bool++` [.item-kind]#external# Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver [.contract-item] [[IERC1363-transferFromAndCall-address-address-uint256-]] ==== `[.contract-item-name]#++transferFromAndCall++#++(address from, address to, uint256 value) → bool++` [.item-kind]#external# Transfer tokens from one address to another and then call `onTransferReceived` on receiver [.contract-item] [[IERC1363-transferFromAndCall-address-address-uint256-bytes-]] ==== `[.contract-item-name]#++transferFromAndCall++#++(address from, address to, uint256 value, bytes data) → bool++` [.item-kind]#external# Transfer tokens from one address to another and then call `onTransferReceived` on receiver [.contract-item] [[IERC1363-approveAndCall-address-uint256-]] ==== `[.contract-item-name]#++approveAndCall++#++(address spender, uint256 value) → bool++` [.item-kind]#external# Approve the passed address to spend the specified amount of tokens on behalf of msg.sender and then call `onApprovalReceived` on spender. [.contract-item] [[IERC1363-approveAndCall-address-uint256-bytes-]] ==== `[.contract-item-name]#++approveAndCall++#++(address spender, uint256 value, bytes data) → bool++` [.item-kind]#external# Approve the passed address to spend the specified amount of tokens on behalf of msg.sender and then call `onApprovalReceived` on spender. :onTransferReceived: pass:normal[xref:#IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-[`++onTransferReceived++`]] [.contract] [[IERC1363Receiver]] === `++IERC1363Receiver++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/IERC1363Receiver.sol[{github-icon},role=heading-link] [.hljs-theme-light.nopadding] ```solidity import "@openzeppelin/contracts/interfaces/IERC1363Receiver.sol"; ``` [.contract-index] .Functions -- * {xref-IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-}[`++onTransferReceived(operator, from, value, data)++`] -- [.contract-item] [[IERC1363Receiver-onTransferReceived-address-address-uint256-bytes-]] ==== `[.contract-item-name]#++onTransferReceived++#++(address operator, address from, uint256 value, bytes data) → bytes4++` [.item-kind]#external# Any ERC1363 smart contract calls this function on the recipient after a `transfer` or a `transferFrom`. This function MAY throw to revert and reject the transfer. Return of other than the magic value MUST result in the transaction being reverted. Note: the token contract address is always the message sender. :proxiableUUID: pass:normal[xref:#IERC1822Proxiable-proxiableUUID--[`++proxiableUUID++`]] [.contract] [[IERC1822Proxiable]] === `++IERC1822Proxiable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/draft-IERC1822.sol[{github-icon},role=heading-link] [.hljs-theme-light.nopadding] ```solidity import "@openzeppelin/contracts/interfaces/draft-IERC1822.sol"; ``` ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified proxy whose upgrades are fully controlled by the current implementation. [.contract-index] .Functions -- * {xref-IERC1822Proxiable-proxiableUUID--}[`++proxiableUUID()++`] -- [.contract-item] [[IERC1822Proxiable-proxiableUUID--]] ==== `[.contract-item-name]#++proxiableUUID++#++() → bytes32++` [.item-kind]#external# Returns the storage slot that the proxiable contract assumes is being used to store the implementation address. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. [.contract] [[IERC2612]] === `++IERC2612++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/draft-IERC2612.sol[{github-icon},role=heading-link] [.hljs-theme-light.nopadding] ```solidity import "@openzeppelin/contracts/interfaces/draft-IERC2612.sol"; ``` [.contract-index] .Functions -- [.contract-subindex-inherited] .IERC20Permit * {xref-IERC20Permit-permit-address-address-uint256-uint256-uint8-bytes32-bytes32-}[`++permit(owner, spender, value, deadline, v, r, s)++`] * {xref-IERC20Permit-nonces-address-}[`++nonces(owner)++`] * {xref-IERC20Permit-DOMAIN_SEPARATOR--}[`++DOMAIN_SEPARATOR()++`] -- :royaltyInfo: pass:normal[xref:#IERC2981-royaltyInfo-uint256-uint256-[`++royaltyInfo++`]] [.contract] [[IERC2981]] === `++IERC2981++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/IERC2981.sol[{github-icon},role=heading-link] [.hljs-theme-light.nopadding] ```solidity import "@openzeppelin/contracts/interfaces/IERC2981.sol"; ``` Interface for the NFT Royalty Standard. A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal support for royalty payments across all NFT marketplaces and ecosystem participants. _Available since v4.5._ [.contract-index] .Functions -- * {xref-IERC2981-royaltyInfo-uint256-uint256-}[`++royaltyInfo(tokenId, salePrice)++`] [.contract-subindex-inherited] .IERC165 * {xref-IERC165-supportsInterface-bytes4-}[`++supportsInterface(interfaceId)++`] -- [.contract-item] [[IERC2981-royaltyInfo-uint256-uint256-]] ==== `[.contract-item-name]#++royaltyInfo++#++(uint256 tokenId, uint256 salePrice) → address receiver, uint256 royaltyAmount++` [.item-kind]#external# Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of exchange. The royalty amount is denominated and should be paid in that same unit of exchange. :maxFlashLoan: pass:normal[xref:#IERC3156FlashLender-maxFlashLoan-address-[`++maxFlashLoan++`]] :flashFee: pass:normal[xref:#IERC3156FlashLender-flashFee-address-uint256-[`++flashFee++`]] :flashLoan: pass:normal[xref:#IERC3156FlashLender-flashLoan-contract-IERC3156FlashBorrower-address-uint256-bytes-[`++flashLoan++`]] [.contract] [[IERC3156FlashLender]] === `++IERC3156FlashLender++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/IERC3156FlashLender.sol[{github-icon},role=heading-link] [.hljs-theme-light.nopadding] ```solidity import "@openzeppelin/contracts/interfaces/IERC3156FlashLender.sol"; ``` Interface of the ERC3156 FlashLender, as defined in https://eips.ethereum.org/EIPS/eip-3156[ERC-3156]. _Available since v4.1._ [.contract-index] .Functions -- * {xref-IERC3156FlashLender-maxFlashLoan-address-}[`++maxFlashLoan(token)++`] * {xref-IERC3156FlashLender-flashFee-address-uint256-}[`++flashFee(token, amount)++`] * {xref-IERC3156FlashLender-flashLoan-contract-IERC3156FlashBorrower-address-uint256-bytes-}[`++flashLoan(receiver, token, amount, data)++`] -- [.contract-item] [[IERC3156FlashLender-maxFlashLoan-address-]] ==== `[.contract-item-name]#++maxFlashLoan++#++(address token) → uint256++` [.item-kind]#external# The amount of currency available to be lended. [.contract-item] [[IERC3156FlashLender-flashFee-address-uint256-]] ==== `[.contract-item-name]#++flashFee++#++(address token, uint256 amount) → uint256++` [.item-kind]#external# The fee to be charged for a given loan. [.contract-item] [[IERC3156FlashLender-flashLoan-contract-IERC3156FlashBorrower-address-uint256-bytes-]] ==== `[.contract-item-name]#++flashLoan++#++(contract IERC3156FlashBorrower receiver, address token, uint256 amount, bytes data) → bool++` [.item-kind]#external# Initiate a flash loan. :onFlashLoan: pass:normal[xref:#IERC3156FlashBorrower-onFlashLoan-address-address-uint256-uint256-bytes-[`++onFlashLoan++`]] [.contract] [[IERC3156FlashBorrower]] === `++IERC3156FlashBorrower++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/IERC3156FlashBorrower.sol[{github-icon},role=heading-link] [.hljs-theme-light.nopadding] ```solidity import "@openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol"; ``` Interface of the ERC3156 FlashBorrower, as defined in https://eips.ethereum.org/EIPS/eip-3156[ERC-3156]. _Available since v4.1._ [.contract-index] .Functions -- * {xref-IERC3156FlashBorrower-onFlashLoan-address-address-uint256-uint256-bytes-}[`++onFlashLoan(initiator, token, amount, fee, data)++`] -- [.contract-item] [[IERC3156FlashBorrower-onFlashLoan-address-address-uint256-uint256-bytes-]] ==== `[.contract-item-name]#++onFlashLoan++#++(address initiator, address token, uint256 amount, uint256 fee, bytes data) → bytes32++` [.item-kind]#external# Receive a flash loan. :Deposit: pass:normal[xref:#IERC4626-Deposit-address-address-uint256-uint256-[`++Deposit++`]] :Withdraw: pass:normal[xref:#IERC4626-Withdraw-address-address-address-uint256-uint256-[`++Withdraw++`]] :asset: pass:normal[xref:#IERC4626-asset--[`++asset++`]] :totalAssets: pass:normal[xref:#IERC4626-totalAssets--[`++totalAssets++`]] :convertToShares: pass:normal[xref:#IERC4626-convertToShares-uint256-[`++convertToShares++`]] :convertToAssets: pass:normal[xref:#IERC4626-convertToAssets-uint256-[`++convertToAssets++`]] :maxDeposit: pass:normal[xref:#IERC4626-maxDeposit-address-[`++maxDeposit++`]] :previewDeposit: pass:normal[xref:#IERC4626-previewDeposit-uint256-[`++previewDeposit++`]] :deposit: pass:normal[xref:#IERC4626-deposit-uint256-address-[`++deposit++`]] :maxMint: pass:normal[xref:#IERC4626-maxMint-address-[`++maxMint++`]] :previewMint: pass:normal[xref:#IERC4626-previewMint-uint256-[`++previewMint++`]] :mint: pass:normal[xref:#IERC4626-mint-uint256-address-[`++mint++`]] :maxWithdraw: pass:normal[xref:#IERC4626-maxWithdraw-address-[`++maxWithdraw++`]] :previewWithdraw: pass:normal[xref:#IERC4626-previewWithdraw-uint256-[`++previewWithdraw++`]] :withdraw: pass:normal[xref:#IERC4626-withdraw-uint256-address-address-[`++withdraw++`]] :maxRedeem: pass:normal[xref:#IERC4626-maxRedeem-address-[`++maxRedeem++`]] :previewRedeem: pass:normal[xref:#IERC4626-previewRedeem-uint256-[`++previewRedeem++`]] :redeem: pass:normal[xref:#IERC4626-redeem-uint256-address-address-[`++redeem++`]] [.contract] [[IERC4626]] === `++IERC4626++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/interfaces/IERC4626.sol[{github-icon},role=heading-link] [.hljs-theme-light.nopadding] ```solidity import "@openzeppelin/contracts/interfaces/IERC4626.sol"; ``` Interface of the ERC4626 "Tokenized Vault Standard", as defined in https://eips.ethereum.org/EIPS/eip-4626[ERC-4626]. _Available since v4.7._ [.contract-index] .Functions -- * {xref-IERC4626-asset--}[`++asset()++`] * {xref-IERC4626-totalAssets--}[`++totalAssets()++`] * {xref-IERC4626-convertToShares-uint256-}[`++convertToShares(assets)++`] * {xref-IERC4626-convertToAssets-uint256-}[`++convertToAssets(shares)++`] * {xref-IERC4626-maxDeposit-address-}[`++maxDeposit(receiver)++`] * {xref-IERC4626-previewDeposit-uint256-}[`++previewDeposit(assets)++`] * {xref-IERC4626-deposit-uint256-address-}[`++deposit(assets, receiver)++`] * {xref-IERC4626-maxMint-address-}[`++maxMint(receiver)++`] * {xref-IERC4626-previewMint-uint256-}[`++previewMint(shares)++`] * {xref-IERC4626-mint-uint256-address-}[`++mint(shares, receiver)++`] * {xref-IERC4626-maxWithdraw-address-}[`++maxWithdraw(owner)++`] * {xref-IERC4626-previewWithdraw-uint256-}[`++previewWithdraw(assets)++`] * {xref-IERC4626-withdraw-uint256-address-address-}[`++withdraw(assets, receiver, owner)++`] * {xref-IERC4626-maxRedeem-address-}[`++maxRedeem(owner)++`] * {xref-IERC4626-previewRedeem-uint256-}[`++previewRedeem(shares)++`] * {xref-IERC4626-redeem-uint256-address-address-}[`++redeem(shares, receiver, owner)++`] [.contract-subindex-inherited] .IERC20Metadata * {xref-IERC20Metadata-name--}[`++name()++`] * {xref-IERC20Metadata-symbol--}[`++symbol()++`] * {xref-IERC20Metadata-decimals--}[`++decimals()++`] [.contract-subindex-inherited] .IERC20 * {xref-IERC20-totalSupply--}[`++totalSupply()++`] * {xref-IERC20-balanceOf-address-}[`++balanceOf(account)++`] * {xref-IERC20-transfer-address-uint256-}[`++transfer(to, amount)++`] * {xref-IERC20-allowance-address-address-}[`++allowance(owner, spender)++`] * {xref-IERC20-approve-address-uint256-}[`++approve(spender, amount)++`] * {xref-IERC20-transferFrom-address-address-uint256-}[`++transferFrom(from, to, amount)++`] -- [.contract-index] .Events -- * {xref-IERC4626-Deposit-address-address-uint256-uint256-}[`++Deposit(sender, owner, assets, shares)++`] * {xref-IERC4626-Withdraw-address-address-address-uint256-uint256-}[`++Withdraw(sender, receiver, owner, assets, shares)++`] [.contract-subindex-inherited] .IERC20Metadata [.contract-subindex-inherited] .IERC20 * {xref-IERC20-Transfer-address-address-uint256-}[`++Transfer(from, to, value)++`] * {xref-IERC20-Approval-address-address-uint256-}[`++Approval(owner, spender, value)++`] -- [.contract-item] [[IERC4626-asset--]] ==== `[.contract-item-name]#++asset++#++() → address assetTokenAddress++` [.item-kind]#external# Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing. - MUST be an ERC-20 token contract. - MUST NOT revert. [.contract-item] [[IERC4626-totalAssets--]] ==== `[.contract-item-name]#++totalAssets++#++() → uint256 totalManagedAssets++` [.item-kind]#external# Returns the total amount of the underlying asset that is “managed” by Vault. - SHOULD include any compounding that occurs from yield. - MUST be inclusive of any fees that are charged against assets in the Vault. - MUST NOT revert. [.contract-item] [[IERC4626-convertToShares-uint256-]] ==== `[.contract-item-name]#++convertToShares++#++(uint256 assets) → uint256 shares++` [.item-kind]#external# Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal scenario where all the conditions are met. - MUST NOT be inclusive of any fees that are charged against assets in the Vault. - MUST NOT show any variations depending on the caller. - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. - MUST NOT revert. NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and from. [.contract-item] [[IERC4626-convertToAssets-uint256-]] ==== `[.contract-item-name]#++convertToAssets++#++(uint256 shares) → uint256 assets++` [.item-kind]#external# Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal scenario where all the conditions are met. - MUST NOT be inclusive of any fees that are charged against assets in the Vault. - MUST NOT show any variations depending on the caller. - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. - MUST NOT revert. NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and from. [.contract-item] [[IERC4626-maxDeposit-address-]] ==== `[.contract-item-name]#++maxDeposit++#++(address receiver) → uint256 maxAssets++` [.item-kind]#external# Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver, through a deposit call. - MUST return a limited value if receiver is subject to some deposit limit. - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited. - MUST NOT revert. [.contract-item] [[IERC4626-previewDeposit-uint256-]] ==== `[.contract-item-name]#++previewDeposit++#++(uint256 assets) → uint256 shares++` [.item-kind]#external# Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given current on-chain conditions. - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called in the same transaction. - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the deposit would be accepted, regardless if the user has enough tokens approved, etc. - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. - MUST NOT revert. NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by depositing. [.contract-item] [[IERC4626-deposit-uint256-address-]] ==== `[.contract-item-name]#++deposit++#++(uint256 assets, address receiver) → uint256 shares++` [.item-kind]#external# Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens. - MUST emit the Deposit event. - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the deposit execution, and are accounted for during deposit. - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc). NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. [.contract-item] [[IERC4626-maxMint-address-]] ==== `[.contract-item-name]#++maxMint++#++(address receiver) → uint256 maxShares++` [.item-kind]#external# Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call. - MUST return a limited value if receiver is subject to some mint limit. - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted. - MUST NOT revert. [.contract-item] [[IERC4626-previewMint-uint256-]] ==== `[.contract-item-name]#++previewMint++#++(uint256 shares) → uint256 assets++` [.item-kind]#external# Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given current on-chain conditions. - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the same transaction. - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint would be accepted, regardless if the user has enough tokens approved, etc. - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. - MUST NOT revert. NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by minting. [.contract-item] [[IERC4626-mint-uint256-address-]] ==== `[.contract-item-name]#++mint++#++(uint256 shares, address receiver) → uint256 assets++` [.item-kind]#external# Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens. - MUST emit the Deposit event. - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint execution, and are accounted for during mint. - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc). NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. [.contract-item] [[IERC4626-maxWithdraw-address-]] ==== `[.contract-item-name]#++maxWithdraw++#++(address owner) → uint256 maxAssets++` [.item-kind]#external# Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the Vault, through a withdraw call. - MUST return a limited value if owner is subject to some withdrawal limit or timelock. - MUST NOT revert. [.contract-item] [[IERC4626-previewWithdraw-uint256-]] ==== `[.contract-item-name]#++previewWithdraw++#++(uint256 assets) → uint256 shares++` [.item-kind]#external# Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, given current on-chain conditions. - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if called in the same transaction. - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though the withdrawal would be accepted, regardless if the user has enough shares, etc. - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. - MUST NOT revert. NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by depositing. [.contract-item] [[IERC4626-withdraw-uint256-address-address-]] ==== `[.contract-item-name]#++withdraw++#++(uint256 assets, address receiver, address owner) → uint256 shares++` [.item-kind]#external# Burns shares from owner and sends exactly assets of underlying tokens to receiver. - MUST emit the Withdraw event. - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the withdraw execution, and are accounted for during withdraw. - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc). Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately. [.contract-item] [[IERC4626-maxRedeem-address-]] ==== `[.contract-item-name]#++maxRedeem++#++(address owner) → uint256 maxShares++` [.item-kind]#external# Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, through a redeem call. - MUST return a limited value if owner is subject to some withdrawal limit or timelock. - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock. - MUST NOT revert. [.contract-item] [[IERC4626-previewRedeem-uint256-]] ==== `[.contract-item-name]#++previewRedeem++#++(uint256 shares) → uint256 assets++` [.item-kind]#external# Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, given current on-chain conditions. - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the same transaction. - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the redemption would be accepted, regardless if the user has enough shares, etc. - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. - MUST NOT revert. NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by redeeming. [.contract-item] [[IERC4626-redeem-uint256-address-address-]] ==== `[.contract-item-name]#++redeem++#++(uint256 shares, address receiver, address owner) → uint256 assets++` [.item-kind]#external# Burns exactly shares from owner and sends assets of underlying tokens to receiver. - MUST emit the Withdraw event. - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the redeem execution, and are accounted for during redeem. - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc). NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately. [.contract-item] [[IERC4626-Deposit-address-address-uint256-uint256-]] ==== `[.contract-item-name]#++Deposit++#++(address indexed sender, address indexed owner, uint256 assets, uint256 shares)++` [.item-kind]#event# [.contract-item] [[IERC4626-Withdraw-address-address-address-uint256-uint256-]] ==== `[.contract-item-name]#++Withdraw++#++(address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares)++` [.item-kind]#event#