keeper

package
v0.7.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2025 License: LGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewQueryServer

func NewQueryServer(keeper Keeper) types.QueryServer

NewQueryServer returns an implementation of the QueryServer interface for the provided Keeper.

Types

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.Codec,
	storeKey storetypes.StoreKey,
	bankKeeper types.BankKeeper,
	evmKeeper types.EvmKeeper,
) Keeper

func (Keeper) AcceptAssetsLocked

func (k Keeper) AcceptAssetsLocked(
	ctx sdk.Context,
	events types.AssetsLockedEvents,
) error

AcceptAssetsLocked processes the given AssetsLocked events sequence by minting the corresponding amount of coins for each event and sending them to the recipient address.

Requirements:

  1. The AssetsLocked sequence must not be empty.
  2. The AssetsLocked sequence must be valid (i.e. all events in the slice pass the AssetsLockedEvent.IsValid test AND sequence numbers of events form a sequence strictly increasing by 1).
  3. The sequence number of the first event in the slice must be exactly one greater than the current sequence tip held in the state.

The function returns an error if any of the requirements is not met. Checking the mentioned requirements is crucial to ensure state consistency regardless of the guarantees provided by the upstream code.

If all requirements are met and x/bank interactions are all successful, the current sequence tip in the state is updated to the sequence number of the last event in the slice.

func (Keeper) CreateERC20TokenMapping

func (k Keeper) CreateERC20TokenMapping(
	ctx sdk.Context,
	sourceToken, mezoToken []byte,
) error

CreateERC20TokenMapping creates a new ERC20 token mapping. Requirements: - The source token address must be a valid EVM address and not zero, - The Mezo token address must be a valid EVM address and not zero, - The source token address must not be already mapped, - The maximum number of mappings must not be reached.

func (Keeper) DeleteERC20TokenMapping

func (k Keeper) DeleteERC20TokenMapping(
	ctx sdk.Context,
	sourceToken []byte,
) error

DeleteERC20TokenMapping deletes an ERC20 token mapping. Requirements: - The mapping must exist.

func (*Keeper) EndBlock

func (k *Keeper) EndBlock(ctx context.Context) error

EndBlock is used to run a given set of assertions after processing a block. Each assertion will ensure that the mezo state is in sync with its understanding of the state of the bridge at the time. In case an assertion prove false, the function will panic, leaving time for the node operators to investigate.

func (Keeper) ExportGenesis

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

ExportGenesis returns the module's exported genesis

func (Keeper) GetAssetsLockedSequenceTip

func (k Keeper) GetAssetsLockedSequenceTip(ctx sdk.Context) math.Int

GetAssetsLockedSequenceTip returns the current sequence tip for the AssetsLocked events. The tip denotes the sequence number of the last event processed by the x/bridge module.

func (Keeper) GetBTCBurnt

func (k Keeper) GetBTCBurnt(ctx sdk.Context) math.Int

GetBTCBurnt returns the total amount of a given BTC burnt.

func (Keeper) GetBTCMinted

func (k Keeper) GetBTCMinted(ctx sdk.Context) math.Int

GetBTCMinted return the amount of a given BTC minted.

func (Keeper) GetERC20TokenMapping

func (k Keeper) GetERC20TokenMapping(
	ctx sdk.Context,
	sourceToken []byte,
) (*types.ERC20TokenMapping, bool)

GetERC20TokenMapping returns an ERC20 token mapping by the corresponding source token address. The boolean return value indicates if the mapping was found.

func (Keeper) GetERC20TokensMappings

func (k Keeper) GetERC20TokensMappings(ctx sdk.Context) []*types.ERC20TokenMapping

GetERC20TokensMappings returns all ERC20 token mappings supported by the bridge.

func (Keeper) GetParams

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

GetParams returns the total set of bridge parameters.

func (Keeper) GetSourceBTCToken

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

GetSourceBTCToken returns the BTC token address on the source chain. AssetsLocked events carrying this token address are directly mapped to the Mezo native denomination - BTC.

func (Keeper) IncreaseBTCBurnt

func (k Keeper) IncreaseBTCBurnt(ctx sdk.Context, amount math.Int) error

IncreaseBTCBurnt increments the total amount of BTC burnt.

func (Keeper) IncreaseBTCMinted

func (k Keeper) IncreaseBTCMinted(ctx sdk.Context, amount math.Int) error

IncreaseBTCMinted increase the total amount of BTC minted.

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(
	ctx sdk.Context,
	genState types.GenesisState,
	accountKeeper types.AccountKeeper,
)

InitGenesis initializes the module's state from a provided genesis state.

func (Keeper) Logger

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

func (Keeper) SetParams

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

SetParams sets the bridge module's parameters.

func (Keeper) SetSourceBTCToken

func (k Keeper) SetSourceBTCToken(ctx sdk.Context, sourceBTCToken []byte)

SetSourceBTCToken sets the BTC token address on the source chain.

Jump to

Keyboard shortcuts

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