# Reward

The Reward contract contains the logic for distributing Sei delegation rewards to holders of stSei. After the Hub contract withdraws Sei delegation rewards to the Reward contract, the Hub contract can request all rewards to be redelegated, which then updates the stSei vs Sei exchange rate.

## Config

<table><thead><tr><th width="194">Key</th><th width="172">Type</th><th>Description</th></tr></thead><tbody><tr><td>owner</td><td>CanonicalAddr</td><td>The owner's address of the contract</td></tr><tr><td>hub_contract</td><td>CanonicalAddr</td><td>Contract address of <a href="/pages/uDcmHmpc0mZMeW8nOOdR">Hub</a></td></tr><tr><td>reward_denom</td><td>String</td><td>Native token denomination for distributed bSei rewards</td></tr><tr><td>swap_contract</td><td>CanonicalAddr</td><td>Contract address of <a href="/pages/aecTtgcR55hEz3feD4Y6">Swap Extension</a></td></tr><tr><td>swap_denoms</td><td>Vec&#x3C;String></td><td>The supported swap denoms type is configured as "usei"</td></tr></tbody></table>

## InitMsg

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct InstantiateMsg {
    pub hub_contract: String,
    pub reward_denom: String,
    pub swap_contract: String,
    pub swap_denoms: Vec<String>,
}
```

<table><thead><tr><th width="173">Key</th><th width="145">Type</th><th>Description</th></tr></thead><tbody><tr><td>hub_contract</td><td>String</td><td>Contract address of <a href="/pages/uDcmHmpc0mZMeW8nOOdR">Hub</a></td></tr><tr><td>reward_denom</td><td>String</td><td>Native token denomination for distributed bSei rewards</td></tr><tr><td>swap_contract</td><td>String</td><td>Contract address of <a href="/pages/aecTtgcR55hEz3feD4Y6">Swap Extension</a></td></tr><tr><td>swap_denoms</td><td>Vec&#x3C;String></td><td>The supported swap denoms type is configured as "usei"</td></tr></tbody></table>

## ExecuteMsg

### ClaimRewards

Claims bSei holder's accrued rewards to the specified address. Sends rewards to the message sender if the `recipient` is not specified.

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    /// return the accrued reward in uusd to the user.
    ClaimRewards { recipient: Option<String> },
}
```

<table><thead><tr><th width="181">Key</th><th width="186">Type</th><th>Description</th></tr></thead><tbody><tr><td>recipient*</td><td>String</td><td>Recipient address of claimed bSei rewards</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

\* = optional

### UpdateConfig

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
   UpdateConfig {
        hub_contract: Option<String>,
        reward_denom: Option<String>, 
        swap_contract: Option<String>,
    },
}
```

<table><thead><tr><th width="172">Key</th><th width="156">Type</th><th>Description</th></tr></thead><tbody><tr><td>hub_contract*</td><td>String</td><td>Contract address of <a href="/pages/uDcmHmpc0mZMeW8nOOdR">Hub</a></td></tr><tr><td>reward_denom*</td><td>String</td><td>Native token denomination for distributed bSei rewards</td></tr><tr><td>swap_contract*</td><td>String</td><td>Contract address of <a href="/pages/aecTtgcR55hEz3feD4Y6">Swap Extension</a></td></tr></tbody></table>

\* = optional

### SetOwner

Transfer ownership permissions to a new owner address.

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
 SetOwner {
        new_owner_addr: String,
    },
}
```

<table><thead><tr><th width="188">Key</th><th width="140">Type</th><th>Description</th></tr></thead><tbody><tr><td>new_owner_addr</td><td>String</td><td>The address of new owner</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### AcceptOwnership

The new owner accepts ownership permissions.

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    AcceptOwnership {},
}
```

### \[Internal] SwapToRewardDenom

Swaps all withdrawn delegation rewards to `reward_denom`. Can only be issued by the `Hub`

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
     SwapToRewardDenom {},
}
```

| Key | Type | Desciption |
| --- | ---- | ---------- |
|     |      |            |

### \[Internal] UpdateGlobalIndex

Updates the global reward index based on the newly withdrawn rewards. Can only be issued by the [Rewards Dispatcher](broken://pages/bwqK9e6KOfutHx5u0qK4)

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    UpdateGlobalIndex {},
}
```

<table><thead><tr><th width="219">Key</th><th width="216">Type</th><th>Description</th></tr></thead><tbody><tr><td></td><td></td><td></td></tr></tbody></table>

### \[Internal] IncreaseBalance

Increases stored user's bSei balance. Stores the user's accrued rewards to pending rewards and updates user's reward index to the current global reward index. Can only be issued by the `Token`.

<pre class="language-rust"><code class="lang-rust"><strong>#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
</strong>#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    IncreaseBalance { 
        address: String, 
        amount: Uint128
     },
}
</code></pre>

<table><thead><tr><th width="183">Key</th><th width="147">Type</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>String</td><td>Address of user whose balance has increased</td></tr><tr><td>amount</td><td>Uint128</td><td>Amount of bINJ balance increased</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### \[Internal] DecreaseBalance

Decreases stored user's bSei balance. Stores the user's accrued rewards to pending rewards and updates user's reward index to the current global reward index. Can only be issued by the `Token`.

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    DecreaseBalance { 
        address: String, 
        amount: Uint128
     },
}
```

<table><thead><tr><th width="175">Key</th><th width="172">Type</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>String</td><td>Address of user whose balance has decreased</td></tr><tr><td>amount</td><td>Uint128</td><td>Amount of bINJ balance decreased</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### UpdateSwapDenom

