foneroplugin

package
v0.0.0-...-db4ab52 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2019 License: ISC Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version                  = "1"
	ID                       = "fonero"
	CmdAuthorizeVote         = "authorizevote"
	CmdStartVote             = "startvote"
	CmdVoteDetails           = "votedetails"
	CmdVoteSummary           = "votesummary"
	CmdLoadVoteResults       = "loadvoteresults"
	CmdBallot                = "ballot"
	CmdBestBlock             = "bestblock"
	CmdNewComment            = "newcomment"
	CmdLikeComment           = "likecomment"
	CmdCensorComment         = "censorcomment"
	CmdGetComment            = "getcomment"
	CmdGetComments           = "getcomments"
	CmdProposalVotes         = "proposalvotes"
	CmdCommentLikes          = "commentlikes"
	CmdProposalCommentsLikes = "proposalcommentslikes"
	CmdInventory             = "inventory"
	CmdTokenInventory        = "tokeninventory"
	MDStreamAuthorizeVote    = 13 // Vote authorization by proposal author
	MDStreamVoteBits         = 14 // Vote bits and mask
	MDStreamVoteSnapshot     = 15 // Vote tickets and start/end parameters

	VoteDurationMin = 2016 // Minimum vote duration (in blocks)
	VoteDurationMax = 4032 // Maximum vote duration (in blocks)

	// Authorize vote actions
	AuthVoteActionAuthorize = "authorize" // Authorize a proposal vote
	AuthVoteActionRevoke    = "revoke"    // Revoke a proposal vote authorization
)

Plugin settings, kinda doesn;t go here but for now it is fine

View Source
const VersionAuthorizeVote = 1

AuthorizeVote is an MDStream that is used to indicate that a proposal has been finalized and is ready to be voted on. The signature and public key are from the proposal author. The author can revoke a previously sent vote authorization by setting the Action field to revoke.

View Source
const VersionStartVote = 1

StartVote instructs the plugin to commence voting on a proposal with the provided vote bits.

View Source
const VersionStartVoteReply = 1

StartVoteReply is the reply to StartVote.

Variables

This section is empty.

Functions

func EncodeAuthorizeVote

func EncodeAuthorizeVote(av AuthorizeVote) ([]byte, error)

EncodeAuthorizeVote encodes AuthorizeVote into a JSON byte slice.

func EncodeAuthorizeVoteReply

func EncodeAuthorizeVoteReply(avr AuthorizeVoteReply) ([]byte, error)

EncodeAuthorizeVote encodes AuthorizeVoteReply into a JSON byte slice.

func EncodeBallot

func EncodeBallot(b Ballot) ([]byte, error)

EncodeCastVotes encodes CastVotes into a JSON byte slice.

func EncodeBallotReply

func EncodeBallotReply(br BallotReply) ([]byte, error)

EncodeCastVoteReplies encodes CastVotes into a JSON byte slice.

func EncodeCastVoteReply

func EncodeCastVoteReply(cvr CastVoteReply) ([]byte, error)

EncodeCastVoteReply encodes CastVoteReply into a JSON byte slice.

func EncodeCensorComment

func EncodeCensorComment(cc CensorComment) ([]byte, error)

EncodeCensorComment encodes CensorComment into a JSON byte slice.

func EncodeCensorCommentReply

func EncodeCensorCommentReply(ccr CensorCommentReply) ([]byte, error)

EncodeCensorCommentReply encodes CensorCommentReply into a JSON byte slice.

func EncodeComment

func EncodeComment(c Comment) ([]byte, error)

EncodeComment encodes Comment into a JSON byte slice.

func EncodeCommentLikes

func EncodeCommentLikes(gpcv CommentLikes) ([]byte, error)

EncodeCommentLikes encodes CommentLikes into a JSON byte slice.

func EncodeCommentLikesReply

func EncodeCommentLikesReply(clr CommentLikesReply) ([]byte, error)

EncodeCommentLikesReply encodes EncodeCommentLikesReply into a JSON byte slice.

func EncodeGetComment

func EncodeGetComment(gc GetComment) ([]byte, error)

EncodeGetComment encodes a GetComment into a JSON byte slice.

