types

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Create call message type.

Implement error codes and messages.

Vote types (addresses slice).

Index

Constants

View Source
const (
	ModuleName = "multisig"

	RouterKey         = ModuleName
	DefaultCodespace  = ModuleName
	DefaultParamspace = ModuleName
)

Default constants.

View Source
const (
	CodeErrRouteDoesntExist = 101
	CodeErrWrongCallId      = 102
	CodeErrEmptyRoute       = 103
	CodeErrEmptyType        = 104
	CodeErrOnlyMs           = 105

	CodeErrAlreadyApproved   = 201
	CodeErrAlreadyConfirmed  = 202
	CodeErrAlreadyRerejected = 203
	CodeErrNotApproved       = 204

	CodeErrNoVotes = 301

	CodeNotValidator     = 401
	CodeNotUniqueID      = 402
	CodeNotFoundUniqueID = 403
)

Error codes.

View Source
const (
	DefIntervalToExecute = 86400 // interval in blocks to execute proposal.
	MinIntervalToExecute = 10
)

Default parameters.

Variables

View Source
var (
	KeyDelimiter = []byte(":")

	LastCallId   = []byte("lastCallId")
	LastExCallId = []byte("lastExCallId")
	PrefixQueue  = []byte("callsQueue")
)

Storage keys.

View Source
var (
	KeyIntervalToExecute = []byte("IntervalToExecute")
)

Keys to store parameters.

Functions

func ErrAlreadyConfirmed

func ErrAlreadyConfirmed(id uint64) sdk.Error

CallID already executed

func ErrAlreadyRejected

func ErrAlreadyRejected(id uint64) sdk.Error

CallID already rejected

func ErrCallAlreadyApproved

func ErrCallAlreadyApproved(id uint64, address string) sdk.Error

CallID already approved by address

func ErrCallNotApproved

func ErrCallNotApproved(id uint64, address string) sdk.Error

CallID not approved by address

func ErrEmptyRoute

func ErrEmptyRoute(id uint64) sdk.Error

Msg.Route is empty

func ErrEmptyType

func ErrEmptyType(id uint64) sdk.Error

Msg.Type is empty (could be empty if we use MsMsg interface)

func ErrNoVotes

func ErrNoVotes(id uint64) sdk.Error

CallID has no votes

func ErrNotFoundUniqueID

func ErrNotFoundUniqueID(uniqueID string) sdk.Error

Call by uniqueID not found

func ErrNotUniqueID

func ErrNotUniqueID(uniqueID string) sdk.Error

UniqueID already used in past

func ErrNotValidator

func ErrNotValidator(validator string) sdk.Error

TX received from not validator (POA module)

func ErrOnlyMultisig

func ErrOnlyMultisig(codeSpase sdk.CodespaceType, moduleName string) sdk.Error

Only multisig calls supported for module.

func ErrRouteDoesntExist

func ErrRouteDoesntExist(route string) sdk.Error

Msg.Route not found in router

func ErrWrongCallId

func ErrWrongCallId(id uint64) sdk.Error

CallID not found in store / CallID > (NextCallID - 1)

func GetCallByIdKey

func GetCallByIdKey(id uint64) []byte

Get a key to store call by id.

func GetKeyVotesById

func GetKeyVotesById(id uint64) []byte

Get a key to store votes for call by id.

func GetPrefixQueue

func GetPrefixQueue(height int64) []byte

Get queue prefix based on height.

func GetQueueKey

func GetQueueKey(id uint64, height int64) []byte

Get a queue key for store call.

func GetUniqueID

func GetUniqueID(uniqueID string) []byte

Get a key to store unique id.

Types

type Call

type Call struct {
	Creator  sdk.AccAddress `json:"creator" swaggertype:"string" format:"bech32" example:"wallet13jyjuz3kkdvqw8u4qfkwd94emdl3vx394kn07h"`
	MsgID    uint64         `json:"msg_id" example:"0"`           // Call ID
	UniqueID string         `json:"unique_id" example:"issue1"`   // Call uniqueID
	Approved bool           `json:"approved"`                     // Call is approved to execute
	Executed bool           `json:"executed"`                     // Call was executed
	Failed   bool           `json:"failed"`                       // Call failed to execute
	Rejected bool           `json:"rejected"`                     // Call was rejected
	Error    string         `json:"error"`                        // Call failed reason
	Msg      core.MsMsg     `json:"msg_data"`                     // Message to execute
	MsgRoute string         `json:"msg_route" example:"oracle"`   // Message route
	MsgType  string         `json:"msg_type" example:"add_asset"` // Message type
	Height   int64          `json:"height" example:"1"`           // BlockHeight when call was submitted
}

Call that will be executed itself, contains msg instances, that executing via router and handler.

func NewCall

func NewCall(id uint64, uniqueID string, msg core.MsMsg, height int64, creator sdk.AccAddress) (Call, sdk.Error)

Create new call instance.

func (Call) String

func (c Call) String() string

Convert call to string representation.

type CallReq

type CallReq struct {
	CallId uint64 `json:"call_id"`
}

Request to get call by call id.

type CallResp

type CallResp struct {
	Call  Call  `json:"call"`                             // Call info
	Votes Votes `json:"votes" swaggertype:"array,string"` // Accounts address array
}

Type to get a call as response with votes.

func (CallResp) String

func (c CallResp) String() string

Call response to string.

type CallsResp

type CallsResp []CallResp

Slice of call responses (in case of multiplay calls to response).

func (CallsResp) String

func (calls CallsResp) String() string

Call responses to string.

type GenesisState

type GenesisState struct {
	Parameters Params `json:"parameters"`
}

Genesis state parameters contains genesis data.

type LastIdRes

type LastIdRes struct {
	LastId uint64 `json:"last_id"`
}

Last id query response.

func (LastIdRes) String

func (q LastIdRes) String() string

Last id response to string.

type Params

type Params struct {
	IntervalToExecute int64 `json:"interval_to_execute"`
}

Describing parameters for multisig module.

func DefaultParams

func DefaultParams() Params

func NewParams

func NewParams(intervalToExecute int64) Params

Create new instance to store parameters.

func (*Params) Equal

func (p *Params) Equal(p2 Params) bool

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

func (Params) String

func (p Params) String() string

func (Params) Validate

func (p Params) Validate() error

type UniqueReq

type UniqueReq struct {
	UniqueId string `json:"unique_id"`
}

Request to get call by unique id.

type Votes

type Votes []types.AccAddress

Votes type is addresses array

Jump to

Keyboard shortcuts

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