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

# getters.gno

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

## ExistsProposal

```go
func ExistsProposal(
	proposalID int64
) bool
```

ExistsProposal checks whether a proposal is stored.

#### Parameters

| Name         | Type  | Description                    |
| ------------ | ----- | ------------------------------ |
| `proposalID` | int64 | proposal identifier to look up |

#### Return Values

| Name   | Type | Description                                     |
| ------ | ---- | ----------------------------------------------- |
| `bool` | bool | true when proposalID is stored, otherwise false |

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

## ExistsVotingInfo

```go
func ExistsVotingInfo(
	proposalID int64,
	addr address
) bool
```

ExistsVotingInfo checks whether voting information exists for a user on a proposal.

#### Parameters

| Name         | Type    | Description                                |
| ------------ | ------- | ------------------------------------------ |
| `proposalID` | int64   | proposal identifier to inspect             |
| `addr`       | address | voter address to look up within proposalID |

#### Return Values

| Name   | Type | Description                                                      |
| ------ | ---- | ---------------------------------------------------------------- |
| `bool` | bool | true when voting information exists for the proposal and address |

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

## GetConfigVersionByProposalId

```go
func GetConfigVersionByProposalId(
	proposalId int64
) (int64, error)
```

GetConfigVersionByProposalId returns the config version used by a proposal.

#### Parameters

| Name         | Type  | Description                    |
| ------------ | ----- | ------------------------------ |
| `proposalId` | int64 | proposal identifier to inspect |

#### Return Values

| Name    | Type  | Description                                                  |
| ------- | ----- | ------------------------------------------------------------ |
| `int64` | int64 | governance configuration version captured by the proposal    |
| `error` | error | nil on success, or an error when the proposal does not exist |

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

## GetCurrentProposalID

```go
func GetCurrentProposalID() int64
```

GetCurrentProposalID returns the current proposal ID counter.

#### Return Values

| Name    | Type  | Description                                                  |
| ------- | ----- | ------------------------------------------------------------ |
| `int64` | int64 | current proposal ID counter used for newly created proposals |

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

## GetCurrentVotingWeightSnapshot

```go
func GetCurrentVotingWeightSnapshot() (int64, int64, error)
```

GetCurrentVotingWeightSnapshot returns the current total voting weight and its timestamp anchor computed with the configured smoothing duration.

#### Return Values

| Name    | Type  | Description                                                                                     |
| ------- | ----- | ----------------------------------------------------------------------------------------------- |
| `int64` | int64 | total voting weight averaged over the configured smoothing window                               |
| `int64` | int64 | Unix timestamp used as the snapshot history anchor                                              |
| `error` | error | nil on success, or an error when the current configuration or snapshot data cannot be retrieved |

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

## GetDescriptionByProposalId

```go
func GetDescriptionByProposalId(
	proposalId int64
) (string, error)
```

GetDescriptionByProposalId returns the description of a proposal.

#### Parameters

| Name         | Type  | Description                    |
| ------------ | ----- | ------------------------------ |
| `proposalId` | int64 | proposal identifier to inspect |

#### Return Values

| Name     | Type   | Description                                                  |
| -------- | ------ | ------------------------------------------------------------ |
| `string` | string | proposal description                                         |
| `error`  | error  | nil on success, or an error when the proposal does not exist |

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

## GetLatestConfigVersion

```go
func GetLatestConfigVersion() int64
```

GetLatestConfigVersion returns the current governance configuration version.

#### Return Values

| Name    | Type  | Description                                       |
| ------- | ----- | ------------------------------------------------- |
| `int64` | int64 | latest configuration version stored by governance |

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

## GetMaxSmoothingPeriod

```go
func GetMaxSmoothingPeriod() int64
```

GetMaxSmoothingPeriod returns the maximum smoothing period for delegation history cleanup.

#### Return Values

| Name    | Type  | Description                                   |
| ------- | ----- | --------------------------------------------- |
| `int64` | int64 | maximum permitted smoothing period in seconds |

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

## GetNayByProposalId

```go
func GetNayByProposalId(
	proposalId int64
) (int64, error)
```

GetNayByProposalId returns the no vote weight of a proposal.

#### Parameters

| Name         | Type  | Description                    |
| ------------ | ----- | ------------------------------ |
| `proposalId` | int64 | proposal identifier to inspect |

#### Return Values

| Name    | Type  | Description                                                  |
| ------- | ----- | ------------------------------------------------------------ |
| `int64` | int64 | total voting weight recorded for no votes                    |
| `error` | error | nil on success, or an error when the proposal does not exist |

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

## GetOldestActiveProposalSnapshotTime

```go
func GetOldestActiveProposalSnapshotTime() (int64, bool, error)
```

