Flash Loan

Navi Flash Loans are an advanced financial instrument unique to the blockchain realm, offering a powerful mechanism for borrowing assets without requiring collateral upfront. These transactions must be initiated and settled within the same block(also known as One Block Borrows), making them highly temporal and reliant on the execution of predefined conditions.

Overview

With a flash loan, users can access the pool's liquidity for a single transaction—but only for reserves for which borrowing is permitted—as long as the money borrowed plus the associated fee is returned or, if permitted, a debt position is opened by the end of the transaction.

Navi offers two options for flash loans:

  • flashloan: This type of flash loan allows users to borrow liquidity from pools above, both the money borrowed and debt receipt will be sent to the address who start the transaction.

  • flashloan_with_AccountCap: This type of flash loan allows users to borrow liquidity from pools above, but the money borrowed will be sent to the account cap address and debt receipt will be sent to the address who start the transaction. Transaction initializer must destroy the receipt at end of the block to make this transaction happen.

Flash Loan Config

Pool
Fee to LP
Fee to Treasury
Max Borrow
Min Borrow

Sui

0%

0.2% 0.06%

200,000

0

USDC

0%

0.2% 0.06%

300,000

0

USDT

0%

0.2% 0.06%

300,000

0

vSUI

0%

0.2% 0.06%

100,000

0

Currently, FlashLoan is activated for only the four specified pools, with an initial maximum borrow limit. The fee for using a flashloan is apportioned between the liquidity providers (LPs) and the protocol's treasury, represented by Fee to LP and Fee to Protocol.

Initially, the fee allocated to the treasury upon deployment is set at 0.2%. However, the NAVI Foundation has decided to reduced the fee to just 0.06% for the first two months for onboarding more developers.. To find the current fee, refer to the AssetConfig.

Moreover, we plan to regularly assess risks and consider raising the maximum borrow limit in the future.

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)

  2. Your contract calls the pool::lending::flash_loan_with_ctx

    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.

  6. All of the above happens in 1 ptb transaction (hence in a single sui block).

Getting Started

You may refer Navi-Developer Doc or navi-sdk for efficient development

Last updated