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

# staker.gno

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

Stakes or unstakes a position obtained from adding liquidity.

## StakeToken

```go
func StakeToken(
	cur realm,
	positionId uint64,
	referrer string
) string
```

StakeToken stakes a position.

#### Parameters

| Name         | Type   | Description                               |
| ------------ | ------ | ----------------------------------------- |
| `cur`        | realm  | Pass `cross` as argument.                 |
| `positionId` | uint64 | The ID of the position to stake.          |
| `referrer`   | string | The referrer address for reward tracking. |

#### Return Values

| Name       | Type   | Description                                    |
| ---------- | ------ | ---------------------------------------------- |
| `poolPath` | string | The path of the pool that the position exists. |

## UnStakeToken

```go
func UnStakeToken(
	cur realm,
	positionId uint64,
	unwrapResult bool
) string
```

UnStakeToken unstakes a position.

#### Parameters

| Name           | Type   | Description                        |
| -------------- | ------ | ---------------------------------- |
| `cur`          | realm  | Pass `cross` as argument.          |
| `positionId`   | uint64 | The ID of the position to unstake. |
| `unwrapResult` | bool   | Whether to unwrap WGNOT to GNOT.   |

#### Return Values

| Name       | Type   | Description                                                   |
| ---------- | ------ | ------------------------------------------------------------- |
| `poolPath` | string | The path of the pool that the position will be unstaked from. |

## CollectReward

```go
func CollectReward(
	cur realm,
	positionId uint64,
	unwrapResult bool
) (string, string, map[string]int64, map[string]int64)
```

CollectReward collects staking rewards accrued to a position.

#### Parameters

| Name           | Type   | Description                                                             |
| -------------- | ------ | ----------------------------------------------------------------------- |
| `cur`          | realm  | Pass `cross` as argument.                                               |
| `positionId`   | uint64 | The ID of the position to collect incentives from.                      |
| `unwrapResult` | bool   | (if position has wugnot fee) whether to receive reward in ugnot or not. |

#### Return Values

| Name              | Type              | Description                                    |
| ----------------- | ----------------- | ---------------------------------------------- |
| `poolPath`        | string            | The path of the pool that the position exists. |
| `stakeDetail`     | string            | The staking details.                           |
| `internalRewards` | map\[string]int64 | The internal rewards.                          |
| `externalRewards` | map\[string]int64 | The external rewards.                          |