GetOldestActiveProposalSnapshotTime returns the oldest active proposal's timestamp anchor. An empty index returns no active proposal; a stale or missing first entry returns an error so cleanup cannot silently skip it.

#### Return Values

| Name    | Type  | Description                                                                                          |
| ------- | ----- | ---------------------------------------------------------------------------------------------------- |
| `int64` | int64 | snapshot timestamp of the oldest active proposal, or zero when the index is empty or an error occurs |
| `bool`  | bool  | true when an active proposal was found at the oldest index entry, otherwise false                    |
| `error` | error | nil for an empty index or active entry, or an error when the entry is missing or inactive            |

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

## GetProposalCreatedAt

```go
func GetProposalCreatedAt(
	proposalId int64
) (int64, error)
```

GetProposalCreatedAt returns the creation timestamp of a proposal.

#### Parameters

| Name         | Type  | Description                    |
| ------------ | ----- | ------------------------------ |
| `proposalId` | int64 | proposal identifier to look up |

#### Return Values

| Name    | Type  | Description                                                  |
| ------- | ----- | ------------------------------------------------------------ |
| `int64` | int64 | Unix timestamp at which the proposal was created             |
| `error` | error | nil on success, or an error when the proposal does not exist |

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

## GetProposalCreatedHeight

```go
func GetProposalCreatedHeight(
	proposalId int64
) (int64, error)
```

GetProposalCreatedHeight returns the creation block height of a proposal.

#### Parameters

| Name         | Type  | Description                    |
| ------------ | ----- | ------------------------------ |
| `proposalId` | int64 | proposal identifier to look up |

#### Return Values

| Name    | Type  | Description                                                  |
| ------- | ----- | ------------------------------------------------------------ |
| `int64` | int64 | block height at which the proposal was created               |
| `error` | error | nil on success, or an error when the proposal does not exist |

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

## GetProposalStatusByProposalId

```go
func GetProposalStatusByProposalId(
	proposalId int64
) (string, error)
```

GetProposalStatusByProposalId returns the current status of a proposal.

#### Parameters

| Name         | Type  | Description                    |
| ------------ | ----- | ------------------------------ |
| `proposalId` | int64 | proposal identifier to inspect |

#### Return Values

| Name     | Type   | Description                                                  |
| -------- | ------ | ------------------------------------------------------------ |
| `string` | string | status computed from the proposal and the current Unix time  |
| `error`  | error  | nil on success, or an error when the proposal does not exist |

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

## GetProposals

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

GetProposals returns a read-only view of every proposal, keyed by the decimal string form of the proposal 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 proposal tree keyed by decimal proposal ID |

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

## GetProposerByProposalId

```go
func GetProposerByProposalId(
	proposalId int64
) (address, error)
```

GetProposerByProposalId returns the proposer address of a proposal.

#### Parameters

| Name         | Type  | Description                    |
| ------------ | ----- | ------------------------------ |
| `proposalId` | int64 | proposal identifier to look up |

#### Return Values

| Name      | Type    | Description                                                  |
| --------- | ------- | ------------------------------------------------------------ |
| `address` | address | address that submitted the proposal                          |
| `error`   | error   | nil on success, or an error when the proposal does not exist |

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

## GetQuorumAmountByProposalId

```go
func GetQuorumAmountByProposalId(
	proposalId int64
) (int64, error)
```

GetQuorumAmountByProposalId returns the quorum requirement for a proposal.

#### Parameters

| Name         | Type  | Description                    |
| ------------ | ----- | ------------------------------ |
| `proposalId` | int64 | proposal identifier to inspect |

#### Return Values

| Name    | Type  | Description                                                  |
| ------- | ----- | ------------------------------------------------------------ |
| `int64` | int64 | minimum voting weight required for the proposal's quorum     |
| `error` | error | nil on success, or an error when the proposal does not exist |

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

## GetTitleByProposalId

```go
func GetTitleByProposalId(
	proposalId int64
) (string, error)
```

GetTitleByProposalId returns the title of a proposal.

#### Parameters

| Name         | Type  | Description                    |
| ------------ | ----- | ------------------------------ |
| `proposalId` | int64 | proposal identifier to inspect |

#### Return Values

| Name     | Type   | Description                                                  |
| -------- | ------ | ------------------------------------------------------------ |
| `string` | string | proposal title                                               |
| `error`  | error  | nil on success, or an error when the proposal does not exist |

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

## GetUserProposals

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

GetUserProposals returns a read-only view of the proposals created per user, keyed by creator address with the creator's proposal IDs as the value. Reading an entry yields a copy of the ID slice, so the view cannot mutate realm state.

#### Return Values

