keeper

package
v0.7.1-rc0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SendToAccountEventName  = "__CronosSendToAccount"
	SendToEthereumEventName = "__CronosSendToEthereum"
	SendToIbcEventName      = "__CronosSendToIbc"
	SendCroToIbcEventName   = "__CronosSendCroToIbc"
)
View Source
const DefaultGasCap uint64 = 25000000

DefaultGasCap defines the gas limit used to run internal evm call

Variables

View Source
var (
	// SendToAccountEvent represent the signature of
	// `event __CronosSendToAccount(address recipient, uint256 amount)`
	SendToAccountEvent abi.Event

	// SendToEthereumEvent represent the signature of
	// `event __CronosSendToEthereum(address recipient, uint256 amount, uint256 bridge_fee)`
	SendToEthereumEvent abi.Event

	// SendToIbcEvent represent the signature of
	// `event __CronosSendToIbc(string recipient, uint256 amount)`
	SendToIbcEvent abi.Event

	// SendCroToIbcEvent represent the signature of
	// `event __CronosSendCroToIbc(string recipient, uint256 amount)`
	SendCroToIbcEvent abi.Event
)

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 sdk.StoreKey,
	paramSpace paramtypes.Subspace,
	bankKeeper types.BankKeeper,
	transferKeeper types.TransferKeeper,
	gravityKeeper types.GravityKeeper,
	evmKeeper types.EvmKeeper,
	accountKeeper types.AccountKeeper,

) *Keeper

func (Keeper) AfterBatchExecutedEvent added in v0.7.0

func (k Keeper) AfterBatchExecutedEvent(ctx sdk.Context, event gravitytypes.BatchExecutedEvent)

func (Keeper) AfterContractCallExecutedEvent added in v0.7.0

func (k Keeper) AfterContractCallExecutedEvent(ctx sdk.Context, event gravitytypes.ContractCallExecutedEvent)

TODO Implements GravityHooks interface

func (Keeper) AfterERC20DeployedEvent added in v0.7.0

func (k Keeper) AfterERC20DeployedEvent(ctx sdk.Context, event gravitytypes.ERC20DeployedEvent)

func (Keeper) AfterRecvTransfer added in v0.6.1

func (k Keeper) AfterRecvTransfer(
	ctx sdk.Context,
	destPort, destChannel string,
	token sdk.Coin,
	receiver string,
	isSource bool)

func (Keeper) AfterRefundTransfer added in v0.6.1

func (k Keeper) AfterRefundTransfer(
	ctx sdk.Context,
	sourcePort, sourceChannel string,
	token sdk.Coin,
	sender string,
	isSource bool)

func (Keeper) AfterSendToCosmosEvent added in v0.7.0

func (k Keeper) AfterSendToCosmosEvent(ctx sdk.Context, event gravitytypes.SendToCosmosEvent)

func (Keeper) AfterSendTransfer added in v0.6.1

func (k Keeper) AfterSendTransfer(
	ctx sdk.Context,
	sourcePort, sourceChannel string,
	token sdk.Coin,
	sender sdk.AccAddress,
	receiver string,
	isSource bool)

func (Keeper) AfterSignerSetExecutedEvent added in v0.7.0

func (k Keeper) AfterSignerSetExecutedEvent(ctx sdk.Context, event gravitytypes.SignerSetTxExecutedEvent)

func (Keeper) CallEVM added in v0.6.1

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

CallEVM execute an evm message from native module

func (Keeper) CallModuleCRC20 added in v0.6.1

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

CallModuleCRC20 call a method of ModuleCRC20 contract

func (Keeper) ContractByDenom added in v0.6.1

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

func (Keeper) ConvertCoinFromCRC20ToNative added in v0.6.1

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

ConvertCoinFromCRC20ToNative convert erc20 token to native token

func (Keeper) ConvertCoinFromNativeToCRC20 added in v0.6.1

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

ConvertCoinFromNativeToCRC20 convert native token to erc20 token

func (Keeper) ConvertCoinsFromNativeToCRC20 added in v0.6.1

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

ConvertCoinsFromNativeToCRC20 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) DeployModuleCRC20 added in v0.6.1

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

DeployModuleCRC20 deploy an embed erc20 contract

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) 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) 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) IbcTransferCoins added in v0.6.1

func (k Keeper) IbcTransferCoins(ctx sdk.Context, from, destination string, coins sdk.Coins) 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)

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)

SetParams sets the total set of cronos parameters.

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, from common.Address, to *common.Address, receipt *ethtypes.Receipt) error

PostTxProcessing implements EvmHook interface

type SendCroToIbcHandler added in v0.6.1

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

SendCroToIbcHandler handles `__CronosSendCroToIbc` log

func NewSendCroToIbcHandler added in v0.6.1

func NewSendCroToIbcHandler(bankKeeper types.BankKeeper, cronosKeeper Keeper) *SendCroToIbcHandler

func (SendCroToIbcHandler) EventID added in v0.6.1

func (h SendCroToIbcHandler) EventID() common.Hash

func (SendCroToIbcHandler) Handle added in v0.6.1

func (h SendCroToIbcHandler) Handle(ctx sdk.Context, contract common.Address, data []byte) error

type SendToAccountHandler added in v0.6.1

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

SendToAccountHandler handles `__CronosSendToAccount` log

func NewSendToAccountHandler added in v0.6.1

func NewSendToAccountHandler(bankKeeper types.BankKeeper, cronosKeeper Keeper) *SendToAccountHandler

func (SendToAccountHandler) EventID added in v0.6.1

func (h SendToAccountHandler) EventID() common.Hash

func (SendToAccountHandler) Handle added in v0.6.1

func (h SendToAccountHandler) Handle(ctx sdk.Context, contract common.Address, data []byte) error

type SendToEthereumHandler added in v0.6.1

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

SendToEthereumHandler handles `__CronosSendToEthereum` log

func NewSendToEthereumHandler added in v0.6.1

func NewSendToEthereumHandler(gravitySrv gravitytypes.MsgServer, cronosKeeper Keeper) *SendToEthereumHandler

func (SendToEthereumHandler) EventID added in v0.6.1

func (h SendToEthereumHandler) EventID() common.Hash

func (SendToEthereumHandler) Handle added in v0.6.1

func (h SendToEthereumHandler) Handle(ctx sdk.Context, contract common.Address, data []byte) error

Handle `__CronosSendToEthereum` log only if gravity is activated.

type SendToIbcHandler added in v0.6.1

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

SendToIbcHandler handles `__CronosSendToIbc` log

func NewSendToIbcHandler added in v0.6.1

func NewSendToIbcHandler(bankKeeper types.BankKeeper, cronosKeeper Keeper) *SendToIbcHandler

func (SendToIbcHandler) EventID added in v0.6.1

func (h SendToIbcHandler) EventID() common.Hash

func (SendToIbcHandler) Handle added in v0.6.1

func (h SendToIbcHandler) Handle(ctx sdk.Context, contract common.Address, data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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