# V3Pool

해당 컨트랙트는 V3 풀입니다.

## Code

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

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

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

## Events

#### Initialize[​](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/pool/IUniswapV3PoolEvents#initialize) <a href="#initialize" id="initialize"></a>

```solidity
event Initialize(
    uint160 sqrtPriceX96,
    int24 tick
)
```

풀에서 #initialize가 처음 호출될 때 풀에서 정확히 한 번 방출됩니다.&#x20;

Mint/Burn/Swap은 초기화 전에 풀에서 내보낼 수 없습니다.

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

<table><thead><tr><th width="178.66666666666666">Name</th><th width="92">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>sqrtPriceX96</code></td><td>uint160</td><td>풀의 초기 sqrt 가격(Q64.96)</td></tr><tr><td><code>tick</code></td><td>int24</td><td>풀의 초기 틱, 즉 풀 시작 가격의 로그 베이스 1.0001</td></tr></tbody></table>

#### Mint[​](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/pool/IUniswapV3PoolEvents#mint) <a href="#mint" id="mint"></a>

```solidity
event Mint(
    address sender,
    address owner,
    int24 tickLower,
    int24 tickUpper,
    uint128 amount,
    uint256 amount0,
    uint256 amount1
)
```

주어진 포지션에 대해 유동성이 발행될 때 발생

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

<table><thead><tr><th width="156.66666666666666">Name</th><th width="114">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>sender</code></td><td>address</td><td>유동성을 발행한 주소</td></tr><tr><td><code>owner</code></td><td>address</td><td>포지션 소유자 및 발행된 유동성 수령인</td></tr><tr><td><code>tickLower</code></td><td>int24</td><td>예치하고자 하는 포지션의 최소 틱</td></tr><tr><td><code>tickUpper</code></td><td>int24</td><td>예치하고자 하는 포지션의 최대 틱</td></tr><tr><td><code>amount</code></td><td>uint128</td><td>포지션 범위에 발행된 유동성의 양</td></tr><tr><td><code>amount0</code></td><td>uint256</td><td>발행된 유동성에 필요한 token0의 양</td></tr><tr><td><code>amount1</code></td><td>uint256</td><td>발행된 유동성에 필요한 token1의 양</td></tr></tbody></table>

#### Collect[​](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/pool/IUniswapV3PoolEvents#collect) <a href="#collect" id="collect"></a>

```solidity
event Collect(
    address owner,
    int24 tickLower,
    int24 tickUpper,
    uint128 amount0,
    uint128 amount1
)
```

포지션 소유자가 수수료를 수령할 때 발생&#x20;

호출자가 수수료를 수집하지 않기로 선택하면 0 amount0 및 amount1로 수집 이벤트를 내보낼 수 있습니다.

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

<table><thead><tr><th width="151.66666666666666">Name</th><th width="100">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>owner</code></td><td>address</td><td>수수료가 징수되는 포지션의 소유자</td></tr><tr><td><code>tickLower</code></td><td>int24</td><td>포지션의 최소 틱</td></tr><tr><td><code>tickUpper</code></td><td>int24</td><td>포지션의 최대 틱</td></tr><tr><td><code>amount0</code></td><td>uint128</td><td>수령한 token0 수수료 금액</td></tr><tr><td><code>amount1</code></td><td>uint128</td><td>수령한 token1 수수료 금액</td></tr></tbody></table>

#### Burn[​](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/pool/IUniswapV3PoolEvents#burn) <a href="#burn" id="burn"></a>

```solidity
event Burn(
    address owner,
    int24 tickLower,
    int24 tickUpper,
    uint128 amount,
    uint256 amount0,
    uint256 amount1
)
```

포지션의 유동성이 제거되었을 때 발생&#x20;

\#collect를 통해 인출해야 하는 유동성 포지션에서 얻은 수수료를 인출하지 않습니다.

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