| Name                   | Type                  | Description                                           |
| ---------------------- | --------------------- | ----------------------------------------------------- |
| `*rotree.ReadOnlyTree` | \*rotree.ReadOnlyTree | read-only user-proposal tree keyed by creator address |

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

## GetVoteStatus

```go
func GetVoteStatus(
	proposalId int64
) (quorum int64, maxVotingWeight int64, yesWeight int64, noWeight int64, err error)
```

GetVoteStatus returns the vote status of a proposal.

#### Parameters

| Name         | Type  | Description                    |
| ------------ | ----- | ------------------------------ |
| `proposalId` | int64 | proposal identifier to inspect |

#### Return Values

| Name              | Type  | Description                                                  |
| ----------------- | ----- | ------------------------------------------------------------ |
| `quorum`          | int64 | minimum vote weight required for the proposal to pass        |
| `maxVotingWeight` | int64 | maximum possible voting weight recorded for the proposal     |
| `yesWeight`       | int64 | total weight of yes votes                                    |
| `noWeight`        | int64 | total weight of no votes                                     |
| `err`             | error | nil on success, or an error when the proposal does not exist |

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

## GetVoteWeight

```go
func GetVoteWeight(
	proposalID int64,
	addr address
) (int64, error)
```

GetVoteWeight returns the voting weight of an address for a proposal.

#### Parameters

| Name         | Type    | Description                                           |
| ------------ | ------- | ----------------------------------------------------- |
| `proposalID` | int64   | proposal identifier to inspect                        |
| `addr`       | address | voter address whose recorded vote weight is requested |

#### Return Values

| Name    | Type  | Description                                                                                |
| ------- | ----- | ------------------------------------------------------------------------------------------ |
| `int64` | int64 | weight recorded for addr's vote                                                            |
| `error` | error | nil on success, or an error when no voting information exists for the proposal and address |

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

## GetVotedAt

```go
func GetVotedAt(
	proposalID int64,
	addr address
) (int64, error)
```

GetVotedAt returns the timestamp when an address voted on a proposal.

#### Parameters

| Name         | Type    | Description                                     |
| ------------ | ------- | ----------------------------------------------- |
| `proposalID` | int64   | proposal identifier to inspect                  |
| `addr`       | address | voter address whose vote timestamp is requested |

#### Return Values

| Name    | Type  | Description                                                                                |
| ------- | ----- | ------------------------------------------------------------------------------------------ |
| `int64` | int64 | Unix timestamp recorded for addr's vote                                                    |
| `error` | error | nil on success, or an error when no voting information exists for the proposal and address |

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

## GetVotedHeight

```go
func GetVotedHeight(
	proposalID int64,
	addr address
) (int64, error)
```

GetVotedHeight returns the block height when an address voted on a proposal.

#### Parameters

| Name         | Type    | Description                                  |
| ------------ | ------- | -------------------------------------------- |
| `proposalID` | int64   | proposal identifier to inspect               |
| `addr`       | address | voter address whose vote height is requested |

#### Return Values

| Name    | Type  | Description                                                                                |
| ------- | ----- | ------------------------------------------------------------------------------------------ |
| `int64` | int64 | block height recorded for addr's vote                                                      |
| `error` | error | nil on success, or an error when no voting information exists for the proposal and address |

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

## GetVotingInfos

```go
func GetVotingInfos(
	proposalID int64
) *rotree.ReadOnlyTree
```

GetVotingInfos returns a read-only view of a proposal's value-backed voting infos, keyed by voter address. Existing proposals have an empty view before the first vote; nil is returned only when the stored voting-info tree is absent.

#### Parameters

| Name         | Type  | Description                                               |
| ------------ | ----- | --------------------------------------------------------- |
| `proposalID` | int64 | proposal identifier whose voting information is requested |

#### Return Values

| Name                   | Type                  | Description                                                                      |
| ---------------------- | --------------------- | -------------------------------------------------------------------------------- |
| `*rotree.ReadOnlyTree` | \*rotree.ReadOnlyTree | read-only voting-info tree keyed by voter address, or nil when no tree is stored |

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

## GetYeaByProposalId

```go
func GetYeaByProposalId(
	proposalId int64
) (int64, error)
```

GetYeaByProposalId returns the yes vote weight of a proposal.

#### Parameters

| Name         | Type  | Description                    |
| ------------ | ----- | ------------------------------ |
| `proposalId` | int64 | proposal identifier to inspect |

#### Return Values

| Name    | Type  | Description                                                  |
| ------- | ----- | ------------------------------------------------------------ |
| `int64` | int64 | total voting weight recorded for yes votes                   |
| `error` | error | nil on success, or an error when the proposal does not exist |

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