types

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// module name
	ModuleName = "global"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName
)
View Source
const (
	// Default epoch length based on seconds
	DefaultEpochLength int64 = 60

	// Default lower bound of block time diff
	DefaultBlkTimeDiffLower int64 = 2

	// Default upper bound of block time diff
	DefaultBlkTimeDiffUpper int64 = 15

	// Default number of blocks to confirm a block is safe
	DefaultConfirmationCount uint64 = 5
)

global params default values

View Source
const (
	QueryLatestBlock    = "latestBlock"
	QuerySecureBlockNum = "secureBlockNum"
	QueryEpoch          = "epoch"
	QueryParameters     = "parameters"
)
View Source
const RouterKey = ModuleName // this was defined in your key.go file
View Source
const (
	TypeMsgSyncBlock = "sync_block"
)

Variables

View Source
var (
	LatestBlockKey = []byte{0x01} // Key for lastest block

	EpochKeyPrefix = []byte{0x21} // Key prefix for epoch
	LatestEpochKey = []byte{0x22} // Key for latest epoch
)
View Source
var (
	KeyEpochLength       = []byte("EpochLength")
	KeyBlkTimeDiffLower  = []byte("KeyBlkTimeDiffLower")
	KeyBlkTimeDiffUpper  = []byte("KeyBlkTimeDiffUpper")
	KeyConfirmationCount = []byte("KeyConfirmationCount")
)

nolint - Keys for parameter access

View Source
var ModuleCdc = codec.New()

Functions

func GetEpochKey

func GetEpochKey(epochId sdk.Int) []byte

get epoch key from epochId

func GetLatestEpochKey

func GetLatestEpochKey() []byte

get latest epoch key

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the Amino codec

Types

type Block

type Block struct {
	Number uint64 `json:"number"`
}

func NewBlock

func NewBlock(number uint64) Block

func (Block) String

func (b Block) String() string

implement fmt.Stringer

type Epoch

type Epoch struct {
	Id        sdk.Int `json:"id"`
	Timestamp int64   `json:"timestamp"`
	TotalFee  sdk.Int `json:"totalFee"`
}

func NewEpoch

func NewEpoch(id sdk.Int, timestamp int64) Epoch

func (Epoch) String

func (e Epoch) String() string

implement fmt.Stringer

type MsgSyncBlock

type MsgSyncBlock struct {
	BlockNumber uint64         `json:"blockNumber"`
	Sender      sdk.AccAddress `json:"sender"`
}

MsgSyncBlock defines a SyncBlock message

func NewMsgSyncBlock

func NewMsgSyncBlock(blockNumber uint64, sender sdk.AccAddress) MsgSyncBlock

NewMsgSyncBlock is a constructor function for MsgSyncBlock

func (MsgSyncBlock) GetSignBytes

func (msg MsgSyncBlock) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgSyncBlock) GetSigners

func (msg MsgSyncBlock) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgSyncBlock) Route

func (msg MsgSyncBlock) Route() string

Route should return the name of the module

func (MsgSyncBlock) Type

func (msg MsgSyncBlock) Type() string

Type should return the action

func (MsgSyncBlock) ValidateBasic

func (msg MsgSyncBlock) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type Params

type Params struct {
	EpochLength       int64  `json:"epochLength" yaml:"epochLength"`             // epoch length based on seconds
	BlkTimeDiffLower  int64  `json:"blkTimeDiffLower" yaml:"blkTimeDiffLower"`   // The lower bound of block time diff
	BlkTimeDiffUpper  int64  `json:"blkTimeDiffUpper" yaml:"blkTimeDiffUpper"`   // The upper bound of block time diff
	ConfirmationCount uint64 `json:"confirmationCount" yaml:"confirmationCount"` // Number of blocks to confirm a block is safe
}

Params defines the high level settings for global

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func MustUnmarshalParams

func MustUnmarshalParams(cdc *codec.Codec, value []byte) Params

unmarshal the current global params value from store key or panic

func NewParams

func NewParams(epochLength, blkTimeDiffLower, blkTimeDiffUpper int64, confirmationCount uint64) Params

NewParams creates a new Params instance

func UnmarshalParams

func UnmarshalParams(cdc *codec.Codec, value []byte) (params Params, err error)

unmarshal the current global params value from store key

func (Params) Equal

func (p Params) Equal(p2 Params) bool

Equal returns a boolean determining if two Param types are identical.

func (*Params) ParamSetPairs

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

Implements params.ParamSet

func (Params) String

func (p Params) String() string

String returns a human readable string representation of the parameters.

func (Params) Validate

func (p Params) Validate() error

validate a set of params

type QueryEpochParams

type QueryEpochParams struct {
	EpochId int64
}

func NewQueryEpochParams

func NewQueryEpochParams(epochId int64) QueryEpochParams

Jump to

Keyboard shortcuts

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