evm

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 11 Imported by: 8

Documentation

Index

Constants

View Source
const ModuleName = "evm"

ModuleName is the EVM module name.

Variables

This section is empty.

Functions

func DecodeEvent

func DecodeEvent(event *types.Event) ([]client.DecodedEvent, error)

DecodeEvent decodes an evm event.

func NewCallTx added in v0.3.0

func NewCallTx(fee *types.Fee, body *Call) *types.Transaction

NewCallTx generates a new evm.Call transaction.

func NewCreateTx added in v0.3.0

func NewCreateTx(fee *types.Fee, body *Create) *types.Transaction

NewCreateTx generates a new evm.Create transaction.

Types

type BalanceQuery

type BalanceQuery struct {
	Address []byte `json:"address"`
}

BalanceQuery queries the EVM account balance.

type Call

type Call struct {
	Address []byte `json:"address"`
	Value   []byte `json:"value"`
	Data    []byte `json:"data"`
}

Call is an EVM CALL transaction.

type CodeQuery

type CodeQuery struct {
	Address []byte `json:"address"`
}

CodeQuery queries the EVM code storage.

type Create

type Create struct {
	Value    []byte `json:"value"`
	InitCode []byte `json:"init_code"`
}

Create is an EVM CREATE transaction.

type Event

type Event struct {
	Address []byte   `json:"address"`
	Topics  [][]byte `json:"topics"`
	Data    []byte   `json:"data"`
}

Event is an event emitted by the EVM module.

type GasCosts

type GasCosts struct{}

GasCosts are the EVM module gas costs.

type Leash added in v0.3.0

type Leash struct {
	Nonce       uint64 `json:"nonce"`
	BlockNumber uint64 `json:"block_number"`
	BlockHash   []byte `json:"block_hash"`
	BlockRange  uint64 `json:"block_range"`
}

type Parameters

type Parameters struct {
	GasCosts GasCosts `json:"gas_costs"`
}

Parameters are the parameters for the EVM module.

type RSVSigner added in v0.3.0

type RSVSigner interface {
	// Sign returns a 65-byte secp256k1 signature as (R || S || V) over the provided digest.
	SignRSV(digest [32]byte) ([]byte, error)
}

RSVSigner is a type that produces secp256k1 signatures in RSV format.

type SignedCallDataPack added in v0.3.0

type SignedCallDataPack struct {
	Data      types.Call `json:"data"`
	Leash     Leash      `json:"leash"`
	Signature []byte     `json:"signature"`
}

SignedCallDataPack defines a signed call.

It should be encoded and sent in the `data` field of an Ethereum call.

func NewSignedCallDataPack added in v0.3.0

func NewSignedCallDataPack(signer RSVSigner, chainID uint64, caller, callee []byte, gasLimit uint64, gasPrice, value *big.Int, data []byte, leash Leash) (*SignedCallDataPack, error)

NewSignedCallDataPack returns a SignedCallDataPack.

This method does not encrypt `data`, so that should be done afterwards.

type SimulateCallQuery

type SimulateCallQuery struct {
	GasPrice []byte `json:"gas_price"`
	GasLimit uint64 `json:"gas_limit"`
	Caller   []byte `json:"caller"`
	Address  []byte `json:"address,omitempty"`
	Value    []byte `json:"value"`
	Data     []byte `json:"data"`
}

SimulateCallQuery simulates an EVM CALL.

type StorageQuery

type StorageQuery struct {
	Address []byte `json:"address"`
	Index   []byte `json:"index"`
}

StorageQuery queries the EVM storage.

type V1

type V1 interface {
	client.EventDecoder

	// Create generates an EVM CREATE transaction.
	// Note that the transaction's gas limit should be set to cover both the
	// SDK gas limit and the EVM gas limit.  The transaction fee should be
	// high enough to cover the EVM gas price multiplied by the EVM gas limit.
	Create(value []byte, initCode []byte) *client.TransactionBuilder

	// Call generates an EVM CALL transaction.
	// Note that the transaction's gas limit should be set to cover both the
	// SDK gas limit and the EVM gas limit.  The transaction fee should be
	// high enough to cover the EVM gas price multiplied by the EVM gas limit.
	Call(address []byte, value []byte, data []byte) *client.TransactionBuilder

	// Storage queries the EVM storage.
	Storage(ctx context.Context, round uint64, address []byte, index []byte) ([]byte, error)

	// Code queries the EVM code storage.
	Code(ctx context.Context, round uint64, address []byte) ([]byte, error)

	// Balance queries the EVM account balance.
	Balance(ctx context.Context, round uint64, address []byte) (*types.Quantity, error)

	// SimulateCall simulates an EVM CALL.
	SimulateCall(ctx context.Context, round uint64, gasPrice []byte, gasLimit uint64, caller []byte, address []byte, value []byte, data []byte) ([]byte, error)

	// Parameters queries the EVM module parameters.
	Parameters(ctx context.Context, round uint64) (*Parameters, error)

	// GetEvents returns events emitted by the EVM module.
	GetEvents(ctx context.Context, round uint64) ([]*Event, error)
}

V1 is the v1 EVM module interface.

func NewV1

func NewV1(rtc client.RuntimeClient) V1

NewV1 generates a V1 client helper for the EVM module.

Jump to

Keyboard shortcuts

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