# Functions

This section provides detailed documentation for all functions available in the CoolDEX contract.

## Available Functions

1. [Admin Initialize Pool](/cooldex/functions/initialize-pool.md) - Creates a new liquidity pool on the DEX
2. [Swap Base In](/cooldex/functions/swap-base-in.md) - Swaps tokens by specifying the input amount
3. [Swap Base Out](/cooldex/functions/swap-base-out.md) - Swaps tokens by specifying the output amount
4. [Deposit](/cooldex/functions/deposit.md) - Adds liquidity to a pool
5. [Withdraw](/cooldex/functions/withdraw.md) - Removes liquidity from a pool
6. [Withdraw PnL](https://github.com/fablee1/sc-gitbook/blob/main/sc-dex/functions/withdraw-pnl.md) - Withdraws accumulated profit and loss

Each function documentation includes:

* Parameter descriptions
* Required accounts
* Function logic
* Example usage


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.something.cool/cooldex/functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
