Skip to main content

Astral Assembly

Overview

The Assembly contract allows xASTRO holders as well as Initial Astroport Builders to post and vote on new on-chain proposals that can execute arbitrary logic.

InstantiateMsg

Instantiate the contract with proposal parameter limitations and the xASTRO and builder unlock contract addresses.

json
assembly.rs
Copy

_13
{
_13
"xastro_token_addr": "terra...",
_13
"builder_unlock_addr": "terra...",
_13
"proposal_voting_period": 123,
_13
"proposal_effective_delay": 123,
_13
"proposal_expiration_period": 123,
_13
"proposal_required_deposit": "123",
_13
"proposal_required_quorum": "0.55",
_13
"proposal_required_threshold": "0.55",
_13
"whitelisted_links": [
_13
"https://some.link"
_13
]
_13
}

ParamsTypeDescription
xastro_token_addrStringAddress of xASTRO token
builder_unlock_addrStringAddress of the builder unlock contract
proposal_voting_periodu64Proposal voting period
proposal_effective_delayu64Proposal effective delay
proposal_expiration_periodu64Proposal expiration period
proposal_required_depositUint128Proposal required deposit
proposal_required_quorumStringProposal required quorum
proposal_required_thresholdStringProposal required threshold
whitelisted_linksVec<String>Whitelisted links

ExecuteMsg

receive

Receive a new on-chain proposal.

json
assembly.rs
Copy

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

ParamsTypeDescription
receiveCw20ReceiveMsgCW20 receive message

cast_vote

Casts a vote for an active proposal.

json
assembly.rs
Copy

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

ParamsTypeDescription
proposal_idu64Proposal identifier
voteProposalVoteOptionVote option

ProposalVoteOption

This structure describes a proposal vote.

assembly.rs
Copy

_5
#[cw_serde]
_5
pub enum ProposalVoteOption {
_5
For,
_5
Against,
_5
}

VariantsDescription
ForVote for proposal
AgainstVote against proposal

end_proposal

Ends an expired proposal.

json
assembly.rs
Copy

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

ParamsTypeDescription
proposal_idu64Proposal identifier

check_messages

Check messages execution.

json
assembly.rs
Copy

_12
{
_12
"check_messages": {
_12
"messages": [
_12
{
_12
"proposal_message": {
_12
"order": "123",
_12
"msg": "<CosmosMsg>"
_12
}
_12
}
_12
]
_12
}
_12
}

ParamsTypeDescription
messagesVec<ProposalMessage>Messages

ProposalMessage

This structure describes a proposal message.

json
assembly.rs
Copy

_6
{
_6
"proposal_message": {
_6
"order": "123",
_6
"msg": "<CosmosMsg>"
_6
}
_6
}

ParamsTypeDescription
orderUint64Order of execution of the message
msgCosmosMsgExecution message

check_messages_passed

The last endpoint which is executed only if all proposal messages have been passed.

json
assembly.rs
Copy

_3
{
_3
"check_messages_passed": {}
_3
}

execute_proposal

Executes a sucessful proposal.

json
assembly.rs
Copy

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

remove_completed_proposal

Removes a completed proposal from the proposal list.

json
assembly.rs
Copy

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

update_config

Update contract parameters. Only the Assembly is allowed to update its own parameters.

json
assembly.rs
Copy

_20
{
_20
"update_config": {
_20
"xastro_token_addr": "...",
_20
"vxastro_token_addr": "...",
_20
"voting_escrow_delegator_addr": "...",
_20
"builder_unlock_addr": "...",
_20
"proposal_voting_period": 123,
_20
"proposal_effective_delay": 123,
_20
"proposal_expiration_period": 123,
_20
"proposal_required_deposit": "123",
_20
"proposal_required_quorum": "0.55",
_20
"proposal_required_threshold": "0.55",
_20
"whitelist_remove": [
_20
"https://some.link"
_20
],
_20
"whitelist_add": [
_20
"https://some.link"
_20
]
_20
}
_20
}

UpdateConfig

This structure stores the params used when updating the main Assembly contract params.

json
assembly.rs
Copy

_18
{
_18
"xastro_token_addr": "...",
_18
"vxastro_token_addr": "...",
_18
"voting_escrow_delegator_addr": "...",
_18
"builder_unlock_addr": "...",
_18
"proposal_voting_period": 123,
_18
"proposal_effective_delay": 123,
_18
"proposal_expiration_period": 123,
_18
"proposal_required_deposit": "123",
_18
"proposal_required_quorum": "0.55",
_18
"proposal_required_threshold": "0.55",
_18
"whitelist_remove": [
_18
"https://some.link"
_18
],
_18
"whitelist_add": [
_18
"https://some.link"
_18
]
_18
}

