# Dispatcher

This contract mainly releases Seilor tokens of SHO on a monthly basis. (Lock the locked Seilor tokens in this contract)

## Config

```rust
pub struct GlobalConfig {
    pub gov: Addr,
    pub claim_token: Addr,
    pub total_lock_amount: Uint256,
    pub start_lock_period_time: u64,
    pub duration_per_period: u64,
    pub periods: u64,
}
```

<table><thead><tr><th width="223">Key</th><th width="139">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>claim_token</td><td>Addr</td><td>The address of the token contract to be claimed</td></tr><tr><td>end_regret_time</td><td>u64</td><td>The end time of the regret period</td></tr><tr><td>total_lock_amount</td><td>Uint256</td><td>The total amount of tokens to be locked</td></tr><tr><td>start_lock_period_time</td><td>u64</td><td>The start time of the lock period</td></tr><tr><td>duration_per_period</td><td>u64</td><td>The duration of each lock period</td></tr><tr><td>periods</td><td>u64</td><td>The number of lock periods</td></tr></tbody></table>



## InitMsg

```rust
#[cw_serde]
pub struct InstantiateMsg {
    pub gov: Option<Addr>,
    pub claim_token: Addr,
    pub total_lock_amount: Uint256,
    pub start_lock_period_time: u64,
    pub duration_per_period: u64,
    pub periods: u64,
}
```

```json
{
  "gov": "sei1...",
  "claim_token": "sei1...",
  "total_lock_amount": "80_000_000_000_000",
  "start_lock_period_time": "1688828677",
  "duration_per_period": "2592000",
  "periods": "25"
}
```

<table><thead><tr><th width="217">Key</th><th width="137">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>claim_token</td><td>Addr</td><td>The address of the token contract to be claimed</td></tr><tr><td>total_lock_amount</td><td>Uint256</td><td>The total amount of tokens to be locked</td></tr><tr><td>start_lock_period_time</td><td>u64</td><td>The start time of the lock period</td></tr><tr><td>duration_per_period</td><td>u64</td><td>The duration of each lock period</td></tr><tr><td>periods</td><td>u64</td><td>The number of lock periods</td></tr></tbody></table>

## ExecuteMsg

### UpdateConfig

```rust
#[cw_serde]
pub enum ExecuteMsg {
    UpdateConfig(UpdateGlobalConfigMsg),
}
#[cw_serde]
pub struct UpdateGlobalConfigMsg {
    pub gov: Option<Addr>,
    pub claim_token: Option<Addr>,
    pub start_lock_period_time: Option<u64>,
    pub total_lock_amount: Option<Uint256>,
}
```

```
{
  "update_config": {
      {
          "gov": "sei1...",
          "claim_token": "sei1...",
          "start_lock_period_time": "1688828677",
          "total_lock_amount": "80_000_000_000_000"
      }
}
```

<table><thead><tr><th width="225">Key</th><th width="98">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>claim_token*</td><td>Addr</td><td>The address of the token contract to be claimed</td></tr><tr><td>start_lock_period_time</td><td>u64</td><td>The start time of the lock period</td></tr><tr><td>total_lock_amount*</td><td>Uint256</td><td>The total amount of tokens to be locked</td></tr></tbody></table>

'\* = optional

### AddUser

```rust
#[cw_serde]
pub enum ExecuteMsg {
    AddUser(Vec<AddUserMsg>),
}
#[cw_serde]
pub struct AddUserMsg {
    pub user: Addr,
    pub lock_amount: Uint256,
    pub replace: bool,
}
```

```json
{
  "add_user": [ 
      {
         "user": "sei1...",
         "lock_amount": "20_000_000_000_000",
         "replace": false
      }
   ]
}
```

<table><thead><tr><th width="187">Key</th><th width="206">Type</th><th>Description</th></tr></thead><tbody><tr><td>add_user</td><td>Vec&#x3C;AddUserMsg></td><td>List of AddUserMsg</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="183">Key</th><th width="146">Type</th><th>Description</th></tr></thead><tbody><tr><td>user</td><td>Addr</td><td>The address of the user to be added</td></tr><tr><td>lock_amount</td><td>Uint256</td><td>The amount of tokens to be locked</td></tr><tr><td>replace</td><td>bool</td><td>Whether to replace the existing user with the same address (default: false)</td></tr></tbody></table>

### UserRegret

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

```json
{
  "user_regret": {}
}
```

### UserClaim

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

```json
{
  "user_claim": {}
}
```

### RegretClaim

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

