Stellar
CosmoDEX
Launch a token, seed a pool and trade it, all on Soroban.
Overview
A permissionless DEX on Stellar. Anyone can deploy a token, create a pool for any pair through a factory, add or remove liquidity for LP tokens, and swap with a constant-product formula and a 0.3% fee, including native XLM pools.
The problem
Launching a token and giving it a market on Soroban took several tools and manual contract deployments.
What I built
- Token contract: mint, transfer, approve, burn and admin, used for both launched tokens and LP tokens
- Pool contract: proportional liquidity, LP mint and burn, and swaps with checked arithmetic throughout
- PoolFactory: one pool per pair, deployed and indexed for discovery
- Invariant checks covering precision loss, pool initialisation edge cases and reserve imbalance; a public USDC faucet in the UI
Under the hood
How it flows
ArchitectureLive
CosmoDEX
01Launch token
02Factory creates pool
03Add liquidity
04Swap (x·y=k)
05Burn LP
Rust / SorobanNext.jsTypeScript