ParamsTypeDescription
xastro_token_addrOption<String>xASTRO token address
vxastro_token_addrOption<String>vxASTRO token address
voting_escrow_delegator_addrOption<String>Voting Escrow delegator address
builder_unlock_addrOption<String>Builder unlock contract address
proposal_voting_periodOption<u64>Proposal voting period
proposal_effective_delayOption<u64>Proposal effective delay
proposal_expiration_periodOption<u64>Proposal expiration period
proposal_required_depositOption<u128>Proposal required deposit
proposal_required_quorumOption<String>Proposal required quorum
proposal_required_thresholdOption<String>Proposal required threshold
whitelist_removeOption<String>Links to remove from whitelist
whitelist_addOption<String>Links to add to whitelist

Cw20HookMsg

submit_proposal

Submit a new proposal in the Assembly.

NOTE

You should execute this message inside the xASTRO token contract.

json
Copy

_7
{
_7
"send": {
_7
"contract": "AssemblyContractAddress",
_7
"amount": "999",
_7
"msg": "base64-encodedStringOfWithdrawMsg"
_7
}
_7
}

ParamsTypeDescription
sendCw20ExecuteMsgCW20 receive message

In send.msg, you may encode this JSON string into base64 encoding.

json
assembly.rs
Copy

_20
{
_20
"submit_proposal": {
_20
"title": "Example proposal",
_20
"description": "Example proposal",
_20
"link": "https://forum.astroport.fi/",
_20
"messages":
_20
[
_20
{
_20
"wasm": {
_20
"execute": {
_20
"contract_addr": "terra..",
_20
"msg": "<base64_encoded_json_string>",
_20
"funds": []
_20
}
_20
}
_20
}
_20
],
_20
"ibc_channel": "channel..."
_20
}
_20
}

ParamsTypeDescription
titleStringProposal title
descriptionStringDescription for proposal
linkOption<String>Link for proposal
messagesOption<Vec<ProposalMessage>>Proposal messages
ibc_channelOption<String>If the proposal should be executed on a remote chain, this field should specify the governance channel

QueryMsg

config

Queries Astral Assembly parameters.

json
assembly.rs
Copy

_3
{
_3
"config": {}
_3
}

Config (response)

json
assembly.rs
Copy

_15
{
_15
"xastro_token_addr": "...",
_15
"vxastro_token_addr": "...",
_15
"voting_escrow_delegator_addr": "...",
_15
"builder_unlock_addr": "...",
_15
"proposal_voting_period": 123,
_15
"proposal_effective_delay": 123,
_15
"proposal_expiration_period": 123,
_15
"proposal_required_deposit": "123",
_15
"proposal_required_quorum": "0.55",
_15
"proposal_required_threshold": "0.55",
_15
"whitelisted_links": [
_15
"https://some.link"
_15
]
_15
}

ParamsTypeDescription
xastro_token_addrAddrxASTRO token address
vxastro_token_addrOption<Addr>vxASTRO token address
voting_escrow_delegator_addrOption<Addr>Voting Escrow delegator address
builder_unlock_addrAddrBuilder unlock contract address
proposal_voting_periodu64Proposal voting period
proposal_effective_delayu64Proposal effective delay
proposal_expiration_periodu64Proposal expiration period
proposal_required_depositUint128Proposal required deposit
proposal_required_quorumDecimalProposal required quorum
proposal_required_thresholdDecimalProposal required threshold
whitelisted_linksVec<String>Whitelisted links

proposals

Queries the current proposal list.

json
assembly.rs
Copy

_6
{
_6
"proposals": {
_6
"start": 5,
_6
"limit": 5
_6
}
_6
}

ParamsTypeDescription
startOption<u64>Id from which to start querying
limitOption<u32>The amount of proposals to return

ProposalListResponse

This structure describes a proposal list response.

json
assembly.rs
Copy