<table><thead><tr><th width="154.66666666666666">Name</th><th width="117">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>owner</code></td><td>address</td><td>유동성이 제거된 포지션의 소유자</td></tr><tr><td><code>tickLower</code></td><td>int24</td><td>포지션의 최소 틱</td></tr><tr><td><code>tickUpper</code></td><td>int24</td><td>포지션의 최대 틱</td></tr><tr><td><code>amount</code></td><td>uint128</td><td>제거할 유동성의 양</td></tr><tr><td><code>amount0</code></td><td>uint256</td><td>인출된 token0의 양</td></tr><tr><td><code>amount1</code></td><td>uint256</td><td>인출된 token1의 양</td></tr></tbody></table>

#### Swap[​](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/pool/IUniswapV3PoolEvents#swap) <a href="#swap" id="swap"></a>

```solidity
event Swap(
    address sender,
    address recipient,
    int256 amount0,
    int256 amount1,
    uint160 sqrtPriceX96,
    uint128 liquidity,
    int24 tick
)
```

token0과 token1 사이의 모든 스왑에 대해 풀에서 내보냅니다.

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

<table><thead><tr><th width="176.66666666666666">Name</th><th width="108">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>sender</code></td><td>address</td><td>스왑 호출을 시작하고 콜백을 수신한 주소</td></tr><tr><td><code>recipient</code></td><td>address</td><td>스왑의 결과물을 받은 주소</td></tr><tr><td><code>amount0</code></td><td>int256</td><td>풀의 token0 잔액 차이</td></tr><tr><td><code>amount1</code></td><td>int256</td><td>풀의 token1 잔액 차이</td></tr><tr><td><code>sqrtPriceX96</code></td><td>uint160</td><td>Q64.96으로 스왑 후 풀의 sqrt(가격)</td></tr><tr><td><code>liquidity</code></td><td>uint128</td><td>스왑 후 풀의 유동성</td></tr><tr><td><code>tick</code></td><td>int24</td><td>스왑 후 풀 가격의 로그 베이스 1.0001</td></tr></tbody></table>

#### &#x20;<a href="#flash" id="flash"></a>

