# Fund

The Fund is a derivative version of Synthetix Staking Rewards, distributing protocol revenue to veSEILOR stakers.

## Config

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct FundConfig {
    pub gov: Addr,
    pub ve_seilor_addr: Addr,
    pub seilor_addr: Addr,
    pub kusd_denom: String,
    pub kusd_reward_addr: Addr,
    pub kusd_reward_total_amount: Uint128,
    pub kusd_reward_total_paid_amount: Uint128,
    // Sum of (reward rate * dt * 1e18 / total supply)
    pub reward_per_token_stored: Uint128,
    // uint256 immutable exitCycle = 30 days;
    pub exit_cycle: Uint64,
    // uint256 public claimAbleTime;
    pub claim_able_time: Uint64,
    pub new_gov: Option<Addr>,
    pub token_cap: Option<Uint128>,
}
```

<table><thead><tr><th width="294">Key</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>gov</td><td>Addr</td><td>The address of the governance contract</td></tr><tr><td>ve_seilor_addr</td><td>Addr</td><td>The address of the veSEILOR contract</td></tr><tr><td>seilor_addr</td><td>Addr</td><td>The address of SEILOR token contract</td></tr><tr><td>kusd_denom</td><td>String</td><td>Stablecoin kUSD denomination</td></tr><tr><td>kusd_reward_addr</td><td>Addr</td><td>The address of the token contract for kUSD rewards</td></tr><tr><td>kusd_reward_total_amount</td><td>Uint128</td><td>The total amount of kUSD rewards</td></tr><tr><td>kusd_reward_total_paid_amount</td><td>Uint128</td><td>The total amount of kUSD rewards paid</td></tr><tr><td>reward_per_token_stored</td><td>Uint128</td><td>Reward per token stored</td></tr><tr><td>exit_cycle</td><td>Uint64</td><td>Exit cycle</td></tr><tr><td>claim_able_time</td><td>Uint64</td><td>Claim able time</td></tr><tr><td>new_gov</td><td>Addr</td><td>The address of the new governance contract</td></tr><tr><td>token_cap</td><td>Uint128</td><td>Token amount limit</td></tr></tbody></table>

## InitMsg

### InstantiateMsg

```rust
#[cw_serde]
pub struct InstantiateMsg {
    pub gov: Option<Addr>,
    pub ve_seilor_addr: Addr,
    pub seilor_addr: Addr,
    pub kusd_denom: String,
    pub kusd_reward_addr: Addr,
    pub exit_cycle: Uint64,
    pub claim_able_time: Uint64,
}
```

```json
{
  "gov": "sei1...",
  "ve_seilor_addr": "sei1...",
  "seilor_addr": "sei1...",
  "kusd_denom": "factor/sei1.../KUSD",
  "kusd_reward_addr": "sei2...",
  "exit_cycle": "2592000",
  "claim_able_time": "1687190400"
}
```

<table><thead><tr><th width="207">Key</th><th width="205">Type</th><th>Description</th></tr></thead><tbody><tr><td>gov</td><td>Addr</td><td>The address of the governance contract</td></tr><tr><td>ve_seilor_addr</td><td>Addr</td><td>The address of the veSEILOR contract</td></tr><tr><td>seilor_addr</td><td>Addr</td><td>The address of SEILOR token contract</td></tr><tr><td>kusd_denom</td><td>String</td><td>Stablecoin kUSD denomination</td></tr><tr><td>kusd_reward_addr</td><td>Addr</td><td>The address of the token contract for kUSD rewards</td></tr><tr><td>exit_cycle</td><td>Uint64</td><td>Exit cycle</td></tr><tr><td>claim_able_time</td><td>Uint64</td><td>Claim able time</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

## ExecuteMsg

### UpdateFundConfig

```rust
#[cw_serde]
pub enum ExecuteMsg {
    UpdateFundConfig { update_config_msg: UpdateConfigMsg },
}

