Lux Docs
Lux Skills Reference

Lux Liquid - DeFi Lending and Yield Protocol

Documentation for Lux Liquid - DeFi Lending and Yield Protocol

Overview

Lux Liquid is a DeFi lending protocol built on the Alchemist V3 architecture. It allows users to deposit yield-bearing collateral, borrow self-repaying synthetic assets, and earn yield through automated strategy allocation. The codebase is a Foundry-based Solidity project with Echidna and Medusa fuzz testing, Slither static analysis, and Docusaurus documentation.

When to use

  • Deploying or modifying DeFi lending/borrowing contracts on Lux, Ethereum, or EVM-compatible chains
  • Integrating yield strategies (eETH, wstETH, sfrxETH, Morpho, Peapods, Tokemak)
  • Building on the Alchemist V3 protocol or Transmuter
  • Running fuzz testing with Echidna or Medusa on Solidity contracts

Quick reference

ItemValue
Repogithub.com/luxfi/liquid
LanguageSolidity 0.8.28
Build systemFoundry (forge)
EVM versionCancun
Optimizervia-ir, 800 runs
LicenseMIT
Default branchmain
Node versionSee .nvmrc

Project structure

liquid/
  src/
    AlchemistV3.sol          # Core lending engine (51KB)
    AlchemistAllocator.sol   # Strategy allocation
    AlchemistCurator.sol     # Strategy curation and risk
    AlchemistETHVault.sol    # ETH vault wrapper
    AlchemistTokenVault.sol  # ERC20 vault wrapper
    AlchemistGate.sol        # Access control gate
    AlchemistStrategyClassifier.sol  # Strategy risk classification
    AlchemistV3Position.sol  # NFT position tracking
    MYTStrategy.sol          # Managed Yield Token strategy
    PerpetualGauge.sol       # Perpetual reward gauge
    Transmuter.sol           # Synthetic-to-underlying conversion
    adapters/                # Token adapter implementations
    base/                    # Base contracts
    external/                # External protocol interfaces
    governance/              # Governance contracts
    interfaces/              # All contract interfaces (20+ files)
    libraries/               # Shared libraries
    mocks/                   # Test mocks
    strategies/              # Yield strategy implementations
      EETH.sol               # EtherFi eETH
      WstethMainnet.sol      # Lido wstETH
      SfrxETH.sol            # Frax sfrxETH
      MorphoYearnOGWETH.sol  # Morpho + Yearn WETH
      PeapodsETH.sol         # Peapods ETH
      TokeAutoEth.sol        # Tokemak autoETH
    test/                    # Forge test suite
    utils/                   # Utility contracts
  script/
    DeployLux.s.sol          # Lux Network deployment script
    Counter.s.sol            # Example script
    util/                    # Script utilities
  docs/                      # Docusaurus documentation site
  lib/                       # Git submodule dependencies
  echidna.yaml               # Echidna fuzz testing config
  medusa.json                # Medusa fuzz testing config
  slither.config.json        # Slither static analysis config
  foundry.toml               # Foundry configuration
  remappings.txt             # Solidity import remappings

Dependencies (git submodules)

SubmodulePurpose
forge-stdFoundry test framework
openzeppelin-contractsERC20, access control, upgrades
openzeppelin-contracts-upgradeableUpgradeable contract patterns
solmateGas-optimized ERC20/ERC721
chainlink-brownie-contractsChainlink price feeds
permit2Uniswap Permit2 approvals
halmos-cheatcodesa16z symbolic testing
vault-v2Morpho vault integration

One-file quickstart

git clone https://github.com/luxfi/liquid.git
cd liquid
forge install
forge build
forge test

Network endpoints (from foundry.toml)

NetworkRPC
Lux Mainnethttps://api.lux.network/ext/bc/C/rpc
Lux Testnethttps://api.testnet.lux.network/ext/bc/C/rpc
Zoo Mainnethttps://api.zoo.network/ext/bc/Zoo/rpc
Hanzo Mainnethttps://api.hanzo.network/ext/bc/Hanzo/rpc
Ethereum Mainnetvia MAINNET_API_KEY env
Ethereum Sepoliavia SEPOLIA_API_KEY env

Key contracts

ContractPurpose
AlchemistV3Core protocol: deposits, borrows, liquidations, yield distribution
TransmuterConverts synthetic tokens to underlying at 1:1
AlchemistV3PositionERC721 NFT representing user positions
AlchemistCuratorStrategy whitelist and risk management
AlchemistAllocatorAutomated capital allocation across strategies
PerpetualGaugeContinuous reward distribution
MYTStrategyManaged Yield Token strategy base

Security tooling

ToolConfig filePurpose
Echidnaechidna.yamlProperty-based fuzz testing (50K iterations, 4 workers)
Medusamedusa.jsonAlternative fuzzer
Slitherslither.config.jsonStatic analysis
Halmosvia halmos-cheatcodesSymbolic execution
Pre-commit.pre-commit-config.yamlFormat + doc generation

Development

# Build
forge build

# Test
forge test

# Test with intense fuzzing
FOUNDRY_PROFILE=intense forge test

# Coverage
forge coverage

# Deploy to Lux
forge script script/DeployLux.s.sol --broadcast --rpc-url lux_mainnet --verify

# Generate docs
forge doc

Environment variables

VariablePurpose
MAINNET_API_KEYEthereum mainnet RPC URL
SEPOLIA_API_KEYEthereum Sepolia RPC URL
ETHERSCAN_API_KEYEtherscan contract verification
LUX_EXPLORER_API_KEYLux explorer contract verification
ZOO_EXPLORER_API_KEYZoo explorer contract verification
HANZO_EXPLORER_API_KEYHanzo explorer contract verification
  • lux/lux-evm.md -- EVM execution layer where contracts run
  • lux/lux-dex.md -- DEX integration for swaps
  • lux/lux-governance.md -- On-chain governance

On this page