withdraw

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package withdraw provides tools to automatically create EVM withdrawals for any transfers into user accounts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindInterfaces

func BindInterfaces() []depinject.Config

BindInterfaces returns a list of depinject.BindInterface that bind the x/bank Keeper interfaces to either this BankWrapper or the default x/bank keeper.

Note that the `gov` and `protocolpool` modules would also require this if/when used. Other SDK modules don't call transfer methods so they don't need this.

func DIInvoke

func DIInvoke(bankWrapper *BankWrapper, evmEngKeeper EVMEngineKeeper)

DIInvoke injects the EVMEngineKeeper into the BankWrapper. This mitigates cyclic dependency: EVMEngineKeeper -> EVMEventProc(EVMStakingKeeper) -> BankWrapper -> EVMEngineKeeper.

Types

type BankWrapper

type BankWrapper struct {
	bankkeeper.Keeper

	EVMEngineKeeper EVMEngineKeeper
}

BankWrapper wraps x/bank.Keeper by overriding methods with creation of a new withdrawal requests.

func NewBankWrapper

func NewBankWrapper(k bankkeeper.Keeper) *BankWrapper

func (*BankWrapper) SendCoinsFromModuleToAccount

func (w *BankWrapper) SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, coins sdk.Coins) error

SendCoinsFromModuleToAccount intercepts all "normal" bank transfers from modules to users and creates EVM withdrawal to the user account and burns the funds from the module.

func (*BankWrapper) SendCoinsFromModuleToAccountNoWithdrawal

func (w *BankWrapper) SendCoinsFromModuleToAccountNoWithdrawal(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, coins sdk.Coins) error

SendCoinsFromModuleToAccountNoWithdrawal bypasses the EVM withdrawal creation. This is required when "depositing" funds from the EVM.

func (*BankWrapper) SetEVMEngineKeeper

func (w *BankWrapper) SetEVMEngineKeeper(keeper EVMEngineKeeper)

func (*BankWrapper) UndelegateCoinsFromModuleToAccount

func (w *BankWrapper) UndelegateCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error

UndelegateCoinsFromModuleToAccount intercepts all principal undelegations and creates EVM withdrawal to the user account. TODO(corver): This is unexpected in magellan upgrade, must be implemented in drake.

type DIInputs

type DIInputs struct {
	depinject.In

	BankKeeper bankkeeper.BaseKeeper
}

type DIOutputs

type DIOutputs struct {
	depinject.Out

	BankWrapper *BankWrapper
}

func DIProvide

func DIProvide(input DIInputs) (DIOutputs, error)

type EVMEngineKeeper

type EVMEngineKeeper interface {
	// InsertWithdrawal creates a new withdrawal request.
	InsertWithdrawal(ctx context.Context, withdrawalAddr common.Address, amountGwei uint64) error
}

Jump to

Keyboard shortcuts

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