func EncodeGetCommentReply

func EncodeGetCommentReply(gcr GetCommentReply) ([]byte, error)

EncodeGetCommentReply encodes a GetCommentReply into a JSON byte slice.

func EncodeGetComments

func EncodeGetComments(gc GetComments) ([]byte, error)

EncodeGetComments encodes GetCommentsReply into a JSON byte slice.

func EncodeGetCommentsReply

func EncodeGetCommentsReply(gcr GetCommentsReply) ([]byte, error)

EncodeGetCommentsReply encodes GetCommentsReply into a JSON byte slice.

func EncodeGetProposalCommentsLikes

func EncodeGetProposalCommentsLikes(gpcv GetProposalCommentsLikes) ([]byte, error)

EncodeGetProposalCommentsLikes encodes GetProposalCommentsLikes into a JSON byte slice.

func EncodeGetProposalCommentsLikesReply

func EncodeGetProposalCommentsLikesReply(gpclr GetProposalCommentsLikesReply) ([]byte, error)

EncodeGetProposalCommentsLikesReply encodes EncodeGetProposalCommentsLikesReply into a JSON byte slice.

func EncodeInventory

func EncodeInventory(i Inventory) ([]byte, error)

EncodeInventory encodes Inventory into a JSON byte slice.

func EncodeInventoryReply

func EncodeInventoryReply(ir InventoryReply) ([]byte, error)

EncodeInventoryReply encodes a InventoryReply into a JSON byte slice.

func EncodeLikeComment

func EncodeLikeComment(lc LikeComment) ([]byte, error)

EncodeLikeComment encodes LikeComment into a JSON byte slice.

func EncodeLikeCommentReply

func EncodeLikeCommentReply(lcr LikeCommentReply) ([]byte, error)

EncodeLikeCommentReply encodes LikeCommentReply into a JSON byte slice.

func EncodeLoadVoteResults

func EncodeLoadVoteResults(lvr LoadVoteResults) ([]byte, error)

EncodeLoadVoteResults encodes a LoadVoteResults into a JSON byte slice.

func EncodeLoadVoteResultsReply

func EncodeLoadVoteResultsReply(reply LoadVoteResultsReply) ([]byte, error)

EncodeLoadVoteResultsReply encodes a LoadVoteResultsReply into a JSON byte slice.

func EncodeNewComment

func EncodeNewComment(nc NewComment) ([]byte, error)

EncodeNewComment encodes NewComment into a JSON byte slice.

func EncodeNewCommentReply

func EncodeNewCommentReply(ncr NewCommentReply) ([]byte, error)

EncodeNewCommentReply encodes NewCommentReply into a JSON byte slice.

func EncodeStartVote

func EncodeStartVote(v StartVote) ([]byte, error)

EncodeStartVoteencodes StartVoteinto a JSON byte slice.

func EncodeStartVoteReply

func EncodeStartVoteReply(v StartVoteReply) ([]byte, error)

EncodeStartVoteReply encodes StartVoteReply into a JSON byte slice.

func EncodeTokenInventory

func EncodeTokenInventory(i TokenInventory) ([]byte, error)

EncodeTokenInventory encodes a TokenInventory into a JSON byte slice.

func EncodeTokenInventoryReply

func EncodeTokenInventoryReply(itr TokenInventoryReply) ([]byte, error)

EncodeTokenInventoryReply encodes a TokenInventoryReply into a JSON byte slice.

func EncodeVote

func EncodeVote(v Vote) ([]byte, error)

EncodeVote encodes Vote into a JSON byte slice.

func EncodeVoteDetails

func EncodeVoteDetails(vd VoteDetails) ([]byte, error)

EncodeVoteDetails encodes VoteDetails into a JSON byte slice.

func EncodeVoteDetailsReply

func EncodeVoteDetailsReply(vdr VoteDetailsReply) ([]byte, error)

EncodeVoteDetailsReply encodes VoteDetailsReply into a JSON byte slice.

func EncodeVoteResults

func EncodeVoteResults(v VoteResults) ([]byte, error)

EncodeVoteResults encodes VoteResults into a JSON byte slice.

func EncodeVoteResultsReply

