> ## Documentation Index
> Fetch the complete documentation index at: https://tech.ramses.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# IRamsesV3Factory

The Ramses V3 Factory facilitates creation of Ramses V3 pools and control over the protocol fees. It uses the AccessHub pattern for governance instead of simple ownership.

## Functions

### tickSpacingInitialFee

```solidity theme={null}
  function tickSpacingInitialFee(
    int24 tickSpacing
  ) external view returns (uint24)
```

Returns the default fee for a given tick spacing, if enabled, or 0 if not enabled

#### Parameters:

| Name          | Type  | Description                 |
| :------------ | :---- | :-------------------------- |
| `tickSpacing` | int24 | The tick spacing to look up |

#### Return Values:

| Type   | Description                                             |
| :----- | :------------------------------------------------------ |
| uint24 | The initial fee for the tick spacing (0 if not enabled) |

### getPool

```solidity theme={null}
  function getPool(
    address tokenA,
    address tokenB,
    int24 tickSpacing
  ) external view returns (address pool)
```

Returns the pool address for a given pair of tokens and tick spacing, or address 0 if it does not exist

tokenA and tokenB may be passed in either token0/token1 or token1/token0 order

#### Parameters:

| Name          | Type    | Description                                     |
| :------------ | :------ | :---------------------------------------------- |
| `tokenA`      | address | The contract address of either token0 or token1 |
| `tokenB`      | address | The contract address of the other token         |
| `tickSpacing` | int24   | The tick spacing of the pool                    |

#### Return Values:

| Name   | Type    | Description      |
| :----- | :------ | :--------------- |
| `pool` | address | The pool address |

### createPool

```solidity theme={null}
  function createPool(
    address tokenA,
    address tokenB,
    int24 tickSpacing,
    uint160 sqrtPriceX96
  ) external returns (address pool)
```

Creates a pool for the given two tokens and tick spacing, optionally initializing it with a price

tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. The fee is automatically derived from `tickSpacingInitialFee`. The call will revert if the pool already exists or the token arguments are invalid. If `sqrtPriceX96` is non-zero, the pool is initialized with that price.

#### Parameters:

| Name           | Type    | Description                                                     |
| :------------- | :------ | :-------------------------------------------------------------- |
| `tokenA`       | address | One of the two tokens in the desired pool                       |
| `tokenB`       | address | The other of the two tokens in the desired pool                 |
| `tickSpacing`  | int24   | The desired tick spacing for the pool                           |
| `sqrtPriceX96` | uint160 | The initial sqrt price of the pool as a Q64.96 (0 to skip init) |

#### Return Values:

| Name   | Type    | Description                           |
| :----- | :------ | :------------------------------------ |
| `pool` | address | The address of the newly created pool |

### enableTickSpacing

```solidity theme={null}
  function enableTickSpacing(
    int24 tickSpacing,
    uint24 initialFee
  ) external
```

Enables a tick spacing with the given default fee

#### Parameters:

| Name          | Type   | Description                                                            |
| :------------ | :----- | :--------------------------------------------------------------------- |
| `tickSpacing` | int24  | The spacing between ticks to enable                                    |
| `initialFee`  | uint24 | The default fee amount, denominated in hundredths of a bip (i.e. 1e-6) |

### setFeeProtocol

```solidity theme={null}
  function setFeeProtocol(
    uint24 _feeProtocol
  ) external
```

Sets the default protocol fee for all pools

#### Parameters:

| Name           | Type   | Description                                                 |
| :------------- | :----- | :---------------------------------------------------------- |
| `_feeProtocol` | uint24 | The new default protocol fee, denominated in 1e-6 precision |

### setPoolFeeProtocol

```solidity theme={null}
  function setPoolFeeProtocol(
    address pool,
    uint24 _feeProtocol
  ) external
```

Sets the protocol fee for a specific pool

#### Parameters:

| Name           | Type    | Description                                    |
| :------------- | :------ | :--------------------------------------------- |
| `pool`         | address | The pool address to update                     |
| `_feeProtocol` | uint24  | The new protocol fee for the pool (1e-6 basis) |

### gaugeFeeSplitEnable

```solidity theme={null}
  function gaugeFeeSplitEnable(
    address pool
  ) external
```

Enables gauge fee splitting for a pool

#### Parameters:

| Name   | Type    | Description                               |
| :----- | :------ | :---------------------------------------- |
| `pool` | address | The pool to enable gauge fee splitting on |

### setFeeCollector

```solidity theme={null}
  function setFeeCollector(
    address _feeCollector
  ) external
```

Updates the fee collector address

#### Parameters:

| Name            | Type    | Description                   |
| :-------------- | :------ | :---------------------------- |
| `_feeCollector` | address | The new fee collector address |

### setVoter

```solidity theme={null}
  function setVoter(
    address _voter
  ) external
```

Updates the voter contract address

#### Parameters:

| Name     | Type    | Description           |
| :------- | :------ | :-------------------- |
| `_voter` | address | The new voter address |

### setFee

```solidity theme={null}
  function setFee(
    address _pool,
    uint24 _fee
  ) external
```

Sets the swap fee for a specific pool

#### Parameters:

| Name    | Type    | Description                                                      |
| :------ | :------ | :--------------------------------------------------------------- |
| `_pool` | address | The pool to update                                               |
| `_fee`  | uint24  | The new swap fee, denominated in hundredths of a bip (i.e. 1e-6) |

### voter

```solidity theme={null}
  function voter(
  ) external returns (address)
```

Returns the address of the Voter contract

### feeCollector

```solidity theme={null}
  function feeCollector(
  ) external view returns (address)
```

Returns the address of the FeeCollector contract

### feeProtocol

```solidity theme={null}
  function feeProtocol(
  ) external view returns (uint24)
```

Returns the default protocol fee

### poolFeeProtocol

```solidity theme={null}
  function poolFeeProtocol(
    address pool
  ) external view returns (uint24)
```

Returns the effective protocol fee for a specific pool

## Events

### PoolCreated

```solidity theme={null}
  event PoolCreated(
    address token0,
    address token1,
    uint24 fee,
    int24 tickSpacing,
    address pool
  )
```

Emitted when a pool is created

#### Parameters:

| Name          | Type    | Description                                                                       |
| :------------ | :------ | :-------------------------------------------------------------------------------- |
| `token0`      | address | The first token of the pool by address sort order                                 |
| `token1`      | address | The second token of the pool by address sort order                                |
| `fee`         | uint24  | The fee collected upon every swap in the pool, denominated in hundredths of a bip |
| `tickSpacing` | int24   | The minimum number of ticks between initialized ticks                             |
| `pool`        | address | The address of the created pool                                                   |

### TickSpacingEnabled

```solidity theme={null}
  event TickSpacingEnabled(
    int24 tickSpacing,
    uint24 fee
  )
```

Emitted when a new tick spacing is enabled for pool creation via the factory

#### Parameters:

| Name          | Type   | Description                                      |
| :------------ | :----- | :----------------------------------------------- |
| `tickSpacing` | int24  | The tick spacing that was enabled                |
| `fee`         | uint24 | The default fee associated with the tick spacing |

### SetFeeProtocol

```solidity theme={null}
  event SetFeeProtocol(
    uint24 feeProtocolOld,
    uint24 feeProtocolNew
  )
```

Emitted when the default protocol fee is changed

#### Parameters:

| Name             | Type   | Description               |
| :--------------- | :----- | :------------------------ |
| `feeProtocolOld` | uint24 | The previous protocol fee |
| `feeProtocolNew` | uint24 | The updated protocol fee  |

### SetPoolFeeProtocol

```solidity theme={null}
  event SetPoolFeeProtocol(
    address pool,
    uint24 feeProtocolOld,
    uint24 feeProtocolNew
  )
```

Emitted when a pool-specific protocol fee is changed

#### Parameters:

| Name             | Type    | Description               |
| :--------------- | :------ | :------------------------ |
| `pool`           | address | The pool address          |
| `feeProtocolOld` | uint24  | The previous protocol fee |
| `feeProtocolNew` | uint24  | The updated protocol fee  |

### FeeAdjustment

```solidity theme={null}
  event FeeAdjustment(
    address pool,
    uint24 newFee
  )
```

Emitted when a pool's swap fee is changed

### FeeCollectorChanged

```solidity theme={null}
  event FeeCollectorChanged(
    address indexed oldFeeCollector,
    address indexed newFeeCollector
  )
```

Emitted when the fee collector address is changed
