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

# emission\_reward\_state.gno

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

## Types

### EmissionRewardState

```go
type EmissionRewardState struct
```

EmissionRewardState tracks emission reward information for an individual staker. This struct maintains reward debt, accumulated rewards, and claiming history to ensure accurate reward calculations and prevent double-claiming.

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

#### Methods

**GetAccumulatedRewardAmount**

```go
func (e *EmissionRewardState) GetAccumulatedRewardAmount() int64
```

GetAccumulatedRewardAmount returns rewards accrued but not yet claimed.

#### Return Values

| Name    | Type  | Description                                           |
| ------- | ----- | ----------------------------------------------------- |
| `int64` | int64 | accumulated reward amount in the smallest token unit. |

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

**GetAccumulatedTimestamp**

```go
func (e *EmissionRewardState) GetAccumulatedTimestamp() int64
```

GetAccumulatedTimestamp returns when accumulated rewards were last updated.

#### Return Values

| Name    | Type  | Description                                                |
| ------- | ----- | ---------------------------------------------------------- |
| `int64` | int64 | Unix timestamp in seconds of the last accumulation update. |

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

**GetClaimedRewardAmount**

```go
func (e *EmissionRewardState) GetClaimedRewardAmount() int64
```

GetClaimedRewardAmount returns the total rewards already claimed.

#### Return Values

| Name    | Type  | Description                                       |
| ------- | ----- | ------------------------------------------------- |
| `int64` | int64 | claimed reward amount in the smallest token unit. |

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

**GetClaimedTimestamp**

```go
func (e *EmissionRewardState) GetClaimedTimestamp() int64
```

GetClaimedTimestamp returns when rewards were last claimed.

#### Return Values

| Name    | Type  | Description                                  |
| ------- | ----- | -------------------------------------------- |
| `int64` | int64 | Unix timestamp in seconds of the last claim. |

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

**GetRewardDebtX128**

```go
func (e *EmissionRewardState) GetRewardDebtX128() *u256.Uint
```

GetRewardDebtX128 returns the scaled reward debt used for accrual calculations.

#### Return Values

| Name         | Type        | Description                                                      |
| ------------ | ----------- | ---------------------------------------------------------------- |
| `*u256.Uint` | \*u256.Uint | current reward debt in the protocol's 128-bit fixed-point scale. |

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

**GetStakedAmount**

```go
func (e *EmissionRewardState) GetStakedAmount() int64
```

GetStakedAmount returns the amount currently staked for this state.

#### Return Values

| Name    | Type  | Description                                     |
| ------- | ----- | ----------------------------------------------- |
| `int64` | int64 | staked token amount in the smallest token unit. |

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

**SetAccumulatedRewardAmount**

```go
func (e *EmissionRewardState) SetAccumulatedRewardAmount(
	accumulatedRewardAmount int64
)
```

SetAccumulatedRewardAmount replaces the unclaimed accumulated reward amount.

#### Parameters

| Name                      | Type  | Description                                    |
| ------------------------- | ----- | ---------------------------------------------- |
| `accumulatedRewardAmount` | int64 | accumulated reward in the smallest token unit. |

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

**SetAccumulatedTimestamp**

```go
func (e *EmissionRewardState) SetAccumulatedTimestamp(
	accumulatedTimestamp int64
)
```

SetAccumulatedTimestamp records the latest reward accumulation timestamp.

#### Parameters

| Name                   | Type  | Description                                            |
| ---------------------- | ----- | ------------------------------------------------------ |
| `accumulatedTimestamp` | int64 | Unix timestamp in seconds for the accumulation update. |

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

**SetClaimedRewardAmount**

```go
func (e *EmissionRewardState) SetClaimedRewardAmount(
	claimedRewardAmount int64
)
```

SetClaimedRewardAmount replaces the total claimed reward amount.

#### Parameters

| Name                  | Type  | Description                                |
| --------------------- | ----- | ------------------------------------------ |
| `claimedRewardAmount` | int64 | claimed reward in the smallest token unit. |

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

**SetClaimedTimestamp**

```go
func (e *EmissionRewardState) SetClaimedTimestamp(
	claimedTimestamp int64
)
```

SetClaimedTimestamp records the latest reward claim timestamp.

#### Parameters

| Name               | Type  | Description                              |
| ------------------ | ----- | ---------------------------------------- |
| `claimedTimestamp` | int64 | Unix timestamp in seconds for the claim. |

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

**SetRewardDebtX128**

```go
func (e *EmissionRewardState) SetRewardDebtX128(
	rewardDebtX128 *u256.Uint
)
```

Setters SetRewardDebtX128 replaces the reward debt with a copied fixed-point value.

#### Parameters

| Name             | Type        | Description                                              |
| ---------------- | ----------- | -------------------------------------------------------- |
| `rewardDebtX128` | \*u256.Uint | reward debt in the protocol's 128-bit fixed-point scale. |

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

**SetStakedAmount**

```go
func (e *EmissionRewardState) SetStakedAmount(
	stakedAmount int64
)
```

SetStakedAmount replaces the current staked amount.

#### Parameters

| Name           | Type  | Description                                     |
| -------------- | ----- | ----------------------------------------------- |
| `stakedAmount` | int64 | staked token amount in the smallest token unit. |

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

#### Constructors

* `func NewEmissionRewardState(accumulatedRewardX128PerStake *u256.Uint) *EmissionRewardState` ([source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/gov/staker/emission_reward_state.gno#L34))
