# V3Factory

해당 컨트랙트는 V3 풀을 배포하고 풀 프로토콜 수수료에 대한 소유권 및 제어를 관리합니다.

## Code

Github Link: (Will be updated after official launch)<br>

## Address

* Cypress :  [0x0Af25138860689F967f142F4B06c29AfC84AE910](https://klaytnscope.com/account/0x0Af25138860689F967f142F4B06c29AfC84AE910?tabId=txList)

## Events, Read-Only Functions, and State-Changing Functions

{% tabs %}
{% tab title="Events" %}

## Events

**PoolCreated**&#x20;

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

풀이 생성될 때 발생

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/IUniswapV3Factory#parameters-6)

<table><thead><tr><th width="162.66666666666666">Name</th><th width="98">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>token0</code></td><td>address</td><td>주소 정렬 순서에 따른 풀의 첫 번째 토큰</td></tr><tr><td><code>token1</code></td><td>address</td><td>주소 정렬 순서에 따른 풀의 두 번째 토큰</td></tr><tr><td><code>fee</code></td><td>uint24</td><td>풀의 모든 스왑에 대해 징수되는 수수료는 1/100 BIP 단위로 표시됩니다.</td></tr><tr><td><code>tickSpacing</code></td><td>int24</td><td>초기화된 틱 사이의 최소 틱 수</td></tr><tr><td><code>pool</code></td><td>address</td><td>생성된 풀의 주소</td></tr></tbody></table>

#### FeeAmountEnabled[​](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/IUniswapV3Factory#feeamountenabled) <a href="#feeamountenabled" id="feeamountenabled"></a>

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

풀 생성에 대해 새로운 수수료 금액이 활성화되면 발생합니다.

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/IUniswapV3Factory#parameters-7)

<table><thead><tr><th width="168.66666666666666">Name</th><th width="90">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>fee</code></td><td>uint24</td><td>1/100 BIP 단위로 표시되는 활성화된 수수료</td></tr><tr><td><code>tickSpacing</code></td><td>int24</td><td>주어진 수수료로 생성된 풀의 초기화된 틱 사이의 최소 틱 수</td></tr></tbody></table>
{% endtab %}

{% tab title="Read-Only Functions" %}

## Read-Only Functions

**getPoolCount**

```solidity
function getPoolCount() external view override returns (uint256);
```

V3에서 생성된 풀 수 가져오기

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/core/UniswapV3Factory#return-values)

<table><thead><tr><th width="127.66666666666666">Name</th><th width="113">Type</th><th>Description</th></tr></thead><tbody><tr><td></td><td>uint256</td><td>V3에서 생성된 풀 수</td></tr></tbody></table>

**getPoolAddress**

```solidity
function getPoolAddress(uint256 idx) external view override returns (address);
```

**Parameters:**

<table><thead><tr><th width="127.66666666666666">Name</th><th width="113">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>idx</code></td><td>uint256</td><td>인덱스 번호</td></tr></tbody></table>

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/core/UniswapV3Factory#return-values)

<table><thead><tr><th width="127.66666666666666">Name</th><th width="113">Type</th><th>Description</th></tr></thead><tbody><tr><td></td><td>address</td><td>index에 해당하는 풀의 주소</td></tr></tbody></table>

#### getPool[​](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/IUniswapV3Factory#getpool) <a href="#getpool" id="getpool"></a>

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

주어진 토큰 쌍과 수수료에 대한 풀 주소를 반환하거나 존재하지 않는 경우 주소 0을 반환합니다. tokenA 및 tokenB는 token0/token1 또는 token1/token0 순서로 전달될 수 있습니다.

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/IUniswapV3Factory#parameters-1)

<table><thead><tr><th width="137.66666666666666">Name</th><th width="105">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tokenA</code></td><td>address</td><td>token0 또는 token1의 컨트랙트 주소</td></tr><tr><td><code>tokenB</code></td><td>address</td><td>다른 토큰의 컨트랙트 주소</td></tr><tr><td><code>fee</code></td><td>uint24</td><td>풀의 모든 스왑에 대해 징수되는 수수료 1/100 BIP 단위</td></tr></tbody></table>

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/IUniswapV3Factory#return-values-2)

<table><thead><tr><th width="145.66666666666666">Name</th><th width="119">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>pool</code></td><td>address</td><td>풀 주소</td></tr></tbody></table>

**feeAmountTickSpacing**[​](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/IUniswapV3Factory#feeamounttickspacing)

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

활성화된 경우 주어진 수수료 금액에 대한 틱 간격을 반환하고 활성화되지 않은 경우 0을 반환합니다. 수수료 금액은 절대 제거할 수 없으므로 이 값은 하드 코딩되거나 호출 컨텍스트에 캐시되어야 합니다.

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/IUniswapV3Factory#parameters)

<table><thead><tr><th width="133.66666666666666">Name</th><th width="106">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>fee</code></td><td>uint24</td><td>BIP의 100분의 1 단위로 표시되는 활성화된 수수료입니다. 활성화되지 않은 수수료의 경우 0을 반환합니다.</td></tr></tbody></table>

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/IUniswapV3Factory#return-values-1)

<table><thead><tr><th width="179">Type</th><th>Description</th></tr></thead><tbody><tr><td>int24</td><td>틱 간격</td></tr></tbody></table>
{% endtab %}

{% tab title="State-Changing Functions" %}

## **State-Changing Functions**

**createPool**

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

* 주어진 두 개의 토큰과 수수료에 대한 풀 생성&#x20;
* tokenA 및 tokenB는 token0/token1 또는 token1/token0 순서로 전달될 수 있습니다. tickSpacing은 수수료에서 검색됩니다.

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/core/UniswapV3Factory#parameters)

<table><thead><tr><th width="135.66666666666666">Name</th><th width="111">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tokenA</code></td><td>address</td><td>원하는 풀의 두 토큰 중 하나</td></tr><tr><td><code>tokenB</code></td><td>address</td><td>원하는 풀에 있는 두 개의 토큰 중 다른 하나</td></tr><tr><td><code>fee</code></td><td>uint24</td><td>풀에 대한 원하는 수수료</td></tr></tbody></table>

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/core/UniswapV3Factory#return-values)

<table><thead><tr><th width="138.66666666666666">Name</th><th width="109">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>pool</code></td><td>address</td><td>새로 생성된 풀의 주소</td></tr></tbody></table>

#### enableFeeAmount[​](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/IUniswapV3Factory#enablefeeamount) <a href="#enablefeeamount" id="enablefeeamount"></a>

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

주어진 tickSpacing으로 수수료 금액을 활성화합니다.&#x20;

수수료 금액은 활성화되면 제거할 수 없습니다.

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/IUniswapV3Factory#parameters-4)

<table><thead><tr><th width="164.66666666666666">Name</th><th width="108">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>fee</code></td><td>uint24</td><td>활성화할 수수료 금액으로, BIP의 100분의 1 단위(예: 1e-6)로 표시됩니다.</td></tr><tr><td><code>tickSpacing</code></td><td>int24</td><td>주어진 수수료 금액으로 생성된 모든 풀에 적용되는 틱 사이의 간격</td></tr></tbody></table>
{% endtab %}
{% endtabs %}
