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

# unstaked\_position.gno

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

## Types

### UnstakedPosition

```go
type UnstakedPosition struct
```

UnstakedPosition is the exit checkpoint of a position that left the pool before collecting.

It pins the pool state a later collect must reproduce the exit-time reward from: the tick observed at the exit, the two boundary ticks (which the unstake may prune from the pool), and the tier context (which a later tier change would otherwise re-rate the window with). Collection is per source, so the checkpoint tracks what is left and is dropped when nothing is.

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L9)

#### Methods

**Deposit**

```go
func (u *UnstakedPosition) Deposit() *Deposit
```

Deposit returns the deposit snapshot captured when this position was unstaked.

#### Return Values

| Name      | Type      | Description                                                                                              |
| --------- | --------- | -------------------------------------------------------------------------------------------------------- |
| `deposit` | \*Deposit | Stored deposit state, including its owner, pool, liquidity, ticks, warmups, and collected reward fields. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L92)

**EmissionCollected**

```go
func (u *UnstakedPosition) EmissionCollected() bool
```

EmissionCollected reports whether the emission reward has been collected.

#### Return Values

| Name        | Type | Description                                                                                        |
| ----------- | ---- | -------------------------------------------------------------------------------------------------- |
| `collected` | bool | True after MarkEmissionCollected has been called; false while the internal reward remains pending. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L158)

**ExitTick**

```go
func (u *UnstakedPosition) ExitTick() int32
```

ExitTick returns the pool tick observed at ExitTime.

#### Return Values

| Name       | Type  | Description                                                                         |
| ---------- | ----- | ----------------------------------------------------------------------------------- |
| `exitTick` | int32 | Tick value used to determine the position's in-range status at the exit checkpoint. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L104)

**ExitTime**

```go
func (u *UnstakedPosition) ExitTime() int64
```

ExitTime returns the timestamp at which the position stopped accruing rewards.

#### Return Values

| Name       | Type  | Description                                                                |
| ---------- | ----- | -------------------------------------------------------------------------- |
| `exitTime` | int64 | Unix timestamp pinned as the end of this position's reward-accrual window. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L98)

**FullyCollected**

```go
func (u *UnstakedPosition) FullyCollected() bool
```

FullyCollected reports whether every reward source has been collected.

#### Return Values

| Name        | Type | Description                                                                                    |
| ----------- | ---- | ---------------------------------------------------------------------------------------------- |
| `collected` | bool | True only when the internal emission flag is set and no external incentive IDs remain pending. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L223)

**HasPendingIncentiveId**

```go
func (u *UnstakedPosition) HasPendingIncentiveId(
	incentiveId string
) bool
```

HasPendingIncentiveId reports whether the incentive is still to be collected.

#### Parameters

| Name          | Type   | Description                                                                |
| ------------- | ------ | -------------------------------------------------------------------------- |
| `incentiveId` | string | External incentive identifier to look up in this checkpoint's pending set. |

#### Return Values

| Name      | Type | Description                                                                                    |
| --------- | ---- | ---------------------------------------------------------------------------------------------- |
| `pending` | bool | True when incentiveId is currently pending; false when it is absent or the pending set is nil. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L170)

**HasPendingIncentives**

```go
func (u *UnstakedPosition) HasPendingIncentives() bool
```

HasPendingIncentives reports whether any incentive is still to be collected.

#### Return Values

| Name      | Type | Description                                                                    |
| --------- | ---- | ------------------------------------------------------------------------------ |
| `pending` | bool | True when at least one external incentive ID remains pending; false otherwise. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L203)

**LowerOutsideAcc**

```go
func (u *UnstakedPosition) LowerOutsideAcc() string
```

LowerOutsideAcc returns the lower boundary tick's outside accumulation at ExitTime.

#### Return Values

| Name              | Type   | Description                                                                   |
| ----------------- | ------ | ----------------------------------------------------------------------------- |
| `lowerOutsideAcc` | string | Decimal-encoded reward-ratio accumulation outside the lower boundary at exit. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L122)

**LowerTick**

```go
func (u *UnstakedPosition) LowerTick() *Tick
```

LowerTick returns the position's lower boundary tick snapshot.

#### Return Values

| Name        | Type   | Description                                                                        |
| ----------- | ------ | ---------------------------------------------------------------------------------- |
| `lowerTick` | \*Tick | Stored lower boundary tick used when calculating rewards for this exit checkpoint. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L110)