_33
{
_33
"proposal_count": "10",
_33
"proposal_list": [
_33
{
_33
"proposal_id": "123",
_33
"submitter": "...",
_33
"status": "active",
_33
"for_power": "100000",
_33
"against_power": "100000",
_33
"start_block": 123,
_33
"start_time": 123,
_33
"end_block": 123,
_33
"delayed_end_block": 123,
_33
"expiration_block": 123,
_33
"title": "...",
_33
"description": "...",
_33
"link": "https://some.link",
_33
"messages": [
_33
{
_33
"order": "1",
_33
"msg": "<CosmosMsg>"
_33
},
_33
{
_33
"order": "2",
_33
"msg": "<CosmosMsg>"
_33
},
_33
...etc
_33
],
_33
"deposit_amount": "100000"
_33
},
_33
etc...
_33
]
_33
}

ParamsTypeDescription
proposal_countUint64The amount of proposals returned
proposal_listVec<ProposalResponse>The list of proposals that are returned

ProposalResponse

This structure describes a proposal response.

json
assembly.rs
Copy

_27
{
_27
"proposal_id": "123",
_27
"submitter": "...",
_27
"status": "active",
_27
"for_power": "100000",
_27
"against_power": "100000",
_27
"start_block": 123,
_27
"start_time": 123,
_27
"end_block": 123,
_27
"delayed_end_block": 123,
_27
"expiration_block": 123,
_27
"title": "...",
_27
"description": "...",
_27
"link": "https://some.link",
_27
"messages": [
_27
{
_27
"order": "1",
_27
"msg": "<CosmosMsg>"
_27
},
_27
{
_27
"order": "2",
_27
"msg": "<CosmosMsg>"
_27
},
_27
...etc
_27
],
_27
"deposit_amount": "100000"
_27
}

ParamsTypeDescription
proposal_idUint64Unique proposal ID
submitterAddrThe address of the proposal submitter
statusProposalStatusStatus of the proposal
for_powerUint128For power of proposal
against_powerUint128Against power of proposal
start_blocku64Start block of proposal
start_timeu64Start time of proposal
end_blocku64End block of proposal
delayed_end_blocku64Delayed end block of proposal
expiration_blocku64Expiration block of proposal
titleStringProposal title
descriptionStringProposal description
linkOption<String>Proposal link
messagesOption<Vec<ProposalMessage>>Proposal messages
deposit_amountUint128Amount of xASTRO deposited in order to post the proposal

ProposalStatus

This enum describes available statuses/states for a Proposal.

assembly.rs
Copy

_8
#[cw_serde]
_8
pub enum ProposalStatus {
_8
Active,
_8
Passed,
_8
Rejected,
_8
Executed,
_8
Expired,
_8
}

VariantsDescription
ActiveProposal is currently active
PassedProposal passed
RejectedProposal rejected
ExecutedProposal executed
ExpiredProposal expired

proposal

Queries information about a specific proposal.

json
assembly.rs
Copy

_5
{
_5
"proposal": {
_5
"proposal_id": 123
_5
}
_5
}

ParamsTypeDescription
proposal_idOption<u64>Id from which to start querying

Returns ProposalResponse

proposal_voters

Queries list of voters of specified proposal.

json
assembly.rs
Copy

_8
{
_8
"proposal_voters": {
_8
"proposal_id": 123,
_8
"vote_option": "for",
_8
"start": 5,
_8
"limit": 5
_8
}
_8
}

ParamsTypeDescription
proposal_idu64Proposal unique id
vote_optionProposalVoteOptionProposal vote option
startOption<u64>Id from which to start querying
limitOption<u32>The amount of proposals to return

Returns a vector that contains objects of type Addr

proposal_votes

Queries information about the votes cast on a proposal.

json
assembly.rs
Copy

_5
{
_5
"proposal_votes": {
_5
"proposal_id": 123
_5
}
_5
}

ParamsTypeDescription
proposal_idu64Proposal unique id

ProposalVotesResponse

This structure describes a proposal vote response.

json
assembly.rs
Copy

_5
{
_5
"proposal_id": 123,
_5
"for_power": "1000000",
_5
"against_power": "1000000"
_5
}

ParamsTypeDescription
proposal_idu64Proposal identifier
for_powerUint128Total amount of for votes for a proposal
against_powerUint128Total amount of against votes for a proposal

user_voting_power

Queries user voting power for a specific proposal.

json
assembly.rs
Copy

_6
{
_6
"user_voting_power": {
_6
"user": "...",
_6
"proposal_id": 123
_6
}
_6
}

ParamsTypeDescription
userStringUser address
proposal_idu64Proposal unique id

Returns Uint128

total_voting_power

Queries total voting power for a specific proposal.

json
assembly.rs
Copy

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

ParamsTypeDescription
proposal_idu64Proposal unique id

Returns Uint128