How do I borrow a flash loan?
Last updated
Last updated
Mainnet smart contract addresses are listed in the Smart Contracts guide
This guide demonstrates how to borrow a flash loan from Equalizer Vaults in a few simple steps. For the demo purpose, we deployed a simple Flash Borrower Example smart contract on the Rinkeby Testnet. Do NOT send mainnet tokens to these smart contracts as they will be lost!
Flash Borrower Example doesn't perform any business logic. We invite you to build your own trading logic using Equalizer Flash loans.
For this example you need
Metamask browser wallet
Rinkeby ETH you can get via Rinkeby Faucet
Open the Flash Loan Provider Flash loan provider is a smart contract developed by Equalizer that enables you to borrow flash loans. You can inspect on Etherscan the Flash Loan Provider:
Connect your wallet Connect your wallet by clicking on Connect to Web3 and select one of the supported wallets (in our example, Metamask)
A wallet window will open and prompt you to connect with your wallet.
Borrow a flash loan Now you can borrow a flash loan. Click on the flashLoan function so you will be able to enter the function parameters.
In the table below, we explain the arguments and provide some example inputs you can test. All fields are mandatory.
Click on Write that will open your wallet and prompt you to sign the transaction. After the transaction is successfully processed, you can inspect the transaction. Example: https://rinkeby.etherscan.io/tx/0xc05e3a4dd0c59aa4de055e8f8f727eaa1f6da1a0c21f2b42fd427a479553b561
Congratulations, you just
borrowed 0.1 USDT from the Equalizer Vaults
Returned 0.1 USDT with 0.05% fee
Below we present the Flash Borrower Example smart contract used in the example. The smart contract only borrows and returns funds. Business logic must be provided by the user.
Argument
Description
Example
receiver
Address of the smart contract that will borrow and return a flash loan.
0x5b4b021d2abcf6116d782884bc5cd414027aeff2
(pre-deployed FlashBorrower Example)
token
The token address we want to borrow. In the example, you can find the USDT test token address.
0xbE6C02195A28d163A1DF2e05B0596416d326b190
amount
Amount of tokens we want to borrow. Note that USDT has 6 decimal places.
100000
data
Input data for the Flash Borrower smart contract.
0x00