func EncodeVoteResultsReply(v VoteResultsReply) ([]byte, error)

EncodeVoteResultsReply encodes VoteResults into a JSON byte slice.

func EncodeVoteSummary

func EncodeVoteSummary(v VoteSummary) ([]byte, error)

EncodeVoteSummary encodes VoteSummary into a JSON byte slice.

func EncodeVoteSummaryReply

func EncodeVoteSummaryReply(v VoteSummaryReply) ([]byte, error)

EncodeVoteSummaryReply encodes VoteSummary into a JSON byte slice.

Types

type AuthorizeVote

type AuthorizeVote struct {
	// Generated by foneroplugin
	Version   uint   `json:"version"`   // Version of this structure
	Receipt   string `json:"receipt"`   // Server signature of client signature
	Timestamp int64  `json:"timestamp"` // Received UNIX timestamp

	// Generated by client
	Action    string `json:"action"`    // Authorize or revoke
	Token     string `json:"token"`     // Proposal censorship token
	Signature string `json:"signature"` // Signature of token+version+action
	PublicKey string `json:"publickey"` // Pubkey used for signature
}

func DecodeAuthorizeVote

func DecodeAuthorizeVote(payload []byte) (*AuthorizeVote, error)

DecodeAuthorizeVote decodes a JSON byte slice into an AuthorizeVote.

type AuthorizeVoteReply

type AuthorizeVoteReply struct {
	Action        string `json:"action"`        // Authorize or revoke
	RecordVersion string `json:"recordversion"` // Version of record files
	Receipt       string `json:"receipt"`       // Server signature of client signature
	Timestamp     int64  `json:"timestamp"`     // Received UNIX timestamp
}

AuthorizeVoteReply returns the authorize vote action that was executed and the receipt for the action. The receipt is the server side signature of AuthorizeVote.Signature.

func DecodeAuthorizeVoteReply

func DecodeAuthorizeVoteReply(payload []byte) (*AuthorizeVoteReply, error)

DecodeAuthorizeVoteReply decodes a JSON byte slice into a AuthorizeVoteReply.

type Ballot

type Ballot struct {
	Votes []CastVote `json:"votes"`
}

Ballot is a batch of votes that are sent to the server.

func DecodeBallot

func DecodeBallot(payload []byte) (*Ballot, error)

DecodeCastVotes decodes a JSON byte slice into a CastVotes.

type BallotReply

type BallotReply struct {
	Receipts []CastVoteReply `json:"receipts"`
}

BallotReply is a reply to a batched list of votes.

func DecodeBallotReply

func DecodeBallotReply(payload []byte) (*BallotReply, error)

DecodeBallotReply decodes a JSON byte slice into a CastVotes.

type CastVote

type CastVote struct {
	Token     string `json:"token"`     // Proposal ID
	Ticket    string `json:"ticket"`    // Ticket ID
	VoteBit   string `json:"votebit"`   // Vote bit that was selected, this is encode in hex
	Signature string `json:"signature"` // Signature of Token+Ticket+VoteBit
}

CastVote is a signed vote.

type CastVoteReply

type CastVoteReply struct {
	ClientSignature string `json:"clientsignature"` // Signature that was sent in
	Signature       string `json:"signature"`       // Signature of the ClientSignature
	Error           string `json:"error"`           // Error if something wen't wrong during casting a vote
}

CastVoteReply contains the signature or error to a cast vote command.

func DecodeCastVoteReply

func DecodeCastVoteReply(payload []byte) (*CastVoteReply, error)

DecodeBallotReply decodes a JSON byte slice into a CastVotes.

type CensorComment

type CensorComment struct {
	Token     string `json:"token"`     // Proposal censorship token
	CommentID string `json:"commentid"` // Comment ID
	Reason    string `json:"reason"`    // Reason comment was censored
	Signature string `json:"signature"` // Client signature of Token+CommentID+Reason
	PublicKey string `json:"publickey"` // Pubkey used for signature

	// Generated by foneroplugin
	Receipt   string `json:"receipt,omitempty"`   // Server signature of client signature
	Timestamp int64  `json:"timestamp,omitempty"` // Received UNIX timestamp
}

