protocol

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DefaultCLIHome is the directory for okchaincli
	DefaultCLIHome = os.ExpandEnv("$HOME/.okchaincli")
	// DefaultNodeHome is the directory for okchaind
	DefaultNodeHome = os.ExpandEnv("$HOME/.okchaind")

	// ModuleBasics is in charge of setting up basic, non-dependant module elements,
	// such as codec registration and genesis verification
	ModuleBasics = module.NewBasicManager(
		genaccounts.AppModuleBasic{},
		genutil.AppModuleBasic{},
		auth.AppModuleBasic{},
		bank.AppModuleBasic{},
		staking.AppModuleBasic{},
		mint.AppModuleBasic{},
		distr.AppModuleBasic{},
		gov.NewAppModuleBasic(
			upgradeClient.ProposalHandler, paramsclient.ProposalHandler,
			dexClient.DelistProposalHandler, distr.ProposalHandler,
		),
		params.AppModuleBasic{},
		crisis.AppModuleBasic{},
		slashing.AppModuleBasic{},
		supply.AppModuleBasic{},

		token.AppModuleBasic{},
		dex.AppModuleBasic{},
		order.AppModuleBasic{},
		backend.AppModuleBasic{},
		upgrade.AppModuleBasic{},
		stream.AppModuleBasic{},
		debug.AppModuleBasic{},
	)
)

Functions

func GetEngine

func GetEngine() *appProtocolEngine

GetEngine gets the Singleton application protocol engine

func GetKVStoreKeysMap

func GetKVStoreKeysMap() map[string]*sdk.KVStoreKey

GetKVStoreKeysMap gets the map of all kv store keys

func GetMainStoreKey

func GetMainStoreKey() *sdk.KVStoreKey

GetMainStoreKey gets the main store key

func GetTransientStoreKeysMap

func GetTransientStoreKeysMap() map[string]*sdk.TransientStoreKey

GetTransientStoreKeysMap gets the map of all transient store keys

func MakeCodec

func MakeCodec() *codec.Codec

MakeCodec registers codec from all the modules

func NewAppProtocolEngine

func NewAppProtocolEngine(protocolKeeper proto.ProtocolKeeper) *appProtocolEngine

NewAppProtocolEngine returns a pointer of a new appProtocolEngine object

Types

type MockProtocol

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

MockProtocol is designed for engine test

func (*MockProtocol) CheckStopped

func (*MockProtocol) CheckStopped()

func (*MockProtocol) ExportGenesis

func (*MockProtocol) ExportGenesis(ctx sdk.Context) map[string]json.RawMessage

func (*MockProtocol) GetBackendKeeper

func (*MockProtocol) GetBackendKeeper() backend.Keeper

func (*MockProtocol) GetCodec

func (*MockProtocol) GetCodec() *codec.Codec

func (*MockProtocol) GetCrisisKeeper

func (*MockProtocol) GetCrisisKeeper() crisis.Keeper

func (*MockProtocol) GetDistrKeeper

func (*MockProtocol) GetDistrKeeper() distr.Keeper

func (*MockProtocol) GetKVStoreKeysMap

func (*MockProtocol) GetKVStoreKeysMap() map[string]*sdk.KVStoreKey

func (*MockProtocol) GetParent

func (mp *MockProtocol) GetParent() Parent

GetParent returns the Parent implements

func (*MockProtocol) GetSlashingKeeper

func (*MockProtocol) GetSlashingKeeper() slashing.Keeper

func (*MockProtocol) GetStakingKeeper

func (*MockProtocol) GetStakingKeeper() staking.Keeper

func (*MockProtocol) GetStreamKeeper

func (*MockProtocol) GetStreamKeeper() stream.Keeper

func (*MockProtocol) GetTokenKeeper

func (*MockProtocol) GetTokenKeeper() token.Keeper

func (*MockProtocol) GetTransientStoreKeysMap

func (*MockProtocol) GetTransientStoreKeysMap() map[string]*sdk.TransientStoreKey

func (*MockProtocol) GetVersion

func (mp *MockProtocol) GetVersion() uint64

GetVersion gets version

func (*MockProtocol) Init

func (*MockProtocol) Init()

func (*MockProtocol) LoadContext

func (*MockProtocol) LoadContext()

nolint

func (*MockProtocol) SetLogger

func (mp *MockProtocol) SetLogger(log log.Logger) Protocol

SetLogger sets logger

func (*MockProtocol) SetParent

func (mp *MockProtocol) SetParent(parent Parent) Protocol

SetParent sets Parent and return the Protocol implements

type Parent

type Parent interface {
	DeliverTx(abci.RequestDeliverTx) abci.ResponseDeliverTx
	PushInitChainer(initChainer sdk.InitChainer)
	PushBeginBlocker(beginBlocker sdk.BeginBlocker)
	PushEndBlocker(endBlocker sdk.EndBlocker)
	PushAnteHandler(ah sdk.AnteHandler)
	SetRouter(router sdk.Router, queryRouter sdk.QueryRouter)
}

