Skip to content
LogoLogo

Interfaces

std/interfaces declares the common standards as interfaces, for typed query and defer against other contracts, for exposing a module's externals with use M exposing, and for announcing them with supports. Each interface is exactly its standard's functions, so its ERC-165 id is the standard's. Interfaces for part of a module's externals, such as IERC20Views or IOwnable, are declared next to the module, not here. The ERC-20, ERC-721, and ERC-1155 files also declare the errors of ERC-6093 that OpenZeppelin, and the standard library's tokens, raise, and the ERC-6909 file declares OpenZeppelin's ERC6909 errors.

import "std/evm";
import "std/interfaces/erc20";
 
error TooLittle of uint;
 
storage is record {
  token : IERC20;
}
 
external function pay(const to : address; const amount : uint)
  raises TooLittle
is {
  const balance : uint := query storage.token.balanceOf(Evm.self());
  assert(balance >= amount, TooLittle(balance));
  defer storage.token.transfer(to, amount);
}
FileInterfaces
std/interfaces/erc165.litheIERC165
std/interfaces/erc20.litheIERC20, IERC20Metadata, IERC20Permit
std/interfaces/erc721.litheIERC721, IERC721Metadata, IERC721Enumerable, IERC721Receiver
std/interfaces/erc1155.litheIERC1155, IERC1155MetadataURI, IERC1155Receiver
std/interfaces/erc6909.litheIERC6909, IERC6909Metadata, IERC6909ContentURI, IERC6909TokenSupply
std/interfaces/erc1271.litheIERC1271
std/interfaces/erc2981.litheIERC2981
std/interfaces/erc3156.litheIERC3156FlashLender, IERC3156FlashBorrower
std/interfaces/erc5805.litheIERC6372, IVotes
std/interfaces/erc5267.litheIERC5267, and its result type EIP712Domain
std/interfaces/erc4626.litheIERC4626
std/interfaces/erc7821.litheIERC7821