> Feedback: If these docs are stale, missing, or confusing, post sanitized feedback to `https://docs.tempo.xyz/api/feedback` with `source: "mcp"`, a short `message`, and any relevant `toolName`, `relatedResource`, or `client`.
# Exchanging Stablecoins

Tempo features an enshrined decentralized exchange (DEX) designed specifically for trading between stablecoins of the same underlying asset (e.g., USDG to USDT). The exchange provides optimal pricing for cross-stablecoin payments while minimizing chain load from excessive market activity.

The exchange operates as a singleton precompiled contract at address `0xdec0000000000000000000000000000000000000`. It maintains an orderbook with separate queues for each price tick, using price-time priority for order matching.

Trading pairs are determined by each token's quote token. All TIP-20 tokens specify a quote token for trading on the exchange. See [Quote Tokens](/docs/protocol/exchange/quote-tokens) for more information on quote token selection and the optional [pathUSD](/docs/protocol/exchange/quote-tokens#pathusd) stablecoin. See the [Stablecoin DEX Specification](/docs/protocol/exchange/spec) for detailed information on the exchange structure.

The exchange supports three types of orders, each with different execution behavior:

| Order Type | Description |
|------------|-------------|
| [**Limit Orders**](/docs/protocol/exchange/providing-liquidity#limit-orders) | Place orders at specific price levels that wait in the book until matched or cancelled. Orders are added to the book immediately when placed. |
| [**Flip Orders**](/docs/protocol/exchange/providing-liquidity#flip-orders) | Special orders that automatically reverse to the opposite side when completely filled, acting like a perpetual liquidity pool. When a flip order is fully filled, the same `orderId` is rewritten on the opposite side and emits `OrderFlipped`. |
| [**Market Orders**](/docs/protocol/exchange/executing-swaps#swap-functions) | Execute immediately against the best available orders in the book (via swap functions). Swaps and cancellations execute immediately within the transaction. |

For the complete execution mechanics, see the [Stablecoin DEX Specification](/docs/protocol/exchange/spec).

To get started with the exchange, explore these guides:

<Cards>
  <Card description="Quote prices and swap between stablecoins" to="/docs/protocol/exchange/executing-swaps" icon="lucide:arrow-left-right" title="Executing Swaps" />

  <Card description="Place orders and flip orders to earn spreads" to="/docs/protocol/exchange/providing-liquidity" icon="lucide:droplet" title="Providing Liquidity" />

  <Card description="Manage token balances on the DEX to save gas costs" to="/docs/protocol/exchange/exchange-balance" icon="lucide:wallet" title="DEX Balance" />
</Cards>

:::info
For a more complete technical specification including design decisions and details of execution semantics, see the [Stablecoin DEX Specification](/docs/protocol/exchange/spec).
:::
