evmfuncs

package
v0.0.0-...-9abc7a9 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EffectStateWrite is the effect of a function call that writes to a storage
	EffectStateWrite = EffectWrite | effectClassMax<<iota<<1

	// EffectAddressWrite is the effect of a function call that writes to an address
	EffectAddressWrite = EffectWrite | effectClassMax<<iota<<1

	// EffectTransfer is the effect of a function call that transfers funds
	EffectTransfer Effect = EffectStateWrite | EffectTrigger | effectClassMax<<iota<<1

	// EffectMint is the effect of a function call that mints tokens
	EffectMint = EffectTransfer | effectClassMax<<iota<<1

	// EffectBurn is the effect of a function call that burns tokens
	EffectBurn = EffectTransfer | effectClassMax<<iota<<1

	// EffectSelfdestruct is the effect of a function call that selfdestructs the contract
	EffectSelfdestruct = EffectAddressWrite | EffectStateWrite | EffectTrigger | effectClassMax<<iota<<1

	// EffectRBACUpdate is the effect of a function call that updates the RBAC
	EffectRBACUpdate = EffectStateWrite | effectClassMax<<iota<<1
)

Variables

View Source
var (
	ArgTypeUnknown = ArgType{Kind: ArgKindUnknown}
	ArgTypeAddress = ArgType{Kind: ArgKindAddress, OffsetLen: 20}
	ArgTypeBool    = ArgType{Kind: ArgKindBool, OffsetLen: 32}
	ArgTypeString  = ArgType{Kind: ArgKindString}

	ArgTypeUint = ArgType{Kind: ArgKindUint, OffsetLen: 32}
)

Functions

This section is empty.

Types

type ArgKind

type ArgKind uint8
const (
	ArgKindUnknown ArgKind = iota
	ArgKindAddress
	ArgKindBool
	ArgKindBytes
	ArgKindInt
	ArgKindString
	ArgKindUint
)

func (ArgKind) String

func (k ArgKind) String() string

type ArgType

type ArgType struct {
	Kind      ArgKind
	OffsetLen int
}

func (ArgType) String

func (t ArgType) String() string

type Effect

type Effect uint64
const (
	// EffectUnknown is the effect of a function call that does not change the state
	EffectUnknown Effect = 0

	// EffectRead is the effect of a function call that reads the state
	EffectRead Effect = 1 << iota

	// EffectWrite is the effect of a function call that changes any data on the blockchain
	EffectWrite

	// EffectTrigger is the effect of a function call that triggers an event
	EffectTrigger
)

func (Effect) Is

func (e Effect) Is(effect Effect) bool

func (Effect) IsUnknown

func (e Effect) IsUnknown() bool

func (Effect) String

func (e Effect) String() string

type FuncParam

type FuncParam struct {
	Name string
	Type string
}

type FuncSig

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

func (*FuncSig) ABI

func (fsig *FuncSig) ABI() (*abi.ABI, error)

ABI creates a fake ABI object for the function signature

func (*FuncSig) Describe

func (fsig *FuncSig) Describe() string

func (*FuncSig) Effects

func (fsig *FuncSig) Effects() Effect

func (*FuncSig) Inputs

func (fsig *FuncSig) Inputs() []FuncParam

func (*FuncSig) Name

func (fsig *FuncSig) Name() string

func (*FuncSig) Outputs

func (fsig *FuncSig) Outputs() []FuncParam

func (*FuncSig) String

func (fsig *FuncSig) String() string

func (*FuncSig) UnpackInput

func (fsig *FuncSig) UnpackInput(data []byte) ([]interface{}, error)

func (*FuncSig) UnpackOutput

func (fsig *FuncSig) UnpackOutput(data []byte) ([]interface{}, error)

func (*FuncSig) WellKnown

func (fsig *FuncSig) WellKnown() bool

type FuncSignature

type FuncSignature interface {
	// Name is the name of the function
	Name() string

	// Inputs is the list of input parameters
	Inputs() []FuncParam

	// Outputs is the list of output parameters
	Outputs() []FuncParam

	// String returns the string representation of the function signature
	String() string

	// WellKnown returns true if the function signature is well known or commonly used
	// in the Ethereum ecosystem (e.g. balanceOf, transfer, etc.)
	WellKnown() bool

	// Effects returns the list of side effects of the function call,
	// if given function signature is known to have specific side effects.
	Effects() Effect

	// Describe returns a string describing the function signature, including a functional description
	// if available
	Describe() string

	// UnpackInput upacks values from given function data and returns a list of Go values.
	// The function signature must match the function data.
	UnpackInput(data []byte) ([]interface{}, error)

	// UnpackOutput upacks values from given function data and returns a list of Go values.
	// The function signature must match the function data.
	UnpackOutput(data []byte) ([]interface{}, error)
}

func NewFuncSignatureFromString

func NewFuncSignatureFromString(sig string) (FuncSignature, error)

type WellKnownFuncDesc

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

func GetWellKnownFuncByMethodID

func GetWellKnownFuncByMethodID(methodID []byte) (*WellKnownFuncDesc, bool)

func GetWellKnownFuncBySig

func GetWellKnownFuncBySig(sig string) (*WellKnownFuncDesc, bool)

func GetWellKnownFuncsByName

func GetWellKnownFuncsByName(name string) []*WellKnownFuncDesc

func (*WellKnownFuncDesc) Description

func (desc *WellKnownFuncDesc) Description() string

func (*WellKnownFuncDesc) Effects

func (desc *WellKnownFuncDesc) Effects() Effect

func (*WellKnownFuncDesc) Inputs

func (desc *WellKnownFuncDesc) Inputs() []FuncParam

func (*WellKnownFuncDesc) MethodID

func (desc *WellKnownFuncDesc) MethodID() []byte

func (*WellKnownFuncDesc) MethodIDHex

func (desc *WellKnownFuncDesc) MethodIDHex() string

func (*WellKnownFuncDesc) Name

func (desc *WellKnownFuncDesc) Name() string

func (*WellKnownFuncDesc) Outputs

func (desc *WellKnownFuncDesc) Outputs() []FuncParam

Jump to

Keyboard shortcuts

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