IncreaseObservationCardinalityNext[​](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/pool/IUniswapV3PoolEvents#increaseobservationcardinalitynext)

```solidity
event IncreaseObservationCardinalityNext(
    uint16 observationCardinalityNextOld,
    uint16 observationCardinalityNextNew
)
```

저장할 수 있는 관찰 수를 늘리기 위해 풀에서 내보냅니다.&#x20;

observationCardinalityNext는 mint/swap/burn 직전에 인덱스에 관측치가 기록될 때까지 관측 카디널리티가 아닙니다.

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

<table><thead><tr><th width="207.66666666666666">Name</th><th width="93">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>observationCardinalityNextOld</code></td><td>uint16</td><td>다음 관찰 카디널리티의 이전 값</td></tr><tr><td><code>observationCardinalityNextNew</code></td><td>uint16</td><td>다음 관찰 카디널리티의 업데이트된 값</td></tr></tbody></table>
{% endtab %}

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

## Read-Only Functions

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

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

IUniswapV3Factory 인터페이스를 준수해야 하는 풀을 배포한 계약

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

<table><thead><tr><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>컨트랙트 주소</td></tr></tbody></table>

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

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

주소별로 정렬된 풀의 두 토큰 중 첫 번째

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

| Type    | Description |
| ------- | ----------- |
| address | 토큰 컨트랙트 주소  |

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

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

주소별로 정렬된 풀의 두 토큰 중 두 번째

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

| Type    | Description |
| ------- | ----------- |
| address | 토큰 컨트랙트 주소  |

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

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

1/100 BIP 단위의 풀 수수료, 즉 1e-6

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

| Type   | Description |
| ------ | ----------- |
| uint24 | 수수료         |

#### tickSpacing[​](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/pool/IUniswapV3PoolImmutables#tickspacing) <a href="#tickspacing" id="tickspacing"></a>

```solidity
function tickSpacing() external view returns (int24)
```

풀 틱 간격&#x20;

틱은 이 값의 배수에서만 사용할 수 있으며 최소값은 1이고 항상 양수입니다. \
예: tickSpacing이 3이면 틱이 3번째 틱마다 초기화될 수 있음을 의미합니다(예: ..., -6, -3, 0, 3, 6, ... 이 값은 항상 양수인데도 캐스팅을 피하기 위해 int24입니다.

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

| Type  | Description |
| ----- | ----------- |
| int24 | 틱 간격        |

#### maxLiquidityPerTick[​](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/pool/IUniswapV3PoolImmutables#maxliquiditypertick) <a href="#maxliquiditypertick" id="maxliquiditypertick"></a>

```solidity
function maxLiquidityPerTick() external view returns (uint128)The maximum amount of position liquidity that can use any tick in the range
```

이 매개변수는 유동성이 uint128을 초과하는 것을 방지하기 위해 틱당 적용되며 풀에 범위 내 유동성을 추가하는 것을 방지하기 위해 범위를 벗어난 유동성이 사용되는 것을 방지합니다.

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

| Type    | Description |
| ------- | ----------- |
| uint128 | 틱당 최대 유동성   |

#### snapshotCumulativesInside[​](https://docs.uniswap.org/contracts/v3/reference/core/UniswapV3Pool#snapshotcumulativesinside) <a href="#snapshotcumulativesinside" id="snapshotcumulativesinside"></a>

```solidity
function snapshotCumulativesInside(
    int24 tickLower,
    int24 tickUpper
) external view returns (
    int56 tickCumulativeInside, 
    uint160 secondsPerLiquidityInsideX128, 
    uint32 secondsInside
)
```

틱 누적, 유동성당 초 및 틱 범위 내 초의 스냅샷을 반환합니다.&#x20;

스냅샷은 위치가 존재하는 기간 동안 찍은 다른 스냅샷과만 비교해야 합니다. \
즉, 첫 번째 스냅샷이 생성된 시점과 두 번째 스냅샷이 생성된 시점 사이의 전체 기간 동안 포지션이 유지되지 않으면 스냅샷을 비교할 수 없습니다.

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

<table><thead><tr><th width="184.66666666666666">Name</th><th width="137">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tickLower</code></td><td>int24</td><td>범위의 하위 틱</td></tr><tr><td><code>tickUpper</code></td><td>int24</td><td>범위의 상위 틱</td></tr></tbody></table>

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

<table><thead><tr><th width="254.66666666666666">Name</th><th width="119">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tickCumulativeInside</code></td><td>int56</td><td>범위에 대한 틱 누산기의 스냅샷</td></tr><tr><td><code>secondsPerLiquidityInsideX128</code></td><td>uint160</td><td>범위에 대한 유동성당 초의 스냅샷</td></tr><tr><td><code>secondsInside</code></td><td>uint32</td><td>범위에 대한 유동성당 초의 스냅샷</td></tr></tbody></table>

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

```solidity
function observe(
    uint32[] secondsAgos
) external view returns (
    int56[] tickCumulatives, 
    uint160[] secondsPerLiquidityCumulativeX128s
)
```

현재 블록 타임스탬프에서 각 타임스탬프 secondsAgo 시점의 누적 틱 및 유동성을 반환합니다.&#x20;

시간 가중 평균 틱 또는 범위 내 유동성을 얻으려면 두 개의 값으로 호출해야 합니다. \
하나는 기간의 시작을 나타내고 다른 하나는 기간의 끝을 나타냅니다. \
예를 들어 지난 시간 가중 평균 틱을 얻으려면 secondsAgos = \[3600, 0]으로 호출해야 합니다. 시간 가중 평균 틱은 토큰1 / 토큰0의 로그 기준 sqrt(1.0001)에서 풀의 기하학적 시간 가중 평균 가격을 나타냅니다. TickMath 라이브러리를 사용하여 눈금 값에서 비율로 이동할 수 있습니다.

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

<table><thead><tr><th width="173.66666666666666">Name</th><th width="115">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>secondsAgos</code></td><td>uint32[]</td><td>각 누적 틱 및 유동성 값이 반환되어야 하는 시점</td></tr></tbody></table>

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

<table><thead><tr><th width="219.66666666666666">Name</th><th width="129">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tickCumulatives</code></td><td>int56[]</td><td>현재 블록 타임스탬프에서 각 <code>secondsAgos</code>의 누적 틱 값</td></tr><tr><td><code>secondsPerLiquidityCumulativeX128s</code></td><td>uint160[]</td><td>현재 블록의 각 <code>secondsAgos</code> 기준 유동성 범위 값당 누적 초</td></tr></tbody></table>

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

```solidity
function slot0() external view returns (
    uint160 sqrtPriceX96, 
    int24 tick, 
    uint16 observationIndex, 
    uint16 observationCardinality, 
    uint16 observationCardinalityNext, 
    uint8 feeProtocol, 
    bool unlocked
)
```

풀의 0번째 스토리지 슬롯은 많은 값을 저장하며 외부에서 액세스할 때 가스를 절약하기 위한 단일 방법으로 노출됩니다.

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

<table><thead><tr><th width="184.66666666666666">Name</th><th width="104">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>sqrtPriceX96</code></td><td>uint160</td><td>sqrt(token1/token0) Q64.96 값으로 풀의 현재 가격</td></tr><tr><td><code>tick</code></td><td>int24</td><td>풀의 현재 틱, 즉 실행된 마지막 틱 전환에 따른 것입니다. 가격이 틱 경계에 있는 경우 이 값은 항상 SqrtTickMath getTickAtSqrtRatio(sqrtPriceX96)와 같지 않을 수 있습니다.</td></tr><tr><td><code>observationIndex</code></td><td>uint16</td><td>작성된 마지막 오라클 관찰의 인덱스</td></tr><tr><td><code>observationCardinality</code></td><td>uint16</td><td>풀에 저장된 현재 최대 관찰 수</td></tr><tr><td><code>observationCardinalityNext</code></td><td>uint16</td><td>관찰 시 업데이트될 다음 최대 관찰 수입니다.</td></tr><tr><td><code>feeProtocol</code></td><td>uint8</td><td>* <strong>미사용</strong> *</td></tr><tr><td><code>unlocked</code></td><td>bool</td><td>풀이 현재 재진입에 잠겨 있는지 여부</td></tr></tbody></table>

#### feeGrowthGlobal0X128[​](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/pool/IUniswapV3PoolState#feegrowthglobal0x128) <a href="#feegrowthglobal0x128" id="feegrowthglobal0x128"></a>

```solidity
function feeGrowthGlobal0X128() external view returns (uint256)
```

풀의 전체 수명 동안 유동성 단위당 수집된 token0의 Q128.128 수수료로 수수료 증가&#x20;

이 값은 uint256을 오버플로할 수 있습니다.

#### feeGrowthGlobal1X128[​](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/pool/IUniswapV3PoolState#feegrowthglobal1x128) <a href="#feegrowthglobal1x128" id="feegrowthglobal1x128"></a>

```solidity
function feeGrowthGlobal1X128() external view returns (uint256)
```

풀의 전체 수명 동안 유동성 단위당 수집된 token1의 Q128.128 수수료로 수수료 증가&#x20;

이 값은 uint256을 오버플로할 수 있습니다.

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

```solidity
function liquidity() external view returns (uint128)
```

현재 풀에서 사용할 수 있는 유동성 범위&#x20;

이 값은 모든 틱의 총 유동성과 관련이 없습니다.

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

```solidity
function ticks(
    int24 tick
) external view returns (
    uint128 liquidityGross, 
    int128 liquidityNet, 
    uint256 feeGrowthOutside0X128, 
    uint256 feeGrowthOutside1X128, 
    int56 tickCumulativeOutside, 
    uint160 secondsPerLiquidityOutsideX128, 
    uint32 secondsOutside, 
    bool initialized,
    uint256 rewardGrowthOutsideX128
)
```

풀에서 특정 틱에 대한 정보 조회

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

| Name   | Type  | Description |
| ------ | ----- | ----------- |
| `tick` | int24 | 조회할 틱       |

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

<table><thead><tr><th width="259">Name</th><th width="97.66666666666666">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>liquidityGross</code></td><td>uint128</td><td>풀을 틱 하한 또는 상한 틱으로 사용하는 총 포지션 유동성,</td></tr><tr><td><code>liquidityNet</code></td><td>int128</td><td>풀 가격이 틱을 넘을 때 유동성이 얼마나 변하는지,</td></tr><tr><td><code>feeGrowthOutside0X128</code></td><td>uint256</td><td>token0의 현재 틱에서 틱 반대편의 수수료 증가,</td></tr><tr><td><code>feeGrowthOutside1X128</code></td><td>uint256</td><td>token1의 현재 틱에서 틱 반대편의 수수료 증가, <br>feeGrowthOutsideX128 값은 틱이 초기화된 경우에만 사용할 수 있습니다. 즉, liquidityGross가 0보다 큰 경우입니다. 또한 이러한 값은 상대적이며 계산에 사용됩니다. 스냅샷.</td></tr><tr><td><code>tickCumulativeOutside</code></td><td>int56</td><td></td></tr><tr><td><code>secondsPerLiquidityOutsideX128</code></td><td>uint160</td><td></td></tr><tr><td><code>secondsOutside</code></td><td>uint32</td><td></td></tr><tr><td><code>initialized</code></td><td>bool</td><td></td></tr><tr><td><code>rewardGrowthOutsideX128</code></td><td>uint256</td><td>현재 틱에서 틱 반대편의 reward 증가</td></tr></tbody></table>

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

```solidity
function positions(
    bytes32 key
) external view returns (
    uint128 liquidity, 
    uint256 feeGrowthInside0LastX128, 
    uint256 feeGrowthInside1LastX128, 
    uint128 tokensOwed0, 
    uint128 tokensOwed1,
    uint256 rewardGrowthInsideLastX128,
    uint128 rewardOwed
)
```

포지션 키로 포지션에 대한 정보를 반환합니다.

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

<table><thead><tr><th width="127.66666666666666">Name</th><th width="140">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>key</code></td><td>bytes32</td><td>위치의 키는 소유자인 tickLower 및 tickUpper가 구성한 사전 이미지의 해시입니다.</td></tr></tbody></table>

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

<table><thead><tr><th width="211.66666666666666">Name</th><th width="102">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>liquidity</code></td><td>uint128</td><td>포지션의 유동성 양,</td></tr><tr><td><code>feeGrowthInside0LastX128</code></td><td>uint256</td><td>마지막 mint/burn/poke 기준 틱 범위 내에서 token0의 수수료 증가,</td></tr><tr><td><code>feeGrowthInside1LastX128</code></td><td>uint256</td><td>마지막 mint/burn/poke 기준 틱 범위 내에서 token1의 수수료 증가,</td></tr><tr><td><code>tokensOwed0</code></td><td>uint128</td><td>마지막 mint/burn/poke 시점의 포지션에 빚진 token0의 계산된 금액,</td></tr><tr><td><code>tokensOwed1</code></td><td>uint128</td><td>마지막 mint/burn/poke 시점의 포지션에 빚진 token1의 계산된 금액,</td></tr><tr><td><code>rewardGrowthInsideLastX128</code></td><td>uint256</td><td>마지막 mint/burn/poke 기준 틱 범위 내에서 reward의 증가,</td></tr><tr><td><code>rewardOwed</code></td><td>uint128</td><td>마지막 mint/burn/poke 시점의 포지션에 빚진 reward의 계산된 금액,</td></tr></tbody></table>

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

```solidity
function observe(
    uint32[] secondsAgos
) external view returns (
    int56[] tickCumulatives, 
    uint160[] secondsPerLiquidityCumulativeX128s
)
```

현재 블록 타임스탬프에서 각 타임스탬프 `secondsAgo`시점의 누적 틱 및 유동성을 반환합니다.&#x20;

시간 가중 평균 틱 또는 범위 내 유동성을 얻으려면 두 개의 값으로 호출해야 합니다. \
하나는 기간의 시작을 나타내고 다른 하나는 기간의 끝을 나타냅니다. 예를 들어 지난 시간 가중 평균 틱을 얻으려면 secondsAgos = \[3600, 0]으로 호출해야 합니다. \
시간 가중 평균 틱은 토큰1 / 토큰0의 로그 기준 sqrt(1.0001)에서 풀의 기하학적 시간 가중 평균 가격을 나타냅니다. TickMath 라이브러리를 사용하여 눈금 값에서 비율로 이동할 수 있습니다.

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

<table><thead><tr><th width="177">Name</th><th width="110.66666666666666">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>secondsAgos</code></td><td>uint32[]</td><td>각 누적 틱 및 유동성 값이 반환되어야 하는 시점부터</td></tr></tbody></table>

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

<table><thead><tr><th width="241">Name</th><th width="107.66666666666666">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tickCumulatives</code></td><td>int56[]</td><td>현재 블록 타임스탬프에서 각 <code>secondsAgos</code>의 누적 틱 값</td></tr><tr><td><code>secondsPerLiquidityCumulativeX128s</code></td><td>uint160[]</td><td>현재 블록 타임스탬프에서 각 <code>secondsAgos</code>의 범위 내 유동성 값당 누적 초</td></tr></tbody></table>

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

```solidity
function observations(
    uint256 index
) external view returns (
    uint32 blockTimestamp, 
    int56 tickCumulative, 
    uint160 secondsPerLiquidityCumulativeX128, 
    bool initialized
)
```

특정 관찰 색인에 대한 데이터를 반환합니다.&#x20;

배열의 특정 인덱스가 아닌 일정 시간 전의 관찰을 얻기 위해 이 메서드 대신 #observe()를 사용하고 싶을 가능성이 큽니다.

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

<table><thead><tr><th width="143.66666666666666">Name</th><th width="133">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>index</code></td><td>uint256</td><td>가져올 관찰 배열의 요소</td></tr></tbody></table>

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

<table><thead><tr><th width="242">Name</th><th width="93.66666666666666">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>blockTimestamp</code></td><td>uint256</td><td>관찰의 타임스탬프,</td></tr><tr><td><code>tickCumulative</code></td><td>int56</td><td>관찰 타임스탬프를 기준으로 풀 수명 동안 경과된 시간(초)을 곱한 틱</td></tr><tr><td><code>secondsPerLiquidityCumulativeX128</code></td><td>uint160</td><td>관찰 타임스탬프를 기준으로 풀 수명 동안 범위 내 유동성 초당</td></tr><tr><td><code>initialized</code></td><td>bool</td><td>관찰이 초기화되었고 값이 사용하기에 안전한지 여부</td></tr></tbody></table>
{% endtab %}

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

## **State-Changing Functions**

#### increaseObservationCardinalityNext[​](https://docs.uniswap.org/contracts/v3/reference/core/UniswapV3Pool#increaseobservationcardinalitynext) <a href="#increaseobservationcardinalitynext" id="increaseobservationcardinalitynext"></a>

```solidity
function increaseObservationCardinalityNext(
    uint16 observationCardinalityNext
) external; 
```

이 풀이 저장할 가격 및 유동성 관찰의 최대 수를 늘립니다.&#x20;

이 방법은 풀에 이미 입력 observeCardinalityNext보다 크거나 같은 observeCardinalityNext가 있는 경우 작동하지 않습니다.

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

<table><thead><tr><th width="159.66666666666666">Name</th><th width="144">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>observationCardinalityNext</code></td><td>uint16</td><td>풀이 저장할 최소 관찰 수</td></tr></tbody></table>

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

```solidity
function initialize(
    uint160 sqrtPriceX96
) external;
```

풀의 초기 가격을 설정합니다. 잠금 해제된 상태로 초기화되기 때문에 잠기지 않음

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

<table><thead><tr><th width="185.66666666666666">Name</th><th width="116">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>sqrtPriceX96</code></td><td>uint160</td><td>풀의 초기 sqrt 가격을 Q64.96으로</td></tr></tbody></table>

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

```solidity
function mint(
    address recipient,
    int24 tickLower,
    int24 tickUpper,
    uint128 amount,
    bytes data
) external returns (uint256 amount0, uint256 amount1)
```

주어진 수신자/tickLower/tickUpper 위치에 유동성 추가

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

<table><thead><tr><th width="150.66666666666666">Name</th><th width="108">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>recipient</code></td><td>address</td><td>유동성이 생성될 주소</td></tr><tr><td><code>tickLower</code></td><td>int24</td><td>유동성을 추가할 포지션의 하위 틱</td></tr><tr><td><code>tickUpper</code></td><td>int24</td><td>유동성을 추가할 위치의 상단 틱</td></tr><tr><td><code>amount</code></td><td>uint128</td><td>발행할 유동성의 양</td></tr><tr><td><code>data</code></td><td>bytes</td><td>콜백으로 전달되어야 하는 모든 데이터</td></tr></tbody></table>

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

<table><thead><tr><th width="146.66666666666666">Name</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>amount0</code></td><td>uint256</td><td>주어진 양의 유동성을 발행하기 위해 지불된 token0의 양. 콜백의 값과 일치</td></tr><tr><td><code>amount1</code></td><td>uint256</td><td>주어진 양의 유동성을 발행하기 위해 지불된 token1의 양. 콜백의 값과 일치</td></tr></tbody></table>

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

```solidity
function collect(
    address recipient,
    int24 tickLower,
    int24 tickUpper,
    uint128 amount0Requested,
    uint128 amount1Requested
) external returns (uint128 amount0, uint128 amount1)
```

포지션에 빚진 토큰을 수집합니다.&#x20;

획득한 수수료를 재계산하지 않으며, 이는 발행 또는 유동성 소각을 통해 수행되어야 합니다. \
콜렉트는 포지션 소유자가 호출해야 합니다. token0 또는 token1만 인출하려면 amount0Requested 또는 amount1Requested를 0으로 설정하면 됩니다. \
빚진 모든 토큰을 인출하기 위해 호출자는 빚진 실제 토큰보다 큰 값을 전달할 수 있습니다. 유형(uint128).max. 빚진 토큰은 누적된 스왑 수수료 또는 소진된 유동성에서 나올 수 있습니다.

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

<table><thead><tr><th width="213.66666666666666">Name</th><th width="123">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>recipient</code></td><td>address</td><td>징수된 수수료를 받을 주소</td></tr><tr><td><code>tickLower</code></td><td>int24</td><td>수수료를 징수할 포지션의 하단 틱</td></tr><tr><td><code>tickUpper</code></td><td>int24</td><td>수수료를 징수할 포지션의 상단 틱</td></tr><tr><td><code>amount0Requested</code></td><td>uint128</td><td>지불해야 할 수수료에서 얼마나 많은 token0을 인출해야 하는가</td></tr><tr><td><code>amount1Requested</code></td><td>uint128</td><td>지불해야 할 수수료에서 얼마나 많은 token1을 인출해야 하는가</td></tr></tbody></table>

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

<table><thead><tr><th width="146.66666666666666">Name</th><th width="113">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>amount0</code></td><td>uint128</td><td>token0에서 징수된 수수료 금액</td></tr><tr><td><code>amount1</code></td><td>uint128</td><td>token1에서 징수된 수수료 금액</td></tr></tbody></table>

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

```solidity
function burn(
    int24 tickLower,
    int24 tickUpper,
    uint128 amount
) external returns (uint256 amount0, uint256 amount1)
```

발신자로부터 유동성을 소각하고 유동성에 대해 포지션에 빚진 계정 토큰

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

<table><thead><tr><th width="146.66666666666666">Name</th><th width="131">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tickLower</code></td><td>int24</td><td>유동성을 제거할 포지션의 하위 틱</td></tr><tr><td><code>tickUpper</code></td><td>int24</td><td>유동성을 제거할 포지션의 상위 틱</td></tr><tr><td><code>amount</code></td><td>uint128</td><td>소각할 유동성의 양</td></tr></tbody></table>

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

<table><thead><tr><th width="138.66666666666666">Name</th><th width="116">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>amount0</code></td><td>uint256</td><td>받는 사람에게 보낸 token0의 양</td></tr><tr><td><code>amount1</code></td><td>uint256</td><td>받는 사람에게 보낸 token1의 양</td></tr></tbody></table>

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

```solidity
function swap(
    address recipient,
    bool zeroForOne,
    int256 amountSpecified,
    uint160 sqrtPriceLimitX96,
    bytes data
) external returns (int256 amount0, int256 amount1)
```

token0을 token1로 바꾸거나 token1을 token0으로 바꿉니다.&#x20;

이 메서드의 호출자는 IUniswapV3SwapCallback#uniswapV3SwapCallback 형식의 콜백을 받습니다.

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

<table><thead><tr><th width="225.66666666666666">Name</th><th width="102">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>recipient</code></td><td>address</td><td>스왑 출력을 수신할 주소</td></tr><tr><td><code>zeroForOne</code></td><td>bool</td><td>스왑의 방향, token0에서 token1로 true, token1에서 token0으로 false</td></tr><tr><td><code>amountSpecified</code></td><td>int256</td><td>정확한 입력(양수) 또는 정확한 출력(음수)으로 암시적으로 스왑을 구성하는 스왑의 양</td></tr><tr><td><code>sqrtPriceLimitX96</code></td><td>uint160</td><td>Q64.96 sqrt 가격 제한. token0 -> 1인 경우 가격은 스왑 후 이 값보다 낮을 수 없습니다. token1 -> 0인 경우 스왑 후 가격은 이 값보다 클 수 없습니다.</td></tr><tr><td><code>data</code></td><td>bytes</td><td>콜백으로 전달될 모든 데이터</td></tr></tbody></table>

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

<table><thead><tr><th width="137.66666666666666">Name</th><th width="104">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>amount0</code></td><td>int256</td><td>풀의 token0 잔액 델타, 음수일 때 정확, 양수일 때 최소값</td></tr><tr><td><code>amount1</code></td><td>int256</td><td>풀의 token1 잔액 델타, 음수일 때 정확, 양수일 때 최소값</td></tr></tbody></table>

#### snapshotCumulativesInside[​](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/pool/IUniswapV3PoolDerivedState#snapshotcumulativesinside) <a href="#snapshotcumulativesinside" id="snapshotcumulativesinside"></a>

```solidity
function snapshotCumulativesInside(
    int24 tickLower,
    int24 tickUpper
) external returns (
    int56 tickCumulativeInside, 
    uint160 secondsPerLiquidityInsideX128, 
    uint32 secondsInside
)
```

틱 누적, 유동성당 초 및 틱 범위 내 초의 스냅샷을 반환합니다.&#x20;

스냅샷은 위치가 존재하는 기간 동안 찍은 다른 스냅샷과만 비교해야 합니다. \
즉, 첫 번째 스냅샷이 생성된 시점과 두 번째 스냅샷이 생성된 시점 사이의 전체 기간 동안 포지션이 유지되지 않으면 스냅샷을 비교할 수 없습니다.

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

<table><thead><tr><th width="187">Name</th><th width="86.66666666666666">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tickLower</code></td><td>int24</td><td>범위의 하위 틱</td></tr><tr><td><code>tickUpper</code></td><td>int24</td><td>범위의 상위 틱</td></tr></tbody></table>

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

<table><thead><tr><th width="259">Name</th><th width="102.66666666666666">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tickCumulativeInside</code></td><td>int56</td><td>범위에 대한 틱 누산기의 스냅샷</td></tr><tr><td><code>secondsPerLiquidityInsideX128</code></td><td>uint160</td><td>범위에 대한 유동성당 초의 스냅샷</td></tr><tr><td><code>secondsInside</code></td><td>uint32</td><td>범위에 대한 유동성당 초의 스냅샷</td></tr></tbody></table>
{% endtab %}
{% endtabs %}