```json
{
  "regret_claim": {}
}
```

## QueryMsg

### QueryGlobalConfig

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

```json
{
  "query_global_config": {}
}
```

### GlobalInfosResponse

```rust
#[cw_serde]
pub struct GlobalInfosResponse {
    pub config: GlobalConfig,
    pub state: GlobalState,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct GlobalConfig {
    pub gov: Addr,
    pub claim_token: Addr,
    pub total_lock_amount: Uint256,
    pub start_lock_period_time: u64,
    pub duration_per_period: u64,
    pub periods: u64,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct GlobalState {
    pub total_user_lock_amount: Uint256,
    pub total_user_claimed_lock_amount: Uint256,
}
```

```json
{
  "config": {},
  "state": {}
}
```

<table><thead><tr><th width="165">Key</th><th width="183">Type</th><th>Description</th></tr></thead><tbody><tr><td>config</td><td>GlobalConfig</td><td>Configuration in the GlobalConfig struct</td></tr><tr><td>state</td><td>GlobalState</td><td>Station in the GlobalState struct</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

<table><thead><tr><th width="222">Key</th><th width="156">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>claim_token</td><td>Addr</td><td>The address of the token contract to be claimed</td></tr><tr><td>total_lock_amount</td><td>Uint256</td><td>The total amount of tokens to be locked</td></tr><tr><td>start_lock_period_time</td><td>u64</td><td>The start time of the lock period</td></tr><tr><td>duration_per_period</td><td>u64</td><td>The duration of each lock period</td></tr><tr><td>periods</td><td>u64</td><td>The number of lock periods</td></tr></tbody></table>

<table><thead><tr><th width="295">Key</th><th width="161">Type</th><th>Description</th></tr></thead><tbody><tr><td>total_user_lock_amount</td><td>Uint256</td><td>The total amount of tokens to be locked by all users</td></tr><tr><td>total_user_claimed_lock_amount</td><td>Uint256</td><td>The total amount of tokens to be locked by all users that have been claimed</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

### QueryUserInfo

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

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

### UserInfoResponse

```rust
#[cw_serde]
pub struct UserInfoResponse {
    pub state: UserState,
    pub current_period: u64,
    pub claimable_lock_amount: Uint256,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct UserState {
    pub user: Addr,
    pub total_user_lock_amount: Uint256,

    pub claimed_lock_amount: Uint256,

    pub last_claimed_period: u64,
    pub user_per_lock_amount: Uint256,

}
```

```json
{
  "state": {
      "user": "sei1...",
      "total_user_lock_amount": "20_000_000_000_000",
      "claimed_lock_amount": "0",
      "last_claimed_period": "0",
      "user_per_lock_amount": "0"
   },
  "current_period": "0",
  "claimable_lock_amount": "0"
}
```

<table><thead><tr><th width="223">Key</th><th width="174">Type</th><th>Description</th></tr></thead><tbody><tr><td>state</td><td>UserState</td><td>The user state</td></tr><tr><td>current_period</td><td>u64</td><td>The current lock period</td></tr><tr><td>claimable_lock_amount</td><td>Uint256</td><td>The amount of tokens that can be claimed by the user in the current period</td></tr></tbody></table>

<table><thead><tr><th width="223">Key</th><th width="180">Type</th><th>Description</th></tr></thead><tbody><tr><td>user</td><td>Addr</td><td>The address of the user</td></tr><tr><td>total_user_lock_amount</td><td>Uint256</td><td>The total amount of tokens to be locked by the user</td></tr><tr><td>claimed_lock_amount</td><td>Uint256</td><td>The total amount of tokens to be locked by the user that have been claimed</td></tr><tr><td>last_claimed_period</td><td>u64</td><td>The last claimed lock period</td></tr><tr><td>user_per_lock_amount</td><td>Uint256</td><td>The amount of tokens to be locked by the user per lock period</td></tr></tbody></table>

### QueryUserInfos

```rust
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(Vec < UserInfoResponse >)]
    QueryUserInfos {
        start_after: Option<Addr>,
        limit: Option<u32>,
    },
}
```

```json
{
  "query_user_infos": {
    "start_after": "sei1...",
    "limit": 10
  }
}
```

<table><thead><tr><th width="161">Key</th><th width="196">Type</th><th>Description</th></tr></thead><tbody><tr><td>start_after*</td><td>Addr</td><td>The address of the user to start after</td></tr><tr><td>limit*</td><td>u32</td><td>The maximum number of users to return</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

\* = optional
