Lx
Docs
GitHub

Developer Integration Guide

LiquitX provides a typed TypeScript package (@liquitx/contracts) with ABIs and deployed addresses for all protocol contracts. This guide covers setup, contract reference, and code examples for integrating with the protocol on Base Sepolia.

Installation & Setup

The @liquitx/contracts package exports typed ABIs, deployed addresses per network, and a chain ID resolver. Use it with viem, ethers.js, or any EVM library.

Import Example (TypeScript + viem)

import {
  fundRegistryAbi,
  assetRegistryAbi,
  riskVaultAbi,
  assetMarketAbi,
  getAddressesForChain,
} from "@liquitx/contracts";

const addresses = getAddressesForChain(84532); // Base Sepolia
console.log(addresses?.fundRegistry); // "0x380F..."

Deployed Contracts (Base Sepolia)

All contracts are deployed on Base Sepolia (Chain ID: 84532). Mainnet deployment pending. Addresses are abbreviated — use getAddressesForChain(84532) for full values.

Governance

ContractAddressPurpose
Timelock0x5247...0AB948h minimum delay on governance actions
Governance0x4916...E097Central parameter coordinator with Admin/Guardian/Emergency roles

Core Registries

ContractAddressPurpose
ManagerRegistry0x3B79...c5E0Allowlist of authorized asset originators
FundRegistry0x380F...2CB8Investment funds with Senior/Junior tranches
AssetRegistry0xe6A9...9F39Lifecycle management for tokenized RWA containers
TrancheTokenFactory0x712b...C512Deploys sr/jr token pairs via EIP-1167 proxies

Stablecoin

ContractAddressPurpose
lxUSD (LXToken)0xC1eC...4ac1Jurisdiction-native stablecoin, 1:1 USDC backed (18 decimals)
CollateralVault0xDC98...9993Holds USDC collateral backing lxUSD

Oracles

ContractAddressPurpose
RiskOracle0xc3d0...1E76M-of-N threshold signatures for risk ratings
TWAPOracle0x8A45...3820Manipulation-resistant time-weighted average prices

Two-Layer Liquidity

ContractAddressPurpose
RiskVault AAA0xEd50...8D4ERC-4626-like vault per risk tier holding lxUSD
RiskVault AA0xE324...322bERC-4626-like vault per risk tier holding lxUSD
RiskVault A0xAec8...40F6ERC-4626-like vault per risk tier holding lxUSD
LiquidityRouter0xB3B9...4490Coordinates capital between vaults and markets
AssetMarketFactory0x1535...58d7Deploys per-asset secondary trading markets

AMM & Trading

ContractAddressPurpose
PoolFactory0xEeFB...653eDeploys risk-bucketed WeightedPools (EIP-1167)
LPStaking0x87a3...3b7fMasterChef-style staking with time-locked tiers
JuniorMarketplace0x52A1...B595P2P orderbook for junior tranche tokens

Safety & Yield

ContractAddressPurpose
YieldRouter0x275F...E74Priority waterfall: Insurance → Treasury → PegDefense → LPs
InsuranceFund0xA662...2636Per-jurisdiction loss absorption reserves
CircuitBreaker0x76df...0051Emergency halt with 4 severity levels
PegDefenseModule0xe08b...565EGraduated buy-side intervention for sr-token pegs

Code Examples

Mint lxUSD (deposit USDC collateral)

import { lxTokenAbi, getAddressesForChain } from "@liquitx/contracts";
import { createPublicClient, createWalletClient, http, parseEther } from "viem";
import { baseSepolia } from "viem/chains";

const addresses = getAddressesForChain(84532)!;

// Approve USDC, then mint lxUSD (1:1, auto-scaled 6→18 decimals)
await walletClient.writeContract({
  address: addresses.lxUsd as `0x${string}`,
  abi: lxTokenAbi,
  functionName: "mint",
  args: [1000_000000n], // 1000 USDC
});

Deposit to Risk Vault

import { riskVaultAbi, getAddressesForChain } from "@liquitx/contracts";

const addresses = getAddressesForChain(84532)!;

// Deposit lxUSD into AAA Risk Vault, receive shares
await walletClient.writeContract({
  address: addresses.riskVaultAAA as `0x${string}`,
  abi: riskVaultAbi,
  functionName: "deposit",
  args: [parseEther("1000")], // 1000 lxUSD
});

// Check share price
const price = await publicClient.readContract({
  address: addresses.riskVaultAAA as `0x${string}`,
  abi: riskVaultAbi,
  functionName: "sharePrice",
});

Swap on Asset Market

import { assetMarketAbi } from "@liquitx/contracts";

// Buy sr-tokens with lxUSD on an Asset Market
await walletClient.writeContract({
  address: marketAddress,
  abi: assetMarketAbi,
  functionName: "swap",
  args: [
    lxUsdAddress,      // assetIn
    srTokenAddress,    // assetOut
    parseEther("100"), // 100 lxUSD in
    parseEther("95"),  // min 95 sr-tokens out (slippage)
  ],
});

Place Junior Marketplace Order

import { juniorMarketplaceAbi, getAddressesForChain } from "@liquitx/contracts";

const addresses = getAddressesForChain(84532)!;

// Create a sell order for junior tokens
await walletClient.writeContract({
  address: addresses.juniorMarketplace as `0x${string}`,
  abi: juniorMarketplaceAbi,
  functionName: "createSellOrder",
  args: [jrTokenAddress, parseEther("100"), parseEther("0.80")],
  // Sell 100 jr-tokens at 0.80 lxUSD each
});

Supported Networks

NetworkChain IDStatus
Base Sepolia84532Live (testnet)
Base Mainnet8453Pending deployment

Resources

Command Palette

Search for a command to run...