governance

package
v0.1.0-rc.7 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2018 License: GPL-3.0 Imports: 19 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"
	TypeTxDeployLibEniPropose = governanceModuleName + "/propose/deploy_libeni"
	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

View Source
var OTAInstance = eni.NewOTAInstance()

Functions

func CancelDownload

func CancelDownload(p *Proposal, bpanic bool)

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 DestroyLibEni

func DestroyLibEni(p *Proposal)

func DownloadLibEni

func DownloadLibEni(p *Proposal)

func ErrApprovedProposal

func ErrApprovedProposal() error

func ErrExceedsExpiration

func ErrExceedsExpiration() error

func ErrInsufficientBalance

func ErrInsufficientBalance() error

func ErrInsufficientParameters

func ErrInsufficientParameters() error

func ErrInvalidExpireBlockHeight

func ErrInvalidExpireBlockHeight() error

func ErrInvalidExpireTimestamp

func ErrInvalidExpireTimestamp() error

func ErrInvalidFileurlJson

func ErrInvalidFileurlJson() error

func ErrInvalidMd5Json

func ErrInvalidMd5Json() error

func ErrInvalidNewLib

func ErrInvalidNewLib() error

func ErrInvalidParameter

func ErrInvalidParameter() error

func ErrInvalidValidator

func ErrInvalidValidator() error

func ErrMissingSignature

func ErrMissingSignature() error

func ErrNoFileurl

func ErrNoFileurl() error

func ErrNoMd5

func ErrNoMd5() error

func ErrOngoingLibFound

func ErrOngoingLibFound() error

func ErrRejectedProposal

func ErrRejectedProposal() error

func ErrRepeatedVote

func ErrRepeatedVote() error

func HasUndeployedProposal

func HasUndeployedProposal(name string) bool

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, expireTimestamp, expireBlockHeight *int64) sdk.Tx

func NewTxDeployLibEniPropose

func NewTxDeployLibEniPropose(proposer *common.Address, name, version, fileurl, md5, reason string, expireTimestamp, expireBlockHeight *int64) sdk.Tx

func NewTxTransferFundPropose

func NewTxTransferFundPropose(proposer *common.Address, fromAddr *common.Address, toAddr *common.Address, amount string, reason string, expireTimestamp, expireBlockHeight *int64) sdk.Tx

func NewTxVote

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

func RegisterLibEni

func RegisterLibEni(p *Proposal)

func ResetDeliverSqlTx

func ResetDeliverSqlTx()

func SaveProposal

func SaveProposal(pp *Proposal)

func SaveVote

func SaveVote(vote *Vote)

func SetDeliverSqlTx

func SetDeliverSqlTx(tx *sql.Tx)

func UpdateDeployLibEniStatus

func UpdateDeployLibEniStatus(pid, status string)

func UpdateProposalResult

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

func UpdateVote

func UpdateVote(vote *Vote)

Types

type Proposal

type Proposal struct {
	Id                string
	Type              string
	Proposer          *common.Address
	BlockHeight       int64
	ExpireTimestamp   int64
	ExpireBlockHeight int64
	CreatedAt         string
	Result            string
	ResultMsg         string
	ResultBlockHeight int64
	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 int64, name, value, reason string, expireTimestamp, expireBlockHeight int64) *Proposal

func NewDeployLibEniProposal

func NewDeployLibEniProposal(id string, proposer *common.Address, blockHeight int64, name, version, fileurl, md5, reason, status string, expireTimestamp, expireBlockHeight int64) *Proposal

func NewTransferFundProposal

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

func QueryProposals

func QueryProposals() (proposals []*Proposal)

func (*Proposal) Hash

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

type ProposalReactor

type ProposalReactor struct {
	ProposalId  string
	BlockHeight int64
	Result      string
}

func (ProposalReactor) React

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

type SqlTxWrapper

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

func (*SqlTxWrapper) Commit

func (wrapper *SqlTxWrapper) Commit()

func (*SqlTxWrapper) Rollback

func (wrapper *SqlTxWrapper) Rollback()

type TxChangeParamPropose

type TxChangeParamPropose struct {
	Proposer          *common.Address `json:"proposer"`
	Name              string          `json:"name"`
	Value             string          `json:"value"`
	Reason            string          `json:"reason"`
	ExpireTimestamp   *int64          `json:"expire_timestamp"`
	ExpireBlockHeight *int64          `json:"expire_block_height"`
}

func (TxChangeParamPropose) ValidateBasic

func (tx TxChangeParamPropose) ValidateBasic() error

func (TxChangeParamPropose) Wrap

func (tx TxChangeParamPropose) Wrap() sdk.Tx

type TxDeployLibEniPropose

type TxDeployLibEniPropose struct {
	Proposer          *common.Address `json:"proposer"`
	Name              string          `json:"name"`
	Version           string          `json:"version"`
	Fileurl           string          `json:"fileurl"`
	Md5               string          `json:"md5"`
	Reason            string          `json:"reason"`
	ExpireTimestamp   *int64          `json:"expire_timestamp"`
	ExpireBlockHeight *int64          `json:"expire_block_height"`
}

func (TxDeployLibEniPropose) ValidateBasic

func (tx TxDeployLibEniPropose) ValidateBasic() error

func (TxDeployLibEniPropose) Wrap

func (tx TxDeployLibEniPropose) 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"`
	ExpireTimestamp   *int64          `json:"expire_timestamp"`
	ExpireBlockHeight *int64          `json:"expire_block_height"`
}

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 int64
	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 int64, 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