# Every LithosDex pool

`GET /dex/pools` · Lithos client API · Lithos Dex

Source: https://lithosprotocol.org/docs/api/list-ld-pools

Every LithosDex pool on chain, ERG/token and token/token, ERG:LIT first, then verified pools, then newest first. Anyone can create a pool. A pool on the client's verified list was checked by hand; any other pool is checked against the facts its contracts take on trust at genesis, and `problems` lists each one it breaks. A pool with problems can be drained: do not trade with it.

Read from an index the client rebuilds in the background as blocks arrive, so a request never waits on a scan. `status` is `building` until the first index completes. Pools named in `lithosdex.pools.hidden` are left out; their own routes still answer.

## Responses

### 200: The pools, as the index last read them

`LDPoolList`

- `status` (string, required, one of building, ready)
- `height` (integer · int32, required): The tip the index was read at
- `truncated` (boolean, required): More pools exist than one index reads; the newest are listed.
- `pools` (LDPoolSummary[], required)
  - `poolNFT` (string, required)
  - `kind` (string, required, one of n2t, t2t): `n2t` is ERG against a token, `t2t` token against token
  - `utxoId` (string, required): The pool box the index read
  - `inclusionHeight` (integer · int32, required)
  - `tokenX` (LDPoolToken, required): One side of a pool. A verified token's name, ticker and decimals come from the client's verified list; any other token's from the node's token index, where whoever minted the token chose them. 
    - `tokenId` (string, required): Token id, or `ERG` for the X side of an ERG/token pool
    - `name` (string)
    - `ticker` (string): Short symbol. Verified tokens and ERG only.
    - `decimals` (integer · int32)
    - `verified` (boolean, required)
  - `tokenY` (LDPoolToken, required): One side of a pool. A verified token's name, ticker and decimals come from the client's verified list; any other token's from the node's token index, where whoever minted the token chose them. 
  - `reservesX` (string, required)
  - `reservesY` (string, required)
  - `pendingX` (string, required): Fees awaiting a flush to the vault
  - `pendingY` (string, required)
  - `supply` (string, required): Shares issued
  - `feeParams` (LDFeeParams, required): Fee numerators over `feeDenom`. `dexFeeNum` stays in the pool; `ergFeeNum` / `tokenFeeNum` are set aside for liquidity providers. 
    - `dexFeeNum` (integer · int64, required)
    - `ergFeeNum` (integer · int64, required)
    - `tokenFeeNum` (integer · int64, required)
    - `feeDenom` (integer · int64, required): Denominator of every numerator above
  - `provTokensLeft` (string, required): Deposits the pool can still take, one provision token each
  - `price` (number · double): Units of Y per unit of X at display decimals. Absent when either side's decimals are unknown.
  - `verified` (boolean, required): Whether the client's verified list names this pool
  - `genesisChecked` (boolean, required): Whether this pool's genesis was checked. False for verified pools, which are checked by hand, and while the node could not be read. 
  - `problems` (string[], required): Genesis facts this pool breaks. Any one can let the pool be drained.
  - `warnings` (string[], required): Risks short of that, such as too little ERG to survive storage rent.

### default: Error

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

## Example request

```bash
curl -X GET "http://localhost:9000/dex/pools"
```

## Example response

```json
{
  "status": "building",
  "height": 0,
  "truncated": true,
  "pools": [
    {
      "poolNFT": "string",
      "kind": "n2t",
      "utxoId": "string",
      "inclusionHeight": 0,
      "tokenX": {
        "tokenId": "c1980d829988229516430a47a5eca376060b6ce859616db0936e78ab25cb6de7",
        "name": "LIT",
        "ticker": "LIT",
        "decimals": 9,
        "verified": true
      },
      "tokenY": {
        "tokenId": "c1980d829988229516430a47a5eca376060b6ce859616db0936e78ab25cb6de7",
        "name": "LIT",
        "ticker": "LIT",
        "decimals": 9,
        "verified": true
      },
      "reservesX": "string",
      "reservesY": "string",
      "pendingX": "string",
      "pendingY": "string",
      "supply": "string",
      "feeParams": {
        "dexFeeNum": 9985,
        "ergFeeNum": 15,
        "tokenFeeNum": 15,
        "feeDenom": 10000
      },
      "provTokensLeft": "string",
      "price": 0.1,
      "verified": true,
      "genesisChecked": true,
      "problems": [
        "string"
      ],
      "warnings": [
        "string"
      ]
    }
  ]
}
```
