> For the complete documentation index, see [llms.txt](https://naviprotocol.gitbook.io/navi-protocol-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://naviprotocol.gitbook.io/navi-protocol-docs/~/revisions/U2pBja6jMjj75mDWWNRp/protocol-mechanics/flash-loan.md).

# Flash Loan

<figure><img src="/files/9GN2iK2AFadjjFkVg2ty" alt=""><figcaption></figcaption></figure>

NAVI Flash Loans are an innovative financial tool exclusive to the blockchain domain, enabling users to borrow assets without providing upfront collateral. These loans, also known as **One-Block Borrows**, must be initiated and fully settled within the same blockchain block. Their success relies on the execution of predefined conditions within this strict timeframe.

### Overview

Flash loans allow users to access liquidity from a pool for a single transaction, either by:

* Borrowing and repaying the loan plus fees immediately, or
* Opening a debt position if permitted by the pool.

NAVI Protocol offers two options for flash loans:

* `flashloan`:
  * Liquidity is borrowed from the pool.
  * Both the borrowed funds and the debt receipt are sent to the address that initiates the transaction.
* `flashloan_with_AccountCap`:
  * Borrowed funds are sent to a predefined account cap address, while the debt receipt is sent to the transaction initializer.
  * The initializer must destroy the receipt by the end of the block for the transaction to succeed.

### Flash Loan Config

* Availability: Enabled for all pools, with initial borrowing caps per pool.
* Fees:
  * Liquidity Providers (LPs): 0%
  * Protocol Treasury: 0.2% (temporarily reduced to 0.06% to encourage developers)
* Adjustments: NAVI regularly evaluates risk and may update borrowing limits.
* Reference: Live fees and pool parameters can be found in [SDK docs](https://sdk.naviprotocol.io/lending/flashloan).

| Pool    | Fee to LP | Fee to Treasury                                | Max Borrow | Min Borrow |
| ------- | --------- | ---------------------------------------------- | ---------- | ---------- |
| Sui     | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 3,000,000  | 0          |
| vSUI    | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 3,000,000  | 0          |
| haSui   | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 2,000,000  | 0          |
| wUSDC   | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 5,000,000  | 0          |
| nUSDC   | 0%        | ~~0.2%~~ <mark style="color:red;">0</mark>%    | 10,000,000 | 0          |
| USDT    | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 5,000,000  | 0          |
| USDY    | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 1,000,000  | 0          |
| AUSD    | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 1,000,000  | 0          |
| suiETH  | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 1,000      | 0          |
| wETH    | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 500        | 0          |
| NAVX    | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 5,000,000  | 0          |
| CETUS   | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 5,000,000  | 0          |
| FDUSD   | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 2,000,000  | 0          |
| wBTC    | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 10         | 0          |
| NS      | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 5,000,000  | 0          |
| DEEP    | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 5,000,000  | 0          |
| BUCK    | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 5,000,000  | 0          |
| suiUSDT | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 5,000,000  | 0          |
| BLUE    | 0%        | ~~0.2%~~ <mark style="color:red;">0.06</mark>% | 2,000,000  | 0          |

### Execution Flow

For SUI developers, a helpful model to consider when developing your solution:

1. Initialize all the parameters required in a [PTB (Programmable Transaction Block)](https://docs.sui.io/guides/developer/sui-101/building-ptb)
2. Your contract calls the `pool::lending::flash_loan_with_ctx`

   &#x20;contract, requesting a Flash Loan of a certain `amount(s)` of `pool(s)`
3. After some sanity checks, the `Lending Contract` transfers the requested `amounts` of the `coins` to your contract, then issue receipt to `receiver` address.
4. Your contract, now holding the flash loaned `amount(s)`, executes any arbitrary operation in the ptb.
5. Call `pool::lending::flash_repay_with_ctx` and send the borrowed money plus fee as an object to the contract.

> All steps occur within a single PTB transaction, i.e., a single SUI block.

### Getting Started

You may refer [NAVI-Developer Doc](https://naviprotocol.gitbook.io/navi-protocol-developer-docs/) or [navi-sdk](https://naviprotocol.gitbook.io/navi-protocol-developer-docs/how-to-interact-with-the-contract/navi-sdk) for efficient development
