Interfaces

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 usefull to interract with third party contracts that implement them.

Detailed ABI

IERC1271

import "@openzeppelin/contracts/interfaces/IERC1271.sol";

Interface of the ERC1271 standard signature validation method for contracts as defined in ERC-1271.

Available since v4.1.

isValidSignature(bytes32 hash, bytes signature) → bytes4 magicValue external

Should return whether the signature provided is valid for the provided data

IERC1363

import "@openzeppelin/contracts/interfaces/IERC1363.sol";

transferAndCall(address to, uint256 value) → bool external

Transfer tokens from msg.sender to another address and then call onTransferReceived on receiver

transferAndCall(address to, uint256 value, bytes data) → bool external

Transfer tokens from msg.sender to another address and then call onTransferReceived on receiver

transferFromAndCall(address from, address to, uint256 value) → bool external

Transfer tokens from one address to another and then call onTransferReceived on receiver

transferFromAndCall(address from, address to, uint256 value, bytes data) → bool external

Transfer tokens from one address to another and then call onTransferReceived on receiver

approveAndCall(address spender, uint256 value) → bool external

Approve the passed address to spend the specified amount of tokens on behalf of msg.sender and then call onApprovalReceived on spender.

approveAndCall(address spender, uint256 value, bytes data) → bool external

Approve the passed address to spend the specified amount of tokens on behalf of msg.sender and then call onApprovalReceived on spender.

IERC1363Receiver

import "@openzeppelin/contracts/interfaces/IERC1363Receiver.sol";

onTransferReceived(address operator, address from, uint256 value, bytes data) → bytes4 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.

IERC2612

import "@openzeppelin/contracts/interfaces/draft-IERC2612.sol";

IERC2981

import "@openzeppelin/contracts/interfaces/IERC2981.sol";

Interface for the NFT Royalty Standard

royaltyInfo(uint256 tokenId, uint256 salePrice) → address receiver, uint256 royaltyAmount external

Called with the sale price to determine how much royalty is owed and to whom.

IERC3156FlashLender

import "@openzeppelin/contracts/interfaces/IERC3156FlashLender.sol";

Interface of the ERC3156 FlashLender, as defined in ERC-3156.

Available since v4.1.

maxFlashLoan(address token) → uint256 external

The amount of currency available to be lended.

flashFee(address token, uint256 amount) → uint256 external

The fee to be charged for a given loan.

flashLoan(contract IERC3156FlashBorrower receiver, address token, uint256 amount, bytes data) → bool external

Initiate a flash loan.

IERC3156FlashBorrower

import "@openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol";

Interface of the ERC3156 FlashBorrower, as defined in ERC-3156.

Available since v4.1.

onFlashLoan(address initiator, address token, uint256 amount, uint256 fee, bytes data) → bytes32 external

Receive a flash loan.