Skip to main content

Voting

Overview

If you have staked ASTRO into the Staking contract, you may be eligible to vote on proposals. Staking must have occured before the submission of the proposal you are voting on.

Additionally, proposal submitters cannot vote on their own proposal.

Casting a Vote

cast_vote

To vote on a proposal, you need to execute a contract message pointing to the cast_vote endpoint in the Assembly contract.

cast_vote takes in the proposal_id and the vote option (for or against)


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

feather.js example

The code in this section is an example implementation of a cast_vote message using feather.js.


_24
const assemblyAddress = 'terra195m6n5xq4rkjy47fn5y3s08tfmj3ryknj55jqvgq2y55zul9myzsgy06hk';
_24
_24
const vote = new MsgExecuteContract(
_24
wallet.key.accAddress('terra'),
_24
assemblyAddress,
_24
{
_24
"cast_vote": {
_24
"proposal_id": 92,
_24
"vote": "for"
_24
}
_24
}
_24
)
_24
_24
let fee = new Fee(2000000, { uluna: 100000 });
_24
_24
let tx = await wallet.createAndSignTx({
_24
msgs: [vote],
_24
fee,
_24
chainID: 'pisco-1',
_24
});
_24
_24
let result = await lcd.tx.broadcast(tx, 'pisco-1');
_24
_24
console.log(result);

cast_vote

To vote on a proposal, you need to execute a contract message pointing to the cast_vote endpoint in the Assembly contract.

cast_vote takes in the proposal_id and the vote option (for or against)

feather.js example

The code in this section is an example implementation of a cast_vote message using feather.js.


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