Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProposalChartData ¶
type ProposalChartData struct { Yes []uint64 `json:"yes"` No []uint64 `json:"no"` Time []int64 `json:"time"` }
ProposalChartData defines the data used to plot proposal ticket votes charts.
type ProposalMetadata ¶
type ProposalMetadata struct { // Time until start for "Authorized" proposals, Time until done for // "Started" proposals. SecondsTil int64 IsPassing bool Approval float32 Rejection float32 Yes int64 No int64 VoteCount int64 QuorumCount int64 QuorumAchieved bool PassPercent float32 VoteStatusDesc string ProposalStateDesc string ProposalStatusDesc string }
ProposalMetadata contains some status-dependent data representations for display purposes.
type ProposalRecord ¶
type ProposalRecord struct { ID int `json:"id" storm:"id,increment"` // Record API data State recordsv1.RecordStateT `json:"state"` Status recordsv1.RecordStatusT `json:"status"` Token string `json:"token"` Version uint32 `json:"version"` Timestamp uint64 `json:"timestamp" storm:"index"` Username string `json:"username"` // Pi metadata Name string `json:"name"` // User metadata UserID string `json:"userid"` // Comments API data CommentsCount int32 `json:"commentscount"` // Ticketvote API data VoteStatus ticketvotev1.VoteStatusT `json:"votestatus"` VoteResults []ticketvotev1.VoteResult `json:"voteresults"` StatusChangeMsg string `json:"statuschangemsg"` EligibleTickets uint32 `json:"eligibletickets"` StartBlockHeight uint32 `json:"startblockheight"` EndBlockHeight uint32 `json:"endblockheight"` QuorumPercentage uint32 `json:"quorumpercentage"` PassPercentage uint32 `json:"passpercentage"` TotalVotes uint64 `json:"totalvotes"` ChartData *ProposalChartData `json:"chartdata"` // Synced is used to indicate that this proposal is already fully // synced with politeia server, and does not need to make any more // http requests for this proposal Synced bool `json:"synced"` // Timestamps PublishedAt uint64 `json:"publishedat" storm:"index"` CensoredAt uint64 `json:"censoredat"` AbandonedAt uint64 `json:"abandonedat"` }
ProposalRecord is the struct that holds all politeia data that dcrdata needs for each proposal. This is the object that is saved to stormdb. It uses data from three politeia API's: records, comments and ticketvote.
func (*ProposalRecord) IsEqual ¶
func (pi *ProposalRecord) IsEqual(b ProposalRecord) bool
IsEqual compares data between the two ProposalRecord structs passed.
func (*ProposalRecord) Metadata ¶
func (pi *ProposalRecord) Metadata(tip, targetBlockTime int64) *ProposalMetadata
Metadata performs some common manipulations of the ProposalRecord data to prepare figures for display. Many of these manipulations require a tip height and a target block time for the network, so those must be provided as arguments.