Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.li.fi/llms.txt

Use this file to discover all available pages before exploring further.

Settlement is the process of escrowing user funds (input settlement) and recording solver delivery (output settlement). This page covers both sides.

Input settlement

Two single-chain input settlers are supported: Multi-chain input settlers are in progress. The Compact supports fill-first flows through resource locks. The Escrow settler uses traditional flows where the escrow must be opened before fills.

StandardOrder

Single-chain input settlers use the following order structure:
struct StandardOrder {
    address user;
    uint256 nonce;
    uint256 originChainId;
    uint32 expires;
    uint32 fillDeadline;
    address inputOracle;
    uint256[2][] inputs;
    MandateOutput[] outputs;
}

MandateOutput

struct MandateOutput {
    bytes32 oracle;
    bytes32 settler;
    uint256 chainId;
    bytes32 token;
    uint256 amount;
    bytes32 recipient;
    bytes call;
    bytes context;
}

Finalization

To claim input funds after filling an order, call one of:
  1. finalise Called by the solver. The caller designates where to send assets and whether to make an external call.
  2. finaliseWithSignature Called by anyone with an AllowOpen signature from the solver containing destination and call details.

Compact Registration

Compact intents are signed as a BatchClaim using The Compact’s EIP-712 domain separator:
struct BatchCompact {
    address arbiter;
    address sponsor;
    uint256 nonce;
    uint256 expires;
    uint256[2][] idsAndAmounts;
    Mandate mandate;
}

struct Mandate {
    uint32 fillDeadline;
    address inputOracle;
    MandateOutput[] outputs;
}
Alternatively, intents can be registered on-chain by the sponsor or by someone paying for the claim on their behalf.

Escrow Registration

Escrow intents can be registered in several ways:
  1. Direct open by the owner through ERC-7683 function open(bytes). Emits event Open(bytes32 indexed orderId, bytes order).
  2. ERC-3009 with the orderId as nonce. A signature per input is required.
  3. Permit2 with an EIP-712 signed PermitBatchWitnessTransferFrom.

Integration Examples


Output settlement

Currently one output settler exists: OutputSettlerSimple.sol. It supports four order types: simple limit orders, Dutch auctions, exclusive limit orders, and exclusive Dutch auctions.

Configuring Auction Type

The auction type is determined by the context field in MandateOutput:
// Simple limit order (no auction)
context = "0x" or "0x00";

// Dutch auction
context = abi.encodePacked(0x01, slope, stopTime);
For Dutch auctions with multiple outputs, only the first output functions as an auction. The rest resolve to their worst price, because solvers only compete on the first output (winning it wins the entire order). For more details on auction mechanics, see Auctions.

Next Steps

System Overview

Full architecture and contract addresses

Oracle Systems

Verification and proof systems

Create and Submit Orders

Order construction for integrators

Filling Orders

How solvers deliver outputs