Lux Docs
Precompile

DeFi Precompiles

Native DEX, lending, perpetuals, and cross-chain bridge precompiles

DeFi precompiles implement a complete financial stack as native EVM operations, achieving sub-microsecond execution latency.

DEX (Uniswap v4-Style)

AddressNameGasDescription
0x0400PoolManager50,000Singleton AMM with flash accounting
0x0401SwapRouter10,000Optimized swap routing
0x0402HooksRegistry3,000Custom hook contracts
0x0403FlashLoan5,000Flash loan facility

Flash Accounting

All operations within a transaction are netted. Token transfers happen only at the end, reducing gas costs for multi-hop swaps.

// Inside lock callback:
BalanceDelta delta = IPoolManager(0x0400).swap(key, params, hookData);
IPoolManager(0x0400).settle(currency0, amount0);
IPoolManager(0x0400).take(currency1, recipient, amount1);

Hooks

Hook capabilities are encoded in the hook contract address (first 2 bytes). Available hooks: BeforeInitialize, AfterInitialize, BeforeSwap, AfterSwap, BeforeAddLiquidity, AfterAddLiquidity, BeforeDonate, AfterDonate.

Lending (Alchemist)

AddressNameGasDescription
0x0410LendingPool15,000Supply/borrow with collateral
0x0411InterestRate5,000Dynamic interest rate curves
0x0412Liquidator50,000Liquidation engine

Perpetuals

AddressNameGasDescription
0x0420PerpEngine25,000Perpetual futures (up to 1111x leverage)
0x0421FundingRate10,000Funding rate calculation
0x0422InsuranceFund20,000Insurance and auto-deleveraging

Liquid Staking

AddressNameGasDescription
0x0430LiquidVault20,000Self-repaying loans (90% LTV)
0x0431LiquidFx25,000L-token to underlying conversion
0x0432LiquidToken5,000Liquid token registry (LUSD, LETH)
0x0433YieldRouter30,000Yield strategy routing

Cross-Chain

AddressNameGasDescription
0x0440TeleportBridge50,000Cross-chain transfer engine
0x0441OmnichainRouter40,000Multi-chain liquidity routing

On this page