> For the complete documentation index, see [llms.txt](https://docs.tonco.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tonco.io/contracts-v1.6-forthcoming/pool_factory.md).

# Pool Factory

### pool\_factory

* [Description](#description)
* [Data Storage](#data-storage)
* [Interface](#interface)
* [Messages](#messages)

## Description

The **Pool Factory** is the public entry point for creating pools. It holds a whitelist of privileged creators and the default settings presets, and on a create request it supplements the message with router data (such as the Default Pool Admin) and asks the [Router](/contracts-v1.6-forthcoming/router.md) to deploy the pool. Anyone may request a pool: a whitelisted creator can pick its own preset and take the Controller/Creator roles, while a non-whitelisted caller gets the default preset. A pool born through the factory can never be granted the privileged ALM Vault or Arbiter roles. The factory admin manages the whitelist and the factory's own parameters.

## Interface

### getPoolFactoryData

(address, address, int, cell, cell) getPoolFactoryData ()

This function provides current state of the user account

#### Return Values

| # | Type    | Description                                                                   |
| - | ------- | ----------------------------------------------------------------------------- |
| 0 | address | admin\_address Address of the admin of this Pool Factory                      |
| 1 | address | router\_address Address of the router that this Pool Factory is attached to   |
| 2 | int     | ton\_price Amount of ton taken as fee during Pool Creation (so far usually 0) |
| 3 | cell    | nftContent Content of Pool that would be presented as Nft Collection          |
| 4 | cell    | nftItemContent Content of Position NFT that would be presented as NFT         |

### getWhitelist

(dict) getWhitelist ()

This function provides current whitelist of the wallets that are allowed to get more granular control on creation.

#### Return Values

| # | Type | Description                                             |
| - | ---- | ------------------------------------------------------- |
| 0 | dict | whitelist Dictionary with whitelist of the Pool Factory |

## Messages

### POOL\_FACTORY\_CREATE\_POOL

Opcode : **0x9e9a8f7f**

Message that initiates pool creation\
Access Rights: Open to anyone. The factory treats senders differently: a whitelisted address may choose its own pool preset (fee, tick spacing, active flag, NFT content) and become the pool's Controller and Creator, while a non-whitelisted sender gets the default preset with the Default Pool Admin as Controller and Creator. Whoever calls it pays for deployment; the factory then asks the Router to create the pool. A pool created through the factory cannot be granted the ALM Vault or Arbiter roles.<br>

<table data-full-width="true"><thead><tr><th width="90">Path</th><th width="200">Mnemonic</th><th width="180">Type</th><th>Description</th></tr></thead><tbody><tr><td></td><td>op</td><td>Uint(32),op</td><td></td></tr><tr><td></td><td>query_id</td><td>Uint(64)</td><td>queryid as of the TON documentation</td></tr><tr><td></td><td>jetton0Minter</td><td>Address(267)</td><td>Minter address of the first jetton</td></tr><tr><td></td><td>jetton1Minter</td><td>Address(267)</td><td>Minter address of the second jetton</td></tr><tr><td></td><td>initial_priceX96</td><td>Uint(160),PriceX96</td><td>Initial price for the pool</td></tr><tr><td></td><td>settings</td><td>Uint(16)</td><td>Value that describes pool configuration preset</td></tr><tr><td></td><td>0</td><td>Cell(0) wallet_cell</td><td>Cell With Wallets.</td></tr><tr><td>0</td><td>jetton0Wallet</td><td>Address(267)</td><td>Address of the jetton0 wallet of the Router</td></tr><tr><td>0</td><td>jetton1Wallet</td><td>Address(267)</td><td>Address of the jetton1 wallet of the Router</td></tr><tr><td></td><td>1</td><td>Cell(0) settings_cell</td><td>Cell With Settings for Whitelisted</td></tr><tr><td>1</td><td>fee</td><td>Uint(16)</td><td>Custom LP fee in FEE_DENOMINATOR parts (FEE_DENOMINATOR=10000, so 1 = 0.01%). Applied only if the sender is whitelisted with allow_set_settings</td></tr><tr><td>1</td><td>tickSpacing</td><td>Uint(24)</td><td>Custom tick spacing. Applied only if the sender is whitelisted with allow_set_settings</td></tr><tr><td>1</td><td>active</td><td>Uint(1),Boolean</td><td>Whether the new pool starts active (unlocked). Applied only if the sender is whitelisted with allow_set_active</td></tr><tr><td>1</td><td>nftContent</td><td>Cell(1),Maybe</td><td>Custom NFT collection content for the pool. Applied only if the sender is whitelisted with allow_set_content</td></tr></tbody></table>

<details>

<summary>TL-B Description</summary>

This is a preliminary tl-b - subject to change

{% code title="Tlb for POOL\_FACTORY\_CREATE\_POOL" overflow="wrap" lineNumbers="true" %}

```javascript
POOL_FACTORY_CREATE_POOL#9e9a8f7f 
    query_id:uint64
    jetton0Minter:MsgAddress
    jetton1Minter:MsgAddress
    initial_priceX96:uint160
    settings:uint16
    wallet_cell:^Wallet_cellType
    settings_cell:^Settings_cellType   // optional ref (present only if a ref is left)
= ContractMessages;
_ 
    jetton0Wallet:MsgAddress
    jetton1Wallet:MsgAddress
= Wallet_cellType;
_ 
    fee:uint16
    tickSpacing:uint24
    active:uint1
    nftContent:(Maybe ^Cell)
= Settings_cellType;
```

{% endcode %}

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.tonco.io/contracts-v1.6-forthcoming/pool_factory.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.
