> 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. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gnoswap.io/contracts/pool/pool.gno.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