CensorComment is a journal entry for a censored comment. The signature and public key are from the admin that censored this comment.

func DecodeCensorComment

func DecodeCensorComment(payload []byte) (*CensorComment, error)

DecodeCensorComment decodes a JSON byte slice into a CensorComment.

type CensorCommentReply

type CensorCommentReply struct {
	Receipt string `json:"receipt"` // Server signature of client signature
}

CommentCensorReply returns the receipt for the censoring action. The receipt is the server side signature of CommentCensor.Signature.

func DecodeCensorCommentReply

func DecodeCensorCommentReply(payload []byte) (*CensorCommentReply, error)

DecodeCensorComment decodes a JSON byte slice into a CensorCommentReply.

type Comment

type Comment struct {
	// Data generated by client
	Token     string `json:"token"`     // Censorship token
	ParentID  string `json:"parentid"`  // Parent comment ID
	Comment   string `json:"comment"`   // Comment
	Signature string `json:"signature"` // Client Signature of Token+ParentID+Comment
	PublicKey string `json:"publickey"` // Pubkey used for Signature

	// Metadata generated by fonero plugin
	CommentID   string `json:"commentid"`   // Comment ID
	Receipt     string `json:"receipt"`     // Server signature of the client Signature
	Timestamp   int64  `json:"timestamp"`   // Received UNIX timestamp
	TotalVotes  uint64 `json:"totalvotes"`  // Total number of up/down votes
	ResultVotes int64  `json:"resultvotes"` // Vote score
	Censored    bool   `json:"censored"`    // Has this comment been censored
}

Comment is the structure that describes the full server side content. It includes server side meta-data as well. Note that the receipt is the server side.

func DecodeComment

func DecodeComment(payload []byte) (*Comment, error)

DecodeComment decodes a JSON byte slice into a Comment

type CommentLikes

type CommentLikes struct {
	Token     string `json:"token"`     // Censorship token
	CommentID string `json:"commentid"` // Comment ID
}

CommentLikes is used to retrieve all of the comment likes for a single record comment.

func DecodeCommentLikes

func DecodeCommentLikes(payload []byte) (*CommentLikes, error)

DecodeCommentLikes decodes a JSON byte slice into a CommentLikes.

type CommentLikesReply

type CommentLikesReply struct {
	CommentLikes []LikeComment `json:"commentlikes"`
}

CommentLikesReply is the reply to CommentLikes and returns all of the upvote/downvote actions for the specified comment.

func DecodeCommentLikesReply

func DecodeCommentLikesReply(payload []byte) (*CommentLikesReply, error)

DecodeCommentLikesReply decodes a JSON byte slice into a CommentLikesReply.

type GetComment

type GetComment struct {
	Token     string `json:"token"`     // Proposal ID
	CommentID string `json:"commentid"` // Comment ID
}

GetComment retrieves a single comment.

func DecodeGetComment

func DecodeGetComment(payload []byte) (*GetComment, error)

DecodeGetComment decodes a JSON byte slice into a GetComment.

type GetCommentReply

type GetCommentReply struct {
	Comment Comment `json:"comment"` // Comment
}

GetCommentReply returns the provided comment.

func DecodeGetCommentReply

func DecodeGetCommentReply(payload []byte) (*GetCommentReply, error)

DecodeGetCommentReply decodes a JSON byte slice into a GetCommentReply.

type GetComments

type GetComments struct {
	Token string `json:"token"` // Proposal ID
}

GetComments retrieve all comments for a given proposal. This call returns the cooked comments; deleted/censored comments are not returned.

func DecodeGetComments

func DecodeGetComments(payload []byte) (*GetComments, error)

DecodeGetComments decodes a JSON byte slice into a GetComments.

type GetCommentsReply

type GetCommentsReply struct {
	Comments []Comment `json:"comments"` // Comments
}

GetCommentsReply returns the provided number of comments.

func DecodeGetCommentsReply

func DecodeGetCommentsReply(payload []byte) (*GetCommentsReply, error)

DecodeGetCommentsReply decodes a JSON byte slice into a GetCommentsReply.

type GetProposalCommentsLikes

type GetProposalCommentsLikes struct {
	Token string `json:"token"` // Censorship token
}

