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

# getters.gno

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

## ExistsDelegation

```go
func ExistsDelegation(
	delegationID int64
) bool
```

ExistsDelegation checks if a delegation exists.

#### Parameters

| Name           | Type  | Description                                      |
| -------------- | ----- | ------------------------------------------------ |
| `delegationID` | int64 | Numeric identifier of the delegation to look up. |

#### Return Values

| Name   | Type | Description                                                       |
| ------ | ---- | ----------------------------------------------------------------- |
| `bool` | bool | true when a delegation with delegationID exists, false otherwise. |

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

## GetClaimableRewardByAddress

```go
func GetClaimableRewardByAddress(
	addr address
) (int64, map[string]int64, error)
```

GetClaimableRewardByAddress returns claimable rewards for an address.

#### Parameters

| Name   | Type    | Description                                                  |
| ------ | ------- | ------------------------------------------------------------ |
| `addr` | address | Address whose emission and protocol-fee rewards are queried. |

#### Return Values

| Name               | Type              | Description                                                            |
| ------------------ | ----------------- | ---------------------------------------------------------------------- |
| `int64`            | int64             | emission reward amount available to addr.                              |
| `map[string]int64` | map\[string]int64 | protocol-fee reward amounts keyed by token path.                       |
| `error`            | error             | nil on success; non-nil when reward state cannot be resolved for addr. |

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

## GetClaimableRewardByLaunchpad

```go
func GetClaimableRewardByLaunchpad(
	addr address
) (int64, map[string]int64, error)
```

GetClaimableRewardByLaunchpad returns claimable launchpad rewards for an address.

#### Parameters

| Name   | Type    | Description                                                   |
| ------ | ------- | ------------------------------------------------------------- |
| `addr` | address | Address whose launchpad and protocol-fee rewards are queried. |

#### Return Values

| Name               | Type              | Description                                                            |
| ------------------ | ----------------- | ---------------------------------------------------------------------- |
| `int64`            | int64             | emission reward amount available to addr.                              |
| `map[string]int64` | map\[string]int64 | protocol-fee reward amounts keyed by token path.                       |
| `error`            | error             | nil on success; non-nil when reward state cannot be resolved for addr. |

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

## GetClaimableRewardByRewardID

```go
func GetClaimableRewardByRewardID(
	rewardID string
) (int64, map[string]int64, error)
```

GetClaimableRewardByRewardID returns claimable reward details by reward ID.

#### Parameters

| Name       | Type   | Description                                                  |
| ---------- | ------ | ------------------------------------------------------------ |
| `rewardID` | string | Reward-state identifier whose claimable rewards are queried. |

#### Return Values

| Name               | Type              | Description                                               |
| ------------------ | ----------------- | --------------------------------------------------------- |
| `int64`            | int64             | emission reward amount associated with rewardID.          |
| `map[string]int64` | map\[string]int64 | protocol-fee reward amounts keyed by token path.          |
| `error`            | error             | nil on success; non-nil when rewardID cannot be resolved. |

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

## GetCollectableWithdrawAmount

```go
func GetCollectableWithdrawAmount(
	delegationID int64
) int64
```

GetCollectableWithdrawAmount returns the collectable withdraw amount for a specific delegation.

#### Parameters

| Name           | Type  | Description                                                       |
| -------------- | ----- | ----------------------------------------------------------------- |
| `delegationID` | int64 | Identifier of the delegation whose collectable amount is queried. |

#### Return Values

| Name    | Type  | Description                                              |
| ------- | ----- | -------------------------------------------------------- |
| `int64` | int64 | amount currently available to collect from delegationID. |

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

## GetDelegationWithdrawCount

```go
func GetDelegationWithdrawCount(
	delegationID int64
) int
```

GetDelegationWithdrawCount returns the total number of delegation withdraws for a specific delegation.

#### Parameters

| Name           | Type  | Description                                                 |
| -------------- | ----- | ----------------------------------------------------------- |
| `delegationID` | int64 | Identifier of the delegation whose withdrawals are counted. |

#### Return Values

| Name  | Type | Description                                                |
| ----- | ---- | ---------------------------------------------------------- |
| `int` | int  | number of withdrawal records associated with delegationID. |

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

## GetDelegations

```go
func GetDelegations() *rotree.ReadOnlyTree
```

GetDelegations returns a read-only view of every delegation, keyed by the decimal string form of the delegation ID. Callers paginate it themselves through IterateByOffset. Reading an entry yields a clone, so the view cannot mutate realm state.

#### Return Values

