keeper

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CanChangeTokenMapping uint64                                  = 1 << iota // 1
	CanTurnBridge                                                             // 2
	All                   = CanChangeTokenMapping | CanTurnBridge             // 3
)

A permission is represented by a bit within uint64 (64bits) An address permission is an integer value between 0 and (2^64-1) This design allows a quick and simple permission check for addresses The next permission should be added before All

View Source
const DefaultGasCap uint64 = 25000000

DefaultGasCap defines the gas limit used to run internal evm call

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.

Types

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.Codec,
	storeKey,
	memKey storetypes.StoreKey,
	bankKeeper types.BankKeeper,
	transferKeeper types.TransferKeeper,
	evmKeeper types.EvmKeeper,
	accountKeeper types.AccountKeeper,
	authority string,

) *Keeper

func (Keeper) BlockList added in v1.7.0

func (Keeper) CallEVM added in v0.6.1

func (k Keeper) CallEVM(ctx sdk.Context, to *common.Address, data []byte, value *big.Int, gasLimit uint64) (*core.Message, *evmtypes.EVMResult, error)

CallEVM execute an evm message from native module

func (Keeper) CallModuleCRC21 added in v1.0.0

func (k Keeper) CallModuleCRC21(ctx sdk.Context, contract common.Address, method string, args ...interface{}) ([]byte, error)

CallModuleCRC21 call a method of ModuleCRC21 contract

func (Keeper) ContractByDenom added in v0.6.1

ContractByDenom query contract by denom, returns both external contract and auto deployed contract

func (Keeper) ConvertCoinFromCRC21ToNative added in v1.0.0

func (k Keeper) ConvertCoinFromCRC21ToNative(ctx sdk.Context, contract, receiver common.Address, amount sdkmath.Int) error

ConvertCoinFromCRC21ToNative convert erc20 token to native token

func (Keeper) ConvertCoinFromNativeToCRC21 added in v1.0.0

func (k Keeper) ConvertCoinFromNativeToCRC21(ctx sdk.Context, sender common.Address, coin sdk.Coin, autoDeploy bool) error

ConvertCoinFromNativeToCRC21 convert native token to erc20 token

func (Keeper) ConvertCoinsFromNativeToCRC21 added in v1.0.0

func (k Keeper) ConvertCoinsFromNativeToCRC21(ctx sdk.Context, sender common.Address, coins sdk.Coins, autoDeploy bool) error

ConvertCoinsFromNativeToCRC21 convert native tokens to erc20 tokens

func (Keeper) ConvertVouchersToEvmCoins added in v0.6.1

func (k Keeper) ConvertVouchersToEvmCoins(ctx sdk.Context, from string, coins sdk.Coins) error

func (Keeper) DeleteExternalContractForDenom added in v0.6.1

func (k Keeper) DeleteExternalContractForDenom(ctx sdk.Context, denom string) bool

DeleteExternalContractForDenom delete the external contract mapping for native denom, returns false if mapping not exists.

func (Keeper) DenomByContract added in v0.6.1

DenomByContract query denom by contract

func (Keeper) DeployModuleCRC21 added in v1.0.0

func (k Keeper) DeployModuleCRC21(ctx sdk.Context, denom string) (common.Address, error)

DeployModuleCRC21 deploy an embed crc21 contract

func (Keeper) GetAccount added in v1.0.0

func (k Keeper) GetAccount(ctx sdk.Context, addr sdk.AccAddress) sdk.AccountI

func (Keeper) GetAuthority added in v1.7.0

func (k Keeper) GetAuthority() string

GetAuthority returns the x/cronos module's authority.

func (Keeper) GetAutoContracts added in v0.6.1

func (k Keeper) GetAutoContracts(ctx sdk.Context) (out []types.TokenMapping)

GetAutoContracts returns all auto-deployed contract mappings

func (Keeper) GetBlockList added in v1.7.0

func (k Keeper) GetBlockList(ctx sdk.Context) []byte

func (Keeper) GetContractByDenom added in v0.6.1

func (k Keeper) GetContractByDenom(ctx sdk.Context, denom string) (contract common.Address, found bool)

GetContractByDenom find the corresponding contract for the denom, external contract is taken in preference to auto-deployed one

func (Keeper) GetDenomByContract added in v0.6.1

func (k Keeper) GetDenomByContract(ctx sdk.Context, contract common.Address) (denom string, found bool)

GetDenomByContract find native denom by contract address

func (Keeper) GetEvmParams added in v0.6.1

func (k Keeper) GetEvmParams(ctx sdk.Context) evmTypes.Params

GetEvmParams returns the total set of evm parameters.

func (Keeper) GetExternalContracts added in v0.6.1

func (k Keeper) GetExternalContracts(ctx sdk.Context) (out []types.TokenMapping)

GetExternalContracts returns all external contract mappings

