Welcome to Lunarys eDEX
Lunarys is the world's first fully encrypted decentralized exchange (eDEX) built with Fully Homomorphic Encryption (FHE) technology. It enables completely private token swaps and liquidity provision where all sensitive data remains encrypted on-chain.
What is Lunarys?
Lunarys is a privacy-first eDEX that maintains complete confidentiality through Fully Homomorphic Encryption (FHE):
- Confidential AMM: Automated market maker with encrypted reserves
- Private Swaps: Trade amounts never revealed in plaintext
- Encrypted Liquidity: LP positions and pool depth completely private
- FHE Technology: All computations done on encrypted data without decryption
The Privacy Problem in DeFi
Traditional DEXes (Uniswap, SushiSwap, etc.):
- Public pool reserves - MEV bots exploit this
- Public trade amounts - Front-running, sandwich attacks
- Public LP positions - Whale tracking, competitive disadvantage
Lunarys eDEX:
- Encrypted pool reserves - MEV resistance
- Encrypted trade amounts - No front-running possible
- Obfuscated public state - ~3x magnitude uncertainty on reserves
- Encrypted LP positions - Complete privacy
Key Features
1. Confidential Liquidity Pools (EPOOL)
- Pool reserves stored as encrypted
euint64values - Constant product formula (x * y = k) computed on encrypted data via 4-term Taylor approximation
- Obfuscated reserves publicly visible with random factor (1M-3M range) for price discovery
- LP shares tracked as encrypted CERC20 tokens
2. Atomic Private Trading
- Single-transaction swap execution (no oracle settlement phase)
- User provides pre-decrypted obfuscated reserves with FHE proof
- Input and output amounts both encrypted
- Slippage protection via encrypted minimum output amount
- Front-running economically impossible due to reserve obfuscation
3. Uniswap V2-Style Fee Model
- Swap fee deducted from input amount (configurable per pool, e.g. 0.3%)
- Fees stay implicitly in reserves (no fee accumulator)
- LPs realize gains when removing liquidity
- 0.05% withdrawal fee prevents JIT liquidity attacks
4. Decentralized & Trustless
- No central custodians
- FHE threshold decryption network
- Open source smart contracts
- Mathematically proven FHE security
How It Works
Confidential AMM with Obfuscated Reserves
Lunarys implements the constant product formula on encrypted values, with publicly visible obfuscated reserves for price discovery:
True reserves: euint64(reserveA), euint64(reserveB) (encrypted, private)
Obfuscated reserves: reserveA * factor, reserveB * factor (publicly decryptable)
The obfuscation factor (1M-3M range) is the same for both reserves, so the price ratio is preserved while the actual magnitude is hidden with ~3x uncertainty.
Atomic swap process:
- User fetches obfuscated reserves from pool and decrypts them via the FHE gateway
- User encrypts their swap amount client-side
- User calls
atomicSwapAForBwith encrypted input, obfuscated reserves, and FHE proof - Pool validates proof against current obfuscated state
- Pool computes output via 4-term Taylor approximation on encrypted values
- Pool checks slippage (encrypted minAmountOut)
- If checks pass: transfer output to user. If not: refund input.
- Pool rotates obfuscation factor (fresh randomness every operation)
Core Components
EPOOL System
EPOOL Contract (Encrypted Pool)
- Main AMM logic with encrypted reserves
- Atomic swap execution (
atomicSwapAForB,atomicSwapBForA) - Bootstrap and contribute liquidity functions
- Per-operation obfuscation factor rotation
- CERC20 LP token (encrypted shares)
EPoolFactory Contract
- Deploys new EPOOL instances
- Manages pool registry with deterministic keys
- Canonical token ordering (lower address = token0)
- Encrypted obfuscation parameters
UniversalRouter Contract
- Pool discovery and route validation (NOT execution)
- Path validation for multi-hop routes
- Users call pools directly for encrypted operations
Technology Stack
FHE Technology
- Fully Homomorphic Encryption: Compute on encrypted data without decryption
- Threshold Decryption Network: Decentralized decryption service
- EVM Compatible: Standard Solidity smart contracts
- Provable Security: Mathematically proven encryption
CERC20 / ERC7984 Standard
- Confidential ERC20 token standard
- Encrypted balances:
euint64 - All tokens use 6 decimals
- Operator approvals for DeFi integrations (
setOperator)
Getting Started
For Users
- Connect Wallet - MetaMask or compatible Web3 wallet on Sepolia testnet
- Claim Test Tokens - Use the Airdrop contract to claim 100 tokens of each type (eBTC, eETH, eUSD, LUN, eUSDT, eBNB)
- Set Operator - Approve the pool to spend your tokens via
setOperator - Trade Privately - Swap tokens with complete confidentiality via atomic swaps
For Developers
- Frontend Integration - Complete TypeScript guide with FHE SDK setup
- Deployed Addresses - Current contract addresses and pool details
Live Deployment (Sepolia Testnet)
Complete 6-token deployment with all contracts verified. See Deployed Addresses for full details.
Infrastructure (Ethereum Sepolia)
- EPoolFactory:
0xa830205E7b5e1b75a6e6EED34207C7FEc7aBEEAE - UniversalRouter:
0x6ef96225151e207cA92cF923C4edD0aC3235842c - Airdrop:
0x5509c8b9995EfEB21A9B6a25995040fF75b960b9
Active Liquidity Pools (Ethereum Sepolia)
| Pool | Address | Fee |
|---|---|---|
| eBTC/eUSD | 0xf0aB79A82F2D1d5b0230815d26fB0278a237bA3c | 0.30% |
| eETH/eUSD | 0x288ddB6c9912f849cDF49D995e4AcC0f3902186B | 0.30% |
| eBNB/eUSD | 0x00689E12aE9a2020a2EcdE27e84C4A67A0eCce49 | 0.30% |
| LUN/eUSD | 0xE71c606EeEfe8452357fFA03C4B327480C8D361a | 0.30% |
| eUSDT/eUSD | 0xdE4ea0e51E06AF239a0CF46446a9c3833efAde77 | 0.10% |
| eBTC/eETH | 0x5E47755F2D86fDb418b6C7f47a808788a11164E6 | 0.30% |
Chain ID: 11155111 (Sepolia) | Explorer: sepolia.etherscan.io