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
The list of tokens and HandlerIDs that can be loaned within the FlashLoan service are as follows.
HandlerID List
Last updated