Smart Contracts
The smart contract system is the foundation of GO Swap, handling all on-chain operations for token swaps and liquidity management.
Core Contracts
LiquidityPool
The primary contract that manages reserves, swaps, and liquidity provisioning.
Responsibilities:
- Maintain token reserves (x and y)
- Execute swaps using constant product formula
- Manage liquidity additions and removals
- Emit events for indexer tracking
- Calculate and distribute fees
Key Functions:
function swap(uint256 amountIn, address tokenIn, address tokenOut)
function addLiquidity(uint256 amountA, uint256 amountB)
function removeLiquidity(uint256 lpTokens)
function getReserves() returns (uint256, uint256)
Factory (Future)
Creates new pools for token pairs permissionlessly.
Responsibilities:
- Deploy new pool contracts
- Track all deployed pools
- Prevent duplicate pools for same pairs
- Manage pool creation fees
Router (Future)
Provides optimized routing for multi-hop swaps.
Responsibilities:
- Calculate optimal swap paths
- Execute multi-hop transactions
- Minimize slippage across routes
- Handle deadline and slippage protection
Token GO
Native utility token of the ecosystem.
Responsibilities:
- Governance voting (future)
- Fee incentives and rewards
- Ecosystem utility functions
- Liquidity mining distributions
Contract Standards
All contracts follow:
✅ EVM Compatibility - Works on all EVM-compatible chains
✅ ERC-20 Standard - Full token standard compliance
✅ Security Best Practices - Reentrancy guards, safe math
✅ Gas Optimization - Efficient execution patterns
✅ Event Emission - Comprehensive logging for transparency
Deployment
All contracts are deployed on Binance Smart Chain (BSC) initially, with future multi-chain deployments planned.
Testnet Deployment: BSC Testnet (for testing and audits)
Mainnet Deployment: BSC Mainnet (production)
Security Model
GO Swap follows a non-custodial security design:
🔒 Users keep control of private keys
🔒 Smart contracts are immutable after deployment
🔒 No centralized fund custody
🔒 Transparent on-chain execution
Security Measures:
- Contract audits (planned)
- Rate-limited RPC usage
- Safe token approval flows
- Replay protection via blockchain finality