# Rewards Dispatcher

The Rewards Dispatcher contract accumulates the rewards from Hub's delegations and manages the rewards.

All rewards from *stSei* tokens (the share of all rewards proportional to the amount of *stSei* tokens minted) are converted to Luna and are re-delegated back to the validators pool.

All rewards from *bSei* (the share of all rewards proportional to the amount of *bSei* tokens minted) are sent to the Reward Contract and handled the old way.

## Config

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct Config {
    pub owner: CanonicalAddr,
    pub hub_contract: CanonicalAddr,
    pub bsei_reward_contract: CanonicalAddr,
    pub stsei_reward_denom: String,
    pub bsei_reward_denom: String,
    pub krp_keeper_address: CanonicalAddr,
    pub krp_keeper_rate: Decimal,
    pub swap_contract: CanonicalAddr,
    pub swap_denoms: Vec<String>,
    pub oracle_contract: CanonicalAddr,
}
```

<table><thead><tr><th width="212">Key</th><th width="189">Type</th><th>Description</th></tr></thead><tbody><tr><td>owner</td><td>CanonicalAddr</td><td>Owner 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>bsei_reward_contract</td><td>CanonicalAddr</td><td>Contract address of <a href="/pages/SWIB97e1ElrG6yxSYuE9">bSei Reward</a></td></tr><tr><td>stsei_reward_denom</td><td>String</td><td>Native token denomination for distributed stSei rewards</td></tr><tr><td>bsei_reward_denom</td><td>String</td><td>Native token denomination for distributed bSei rewards</td></tr><tr><td>krp_keeper_address</td><td>CanonicalAddr</td><td>Address for fee distribution</td></tr><tr><td>krp_keeper_rate</td><td>Decimal</td><td>Amount of fees which goes to Fee Address</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><tr><td>oracle_contract</td><td>CanonicalAddr</td><td>Contract address of <a href="/pages/GZsWYCeNNKVDvIf1ouxL">Oracle</a></td></tr></tbody></table>

## InitMsg

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct InstantiateMsg {
    pub hub_contract: String,
    pub bsei_reward_contract: String,
    pub stsei_reward_denom: String,
    pub bsei_reward_denom: String,
    pub krp_keeper_address: String,
    pub krp_keeper_rate: Decimal,
    pub swap_contract: String,
    pub swap_denoms: Vec<String>,
    pub oracle_contract: String,
}
```

<table><thead><tr><th width="212">Key</th><th width="189">Type</th><th>Description</th></tr></thead><tbody><tr><td>hub_contract</td><td>CanonicalAddr</td><td>Contract address of <a href="/pages/uDcmHmpc0mZMeW8nOOdR">Hub</a></td></tr><tr><td>bsei_reward_contract</td><td>CanonicalAddr</td><td>Contract address of <a href="/pages/SWIB97e1ElrG6yxSYuE9">bSei Reward</a></td></tr><tr><td>stsei_reward_denom</td><td>String</td><td>Native token denomination for distributed stSei rewards</td></tr><tr><td>bsei_reward_denom</td><td>String</td><td>Native token denomination for distributed bSei rewards</td></tr><tr><td>krp_keeper_address</td><td>CanonicalAddr</td><td>Address for fee distribution</td></tr><tr><td>krp_keeper_rate</td><td>Decimal</td><td>Amount of fees which goes to Fee Address</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><tr><td>oracle_contract</td><td>CanonicalAddr</td><td>Contract address of <a href="/pages/GZsWYCeNNKVDvIf1ouxL">Oracle</a></td></tr></tbody></table>

## ExecuteMsg

### \[Internal] SwapToRewardDenom

Swaps all native tokens on his balance to Sei and kUSD proportional to the minted stSei and bSei amount.

Can only be executed by the [Hub](broken://pages/uDcmHmpc0mZMeW8nOOdR).

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

<table><thead><tr><th width="193">Key</th><th width="206">Type</th><th>Description</th></tr></thead><tbody><tr><td>bsei_total_bonded</td><td>Uint128</td><td>Total amount of minted bSei</td></tr><tr><td>stsei_total_bonded</td><td>Uint128</td><td>Total amount of minted stSei</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### \[Internal] DispatchRewards

Re-stakes the stSei rewards (with subtracted Fee) and sends the bSei rewards to the old bSei Rewards contract (with subtracted Fee).

Can only be executed by the [Hub](broken://pages/uDcmHmpc0mZMeW8nOOdR).

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

### UpdateConfig

Updates the dispatcher's configuration. Can only be executed by the owner.

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

<table><thead><tr><th width="209">Key</th><th width="191">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>bsei_reward_contract</td><td>String</td><td>Contract address of <a href="/pages/SWIB97e1ElrG6yxSYuE9">bSei Reward</a></td></tr><tr><td>stsei_reward_denom</td><td>String</td><td>Native token denomination for distributed stSei rewards</td></tr><tr><td>bsei_reward_denom</td><td>String</td><td>Native token denomination for distributed bSei rewards</td></tr><tr><td>krp_keeper_addres</td><td>String</td><td>Address for fee distribution</td></tr><tr><td>krp_keeper_rate</td><td>Decimal</td><td>Amount of fees which goes to Fee Address</td></tr></tbody></table>

### 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 {},
}
```

### UpdateSwapContract

Update the contract address of the [Swap Extension](broken://pages/aecTtgcR55hEz3feD4Y6), which can only be modified by the owner.

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

<table><thead><tr><th width="176">Key</th><th width="184">Type</th><th>Description</th></tr></thead><tbody><tr><td>swap_contract</td><td>String</td><td>The new address of <a href="/pages/aecTtgcR55hEz3feD4Y6">Swap Extension</a></td></tr><tr><td></td><td></td><td></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>

### UpdateOracleContract

Update the contract address of the [Oracle](broken://pages/GZsWYCeNNKVDvIf1ouxL), which can only be modified by the owner.

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

<table><thead><tr><th width="188">Key</th><th width="182">Type</th><th>Description</th></tr></thead><tbody><tr><td>oracle_contract</td><td>String</td><td>The new address of <a href="/pages/GZsWYCeNNKVDvIf1ouxL">Oracle</a></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

## QueryMsg

### Config

Returns the current configuration of the contract.

```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 owner: String,
    pub hub_contract: String,
    pub bsei_reward_contract: String,
    pub stsei_reward_denom: String,
    pub bsei_reward_denom: String,
    pub krp_keeper_address: String,
    pub krp_keeper_rate: Decimal,
    pub swap_contract: String,
    pub swap_denoms: Vec<String>,
    pub oracle_contract: String,
}
```

<table><thead><tr><th width="212">Key</th><th width="189">Type</th><th>Description</th></tr></thead><tbody><tr><td>owner</td><td>CanonicalAddr</td><td>Owner 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>bsei_reward_contract</td><td>CanonicalAddr</td><td>Contract address of <a href="/pages/SWIB97e1ElrG6yxSYuE9">bSei Reward</a></td></tr><tr><td>stsei_reward_denom</td><td>String</td><td>Native token denomination for distributed stSei rewards</td></tr><tr><td>bsei_reward_denom</td><td>String</td><td>Native token denomination for distributed bSei rewards</td></tr><tr><td>krp_keeper_address</td><td>CanonicalAddr</td><td>Address for fee distribution</td></tr><tr><td>krp_keeper_rate</td><td>Decimal</td><td>Amount of fees which goes to Fee Address</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><tr><td>oracle_contract</td><td>CanonicalAddr</td><td>Contract address of <a href="/pages/GZsWYCeNNKVDvIf1ouxL">Oracle</a></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/rewards-dispatcher.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.