Add or remove Native token denomination types supported by the [Swap Extension](broken://pages/aecTtgcR55hEz3feD4Y6).

<pre class="language-rust"><code class="lang-rust">#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    UpdateSwapDenom {
        swap_denom: String,
        is_add: bool,
    },
<strong>}
</strong></code></pre>

<table><thead><tr><th width="179">Key</th><th width="183">Type</th><th>Description</th></tr></thead><tbody><tr><td>swap_denom</td><td>String</td><td>Add or remove Native token denomination types</td></tr><tr><td>is_add</td><td>bool</td><td>"true" represents "add", and "false" represents "remove"</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

## QueryMsg

### Config

Gets the contract configuration of `Reward`.

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    Config {},
}
```

### ConfigResponse

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct ConfigResponse {
    pub hub_contract: String,
    pub reward_denom: String,
    pub owner: String,
    pub swap_contract: String,
}
```

<table><thead><tr><th width="217">Key</th><th width="144">Type</th><th>Description</th></tr></thead><tbody><tr><td>hub_contract</td><td>String</td><td>Contract address of <a href="/pages/uDcmHmpc0mZMeW8nOOdR">Hub</a></td></tr><tr><td>reward_denom</td><td>String</td><td>Native token denomination for distributed bSei rewards</td></tr><tr><td>owner</td><td>String</td><td>The owner's address of the contract</td></tr><tr><td>swap_contract</td><td>String</td><td>The supported swap denoms type is configured as "usei"</td></tr></tbody></table>

### State

Gets information about the contract's current state.

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    State {},
}
```

### StateResponse

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct StateResponse {
    pub global_index: Decimal,
    pub total_balance: Uint128,
    pub prev_reward_balance: Uint128,
}
```

<table><thead><tr><th width="238">Key</th><th width="144">Type</th><th>Description</th></tr></thead><tbody><tr><td>global_index</td><td>Decimal</td><td>Current global reward index of bSei</td></tr><tr><td>total_balance</td><td>Uint128</td><td>Total bSei balance of all holders</td></tr><tr><td>prev_reward_balance</td><td>Uint128</td><td>kUSD balance of Reward contract at the end of last <a href="#internal-updateglobalindex"><code>UpdateGlobalIndex</code></a></td></tr></tbody></table>

### AccruedRewards

Gets the amount of rewards accrued to the specified bSei holder.

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    AccruedRewards {
        address: String,
    },
}
```

<table><thead><tr><th width="218">Key</th><th width="171">Type</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>String</td><td>Address of bSei holder</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### AccruedRewardsResponse

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct AccruedRewardsResponse {
    pub rewards: Uint128,
}
```

<table><thead><tr><th width="197">Key</th><th width="184">Type</th><th>Description</th></tr></thead><tbody><tr><td>rewards</td><td>Uint128</td><td>Amount of <code>reward_denom</code> rewards accrued</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### Holder

Gets information about the specified bSei holder.

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    Holder {
        address: String,
    },
}
```

<table><thead><tr><th width="218">Key</th><th width="171">Type</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>String</td><td>Address of bSei holder</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### HolderResponse

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct HolderResponse {
    pub address: String,
    pub balance: Uint128,
    pub index: Decimal,
    pub pending_rewards: Decimal,
}
```

<table><thead><tr><th width="201">Key</th><th width="171">Type</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>String</td><td>Address of bSei holder</td></tr><tr><td>balance</td><td>Uint128</td><td>bSei balance of holder</td></tr><tr><td>index</td><td>Decimal</td><td>Holder's reward index value</td></tr><tr><td>pending_rewards</td><td>Decimal</td><td>Amount of holder's pending rewards</td></tr></tbody></table>

### Holders

Gets information about all bSei holders.

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
  Holders {
        start_after: Option<String>,
        limit: Option<u32>,
    },
}
```

<table><thead><tr><th width="205">Key</th><th width="108">Type</th><th>Description</th></tr></thead><tbody><tr><td>start_after*</td><td>String</td><td>Address of bSei holder to start query</td></tr><tr><td>limit*</td><td>u32</td><td>Maximum number of query entries</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

\* = optional

### HoldersResponse

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct HoldersResponse {
    pub holders: Vec<HolderResponse>,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct HolderResponse {
    pub address: String,
    pub balance: Uint128,
    pub index: Decimal,
    pub pending_rewards: Decimal,
}
```

<table><thead><tr><th width="168">Key</th><th width="219">Type</th><th>Description</th></tr></thead><tbody><tr><td>holders</td><td>Vec&#x3C;HolderResponse></td><td>Vector of holder informations</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

<table><thead><tr><th width="175">Key</th><th width="218">Type</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>String</td><td>Address of bSei holder</td></tr><tr><td>balance</td><td>Uint128</td><td>bSei balance of holder</td></tr><tr><td>index</td><td>Decimal</td><td>Holder's reward index value</td></tr><tr><td>pending_rewards</td><td>Decimal</td><td>Amount of holder's pending rewards</td></tr></tbody></table>

### NewOwner

Query the address of the new owner.

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
  NewOwner {},
}
```

### NewOwnerResponse

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct NewOwnerResponse {
    pub new_owner: String,
}
```

<table><thead><tr><th width="186">Key</th><th width="190">Type</th><th>Description</th></tr></thead><tbody><tr><td>new_owner</td><td>String</td><td>The address of new owner</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kryptonite.finance/developer/staking/reward.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
