ve(3,3) Meta DEX Development | SwapX Case Study

Development Scope
We started with the THENA codebase and customized it extensively—delivering 30+ smart contracts, backend logic, and a complete frontend to bring all components together into one seamless, ve(3,3) DEX.
Here’s a quick overview of the key modules and what each one does:
How It All Works
SwapX brings together liquidity, incentives, and governance into one coordinated loop. Here's how the full cycle works, using automated concentrated liquidity as an example:
From LP to Voting Power to Rewards

1. Provide Liquidity via ICHI
Users deposit one token (not a full pair) into an ICHI vault — an automated liquidity manager integrated with Algebra’s CLMM. In return, they receive ICHI Vault ERC20 tokens.
2. Stake ICHI Vault Tokens to Gauges
These tokens are then staked to the relevant gauge. Based on the gauge's share of the weekly vote, the user earns $SWPX emissions as LP rewards.
3. Lock SWPX → Get veSWPX
The user can lock earned $SWPX in the voting escrow contract, receiving veSWPX — an NFT with voting power based on amount and lock time.
4. Vote to Direct Emissions
veSWPX holders vote on gauges to determine next week’s emissions allocation. The more votes a gauge gets, the more rewards it distributes.
5. Earn Voter Incentives
Voters earn two kinds of bribes:
– Internal bribes: a share of swap fees generated by the gauge
– External bribes: manually added incentives from protocols and partners
They also receive rebase rewards, which increase their veSWPX balance weekly.
Liquidity provision
SwapX offers diverse liquidity pools designed for different strategies and asset types, balancing capital efficiency with ease of use.
Concentrated Liquidity
CLAMM is powered by Algebra’s engine, allowing liquidity providers (LPs) to concentrate their liquidity within specific price ranges. Liquidity outside these ranges doesn’t earn fees and requires active management. To simplify this, SwapX integrates ICHI’s Automated Liquidity Manager (ALM), where users deposit a single token into an ICHI vault. The ALM automatically manages and rebalances positions within Algebra’s CLMM pools. Users receive ICHI vault ERC20 tokens, which can then be staked in gauges to earn $SWPX emissions based on weekly voting results.
LPs can also provide liquidity manually by depositing both tokens of a pair directly to the pool, receiving LP NFTs and earning swap fees.
Classic Liquidity
Classic pools, forked from Thena, include:
a. Volatile Pools (CPMM)
Employ the constant product formula (x * y = k), uniswap v2 like pools
b. Stable Pools (CFMM)
Curve-style pools optimized for stable or closely correlated assets, using a constant sum formula to reduce slippage and price impact.
In both classic pools, LPs earn swap fees by holding LP tokens or boost rewards by staking LP tokens in gauges. Staked LPs receive weekly $SWPX emissions allocated by voters. Emissions earned can be locked to gain veSWPX voting power, linking liquidity provision to governance.
Voting System & ve(3,3) Model
This is where the core of ve(3,3) lives, built around voting escrow, voting, gauges, and bribes, all working together to align incentives and govern emissions distribution.
Voting Escrow
Users start by locking their $SWPX tokens in the voting escrow contract, receiving veSWPX — an NFT representing their voting power. This power depends on the amount locked and the lock duration, gradually decreasing as the lock nears expiration. veSWPX tokens can be extended, merged, split, or withdrawn once expired, giving users full control over their voting assets.
Voting
Each week, during a defined voting period called an epoch (Thursday 00:00 UTC to the next Thursday 00:00 UTC), veSWPX holders vote for liquidity pools, called gauges, to decide how the weekly $SWPX emissions are allocated. Pools with more votes receive larger shares of emissions, resulting in higher APRs that attract more liquidity and reduce trading slippage.
Rewards
To further reward governance participation, voters earn bribes — which come in two forms: internal bribes, paid from the swap fees generated by the pools they support, and external bribes, offered by partners or protocols as additional incentives. On top of that, veSWPX holders receive rebase rewards that increase their locked token balance over time, encouraging long-term commitment.
Ecosystem Integrations
SwapX integrates with a variety of external protocols and services to enhance its functionality, user experience, and incentives system:
Core infra
- Algebra: Powers SwapX’s concentrated liquidity AMM and supports custom swap fee structures.
- ICHI: Provides automated liquidity management for CLMM pools, simplifying single-token deposits and position rebalancing for LPs.
- Orbs: Offers off-chain services enabling vote automation and advanced gauge features like boosting and timing controls.
- TradingView: Integrated charts and market data visualization via The Graph subgraphs.
User incentives
Additionally, SwapX participates in several ecosystem-wide points and rewards programs to expand user incentives and community engagement:
- Sonic Points: Sonic blockchain’s native points program for airdrops and rewards.
- Origin Protocol (Points): A decentralized commerce platform’s rewards integration.
- Gems (Points): Gamified social token ecosystem for community incentives.
- yUSD Points (Yieldfi): Yieldfi’s point-based rewards for liquidity and yield farming.
- Rings (Points): Community and engagement points used in various dApps.
How Token Flows Are Managed
$SWPX Emissions
Weekly emissions are split into several tranches, evolving over time based on the rebase mechanism:
- Gauges receive the majority of emissions, starting at 92% in epoch 1 and decreasing to 62% by epoch 22 as rebase rewards increase. Allocations among Gauges are determined by the previous week’s vote.
- Rebase rewards start at 10% and increase 1% weekly, capping at 30%. These are distributed to veSWPX holders who actively vote.
- Team Allocation is fixed at 3% per epoch. During the first 12 epochs, this portion is redirected to xNFT holdersbefore flowing to the team wallet.
- Referral System receives 5% of weekly emissions, sent to a dedicated contract. Any unused portion rolls over to the next week and is added to gauge emissions, distributed based on the latest voting results.
Bribes:
Voters receive two types of bribes as additional incentives:
- Internal Bribes: Derived from a share of swap fees generated by the gauges they support.
- External Bribes: Additional rewards supplied by partners or protocols to encourage votes on specific gauges.
Swap Fees
Swap fees on SwapX are divided into four main tranches:
- xNFT Staking (20%)
- Algebra (3%)
- LPs and Gauges (73%)
- Treasury (4%)
There are two AMMs on the platform: Algebra’s CLMM (which we do not own and cannot modify) and SwapX’s native DEX. The fee flow differs slightly between these.
On Algebra DEX:

