LogoLogo
  • Overview
  • Learn
    • Lend
    • Borrow
    • Interest Rate
    • Liquidate
    • Flash Loans
    • NEPT Token
    • Risks
  • Develop
    • Contracts
      • Market
      • Interest Model
      • Token
      • Oracle
      • Querier
      • Flashloan Reciever
      • nToken
    • Token Addresses
  • User Guides
    • How to Lend on Neptune
    • How to Borrow on Neptune
    • How to Stake with the Neptune Validator
    • How to bridge TIA to Injective
  • Socials and Media
  • Audits
Powered by GitBook
On this page
  • How Flash Loans Work
  • Accessing Flashloans
  • Flash Loan Components
  • Borrowing and Fees
  • Flash Loan Receiver
  • Common Use Cases
  • Safety Mechanisms
  1. Learn

Flash Loans

Flash loans in the Neptune Protocol allow users to borrow assets without collateral, as long as the borrowed amount is returned within the same transaction. This powerful feature enables sophisticated trading strategies, arbitrage opportunities, and efficient debt refinancing.

How Flash Loans Work

When executing a flash loan, the protocol:

  1. Lends the requested assets to the borrower

  2. Executes the borrower's specified series of operations

  3. Verifies the borrowed amount plus fees are returned

  4. Completes or reverts the entire transaction

All of these steps occur atomically - either all succeed together, or the entire transaction is rolled back, ensuring the protocol's safety.

Accessing Flashloans

Flashloan access in Neptune in gated by NEPT token staking, where the amount and value of your NEPT token stake determines the amount of value a user can Flashloan from the protocol.

For a users to be able to access Flashloans from the Neptune protocol, they must first stake NEPT into staking pool 3. The amount of NEPT staked to this pool, and the market value of NEPT is used in conjunction with the Flasloan Multiplier to determine the maximum value the user can utilise in a single Flashloan process.

This token gating feature was introduced to mitigate against misuse of Flashloans. Where in the past Flashloans have been utilized in malicious trading strategies to exploit vulnerabilities in third party protocols. Having to stake NEPT to first access Flashloans, requires the user to put up their own capital, increasing the cost of malicious behaviour and a potential loss to the user if protocol governance determines they are a bad actor.

Flash Loan Components

Borrowing and Fees

Flash loans in Neptune incur a small fee (typically 0.1%) on the borrowed amount. The total repayment amount is calculated as:

Repayment Amount=Borrowed Amount×(1+Flash Loan Fee)\text{Repayment Amount} = \text{Borrowed Amount} \times (1 + \text{Flash Loan Fee})Repayment Amount=Borrowed Amount×(1+Flash Loan Fee)

Flash Loan Receiver

The Flash Loan Receiver contract acts as an intermediary that:

  • Receives the borrowed funds

  • Executes the user's specified operations

  • Ensures proper repayment

  • Handles any remaining asset management

Common Use Cases

Flash loans enable several powerful strategies:

  1. Arbitrage

    • Exploit price differences across exchanges

    • Execute trades with zero initial capital

    • Return loan plus fees from arbitrage profits

  2. Collateral Swaps

    • Refinance existing loans

    • Switch collateral types efficiently

    • Optimize borrowing positions

  3. Liquidations

    • Access capital for liquidation opportunities

    • Execute liquidations without holding reserves

    • Profit from discounted collateral sales

Safety Mechanisms

Neptune's flash loans incorporate several safety features:

  1. Atomic Execution

    • All operations must succeed, or everything reverts

    • No partial execution possible

    • Protocol assets always protected

  2. Validation Checks

    • Verification of full repayment

    • Fee calculation and collection

    • Asset balance reconciliation

  3. Access Controls

    • Whitelisted receiver contracts

    • Validated operation sequences

    • Protected callback functions

PreviousLiquidateNextNEPT Token

Last updated 2 months ago