β‘Flash Loan
Developer documentation on how to utilize CROSS for flash loan utility
Overview
Flash loan functionality is healthy for any ecosystem as they assist in ensuring efficient market pricing via arbitrage, healthy collateral levels in lending protocols via flash liquidation, and much more.
Flash loans are a feature designed for developers, due to the technical knowledge required to execute one. Flash Loans allow you to borrow any available amount of assets without putting up any collateral, as long as the liquidity is returned to the protocol within one block transaction. To do a Flash Loan, you will need to build a contract that requests a Flash Loan. The contract will then need to execute the instructed steps and pay back the loan + interest and fees all within the same transaction.
Read our article for a brief overview on what this is and what it means for the ecosystem: https://medium.com/@avtoCROSS/product-extension-flash-loan-enabled-71b090433152
Otherwise, learn more about the fundamentals of Flash Loans in this introductory primer and this more in-depth study for those who wish to better understand it.
Documentation
Some CROSS pools have flash loan functionalities enabled for a small, industry-standard 0.08% fee.
Currently, xUSD 3Pool (0x43F3671b099b78D26387CD75283b826FD9585B60) is the only supported pool for flash loan functionalities:
USDC: 0xc21223249CA28397B4B6541dfFaEcC539BfF0c59
USDT: 0x66e428c3f67a68878562e79A0234c1F83c208770
DAI: 0xF2001B145b43032AAF5Ee2884e456CCd805F677D
function flashLoan(
address receiver,
IERC20 token,
uint256 amount,
bytes memory params
) external;Caller must provide a valid receiver address that inherits IFlashLoanReceiver interface.
Upon finishing executeOperation, the pool must have the initial liquidity back along with the associated fee. If the requirement is not met, then the transaction will fail.
Contract Template
We provide a basic example of a flash loan borrower contract:
Here, for getting of Flash-Loan and using of it you need to call getFlashLoan method only.
Example of a loan getting in 1000 USDC:
Last updated