Skip to main content

Submitting a Proposal

Overview

The Assembly contract allows xASTRO holders as well as Initial Astroport Builders to post new on-chain proposals that can execute arbitrary logic, including contract parameter changes, smart contract upgrades, and treasury disbursements. For a full list of upgradeable contracts and availiable parameter changes, look here.

Upon approval, the upgrades or assignments will be autonomously executed.

Proposal Message

Cw20HookMsg

To submit a proposal, you need to execute a contract message pointing to the send enpoint in the xASTRO token contract.

The send operation takes in a:

  • contract - Address where xASTRO tokens are being sent to (Assembly contract)
  • amount - Required deposit to submit a proposal (30,000 xASTRO for mainnet)
  • msg Binary encoded message containing our contract call.

_45
{
_45
"send": {
_45
"contract": assemblyAddress,
_45
"amount": "1000", // testnet deposit amount - mainnet = 30,000 xASTRO
_45
"msg": toBase64(
_45
{
_45
"submit_proposal": {
_45
"title": "Example proposal",
_45
"description": "Example proposal",
_45
"link": "https://forum.astroport.fi/",
_45
"messages":
_45
[
_45
{
_45
"wasm": {
_45
"execute": {
_45
"contract_addr": factoryAddress,
_45
"msg": toBase64(
_45
{
_45
"deregister": {
_45
"asset_infos": [
_45
{
_45
"token": {
_45
"contract_addr": astroAddress
_45
}
_45
},
_45
{
_45
"token": {
_45
"contract_addr": steakAddress
_45
}
_45
}
_45
]
_45
}
_45
}
_45
),
_45
"funds": []
_45
}
_45
}
_45
}
_45
],
_45
"ibc_channel": "channel..."
_45
}
_45
}
_45
)
_45
}
_45
}

submit_proposal

Our encoded message performs a contract call to the submit_proposal endpoint in the Assembly contract.

submit_proposal takes in the following parameters:

  • title: Proposal title
  • description: Description for the proposal
  • link: Link to forum discussion
  • messages: Proposal messages
  • ibc_channel: Governance channel

_45
{
_45
"send": {
_45
"contract": assemblyAddress,
_45
"amount": "1000", // testnet deposit amount - mainnet = 30,000 xASTRO
_45
"msg": toBase64(
_45
{
_45
"submit_proposal": {
_45
"title": "Example proposal",
_45
"description": "Example proposal",
_45
"link": "https://forum.astroport.fi/",
_45
"messages":
_45
[
_45
{
_45
"wasm": {
_45
"execute": {
_45
"contract_addr": factoryAddress,
_45
"msg": toBase64(
_45
{
_45
"deregister": {
_45
"asset_infos": [
_45
{
_45
"token": {
_45
"contract_addr": astroAddress
_45
}
_45
},
_45
{
_45
"token": {
_45
"contract_addr": steakAddress
_45
}
_45
}
_45
]
_45
}
_45
}
_45
),
_45
"funds": []
_45
}
_45
}
_45
}
_45
],
_45
"ibc_channel": "channel..."
_45
}
_45
}
_45
)
_45
}
_45
}

msg

The msg parameter contains a WasmMsg of type Execute.

wasm -> execute requires the following parameters:

  • contract_addr: Address of the contract our proposal message is pointing to. For example, if you are deregistering a pool, the address would be the Factory contract address.
  • msg: Binary encoded message containing our contract call.
  • funds: Any funds to send along with our transaction.

_45
{
_45
"send": {
_45
"contract": assemblyAddress,
_45
"amount": "1000", // testnet deposit amount - mainnet = 30,000 xASTRO
_45
"msg": toBase64(
_45
{
_45
"submit_proposal": {
_45
"title": "Example proposal",
_45
"description": "Example proposal",
_45
"link": "https://forum.astroport.fi/",
_45
"messages":
_45
[
_45
{
_45
"wasm": {
_45
"execute": {
_45
"contract_addr": factoryAddress,
_45
"msg": toBase64(
_45
{
_45
"deregister": {
_45
"asset_infos": [
_45
{
_45
"token": {
_45
"contract_addr": astroAddress
_45
}
_45
},
_45
{
_45
"token": {
_45
"contract_addr": steakAddress
_45
}
_45
}
_45
]
_45
}
_45
}
_45
),
_45
"funds": []
_45
}
_45
}
_45
}
_45
],
_45
"ibc_channel": "channel..."
_45
}
_45
}
_45
)
_45
}
_45
}

Proposal Example

Our msg parameter contains our final contract call which executes autonomously upon the passage of a successful proposal.

In this example, we deregister the ASTRO-Steak token pair.


_16
{
_16
"deregister": {
_16
"asset_infos": [
_16
{
_16
"token": {
_16
"contract_addr": astroAddress
_16
}
_16
},
_16
{
_16
"token": {
_16
"contract_addr": steakAddress
_16
}
_16
}
_16
]
_16
}
_16
}

Encoding our Messages

To encode our message, there are two common options:

The code in this section uses a custom function (toBase64) to display our binary message - this function needs to be defined elsewhere to be used. The actual string representation of our message would be an encoded binary.


_3
let toBase64 = (obj) => {
_3
return Buffer.from(JSON.stringify(obj)).toString("base64");
_3
};

Cw20HookMsg

To submit a proposal, you need to execute a contract message pointing to the send enpoint in the xASTRO token contract.

The send operation takes in a:

  • contract - Address where xASTRO tokens are being sent to (Assembly contract)
  • amount - Required deposit to submit a proposal (30,000 xASTRO for mainnet)
  • msg Binary encoded message containing our contract call.

submit_proposal

Our encoded message performs a contract call to the submit_proposal endpoint in the Assembly contract.

submit_proposal takes in the following parameters:

  • title: Proposal title
  • description: Description for the proposal
  • link: Link to forum discussion
  • messages: Proposal messages
  • ibc_channel: Governance channel

msg

The msg parameter contains a WasmMsg of type Execute.

wasm -> execute requires the following parameters:

  • contract_addr: Address of the contract our proposal message is pointing to. For example, if you are deregistering a pool, the address would be the Factory contract address.
  • msg: Binary encoded message containing our contract call.
  • funds: Any funds to send along with our transaction.

Proposal Example

Our msg parameter contains our final contract call which executes autonomously upon the passage of a successful proposal.

In this example, we deregister the ASTRO-Steak token pair.

Encoding our Messages

To encode our message, there are two common options:

The code in this section uses a custom function (toBase64) to display our binary message - this function needs to be defined elsewhere to be used. The actual string representation of our message would be an encoded binary.


_45
{
_45
"send": {
_45
"contract": assemblyAddress,
_45
"amount": "1000", // testnet deposit amount - mainnet = 30,000 xASTRO
_45
"msg": toBase64(
_45
{
_45
"submit_proposal": {
_45
"title": "Example proposal",
_45
"description": "Example proposal",
_45
"link": "https://forum.astroport.fi/",
_45
"messages":
_45
[
_45
{
_45
"wasm": {
_45
"execute": {
_45
"contract_addr": factoryAddress,
_45
"msg": toBase64(
_45
{
_45
"deregister": {
_45
"asset_infos": [
_45
{
_45
"token": {
_45
"contract_addr": astroAddress
_45
}
_45
},
_45
{
_45
"token": {
_45
"contract_addr": steakAddress
_45
}
_45
}
_45
]
_45
}
_45
}
_45
),
_45
"funds": []
_45
}
_45
}
_45
}
_45
],
_45
"ibc_channel": "channel..."
_45
}
_45
}
_45
)
_45
}
_45
}