Products
SWSS DEX
Pre-launch
Section
Products
Documentation category
Type
Guide
Technical reference
Summary
SWSS DEX, the SwssChain decentralised exchange for on-chain SWSS Coin and ecosystem asset trading with an automated market maker and on-chain order matching.
SWSS Foundation Notice

This documentation is restricted to authorised members of the SWSS Developer Community. Access is granted exclusively through SWSS DevHub, after KYB and SWSS Foundation approval.

All SwssChain GitHub repositories are private. Significant updates are currently deploying across the full SWSS Ecosystem. SDK and API specifications are subject to change at any time in accordance with security requirements and SwssChain Foundation governance decisions.

Join SWSS DevHub →Have a question? Use the Need Help? button below.
SDK Update Notice

SWSS SDK v2.1 is deploying across the ecosystem. API signatures may change during this period. Ensure your integration uses the latest schema from SWSS DevHub.

Article Content

SWSS DEX

SWSS DEX is the SwssChain-native decentralised exchange (DEX) for on-chain asset trading. It implements an automated market maker (AMM) model with concentrated liquidity, enabling efficient price discovery and low-slippage trading for SWSS Coin and other assets issued on SwssChain. All trading operations (liquidity provision, swaps, and fee collection) execute on-chain with full transparency.

Trading Model

SWSS DEX uses a concentrated liquidity AMM where liquidity providers specify a price range within which their capital is deployed. This increases capital efficiency compared to traditional constant-product AMMs by concentrating liquidity around the current market price.

The core invariant for a given liquidity position within its active range is:

(x + L / sqrt(P_upper)) × (y + L × sqrt(P_lower)) = L²

Where x and y are the reserve amounts of the two assets, L is the liquidity depth, and P_upper / P_lower are the upper and lower price bounds of the position.

Supported Trading Pairs

Pair Status Fee Tier
SWSS / USDCQ4 20270.05%, 0.3%, 1%
SWSS / USDTQ4 20270.05%, 0.3%
SWSS / WETHQ3 20260.3%, 1%

DEX Smart Contracts

SWSS DEX is implemented as a set of immutable smart contracts on SwssChain. The core contracts are:

  • DEX Factory: Deploys and tracks all trading pair pool contracts.
  • DEX Router: The user-facing contract for submitting swaps and managing multi-hop routes.
  • DEX Pool: Individual concentrated liquidity pool contracts, one per trading pair and fee tier.
  • DEX Position Manager: Manages liquidity provider positions as on-chain records using the Deed Transaction Standard's position tracking extension.

SDK Integration

import { SwssChain, networks } from '@swsschain/sdk';
import { DexRouter } from '@swsschain/dex-sdk';

const client = new SwssChain({
  network: networks.mainnet,
  privateKey: process.env.PRIVATE_KEY as `0x${string}`,
});

const dex = new DexRouter(client);

// Get quote for a swap
const quote = await dex.getQuote({
  tokenIn: 'SWSS',
  tokenOut: 'USDC',
  amountIn: client.parseSWSSCoin('100'),  // 100 SWSS
  slippageTolerance: 0.005,               // 0.5%
});

console.log('Expected output:', quote.amountOut, 'USDC');

// Execute swap
const txHash = await dex.swap({
  ...quote,
  deadline: Math.floor(Date.now() / 1000) + 300, // 5 minutes
});

Liquidity Provision

Liquidity providers earn trading fees proportional to their share of the active liquidity in a pool. Fees accumulate in the pool contract and are redeemable at any time. Providing liquidity to SWSS DEX is subject to the standard risks associated with AMM liquidity provision, including impermanent loss resulting from price divergence between the deposited assets.

Settlement Combustion Model

DEX swap transactions are standard SwssChain transactions subject to the Transactional Settlement Levy at the network level. The DEX protocol fee (the fee tier selected at pool creation) is separate from and in addition to the TSL. Protocol fees are distributed to liquidity providers in proportion to their active position depth at the time of each swap.