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

# reward\_state.gno

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

## Types

### RewardState

```go
type RewardState struct
```

RewardState represents the state of a reward for a deposit. It contains the necessary data to manage and distribute rewards for a specific deposit.

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

#### Methods

**AccumulatedRewardAmount**

```go
func (rs *RewardState) AccumulatedRewardAmount() int64
```

AccumulatedRewardAmount returns the legacy accumulated reward field.

#### Return Values

| Name     | Type  | Description                                                                                               |
| -------- | ----- | --------------------------------------------------------------------------------------------------------- |
| `amount` | int64 | legacy reward amount in token base units; v1 accounting normally leaves it at zero unless explicitly set. |

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

**AccumulatedTime**

```go
func (rs *RewardState) AccumulatedTime() int64
```

AccumulatedTime returns the last timestamp recorded for reward accumulation.

#### Return Values

| Name   | Type  | Description                                                                 |
| ------ | ----- | --------------------------------------------------------------------------- |
| `time` | int64 | last accumulated timestamp in Unix seconds, or zero before one is recorded. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/reward_state.gno#L150)

**ClaimableTime**

```go
func (rs *RewardState) ClaimableTime() int64
```

ClaimableTime returns the earliest Unix timestamp at which this reward may be claimed.

#### Return Values

| Name            | Type  | Description                             |
| --------------- | ----- | --------------------------------------- |
| `claimableTime` | int64 | claimability timestamp in Unix seconds. |

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

**ClaimedAmount**

```go
func (rs *RewardState) ClaimedAmount() int64
```

ClaimedAmount returns the reward amount already claimed for this deposit.

#### Return Values

| Name     | Type  | Description                                |
| -------- | ----- | ------------------------------------------ |
| `amount` | int64 | claimed reward amount in token base units. |

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

**Clone**

```go
func (rs RewardState) Clone() *RewardState
```

Clone returns an independent copy of this reward state, including a cloned Q128 price debt value.

#### Return Values

| Name          | Type          | Description                                                                     |
| ------------- | ------------- | ------------------------------------------------------------------------------- |
| `rewardState` | \*RewardState | deep copy of the reward state that can be modified without changing the source. |

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

**DepositAmount**

```go
func (rs *RewardState) DepositAmount() int64
```

DepositAmount returns the GNS principal represented by this reward state.

#### Return Values

| Name     | Type  | Description                                                 |
| -------- | ----- | ----------------------------------------------------------- |
| `amount` | int64 | staked GNS amount in base units used for reward allocation. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/reward_state.gno#L86)

**DistributeEndTime**

```go
func (rs *RewardState) DistributeEndTime() int64
```

DistributeEndTime returns the Unix timestamp when this deposit stops accruing rewards.

#### Return Values

| Name      | Type  | Description                                   |
| --------- | ----- | --------------------------------------------- |
| `endTime` | int64 | reward accrual end timestamp in Unix seconds. |

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

**DistributeStartTime**

```go
func (rs *RewardState) DistributeStartTime() int64
```

DistributeStartTime returns the Unix timestamp when this deposit starts accruing rewards.

#### Return Values

| Name        | Type  | Description                                     |
| ----------- | ----- | ----------------------------------------------- |
| `startTime` | int64 | reward accrual start timestamp in Unix seconds. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/reward_state.gno#L102)

**PriceDebtX128**

```go
func (rs *RewardState) PriceDebtX128() *u256.Uint
```

PriceDebtX128 returns the deposit's initial reward index debt in Q128 fixed-point units.

#### Return Values

| Name   | Type        | Description                                                                    |
| ------ | ----------- | ------------------------------------------------------------------------------ |
| `debt` | \*u256.Uint | stored price debt used to subtract rewards accrued before this deposit joined. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/reward_state.gno#L54)

**SetAccumulatedRewardAmount**

```go
func (rs *RewardState) SetAccumulatedRewardAmount(
	amount int64
)
```

SetAccumulatedRewardAmount sets the legacy accumulated reward field.

#### Parameters

| Name     | Type  | Description                                                                         |
| -------- | ----- | ----------------------------------------------------------------------------------- |
| `amount` | int64 | legacy reward amount in token base units; v1 accounting does not update this field. |

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

**SetAccumulatedTime**

```go
func (rs *RewardState) SetAccumulatedTime(
	time int64
)
```

SetAccumulatedTime sets the last timestamp recorded for reward accumulation.

#### Parameters

| Name   | Type  | Description                                 |
| ------ | ----- | ------------------------------------------- |
| `time` | int64 | last accumulated timestamp in Unix seconds. |

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

**SetClaimableTime**

```go
func (rs *RewardState) SetClaimableTime(
	time int64
)
```

SetClaimableTime sets the earliest Unix timestamp at which this reward may be claimed.

#### Parameters

| Name   | Type  | Description                             |
| ------ | ----- | --------------------------------------- |
| `time` | int64 | claimability timestamp in Unix seconds. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/reward_state.gno#L78)

**SetClaimedAmount**

```go
func (rs *RewardState) SetClaimedAmount(
	amount int64
)
```

SetClaimedAmount replaces the reward amount already claimed for this deposit.

#### Parameters

| Name     | Type  | Description                                |
| -------- | ----- | ------------------------------------------ |
| `amount` | int64 | claimed reward amount in token base units. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/reward_state.gno#L174)

**SetDepositAmount**

```go
func (rs *RewardState) SetDepositAmount(
	amount int64
)
```

SetDepositAmount replaces the GNS principal represented by this reward state.

#### Parameters

| Name     | Type  | Description                                                 |
| -------- | ----- | ----------------------------------------------------------- |
| `amount` | int64 | staked GNS amount in base units used for reward allocation. |

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

**SetDistributeEndTime**

```go
func (rs *RewardState) SetDistributeEndTime(
	time int64
)
```

SetDistributeEndTime sets the Unix timestamp when this deposit stops accruing rewards.

#### Parameters

| Name   | Type  | Description                                   |
| ------ | ----- | --------------------------------------------- |
| `time` | int64 | reward accrual end timestamp in Unix seconds. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/reward_state.gno#L126)

**SetDistributeStartTime**

```go
func (rs *RewardState) SetDistributeStartTime(
	time int64
)
```

SetDistributeStartTime sets the Unix timestamp when this deposit starts accruing rewards.

#### Parameters

| Name   | Type  | Description                                     |
| ------ | ----- | ----------------------------------------------- |
| `time` | int64 | reward accrual start timestamp in Unix seconds. |

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

**SetPriceDebtX128**

```go
func (rs *RewardState) SetPriceDebtX128(
	debt *u256.Uint
)
```

SetPriceDebtX128 replaces the deposit's initial reward index debt.

#### Parameters

| Name   | Type        | Description                                                                   |
| ------ | ----------- | ----------------------------------------------------------------------------- |
| `debt` | \*u256.Uint | new price debt in Q128 fixed-point units; the value is copied into the state. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/reward_state.gno#L62)

#### Constructors

* `func GetRewardState(projectTierId string, depositId string) (*RewardState, error)` ([source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/getter.gno#L593))
* `func NewRewardState(accumulatedRewardPerDepositX128 *u256.Uint, depositAmount int64, distributeStartTime int64, distributeEndTime int64, claimableTime int64) *RewardState` ([source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/reward_state.gno#L32))
