Linkora-Dex
linkora-dex-contracts
JavaScript

Core smart contracts implementing upgradeable DEX functionality including routing, pools, trading, and optional governance systems

Last updated Apr 9, 2026
13
Stars
1
Forks
0
Issues
0
Stars/day
Attention Score
1
Language breakdown
No language data available.
โ–ธ Files click to expand
README

DEX Smart Contracts

Decentralized exchange with margin trading and upgradeable architecture

Quick Start

# Install dependencies
npm install

npx hardhat clean

rm -rf artifacts/ cache/ node_modules/.cache/

Compile contracts

npm run compile

or

npx hardhat compile --force

Start local network

npm run node

Deploy system (in new terminal)

npm run prod:infrastructure npm run prod:tokens npm run prod:pools

or

npm run prod:deploy:config

Verifi npm run infoPool

Start services

npm run price-generator-anvil # Price generator npm run keeper:upgradeable-anvil # Order executor npm run trading-demo-anvil # Trading demo

Architecture

Core DEX

Upgradeable Proxy Pattern
  • Router Proxy โ†’ Router Implementation
  • Pool Proxy โ†’ Pool Implementation
  • Trading Proxy โ†’ Trading Implementation
  • Oracle Proxy โ†’ Oracle Implementation
Configuration config/anvil_upgradeable-config.json

Governance Token (optional)

Additional features
  • Trading discounts up to 10%
  • Staking with rewards from fees
  • Voting system for governance
  • Premium access features
Configuration config/token-config.json

Main Features

Core DEX

  • โœ… Spot trading
  • โœ… Limit orders
  • โœ… Stop-loss orders
  • โœ… Margin trading
  • โœ… Liquidity providing
  • โœ… Upgradeable contracts
  • โœ… Flash loan protection
  • โœ… Circuit breaker

Governance Token (optional)

  • โœ… ERC-20 with extended functions
  • โœ… Trading discount system
  • โœ… Staking with doubled voting weight
  • โœ… Distribution of part of fees to stakers
  • โœ… Timelock governance with quorum
  • โœ… Premium features for large holders

Deployment and Management

Main system

Governance and tokenomics

Development Commands

Deploy and testing

# Full deployment pipeline
npm run prod:infrastructure  # Infrastructure
npm run prod:tokens         # Tokens and prices
npm run prod:pools          # Liquidity

Governance token

npm run deploy:governance-token npm run verify:governance-token

Testing

npm run test:integration npm run test:full-upgradeable npm run verify:upgrades

Services and automation

# Runtime services
npm run price-generator-anvil    # Price updates
npm run keeper:upgradeable-anvil # Order execution
npm run trading-demo-anvil       # Trading demonstration

Management

npm run pause # Emergency stop npm run unpause # Resume operation npm run cancel-all # Cancel all orders

Docker deployment

# Full development environment
./docker-run.sh full

Individual components

./docker-run.sh start # Node only ./docker-run.sh deploy # Contract deployment ./docker-run.sh services # Automation

Operating Principles

Modular architecture

  • Core DEX Fully functional without token
  • Governance Token Optional addition
  • Simple integration Token connects with one command

Router-centric design

  • All operations through single Router contract
  • Upgradeable without changing addresses
  • Backward compatibility guaranteed

Security

  • Timelock for all governance changes
  • Quorum for decision validity
  • Restrictions on critical parameters
  • Emergency stop capability
  • Flash loan protection
  • Circuit breaker mechanisms

Project Structure

โ”œโ”€โ”€ contracts/
โ”‚   โ”œโ”€โ”€ upgradeable/     # Main contracts
โ”‚   โ”œโ”€โ”€ governance/      # Governance token
โ”‚   โ”œโ”€โ”€ libraries/       # Logic libraries
โ”‚   โ””โ”€โ”€ access/         # Access control
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ prod_*          # Production deploy
โ”‚   โ”œโ”€โ”€ utils/          # Management utilities
โ”‚   โ””โ”€โ”€ tests/          # Integration tests
โ”œโ”€โ”€ config/             # Configurations
โ””โ”€โ”€ docs/              # Documentation

Security and Audit

  • Upgradeable proxy pattern with timelock protection
  • Comprehensive testing with >95% coverage
  • Static analysis with Slither
  • Emergency pause functionality
  • Multi-signature governance for critical operations

License

MIT License - see LICENSE for details

Contact Me

๐Ÿ“ซ Reach out on LinkedIn or Email or Telegram

Support

  • Technical documentation in docs/ folder
  • Usage examples in scripts/
  • Issues and questions through GitHub
๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท Linkora-Dex/linkora-dex-contracts ยท Updated daily from GitHub