ibc

package
v5.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransferMethod                   = "transfer"
	TransferWithDefaultTimeoutMethod = "transferWithDefaultTimeout"
)
View Source
const (
	DefaultBlockIncrement = 100
	DefaultTimeIncrement  = 10 * time.Minute
)

Default increment values

View Source
const (
	// EventTypeTransfer define the event when a transfer is done via contract
	EventTypeTransfer = "Transfer"
)
View Source
const (
	IBCPrecompileAddress = "0x0000000000000000000000000000000000001002"
)

Variables

This section is empty.

Functions

func GetKiiAddressByEvmAddress

func GetKiiAddressByEvmAddress(ctx sdk.Context, evmAddress common.Address) (sdk.AccAddress, error)

GetKiiAddressByEvmAddress transforms evm address into a kii address

func NewMsgTransfer

func NewMsgTransfer(
	ctx sdk.Context,
	method *abi.Method,
	sender common.Address,
	args []interface{},
) (*types.MsgTransfer, error)

NewMsgTransfer creates a new Transfer message

func ValidateArgsLength

func ValidateArgsLength(args []interface{}, length int) error

ValidateArgsLength checks if the length of the args is as expected

Types

type Precompile

type Precompile struct {
	cmn.Precompile
	// contains filtered or unexported fields
}

Precompile defines the struct for the ibc precompile

func NewPrecompile

func NewPrecompile(
	transferKeeper ibctransferkeeper.Keeper,
	clientKeeper clientkeeper.Keeper,
	connectionKeeper connectionkeeper.Keeper,
	channelKeeper channelkeeper.Keeper,
) (*Precompile, error)

NewPrecompile defines creates a new instance of ibc precompile

func (*Precompile) EmitEventTransfer

func (p *Precompile) EmitEventTransfer(
	ctx sdk.Context,
	stateDB vm.StateDB,
	caller common.Address,
	receiver, denom, port, channel string,
	amount *big.Int,
	height clienttypes.Height,
	timeoutTimestamp uint64,
	memo string,
) (err error)

EmitEventTransfer emits the Transfer event

func (Precompile) GetAdjustedTimestamp

func (p Precompile) GetAdjustedTimestamp(ctx sdk.Context, clientID string, height clienttypes.Height) (uint64, error)

GetAdjustedTimestamp creates default timestamp from height and unix

func (Precompile) IsTransaction

func (Precompile) IsTransaction(method *abi.Method) bool

IsTransaction checks if the method is a transaction

func (Precompile) LogTransfer added in v5.2.0

func (p Precompile) LogTransfer(ctx sdk.Context, method *abi.Method, msg *types.MsgTransfer)

LogTransfer logs a given transfer in the debug stream msg received here already passed basic validation

func (Precompile) Logger

func (p Precompile) Logger(ctx sdk.Context) log.Logger

Logger returns the logger for the precompile

func (Precompile) NewMsgTransferDefaultTimeout

func (p Precompile) NewMsgTransferDefaultTimeout(
	ctx sdk.Context,
	method *abi.Method,
	sender common.Address,
	args []interface{},
) (*types.MsgTransfer, error)

NewMsgTransferDefaultTimeout builds a new transfer message while collecting timeout information

func (Precompile) RequiredGas

func (p Precompile) RequiredGas(input []byte) uint64

RequiredGas returns the gas required for the precompile This is the same implementation as the one from the EVM module pre-compiles

func (Precompile) Run

func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz []byte, err error)

Run executes the ibc precompile

func (Precompile) Transfer

func (p Precompile) Transfer(ctx sdk.Context, method *abi.Method, stateDB vm.StateDB, args []interface{}, caller common.Address) ([]byte, error)

Transfer does a IBC transfer with custom timeout options

func (Precompile) TransferWithDefaultTimeout

func (p Precompile) TransferWithDefaultTimeout(ctx sdk.Context, method *abi.Method, stateDB vm.StateDB, args []interface{}, caller common.Address) ([]byte, error)

TransferWithDefaultTimeout does a IBC transfer with default timeout options

type TransferEvent

type TransferEvent struct {
	Caller           common.Address
	Denom            common.Hash
	Receiver         common.Hash
	Port             string
	Channel          string
	Amount           *big.Int
	RevisionNumber   uint64
	RevisionHeight   uint64
	TimeoutTimestamp uint64
	Memo             string
}

TransferEvent represents the solidity event that is logged

type ValidatedArgs

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

ValidatedArgs stores common args that have been validated

Jump to

Keyboard shortcuts

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