🏦Astral Assembly

The place where Astroport tokenholders submit and vote on proposals

1. Overview

The Astral Assembly is Astroport’s version of a DAO (Decentralised Autonomous Organization). The Astral Assembly’s goal is the operation, maintenance, development, and growth of Astroport as a user-governed DeFi commons. xASTRO and vxASTRO holders will have the power to propose and make binding votes on smart contract parameter changes, smart contract upgrades, and treasury disbursements.

The Assembly contract code can be found here.

2. Variables & Functions

Constants

Name
Description

CONTRACT_NAME

The Assembly contract name

CONTRACT_VERSION

The current contract version

DEFAULT_LIMIT

Default amount of proposals to retrieve in a query

MAX_LIMIT

Max amount of proposals to retrieve in a query

MINIMUM_PROPOSAL_REQUIRED_THRESHOLD_PERCENTAGE

Minimum proposal required threshold percentage

MAX_PROPOSAL_REQUIRED_PERCENTAGE

Max proposal required threshold percentage

MINIMUM_DELAY

Minimum amount of blocks between a proposal being marked as successful and the time when it can be executed

MINIMUM_EXPIRATION_PERIOD

Minimum amount of blocks after voting is done and the grace period ends after which a proposal is considered expired

MIN_TITLE_LENGTH

Minimum title length

MAX_TITLE_LENGTH

Maximum title length

MIN_DESC_LENGTH

Minimum description length

MAX_DESC_LENGTH

Maxiumum disription length

MIN_LINK_LENGTH

Minimum link length

MAX_LINK_LENGTH

Maximum link length

CONFIG

Struct that stores general contract params

PROPOSAL_COUNT

Stores the global state for the Assembly contract

PROPOSALS

This is a mapping that contains information about all proposals

Structs

Name
Description
Contains

InstantiateMsg

This structure holds the parameters used for creating an Assembly contract

  • xastro_token_addr - Address of xASTRO token

  • vxastro_token_addr - Address of vxASTRO token

  • builder_unlock_addr - Address of the builder unlock contract

  • proposal_voting_period - Proposal voting period

  • proposal_effective_delay - Proposal effective delay

  • proposal_expiration_period - Proposal expiration period

  • proposal_required_deposit - Proposal required deposit

  • proposal_required_quorum - Proposal required quorum

  • proposal_required_threshold - Proposal required threshold

  • whitelisted_links - Whitelisted links

Config

This structure stores general parameters for the Assembly contract

Same as above

UpdateConfig

This structure sotres the params used when updating the main Assembly contract params

Same as above

Proposal

This structure stores data for a proposal

  • proposal_id - Unique proposal ID

  • submitter - The address of the proposal submitter

  • status - Status of the proposal

  • for_power - For power of proposal

  • against_power - Against power of proposal

  • for_voters - For votes for the proposal

  • against_voters - Against votes for the proposal

  • start_block - Start block of proposal

  • start_time - Start time of proposal

  • end_block - End block of proposal

  • title - Proposal title

  • description - Proposal description

  • link - Proposal link

  • messages - Proposal messages

  • deposit_amount - Amount of xASTRO deposited in order to post the proposal

ProposalMessage

This structure describes a proposal message

  • order - Order of execution of the message

  • msg - Execution message

ProposalVote

This structure describes a proposal vote

  • option - Voted option for the proposal

  • power - Vote power

ProposalVotesResponse

This structure describes a proposal vote response

  • proposal_id - Proposal identifier

  • for_power - Total amount of for votes for a proposal

  • against_power - Total amount of against votes for a proposal

ProposalListResponse

This structure describes proposal list response

  • proposal_count - Prosal count

  • proposal_list - Proposal list

Functions

Function
Params
Description

instantiate

(deps: DepsMut, _env: Env, _info: MessageInfo, msg: InstantiateMsg, ) -> Result<Response, ContractError>

Instantiates the Assembly contract

execute

(deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result<Response, ContractError>

Exposes all the execute functions available in the contract

receive_cw20

(deps: DepsMut, env: Env, info: MessageInfo, cw20_msg: Cw20ReceiveMsg, ) -> Result<Response, ContractError>

Receives a message of type [Cw20ReceiveMsg] and processes it depending on the received template

submit_proposal

(deps: DepsMut, env: Env, info: MessageInfo, sender: Addr, deposit_amount: Uint128, title: String, description: String, link: Option<String>, messages: Option<Vec<ProposalMessage>>, ) -> Result<Response, ContractError>

Submit a brand new proposal and locks some xASTRO as an anti-spam mechanism.

cast_vote

(deps: DepsMut, env: Env, info: MessageInfo, proposal_id: u64, vote_option: ProposalVoteOption, ) -> Result<Response, ContractError>

Cast a vote on a proposal

end_proposal

(deps: DepsMut, env: Env, _info: MessageInfo, proposal_id: u64, ) -> Result<Response, ContractError>

Ends proposal voting and sets the proposal status

execute_proposal

(deps: DepsMut, env: Env, _info: MessageInfo, proposal_id: u64, ) -> Result<Response, ContractError>

Executes a successful proposal

remove_completed_proposal

(deps: DepsMut, env: Env, _info: MessageInfo, proposal_id: u64, ) -> Result<Response, ContractError>

Removes an expired or rejected proposal from the general proposal list

update_config

(deps: DepsMut, env: Env, info: MessageInfo, updated_config: UpdateConfig, ) -> Result<Response, ContractError>

Updates Assembly contract parameters

query

(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult<Binary>

Expose available contract queries

query_config

(deps: Deps) -> StdResult<Config>

Returns the contract configuration stored in the [Config] structure

query_proposals

(deps: Deps, start: Option<u64>, limit: Option<u32>, ) -> StdResult<ProposalListResponse>

Returns the current proposal list

query_proposal

(deps: Deps, proposal_id: u64) -> StdResult<Proposal>

Returns proposal information stored in the [Proposal] structure

query_proposal_votes

(deps: Deps, proposal_id: u64) -> StdResult<ProposalVotesResponse>

Returns proposal votes stored in the [ProposalVotesResponse] structure

calc_voting_power

(deps: Deps, sender: String, proposal: &Proposal) -> StdResult<Uint128>

Calculates an address' voting power at the specified block

calc_total_voting_power_at

(deps: Deps, proposal: &Proposal) -> StdResult<Uint128>

Calculates the total voting power at a specified block (that is relevant for a specific proposal)

migrate

(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result<Response, ContractError>

Used for the contract migration. Returns a default object of type [Response]

3. Walkthrough

ExecuteMsg

receive

Submit a new on-chain proposal.

{
  "receive": {
    "sender": "terra...",
    "amount": "123",
    "msg": "<base64_encoded_json_string>"
  }
}

cast_vote

Casts a vote for an active proposal.

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

end_proposal

Ends an expired proposal.

{
  "end_proposal": {
    "proposal_id": 123
  }
}

execute_proposal

Executes a proposal.

{
  "execute_proposal": {
    "proposal_id": 123
  }
}

remove_completed_proposal

Removes a completed proposal from the proposal list.

{
  "remove_completed_proposal": {
    "proposal_id": 123
  }
}

Queries

config

Returns Astral Assembly parameters.

{
  "config": {}
}

proposals

Returns the current proposal list.

{
  "proposals": {}
}

proposal

Returns information about a specific proposal.

{
  "proposal": {
    "proposal_id": 12
  }
}

proposal_votes

Returns information about the votes cast on a proposal.

{
  "proposal_votes": {
    "proposal_id": 12
  }
}

user_voting_power

Returns user voting power for a specific proposal.

{
  "user_voting_power": {
    "user": "terra...",
    "proposal_id": 12
  }
}

total_voting_power

Returns total voting power for a specific proposal.

{
  "total_voting_power": {
    "proposal_id": 123
  }
}

Last updated

Was this helpful?