| Name                   | Type                  | Description                                                                          |
| ---------------------- | --------------------- | ------------------------------------------------------------------------------------ |
| `*rotree.ReadOnlyTree` | \*rotree.ReadOnlyTree | read-only delegation view keyed by decimal delegation ID; entry reads return clones. |

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

## GetDelegatorDelegations

```go
func GetDelegatorDelegations(
	delegator address
) *rotree.ReadOnlyTree
```

GetDelegatorDelegations returns a read-only view of a delegator's delegations, keyed by delegatee address with that pair's delegation IDs as the value. Reading an entry yields a copy of the ID slice, so the view cannot mutate realm state. nil is returned when the delegator has no delegations.

#### Parameters

| Name        | Type    | Description                                 |
| ----------- | ------- | ------------------------------------------- |
| `delegator` | address | Address whose delegations should be listed. |

#### Return Values

| Name                   | Type                  | Description                                                                          |
| ---------------------- | --------------------- | ------------------------------------------------------------------------------------ |
| `*rotree.ReadOnlyTree` | \*rotree.ReadOnlyTree | read-only view keyed by delegatee address, or nil when delegator has no delegations. |

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

## GetEmissionAccumulatedTimestamp

```go
func GetEmissionAccumulatedTimestamp() int64
```

GetEmissionAccumulatedTimestamp returns the accumulated timestamp for emission rewards.

#### Return Values

| Name    | Type  | Description                                                     |
| ------- | ----- | --------------------------------------------------------------- |
| `int64` | int64 | Unix timestamp at which emission accumulation was last updated. |

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

## GetEmissionAccumulatedX128PerStake

```go
func GetEmissionAccumulatedX128PerStake() *u256.Uint
```

GetEmissionAccumulatedX128PerStake returns the accumulated emission per stake (Q128).

#### Return Values

| Name         | Type        | Description                                                          |
| ------------ | ----------- | -------------------------------------------------------------------- |
| `*u256.Uint` | \*u256.Uint | accumulated emission reward per unit stake in Q128 fixed-point form. |

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

## GetEmissionDistributedAmount

```go
func GetEmissionDistributedAmount() int64
```

GetEmissionDistributedAmount returns the total distributed emission amount.

#### Return Values

| Name    | Type  | Description                                   |
| ------- | ----- | --------------------------------------------- |
| `int64` | int64 | total emission amount distributed to stakers. |

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

## GetLaunchpadProjectDeposit

```go
func GetLaunchpadProjectDeposit(
	projectAddr string
) (int64, bool)
```

GetLaunchpadProjectDeposit returns the deposit amount for a launchpad project.

#### Parameters

| Name          | Type   | Description                                                  |
| ------------- | ------ | ------------------------------------------------------------ |
| `projectAddr` | string | Launchpad project address whose deposited amount is queried. |

#### Return Values

| Name    | Type  | Description                                                         |
| ------- | ----- | ------------------------------------------------------------------- |
| `int64` | int64 | recorded launchpad project deposit amount.                          |
| `bool`  | bool  | true when a deposit record exists for projectAddr; false otherwise. |

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

## GetProtocolFeeAccumulatedTimestamp

```go
func GetProtocolFeeAccumulatedTimestamp() int64
```

GetProtocolFeeAccumulatedTimestamp returns the accumulated timestamp for protocol fee rewards.

#### Return Values

| Name    | Type  | Description                                                         |
| ------- | ----- | ------------------------------------------------------------------- |
| `int64` | int64 | Unix timestamp at which protocol-fee accumulation was last updated. |

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

## GetProtocolFeeAccumulatedX128PerStake

```go
func GetProtocolFeeAccumulatedX128PerStake(
	tokenPath string
) *u256.Uint
```

GetProtocolFeeAccumulatedX128PerStake returns the accumulated protocol fee per stake (Q128) for a token path.

#### Parameters

| Name        | Type   | Description                                                      |
| ----------- | ------ | ---------------------------------------------------------------- |
| `tokenPath` | string | Registered token path whose protocol-fee accumulator is queried. |

#### Return Values

| Name         | Type        | Description                                                              |
| ------------ | ----------- | ------------------------------------------------------------------------ |
| `*u256.Uint` | \*u256.Uint | accumulated protocol-fee amount per unit stake in Q128 fixed-point form. |

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

## GetProtocolFeeAmount

```go
func GetProtocolFeeAmount(
	tokenPath string
) int64
```

GetProtocolFeeAmount returns the protocol fee amounts for a token path.

#### Parameters

| Name        | Type   | Description                                            |
| ----------- | ------ | ------------------------------------------------------ |
| `tokenPath` | string | Registered token path whose protocol fees are queried. |