#[cw_serde]
pub struct UpdateConfigMsg {
    pub gov: Option<Addr>,
    pub ve_seilor_addr: Option<Addr>,
    pub seilor_addr: Option<Addr>,
    pub kusd_denom: Option<String>,
    pub kusd_reward_addr: Option<Addr>,
    pub claim_able_time: Option<Uint64>,
}
```

```json
{
  "update_fund_config":
   {
      "update_config_msg": 
      {
         "gov": "sei1...",
         "ve_seilor_addr": "sei1...",
         "seilor_addr": "sei1...",
         "kusd_denom": "factor/sei1.../KUSD",
         "kusd_reward_addr": "sei2...",
         "claim_able_time": "1687190400"
      }
   }
}
```

<table><thead><tr><th width="236">Key</th><th width="202">Type</th><th>Description</th></tr></thead><tbody><tr><td>update_fund_config</td><td>UpdateConfigMsg</td><td>Fund contract configuration structure</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

<table><thead><tr><th width="235">Key</th><th width="205">Type</th><th>Description</th></tr></thead><tbody><tr><td>gov*</td><td>Addr</td><td>The address of the governance contract</td></tr><tr><td>ve_seilor_addr*</td><td>Addr</td><td>The address of the veSEILOR contract</td></tr><tr><td>seilor_addr*</td><td>Addr</td><td>The address of SEILOR token contract</td></tr><tr><td>kusd_denom*</td><td>String</td><td>Stablecoin kUSD denomination</td></tr><tr><td>kusd_reward_addr*</td><td>Addr</td><td>The address of the token contract for kUSD rewards</td></tr><tr><td>claim_able_time*</td><td>Uint64</td><td>Claim able time</td></tr></tbody></table>

### RefreshReward

Update user reward.

```rust
#[cw_serde]
pub enum ExecuteMsg {
    RefreshReward { account: Addr },
}
```

```json
{
  "refresh_reward": {
    "account": "sei1..."
  }
}
```

<table><thead><tr><th width="170">Key</th><th width="185">Type</th><th>Description</th></tr></thead><tbody><tr><td>account</td><td>Addr</td><td>The user's address</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### Stake

Stake SEILOR.

```rust
#[cw_serde]
pub enum ExecuteMsg {
    Stake { amount: Uint128 },
}
```

```json
{
  "stake": {
    "amount": "1000000000000000000"
  }
}
```

<table><thead><tr><th width="169">Key</th><th width="199">Type</th><th>Description</th></tr></thead><tbody><tr><td>amount</td><td>Uint128</td><td>The amount of SEILOR to stake</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### Withdraw

```rust
#[cw_serde]
pub enum ExecuteMsg {
    Withdraw { amount: Uint128 },
}
```

```json
{
  "withdraw": {
    "amount": "1000000000000000000"
  }
}
```

<table><thead><tr><th width="177">Key</th><th width="193">Type</th><th>Description</th></tr></thead><tbody><tr><td>amount</td><td>Uint128</td><td>The amount of SEILOR to withdraw</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### ReStake

```rust
#[cw_serde]
pub enum ExecuteMsg {
    ReStake {},
}
```

```
{
  "re_stake": {}
}
```

### GetReward

```rust
#[cw_serde]
pub enum ExecuteMsg {
    GetReward {},
}
```

```json
{
  "get_reward": {}
}
```

### NotifyRewardAmount

```rust
#[cw_serde]
pub enum ExecuteMsg {
    NotifyRewardAmount { reward: Uint128 },
}
```

```json
{
  "notify_reward_amount": {
    "reward": "1000000000000000000"
  }
}
```

### SetVeFundMinter

```rust
#[cw_serde]
pub enum ExecuteMsg {
    SetVeFundMinter {
        minter: Addr,
        is_ve_minter: bool,
    },
}
```

```json
{
  "set_ve_fund_minter": {
    "minter": "sei1...",
    "is_ve_minter": true
  }
}
```

<table><thead><tr><th width="174">Key</th><th width="205">Type</th><th>Description</th></tr></thead><tbody><tr><td>minter</td><td>Addr</td><td>The minter's address</td></tr><tr><td>is_ve_minter</td><td>bool</td><td>Whether the user is a ve-minter</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### VeFundMint

```rust
#[cw_serde]
pub enum ExecuteMsg {
    VeFundMint {
        user: Addr,
        amount: Uint128,
    },
}
```

```json
{
  "ve_fund_mint": {
    "user": "sei1...",
    "amount": "1000000000000000000"
  }
}
```

<table><thead><tr><th width="168">Key</th><th width="213">Type</th><th>Description</th></tr></thead><tbody><tr><td>user</td><td>Addr</td><td>The user's address</td></tr><tr><td>amout</td><td>Uint128</td><td>mint amount</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

## QueryMsg

### FundConfig

```rust
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(FundConfigResponse)]
    FundConfig {},
}
```

```
{
  "fund_config": {}
}
```

### FundConfigResponse

```rust
#[cw_serde]
pub struct FundConfigResponse {
    pub gov: Addr,
    pub ve_seilor_addr: Addr,
    pub seilor_addr: Addr,
    pub kusd_denom: String,
    pub kusd_reward_addr: Addr,
    pub kusd_reward_total_amount: Uint128,
    pub kusd_reward_total_paid_amount: Uint128,
    // Sum of (reward rate * dt * 1e18 / total supply)
    pub reward_per_token_stored: Uint128,
    // uint256 immutable exitCycle = 30 days;
    pub exit_cycle: Uint64,
    // uint256 public claimAbleTime;
    pub claim_able_time: Uint64,
}
```

```json
{
  "gov": "sei1...",
  "ve_seilor_addr": "sei1...",
  "seilor_addr": "sei1...",
  "kusd_denom": "factor/sei1.../kUSD",
  "kusd_reward_addr": "sei2...",
  "kusd_reward_total_amount": "1000000000000000000",
  "kusd_reward_total_paid_amount": "1000000000000000000",
  "reward_per_token_stored": "1000000000000000000",
  "exit_cycle": "2592000",
  "claim_able_time": "1687190400"
}
```

<table><thead><tr><th width="297">Key</th><th width="95">Type</th><th>Description</th></tr></thead><tbody><tr><td>gov</td><td>Addr</td><td>The address of the governance contract</td></tr><tr><td>ve_seilor_addr</td><td>Addr</td><td>The address of the veSEILOR contract</td></tr><tr><td>seilor_addr</td><td>Addr</td><td>The address of SEILOR token contract</td></tr><tr><td>kusd_denom</td><td>String</td><td>Stablecoin kUSD denomination</td></tr><tr><td>kusd_reward_addr</td><td>Addr</td><td>The address of the token contract for kUSD rewards</td></tr><tr><td>kusd_reward_total_amount</td><td>Uint128</td><td>The total amount of kUSD rewards</td></tr><tr><td>kusd_reward_total_paid_amount</td><td>Uint128</td><td>The total amount of kUSD rewards paid</td></tr><tr><td>reward_per_token_stored</td><td>Uint128</td><td>Reward per token stored</td></tr><tr><td>exit_cycle</td><td>Uint64</td><td>Exit cycle</td></tr><tr><td>claim_able_time</td><td>Uint64</td><td>Claim able time</td></tr></tbody></table>

### GetClaimAbleSeilor

```rust
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(GetClaimAbleSeilorResponse)]
    GetClaimAbleSeilor { user: Addr },
}
```

```json
{
  "get_claim_able_seilor": {
    "user": "sei1..."
  }
}
```

<table><thead><tr><th width="218">Key</th><th width="178">Type</th><th>Description</th></tr></thead><tbody><tr><td>user</td><td>Addr</td><td>The user's address</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### GetClaimAbleSeilorResponse&#x20;

```rust
#[cw_serde]
pub struct GetClaimAbleSeilorResponse {
    pub amount: Uint128,
}
```

```json
{
  "amount": "1000000000000000000"
}
```

<table><thead><tr><th width="195">Key</th><th width="194">Type</th><th>Description</th></tr></thead><tbody><tr><td>amount</td><td>Uint128</td><td>The amount of SEILOR that can be claimed</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### GetReservedSeilorForVesting

```rust
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(GetReservedSeilorForVestingResponse)]
    GetReservedSeilorForVesting { user: Addr },
}
```

```json
{
  "get_reserved_seilor_for_vesting": {
    "user": "sei1..."
  }
}
```

<table><thead><tr><th width="184">Key</th><th width="224">Type</th><th>Description</th></tr></thead><tbody><tr><td>user</td><td>Addr</td><td>The user's address</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### GetReservedSeilorForVestingResponse&#x20;

```rust
#[cw_serde]
pub struct GetReservedSeilorForVestingResponse {
    pub amount: Uint128,
}
```

```rust
{
  "amount": "1000000000000000000"
}
```

<table><thead><tr><th width="132">Key</th><th width="125">Type</th><th>Description</th></tr></thead><tbody><tr><td>amount</td><td>Unit128</td><td>The remaining amount of veSEILOR that is vested for the user</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### Earned&#x20;

```rust
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(EarnedResponse)]
    Earned { account: Addr },
}
```

```json
{
  "earned": {
    "account": "sei1..."
  }
}
```

<table><thead><tr><th width="184">Key</th><th width="224">Type</th><th>Description</th></tr></thead><tbody><tr><td>account</td><td>Addr</td><td>The user's address</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### EarnedResponse

```rust
#[cw_serde]
pub struct EarnedResponse {
    pub amount: Uint128,
}
```

```json
{
  "amount": "1000000000000000000"
}
```

<table><thead><tr><th width="132">Key</th><th width="125">Type</th><th>Description</th></tr></thead><tbody><tr><td>amount</td><td>Unit128</td><td>The amount of veSEILOR that is earned by the user</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### GetClaimAbleKusd&#x20;

```rust
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(GetClaimAbleKusdResponse)]
    GetClaimAbleKusd { account: Addr },
}
```

```json
{
  "get_claim_able_kusd": {
    "account": "sei1..."
  }
}
```

<table><thead><tr><th width="167">Key</th><th width="196">Type</th><th>Description</th></tr></thead><tbody><tr><td>account</td><td>Addr</td><td>The user's address</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### GetClaimAbleKusdResponse&#x20;

```rust
#[cw_serde]
pub struct GetClaimAbleKusdResponse {
    pub amount: Uint128,
}
```

```json
{
  "amount": "1000000000000000000"
}
```

<table><thead><tr><th width="172">Key</th><th width="187">Type</th><th>Description</th></tr></thead><tbody><tr><td>amount</td><td>Uint128</td><td>The amount of kUSD that the user is able to claim</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### GetUserRewardPerTokenPaid&#x20;

```rust
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(UserRewardPerTokenPaidResponse)]
    GetUserRewardPerTokenPaid { account: Addr },
}
```

```json
{
  "get_user_reward_per_token_paid": {
    "account": "sei1..."
  }
}
```

<table><thead><tr><th width="185">Key</th><th width="161">Type</th><th>Description</th></tr></thead><tbody><tr><td>account</td><td>Addr</td><td>The user's address</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### GetUserRewardPerTokenPaidResponse&#x20;

```rust
#[cw_serde]
pub struct UserRewardPerTokenPaidResponse {
    pub user_reward_per_token_paid: Uint128,
}
```

```json
{
  "user_reward_per_token_paid": "1000000000000000000"
}
```

<table><thead><tr><th width="172">Key</th><th width="187">Type</th><th>Description</th></tr></thead><tbody><tr><td>user_reward_per_token_paid</td><td>Uint128</td><td>The rate of reward allocation per token for the user</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### GetUserRewards&#x20;

```rust
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(UserRewardsResponse)]
    GetUserRewards { account: Addr },
}
```

```json
{
  "get_user_rewards": {
    "account": "sei1..."
  }
}
```

<table><thead><tr><th width="185">Key</th><th width="161">Type</th><th>Description</th></tr></thead><tbody><tr><td>account</td><td>Addr</td><td>The user's address</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### UserRewardsResponse&#x20;

```rust
#[cw_serde]
pub struct UserRewardsResponse {
    pub user_rewards: Uint128,
}
```

```json
{
  "user_rewards": "1000000000000000000"
}
```

<table><thead><tr><th width="172">Key</th><th width="187">Type</th><th>Description</th></tr></thead><tbody><tr><td>user_rewards</td><td>Uint128</td><td>The amount of rewards that the user is able to claim</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### GetUserTime2fullRedemption&#x20;

```rust
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(UserTime2fullRedemptionResponse)]
    GetUserTime2fullRedemption { account: Addr },
}
```

```json
{
  "get_user_time2full_redemption": {
    "account": "sei1..."
  }
}
```

<table><thead><tr><th width="185">Key</th><th width="161">Type</th><th>Description</th></tr></thead><tbody><tr><td>account</td><td>Addr</td><td>The user's address</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### UserTime2fullRedemptionResponse&#x20;

```rust
#[cw_serde]
pub struct UserTime2fullRedemptionResponse {
    pub user_time2full_redemption: Uint64,
}
```

```
{
  "user_time2full_redemption": "1000000000000000000"
}
```

<table><thead><tr><th width="250">Key</th><th width="210">Type</th><th>Description</th></tr></thead><tbody><tr><td>user_time2full_redemption</td><td>Uint64</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### GetUserUnstakeRate&#x20;

```rust
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(UserUnstakeRateResponse)]
    GetUserUnstakeRate { account: Addr },
}
```

```json
{
  "get_user_unstake_rate": {
    "account": "sei1..."
  }
}
```

<table><thead><tr><th width="185">Key</th><th width="161">Type</th><th>Description</th></tr></thead><tbody><tr><td>account</td><td>Addr</td><td>The user's address</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### UserUnstakeRateResponse&#x20;

```rust
#[cw_serde]
pub struct UserUnstakeRateResponse {
    pub user_unstake_rate: Uint256,
}
```

```
{
  "user_unstake_rate": "1000000000000000000"
}
```

<table><thead><tr><th width="188">Key</th><th width="172">Type</th><th>Description</th></tr></thead><tbody><tr><td>user_unstake_rate</td><td>Uint256</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### GetUserLastWithdrawTime&#x20;

```rust
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(UserLastWithdrawTimeResponse)]
    GetUserLastWithdrawTime { account: Addr },
}
```

```json
{
  "get_user_last_withdraw_time": {
    "account": "sei1..."
  }
}
```

<table><thead><tr><th width="185">Key</th><th width="161">Type</th><th>Description</th></tr></thead><tbody><tr><td>account</td><td>Addr</td><td>The user's address</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### UserLastWithdrawTimeResponse&#x20;

```rust
#[cw_serde]
pub struct UserLastWithdrawTimeResponse {
    pub user_last_withdraw_time: Uint64,
}
```

```json
{
  "user_last_withdraw_time": "1000000000000000000"
}
```

<table><thead><tr><th width="243">Key</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>user_last_withdraw_time</td><td>Uint64</td><td>The time when the user last withdrew</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### IsVeFundMinter&#x20;

```rust
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(bool)]
    IsVeFundMinter { minter: Addr },
}
```

```json
{
  "is_ve_fund_minter": {
    "minter": "sei1..."
  }
}
```

<table><thead><tr><th width="185">Key</th><th width="161">Type</th><th>Description</th></tr></thead><tbody><tr><td>minter</td><td>Addr</td><td>The user's address</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

Return true or false.


---

# 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/seilor-token/fund.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.
