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.
- 1.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.
- 2.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.
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.
// calculate fee
discountRate = 0.1 + 0.9 * min(1, discountBase / bifiAmount)
FlashLoan Fee = flashLoanAmount * feeRate * discountRate
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. (maximum
feeRate: Basic rate of BiFi FlashLoan fee
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.
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 the
executeOperation()function must follow the strict rule of repaying the loan with a fee after the users pursue their needs.
Flashloan Template Tutorial
- 1.The user deploys the
FlashloanReceivercontract with the FlashLoan contract address as an imput value.// _managerAddr : FlashLoan contract addressconstructor(address _managerAddr)
Usersends coins equal to FlashLoan Fee to
- 1.User calls the
flashloanfunction of the
FlashLoanReceiverContract.// handlerID : ID of handler to borrow asset via Flashloan// amount : Amount of cryptocurrencies to be lended by Flashloan**// The standard of amount is unifiedAmount(10**18), not Decimal of each token.**// params : Encoded parameters to pass to Flashloan's executeOperation function터function flashloan(uint256 handlerID, uint256 amount, bytes calldata params)
FlashLoanReceiverContract calls the
FlashLoanContract.// handlerID, amount, params :Factors passed in step (1)// receiverAddress: Address to recieve flashLoanfunction flashloan(uint256 handlerID, address receiverAddress, uint256 amount, bytes calldata params) external returns (bool)
HandlerProxyContract to request execution of flashLoan.
HandlerProxyContract sends tokens to the
FlashLoanReceiverContract equal to the amount of requested FlashLoan.
FlashLoanContract calls the
FlashLoanReceiver.// reserve****:**** Address of asset (Token) borrowed through Flashloan// amount: Number of assets (cryptocurrenices) borrowed through Flashloan// fee: Number of fees of Flashloan// params: Encoded parameters passed through the flashloan functionfunction executeOperation(address reserve, uint256 amount, uint256 fee, bytes calldata params)
- 6.After executing the user-defined logic, the
FlashLoanReceiverContract performs Repay as much as the sum of the
fee, the imput value of step (5).
The FlashLoan Contract information to use the FlashLoan service is as follows.
The list of tokens and HandlerIDs that can be loaned within the FlashLoan service are as follows.