Introduction
Coinswap is an innovative token exchange protocol implemented on IRISHub, enabling seamless token-to-IRIS and token-to-token conversions through automated on-chain processes. Built upon the Constant Product Market Maker Model, this decentralized exchange mechanism revolutionizes asset management within the IRISHub ecosystem.
Key Concepts Explained
Liquidity Pool Mechanics
The liquidity pool operates as a self-governing system account containing three core components:
- IRIS tokens
- Partner tokens
- Liquidity securities (transferable certificates representing market maker shares)
Each token (excluding IRIS) maintains its own dedicated pool to facilitate accurate price calculations.
Understanding Market Dynamics
The protocol employs the constant product formula: x * y = k
, where:
x
= Quantity of Token Xy
= Quantity of Token Yk
= Constant value (only changes during liquidity adjustments)
๐ Discover how liquidity pools create trading opportunities
Core Operations Breakdown
1. Adding Liquidity
Market makers contribute to pool stability while earning transaction fees:
Creating New Liquidity Pools
- Requires proportional deposits of both tokens based on current market rates
- Initializes pool pricing through organic market forces
- Arbitrage opportunities naturally align prices with market values
Expanding Existing Pools
- Mandates deposits matching current pool ratios
- Prevents arbitrage-related losses for market makers
- Issues transferable liquidity certificates upon deposit
2. Executing Token Swaps
Users can exchange tokens through two primary methods:
Transaction Type | Calculation Method | Success Conditions |
---|---|---|
Buy Order | Output-based input calculation | Payment โฅ computed value |
Sell Order | Input-based output calculation | Request โค computed value |
All transactions incur a 0.3% fee (configurable via governance proposals), including cross-token conversions that route through IRIS intermediary steps.
3. Removing Liquidity
Market makers can:
- Redeem certificates for original deposits
- Claim accumulated trading fees
- Automatically burn equivalent liquidity shares
Implementation Details
The module exclusively offers REST API endpoints for transactions. Developers can explore the Coinswap Exchange reference implementation for practical integration examples.
๐ Learn advanced DeFi strategies for liquidity providers
FAQ Section
How does Coinswap ensure price stability?
The constant product formula and arbitrage mechanisms naturally maintain prices aligned with broader market values without centralized intervention.
What benefits do market makers receive?
Providers earn 0.3% fees from all transactions proportional to their pool share, with flexible withdrawal options and transferable liquidity certificates.
Can I swap between any two tokens directly?
Yes, the protocol supports both direct token-to-IRIS and indirect token-to-token exchanges (with two-step IRIS conversion).
How is the 0.3% fee distributed?
The entire fee gets reinvested into liquidity pools, directly benefiting active market makers.
What happens during high volatility?
The flexible withdrawal system allows market makers to quickly adjust positions, while the mathematical model automatically adjusts exchange rates to reflect current market conditions.