common

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2021 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Overview

Package common provides common modules, constants and functions for the application.

Index

Constants

View Source
const (
	MicroCTKDenom = "uctk"
	MicroUnit     = int64(1e6)

	Update1Height = 348000
	// TODO: set to update height
	Update2Height = 1423600
)
View Source
const (
	BlocksPerMinute = uint64(12)
	BlocksPerHour   = BlocksPerMinute * 60
	BlocksPerDay    = BlocksPerHour * 24
	BlocksPerWeek   = BlocksPerDay * 7
	BlocksPerMonth  = BlocksPerDay * 30
	BlocksPerYear   = BlocksPerDay * 365

	BlocksPerEpoch = BlocksPerWeek

	SecondsPerBlock = uint64(5)
)
View Source
const (
	// Bech32MainPrefix is the common prefix of all prefixes.
	Bech32MainPrefix = "certik"

	// Bech32PrefixAccAddr is the prefix of account addresses.
	Bech32PrefixAccAddr = Bech32MainPrefix
	// Bech32PrefixAccPub is the prefix of account public keys.
	Bech32PrefixAccPub = Bech32MainPrefix + sdk.PrefixPublic
	// Bech32PrefixValAddr is the prefix of validator operator addresses.
	Bech32PrefixValAddr = Bech32MainPrefix + sdk.PrefixValidator + sdk.PrefixOperator
	// Bech32PrefixValPub is the prefix of validator operator public keys.
	Bech32PrefixValPub = Bech32MainPrefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic
	// Bech32PrefixConsAddr is the prefix of consensus node addresses.
	Bech32PrefixConsAddr = Bech32MainPrefix + sdk.PrefixValidator + sdk.PrefixConsensus
	// Bech32PrefixConsPub is the prefix of consensus node public keys.
	Bech32PrefixConsPub = Bech32MainPrefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic
)

Variables

This section is empty.

Functions

func DivideCoins

func DivideCoins(coins sdk.Coins, dividend int64) sdk.Coins

DivideCoins divides the coins with certain number, discarding any remainders.

func GetCoinPercentage

func GetCoinPercentage(coins sdk.Coins, percentage int64) sdk.Coins

GetCoinPercentage returns a certain percentage of coins. NOTE: The amount of coins returned will always be floored.

Types

type AppModuleBasic

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

AppModuleBasic defines common app module basics object.

func NewAppModuleBasic

func NewAppModuleBasic(
	moduleName string,
	regCodec func(cdc *codec.Codec),
	modCdc *codec.Codec,
	defaultGenesisState interface{},
	validateGenesis func(data json.RawMessage) error,
	storeKey string,
	registerRoutes func(cliCtx context.CLIContext, r *mux.Router),
	getQueryCmd func(storeKey string, cdc *codec.Codec) *cobra.Command,
	getTxCmd func(cdc *codec.Codec) *cobra.Command,
) AppModuleBasic

NewAppModuleBasic create a new common AppModuleBasic object.

func (AppModuleBasic) DefaultGenesis

func (amb AppModuleBasic) DefaultGenesis() json.RawMessage

DefaultGenesis returns the default genesis state.

func (AppModuleBasic) GetQueryCmd

func (amb AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command

GetQueryCmd gets the root query command of this module.

func (AppModuleBasic) GetTxCmd

func (amb AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command

GetTxCmd gets the root tx command of this module.

func (AppModuleBasic) Name

func (amb AppModuleBasic) Name() string

Name returns the module name.

func (AppModuleBasic) RegisterCodec

func (amb AppModuleBasic) RegisterCodec(cdc *codec.Codec)

RegisterCodec registers module codec.

func (AppModuleBasic) RegisterRESTRoutes

func (amb AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)

RegisterRESTRoutes registers REST routes for the module.

func (AppModuleBasic) ValidateGenesis

func (amb AppModuleBasic) ValidateGenesis(bz json.RawMessage) error

ValidateGenesis validates the module's genesis.

Jump to

Keyboard shortcuts

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