GetProposalCommentsLikes is a command to fetch all vote actions on the comments of a given proposal

func DecodeGetProposalCommentsLikes

func DecodeGetProposalCommentsLikes(payload []byte) (*GetProposalCommentsLikes, error)

DecodeGetProposalCommentsLikes decodes a JSON byte slice into a GetProposalCommentsLikes.

type GetProposalCommentsLikesReply

type GetProposalCommentsLikesReply struct {
	CommentsLikes []LikeComment `json:"commentslikes"`
}

GetProposalCommentsLikesReply is a reply with all vote actions for the comments of a given proposal

func DecodeGetProposalCommentsLikesReply

func DecodeGetProposalCommentsLikesReply(payload []byte) (*GetProposalCommentsLikesReply, error)

DecodeGetProposalCommentsLikesReply decodes a JSON byte slice into a GetProposalCommentsLikesReply.

type Inventory

type Inventory struct{}

Inventory is used to retrieve the fonero plugin inventory.

func DecodeInventory

func DecodeInventory(payload []byte) (*Inventory, error)

DecodeInventory decodes a JSON byte slice into a Inventory.

type InventoryReply

type InventoryReply struct {
	Comments             []Comment            `json:"comments"`             // Comments
	LikeComments         []LikeComment        `json:"likecomments"`         // Like comments
	AuthorizeVotes       []AuthorizeVote      `json:"authorizevotes"`       // Authorize votes
	AuthorizeVoteReplies []AuthorizeVoteReply `json:"authorizevotereplies"` // Authorize vote replies
	StartVoteTuples      []StartVoteTuple     `json:"startvotetuples"`      // Start vote tuples
	CastVotes            []CastVote           `json:"castvotes"`            // Cast votes
}

InventoryReply returns the fonero plugin inventory.

func DecodeInventoryReply

func DecodeInventoryReply(payload []byte) (*InventoryReply, error)

DecodeInventoryReply decodes a JSON byte slice into a inventory.

type LikeComment

type LikeComment struct {
	Token     string `json:"token"`     // Censorship token
	CommentID string `json:"commentid"` // Comment ID
	Action    string `json:"action"`    // Up or downvote (1, -1)
	Signature string `json:"signature"` // Client Signature of Token+CommentID+Action
	PublicKey string `json:"publickey"` // Pubkey used for Signature

	// Only used on disk
	Receipt   string `json:"receipt,omitempty"`   // Signature of Signature
	Timestamp int64  `json:"timestamp,omitempty"` // Received UNIX timestamp
}

LikeComment records an up or down vote from a user on a comment.

func DecodeLikeComment

func DecodeLikeComment(payload []byte) (*LikeComment, error)

DecodeLikeComment decodes a JSON byte slice into a LikeComment.

type LikeCommentReply

type LikeCommentReply struct {
	Total   uint64 `json:"total"`           // Total number of up and down votes
	Result  int64  `json:"result"`          // Current tally of likes, can be negative
	Receipt string `json:"receipt"`         // Server signature of client signature
	Error   string `json:"error,omitempty"` // Error if something wen't wrong during liking a comment
}

LikeCommentReply returns the result of an up or down vote.

func DecodeLikeCommentReply

func DecodeLikeCommentReply(payload []byte) (*LikeCommentReply, error)

DecodeLikeCommentReply decodes a JSON byte slice into a LikeCommentReply.

type LoadVoteResults

type LoadVoteResults struct {
	BestBlock uint64 `json:"bestblock"` // Best block height
}

LoadVoteResults creates a vote results entry in the cache for any proposals that have finsished voting but have not yet been added to the lazy loaded vote results table.

func DecodeLoadVoteResults

func DecodeLoadVoteResults(payload []byte) (*LoadVoteResults, error)

DecodeLoadVoteResults decodes a JSON byte slice into a LoadVoteResults.

type LoadVoteResultsReply

type LoadVoteResultsReply struct{}

LoadVoteResultsReply is the reply to the LoadVoteResults command.

func DecodeLoadVoteResultsReply

func DecodeLoadVoteResultsReply(payload []byte) (*LoadVoteResultsReply, error)

