keeper

package
v0.0.0-...-b120c92 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMoveProposalHandler

func NewMoveProposalHandler(k Keeper) govtypes.Handler

NewMoveProposalHandler creates a new governance Handler for move proposals

Types

type GoApi

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

func NewApi

func NewApi(k Keeper, ctx sdk.Context) GoApi

func (GoApi) AmountToShare

func (api GoApi) AmountToShare(valBz []byte, amount uint64) (uint64, error)

AmountToShare convert amount to share

func (GoApi) GetBlockInfo

func (api GoApi) GetBlockInfo() (uint64, uint64)

GetBlockInfo return block info (height and timestamp)

func (GoApi) ShareToAmount

func (api GoApi) ShareToAmount(valBz []byte, share uint64) (uint64, error)

ShareToAmount convert share to amount

func (GoApi) UnbondTimestamp

func (api GoApi) UnbondTimestamp() uint64

UnbondTimestamp return staking unbond time

type Keeper

type Keeper struct {
	StakingKeeper types.StakingKeeper
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.Codec,
	storeKey sdk.StoreKey,
	paramSpace paramtypes.Subspace,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	distrKeeper types.DistributionKeeper,
	stakingKeeper types.StakingKeeper,
	moveConfig moveconfig.MoveConfig,
) Keeper

func (Keeper) AmountToShare

func (k Keeper) AmountToShare(ctx sdk.Context, valAddr sdk.ValAddress, amount uint64) (uint64, error)

AmountToShare convert amount to share in the ratio of a validator's share/token

func (Keeper) ApplyStakingDelta

func (k Keeper) ApplyStakingDelta(
	ctx sdk.Context,
	valAddr sdk.ValAddress,
	delta uint64,
	sign bool,
) error

ApplyStakingDelta increase staking amount if the delta is positive if else, decrease staking amount

func (Keeper) ApplyStorageDelta

func (k Keeper) ApplyStorageDelta(
	ctx sdk.Context,
	addr sdk.AccAddress,
	delta uint64,
	isNeg bool,
) error

Apply changeset size-delta to storage and charge fee

func (Keeper) DecodeModuleBytes

func (k Keeper) DecodeModuleBytes(
	moduleBytes []byte,
) ([]byte, error)

DecodeModuleBytes decode raw module bytes into `MoveModule` json string

func (Keeper) DecodeMoveResource

func (k Keeper) DecodeMoveResource(
	ctx sdk.Context,
	structTag vmtypes.StructTag,
	resourceBytes []byte,
) ([]byte, error)

DecodeMoveResource decode raw move resource bytes into `MoveResource` json string

func (Keeper) DecodeScriptBytes

func (k Keeper) DecodeScriptBytes(
	scriptBytes []byte,
) ([]byte, error)

DecodeScriptBytes decode raw script bytes into `MoveFunction` json string

func (Keeper) DelegateToValidator

func (k Keeper) DelegateToValidator(ctx sdk.Context, valAddr sdk.ValAddress, amount sdk.Int) (sdk.Dec, error)

DelegateToValidator withdraw staking coins from the move module account and send the coins to a delegator module account for a validator and consequentially delegate the deposited coins to a validator.

func (Keeper) DenomToStructTag

func (k Keeper) DenomToStructTag(ctx sdk.Context, denom string) (vmtypes.StructTag, error)

DenomToStructTag convert denom to struct tag

func (Keeper) ExecuteEntryFunction

func (k Keeper) ExecuteEntryFunction(
	ctx sdk.Context,
	sender sdk.AccAddress,
	moduleOwner sdk.AccAddress,
	moduleName string,
	functionName string,
	typeArgs []string,
	args [][]byte,
) error

func (Keeper) ExecuteScript

func (k Keeper) ExecuteScript(
	ctx sdk.Context,
	sender sdk.AccAddress,
	byteCodes []byte,
	typeArgs []string,
	args [][]byte,
) error

func (Keeper) GetDelegatorModuleAddress

