keeper

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ModuleBasics is a mock module basic manager for testing
	ModuleBasics = module.NewBasicManager(
		auth.AppModuleBasic{},
		genutil.AppModuleBasic{},
		bank.AppModuleBasic{},
		capability.AppModuleBasic{},
		staking.AppModuleBasic{},
		mint.AppModuleBasic{},
		distribution.AppModuleBasic{},
		gov.NewAppModuleBasic(paramsclient.ProposalHandler),
		params.AppModuleBasic{},
		crisis.AppModuleBasic{},
		slashing.AppModuleBasic{},
		upgrade.AppModuleBasic{},
		evidence.AppModuleBasic{},
		vesting.AppModuleBasic{},
	)

	// TestingStakeParams is a set of staking params for testing
	TestingStakeParams = stakingtypes.Params{
		UnbondingTime:     100,
		MaxValidators:     10,
		MaxEntries:        10,
		HistoricalEntries: 10000,
		BondDenom:         "stake",
	}
)

Functions

func ExportGenesis

func ExportGenesis(ctx sdk.Context, k Keeper) types.GenesisState

ExportGenesis exports all the state needed to restart the chain from the current state of the chain

func InitGenesis

func InitGenesis(ctx sdk.Context, k Keeper, data types.GenesisState)

InitGenesis starts a chain from a genesis state

func MakeTestCodec

func MakeTestCodec() *codec.LegacyAmino

TODO: Remove this from althea-chain and cosmos-gravity-bridge as well MakeTestCodec creates a legacy amino codec for testing

func MakeTestMarshaler

func MakeTestMarshaler() *codec.ProtoCodec

MakeTestMarshaler creates a proto codec for use in testing

Types

type Keeper

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

func NewKeeper

func NewKeeper(cdc codec.BinaryCodec, storeKey sdk.StoreKey, paramSpace paramstypes.Subspace) Keeper

func (Keeper) GetChainLocked

func (k Keeper) GetChainLocked(ctx sdk.Context) bool

TODO: Doc all these methods

func (Keeper) GetLockExemptAddresses

func (k Keeper) GetLockExemptAddresses(ctx sdk.Context) []string

func (Keeper) GetLockExemptAddressesSet

func (k Keeper) GetLockExemptAddressesSet(ctx sdk.Context) map[string]struct{}

func (Keeper) GetLockedMessageTypes

func (k Keeper) GetLockedMessageTypes(ctx sdk.Context) []string

func (Keeper) GetLockedMessageTypesSet

func (k Keeper) GetLockedMessageTypesSet(ctx sdk.Context) map[string]struct{}

func (Keeper) GetLockedTokenDenoms

func (k Keeper) GetLockedTokenDenoms(ctx sdk.Context) []string

func (Keeper) GetLockedTokenDenomsSet

func (k Keeper) GetLockedTokenDenomsSet(ctx sdk.Context) map[string]struct{}

func (Keeper) GetParamsIfSet

func (k Keeper) GetParamsIfSet(ctx sdk.Context) (params types.Params, err error)

GetParamsIfSet will return the current params, but will return an error if the chain is still initializing. By error checking this function is safe to use in handling genesis transactions.

func (Keeper) SetChainLocked

func (k Keeper) SetChainLocked(ctx sdk.Context, locked bool)

func (Keeper) SetLockExemptAddresses

func (k Keeper) SetLockExemptAddresses(ctx sdk.Context, lockExempt []string)

TODO: It would be nice to just store the pseudo-set instead of the string array so that we get better efficiency on each read (happens each transaction in antehandler) however we would need to make a custom param change proposal handler to construct the set upon governance proposal before storage in keeper

func (Keeper) SetLockedMessageTypes

func (k Keeper) SetLockedMessageTypes(ctx sdk.Context, lockedMessageTypes []string)

func (Keeper) SetLockedTokenDenoms

func (k Keeper) SetLockedTokenDenoms(ctx sdk.Context, lockedTokenDenoms []string)

type TestInput

type TestInput struct {
	ParamsKeeper paramskeeper.Keeper
	LockupKeeper Keeper
	Context      sdk.Context
	Codec        codec.Codec
	LegacyAmino  *codec.LegacyAmino
}

TestInput stores the various keepers required to test lockup

func CreateTestEnv

func CreateTestEnv(t *testing.T) TestInput

CreateTestEnv creates the keeper testing environment for lockup

Jump to

Keyboard shortcuts

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