func (Keeper) GetParams added in v0.6.1

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

GetParams returns the total set of cronos parameters.

func (Keeper) GetPermissions added in v1.7.0

func (k Keeper) GetPermissions(ctx sdk.Context, address sdk.AccAddress) uint64

func (Keeper) GetSourceChannelID added in v0.6.1

func (k Keeper) GetSourceChannelID(ctx sdk.Context, ibcVoucherDenom string) (channelID string, err error)

GetSourceChannelID returns the channel id for an ibc voucher The voucher has for format ibc/hash(path)

func (Keeper) HasPermission added in v1.7.0

func (k Keeper) HasPermission(ctx sdk.Context, accounts []sdk.AccAddress, permissionsToCheck uint64) bool

HasPermission check if an account has a specific permission. by default cronos admin has all permissions

func (Keeper) IBCOnAcknowledgementPacketCallback added in v1.7.0

func (k Keeper) IBCOnAcknowledgementPacketCallback(
	ctx sdk.Context,
	packet channeltypes.Packet,
	acknowledgement []byte,
	relayer sdk.AccAddress,
	contractAddress,
	packetSenderAddress string,
	version string,
) error

func (Keeper) IBCOnTimeoutPacketCallback added in v1.7.0

func (k Keeper) IBCOnTimeoutPacketCallback(
	ctx sdk.Context,
	packet channeltypes.Packet,
	relayer sdk.AccAddress,
	contractAddress,
	packetSenderAddress string,
	version string,
) error

func (Keeper) IBCReceivePacketCallback added in v1.7.0

func (k Keeper) IBCReceivePacketCallback(
	ctx sdk.Context,
	packet ibcexported.PacketI,
	ack ibcexported.Acknowledgement,
	contractAddress string,
	version string,
) error

func (Keeper) IBCSendPacketCallback added in v1.7.0

func (k Keeper) IBCSendPacketCallback(
	ctx sdk.Context,
	sourcePort string,
	sourceChannel string,
	timeoutHeight clienttypes.Height,
	timeoutTimestamp uint64,
	packetData []byte,
	contractAddress,
	packetSenderAddress string,
	version string,
) error

func (Keeper) IbcTransferCoins added in v0.6.1

func (k Keeper) IbcTransferCoins(ctx sdk.Context, from, destination string, coins sdk.Coins, channelId string) error

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

func (Keeper) OnRecvVouchers added in v0.6.1

func (k Keeper) OnRecvVouchers(
	ctx sdk.Context,
	tokens sdk.Coins,
	receiver string,
)

OnRecvVouchers try to convert ibc voucher to evm coins, revert the state in case of failure

func (Keeper) Params added in v1.7.0

Params returns parameters of cronos module

func (Keeper) Permissions added in v1.7.0

Permissions returns the permissions of a specific account

func (Keeper) RegisterOrUpdateTokenMapping added in v1.0.0

func (k Keeper) RegisterOrUpdateTokenMapping(ctx sdk.Context, msg *types.MsgUpdateTokenMapping) error

RegisterOrUpdateTokenMapping update the token mapping, register a coin metadata if needed

func (Keeper) ReplayBlock added in v0.6.10

ReplayBlock replay the eth messages in the block to recover the results of false-failed txs.

func (Keeper) SetAutoContractForDenom added in v0.6.1

func (k Keeper) SetAutoContractForDenom(ctx sdk.Context, denom string, address common.Address)

SetAutoContractForDenom set the auto deployed contract for native denom

func (Keeper) SetExternalContractForDenom added in v0.6.1

func (k Keeper) SetExternalContractForDenom(ctx sdk.Context, denom string, address common.Address) error

SetExternalContractForDenom set the external contract for native denom, replace the old one if any existing.

func (Keeper) SetParams added in v0.6.1

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

SetParams sets the total set of cronos parameters.

func (Keeper) SetPermissions added in v1.7.0

func (k Keeper) SetPermissions(ctx sdk.Context, address sdk.AccAddress, permissions uint64)

type LogProcessEvmHook added in v0.6.1

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

LogProcessEvmHook is an evm hook that convert specific contract logs into native module calls

func NewLogProcessEvmHook added in v0.6.1

func NewLogProcessEvmHook(handlers ...types.EvmLogHandler) *LogProcessEvmHook

func (LogProcessEvmHook) PostTxProcessing added in v0.6.1

func (h LogProcessEvmHook) PostTxProcessing(ctx sdk.Context, _ *core.Message, receipt *ethtypes.Receipt) error

PostTxProcessing implements EvmHook interface

type Migrator added in v1.7.0

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

Migrator is a struct for handling in-place store migrations.

func NewMigrator added in v1.7.0

func NewMigrator(keeper Keeper, ss paramstypes.Subspace) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate1to2 added in v1.7.0

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 migrates from version 1 to 2.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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