**MarkEmissionCollected**

```go
func (u *UnstakedPosition) MarkEmissionCollected()
```

MarkEmissionCollected records that the emission reward has been collected.

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L161)

**MarkIncentiveCollected**

```go
func (u *UnstakedPosition) MarkIncentiveCollected(
	incentiveId string
)
```

MarkIncentiveCollected records that the incentive has been collected.

#### Parameters

| Name          | Type   | Description                                                   |
| ------------- | ------ | ------------------------------------------------------------- |
| `incentiveId` | string | External incentive identifier to remove from the pending set. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L211)

**PendingIncentiveCount**

```go
func (u *UnstakedPosition) PendingIncentiveCount() int
```

PendingIncentiveCount returns how many incentives are still to be collected.

#### Return Values

| Name    | Type | Description                                                           |
| ------- | ---- | --------------------------------------------------------------------- |
| `count` | int  | Number of external incentive IDs currently pending in the checkpoint. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L195)

**PendingIncentiveIdList**

```go
func (u *UnstakedPosition) PendingIncentiveIdList() []string
```

PendingIncentiveIdList returns the incentives still to be collected.

#### Return Values

| Name           | Type      | Description                                                               |
| -------------- | --------- | ------------------------------------------------------------------------- |
| `incentiveIds` | \[]string | IDs currently present in the pending set; iteration order is unspecified. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L182)

**Tier**

```go
func (u *UnstakedPosition) Tier() uint64
```

Tier returns the pool's emission tier at ExitTime, or 0 when it was not tiered.

#### Return Values

| Name   | Type   | Description                                                          |
| ------ | ------ | -------------------------------------------------------------------- |
| `tier` | uint64 | Tier identifier pinned at exit; zero means no emission tier applied. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L134)

**TierCount**

```go
func (u *UnstakedPosition) TierCount() uint64
```

TierCount returns how many pools shared the tier at ExitTime.

#### Return Values

| Name        | Type   | Description                                                  |
| ----------- | ------ | ------------------------------------------------------------ |
| `tierCount` | uint64 | Number of pools in the pinned tier when the position exited. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L146)

**TierRatio**

```go
func (u *UnstakedPosition) TierRatio() uint64
```

TierRatio returns the tier's emission ratio at ExitTime.

#### Return Values

| Name        | Type   | Description                                                   |
| ----------- | ------ | ------------------------------------------------------------- |
| `tierRatio` | uint64 | Stored scaled reward-share ratio for the pinned tier at exit. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L140)

**UnstakingFee**

```go
func (u *UnstakedPosition) UnstakingFee() uint64
```

UnstakingFee returns the staking-reward fee rate in force at ExitTime.

#### Return Values

| Name           | Type   | Description                                                        |
| -------------- | ------ | ------------------------------------------------------------------ |
| `unstakingFee` | uint64 | Fee rate pinned for this exit in basis points (0-1,000; 100 = 1%). |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L152)

**UpperOutsideAcc**

```go
func (u *UnstakedPosition) UpperOutsideAcc() string
```

UpperOutsideAcc returns the upper boundary tick's outside accumulation at ExitTime.

#### Return Values

| Name              | Type   | Description                                                                   |
| ----------------- | ------ | ----------------------------------------------------------------------------- |
| `upperOutsideAcc` | string | Decimal-encoded reward-ratio accumulation outside the upper boundary at exit. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L128)

**UpperTick**

```go
func (u *UnstakedPosition) UpperTick() *Tick
```

UpperTick returns the position's upper boundary tick snapshot.

#### Return Values

| Name        | Type   | Description                                                                        |
| ----------- | ------ | ---------------------------------------------------------------------------------- |
| `upperTick` | \*Tick | Stored upper boundary tick used when calculating rewards for this exit checkpoint. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L116)

#### Constructors

* `func NewUnstakedPosition(deposit *Deposit, exitTime int64, exitTick int32, lowerTick *Tick, upperTick *Tick, lowerOutsideAcc string, upperOutsideAcc string, tier uint64, tierRatio uint64, tierCount uint64, unstakingFee uint64, pendingIncentiveIds []string) *UnstakedPosition` ([source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/staker/unstaked_position.gno#L52))
