Governance#
- class defichain.ocean.Governance(ocean)#
- listGovProposals(status: str = 'all', type: str = 'all', cycle: int = 0, all: bool = False, size: int = 30, next: str | None = None) {} #
Paginate query on-chain governance proposals
- Parameters:
status (str) – (required) proposal status: all, voting, rejected, completed
type (str) – (required) proposal type: all, cfp, voc
cycle (int) – (required) proposal cycle: 0 (show all), cycle: N (show cycle N), cycle: -1 (show previous cycle)
all (bool) – (optional) all True to return all records, otherwise it will return based on size param
size (int) – (optional) number of returned proposals
next (str) – (optional) next set of proposals
- Returns:
Json String
[ { proposalId: string title: string context: string contextHash: string type: GovernanceProposalType status: GovernanceProposalStatus amount?: string currentCycle: number totalCycles: number creationHeight: number cycleEndHeight: number proposalEndHeight: number payoutAddress?: string votingPeriod: number approvalThreshold: string quorum: string votesPossible?: number votesPresent?: number votesPresentPct?: string votesYes?: number votesYesPct?: string fee: number options?: string[] } ]
- Example:
>>> ocean.governance.listGovProposals("all", "all")
- getGovProposal(id: str) {} #
Get information about a proposal with given proposal id.
- Parameters:
id (str) – (required) txid of proposal
- Returns:
Json String
{ proposalId: string title: string context: string contextHash: string type: GovernanceProposalType status: GovernanceProposalStatus amount?: string currentCycle: number totalCycles: number creationHeight: number cycleEndHeight: number proposalEndHeight: number payoutAddress?: string votingPeriod: number approvalThreshold: string quorum: string votesPossible?: number votesPresent?: number votesPresentPct?: string votesYes?: number votesYesPct?: string fee: number options?: string[] }
- Example:
>>> ocean.governance.getGovProposal("a252bea49341adb75842dd30442e5836f9e204e7fa96a1585983eca3b3b5407c")
- listGovProposalVotes(id: str, masternodeId: str = 'all', cycle: int = 0, all: bool = False, size: int = 30, next: str | None = None) {} #
Returns votes for a proposal
- Parameters:
id (str) – (required) txid of proposal
masternodeId (str) – (required) masternodeId, mine, all
cycle (int) – (required) proposal cycle: 0 (show all), cycle: N (show cycle N), cycle: -1 (show previous cycle)
all (bool) – (optional) all True to return all records, otherwise it will return based on size param
size (int) – (optional) number of returned proposals votes
next (str) – (optional) next set of proposals votes
- Returns:
Json String
{ proposalId: string masternodeId: string cycle: number vote: YES, NO, NEUTRAL, UNKNOWN valid: boolean }
- Example:
>>> ocean.governance.listGovProposalVotes("a252bea49341adb75842dd30442e5836f9e204e7fa96a1585983eca3b3b5407c")