Welcome to Lunarys DEX
Lunarys is the world's first fully confidential decentralized exchange (DEX) built on Zama's Fully Homomorphic Encryption (fhEVM) technology. It enables completely private token swaps, liquidity provision, and governance—where all sensitive data remains encrypted on-chain.
What is Lunarys?
Lunarys is a privacy-first DEX 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
- Confidential Governance: Vote weights and tallies remain encrypted
- 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
- Public governance votes → Vote buying, coercion
Lunarys Confidential DEX:
- Encrypted pool reserves → MEV resistance
- Encrypted trade amounts → No front-running possible
- Encrypted LP positions → Complete privacy
- Encrypted governance votes → True democracy
Key Features
1. Confidential Liquidity Pools
- Pool reserves stored as encrypted
euint64values - Constant product formula (x × y = k) computed on encrypted data
- Individual LP positions tracked privately via hooks
- Historical reserve tracking with encrypted checkpoints
2. Private Trading
- Two-phase swap mechanism (Initiate → Oracle → Settle)
- Masked decryption preserves privacy during computation
- Input and output amounts both encrypted
- Front-running economically impossible
3. Encrypted Governance
- Snapshot-based voting prevents vote buying
- Vote weights encrypted during voting period
- Only final outcome decrypted (passed/failed)
- Timelock security for proposal execution
4. Hook System
- Extensible architecture for custom integrations
- LP position tracking via liquidity hooks
- Swap analytics via swap hooks
- Pool-specific governance hooks
5. Decentralized & Trustless
- No central custodians
- Threshold oracle network (no single point of failure)
- Open source smart contracts
- Mathematically proven FHE security
How It Works
Confidential AMM
Lunarys implements the constant product formula entirely on encrypted values:
Traditional: x * y = k (all public)
Lunarys: euint64(x) * euint64(y) = euint128(k) (all encrypted)
Swap process:
- User submits encrypted input amount
- Pool calculates encrypted output using AMM formula
- Masked decryption: Oracle decrypts only a masked value (privacy-preserving)
- Pool completes swap with encrypted output
- User receives encrypted tokens
**Key innovation:**Masked decryption technique
- Instead of decrypting pool reserves (reveals state)
- Decrypt randomized masked values (reveals nothing useful)
- Mathematical properties ensure correct results
- Privacy fully preserved
Encrypted Governance
Vote privacy through encryption:
- Proposal Creation: Must have ≥10k LUN (encrypted check)
- Voting Delay: 1 day snapshot period
- Voting Period: 3 days of encrypted voting
- Tally: Only final outcome decrypted (not individual votes)
- Timelock: 2 day security delay
- Execution: Permissionless execution after delay
Checkpoints prevent vote buying:
- Voting power snapshotted at proposal creation
- Buying tokens after doesn't increase vote weight
- Historical encrypted balances via binary search
- O(log n) lookup complexity
Core Components
PrivacyPool System
PrivacyPool Contract
- Main AMM logic with encrypted reserves
- Two-phase swap mechanism
- Bootstrap & contribute liquidity functions
- Checkpoint-based reserve tracking
- Hook integration points
PrivacyPoolFactory Contract
- Deploys new pool instances
- Manages pool registry
- Owner-controlled pool creation
- Hook configuration
Hook Contracts (Optional)
ILiquidityHook- LP position trackingISwapHook- Swap analytics, custom logic- Fully customizable per pool
DAO System
ConfidentialGovernanceToken (LUN)
- ERC7984 confidential token
- Encrypted balances and transfers
- Delegation with encrypted voting power
- Checkpoint-based historical balances
- Max supply: 1,000,000 LUN
- Emission rate: 0.1 LUN/second
ConfidentialGovernor
- Proposal creation and management
- Encrypted voting with three options (For/Against/Abstain)
- Quorum: 50,000 LUN minimum
- Proposal threshold: 10,000 LUN
- Voting delay: 1 day
- Voting period: 3 days
ConfidentialTimelock
- 2-day execution delay
- Emergency cancellation capability
- Batch operation support
- Role-based access control
ConfidentialTreasury
- Encrypted fund management
- Governance-controlled withdrawals
- Transparent operations without exposing amounts
ConfidentialEmissionsController
- Automated token distribution
- LP incentives
- Staking rewards
- Developer grants
Technology Stack
Zama fhEVM
- Fully Homomorphic Encryption: Compute on encrypted data without decryption
- Threshold Oracle Network: Decentralized decryption service
- EVM Compatible: Standard Solidity smart contracts
- Provable Security: Mathematically proven encryption
ERC7984 Standard
- Confidential ERC20 token standard
- Encrypted balances:
euint64 - Confidential transfers with zero-knowledge proofs
- Operator approvals for DeFi integrations
Smart Contracts
- Written in Solidity
- Deployed on Ethereum-compatible chains
- Open source and auditable
- Gas-optimized where possible
Getting Started
For Users
-
Connect Wallet
- MetaMask or compatible Web3 wallet
- Connect to Sepolia testnet
-
Get Test Tokens
- Acquire LUN, USDC, ZAMA, or eBTC
- All tokens implement ERC7984 (confidential)
-
Provide Liquidity
- Bootstrap new pools or contribute to existing
- Receive encrypted LP positions via hooks
-
Trade Privately
- Swap tokens with complete confidentiality
- No front-running or MEV extraction
-
Participate in Governance
- Delegate or self-delegate voting power
- Create and vote on proposals
- Shape protocol direction
For Developers
-
Integrate Pools
- Deploy custom hooks for LP tracking
- Build on top of PrivacyPool primitives
- Create pool-specific strategies
-
Build DApps
- Use React hooks for frontend integration
- Leverage FHEVM SDK for encryption
- Connect to deployed contracts
-
Extend Protocol
- Create governance proposals
- Deploy new pool types
- Develop advanced trading strategies
Documentation Structure
Core Concepts
- Protocol Overview - Complete system walkthrough
- Swap Mechanism - Two-phase swaps in detail
- Liquidity Provision - Bootstrap & contribute explained
- Checkpoints Confidential - Historical tracking
- DAO System - Governance deep dive
Contract References
- PrivacyPool - Pool contract API
- PrivacyPoolFactory - Factory contract
- Hooks System - Extensibility guide
- Smart Contracts - All contract docs
Architecture
- Architecture - System design
- Pool Architecture - Pool internals
- DAO Architecture - Governance structure
Integration
- Deployed Addresses - Contract addresses
Live Deployment (Sepolia Testnet)
Complete fresh deployment with all contracts verified. 16/16 contracts verified on Etherscan. See Deployed Addresses for full details.
Confidential Tokens (ERC7984)
- LUN (Governance):
0xac4d3C0f90A6a4B5b8ae16AFd78F1EEcF238eD70 - eUSD:
0xc56929E0aeC02cf7679ac53F2cfD5a85Aa33A1ef - ZAMA:
0x7778E67d9fFec15e551Ef8c73B6608083B010305 - eBTC:
0x538Ff24472171adBd61276CCf2978aB8589A9314
DAO System
- Governor:
0xa6585aA902083E7e3386690e9d944564AB82a92f - Timelock:
0x2D6C594512cEBe7Ca09a63243Fd6599Ed6711F1a - Treasury:
0x4080754E9fc917dAdDcdD98F065bFE6A9C7DD04d - EmissionsController:
0x2db86E1EfC1a12F49f5773CAccFC6E4841759f0c
Liquidity Infrastructure
- Factory:
0x325E2fC63CD617C1A09bA41f6fD9bbe5eFc074d8 - Router: Redeployment pending ⏳
- LUN/eUSD Pool:
0x975Be3F050026823394D299799A4d1B502716944 - LUN/eBTC Pool:
0xB5845b18062628F31D1cAEf14dC6f114293403DD - eUSD/eBTC Pool:
0x3299e09E744DEc4557F12527b2940ae84A869dc2 - ZAMA/eUSD Pool:
0xd1956BDd2E45E85e9e717e036e3A41C949b31784 - ZAMA/LUN Pool:
0x9292A1168d6ea1eA87B6C6C9e131b581f64cacc0
Chain ID: 11155111 (Sepolia)
RPC: https://sepolia.infura.io/v3/<API_KEY>
Explorer: sepolia.etherscan.io
See Deployed Addresses for complete list, integration snippets, and verification links.
Next Steps
Ready to dive deeper? Start with:
- Protocol Overview - Understand the complete system
- Swap Mechanism - Learn how confidential swaps work
- DAO System - Explore encrypted governance
Welcome to the future of confidential DeFi. 🌙