- Algebra takes a fixed 3% fee.
- 27% of fees go to the Algebra Community, then flow to the FeesVault contract.
- From FeesVault, fees are split between the Treasury and xNFT staking rewards.
- The remaining fees are distributed among manual LPs and gauges (the latter translating to voter rewards).
On SwapX’s native classic liquidity pools:
Fees flow directly to their destinations (Treasury, xNFT staking, LPs, and gauges) without intermediate steps.

Customization Highlights
Although SwapX is based on the THENA codebase, a significant amount of work was needed to tailor it to the new environment and project goals.
- Initial deployment: The project was originally planned for OKX Chain (zkEVM), but zkCounters introduced compatibility issues with key parts of THENA’s logic. This required low-level adjustments and ultimately led to a migration to Sonic.
- Adapting to Sonic's speed: Sonic is extremely fast, which broke assumptions baked into THENA’s reliance on The Graph. Neither The Graph nor Alchemy could keep up in real time, so we built custom indexers to ensure up-to-date data and responsive UI components.
- Codebase customizations: While core AMM math remained untouched, we made extensive changes across the codebase — including emissions logic, fee distribution tranches, NFT staking mechanics, and gauge vote tracking.
- 30+ interlinked contracts: The system includes over 30 smart contracts. With so many touchpoints between modules, careful attention was needed to maintain logic integrity while extending functionality.
Results & Impact
- Complex Codebase Customization
We extended THENA’s codebase with extensive customizations—covering token emissions, swap fee tranches, NFT staking, and governance voting—while preserving core AMM math and maintaining logic integrity across 30+ interdependent smart contracts. - Ecosystem Protocols Integration:
We seamlessly integrated critical third-party protocols including Algebra for concentrated liquidity, ICHI for automated liquidity management, and Orbs for off-chain vote automation, significantly enhancing SwapX’s features and user experience. - Collaborative Partnership:
Our team worked closely with the client, iterating swiftly on design, features, and performance to transform an ambitious product vision into a scalable, maintainable, and production-ready platform.