ERC-3156: Flash Loan Standard
ERC-3156 standardises uncollateralized atomic loans: a borrower receives any amount, executes arbitrary logic in a callback, and must return the principal + fee before the transaction ends. If the callback fails to repay, the entire transaction reverts and the loan never happened.
Lender Interface
function maxFlashLoan(address token) external view returns (uint256);
function flashFee(address token, uint256 amount) external view returns (uint256);
function flashLoan(IERC3156FlashBorrower receiver, address token,
uint256 amount, bytes calldata data) external returns (bool);Borrower Interface
function onFlashLoan(address initiator, address token, uint256 amount,
uint256 fee, bytes calldata data)
external returns (bytes32); // returns keccak256("ERC3156FlashBorrower.onFlashLoan")Neo Equivalent
Neo flash loans work identically — atomic transactions ensure repay-or-revert. The "magic return value" pattern translates one-for-one. The Neo port below uses NEP-17 transfers and a callback method name onFlashLoan that borrowers implement.
Live on Neo TestNet
Both implementations deployed on Neo N3 TestNet.
| Implementation | TestNet Address | Contract Hash |
|---|---|---|
Solidity (neo-solc) | NhSy8SUwdRdrYAvK2YadgbXZwRTfJZC6DT | 0xb7d5cd14…117d37ec |
Neo C# (nccs) | NSogFgSB3xhbRn81ie21Xb8L5vzxAguyZZ | 0xa82c8142…1440984b |
Verified: pre-setup state (feeBps == 0). Both implementations enforce the ERC-3156 callback magic value (keccak256("ERC3156FlashBorrower.onFlashLoan")) on repay. docs/standards-mirror/deployments/erc-3156/.
