model

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrFailedToMarshalNextProposalID

func ErrFailedToMarshalNextProposalID(err error) sdk.Error

ErrFailedToMarshalNextProposalID - error if marshal next proposal id failed

func ErrFailedToMarshalProposal

func ErrFailedToMarshalProposal(err error) sdk.Error

ErrFailedToMarshalProposal - error if marshal proposal failed

func ErrFailedToUnmarshalNextProposalID

func ErrFailedToUnmarshalNextProposalID(err error) sdk.Error

ErrFailedToUnmarshalProposal - error if unmarshal next proposal id failed

func ErrFailedToUnmarshalProposal

func ErrFailedToUnmarshalProposal(err error) sdk.Error

ErrFailedToUnmarshalProposal - error if unmarshal proposal failed

func ErrNextProposalIDNotFound

func ErrNextProposalIDNotFound() sdk.Error

ErrNextProposalIDNotFound - error if next proposal ID is not found in KVStore

func ErrProposalNotFound

func ErrProposalNotFound() sdk.Error

ErrProposalNotFound - error if proposal is not found in KVStore

func GetExpiredProposalKey added in v0.1.1

func GetExpiredProposalKey(proposalID types.ProposalKey) []byte

GetExpiredProposalKey - "expired proposal subStore" + "proposal ID"

func GetOngoingProposalKey added in v0.1.1

func GetOngoingProposalKey(proposalID types.ProposalKey) []byte

GetOngoingProposalKey - "ongoing proposal substore" + "proposal ID"

Types

type ChangeParamProposal

type ChangeParamProposal struct {
	ProposalInfo
	Param  param.Parameter `json:"param"`
	Reason string          `json:"reason"` //nolint:govet
}

ChangeParamProposal - change parameter proposal

func (*ChangeParamProposal) GetProposalInfo

func (p *ChangeParamProposal) GetProposalInfo() ProposalInfo

GetProposalInfo - implements Proposal

func (*ChangeParamProposal) SetProposalInfo

func (p *ChangeParamProposal) SetProposalInfo(info ProposalInfo)

SetProposalInfo - implements Proposal

type ContentCensorshipProposal

type ContentCensorshipProposal struct {
	ProposalInfo
	Permlink types.Permlink `json:"permlink"`
	Reason   string         `json:"reason"` //nolint:govet
}

ContentCensorshipProposal - content censorship proposal

func (*ContentCensorshipProposal) GetProposalInfo

func (p *ContentCensorshipProposal) GetProposalInfo() ProposalInfo

GetProposalInfo - implements Proposal

func (*ContentCensorshipProposal) SetProposalInfo

func (p *ContentCensorshipProposal) SetProposalInfo(info ProposalInfo)

SetProposalInfo - implements Proposal

type NextProposalID

type NextProposalID struct {
	NextProposalID int64 `json:"next_proposal_id"`
}

NextProposalID - store next proposal ID to KVStore

type Proposal

type Proposal interface {
	GetProposalInfo() ProposalInfo
	SetProposalInfo(ProposalInfo)
}

Proposal - there are three proposal types 1) change parameter proposal 2) content censorship proposal 3) protocol upgrade proposal

type ProposalInfo

type ProposalInfo struct {
	Creator       types.AccountKey     `json:"creator"`
	ProposalID    types.ProposalKey    `json:"proposal_id"`
	AgreeVotes    types.Coin           `json:"agree_vote"`
	DisagreeVotes types.Coin           `json:"disagree_vote"`
	Result        types.ProposalResult `json:"result"`
	CreatedAt     int64                `json:"created_at"`
	ExpiredAt     int64                `json:"expired_at"`
	Reason        string               `json:"reason"`
}

ProposalInfo - basic proposal info

type ProposalStorage

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

ProposalStorage - proposal storage

func NewProposalStorage

func NewProposalStorage(key sdk.StoreKey) ProposalStorage

func (ProposalStorage) DeleteExpiredProposal added in v0.1.1

func (ps ProposalStorage) DeleteExpiredProposal(ctx sdk.Context, proposalID types.ProposalKey) sdk.Error

DeleteExpiredProposal - delete proposal from expired proposal KVStore

func (ProposalStorage) DeleteOngoingProposal added in v0.1.1

func (ps ProposalStorage) DeleteOngoingProposal(ctx sdk.Context, proposalID types.ProposalKey) sdk.Error

SetOngoingProposal - delete proposal from ongoing proposal KVStore

func (ProposalStorage) DoesProposalExist

func (ps ProposalStorage) DoesProposalExist(ctx sdk.Context, proposalID types.ProposalKey) bool

DoesProposalExist - check if proposal exists in KVStore or not

func (ProposalStorage) GetExpiredProposal added in v0.1.1

func (ps ProposalStorage) GetExpiredProposal(ctx sdk.Context, proposalID types.ProposalKey) (Proposal, sdk.Error)

GetExpiredProposal - get proposal from expired proposal KVStore

func (ProposalStorage) GetExpiredProposalList added in v0.1.1

func (ps ProposalStorage) GetExpiredProposalList(ctx sdk.Context) ([]Proposal, sdk.Error)

GetExpiredProposalList - get expired proposal list from expired proposal KVStore

func (ProposalStorage) GetNextProposalID

func (ps ProposalStorage) GetNextProposalID(ctx sdk.Context) (*NextProposalID, sdk.Error)

GetNextProposalID - get next proposal ID from KVStore

func (ProposalStorage) GetOngoingProposal added in v0.1.1

func (ps ProposalStorage) GetOngoingProposal(ctx sdk.Context, proposalID types.ProposalKey) (Proposal, sdk.Error)

GetOngoingProposal - get proposal from ongoing proposal KVStore

func (ProposalStorage) GetOngoingProposalList added in v0.1.1

func (ps ProposalStorage) GetOngoingProposalList(ctx sdk.Context) ([]Proposal, sdk.Error)

GetOngoingProposalList - get ongoing proposal list from ongoing proposal KVStore

func (ProposalStorage) InitGenesis

func (ps ProposalStorage) InitGenesis(ctx sdk.Context) sdk.Error

InitGenesis - initialize proposal storage

func (ProposalStorage) SetExpiredProposal added in v0.1.1

func (ps ProposalStorage) SetExpiredProposal(ctx sdk.Context, proposalID types.ProposalKey, proposal Proposal) sdk.Error

SetExpiredProposal - set proposal to expired proposal KVStore

func (ProposalStorage) SetNextProposalID

func (ps ProposalStorage) SetNextProposalID(ctx sdk.Context, nextProposalID *NextProposalID) sdk.Error

SetNextProposalID - set next proposal ID to KVStore

func (ProposalStorage) SetOngoingProposal added in v0.1.1

func (ps ProposalStorage) SetOngoingProposal(ctx sdk.Context, proposalID types.ProposalKey, proposal Proposal) sdk.Error

SetOngoingProposal - set proposal to ongoing proposal KVStore

type ProtocolUpgradeProposal

type ProtocolUpgradeProposal struct {
	ProposalInfo
	Link   string `json:"link"`
	Reason string `json:"reason"` //nolint:govet
}

ProtocolUpgradeProposal - protocol upgrade proposal

func (*ProtocolUpgradeProposal) GetProposalInfo

func (p *ProtocolUpgradeProposal) GetProposalInfo() ProposalInfo

GetProposalInfo - implements Proposal

func (*ProtocolUpgradeProposal) SetProposalInfo

func (p *ProtocolUpgradeProposal) SetProposalInfo(info ProposalInfo)

SetProposalInfo - implements Proposal

Jump to

Keyboard shortcuts

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