> For the complete documentation index, see [llms.txt](https://mars-protocol.gitbook.io/mars-protocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mars-protocol.gitbook.io/mars-protocol/contracts-core/council.md).

# Council

The Council contract handles submission, voting, and execution of proposals. As protocol becomes stable, the Council will be the admin of all protocol contracts and have privileges to update most params.

## Links

* package (msgs and types): <https://github.com/mars-protocol/mars-core/blob/master/packages/mars-core/src/council.rs>
* contract:  <https://github.com/mars-protocol/mars-core/blob/master/contracts/mars-council/src/contract.rs>
* schema: <https://github.com/mars-protocol/mars-core/tree/master/contracts/mars-council/schema>

## Config

| Key                           | Type          | Description                                                                                                               |
| ----------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `address_provider_address`    | CanonicalAddr | Address provider returns addresses for all protocol contracts                                                             |
| `proposal_voting_period`      | u64           | Blocks during which a proposal is active since being submitted                                                            |
| `proposal_effective_delay`    | u64           | Blocks that need to pass since a proposal succeeds in order for it to be available to be executed                         |
| `proposal_expiration_period`  | u64           | Blocks after the effective\_delay during which a successful proposal can be activated before it expires                   |
| `proposal_required_deposit`   | Uint128       | Number of Mars needed to make a proposal. Will be returned if successful. Will be distributed between stakers if rejected |
| `proposal_required_quorum`    | Decimal       | % of total voting power required to participate in the proposal in order to consider it successfull                       |
| `proposal_required_threshold` | Decimal       | % of for votes required in order to consider the proposal successful                                                      |

## InstantiateMsg

{% tabs %}
{% tab title="Rust" %}

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct InstantiateMsg {
    pub config: CreateOrUpdateConfig
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
  "config": {
    "proposal_voting_period": 3, 
    "proposal_effective_delay": 3, 
    "proposal_expiration_period": 3,
    "proposal_required_deposit": 1000,
    "proposal_required_quorum": 0.2,
    "proposal_required_threshold": 0.3
  }
}
```

{% endtab %}
{% endtabs %}

### `CreateOrUpdateConfig`

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema, Default)]
pub struct CreateOrUpdateConfig {
    pub proposal_voting_period: Option<u64>,
    pub proposal_effective_delay: Option<u64>,
    pub proposal_expiration_period: Option<u64>,
    pub proposal_required_deposit: Option<Uint128>,
    pub proposal_required_quorum: Option<Decimal>,
    pub proposal_required_threshold: Option<Decimal>
}
```

| Key                             | Type    | Description                 |
| ------------------------------- | ------- | --------------------------- |
| `proposal_voting_period`\*      | u64     | Proposal voting period      |
| `proposal_effective_delay`\*    | u64     | Proposal effective delay    |
| `proposal_expiration_period`\*  | u64     | Proposal expiration period  |
| `proposal_required_deposit`\*   | Uint128 | Proposal required deposit   |
| `proposal_required_quorum`\*    | Decimal | Proposal required quorum    |
| `proposal_required_threshold`\* | Decimal | Proposal required threshold |

\* = optional

## ExecuteMsg

### `UpdateConfig`

Update config.

{% tabs %}
{% tab title="Rust" %}

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

{% endtab %}

{% tab title="JSON" %}

```json
{
  "update_config": {
    "config": {
      "proposal_voting_period": 3, 
      "proposal_effective_delay": 3, 
      "proposal_expiration_period": 3,
      "proposal_required_deposit": 1000,
      "proposal_required_quorum": 0.2,
      "proposal_required_threshold": 0.3
    }
  }
}
```

{% endtab %}
{% endtabs %}

### `Receive`

Implementation cw20 receive msg.

{% tabs %}
{% tab title="Rust" %}

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

{% endtab %}

{% tab title="JSON" %}

```json
{
  "receive": {}
}
```

{% endtab %}
{% endtabs %}

### `CastVote`

Vote for a proposal.

{% tabs %}
{% tab title="Rust" %}

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    CastVote {
        proposal_id: u64,
        vote: ProposalVoteOption
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
  "cast_vote": {
    "proposal_id": 123,
    "vote": "for"
  }
}
```

{% endtab %}
{% endtabs %}

| Key           | Type               | Description                  |
| ------------- | ------------------ | ---------------------------- |
| `proposal_id` | u64                | Proposal ID                  |
| `vote`        | ProposalVoteOption | Vote for or against proposal |

### `ProposalVoteOption`

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

| Key       | Description          |
| --------- | -------------------- |
| `For`     | For the proposal     |
| `Against` | Against the proposal |

### `EndProposal`

End proposal after the voting period has passed.

{% tabs %}
{% tab title="Rust" %}

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

{% endtab %}

{% tab title="JSON" %}

```json
{
  "end_proposal": {
    "proposal_id": 123
  }
}
```

{% endtab %}
{% endtabs %}

| Key           | Type | Description |
| ------------- | ---- | ----------- |
| `proposal_id` | u64  | Proposal ID |

### `ExecuteProposal`

Execute a successful proposal.

{% tabs %}
{% tab title="Rust" %}

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

{% endtab %}

{% tab title="JSON" %}

```json
{
  "execute_proposal": {
    "proposal_id": 123
  }
}
```

{% endtab %}
{% endtabs %}

| Key           | Type | Description |
| ------------- | ---- | ----------- |
| `proposal_id` | u64  | Proposal ID |

## ReceiveMsg

### `SubmitProposal`

{% tabs %}
{% tab title="Rust" %}

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ReceiveMsg {
    SubmitProposal {
        title: String,
        description: String,
        link: Option<String>, 
        messages: Option<Vec<ProposalMessage>>
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
  "submit_proposal": {
    "title": "proposal_title",
    "description": "sample_description",
    "link": "forum_link",
    "messages": {}
  }
}
```

{% endtab %}
{% endtabs %}

| Key           | Type         | Description                                             |
| ------------- | ------------ | ------------------------------------------------------- |
| `title`       | String       | Proposal title                                          |
| `description` | String       | Proposal description                                    |
| `link`\*      | String       | Link to Mars forum discussion                           |
| `messages`\*  | Vec\<String> | `CosmosMsg` that gets executed if the proposal succeeds |

\* = optional

### `ProposalMessage`

Execute call that will be executed by the DAO if the proposal succeeds.

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct ProposalMessage {
    pub execution_order: u64,
    pub msg: CosmosMsg,
}
```

| Key               | Type      | Description                                                      |
| ----------------- | --------- | ---------------------------------------------------------------- |
| `execution_order` | u64       | Determines order of execution lower order will be executed first |
| `msg`             | CosmosMsg | CosmosMsg that will be executed by the council                   |

## QueryMsg

### `Config`

Get the contract config.

{% tabs %}
{% tab title="Rust" %}

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

{% endtab %}

{% tab title="JSON" %}

```json
 {
  "config": {}
}
```

{% endtab %}
{% endtabs %}

### `Proposals`

{% tabs %}
{% tab title="Rust" %}

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

{% endtab %}

{% tab title="JSON" %}

```json
{
  "proposals": {
    "start":,
    "limit": 10,
  }
}
```

{% endtab %}
{% endtabs %}

|           |     |                                  |
| --------- | --- | -------------------------------- |
| `start`\* | u64 | Number of proposal to start list |
| `limit`\* | u32 | Limit of poposals to return      |

\* = optional

### `Proposal`

{% tabs %}
{% tab title="Rust" %}

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

{% endtab %}

{% tab title="JSON" %}

```json
{
  "proposal": {
    "proposal_id": 123
  }
}
```

{% endtab %}
{% endtabs %}

| Key           | Type | Description |
| ------------- | ---- | ----------- |
| `proposal_id` | u64  | Proposal ID |

### `ProposalVotes`

{% tabs %}
{% tab title="Rust" %}

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

{% endtab %}

{% tab title="JSON" %}

```json
{
  "proposal_votes": {
    "proposal_id": 123,
    "start_after": "terra...",
    "limit": 100
  }
}
```

{% endtab %}
{% endtabs %}

| Key             | Type   | Description                                     |
| --------------- | ------ | ----------------------------------------------- |
| `proposal_id`   | u64    | Proposal ID                                     |
| `start_after`\* | String | Address to start after                          |
| `limit`\*       | u32    | Limit of addresses and proposal votes to return |

\* = optional

## Structs

### `GlobalState`

Global state.&#x20;

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct GlobalState {
    pub proposal_count: u64,
}
```

| Key              |     |                     |
| ---------------- | --- | ------------------- |
| `proposal_count` | u64 | Number of porposals |

### `Proposal`

Proposal metadata stored in state.

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct Proposal {
    pub proposal_id: u64,
    pub submitter_address: Addr,
    pub status: ProposalStatus,
    pub for_votes: Uint128,
    pub against_votes: Uint128,
    pub start_height: u64,
    pub end_height: u64,
    pub title: String,
    pub description: String,
    pub link: Option<String>,
    pub messages: Option<Vec<ProposalMessage>>,
    pub deposit_amount: Uint128,
}
```

| Key                 | Type                           | Description                                                                                                                                        |
| ------------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `proposal_id`       | u64                            | Proposal id                                                                                                                                        |
| `submitter_address` | String                         | Address submitting the proposal                                                                                                                    |
| `status`            | ProposalStatus                 | Wether the proposal is Active, Passed, Rejected or Executed                                                                                        |
| `for_votes`         | Uint128                        | Number of for votes                                                                                                                                |
| `against_votes`     | Uint128                        | Number of against votes                                                                                                                            |
| `start_height`      | u64                            | Block at which voting for the porposal starts                                                                                                      |
| `end_height`        | u64                            | Block at which voting for the porposal ends                                                                                                        |
| `title`             | String                         | Title for the proposal                                                                                                                             |
| `description`       | String                         | Description for the proposal                                                                                                                       |
| `link`\*            | Option\<String>                | Link provided for cases where the proposal description is too large or some other external resource is intended to be associated with the proposal |
| `messages`\*        | Option\<Vec\<ProposalMessage>> | Set of messages available to get executed if the proposal passes                                                                                   |
| `deposit_amount`    | Uint128                        | MARS tokens deposited on the proposal submission. Will be returned to submitter if proposal passes and sent to xMars stakers otherwise             |

### `ProposalVote`

Single vote made by an address.

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct ProposalVote {
    pub option: ProposalVoteOption,
    pub power: Uint128,
}
```

| Key      |                    |                             |
| -------- | ------------------ | --------------------------- |
| `option` | ProposalVoteOption | For or Against the proposal |
| `power`  | Uint128            | Voting power                |

### `ProposalsListResponse`

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct ProposalsListResponse {
    pub proposal_count: u64,
    pub proposal_list: Vec<Proposal>,
}
```

|                  |                |                                        |
| ---------------- | -------------- | -------------------------------------- |
| `proposal_count` | u64            | Total proposals submitted              |
| `proposal_list`  | Vec\<Proposal> | List of proposals (paginated by query) |

### `ProposalVotesResponse`

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct ProposalVotesResponse {
    pub proposal_id: u64,
    pub votes: Vec<ProposalVoteResponse>,
}
```

| Key           |                            |                                   |
| ------------- | -------------------------- | --------------------------------- |
| `proposal_id` | u64                        | Proposal id                       |
| `votes`       | Vec\<ProposalVoteResponse> | Vector of proposal vote responses |

### `ProposalVoteResponse`

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct ProposalVoteResponse {
    pub voter_address: String,
    pub option: ProposalVoteOption,
    pub power: Uint128,
}
```

| Key             |                    |                      |
| --------------- | ------------------ | -------------------- |
| `voter_address` | String             | Vote address         |
| `option`        | ProposalVoteOption | Proposal vote option |
| `power`         | Uint128            | Power                |

## Enums

### `ProposalStatus`

Proposal status.

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ProposalStatus {
    Active,
    Passed,
    Rejected,
    Executed,
}
```

| Key        | Description                                              |
| ---------- | -------------------------------------------------------- |
| `Active`   | Proposal is being voted on                               |
| `Passed`   | Proposal has been approved but has not been executed yet |
| `Rejected` | Proposal was rejected                                    |
| `Executed` | Proposal has been approved and executed                  |

## Voting Power and Quorum

The voting power of a user for a proposal is defined as the sum of two parts:

1. &#x20;Free voting power: the amount of xMARS token in the user's wallet, at the block before the proposal was created
2. Locked voting power: the amount of MARS locked in the vesting contract owned by the user, at the block before the proposal was created The reason we can use the amount of MARS (instead of xMARS) for locked voting power is that, since vesting allocations can only be created when 1 MARS == 1 xMARS, these MARS tokens would have produced the same amount of xMARS if they were staked.

Total voting power for quorum computations is the sum of the total free voting power (xMars supply) and locked voting power.