func (k Keeper) GetDelegatorModuleAddress(val sdk.ValAddress) sdk.AccAddress

GetDelegatorModuleAddress return a unique delegator module address for a validator

func (Keeper) GetDelegatorModuleName

func (k Keeper) GetDelegatorModuleName(val sdk.ValAddress) string

GetDelegatorModuleName return a unique delegator module name for a validator

func (Keeper) GetModule

func (k Keeper) GetModule(
	ctx sdk.Context,
	addr sdk.AccAddress,
	moduleName string,
) (types.Module, error)

GetModule return Module of the given account address and name

func (Keeper) GetMoveAccount

func (k Keeper) GetMoveAccount(ctx sdk.Context) authtypes.ModuleAccountI

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) types.Params

GetParams returns the total set of wasm parameters.

func (Keeper) GetResource

func (k Keeper) GetResource(
	ctx sdk.Context,
	addr sdk.AccAddress,
	structTag vmtypes.StructTag,
) (types.Resource, error)

GetResource return Resource of the given account address and struct tag

func (Keeper) GetStorageAccount

func (k Keeper) GetStorageAccount(ctx sdk.Context) authtypes.ModuleAccountI

func (Keeper) GetStorageFee

func (k Keeper) GetStorageFee(
	ctx sdk.Context,
	addr sdk.AccAddress,
) (types.StorageFee, error)

GetStorageFee return storage fee object of an address

func (Keeper) GetStructTagFromDenomHash

func (k Keeper) GetStructTagFromDenomHash(ctx sdk.Context, denomHash []byte) (vmtypes.StructTag, error)

GetStructTagFromDenomHash return stored struct tag with denom hash as key

func (Keeper) GetTableEntry

func (k Keeper) GetTableEntry(
	ctx sdk.Context,
	tableAddr sdk.AccAddress,
	key []byte,
) (types.TableEntry, error)

GetTableEntry return table entry

func (Keeper) GetTableMeta

func (k Keeper) GetTableMeta(
	ctx sdk.Context,
	tableAddr sdk.AccAddress,
) (types.TableMeta, error)

GetTableMeta return table entry

func (Keeper) HasDenomTrace

func (k Keeper) HasDenomTrace(ctx sdk.Context, structTag vmtypes.StructTag) bool

HasDenomTrace check wether the struct tag stored or not

func (Keeper) Initialize

func (k Keeper) Initialize(
	ctx sdk.Context,
	moduleBundle vmtypes.ModuleBundle,
) error

func (Keeper) InitializeCoin

func (k Keeper) InitializeCoin(
	ctx sdk.Context,
	denom string,
) error

func (Keeper) InitializeStaking

func (k Keeper) InitializeStaking(
	ctx sdk.Context,
) error

func (Keeper) InstantUnbondFromValidator

func (k Keeper) InstantUnbondFromValidator(ctx sdk.Context, valAddr sdk.ValAddress, amount sdk.Int) (sdk.Int, error)

InstantUnbondFromValidator unbond coins without unbonding period and send the withdrawn coins to the move module account

func (Keeper) IterateDenomTrace

func (k Keeper) IterateDenomTrace(ctx sdk.Context, cb func(types.DenomTrace))

IterateDenomTrace iterate VMStore kv store for genesis export

func (Keeper) IterateStorageFee

func (k Keeper) IterateStorageFee(
	ctx sdk.Context,
	cb func(types.StorageFee),
) error

IterateStorageFee iterate storage fee store

func (Keeper) IterateVMStore

func (k Keeper) IterateVMStore(ctx sdk.Context, cb func(*types.Module, *types.Resource, *types.TableEntry, *types.TableMeta))

IterateVMStore iterate VMStore store for genesis export

func (Keeper) PublishModuleBundle

func (k Keeper) PublishModuleBundle(
	ctx sdk.Context,
	sender sdk.AccAddress,
	moduleBundles vmtypes.ModuleBundle,
) error

