FlashLoan
Introduction
There are numerous ways to grow profit by participating in the DeFi ecosystem. However, most opportunities such as staking, loan arbitrage, and liquidation are limited to the amount of capital one initially has. But now, there is another opportunity in DeFi that allow users to utilize their capital without limits using flash loans, opening up new financial strategies never imagined before.
BiFi offers both flash loans and traditional lending. Flash loans allow users to trade with leverage without any collateral as long as it executes both the borrowing and the repayment of loans in one block transaction. Maximize your profits and pursue a myriad of strategies you were unable to before with BiFi FlashLoan.
You can use BiFi FlashLoans in two ways:
BIFI-X: As an extension of BiFi, users are able to use BiFi FlashLoan most effectively through yield farming or long/short position strategies. BiFi's flash loans allow users to leverage their capital, completing both the borrowing and loan repayment in a single transaction.
Direct use: One groundbreaking feature of BiFi FlashLoan is that users can borrow uncollateralized loans. However, this is only possible through developing smart contracts. BiFi-X automates this arduous process, but in order to use BiFi FlashLoan, users need to be able to develop smart contracts.
In addition, users must pay fees to use BiFi FlashLoan. However, users who hold BiFi tokens will receive discount in fees according to the amount they hold (BiFi tokens can be earned as a reward from using the BiFi lending platform). Learn how to calculate BiFi FlashLoan fee below.
Calculating FlashLoan Fee
BiFi FlashLoan Fee is calculated according to a fixed rate (feeRate) of the loan. If the user owns BiFi tokens, a discount rate is applied to the fee according to the number of tokens.
FlashLoan Fee Calculation Formula
discountRate
: The final discount rate. It is changed according to the number of user's BiFi tokens(bifiAmount
). The more you have, the higher the discount rate. (maximumdiscountBase
)feeRate
: Basic rate of BiFi FlashLoan fee
Using BiFi FlashLoan
BiFi X Service
BiFi-X platform is where you can use the BiFi FlashLoan service the most effectively. Maximize your profits by leveraging your own capital with BiFi FlashLoan.
Direct Usage Of Smart Contracts
BiFi FlashLoan service is provided by the interaction between the FlashLoan Receiver Contract created by the user and the FlashLoan Contract, which provides a FlashLoan service using the BiFi token pool.
FlashLoan Contract: This is a system contract that provides the liquidity of BiFi FlashLoan upon request from users using the liquidity of BiFi.
FlashLoanReceiver Contract: Functions as a Smart Wallet to receive a loan from BiFi FlashLoan and perform tasks. Users should request a FlashLoan by using the
flashloan()
function provided by the FlashLoan Contract and implement their tasks in theexecuteOperation()
function. ThisexecuteOperation()
function must follow the strict rule of repaying the loan with a fee after the users pursue their needs.
Flashloan Template Tutorial
🍴Testing Kits: 🧑🍳flashloan-cooking
⌨️Template Solidity Code: 📁Template Code
Preparation of FlashLoan
The user deploys the
FlashloanReceiver
contract with the FlashLoan contract address as an imput value.User
sends coins equal to FlashLoan Fee toFlashLoanReceiver
Contract.
Steps to launch FlashLoan
User calls the
flashloan
function of theFlashLoanReceiver
Contract.FlashLoanReceiver
Contract calls theflashloan
function ofFlashLoan
Contract.FlashLoan
Contract callsexecuteFlashloan
ofHandlerProxy
Contract to request execution of flashLoan.The
HandlerProxy
Contract sends tokens to theFlashLoanReceiver
Contract equal to the amount of requested FlashLoan.FlashLoan
Contract calls theexecuteOperation
function ofFlashLoanReceiver
.After executing the user-defined logic, the
FlashLoanReceiver
Contract performs Repay as much as the sum of theamount
andfee
, the imput value of step (5).
Appendix: Contract Information
The FlashLoan Contract information to use the FlashLoan service is as follows.
FlashLoan Contract List
Address
Chain
ETHEREUM
BINANCE
The list of tokens and HandlerIDs that can be loaned within the FlashLoan service are as follows.
HandlerID List
HandlerID
Name
Address
Chain
0
ETHER
X
ETHEREUM
1
USDT
0xdac17f958d2ee523a2206206994597c13d831ec7
ETHEREUM
2
DAI
0x6b175474e89094c44da98b954eedeac495271d0f
ETHEREUM
3
LINK
0x514910771af9ca656af840dff83e8264ecf986ca
ETHEREUM
4
USDC
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
ETHEREUM
5
WBTC
0x2260fac5e5542a773aa44fbcfedf7c193bc2c599
ETHEREUM
0
BNB
X
BINANCE
1
ETHER
0xf86d8218BCC15874f5D25c191FdDd43F2334c3EB
BINANCE
2
USDT
0x2A29598cbc17BA112C8Fd0E07Fbf5402eF57E6b8
BINANCE
3
DAI
0xB67C5433d234d656002f12664d15ab4b40666D9B
BINANCE
4
USDC
0xBA9De5a8FD91408826616f2d6d7470A11E34c9F0
BINANCE
5
BTCB
0x26d0E4707af1c1DAAd8e9BA21b99cDa7Fd24c40B
BINANCE
6
BUSD
0x829ED2a2BeF8b72e648f92CBF01587C7E12e8c1e
BINANCE
Last updated