Flash Loans
Flash Loans are special un-collateralized loans that allow the borrowing of an NFT asset, as long as the borrowed NFT is returned before the end of the transaction. There is no real world analogy to Flash Loans, so it requires some basic understanding of how state is managed within blocks in blockchains.
Flash Loans are an advanced concept aimed at developers. You must have a good understanding of Ethereum, programming, and smart contracts to take advantage of them.
Overview
For developers, a helpful mental model to consider when developing your solution:
Your contract calls the BoundNFT contract, requesting a Flash Loan of a certain tokens of NFTs using flashLoan().
After some sanity checks, the BoundNFT transfers the requested amounts of the NFTs to your contract, then calls executeOperation() on your contract (or another contract that you specify as the _receiver).
Your contract, now holding the flash loaned NFTs, executes any arbitrary operation in its code.
If you are performing a 'traditional' flash loan, then when your code has finished, you transfer the flash loaned amounts of reserves back to the BoundNFT.
The BoundNFT contract updates the relevant details of the NFTs and pulls the flash loaned NFT + fee. If the NFT owing is not available (due to a lack of token or approval), then the transaction is reverted.
All of the above happens in 1 transaction (hence in a single Ethereum block).
Applications of Flash Loans
BoundNFT Flash Loans are already used extensively with Bend for swapping and/or migrating positions.
Other examples in the wild include:
Airdop for holders who's NFTs have been used as collateral.
Other examples and ideas are listed on our blog here and here.
Last updated