Advanced Liquidation Strategies

This guide covers advanced techniques for liquidating positions in Flux Protocol, including capital-free liquidations, leveraged liquidations, and complex multi-step strategies.

Overview

During liquidation, the liquidator receives a callback where they have access to all locked_* operations, just like a manager. This enables powerful strategies:

  1. Capital-Free Liquidation - Use seized collateral to pay for liquidation

  2. Leveraged Liquidation - Borrow from the vault to liquidate

  3. Flash Liquidation - Borrow, liquidate, repay in single transaction

  4. Cross-Protocol Arbitrage - Liquidate via external DEXs for profit

  5. Recursive Liquidation - Open position against vault to liquidate another manager

Key Insight: Liquidators are temporary managers during the callback. They can borrow, deposit, withdraw, and interact with wrappers just like regular managers.


Available Operations During Liquidation

During the liquidation callback, liquidators have access to:

interface ILiquidatorOperations {
    // Capital operations
    function locked_borrow(uint256 amount) external;
    function locked_repay(uint256 amount) external;

    // Bond operations
    function locked_depositBond(uint256 amount) external;
    function locked_withdrawBond(uint256 amount) external;

    // Wrapper operations
    function locked_registerWrapper(address wrapper) external;
    function locked_deregisterWrapper(address wrapper) external;
    function locked_depositToWrapper(IAsset wrapper, bytes32 positionId, uint256 amount) external;
    function locked_withdrawFromWrapper(IAsset wrapper, bytes32 positionId, uint256 amount) external;
    function locked_claimFromWrapper(IAsset wrapper, bytes32 positionId, uint256 amountOrTokenId) external;
    function locked_interactWithWrapper(address wrapper, bytes calldata data) external;

    // Working capital management
    function locked_moveFunds(bytes32 fromPositionId, bytes32 toPositionId, uint256 amount) external;
}

What You Receive:

  • All of manager's positions (bond + wrappers + working capital)

  • Lock on vault (atomic execution)

  • Ability to use vault operations

What You Must Return:

  • Minimum payment in your working capital (base asset wrapper)

  • Vault verifies this after callback completes


Strategy 1: Capital-Free Liquidation (Basic)

Use the seized collateral itself to pay for the liquidation.

Concept

Implementation

Example

Advantages

  • Zero capital required

  • No external funding needed

  • Simple implementation

  • Gas efficient

Limitations

  • Only works if collateral > min payment

  • Collateral already in base asset (or must swap)

  • Lower profit than leveraged strategies


Strategy 2: Leveraged Liquidation

Borrow from the vault itself to increase your liquidation capacity and profit.

Concept

During liquidation callback, become a manager by borrowing from the vault. Use that borrowed capital plus seized collateral to maximize profit.

Implementation

Example

Advantages

  • Can liquidate positions even with insufficient collateral

  • Maximize profit by using vault capital

  • Handle complex multi-asset positions

  • Optimize swaps for best prices

Limitations

  • More complex implementation

  • Higher gas costs

  • Requires bond posting

  • Must repay borrowed capital


Strategy 3: Recursive/Nested Liquidation

Open a position against the vault to liquidate another manager.

This is the most advanced strategy: You become a manager yourself, borrow capital, use it to liquidate another manager, and close your position in the same transaction.

Concept

Implementation

Execution Flow

Example

Advantages

  • True capital-free: Use vault's own capital

  • Can liquidate very large positions

  • Atomic execution

  • No need for external funding

  • Scales with vault size

Limitations

  • Very complex implementation

  • High gas costs (nested callbacks)

  • Requires tracking callback depth

  • Must manage bond requirements

  • Vault must have idle liquidity


Strategy 4: Flash Loan Liquidation

Use external flash loans to liquidate, then repay the flash loan from seized collateral.

Concept

Implementation

Example

Advantages

  • No capital required

  • Can liquidate unlimited size positions

  • Pay minimal flash loan fees

  • No vault borrowing (don't become manager)

Limitations

  • Requires flash loan provider integration

  • Flash loan fees eat into profit

  • Must repay same transaction

  • Complex error handling


Strategy 5: Cross-Protocol Arbitrage

Liquidate positions and sell on external DEXs for better prices.

Concept

Instead of just unwinding positions to base asset, route through multiple DEXs to maximize profit:

Implementation

Advantages

  • Maximize profit through best execution

  • Reduce slippage by routing optimally

  • Can capture arbitrage opportunities

  • Better for large liquidations

Limitations

  • More gas intensive (multiple quote checks)

  • Requires maintaining multiple DEX integrations

  • Quotes may be stale by execution time

  • Increased complexity


Comparison of Strategies

Strategy
Capital Required
Complexity
Gas Cost
Max Profit
Best For

Capital-Free

None

Low

Low

Medium

Simple positions, base asset collateral

Leveraged

None (vault capital)

Medium

Medium

High

Complex multi-asset positions

Recursive

None (vault capital)

Very High

High

Very High

Large positions, low vault utilization

Flash Loan

None (flash loan)

High

Medium

High

Very large positions

Arbitrage

Varies

High

High

Highest

Multi-asset positions, volatile markets


Best Practices

For All Strategies

Do:

  • Calculate gas costs before executing

  • Check vault has sufficient idle liquidity (for borrowing strategies)

  • Verify position is still liquidatable before executing

  • Use proper slippage protection on DEX swaps

  • Test on testnet/fork first

  • Handle all error cases gracefully

Don't:

  • Assume seized collateral is in base asset

  • Ignore flash loan fees in profit calculation

  • Use unlimited approvals carelessly

  • Forget to repay borrowed capital

  • Skip callback depth tracking for recursive strategies

Gas Optimization

Profit Calculation

Always account for all costs:

Error Handling


Security Considerations

Reentrancy Protection

Flux vault has nonReentrant on liquidate(), but be careful with external calls:

Flash Loan Attacks

Verify liquidations are genuine, not manipulated:

Sandwich Attack Protection

Protect your swaps from MEV:


Summary

Flux's liquidation callback system enables sophisticated capital-efficient strategies:

  1. Capital-Free: Use seized collateral to pay for liquidation

  2. Leveraged: Borrow from vault to amplify liquidation capacity

  3. Recursive: Become a manager to liquidate another manager

  4. Flash Loans: Use external flash loans for unlimited capital

  5. Arbitrage: Route through multiple DEXs for maximum profit

Key Insight: Liquidators are temporary managers with full access to locked_* operations. This enables truly capital-free liquidations at any scale.

Choose your strategy based on:

  • Position size

  • Collateral composition

  • Available capital

  • Gas budget

  • Vault liquidity

  • Technical expertise

Last updated