⚡
Flash Loan
In short, it means you can make payments on DODO with credit. When you buy tokens, you can get them first and then pay for them.
Flash Loan Mechanism

The above diagram illustrates the four steps of the DODO V2 flash swap.
1. Invoke the
flashLoan
function in the pool contract .2.The pool sends the base and quote token to the applicant (where baseAmount or quoteAmount can be lent to 0) .
3.If the
flashLoan
function is called with data
data that is not empty, the contract calls the DVMFlashLoanCall
or DPPFlashLoanCall
method (corresponding to public and private pools) passed by the applicant into the assetTo contract address.4. After the
DVMFlashLoanCall
or DPPFlashLoanCall
is executed, the tokens will be returned and the contract will calculate if the pool is losing money, and if it is losing money, it will be traded out directly.function flashLoan(
uint256 baseAmount,
uint256 quoteAmount,
address assetTo,
bytes calldata data
) external;
PS: DODO V2 flashLoan will preview a transaction that equalize the base and quote token to the initial state. using the preview transaction fee as the flashloan fee. No more fee will be charged in other situations.
Requires users implement the
IDODOCallee
interface.interface IDODOCallee {
function DVMFlashLoanCall(
address sender,
uint256 baseAmount,
uint256 quoteAmount,
bytes calldata data
) external;
function DPPFlashLoanCall(
address sender,
uint256 baseAmount,
uint256 quoteAmount,
bytes calldata data
) external;
function DSPFlashLoanCall(
address sender,
uint256 baseAmount,
uint256 quoteAmount,
bytes calldata data
) external;
}
Some thoughts
Once you dive into Flash Loan Exchange, you'll understand the advantages of the DeFi world over the centralized world. By combining smart contracts, we can increase the utilization of funds in DeFi to unprecedented levels. the cost of trust in the DeFi world is extremely low. The DODO team hopes to get DeFi practitioners started in the DeFi world by introducing them to Flash Loan exchange.
Note:Flash Loan was inspired by dYdX and Uniswap. and the DODO team pays tribute to these pioneers of the DeFi world. 👍
Last modified 1yr ago