# Factory Module

#### Structs

**`Pairs`**

```move
struct Pairs has key, store {
    id: UID,
    list: LinkedTable<ID, PairSimpleInfo>,
    index: u64,
}
```

* **Purpose**: Global registry of all trading pairs
* **Access**: Shared object accessible by all users

**`PairSimpleInfo`**

```move
struct PairSimpleInfo has copy, drop, store {
    pair_id: ID,
    pair_key: ID,
    bin_step: u16,
    coin_type_a: TypeName,
    coin_type_b: TypeName
}
```

* **Purpose**: Basic information about a trading pair

#### Events

**`InitFactoryEvent`**

```move
struct InitFactoryEvent has copy, drop {
    pairs_id: ID,
}
```

* **Emitted**: When factory is initialized

**`CreatePairEvent`**

```move
struct CreatePairEvent has copy, drop {
    pair_id: ID,
    bin_step: u16,
    coin_type_a: String,
    coin_type_b: String,
    active_id: u32,
}
```

* **Emitted**: When new trading pair is created

#### Core Functions

**Pair Creation**

* **`create_pair<X, Y>`**: Creates a new trading pair
  * Validates token types and whitelist status
  * Initializes pair with specified parameters
  * Registers pair in global registry
  * Emits creation event

**Pair Management**

* **`set_static_fee_parameters`**: Updates fee structure (admin only)
* **`force_decay`**: Forces volatility decay (admin only)
* **`pause_pair`**: Pauses/unpauses trading (admin only)
* **`increase_oracle_length`**: Expands price oracle capacity (admin only)

**View Functions**

* **`new_pair_key<X, Y>`**: Generates deterministic pair key
* **`pool_simple_info`**: Retrieves pair information
* **`index`**: Gets total number of pairs created


---

# 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.ferra.ag/integration/dlmm/smart-contract/factory-module.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.
