# Qoq

> Qoq is the StableSwap AMM on Intear DEX: pools of two assets that trade close to a price, fixed or read by an oracle from exchanges, with multi-pool and split routes, liquidity shares and one fee per pool.

This page is part of the Qoq docs. Qoq is the DEX `slimedragon.near/amp` on the Intear DEX contract, `dex.intear.near`, and every call goes to that contract. https://docs.intear.tech/qoq/llms-full.txt has all of its pages in one file, and https://docs.intear.tech/llms.txt lists every page of the Intear docs.

Qoq is an AMM (automated market maker) that runs inside [Intear DEX](https://docs.intear.tech/intear-dex.md). Its pools hold two assets each and trade them on a StableSwap curve around a price. The price is either fixed, for assets worth the same like two dollar stablecoins, or the median of the prices that an [oracle](https://docs.intear.tech/intear-dex/guides/oracles.md) reads from several exchanges. While a pool is balanced, it trades close to that price, so large swaps move the price little.

Qoq is a DEX on the engine, so there's no Qoq contract to call. Every call goes to the engine, `dex.intear.near`, with Qoq's DEX ID:

```
slimedragon.near/amp
```

- Swaps use the engine's [`swap_simple`](https://docs.intear.tech/intear-dex/guides/swaps.md) or [operations](https://docs.intear.tech/intear-dex/guides/operations.md), with Qoq routes in `message`. A swap through a pool that an oracle prices starts with an [oracle request](https://docs.intear.tech/qoq/guides/swaps.md#pools-an-oracle-prices).
- Everything else, like adding liquidity, is a [`dex_call`](https://docs.intear.tech/intear-dex/guides/dexes.md#dex_call), and reads are [`dex_view`](https://docs.intear.tech/intear-dex/guides/dexes.md#dex_view).
- Arguments and results are [Borsh](https://borsh.io/), in base64. [Types](https://docs.intear.tech/qoq/reference/types.md) has the layout of each.

The examples use [near CLI](https://docs.intear.tech/intear-dex/quickstart.md#before-you-start), like the Intear DEX docs.

:::caution
The contracts are not audited.
:::

## Pools

Each pool has an ID, counted from 0 in the order pools were created. Pool 0 is NEAR/USDC, priced by an oracle, and pool 1 is USDt/USDC, at a fixed price of 1. Pools can hold NEAR, NEP-141 and NEP-245 assets.

Only Qoq's owner, slimedragon.near, creates pools, and it can change a pool's amplification, fee and oracle. Anyone can add liquidity to any pool and get shares of it. See [Pools](https://docs.intear.tech/qoq/guides/pools.md).

## Fees

Each pool has one fee, out of the input of every swap. Qoq takes 20% of it as its protocol fee, and the rest goes to the pool's liquidity providers, in the asset each one chooses. Swaps on a pool that an oracle prices also pay the oracle's fee, for each request. Apps charge their own fee on the swaps they bring with Intear DEX's [referral fees](https://docs.intear.tech/intear-dex/guides/referral-fees.md).

## What you can do

- **Swap**: Through one pool, a chain of pools, or split across several routes, in one swap.
- **Quote**: Simulate swaps on pools that an oracle prices, with the prices you pass.
- **Provide liquidity**: Add both assets of a pool and earn its fees, in either asset.
- **Earn referral fees**: Charge up to 5% on the swaps your app sends, with Intear DEX's [referral fees](https://docs.intear.tech/intear-dex/guides/referral-fees.md).

## Next steps

- [Swaps](https://docs.intear.tech/qoq/guides/swaps.md): The swap message, oracle requests, quotes, and how prices work.
- [Methods](https://docs.intear.tech/qoq/reference/methods.md): Every call and view of Qoq.
- [DEX Aggregator](https://docs.intear.tech/dex-aggregator.md): Get Qoq routes built for you, oracle request included, as ready-to-sign transactions.
