Pixpel DEX: Decentralized Exchange Protocol
Version 1.0 | Date: September 15, 2025 | Prepared by: Pixpel Team
Abstract
Pixpel DEX is an automated market maker (AMM) decentralized exchange protocol built on EVMcompatible blockchains. The protocol enables permission-less token swaps and liquidity provision through a system of smart contracts that implement constant product market maker logic. PixpelSwap features enhanced chain-specific configurations, including specialized support for restricted networks (e.g. SKALE etc), making it adaptable to various blockchain ecosystems while maintaining security and efficiency
1. Introduction
A. Background
Decentralized exchanges have revolutionized cryptocurrency trading by eliminating intermediaries and enabling peer-to-peer token exchanges. Traditional centralized exchanges pose risks including custody concerns, single points of failure, and regulatory vulnerabilities. AMM based DEX solve these problems by using liquidity pools and algorithmic pricing.
B. Pixpel DEX Overview
Pixpel DEX is a fork of the proven Uniswap V2 architecture with enhancements for multi-chain deployment. The protocol consists of:
- Factory Contract: Deploys and tracks liquidity pair contracts
- Router Contracts:User-facing interfaces for swaps and liquidity management
- Pair Contracts: Individual liquidity pools implementing AMM logic
- Migration Contract: Facilitates upgrades from legacy versions.
C. Key Features
- Permission-less liquidity pool creation.
- Automated market making with constant product formula.
- ERC-20 token standard support.
- Fee-on-transfer token compatibility.
- Meta-transaction support via EIP-2612 permits.
- Chain-specific configuration for network restrictions.
- Flash swap capabilities.
2. System Architecture
A. Core Components
1. Pixpel Swap Factory
The factory contract serves as the registry and deployment mechanism for all trading pairs.
Key Functions
- createPair(): Deploys new pair contracts using CREATE2 for deterministic addresses.
- setFeeTo(): Configures protocol fee recipient
- setSkaleChainConfig(): Manages chain specific restrictions.
Chain Restrictions
On the restricted networks (like SKALE), the factory prevents creation of pairs involving the native WETH token to comply with network-specific requirements.
2. Pixpel Swap Pair
Each pair contract manages a liquidity pool for two ERC-20 tokens.
Core Mechanisms
- Liquidity Provision: Users deposit token pairs and receive LP tokens representing pool share.
- Swapping: Traders exchange tokens using the constant product formula (x × y = k).
- Price Oracle: Cumulative price tracking for external price feeds.
- Fee Structure: A 0.3% swap fee distributed to liquidity providers
Core Mechanisms
- Reentrancy protection via mutex locks.
- Overflow protection with SafeMath.
- Minimum liquidity lock (1000 wei) to prevent inflation attacks.
3. Pixpel Swap Router02
The PixpelSwapRouter02 contract provides a user-friendly interface for interacting with pairs.
Functionality
- Optimal routing for multi-hop swaps.
- Slippage protection via minimum output parameters.
- Deadline enforcement to prevent stale transactions.
- ETH wrapping/unwrapping for native token trades.
- Permit-based approvals for gasless transactions.
Restricted Networks Handling
Router02 includes chain ID checks to restrict ETH-based operations on the restricted networks(e.g. SKALE etc), ensuring compliance with network specifications
B. Mathematical Model
1. Constant Product Formula
The protocol uses the constant product market maker model:
x × y = k
Where:
- x = reserve of token A
- y = reserve of token B
- k = constant product
2. Token Price Mechanism
Token price is determined by the ratio of reserves:
Price of A in terms of B = y / x
Price of B in terms of A = x / y
3. Swap Calculation
For a swap of ∆x input tokens, the output ∆y is:
∆y = (y × ∆x × 997) / x × 1000 + ∆x × 997
The factor 997 / 1000 accounts for the 0.3% trading fee.
3. Economic Model
A. Fee Structure
Trading Fees
- 0.3% fee on all swaps
- Entire fee distributed to liquidity providers
- Optional protocol fee (currently disabled)
Protocol Fee Mechanism
When enabled, one-sixth of trading fee growth goes to the protocol treasury, calculated as:
Protocol Fee = (√knew −√kold) / 6
B. Liquidity Provider Economics
Returns
- Proportional share of all trading fees.
- Impermanent loss risk from price divergence.
- LP tokens are ERC-20 compatible and trade-able.
Liquidity Mining: LP tokens can be staked in external contracts for additional yield farming opportunities.
4. Technical Specifications
A. Smart Contract Standards
- Solidity Version: 0.5.16 (Pair, Factory, ERC20), 0.6.0 (Router, Migrator)
- ERC-20:Full compliance for LP tokens
- EIP-2612: Permit functionality for gasless approvals
- EIP-712: Typed structured data hashing
B. Security Measures
Contract-Level
- Reentrancy guards on all state-changing functions
- SafeMath for arithmetic operations
- Access control for administrative functions
- Immutable core parameters (factory, WETH addresses)
Protocol-Level
- Minimum liquidity lock to prevent manipulation
- Deadline checks to prevent transaction replay
- Slippage protection parameters
- Path validation for multi-hop swaps
C. Gas Optimization
- Single storage slot packing for reserves and timestamp
- Cached values to reduce SLOAD operations
- Efficient loop structures in routing logic
- CREATE2 for deterministic pair addresses
5. Multi-Chain Strategy
A. Network Integration
Pixpel DEX includes specialized logic for Restricted network deployment.
Restrictions
- Native ETH/WETH pairs prohibited on Restricted Networks(e.g. SKALE)
- Restricted Network WETHaddress(e.g. SKALE): 0x95ac999302Ff402b39A8B952a662863338585d3c
- Configurable via setSkaleChainConfig() in factory
Rationale
The Restricted network has unique fee structures and native token handling that require custom implementation separate from ETH-compatible chains
B. Chain Agnostic Design
The core AMM logic remains chain-agnostic, with chain-specific configurations isolated to:
Restrictions
- Factory pair creation restrictions
- Router ETH operation gates
- Configurable chain ID parameters
6. Use Cases
A. Token Trading
Users can swap any ERC-20 token pair without intermediaries:
- Direct token-to-token swaps
- Multi-hop routing for optimal rates
- Native ETH trading via WETH wrapper (where supported)
B. Liquidity Provision
Token holders can earn passive income by:
- Providing liquidity to trading pairs
- Earning proportional trading fees
- Participating in liquidity mining programs
C. Price Discovery
The protocol serves as a decentralized price oracle:
- Cumulative price accumulators
- Time-weighted average price (TWAP) calculation
- Resistant to manipulation via liquidity depth
D. Flash Swaps
Advanced users can borrow tokens for atomic transactions:
- Arbitrage opportunities
- Collateral swapping
- Liquidation protection
7. Governance and Administration
A. Factory Administration
Fee Setter Role
- Controls protocol fee recipient address
- Manages chain-specific configurations
- Cannot modify existing pairs or user funds
B. Router Administration
Owner Role
- Updates Restricted chain configuration
- No control over user assets or transactions
- Limited to operational parameters
C. Decentralization Roadmap
Future governance mechanisms may include:
- Community voting via governance tokens
- Time-locked administrative actions
- Multi-signature requirements for critical operations
8. Security Considerations
A. Audited Components
Core AMM logic inherited from the battle-tested Uniswap V2 codebase with extensive security audits and years of production use.
B. Best Practices
Owner Role
- Set appropriate slippage tolerances
- Use deadline parameters
- Verify transaction details before signing
- Understand impermanent loss before providing liquidity
For Integrators
- Use router contracts, not pairs directly
- Implement proper error handling
- Cache pair addresses where possible
- Monitor price impact for large trades
9. Migration and Upgrades
A. PixpelSwapMigrator
The migration contract facilitates upgrades from legacy versions.
Process
- User approves migrator contract
- Migrator removes liquidity from V1 exchange
- Assets automatically re-deposited in V2 pair
- New V2 LP tokens issued to user
- Excess assets refunded
Safety Features
- Atomic execution (all-or-nothing)
- Slippage protection on re-deployment
- Deadline enforcement
10. Future Development
A. Planned Enhancements
Protocol Improvements
- Concentrated liquidity options
- Dynamic fee tiers
- Improved oracle mechanisms
- Layer 2 scaling solutions
User Experience
- Limit order functionality
- Advanced routing algorithms
- Aggregator integrations 11
- Mobile wallet support
B. Ecosystem Growth
Developer Tools
- SDK for integration
- Subgraph for data querying
- Analytics dashboard
- Testing frameworks
Community Initiatives
- Liquidity mining programs
- Developer grants
- Educational resources
- Partnership integrations
11. Conclusion
Pixpel DEX provides a robust, secure, and flexible decentralized exchange infrastructure suitable for multi-chain deployment. By building on proven AMM principles while adding chain-specific optimizations, the protocol enables efficient token trading and liquidity provision across diverse blockchain ecosystems.
The modular architecture allows for continuous improvement while maintaining backward compatibility and security. With proper risk management and community governance, Pixpel DEX aims to become a cornerstone of decentralized finance infrastructure.