The official Solidity smart contracts library for the Lux Network ecosystem. Production-ready contracts for tokens, DeFi protocols, cross-chain bridges, post-quantum cryptography, and more.
npm install @luxfi/contracts
# or
pnpm add @luxfi/contracts
# or
yarn add @luxfi/contractsforge install luxfi/standardAdd to remappings.txt:
@luxfi/contracts/=lib/standard/contracts/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "@luxfi/contracts/tokens/LRC20.sol";
contract MyToken is LRC20 {
constructor() LRC20("My Token", "MTK") {
_mint(msg.sender, 1_000_000 * 10**18);
}
}Standard token implementations with Lux-native naming:
| Contract | Description | Import |
|---|---|---|
| LRC20 | ERC20 base implementation | @luxfi/contracts/tokens/LRC20.sol |
| LRC20B | Bridgeable ERC20 (mint/burn by bridge) | @luxfi/contracts/tokens/LRC20B.sol |
| LRC721B | Bridgeable ERC721 | @luxfi/contracts/tokens/LRC721B.sol |
| LRC1155B | Bridgeable ERC1155 | @luxfi/contracts/tokens/LRC1155B.sol |
| LUX | Native platform token | @luxfi/contracts/tokens/LUX.sol |
| LUSD | Lux Dollar stablecoin | @luxfi/contracts/tokens/LUSD.sol |
| AI | AI compute mining token | @luxfi/contracts/tokens/AI.sol |
| WLUX | Wrapped LUX | @luxfi/contracts/tokens/WLUX.sol |
Extensions:
LRC20Capped- Maximum supply capLRC20Burnable- Burn functionalityLRC20Pausable- Emergency pauseLRC20Permit- Gasless approvals (EIP-2612)
Cross-chain asset transfers via Warp messaging:
| Contract | Description | Import |
|---|---|---|
| Bridge | Core bridge with Warp verification | @luxfi/contracts/bridge/Bridge.sol |
| Teleport | Token teleportation interface | @luxfi/contracts/bridge/Teleport.sol |
| LRC20B | Bridgeable token base | @luxfi/contracts/bridge/LRC20B.sol |
| LETH | Bridged ETH on Lux | @luxfi/contracts/bridge/lux/LETH.sol |
| LUSD | Lux Dollar stablecoin | @luxfi/contracts/bridge/lux/LUSD.sol |
| LBTC/LSOL/LTON | Bridged assets (L-prefix) | @luxfi/contracts/bridge/lux/*.sol |
import "@luxfi/contracts/bridge/Teleport.sol";
// Teleport tokens to another chain
teleport.send(destChainId, recipient, token, amount);Deposit yield-bearing collateral, mint synthetic assets, debt repays itself over time:
| Contract | Description |
|---|---|
| SynthVault | Main vault - deposit, mint, repay |
| Transmuter | 1:1 synth-to-underlying redemption |
| SynthToken | Base LRC20 for synthetics |
| sUSD/sETH/sBTC | Core synthetic assets |
| sLUX/sAI/sZOO | Lux ecosystem synthetics |
import "@luxfi/contracts/synths/SynthVault.sol";
// Deposit yield token, mint synths
vault.deposit(yieldToken, amount, recipient);
vault.mint(synthAmount, recipient);
// Yield automatically repays debt over timeAvailable Synths: sUSD, sETH, sBTC, sLUX, sAI, sZOO, sSOL, sTON, sADA, sAVAX, sBNB, sPOL
Leveraged perpetual futures with up to 50x leverage:
| Contract | Description |
|---|---|
| Vault | Central liquidity pool |
| Router | Position management |
| LLP | Liquidity provider token |
| PositionRouter | Keeper-executed orders |
import "@luxfi/contracts/perps/core/Router.sol";
// Open leveraged long position
router.increasePosition(
collateralToken,
indexToken,
collateralAmount,
sizeDelta,
true // isLong
);Automated market maker with V2 and V3 pools:
| Contract | Description |
|---|---|
| AMMV2Factory | V2 pair factory |
| AMMV2Pair | V2 liquidity pair |
| AMMV2Router | V2 swap router |
| AMMV3Factory | V3 concentrated liquidity factory |
| AMMV3Pool | V3 concentrated liquidity pool |
Morpho-style lending markets:
| Contract | Description |
|---|---|
| Markets | Core lending market |
| Allocator | Capital allocation |
| Router | Lending router |
NFT automated market maker with bonding curves:
| Contract | Description |
|---|---|
| LSSVMPairFactory | Pair factory |
| LSSVMPair | NFT/token pair |
| LSSVMRouter | Swap router |
| LinearCurve | Linear bonding curve |
| ExponentialCurve | Exponential bonding curve |
On-chain governance with vote-escrowed tokens:
| Contract | Description |
|---|---|
| DAO | Complete DAO implementation |
| Governor | OpenZeppelin Governor |
| Timelock | Timelock controller |
| vLUX | Vote-escrowed LUX |
| GaugeController | Gauge weight voting |
import "@luxfi/contracts/governance/DAO.sol";
// Create proposal
dao.propose(targets, values, calldatas, description);
// Vote
dao.castVote(proposalId, support);Multi-sig wallets with post-quantum signer support:
| Contract | Description |
|---|---|
| Safe | Core multi-sig wallet |
| SafeFactory | Safe deployment factory |
| SafeFROSTSigner | FROST threshold signer |
| SafeMLDSASigner | ML-DSA (Dilithium) signer |
| SafeRingtailSigner | Ringtail lattice signer |
| SafeLSSSigner | LSS-MPC signer |
| SafeCGGMP21Signer | CGGMP21 ECDSA threshold |
| QuantumSafe | Full quantum-resistant safe |
import "@luxfi/contracts/safe/Safe.sol";
import "@luxfi/contracts/safe/SafeFROSTSigner.sol";
// Create safe with FROST threshold signing
Safe safe = safeFactory.createSafe(owners, threshold);
safe.enableModule(address(frostSigner));Quantum-resistant signature schemes via EVM precompiles:
| Precompile | Description |
|---|---|
| IFROST | Schnorr threshold signatures |
| IMLDSA | ML-DSA (FIPS 204 / Dilithium) |
| IMLKEM | ML-KEM key encapsulation |
| ISLHDSA | SLH-DSA (SPHINCS+) |
| IRingtailThreshold | Lattice-based threshold |
| ICGGMP21 | ECDSA threshold (MPC) |
| IBLS | BLS signatures |
| IWarp | Cross-chain Warp messaging |
| IQuasar | Quantum consensus |
import "@luxfi/contracts/crypto/precompiles/IMLDSA.sol";
// Verify post-quantum signature
bool valid = IMLDSA.verify(publicKey, message, signature);Lamport Signatures:
import "@luxfi/contracts/crypto/lamport/LamportBase.sol";
// One-time quantum-safe signaturesDecentralized identity management:
| Contract | Description |
|---|---|
| DIDRegistry | DID document storage |
| DIDResolver | DID resolution |
| PremiumDIDRegistry | Premium DID features |
AI token mining and compute marketplace:
| Contract | Description |
|---|---|
| AIToken | AI mining token |
| AIMining | Mining rewards |
| ComputeMarket | GPU compute marketplace |
| Contract | Description |
|---|---|
| sLUX | Staked LUX token |
| Contract | Description |
|---|---|
| FeeSplitter | Protocol fee distribution |
| SynthFeeSplitter | Synth-specific fees |
| ValidatorVault | Validator rewards vault |
| Contract | Description |
|---|---|
| Account | ERC-4337 account |
| EOA | Externally owned account |
| EOAFactory | Account factory |
| EOAPaymaster | Gas sponsorship |
| Contract | Description |
|---|---|
| OmnichainLP | Cross-chain liquidity |
| OmnichainLPRouter | Routing layer |
| Contract | Description |
|---|---|
| GenesisNFTs | Genesis collection |
| Market | NFT marketplace |
This project supports both Foundry (recommended) and Hardhat for development.
- Foundry (recommended)
- Node.js 18+ and pnpm/npm
- Git
# Clone repository
git clone https://github.com/luxfi/standard.git
cd standard
# Install Foundry dependencies
forge install
# Install Node.js dependencies (for Hardhat)
pnpm install# Foundry (recommended)
forge build
# Hardhat
pnpm build:hardhat# Foundry (recommended) - 751+ tests
forge test
# With verbosity
forge test -vvv
# With gas reporting
forge test --gas-report
# Coverage
forge coverage
# Hardhat
pnpm test:hardhatGenerate TypeChain types for Hardhat/ethers:
pnpm typechainDeploy scripts are in script/:
# Local deployment (start anvil first)
anvil &
forge script script/DeployAll.s.sol --rpc-url localhost --broadcast
# Lux Mainnet
forge script script/DeployAll.s.sol --rpc-url lux --broadcast --verify
# Lux Testnet
forge script script/DeployAll.s.sol --rpc-url lux_testnet --broadcast --verifyAvailable deploy scripts:
DeployTokens.s.sol- Core tokens (LUX, LUSD, AI, WLUX)DeploySynths.s.sol- Synths protocol (SynthVault, Transmuter)DeployPerps.s.sol- Perpetual trading (Vault, Router, LLP)DeployAMM.s.sol- AMM pools (V2, V3)DeployMarkets.s.sol- Lending marketsDeployGovernance.s.sol- DAO & governanceDeployAI.s.sol- AI miningDeployAll.s.sol- Full deployment
# Start local node
pnpm node
# Deploy via Hardhat
pnpm deploy:hardhat localhostConfigure .env for deployments:
PRIVATE_KEY=your_private_key
INFURA_API_KEY=your_infura_key
ETHERSCAN_API_KEY=your_etherscan_key
LUXSCAN_API_KEY=your_luxscan_keyAvailable networks: lux, lux_testnet, zoo, zoo_testnet, hanzo, mainnet, sepolia
Full documentation available at standard.lux.network
- All contracts follow Solidity best practices
- Built on OpenZeppelin libraries where applicable
- Post-quantum cryptography for future-proofing
- Comprehensive test coverage (751+ tests)
Audit reports are available in the audits/ directory.
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
BSD-3-Clause License - see LICENSE