governance

package
v0.1.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2018 License: GPL-3.0 Imports: 18 Imported by: 9

Documentation

Overview

nolint

Index

Constants

View Source
const (
	ByteTxTransferFundPropose = 0xA1
	ByteTxChangeParamPropose  = 0xA2
	ByteTxDeployLibEniPropose = 0xA3
	ByteTxVote                = 0xA4
	TypeTxTransferFundPropose = governanceModuleName + "/propose/transfer_fund"
	TypeTxChangeParamPropose  = governanceModuleName + "/propose/change_param"
	TypeTxVote                = governanceModuleName + "/vote"
)

register the tx type with its validation logic make sure to use the name of the handler as the prefix in the tx type, so it gets routed properly

View Source
const CHANGE_PARAM_PROPOSAL = "change_param"
View Source
const DEPLOY_LIBENI_PROPOSAL = "deploy_libeni"
View Source
const TRANSFER_FUND_PROPOSAL = "transfer_fund"

Variables

This section is empty.

Functions

func CheckProposal

func CheckProposal(pid string, voter *common.Address) string

func CheckTx

func CheckTx(ctx types.Context, store state.SimpleDB,
	tx sdk.Tx) (res sdk.CheckResult, err error)

func DeliverTx

func DeliverTx(ctx types.Context, store state.SimpleDB,
	tx sdk.Tx, hash []byte) (res sdk.DeliverResult, err error)

DeliverTx executes the tx if valid

func ErrApprovedProposal

func ErrApprovedProposal() error

func ErrInsufficientBalance

func ErrInsufficientBalance() error

func ErrInvalidParameter

func ErrInvalidParameter() error

func ErrInvalidValidator

func ErrInvalidValidator() error

func ErrMissingSignature

func ErrMissingSignature() error

func ErrRejectedProposal

func ErrRejectedProposal() error

func ErrRepeatedVote

func ErrRepeatedVote() error

func InitState

func InitState(module, key, value string, store state.SimpleDB) error

func Name

func Name() string

Name is the name of the modules.

func NewTxChangeParamPropose

func NewTxChangeParamPropose(proposer *common.Address, name string, value string, reason string, expire uint64) sdk.Tx

func NewTxTransferFundPropose

func NewTxTransferFundPropose(proposer *common.Address, fromAddr *common.Address, toAddr *common.Address, amount string, reason string, expire uint64) sdk.Tx

func NewTxVote

func NewTxVote(pid string, voter common.Address, answer string) sdk.Tx

func SaveProposal

func SaveProposal(pp *Proposal)

func SaveVote

func SaveVote(vote *Vote)

func UpdateProposalResult

func UpdateProposalResult(pid, result, msg string, blockHeight uint64, resultAt string)

Types

type Proposal

type Proposal struct {
	Id                string
	Type              string
	Proposer          *common.Address
	BlockHeight       uint64
	ExpireBlockHeight uint64
	CreatedAt         string
	Result            string
	ResultMsg         string
	ResultBlockHeight uint64
	ResultAt          string
	Detail            map[string]interface{}
}

func GetPendingProposals

func GetPendingProposals() (proposals []*Proposal)

func GetProposalById

func GetProposalById(pid string) *Proposal

func GetProposals

func GetProposals() (proposals []*Proposal)

func NewChangeParamProposal

func NewChangeParamProposal(id string, proposer *common.Address, blockHeight uint64, name, value, reason string, expireBlockHeight uint64) *Proposal

func NewTransferFundProposal

func NewTransferFundProposal(id string, proposer *common.Address, blockHeight uint64, from *common.Address, to *common.Address, amount string, reason string, expireBlockHeight uint64) *Proposal

func (*Proposal) Hash

func (p *Proposal) Hash() []byte

type ProposalReactor

type ProposalReactor struct {
	ProposalId  string
	BlockHeight uint64
	Result      string
}

func (ProposalReactor) React

func (pr ProposalReactor) React(result, msg string)

type TxChangeParamPropose

type TxChangeParamPropose struct {
	Proposer *common.Address `json:"proposer"`
	Name     string          `json:"name"`
	Value    string          `json:"value"`
	Reason   string          `json:"reason"`
	Expire   uint64          `json:"expire"`
}

func (TxChangeParamPropose) ValidateBasic

func (tx TxChangeParamPropose) ValidateBasic() error

func (TxChangeParamPropose) Wrap

func (tx TxChangeParamPropose) Wrap() sdk.Tx

type TxTransferFundPropose

type TxTransferFundPropose struct {
	Proposer *common.Address `json:"proposer"`
	From     *common.Address `json:"from"`
	To       *common.Address `json:"to"`
	Amount   string          `json:"amount"`
	Reason   string          `json:"reason"`
	Expire   uint64          `json:"expire"`
}

func (TxTransferFundPropose) ValidateBasic

func (tx TxTransferFundPropose) ValidateBasic() error

func (TxTransferFundPropose) Wrap

func (tx TxTransferFundPropose) Wrap() sdk.Tx

type TxVote

type TxVote struct {
	ProposalId string         `json:"proposal_id"`
	Voter      common.Address `json:"voter"`
	Answer     string         `json:"answer"`
}

func (TxVote) ValidateBasic

func (tx TxVote) ValidateBasic() error

func (TxVote) Wrap

func (tx TxVote) Wrap() sdk.Tx

type Vote

type Vote struct {
	ProposalId  string
	Voter       common.Address
	BlockHeight uint64
	Answer      string
	CreatedAt   string
}

func GetVoteByPidAndVoter

func GetVoteByPidAndVoter(pid string, voter string) *Vote

func GetVotesByPid

func GetVotesByPid(pid string) (votes []*Vote)

func NewVote

func NewVote(proposalId string, voter common.Address, blockHeight uint64, answer string) *Vote

func (*Vote) Hash

func (v *Vote) Hash() []byte

Jump to

Keyboard shortcuts

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