DecodeLoadVoteResultsReply decodes a JSON byte slice into a LoadVoteResults.

type NewComment

type NewComment struct {
	Token     string `json:"token"`     // Censorship token
	ParentID  string `json:"parentid"`  // Parent comment ID
	Comment   string `json:"comment"`   // Comment
	Signature string `json:"signature"` // Signature of Token+ParentID+Comment
	PublicKey string `json:"publickey"` // Pubkey used for Signature
}

NewComment sends a comment from a user to a specific proposal. Note that the user is implied by the session.

func DecodeNewComment

func DecodeNewComment(payload []byte) (*NewComment, error)

DecodeNewComment decodes a JSON byte slice into a NewComment

type NewCommentReply

type NewCommentReply struct {
	CommentID string `json:"commentid"` // Comment ID
	Receipt   string `json:"receipt"`   // Server signature of the client Signature
	Timestamp int64  `json:"timestamp"` // Received UNIX timestamp
}

NewCommentReply returns the metadata generated by fonero plugin for the new comment.

func DecodeNewCommentReply

func DecodeNewCommentReply(payload []byte) (*NewCommentReply, error)

DecodeNewCommentReply decodes a JSON byte slice into a NewCommentReply.

type StartVote

type StartVote struct {
	// fonero plugin only data
	Version uint `json:"version"` // Version of this structure

	PublicKey string `json:"publickey"` // Key used for signature.
	Vote      Vote   `json:"vote"`      // Vote + options
	Signature string `json:"signature"` // Signature of Votehash
}

func DecodeStartVote

func DecodeStartVote(payload []byte) (*StartVote, error)

DecodeVotedecodes a JSON byte slice into a StartVote.

type StartVoteReply

type StartVoteReply struct {
	// fonero plugin only data
	Version uint `json:"version"` // Version of this structure

	// Shared data
	StartBlockHeight string   `json:"startblockheight"` // Block height
	StartBlockHash   string   `json:"startblockhash"`   // Block hash
	EndHeight        string   `json:"endheight"`        // Height of vote end
	EligibleTickets  []string `json:"eligibletickets"`  // Valid voting tickets
}

func DecodeStartVoteReply

func DecodeStartVoteReply(payload []byte) (*StartVoteReply, error)

DecodeVoteReply decodes a JSON byte slice into a StartVoteReply.

type StartVoteTuple

type StartVoteTuple struct {
	StartVote      StartVote      `json:"startvote"`      // Start vote
	StartVoteReply StartVoteReply `json:"startvotereply"` // Start vote reply
}

StartVoteTuple is used to return the StartVote and StartVoteReply for a record. StartVoteReply does not contain any record identifying data so it must be returned with the StartVote in order to know what record it belongs to.

type TokenInventory

type TokenInventory struct {
	BestBlock uint64 `json:"bestblock"` // Best block
}

TokenInventory requests the tokens of all records in the inventory, categorized by stage of the voting process.

func DecodeTokenInventory

func DecodeTokenInventory(payload []byte) (*TokenInventory, error)

DecodeTokenInventory decodes a JSON byte slice into a TokenInventory.

type TokenInventoryReply

type TokenInventoryReply struct {
	Pre       []string `json:"pre"`       // Tokens of records that are pre-vote
	Active    []string `json:"active"`    // Tokens of records with an active voting period
	Approved  []string `json:"approved"`  // Tokens of records that have been approved by a vote
	Rejected  []string `json:"rejected"`  // Tokens of records that have been rejected by a vote
	Abandoned []string `json:"abandoned"` // Tokens of records that have been abandoned
}

TokenInventoryReply is the response to the TokenInventory command and returns the tokens of all records in the inventory. The tokens are categorized by stage of the voting process. Pre and abandoned tokens are sorted by timestamp in decending order. Active, approved, and rejected tokens are sorted by voting period end block height in decending order.

func DecodeTokenInventoryReply

func DecodeTokenInventoryReply(payload []byte) (*TokenInventoryReply, error)

DecodeTokenInventoryReply decodes a JSON byte slice into a inventory.

type Vote

