governance

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2018 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const (
	ByteTxTransferFundPropose   = 0xA1
	ByteTxChangeParamPropose    = 0xA2
	ByteTxDeployLibEniPropose   = 0xA3
	ByteTxRetireProgramPropose  = 0xA4
	ByteTxUpgradeProgramPropose = 0xA5
	ByteTxVote                  = 0xA6
	TypeTxTransferFundPropose   = governanceModuleName + "/propose/transfer_fund"
	TypeTxChangeParamPropose    = governanceModuleName + "/propose/change_param"
	TypeTxDeployLibEniPropose   = governanceModuleName + "/propose/deploy_libeni"
	TypeTxRetireProgramPropose  = governanceModuleName + "/propose/retire_program"
	TypeTxUpgradeProgramPropose = governanceModuleName + "/propose/upgrade_program"
	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 RETIRE_PROGRAM_PROPOSAL = "retire_program"
View Source
const TRANSFER_FUND_PROPOSAL = "transfer_fund"
View Source
const UPGRADE_PROGRAM_PROPOSAL = "upgrade_program"

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 DownloadProgramCmd

func DownloadProgramCmd(p *Proposal) error

DownloadProgramCmd download new program version

func ErrApprovedProposal

func ErrApprovedProposal() error

func ErrExceedsExpiration

func ErrExceedsExpiration() error

func ErrExpirationTooClose

func ErrExpirationTooClose() 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 ErrOngoingRetiringFound

func ErrOngoingRetiringFound() 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 KillProgramCmd

func KillProgramCmd(p *Proposal) error

KilProgramCmd kill the process from internal

func Name

func Name() string

Name is the name of the modules.

func NewTxChangeParamPropose

func NewTxChangeParamPropose(name string, value string, reason string, expireTimestamp, expireBlockHeight *int64) sdk.Tx

func NewTxDeployLibEniPropose

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

func NewTxRetireProgramPropose

func NewTxRetireProgramPropose(preservedValidators, reason string, expireBlockHeight *int64) sdk.Tx

func NewTxTransferFundPropose

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

func NewTxUpgradeProgramPropose

func NewTxUpgradeProgramPropose(name, version, fileurl, md5, reason string, expireBlockHeight *int64) sdk.Tx

func NewTxVote

func NewTxVote(pid string, 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)

func UpdateRetireProgramStatus

func UpdateRetireProgramStatus(pid, status string)

func UpdateVote

func UpdateVote(vote *Vote)

func UpgradeProgramCmd

func UpgradeProgramCmd(p *Proposal) error

UpgradeProgramCmd upgrade new program version

Types

type Proposal

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

func GetPendingProposals

func GetPendingProposals() (proposals []*Proposal)

func GetProposalById

func GetProposalById(pid string) *Proposal

func GetRetiringProposal

func GetRetiringProposal(version string) *Proposal

func GetUpgradingProposal

func GetUpgradingProposal(version string) *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 NewRetireProgramProposal

func NewRetireProgramProposal(id string, proposer *common.Address, blockHeight int64, retiredVersion, preservedValidators, reason string, 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 NewUpgradeProgramProposal

func NewUpgradeProgramProposal(id string, proposer *common.Address, blockHeight int64, retiredVersion, name, version, fileurl, md5, reason string, 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 {
	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 {
	Name              string `json:"name"`
	Version           string `json:"version"`
	FileUrl           string `json:"file_url"`
	Md5               string `json:"md5"`
	Reason            string `json:"reason"`
	ExpireTimestamp   *int64 `json:"deploy_timestamp"`
	ExpireBlockHeight *int64 `json:"deploy_block_height"`
}

func (TxDeployLibEniPropose) ValidateBasic

func (tx TxDeployLibEniPropose) ValidateBasic() error

func (TxDeployLibEniPropose) Wrap

func (tx TxDeployLibEniPropose) Wrap() sdk.Tx

type TxRetireProgramPropose

type TxRetireProgramPropose struct {
	PreservedValidators string `json:"preserved_validators"`
	Reason              string `json:"reason"`
	ExpireBlockHeight   *int64 `json:"retired_block_height"`
}

func (TxRetireProgramPropose) ValidateBasic

func (tx TxRetireProgramPropose) ValidateBasic() error

func (TxRetireProgramPropose) Wrap

func (tx TxRetireProgramPropose) Wrap() sdk.Tx

type TxTransferFundPropose

type TxTransferFundPropose struct {
	From              *common.Address `json:"transfer_from"`
	To                *common.Address `json:"transfer_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 TxUpgradeProgramPropose

type TxUpgradeProgramPropose struct {
	Name              string `json:"name"`
	Version           string `json:"version"`
	FileUrl           string `json:"file_url"`
	Md5               string `json:"md5"`
	Reason            string `json:"reason"`
	ExpireBlockHeight *int64 `json:"upgrade_block_height"`
}

func (TxUpgradeProgramPropose) ValidateBasic

func (tx TxUpgradeProgramPropose) ValidateBasic() error

func (TxUpgradeProgramPropose) Wrap

func (tx TxUpgradeProgramPropose) Wrap() sdk.Tx

type TxVote

type TxVote struct {
	ProposalId string `json:"proposal_id"`
	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
}

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