model

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrDelegationNotFound

func ErrDelegationNotFound() sdk.Error

func ErrFailedToMarshalDelegation

func ErrFailedToMarshalDelegation(err error) sdk.Error

func ErrFailedToMarshalReferenceList

func ErrFailedToMarshalReferenceList(err error) sdk.Error

func ErrFailedToMarshalVote

func ErrFailedToMarshalVote(err error) sdk.Error

func ErrFailedToMarshalVoter

func ErrFailedToMarshalVoter(err error) sdk.Error

marshal error

func ErrFailedToUnmarshalDelegation

func ErrFailedToUnmarshalDelegation(err error) sdk.Error

func ErrFailedToUnmarshalReferenceList

func ErrFailedToUnmarshalReferenceList(err error) sdk.Error

func ErrFailedToUnmarshalVote

func ErrFailedToUnmarshalVote(err error) sdk.Error

func ErrFailedToUnmarshalVoter

func ErrFailedToUnmarshalVoter(err error) sdk.Error

unmarshal error

func ErrReferenceListNotFound

func ErrReferenceListNotFound() sdk.Error

func ErrVoteNotFound

func ErrVoteNotFound() sdk.Error

func ErrVoterNotFound

func ErrVoterNotFound() sdk.Error

not found error

func GetDelegationKey

func GetDelegationKey(me types.AccountKey, myDelegator types.AccountKey) []byte

"delegation substore" + "me(voter)" + "my delegator"

func GetVoteKey

func GetVoteKey(proposalID types.ProposalKey, voter types.AccountKey) []byte

"vote substore" + "proposalID" + "voter"

func GetVoterKey

func GetVoterKey(me types.AccountKey) []byte

Types

type Delegation

type Delegation struct {
	Delegator types.AccountKey `json:"delegator"`
	Amount    types.Coin       `json:"amount"`
}

type ReferenceList

type ReferenceList struct {
	AllValidators []types.AccountKey `json:"all_validators"`
}

type Vote

type Vote struct {
	Voter       types.AccountKey `json:"voter"`
	VotingPower types.Coin       `json:"voting_power"`
	Result      bool             `json:"result"`
}

type VoteStorage

type VoteStorage struct {
	// contains filtered or unexported fields
}

func NewVoteStorage

func NewVoteStorage(key sdk.StoreKey) VoteStorage

func (VoteStorage) DeleteDelegation

func (vs VoteStorage) DeleteDelegation(ctx sdk.Context, voter types.AccountKey, delegator types.AccountKey) sdk.Error

func (VoteStorage) DeleteVote

func (vs VoteStorage) DeleteVote(ctx sdk.Context, proposalID types.ProposalKey, voter types.AccountKey) sdk.Error

func (VoteStorage) DeleteVoter

func (vs VoteStorage) DeleteVoter(ctx sdk.Context, username types.AccountKey) sdk.Error

func (VoteStorage) DoesDelegationExist

func (vs VoteStorage) DoesDelegationExist(ctx sdk.Context, voter types.AccountKey, delegator types.AccountKey) bool

func (VoteStorage) DoesVoteExist

func (vs VoteStorage) DoesVoteExist(ctx sdk.Context, proposalID types.ProposalKey, voter types.AccountKey) bool

func (VoteStorage) DoesVoterExist

func (vs VoteStorage) DoesVoterExist(ctx sdk.Context, accKey types.AccountKey) bool

func (VoteStorage) GetAllDelegators

func (vs VoteStorage) GetAllDelegators(ctx sdk.Context, voterName types.AccountKey) ([]types.AccountKey, sdk.Error)

func (VoteStorage) GetAllVotes

func (vs VoteStorage) GetAllVotes(ctx sdk.Context, proposalID types.ProposalKey) ([]Vote, sdk.Error)

func (VoteStorage) GetDelegation

func (vs VoteStorage) GetDelegation(ctx sdk.Context, voter types.AccountKey, delegator types.AccountKey) (*Delegation, sdk.Error)

func (VoteStorage) GetReferenceList

func (vs VoteStorage) GetReferenceList(ctx sdk.Context) (*ReferenceList, sdk.Error)

func (VoteStorage) GetVote

func (vs VoteStorage) GetVote(ctx sdk.Context, proposalID types.ProposalKey, voter types.AccountKey) (*Vote, sdk.Error)

func (VoteStorage) GetVoter

func (vs VoteStorage) GetVoter(ctx sdk.Context, accKey types.AccountKey) (*Voter, sdk.Error)

func (VoteStorage) InitGenesis

func (vs VoteStorage) InitGenesis(ctx sdk.Context) sdk.Error

func (VoteStorage) SetDelegation

func (vs VoteStorage) SetDelegation(ctx sdk.Context, voter types.AccountKey, delegator types.AccountKey, delegation *Delegation) sdk.Error

func (VoteStorage) SetReferenceList

func (vs VoteStorage) SetReferenceList(ctx sdk.Context, lst *ReferenceList) sdk.Error

func (VoteStorage) SetVote

func (vs VoteStorage) SetVote(ctx sdk.Context, proposalID types.ProposalKey, voter types.AccountKey, vote *Vote) sdk.Error

func (VoteStorage) SetVoter

func (vs VoteStorage) SetVoter(ctx sdk.Context, accKey types.AccountKey, voter *Voter) sdk.Error

type Voter

type Voter struct {
	Username       types.AccountKey `json:"username"`
	Deposit        types.Coin       `json:"deposit"`
	DelegatedPower types.Coin       `json:"delegated_power"`
}

Jump to

Keyboard shortcuts

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