type Vote struct {
	Token            string       `json:"token"`            // Token that identifies vote
	Mask             uint64       `json:"mask"`             // Valid votebits
	Duration         uint32       `json:"duration"`         // Duration in blocks
	QuorumPercentage uint32       `json:"quorumpercentage"` // Percent of eligible votes required for quorum
	PassPercentage   uint32       `json:"passpercentage"`   // Percent of total votes required to pass
	Options          []VoteOption `json:"options"`          // Vote option
}

Vote represents the vote options for vote that is identified by its token.

func DecodeVote

func DecodeVote(payload []byte) (*Vote, error)

DecodeVote decodes a JSON byte slice into a Vote.

type VoteDetails

type VoteDetails struct {
	Token string `json:"token"` // Censorship token
}

VoteDetails is used to retrieve the voting period details for a record.

func DecodeVoteDetails

func DecodeVoteDetails(payload []byte) (*VoteDetails, error)

DecodeVoteDetails decodes a JSON byte slice into a VoteDetails.

type VoteDetailsReply

type VoteDetailsReply struct {
	AuthorizeVote  AuthorizeVote  `json:"authorizevote"`  // Vote authorization
	StartVote      StartVote      `json:"startvote"`      // Vote ballot
	StartVoteReply StartVoteReply `json:"startvotereply"` // Start vote snapshot
}

VoteDetailsReply is the reply to VoteDetails.

func DecodeVoteDetailsReply

func DecodeVoteDetailsReply(payload []byte) (*VoteDetailsReply, error)

DecodeVoteReply decodes a JSON byte slice into a VoteDetailsReply.

type VoteOption

type VoteOption struct {
	Id          string `json:"id"`          // Single unique word identifying vote (e.g. yes)
	Description string `json:"description"` // Longer description of the vote.
	Bits        uint64 `json:"bits"`        // Bits used for this option
}

VoteOption describes a single vote option.

type VoteOptionResult

type VoteOptionResult struct {
	ID          string `json:"id"`          // Single unique word identifying vote (e.g. yes)
	Description string `json:"description"` // Longer description of the vote.
	Bits        uint64 `json:"bits"`        // Bits used for this option
	Votes       uint64 `json:"votes"`       // Number of votes cast for this option
}

VoteOptionResult describes a vote option and the total number of votes that have been cast for this option.

type VoteResults

type VoteResults struct {
	Token string `json:"token"` // Censorship token
}

func DecodeVoteResults

func DecodeVoteResults(payload []byte) (*VoteResults, error)

DecodeVoteResults decodes a JSON byte slice into a VoteResults.

type VoteResultsReply

type VoteResultsReply struct {
	StartVote StartVote  `json:"startvote"` // Original ballot
	CastVotes []CastVote `json:"castvotes"` // All votes
}

func DecodeVoteResultsReply

func DecodeVoteResultsReply(payload []byte) (*VoteResultsReply, error)

DecodeVoteResultsReply decodes a JSON byte slice into a VoteResults.

type VoteSummary

type VoteSummary struct {
	Token string `json:"token"` // Censorship token
}

VoteSummary requests a summary of a proposal vote. This includes certain voting period parameters and a summary of the vote results.

func DecodeVoteSummary

func DecodeVoteSummary(payload []byte) (*VoteSummary, error)

DecodeVoteSummary decodes a JSON byte slice into a VoteSummary.

type VoteSummaryReply

type VoteSummaryReply struct {
	Authorized          bool               `json:"authorized"`          // Vote is authorized
	EndHeight           string             `json:"endheight"`           // End block height
	EligibleTicketCount int                `json:"eligibleticketcount"` // Number of eligible tickets
	QuorumPercentage    uint32             `json:"quorumpercentage"`    // Percent of eligible votes required for quorum
	PassPercentage      uint32             `json:"passpercentage"`      // Percent of total votes required to pass
	Results             []VoteOptionResult `json:"results"`             // Vote results
}

VoteSummaryReply is the reply to the VoteSummary command and returns certain voting period parameters as well as a summary of the vote results.

func DecodeVoteSummaryReply

func DecodeVoteSummaryReply(payload []byte) (*VoteSummaryReply, error)

DecodeVoteSummaryReply decodes a JSON byte slice into a VoteSummaryReply.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL