> 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/position/getter.gno.md).

# getter.gno

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

## GetPositionCount

```go
func GetPositionCount() int

```

GetPositionCount returns the total number of positions.

#### Return Values

| Name    | Type | Description               |
| ------- | ---- | ------------------------- |
| `count` | int  | total number of positions |

***

## GetPositionIDs

```go
func GetPositionIDs(
	offset int,
	count int
) []uint64

```

GetPositionIDs returns a paginated list of position IDs.

#### Parameters

| Name     | Type | Description                      |
| -------- | ---- | -------------------------------- |
| `offset` | int  | starting index for pagination    |
| `count`  | int  | number of position IDs to return |

#### Return Values

| Name          | Type      | Description           |
| ------------- | --------- | --------------------- |
| `positionIDs` | \[]uint64 | slice of position IDs |

***

## GetPosition

```go
func GetPosition(positionId uint64) (Position, error)

```

GetPosition returns the position data for a given position ID.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name       | Type     | Description                   |
| ---------- | -------- | ----------------------------- |
| `position` | Position | the position data             |
| `err`      | error    | non-nil if position not found |

***

## IsBurned

```go
func IsBurned(
	positionId uint64
) bool

```

IsBurned returns whether a position has been burned.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name     | Type | Description                      |
| -------- | ---- | -------------------------------- |
| `burned` | bool | true if position has been burned |

***

## IsInRange

```go
func IsInRange(
	positionId uint64
) bool

```

IsInRange returns whether a position's ticks are within the current price range.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name      | Type | Description                                    |
| --------- | ---- | ---------------------------------------------- |
| `inRange` | bool | true if position is within current price range |

***

## GetPositionToken0Balance

```go
func GetPositionToken0Balance(
	positionId uint64
) *u256.Uint

```

GetPositionToken0Balance returns the token0 balance of a position.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name      | Type        | Description    |
| --------- | ----------- | -------------- |
| `balance` | \*u256.Uint | token0 balance |

***

## GetPositionToken1Balance

```go
func GetPositionToken1Balance(
	positionId uint64
) *u256.Uint

```

GetPositionToken1Balance returns the token1 balance of a position.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name      | Type        | Description    |
| --------- | ----------- | -------------- |
| `balance` | \*u256.Uint | token1 balance |

***

## GetPositionTokenBalances

```go
func GetPositionTokenBalances(
	positionId uint64
) (string, string)

```

GetPositionTokenBalances returns the token balances of a position.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name            | Type   | Description       |
| --------------- | ------ | ----------------- |
| `token0Balance` | string | balance of token0 |
| `token1Balance` | string | balance of token1 |

***

## GetPositionFeeGrowthInside0LastX128

```go
func GetPositionFeeGrowthInside0LastX128(
	positionId uint64
) *u256.Uint

```

GetPositionFeeGrowthInside0LastX128 returns the last recorded fee growth inside for token0.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name        | Type        | Description                                 |
| ----------- | ----------- | ------------------------------------------- |
| `feeGrowth` | \*u256.Uint | fee growth inside for token0 in X128 format |

***

## GetPositionFeeGrowthInside1LastX128

```go
func GetPositionFeeGrowthInside1LastX128(
	positionId uint64
) *u256.Uint

```

GetPositionFeeGrowthInside1LastX128 returns the last recorded fee growth inside for token1.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name        | Type        | Description                                 |
| ----------- | ----------- | ------------------------------------------- |
| `feeGrowth` | \*u256.Uint | fee growth inside for token1 in X128 format |

***

## GetPositionFeeGrowthInsideLastX128

```go
func GetPositionFeeGrowthInsideLastX128(
	positionId uint64
) (*u256.Uint, *u256.Uint)

```

GetPositionFeeGrowthInsideLastX128 returns the last recorded fee growth inside for both tokens.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name         | Type        | Description                                 |
| ------------ | ----------- | ------------------------------------------- |
| `feeGrowth0` | \*u256.Uint | fee growth inside for token0 in X128 format |
| `feeGrowth1` | \*u256.Uint | fee growth inside for token1 in X128 format |