Parent shows the expected behavior of BaseApp(hooks)

type Protocol

type Protocol interface {
	GetVersion() uint64

	// load base installation for each protocol
	LoadContext()
	Init()
	GetCodec() *codec.Codec

	// gracefully stop okchaind
	CheckStopped()

	// setter
	SetLogger(log log.Logger) Protocol
	SetParent(parent Parent) Protocol

	//getter
	GetParent() Parent

	// get specific keeper
	GetBackendKeeper() backend.Keeper
	GetStreamKeeper() stream.Keeper
	GetCrisisKeeper() crisis.Keeper
	GetStakingKeeper() staking.Keeper
	GetDistrKeeper() distr.Keeper
	GetSlashingKeeper() slashing.Keeper
	GetTokenKeeper() token.Keeper

	// fit cm36
	GetKVStoreKeysMap() map[string]*sdk.KVStoreKey
	GetTransientStoreKeysMap() map[string]*sdk.TransientStoreKey
	ExportGenesis(ctx sdk.Context) map[string]json.RawMessage
}

Protocol shows the expected behavior for any protocol version

func NewMockProtocol

func NewMockProtocol(version uint64) Protocol

NewMockProtocol creates a new instance of MockProtocol

type ProtocolV0

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

ProtocolV0 is the struct of the original protocol of okchain

func NewProtocolV0

func NewProtocolV0(
	parent Parent, version uint64, log log.Logger, invCheckPeriod uint, pk proto.ProtocolKeeper,
) *ProtocolV0

NewProtocolV0 creates a new instance of NewProtocolV0

func (*ProtocolV0) BeginBlocker

BeginBlocker set function to BaseApp as a hook

func (*ProtocolV0) CheckStopped

func (p *ProtocolV0) CheckStopped()

CheckStopped gives a quick check whether okchain needs stopped

func (*ProtocolV0) EndBlocker

EndBlocker sets function to BaseApp as a hook

func (*ProtocolV0) ExportGenesis

func (p *ProtocolV0) ExportGenesis(ctx sdk.Context) map[string]json.RawMessage

ExportGenesis exports the genesis state for whole protocol

func (*ProtocolV0) GetBackendKeeper

func (p *ProtocolV0) GetBackendKeeper() backend.Keeper

GetBackendKeeper gets backend keeper

func (*ProtocolV0) GetCodec

func (p *ProtocolV0) GetCodec() *codec.Codec

GetCodec gets tx codec

func (*ProtocolV0) GetCrisisKeeper

func (p *ProtocolV0) GetCrisisKeeper() crisis.Keeper

GetCrisisKeeper gets crisis keeper

func (*ProtocolV0) GetDistrKeeper

func (p *ProtocolV0) GetDistrKeeper() distr.Keeper

GetDistrKeeper gets distr keeper

func (*ProtocolV0) GetKVStoreKeysMap

func (p *ProtocolV0) GetKVStoreKeysMap() map[string]*sdk.KVStoreKey

GetKVStoreKeysMap gets the map of kv store keys

func (*ProtocolV0) GetParent

func (p *ProtocolV0) GetParent() Parent

GetParent gets parent implement

func (*ProtocolV0) GetSlashingKeeper

func (p *ProtocolV0) GetSlashingKeeper() slashing.Keeper

GetSlashingKeeper gets slashing keeper

func (*ProtocolV0) GetStakingKeeper

func (p *ProtocolV0) GetStakingKeeper() staking.Keeper

GetStakingKeeper gets staking keeper

func (*ProtocolV0) GetStreamKeeper

func (p *ProtocolV0) GetStreamKeeper() stream.Keeper

GetStreamKeeper gets stream keeper

func (*ProtocolV0) GetTokenKeeper

func (p *ProtocolV0) GetTokenKeeper() token.Keeper

GetTokenKeeper gets token keeper

func (*ProtocolV0) GetTransientStoreKeysMap

func (p *ProtocolV0) GetTransientStoreKeysMap() map[string]*sdk.TransientStoreKey

GetTransientStoreKeysMap gets the map of transient store keys

func (*ProtocolV0) GetVersion

func (p *ProtocolV0) GetVersion() uint64

GetVersion gets the version of this protocol

func (*ProtocolV0) Init

func (p *ProtocolV0) Init()

nolint

func (*ProtocolV0) InitChainer

InitChainer initializes application state at genesis as a hook

func (*ProtocolV0) LoadContext

func (p *ProtocolV0) LoadContext()

LoadContext updates the context for the app after the upgrade of protocol

func (*ProtocolV0) SetLogger

func (p *ProtocolV0) SetLogger(log log.Logger) Protocol

SetLogger sets logger

func (*ProtocolV0) SetParent

func (p *ProtocolV0) SetParent(parent Parent) Protocol

SetParent sets parent implement

func (*ProtocolV0) Stop

func (p *ProtocolV0) Stop()

Stop makes okchain exit gracefully

Jump to

Keyboard shortcuts

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