precompile_util

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrDifferentOrigin = "tx origin address %s does not match the sender address %s"
)

Variables

This section is empty.

Functions

func ConvertToStringArray

func ConvertToStringArray(arg interface{}, argPosition int) ([]string, error)

ConvertToStringArray converts an interface value to a string array. It handles both direct []string types and []interface{} that contains strings. argPosition is used in error messages to identify which argument had the issue.

func EmitEventWithArguments

func EmitEventWithArguments(
	ctx sdk.Context,
	p cmn.Precompile,
	stateDB vm.StateDB,
	eventType string,
	senderAddress common.Address,
	packedArguments ...interface{},
) error

EmitEventWithArguments creates a new event with the specified event type, sender address, and additional arguments. It properly handles indexed topics and non-indexed data.

func ExecuteMsg

func ExecuteMsg(
	ctx sdk.Context,
	origin common.Address,
	contract *vm.Contract,
	_ vm.StateDB,
	method *abi.Method,
	args []interface{},
	msgCreator func([]interface{}) (interface{}, common.Address, error),
	msgHandler func(ctx sdk.Context, msg interface{}) error,
	errorPrefix string,
) ([]byte, error)

ExecuteMsg is a helper function that handles the common pattern of executing a message

func ParseAddressFrom

func ParseAddressFrom(args []interface{}, argIndex int) (common.Address, error)

func ParseStringFrom

func ParseStringFrom(args []interface{}, argIndex int) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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