Flash loan

The Cetus CLMM (Concentrated Liquidity Market Maker) provides a flash loan mechanism, allowing users to borrow assets from a liquidity pool without requiring upfront collateral, as long as the borrowed amount is repaid within the same transaction. This feature is particularly useful for arbitrage, liquidations, and high-frequency trading strategies.

Flash loan fee

For each pool, the fee rate for flash loans is equal to the fee rate for swaps. We currently have six different fee rates. Additionally, different tick spacings correspond to distinct fee rates; please refer to the diagram below for more details.

tick spacing
fee rate

2

0.0001 (100)

10

0.0005 (500)

20

0.001 (1000)

60

0.0025 (2500)

200

0.01 (10000)

220

0.02 (20000)

The module includes the following functions:

1. Flash loan from pool

/// Flash loan from pool
/// Params
///     - `config` The global config of clmm package.
///     - `pool` The clmm pool object.
///     - `loan_a` A flag indicating whether to loan coin A (true) or coin B (false).
///     - `amount` The amount to loan.
/// Returns
///     - `Balance<CoinTypeA>` The balance of coin A to loan.
///     - `Balance<CoinTypeB>` The balance of coin B to loan.
///     - `FlashLoanReceipt` The receipt for repaying the flash loan.
public fun flash_loan<CoinTypeA, CoinTypeB>(
    _config: &GlobalConfig,
    _pool: &mut Pool<CoinTypeA, CoinTypeB>,
    _loan_a: bool,
    _amount: u64
): (Balance<CoinTypeA>, Balance<CoinTypeB>, FlashLoanReceipt) {}

2. Flash loan from pool with partner

In addition to Swap with Partner, the Cetus protocol also enables the sharing of protocol fees with a designated partner. Partner can collect ref fee by partner cap. Details can refer to Partner.

3. Repay flash loan

4. Repay flash loan with partner id

Last updated