vote(contract, sender, proposalID, voteOption, currency)

Feature

Returns an raw operation to cast a vote. Note : Can use it only within the ‘VotingPeriod’. Only registered account can execute.

Parameters

string contract address, string sender, string proposalID, int voteOption, string currency ID

Return Value

object vote operation

  • voteOption

    • crypto version: 0-Approve, 1-Disapprove, other number-Abstain

    • biz version: Choose from multiple selections of documents linked to the proposal's URL

example

const contractAddress = "0x41EFb6902ADcb1214a7123b01af66b1D13b89864fca";
const sender = "0x4874C17C354c498cf44D2946612DBe47fBcE7E87fca";
const proposalID = "test_proposal";
const voteOption = 1;
const currencyID = "MCC";
const castVoteOperation = mitum.dao.vote(contractAddress, sender, proposalID, voteOption, currencyID);

console.log(castVoteOperation);

// output
Operation {
  id: 'mitum',
  fact: VoteFact {
    hint: Hint { s: 'mitum-dao-vote-operation-fact' },
    token: Token { s: '2023-10-18 06:11:25.574 +0000 UTC' },
    _hash: <Buffer e4 ae 66 5a cb 8b e2 fc 88 df a6 57 d4 ce 3b 01 1b 39 be fe 75 8e 91 80 b0 19 3b 01 61 f6 1f 68>,
    sender: Address {
      s: '0x4874C17C354c498cf44D2946612DBe47fBcE7E87fca',
      type: 'mitum'
    },
    contract: Address {
      s: '0x41EFb6902ADcb1214a7123b01af66b1D13b89864fca',
      type: 'mitum'
    },
    currency: CurrencyID { s: 'MCC' },
    proposalID: 'test_proposal',
    vote: Big { big: 1n }
  },
  hint: Hint { s: 'mitum-dao-vote-operation' },
  _factSigns: [],
  _hash: <Buffer >
}

Last updated