Mars Protocol
Search…
βš–
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

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

Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct InstantiateMsg {
pub config: CreateOrUpdateConfig
}
{
"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
}
}

CreateOrUpdateConfig

#[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.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
config: CreateOrUpdateConfig
}
{
"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
}
}
}

Receive

Implementation cw20 receive msg.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
Receive(Cw20ReceiveMsg)
}
{
"receive": {}
}

CastVote

Vote for a proposal.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
CastVote {
proposal_id: u64,
vote: ProposalVoteOption
}
}
{
"cast_vote": {
"proposal_id": 123,
"vote": "for"
}
}
Key
Type
Description
proposal_id
u64
Proposal ID
vote
ProposalVoteOption
Vote for or against proposal

ProposalVoteOption

#[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.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
EndProposal {
proposal_id: u64
}
}
{
"end_proposal": {
"proposal_id": 123
}
}
Key
Type
Description
proposal_id
u64
Proposal ID

ExecuteProposal

Execute a successful proposal.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
ExecuteProposal {
proposal_id: u64
}
}
{
"execute_proposal": {
"proposal_id": 123
}
}
Key
Type
Description
proposal_id
u64
Proposal ID

ReceiveMsg

SubmitProposal

Rust
JSON
#[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>>
}
}
{
"submit_proposal": {
"title": "proposal_title",
"description": "sample_description",
"link": "forum_link",
"messages": {}
}
}
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.
#[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.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
Config {}
}
{
"config": {}
}

Proposals

Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
Proposals {
start: Option<u64>,
limit: Option<u32>
}
}
{
"proposals": {
"start":,
"limit": 10,
}
}
start*
u64
Number of proposal to start list
limit*
u32
Limit of poposals to return
* = optional

Proposal

Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
Proposal {
proposal_id: u64
}
}
{
"proposal": {
"proposal_id": 123
}
}
Key
Type
Description
proposal_id
u64
Proposal ID

ProposalVotes

Rust
JSON
#[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>
}
}
{
"proposal_votes": {
"proposal_id": 123,
"start_after": "terra...",
"limit": 100
}
}
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.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct GlobalState {
pub proposal_count: u64,
}
Key
Text
Text
proposal_count
u64
Number of porposals

Proposal

Proposal metadata stored in state.
#[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.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct ProposalVote {
pub option: ProposalVoteOption,
pub power: Uint128,
}
Key
Text
Text
option
ProposalVoteOption
For or Against the proposal
power
Uint128
Voting power

ProposalsListResponse

#[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

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct ProposalVotesResponse {
pub proposal_id: u64,
pub votes: Vec<ProposalVoteResponse>,
}
Key
Text
Text
proposal_id
u64
Proposal id
votes
Vec<ProposalVoteResponse>
Vector of proposal vote responses

ProposalVoteResponse

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct ProposalVoteResponse {
pub voter_address: String,
pub option: ProposalVoteOption,
pub power: Uint128,
}
Key
Text
Text
voter_address
String
Vote address
option
ProposalVoteOption
Proposal vote option
power
Uint128
Power

Enums

ProposalStatus

Proposal status.
#[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. 1.
    Free voting power: the amount of xMARS token in the user's wallet, at the block before the proposal was created
  2. 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.
Copy link
On this page
Links
Config
InstantiateMsg
CreateOrUpdateConfig
ExecuteMsg
UpdateConfig
Receive
CastVote
ProposalVoteOption
EndProposal
ExecuteProposal
ReceiveMsg
SubmitProposal
ProposalMessage
QueryMsg
Config
Proposals
Proposal
ProposalVotes
Structs
GlobalState
Proposal
ProposalVote
ProposalsListResponse
ProposalVotesResponse
ProposalVoteResponse
Enums
ProposalStatus
Voting Power and Quorum