func (Keeper) QueryEntryFunction

func (k Keeper) QueryEntryFunction(
	ctx sdk.Context,
	moduleOwner sdk.AccAddress,
	moduleName string,
	functionName string,
	typeArgs []string,
	args [][]byte,
) ([]byte, error)

func (Keeper) SetModule

func (k Keeper) SetModule(
	ctx sdk.Context,
	addr sdk.AccAddress,
	moduleName string,
	moduleBytes []byte,
) error

SetModule store Module bytes This function should be used only when InitGenesis

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, ps types.Params)

SetParams set the given params to store

func (Keeper) SetResource

func (k Keeper) SetResource(
	ctx sdk.Context,
	addr sdk.AccAddress,
	structTag vmtypes.StructTag,
	resourceBytes []byte,
) error

SetResource store Resource bytes This function should be used only when InitGenesis

func (Keeper) SetStorageFee

func (k Keeper) SetStorageFee(
	ctx sdk.Context,
	addr sdk.AccAddress,
	storageFee types.StorageFee,
) error

SetStorageFee store storage fee of an address

func (Keeper) SetTableEntry

func (k Keeper) SetTableEntry(
	ctx sdk.Context,
	tableAddr sdk.AccAddress,
	key []byte,
	value []byte,
)

SetTableEntry store table entry data

func (Keeper) SetTableMeta

func (k Keeper) SetTableMeta(
	ctx sdk.Context,
	tableAddr sdk.AccAddress,
	metaBytes []byte,
)

SetTableMeta store table meta data

func (Keeper) ShareToAmount

func (k Keeper) ShareToAmount(ctx sdk.Context, valAddr sdk.ValAddress, share uint64) (uint64, error)

ShareToAmount convert share to amount in the ratio of a validator's token/share

func (Keeper) StoreDenomTrace

func (k Keeper) StoreDenomTrace(ctx sdk.Context, structTag vmtypes.StructTag) error

StoreDenomTrace store struct tag with denom hash as key

func (Keeper) StructTagToDenom

func (k Keeper) StructTagToDenom(ctx sdk.Context, structTag vmtypes.StructTag) (string, error)

StructTagToDenom convert struct tag to denom

func (Keeper) WithdrawRewards

func (k Keeper) WithdrawRewards(ctx sdk.Context, valAddr sdk.ValAddress) (sdk.Coins, error)

WithdrawRewards withdraw rewards from a validator and send the withdrawn staking rewards to the move module account

type MsgServer

type MsgServer struct {
	Keeper
}

func NewMsgServerImpl

func NewMsgServerImpl(k Keeper) MsgServer

NewMsgServerImpl return MsgServer instance

func (MsgServer) ConvertMoveCoin

func (MsgServer) ConvertNativeCoin

func (MsgServer) ExecuteEntryFunction

ExecuteEntryFunction implements entry function execution feature

func (MsgServer) ExecuteScript

func (ms MsgServer) ExecuteScript(context context.Context, req *types.MsgExecuteScript) (*types.MsgExecuteScriptResponse, error)

ExecuteScript implements script execution

func (MsgServer) PublishModuleBundle

PublishModuleBundle implements publishing module to move vm

type ProposalHandler

type ProposalHandler struct {
	Keeper
}

func NewProposalHandler

func NewProposalHandler(k Keeper) ProposalHandler

NewProposalHandler return ProposalHandler instance

func (ProposalHandler) HandlePublishStdModuleProposal

func (ph ProposalHandler) HandlePublishStdModuleProposal(ctx sdk.Context, p types.PublishStdModuleProposal) error

type Querier

type Querier struct {
	Keeper
}

func NewQuerier

func NewQuerier(k Keeper) Querier

NewQuerier return new Querier instance

func (Querier) EntryFunction

func (Querier) Module

func (Querier) Modules

func (Querier) Resource

func (Querier) Resources

func (Querier) ScriptABI

Jump to

Keyboard shortcuts

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