types

package
v0.0.0-...-65a1244 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = 2

	CodeInvalidDeposit sdk.CodeType = 101
	CodeInvalidBond    sdk.CodeType = 102
	CodeInvalidBallot  sdk.CodeType = 103
	CodeInvalidPhase   sdk.CodeType = 104
	CodeInvalidVote    sdk.CodeType = 105
)

Reserve errors 100 ~ 199

View Source
const (
	TokenName = "RegistryCoin"
)

Variables

This section is empty.

Functions

func ErrInvalidBallot

func ErrInvalidBallot(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidBond

func ErrInvalidBond(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidDeposit

func ErrInvalidDeposit(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidPhase

func ErrInvalidPhase(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidVote

func ErrInvalidVote(codespace sdk.CodespaceType, msg string) sdk.Error

func GetAccountDecoder

func GetAccountDecoder(cdc *wire.Codec) auth.AccountDecoder

func RegisterAmino

func RegisterAmino(cdc *amino.Codec)

Types

type Ballot

type Ballot struct {
	Identifier          string
	Details             string
	Owner               sdk.Address
	Challenger          sdk.Address
	Active              bool
	Approve             int64
	Deny                int64
	Bond                int64
	EndApplyBlockStamp  int64
	EndCommitBlockStamp int64
}

func NewBallot

func NewBallot(identifier string, details string, owner sdk.Address, endApplyBlock int64) Ballot

type ChallengeMsg

type ChallengeMsg struct {
	Owner      sdk.Address
	Identifier string
	Bond       sdk.Coin
}

ChallengeMsg is used to challenge a pending or finalized listing

func NewChallengeMsg

func NewChallengeMsg(owner sdk.Address, identifier string, bond sdk.Coin) ChallengeMsg

func (ChallengeMsg) GetSignBytes

func (msg ChallengeMsg) GetSignBytes() []byte

func (ChallengeMsg) GetSigners

func (msg ChallengeMsg) GetSigners() []sdk.Address

func (ChallengeMsg) Type

func (msg ChallengeMsg) Type() string

func (ChallengeMsg) ValidateBasic

func (msg ChallengeMsg) ValidateBasic() sdk.Error

type CommitMsg

type CommitMsg struct {
	Owner      sdk.Address
	Identifier string
	Commitment []byte
}

CommitMsg is used to make a commitment during commit phase on an active challenge to a specific listing identified by Identifier.

func NewCommitMsg

func NewCommitMsg(owner sdk.Address, identifier string, commitment []byte) CommitMsg

func (CommitMsg) GetSignBytes

func (msg CommitMsg) GetSignBytes() []byte

func (CommitMsg) GetSigners

func (msg CommitMsg) GetSigners() []sdk.Address

func (CommitMsg) Type

func (msg CommitMsg) Type() string

func (CommitMsg) ValidateBasic

func (msg CommitMsg) ValidateBasic() sdk.Error

type DeclareCandidacyMsg

type DeclareCandidacyMsg struct {
	Owner      sdk.Address
	Identifier string
	Details    string
	Deposit    sdk.Coin
}

DeclareCandidacyMsg is used to propose a new listing to be added to registry. Identifier is a unique identifier of the listing Deposit is taken and held for entire duration of listing. Awarded to challengers upon successful challenge. Users can add details about candidate to convince voters to approve listing

func GenerateCandidacyMsg

func GenerateCandidacyMsg() DeclareCandidacyMsg

func NewDeclareCandidacyMsg

func NewDeclareCandidacyMsg(owner sdk.Address, identifier string, bond sdk.Coin) DeclareCandidacyMsg

func (DeclareCandidacyMsg) GetSignBytes

func (msg DeclareCandidacyMsg) GetSignBytes() []byte

func (DeclareCandidacyMsg) GetSigners

func (msg DeclareCandidacyMsg) GetSigners() []sdk.Address

func (DeclareCandidacyMsg) Type

func (msg DeclareCandidacyMsg) Type() string

func (DeclareCandidacyMsg) ValidateBasic

func (msg DeclareCandidacyMsg) ValidateBasic() sdk.Error

type GenesisAccount

type GenesisAccount struct {
	Address sdk.Address `json:"address"`
	Coins   sdk.Coins   `json:"coins"`
}

GenesisAccount doesn't need pubkey or sequence

func NewGenesisAccount

func NewGenesisAccount(aa *auth.BaseAccount) *GenesisAccount

func (*GenesisAccount) ToAccount

func (ga *GenesisAccount) ToAccount() (acc *auth.BaseAccount, err error)

convert GenesisAccount to AppAccount

type GenesisState

type GenesisState struct {
	Accounts []*GenesisAccount `json:"accounts"`
}

type Item

type Item struct {
	Value    string // The Value of the item; arbitrary.
	Priority int    // The Priority of the item in the queue.
	// contains filtered or unexported fields
}

Value should be identifier of listing

type Listing

type Listing struct {
	Identifier string
	Votes      int64
}

func NewListing

func NewListing(identifier string, votes int64) Listing

type PriorityQueue

type PriorityQueue []*Item

A PriorityQueue implements heap.Interface and holds Items.

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Peek

func (pq *PriorityQueue) Peek() Item

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

func (*PriorityQueue) Remove

func (pq *PriorityQueue) Remove(Value string) sdk.Error

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

func (*PriorityQueue) Update

func (pq *PriorityQueue) Update(Value string, Priority int) sdk.Error

update modifies the Priority and Value of an Item in the queue.

type RevealMsg

type RevealMsg struct {
	Owner      sdk.Address
	Identifier string
	Vote       bool
	Nonce      []byte
	Bond       sdk.Coin
}

RevealMsg is to reveal vote during reveal phase on active challenge to listing identified by Identifier.

func NewRevealMsg

func NewRevealMsg(owner sdk.Address, identifier string, vote bool, nonce []byte, bond sdk.Coin) RevealMsg

func (RevealMsg) GetSignBytes

func (msg RevealMsg) GetSignBytes() []byte

func (RevealMsg) GetSigners

func (msg RevealMsg) GetSigners() []sdk.Address

func (RevealMsg) Type

func (msg RevealMsg) Type() string

func (RevealMsg) ValidateBasic

func (msg RevealMsg) ValidateBasic() sdk.Error

type Vote

type Vote struct {
	Choice bool
	Power  int64
}

Vote revealed during reveal phase

func NewVote

func NewVote(choice bool, power int64) Vote

Jump to

Keyboard shortcuts

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