types

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName defines the module name
	ModuleName = "ibc-callbacks"
)

Variables

View Source
var (
	ErrInvalidReceiverAddress = errorsmod.Register(ModuleName, 1, "invalid receiver address")
	ErrCallbackFailed         = errorsmod.Register(ModuleName, 2, "callback failed")
	ErrInvalidCalldata        = errorsmod.Register(ModuleName, 3, "invalid calldata in callback data")
	ErrContractHasNoCode      = errorsmod.Register(ModuleName, 4, "contract has no code")
	ErrTokenPairNotFound      = errorsmod.Register(ModuleName, 5, "token not registered")
	ErrNumberOverflow         = errorsmod.Register(ModuleName, 6, "number overflow")
	ErrAllowanceFailed        = errorsmod.Register(ModuleName, 7, "allowance failed")
	ErrEVMCallFailed          = errorsmod.Register(ModuleName, 8, "evm call failed")
	ErrOutOfGas               = errorsmod.Register(ModuleName, 9, "out of gas")
)

EVM sentinel callback errors

Functions

func GenerateIsolatedAddress

func GenerateIsolatedAddress(channelID string, sender string) sdk.AccAddress

GenerateIsolatedAddress generates an isolated address for the given channel ID and sender address. This provides a safe address to call the receiver contract address with custom calldata

Types

type AccountKeeper

type AccountKeeper interface {
	NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
	SetAccount(ctx context.Context, acc sdk.AccountI)
}

AccountKeeper defines the contract required for account APIs.

type ERC20Keeper

type ERC20Keeper interface {
	GetTokenPairID(ctx sdk.Context, token string) []byte
	GetTokenPair(ctx sdk.Context, id []byte) (types.TokenPair, bool)
	SetAllowance(ctx sdk.Context, erc20 common.Address, owner common.Address, spender common.Address, value *big.Int) error
	BalanceOf(ctx sdk.Context, abi abi.ABI, contract, account common.Address) *big.Int
}

type EVMKeeper

type EVMKeeper interface {
	CallEVM(ctx sdk.Context, abi abi.ABI, from, contract common.Address, commit bool, gasCap *big.Int, method string, args ...interface{}) (*evmtypes.MsgEthereumTxResponse, error)
	CallEVMWithData(ctx sdk.Context, from common.Address, contract *common.Address, data []byte, commit bool, gasCap *big.Int) (*evmtypes.MsgEthereumTxResponse, error)
	GetAccountOrEmpty(ctx sdk.Context, addr common.Address) statedb.Account
	GetAccount(ctx sdk.Context, addr common.Address) *statedb.Account
}

EVMKeeper defines the expected EVM keeper interface used on erc20

type Unmarshaler

type Unmarshaler struct{}

func (Unmarshaler) UnmarshalPacketData

func (u Unmarshaler) UnmarshalPacketData(ctx sdk.Context, portID, channelID string, data []byte) (any, string, error)

UnmarshalPacketData will unmarshal the packet data for the IBC transfer callback. It expects the data to be in the format of transfertypes.FungibleTokenPacketData. If the data is not in the expected format, it returns an error.

Jump to

Keyboard shortcuts

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