types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: GPL-3.0 Imports: 4 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

	IntervalToExecute int64 = 86400 // interval in blocks to execute proposal.
)

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.

Variables

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

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

Storage keys.

Functions

func ErrAlreadyConfirmed

func ErrAlreadyConfirmed(id uint64) sdk.Error

When call already executed.

func ErrAlreadyRejected

func ErrAlreadyRejected(id uint64) sdk.Error

When call already rejected.

func ErrCallAlreadyApproved

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

When call already approved by address.

func ErrCallNotApproved

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

When call not approved by address.

func ErrCantParseCallId

func ErrCantParseCallId(sid string) sdk.Error

When cant parse call id.

func ErrEmptyRoute

func ErrEmptyRoute(id uint64) sdk.Error

When msg route is empty (could be empty if we use MsMsg interface).

func ErrEmptyType

func ErrEmptyType(id uint64) sdk.Error

When msg route is empty (could be empty if we use MsMsg interface).

func ErrNoVotes

func ErrNoVotes(id uint64) sdk.Error

When no votes found for call.

func ErrNotFoundUniqueID

func ErrNotFoundUniqueID(uniqueID string) sdk.Error

When call not found by unique id.

func ErrNotUniqueID

func ErrNotUniqueID(uniqueID string) sdk.Error

When unique id already used in past.

func ErrNotValidator

func ErrNotValidator(validator string) sdk.Error

When tx from not validator.

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

When msg route doesnt exist.

func ErrWrongCallId

func ErrWrongCallId(id uint64) sdk.Error

When call with provided id doesnt exist.

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
	Creator sdk.AccAddress `json:"creator"`

	// ID
	MsgID uint64 `json:"msg_id"`

	// Unique ID
	UniqueID string `json:"unique_id"`

	// When call approved to execute
	Approved bool `json:"approved"`

	// Execution failed or executed
	Executed bool `json:"executed"`
	Failed   bool `json:"failed"`

	// If call was rejected
	Rejected bool   `json:"rejected"`
	Error    string `json:"error"`

	// Msg to execute
	Msg core.MsMsg `json:"msg_data"`

	// Msg route
	MsgRoute string `json:"msg_route"`

	// Msg type
	MsgType string `json:"msg_type"`

	// Height when call submitted
	Height int64 `json:"height"`
}

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"`
	Votes Votes `json:"votes"`
}

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