VersΓ£o 1.0.0
Ink! Version: 5.1.1
Rede Alvo: Lunes Network (wss://ws.lunes.io)
Γltima AtualizaΓ§Γ£o: Agosto 2024
Welcome to Lunex DEX, a cutting-edge decentralized exchange built on the Lunes blockchain! Featuring innovative staking, governance, trading rewards, and a complete DeFi ecosystem with the lowest fees and highest security standards.
π EspecificaΓ§Γ΅es TΓ©cnicas:
- Framework: ink! 5.1.1 (Polkadot Smart Contracts)
- PadrΓ£o de Token: PSP22 (Polkadot Standard Proposal)
- Arquitetura: Baseada em Uniswap V2 (AMM - Automated Market Maker)
- SeguranΓ§a: Implementa reentrancy guards, input validation e checked arithmetic
- Toolchain: Rust nightly (atualizado)
- Complete DEX with Factory, Router, and Pair contracts
- Native Staking with LUNES token and governance voting
- Trading Rewards with anti-fraud protection and tier system
- Hybrid Token Listing (admin + community governance)
- Advanced Security with comprehensive audit and optimization
- Architecture Overview
- Smart Contracts
- Advanced Features
- Getting Started
- Development Setup
- Deployment
- Testing
- Security
- Networks
- Documentation
- Contributing
- Status
- Versions
- License
Lunex DEX is built with a modular architecture that ensures scalability, security, and maintainability:
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β π Factory ββββββ π Pair ββββββ π£οΈ Router β
β Contract β β Contracts β β Contract β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
βββββββββββββββββββββββββΌββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ
β β β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β π₯© Staking β β π Trading β β πͺ WNative β
β + Governance β β Rewards β β Token β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
- Uniswap V2 Compatible: Battle-tested AMM model
- Native LUNES Integration: 8 decimal places support
- 0.5% Total Fee Structure: Optimized distribution
- Community Governance: Democratic token listing
- Anti-Fraud Protection: Advanced security measures
| Contract | Description | Features |
|---|---|---|
| π Factory | Creates and manages trading pairs | Deterministic pair creation, fee management |
| π Pair | Individual AMM pools | Uniswap V2 compatibility, optimized gas usage |
| π£οΈ Router | Main trading interface | Multi-hop swaps, slippage protection |
| πͺ WNative | Wrapped LUNES token | Native token wrapping/unwrapping |
| Contract | Description | Features |
|---|---|---|
| π₯© Staking | LUNES staking + governance | Tiered rewards, proposal voting, paginatedrewards |
| π Trading Rewards | Volume-based rewards | Anti-fraud protection, configurable parameters, epoch system |
- 60% β Liquidity Providers (0.3%)
- 15% β Development/Team (0.075%)
- 15% β Trading Rewards (0.075%)
- 10% β Staking Rewards (0.05%)
- Tiered Rewards: Bronze, Silver, Gold, Platinum (up to 15% APY)
- Governance Power: Vote on token listings and protocol changes
- Early Adopter Bonuses: Special rewards for first 100/500/1000 stakers
- Volume Tiers: Bronze β Platinum based on monthly volume
- Anti-Fraud: Cooldown periods, volume limits, blacklist system
- Configurable Parameters: Admin-adjustable fraud prevention
- Epoch System: Weekly/monthly reward distributions
- Hybrid Listing: Admin + community-driven token approval
- Dynamic Fees: Community can adjust proposal fees (starts at 1,000 LUNES)
- Fee Redistribution: Rejected proposals fund development and rewards
- Connect Lunes Wallet β Access the DEX interface
- Stake LUNES β Earn rewards and governance power
- Add Liquidity β Earn fees from trading pairs
- Trade Tokens β Low fees, high security
- Claim Rewards β From staking and trading activity
- Clone Repository β Get the latest code
- Setup Environment β Rust, ink!, cargo-contract
- Build Contracts β Compile and test
- Deploy to Lunes β Use provided scripts
- Integrate β Connect your dApp
- Rust (stable toolchain)
- cargo-contract CLI (latest version)
- Node.js and Yarn (for scripts)
- Lunes Network access
# Clone repository
git clone https://github.com/lunes-platform/lunex-dex.git
cd lunex-dex
# Install Rust dependencies
rustup target add wasm32-unknown-unknown
cargo install cargo-contract --force --locked
# Install Node.js dependencies
yarn install
# Build all contracts
cargo build --workspace
# Run all tests
cargo test --workspace# Deploy to testnet
yarn deploy:testnet
# Deploy to mainnet
yarn deploy:mainnet
# Admin list tokens (for initial setup)
yarn admin-list-token
# Verify deployment
yarn verify:deployment# Build contracts
yarn compile:all
# Deploy contracts
yarn deploy:lunes
# List tokens via governance
yarn list-token
# Verify deployment
yarn verify:deployment# Run all contract unit tests
cargo test --workspace
# Test specific contract
cd uniswap-v2/contracts/factory && cargo test
cd uniswap-v2/contracts/router && cargo test
cd uniswap-v2/contracts/staking && cargo test
cd uniswap-v2/contracts/rewards && cargo test
cd uniswap-v2/contracts/wnative && cargo test# Run TypeScript integration tests
yarn test
# Run Rust integration tests
cargo test --test integration_e2e- Factory Contract: 10/10 tests β
- Router Contract: 18/18 tests β
- Pair Contract: 10/10 tests β
- Staking Contract: 12/12 tests β
- Trading Rewards: 13/13 tests β
- WNative Contract: 13/13 tests β
- Reentrancy Protection β Guards against malicious calls
- Access Control β Role-based permissions
- Input Validation β Comprehensive parameter checking
- Overflow Protection β Safe arithmetic operations
- Anti-Fraud System β Trading rewards protection
- β OpenZeppelin Security Review compliance
- β Code Review by security experts
- β Gas Optimization analysis
- β Stress Testing completed
- β Production Deployment ready
- π Third-party Audit scheduled Q1 2025
- Testnet:
wss://ws-test.lunes.io - Mainnet:
wss://ws.lunes.iowss://ws-lunes-main-01.lunes.iowss://ws-lunes-main-02.lunes.iowss://ws-archive.lunes.io
- Symbol: LUNES
- Decimals: 8
- Network: Lunes (Substrate-based)
docs/guides/β Deployment and usage guidesdocs/reports/β Security audits and reportsdocs/β Technical documentationexamples/β Configuration examplesscripts/β Deployment and management scripts
We welcome contributions! Please follow these guidelines:
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Test your changes (
cargo test --workspace) - Commit with clear messages (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Rust: Follow
rustfmtandclippyrecommendations - Tests: Maintain 100% test coverage for new features
- Security: All changes must pass security review
- Documentation: Update relevant docs and comments
- π Security audits and improvements
- β‘ Gas optimization enhancements
- π§ͺ Testing expansion and edge cases
- π Documentation and tutorials
- π Frontend development (coming soon)
- Lunes Platform - Blockchain infrastructure
- ink! - Smart contract framework
- OpenBrush - Security standards reference
- Uniswap V2 - AMM model inspiration
| Component | Status | Progress |
|---|---|---|
| Core DEX | β Complete | Factory, Router, Pair contracts |
| Staking & Governance | β Complete | LUNES staking, voting, proposals |
| Trading Rewards | β Complete | Anti-fraud, tiers, epoch system |
| Security Audit | β Complete | OpenZeppelin compliance |
| Gas Optimization | β Complete | Optimized for production |
| Testing Suite | β Complete | 76/76 tests passing |
| Documentation | β Complete | Comprehensive guides |
| Deployment Scripts | β Complete | Automated deployment |
| Mainnet Ready | β Complete | Lunes Network compatible |
- π External Audit (Q1 2025)
- π Frontend Interface (Q2 2025)
- π± Mobile App (Q3 2025)
- π Cross-chain Bridge (Q4 2025)
- π Multi-chain Support (Q4 2025)
- ink!: 5.1.1 (stable)
- Rust: stable toolchain (2025 edition)
- Substrate: Compatible
- cargo-contract: latest
- scale-codec: 3.x
- scale-info: 2.10
- ink_env: 5.1.1
- ink_storage: 5.1.1
- Migration Completed: ink! 4.0 β ink! 5.1.1
- Security Enhanced: OpenZeppelin compliance
- Gas Optimized: Production-ready efficiency
- Testing: 100% coverage maintained
Lunex DEX is open source and released under the Apache 2.0 License.
- β Commercial use allowed
- β Modification allowed
- β Distribution allowed
- β Private use allowed
β οΈ Trademark use not granted
π Built with β€οΈ for the Lunes ecosystem π