#### Return Values

| Name    | Type  | Description                                                        |
| ------- | ----- | ------------------------------------------------------------------ |
| `int64` | int64 | accumulated protocol-fee amount for tokenPath in token base units. |

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

## GetTotalDelegated

```go
func GetTotalDelegated() int64
```

GetTotalDelegated returns the total amount of GNS delegated.

#### Return Values

| Name    | Type  | Description                                       |
| ------- | ----- | ------------------------------------------------- |
| `int64` | int64 | total GNS amount delegated across all delegators. |

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

## GetTotalDelegationAmountAtSnapshot

```go
func GetTotalDelegationAmountAtSnapshot(
	snapshotTime int64
) (int64, bool)
```

GetTotalDelegationAmountAtSnapshot returns total delegation at a Unix timestamp, using the latest history entry at or before that timestamp. The lookup is timestamp-based rather than a block-height snapshot.

#### Parameters

| Name           | Type  | Description                                                                                |
| -------------- | ----- | ------------------------------------------------------------------------------------------ |
| `snapshotTime` | int64 | Unix timestamp at or before which to select the latest aggregate delegation history entry. |

#### Return Values

| Name    | Type  | Description                                                                    |
| ------- | ----- | ------------------------------------------------------------------------------ |
| `int64` | int64 | aggregate delegated amount recorded at or before snapshotTime.                 |
| `bool`  | bool  | true when a qualifying history entry exists; false when no entry is available. |

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

## GetTotalLockedAmount

```go
func GetTotalLockedAmount() int64
```

GetTotalLockedAmount returns the total amount of GNS locked in undelegation.

#### Return Values

| Name    | Type  | Description                                                    |
| ------- | ----- | -------------------------------------------------------------- |
| `int64` | int64 | total GNS amount currently locked in undelegation withdrawals. |

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

## GetTotalxGnsSupply

```go
func GetTotalxGnsSupply() int64
```

GetTotalxGnsSupply returns total xGNS supply, including launchpad-held xGNS.

#### Return Values

| Name    | Type  | Description                                                   |
| ------- | ----- | ------------------------------------------------------------- |
| `int64` | int64 | total xGNS supply, including xGNS held by launchpad projects. |

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

## GetUnDelegationLockupPeriod

```go
func GetUnDelegationLockupPeriod() int64
```

GetUnDelegationLockupPeriod returns the undelegation lockup period in seconds.

#### Return Values

| Name    | Type  | Description                                         |
| ------- | ----- | --------------------------------------------------- |
| `int64` | int64 | configured undelegation lockup duration in seconds. |

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

## GetUserDelegationAmountAtSnapshot

```go
func GetUserDelegationAmountAtSnapshot(
	userAddr address,
	snapshotTime int64
) (int64, bool)
```

GetUserDelegationAmountAtSnapshot returns one user's delegation at a Unix timestamp, using that user's latest history entry at or before the timestamp. The bool is false when no qualifying history entry exists.

#### Parameters

| Name           | Type    | Description                                                                  |
| -------------- | ------- | ---------------------------------------------------------------------------- |
| `userAddr`     | address | Delegator address whose historical delegation is queried.                    |
| `snapshotTime` | int64   | Unix timestamp at or before which to select the user's latest history entry. |

#### Return Values

| Name    | Type  | Description                                                        |
| ------- | ----- | ------------------------------------------------------------------ |
| `int64` | int64 | user's delegated amount recorded at or before snapshotTime.        |
| `bool`  | bool  | true when a qualifying user-history entry exists; false otherwise. |

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

## GetUserDelegationIDs

```go
func GetUserDelegationIDs(
	delegator address,
	delegatee address
) []int64
```

GetUserDelegationIDs returns a list of delegation IDs for a specific delegator-delegatee pair.

#### Parameters

| Name        | Type    | Description                           |
| ----------- | ------- | ------------------------------------- |
| `delegator` | address | Address that supplied the delegation. |
| `delegatee` | address | Address receiving that delegation.    |

#### Return Values

| Name      | Type     | Description                                                                                        |
| --------- | -------- | -------------------------------------------------------------------------------------------------- |
| `[]int64` | \[]int64 | delegation IDs for the delegator-delegatee pair; the returned slice is independent of realm state. |

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

## HasDelegationSnapshotsKey

```go
func HasDelegationSnapshotsKey() bool
```

HasDelegationSnapshotsKey returns true if delegation history exists.

#### Return Values

| Name   | Type | Description                                                   |
| ------ | ---- | ------------------------------------------------------------- |
| `bool` | bool | true when delegation history has been initialized in storage. |

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