> For the complete documentation index, see [llms.txt](https://docs.gnoswap.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gnoswap.io/contracts/pool/pool.gno.md).

# pool.gno

{% embed url="<https://github.com/gnoswap-labs/gnoswap/blob/main/contract/r/gnoswap/pool/v1/pool.gno>" %}

Defines the basic functionality of a liquidity pool such as adding and removing liquidity or performing swaps.

## Mint

```go
func Mint(
	cur realm,
	token0Path string,
	token1Path string,
	fee uint32,
	tickLower int32,
	tickUpper int32,
	liquidityAmount string,
	positionCaller address
) (string, string)
```

Mint adds liquidity to a pool. This function can only be called by the Position contract, not by users.

#### Parameters

| Name              | Type    | Description                                                                                                                               |
| ----------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `cur`             | realm   | Pass `cross` as argument.                                                                                                                 |
| `token0Path`      | string  | The path of token0 of the desired pool.                                                                                                   |
| `token1Path`      | string  | The path of token1 of the desired pool.                                                                                                   |
| `fee`             | uint32  | The fee tier of the desired pool.                                                                                                         |
| `tickLower`       | int32   | The lower tick of the price range of the position.                                                                                        |
| `tickUpper`       | int32   | The upper tick of the price range of the position.                                                                                        |
| `liquidityAmount` | string  | The amount of liquidity to add. This value is calculated by the Position contract based on the amounts of token0 & token1, and the price. |
| `positionCaller`  | address | The caller address from the position contract.                                                                                            |

#### Return Values

| Name      | Type   | Description                                                                 |
| --------- | ------ | --------------------------------------------------------------------------- |
| `amount0` | string | The amount of token0 that added to the liquidity pool to mint the position. |
| `amount1` | string | The amount of token1 that added to the liquidity pool to mint the position. |

## Burn

```go
func Burn(
	cur realm,
	token0Path string,
	token1Path string,
	fee uint32,
	tickLower int32,
	tickUpper int32,
	liquidityAmount string,
	positionCaller address
) (string, string)
```

Burn removes liquidity from a pool. This function can only be called by the Position contract, not by users.

#### Parameters

| Name              | Type    | Description                                        |
| ----------------- | ------- | -------------------------------------------------- |
| `cur`             | realm   | Pass `cross` as argument.                          |
| `token0Path`      | string  | The path of token0 of the desired pool.            |
| `token1Path`      | string  | The path of token1 of the desired pool.            |
| `fee`             | uint32  | The fee tier of the desired pool.                  |
| `tickLower`       | int32   | The lower tick of the price range of the position. |
| `tickUpper`       | int32   | The upper tick of the price range of the position. |
| `liquidityAmount` | string  | The amount of liquidity to remove.                 |
| `positionCaller`  | address | The caller address from the position contract.     |

#### Return Values

| Name      | Type   | Description                                                                  |
| --------- | ------ | ---------------------------------------------------------------------------- |
| `amount0` | string | The amount of token0 that was removed from the pool by burning the position. |
| `amount1` | string | The amount of token1 that was removed from the pool by burning the position. |

## Collect

```go
func Collect(
	cur realm,
	token0Path string,
	token1Path string,
	fee uint32,
	recipient address,
	tickLower int32,
	tickUpper int32,
	amount0Requested string,
	amount1Requested string
) (string, string)

```

Collect collects swap fees in token0 and token1 accrued to a position. This function can only be called by the Position contract, not by users.

#### Parameters

| Name               | Type    | Description                                            |
| ------------------ | ------- | ------------------------------------------------------ |
| `cur`              | realm   | Pass `cross` as argument.                              |
| `token0Path`       | string  | The path of token0 of the desired pool.                |
| `token1Path`       | string  | The path of token1 of the desired pool.                |
| `fee`              | uint32  | The fee tier of the desired pool.                      |
| `recipient`        | address | The address that will receive the collected fees.      |
| `tickLower`        | int32   | The lower tick of the price range of the position.     |
| `tickUpper`        | int32   | The upper tick of the price range of the position.     |
| `amount0Requested` | string  | The maximum amount of token0 to collect from the pool. |
| `amount1Requested` | string  | The maximum amount of token1 to collect from the pool. |

#### Return Values

| Name      | Type   | Description                                                |
| --------- | ------ | ---------------------------------------------------------- |
| `amount0` | string | The amount of token0 that was collected from the position. |
| `amount1` | string | The amount of token1 that was collected from the position. |

## CollectProtocol

```go
func CollectProtocol(
	cur realm,
	token0Path string,
	token1Path string,
	fee uint32,
	recipient address,
	amount0Requested string,
	amount1Requested string
) (string, string)

```

CollectProtocol collects the Protocol Fee claimable from a pool.

#### Parameters

| Name               | Type    | Description                                               |
| ------------------ | ------- | --------------------------------------------------------- |
| `cur`              | realm   | Pass `cross` as argument.                                 |
| `token0Path`       | string  | The path of token0 of the desired pool.                   |
| `token1Path`       | string  | The path of token1 of the desired pool.                   |
| `fee`              | uint32  | The fee tier of the desired pool.                         |
| `recipient`        | address | The address that will receive the collected Protocol Fee. |
| `amount0Requested` | string  | The maximum amount of token0 to collect from the pool.    |
| `amount1Requested` | string  | The maximum amount of token1 to collect from the pool.    |

#### Return Values

| Name      | Type   | Description                                            |
| --------- | ------ | ------------------------------------------------------ |
| `amount0` | string | The amount of token0 that was collected from the pool. |
| `amount1` | string | The amount of token1 that was collected from the pool. |
