# UniswapV3FactoryUpgradeable

Factory contract for creating AMM pools.&#x20;

## Table of Contents

<details>

<summary>Variables</summary>

[#feedistributor](#feedistributor "mention")\
[#feeamounttickspacing](#feeamounttickspacing "mention")\
[#getpool](#getpool "mention")\
[#rewardtiercardinality](#rewardtiercardinality "mention")

</details>

<details>

<summary>Events</summary>

[#poolcreated](#poolcreated "mention")\
[#feeamountenabled](#feeamountenabled "mention")

</details>

<details>

<summary>Public Write Functions</summary>

[#createpool](#createpool "mention")

</details>

<details>

<summary>Owner Write Functions</summary>

[#setfeedistributor](#setfeedistributor "mention")\
[#setrewardtiercardinality](#setrewardtiercardinality "mention")\
[#enablefeeamount](#enablefeeamount "mention")

</details>

<details>

<summary>Read Functions</summary>

[#owner](#owner "mention")

</details>

## Variables

#### feeDistributor

```solidity
function feeDistributor() external view returns (address)
```

Address of `NFTXFeeDistributorV3`.

#### feeAmountTickSpacing

```solidity
function feeAmountTickSpacing(uint24 fee) external view returns (int24)
```

Tick spacing value for a given fee tier. Tick spacing is capped at 16384, which represents a >5x price change with ticks of 1 bip.

#### getPool

```solidity
function getPool(
    address tokenA,
    address tokenB,
    uint24 fee
) external view returns (address pool)
```

Pool address for a given pair and fee, or 0 if the pool does not exist.&#x20;

#### rewardTierCardinality

```solidity
function rewardTierCardinality() external view returns (uint16)
```

The CardinalityNext value for the RewardFeeTier pools.&#x20;

## Events

#### PoolCreated

```solidity
event PoolCreated(
    address indexed token0,
    address indexed token1,
    uint24 indexed fee,
    int24 tickSpacing,
    address pool
)
```

Emitted by `createPool()`.

<table><thead><tr><th width="174.5">Parameters</th><th width="128">Type</th><th>Description</th></tr></thead><tbody><tr><td>token0</td><td><code>address</code></td><td>Address of token0.</td></tr><tr><td>token1</td><td><code>address</code></td><td>Address of token1.</td></tr><tr><td>fee</td><td><code>uint24</code></td><td>Fee tier of pool.</td></tr><tr><td>tickSpacing</td><td><code>int24</code></td><td>Tick spacing of pool.</td></tr><tr><td>pool</td><td><code>address</code></td><td>Address of pool. </td></tr></tbody></table>

#### FeeAmountEnabled

```solidity
event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing)
```

Emitted by `__UniswapV3FactoryUpgradeable_init()` and `enableFeeAmount()`.&#x20;

<table><thead><tr><th width="174.5">Parameters</th><th width="128">Type</th><th>Description</th></tr></thead><tbody><tr><td>fee</td><td><code>uint24</code></td><td>New fee tier just added.</td></tr><tr><td>tickSpacing</td><td><code>int24</code></td><td>Tick spacing for the fee tier. </td></tr></tbody></table>

## Write Functions

#### createPool

```solidity
function createPool(
    address tokenA,
    address tokenB,
    uint24 fee
) external returns (address pool)
```

Deploys a new pool, using a BeaconProxy.&#x20;

<table><thead><tr><th width="174.5">Parameters</th><th width="128">Type</th><th>Description</th></tr></thead><tbody><tr><td>tokenA</td><td><code>address</code></td><td>First token for pair.</td></tr><tr><td>tokenB</td><td><code>address</code></td><td>Second token for pair.</td></tr><tr><td>fee</td><td><code>uint24</code></td><td>Fee tier of pool. Must be one of the enabled fee tiers.</td></tr></tbody></table>

<table><thead><tr><th width="172.5">Return values</th><th width="128">Type</th><th>Description</th></tr></thead><tbody><tr><td>pool</td><td><code>address</code></td><td>Address of new pool.</td></tr></tbody></table>

## Owner Functions

#### setFeeDistributor

```solidity
function setFeeDistributor(address feeDistributor_) external
```

Sets the `NFTXFeeDistributorV3` address.

<table><thead><tr><th width="174.5">Parameters</th><th width="128">Type</th><th>Description</th></tr></thead><tbody><tr><td>feeDistributor_</td><td><code>address</code></td><td>Updated address for fee distributor.</td></tr></tbody></table>

#### setRewardTierCardinality

```solidity
function setRewardTierCardinality(
    uint16 rewardTierCardinality_
) external
```

Sets the CardinalityNext value for the RewardFeeTier pools.&#x20;

<table><thead><tr><th width="219.5">Parameters</th><th width="128">Type</th><th>Description</th></tr></thead><tbody><tr><td>rewardTierCardinality_</td><td><code>uint16</code></td><td>New reward tier cardinality.</td></tr></tbody></table>

#### enableFeeAmount

```solidity
function enableFeeAmount(uint24 fee, int24 tickSpacing) external
```

Enables a new fee amount option for pools, with a given tick spacing. Once enabled, fee amounts cannot be removed.&#x20;

<table><thead><tr><th width="174.5">Parameters</th><th width="128">Type</th><th>Description</th></tr></thead><tbody><tr><td>fee</td><td><code>uint24</code></td><td>New fee tier being added.</td></tr><tr><td>tickSpacing</td><td><code>int24</code></td><td>Tick spacing for the new fee tier.</td></tr></tbody></table>

## Read Functions

#### owner

```solidity
function owner()
    public
    view
    returns (address)
```

Returns the contract owner.&#x20;

<table><thead><tr><th width="157.5">Return values</th><th width="218">Type</th><th>Description</th></tr></thead><tbody><tr><td><em>unnamed</em></td><td><code>address</code></td><td>Address of contract owner</td></tr></tbody></table>
