Flash Loans
Developer Guide

Introduction to Flash Loans

Flash Loans let you borrow assets instantly, no collateral needed! The only catch? You have to pay it back with a small fee, all within the same transaction—inside a single blockchain block.


If you don’t manage to repay in time, no worries—the entire transaction is canceled/reverted to initial state as if it never happened. This powerful tool is designed for developers who are well-versed in the Ethereum Virtual Machine (EVM) and smart contracts.


How Flash Loans Work

Flash loans operate within a single blockchain transaction. Here's how it works step by step:


  • • Your smart contract requests a loan from the RapidLoansCore contract which pulls funds from the liquidity pool, specifying the asset and amount.
  • • The Pool transfers the requested asset to your contract after performing some checks.
  • • Your contract can now use the loaned funds for any operation, such as arbitrage or liquidation.
  • • After your operation is complete, you must repay the loan with a fee back to the Pool.
  • • If you fail to repay, the entire transaction is reverted to the initial state.

Execution Flow

Here's your ultimate step-by-step roadmap to mastering flash loans on Rapid Loan!


  • • Kick things off by creating your own contract and inheriting from IReceiverContract, which you'll find in the RapidLoans GitHub repository. This is your starting point to tap into the Rapid Loans magic.flash loans
  • • Next, you'll need to interact with the RapidLoansCore contract. For that, you need to take in RapidLoansCore address and IRapidLoansCore interface which is present in address book and RapidLoans/contracts repo.flash loans
  • • Call the requestTRXRapidLoan function on the core contract, specifying the amount of TRX you want to borrow. The core contract will transfer the requested assets to your contract, allowing you to use the loaned funds.flash loans
  • • Now for the fun part! Inside the executeTRXRapidLoan function, you'll use the loaned funds to perform any logic you want—arbitrage, liquidation, you name it. Just don't forget to repay the loan, plus the fee.flash loans
  • • Checkout a Subject contract, available in the RapidLoans/contracts repo too, that is an example of a customer contract using RapidLoans to perform arbitrage. You can also try it yourself on the TronIde Here.

  • • The process for JST is the same, just swap out TRX functions for JST ones. We highly recommend giving it a test run on the TRON IDE before taking it on-chain.

  • • Get the interfaces from github repo, link given in navbar dropdown.