***

## GetPositionLiquidity

```go
func GetPositionLiquidity(
	positionId uint64
) *u256.Uint

```

GetPositionLiquidity returns the liquidity amount of a position.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name        | Type        | Description                      |
| ----------- | ----------- | -------------------------------- |
| `liquidity` | \*u256.Uint | liquidity amount of the position |

***

## GetPositionOperator

```go
func GetPositionOperator(
	positionId uint64
) address

```

GetPositionOperator returns the operator address of a position.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name       | Type    | Description                                 |
| ---------- | ------- | ------------------------------------------- |
| `operator` | address | address approved for spending this position |

***

## GetPositionOwner

```go
func GetPositionOwner(
	positionId uint64
) address

```

GetPositionOwner returns the owner address of a position NFT.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name    | Type    | Description                        |
| ------- | ------- | ---------------------------------- |
| `owner` | address | address that owns the position NFT |

***

## GetPositionPoolKey

```go
func GetPositionPoolKey(
	positionId uint64
) string

```

GetPositionPoolKey returns the pool key of a position.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name      | Type   | Description          |
| --------- | ------ | -------------------- |
| `poolKey` | string | pool path identifier |

***

## GetPositionTickLower

```go
func GetPositionTickLower(
	positionId uint64
) int32

```

GetPositionTickLower returns the lower tick of a position.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name        | Type  | Description         |
| ----------- | ----- | ------------------- |
| `tickLower` | int32 | lower tick boundary |

***

## GetPositionTickUpper

```go
func GetPositionTickUpper(
	positionId uint64
) int32

```

GetPositionTickUpper returns the upper tick of a position.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name        | Type  | Description         |
| ----------- | ----- | ------------------- |
| `tickUpper` | int32 | upper tick boundary |

***

## GetPositionTicks

```go
func GetPositionTicks(
	positionId uint64
) (int32, int32)

```

GetPositionTicks returns the lower and upper ticks of a position.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name        | Type  | Description         |
| ----------- | ----- | ------------------- |
| `tickLower` | int32 | lower tick boundary |
| `tickUpper` | int32 | upper tick boundary |

***

## GetPositionTokensOwed0

```go
func GetPositionTokensOwed0(
	positionId uint64
) *u256.Uint

```

GetPositionTokensOwed0 returns the amount of token0 owed to a position.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name         | Type        | Description           |
| ------------ | ----------- | --------------------- |
| `tokensOwed` | \*u256.Uint | amount of token0 owed |

***

## GetPositionTokensOwed1

```go
func GetPositionTokensOwed1(
	positionId uint64
) *u256.Uint

```

GetPositionTokensOwed1 returns the amount of token1 owed to a position.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name         | Type        | Description           |
| ------------ | ----------- | --------------------- |
| `tokensOwed` | \*u256.Uint | amount of token1 owed |

***

## GetPositionTokensOwed

```go
func GetPositionTokensOwed(
	positionId uint64
) (*u256.Uint, *u256.Uint)

```

GetPositionTokensOwed returns the amount of tokens owed to a position.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name          | Type        | Description           |
| ------------- | ----------- | --------------------- |
| `tokensOwed0` | \*u256.Uint | amount of token0 owed |
| `tokensOwed1` | \*u256.Uint | amount of token1 owed |

***

## GetUnclaimedFee

```go
func GetUnclaimedFee(
	positionId uint64
) (*u256.Uint, *u256.Uint)

```

GetUnclaimedFee returns the unclaimed fees for both tokens of a position.

#### Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| `positionId` | uint64 | ID of the position |

#### Return Values

| Name            | Type        | Description                     |
| --------------- | ----------- | ------------------------------- |
| `unclaimedFee0` | \*u256.Uint | unclaimed fee amount for token0 |
| `unclaimedFee1` | \*u256.Uint | unclaimed fee amount for token1 |
