ERC20FlashMint
Inherits: IERC20FlashMint
Title: ERC20FlashMint
Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20FlashMint.sol)
Stateless Diamond facet — ERC-3156 flash loans at the token level (the token mints itself as the loan).
Pure delegator to ERC20FlashMintLib. Default fee is 0 (burned). A supply cap (ERC20Capped) is not
reflected by maxFlashLoan — pair with a cap-aware flash-mint library if that composition is needed.
Notes:
- lattice-version: 0.1.0
- lattice-source: OpenZeppelin v5.6.1
Functions
maxFlashLoan
The amount of currency available to be lent.
function maxFlashLoan(address token) public view virtual returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| token | address | The loan currency. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 | The amount of token that can be borrowed. |
flashFee
The fee to be charged for a given loan.
function flashFee(address token, uint256 value) public view virtual returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| token | address | The loan currency. |
| value | uint256 | The amount of tokens lent. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 | The amount of token to be charged for the loan, on top of the returned principal. |
flashLoan
Initiate a flash loan.
function flashLoan(IERC3156FlashBorrower receiver, address token, uint256 value, bytes calldata data)
public
virtual
returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| receiver | IERC3156FlashBorrower | The receiver of the tokens in the loan, and the receiver of the callback. |
| token | address | The loan currency. |
| value | uint256 | The amount of tokens lent. |
| data | bytes | Arbitrary data structure, intended to contain user-defined parameters. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
exportSelectors
ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).
Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches
forge inspect ERC20FlashMint methodIdentifiers (alphabetical by signature); kept in exact parity by
ExportSelectorsParityTest. Chunks:
flashFee(address,uint256) 0xd9d98ce4
flashLoan(address,address,uint256,bytes) 0x5cffe9de
maxFlashLoan(address) 0x613255ab
function exportSelectors() external pure virtual returns (bytes memory selectors);Returns
| Name | Type | Description |
|---|---|---|
| selectors | bytes |