evm

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: MIT Imports: 3 Imported by: 5

Documentation

Index

Constants

View Source
const AddressLength = 20
View Source
const HashLength = 32

Variables

This section is empty.

Functions

This section is empty.

Types

type ABIPayload

type ABIPayload = []byte

represents solidity-spec abi encoded bytes

type Address

type Address = [AddressLength]byte

represents evm-style address

type CallMsg

type CallMsg struct {
	To   Address
	From Address // from field is needed if contract read depends on msg.sender
	Data ABIPayload
}

matches simplifie evm-style callMsg for reads/EstimateGas

type FilterQuery

type FilterQuery struct {
	BlockHash Hash      // for filter by exact block, if not empty can't use from/to
	FromBlock *big.Int  // start block range
	ToBlock   *big.Int  // end block range
	Addresses []Address // contract(s) to filter logs from

	// The Topic list restricts matches to particular event topics. Each event has a list
	// of topics. Topics matches a prefix of that list. An empty element slice matches any
	// topic. Non-empty elements represent an alternative that matches any of the
	// contained topics.
	//
	// Examples:
	// {} or nil          matches any topic list
	// {{A}}              matches topic A in first position
	// {{}, {B}}          matches any topic in first position AND B in second position
	// {{A}, {B}}         matches topic A in first position AND B in second position
	// {{A, B}, {C, D}}   matches topic (A OR B) in first position AND (C OR D) in second position
	Topics [][]Hash // filter log by event sigs and indexed args
}

matches evm-style eth_getLogs filterQuery

type GasConfig

type GasConfig struct {
	// Default to nil. If not specified the value configured in GasEstimator will be used
	GasLimit *uint64
	// Default to nil. If not specified the value configured in GasEstimator will be used
	MaxGasPrice *big.Int
}

type Hash

type Hash = [HashLength]byte

represents evm-style hash

type Head struct {
	Timestamp  uint64 // time in seconds
	Hash       Hash
	ParentHash Hash
	Number     *big.Int
}

matches simplified evm-style head

type LPFilterQuery

type LPFilterQuery struct {
	Name         string        // filter identifier, used to remove filter
	Addresses    []Address     // list of addresses to include
	EventSigs    []Hash        // list of possible signatures
	Topic2       []Hash        // list of possible values for topic2
	Topic3       []Hash        // list of possible values for topic3
	Topic4       []Hash        // list of possible values for topic3
	Retention    time.Duration // maximum amount of time to retain
	MaxLogsKept  uint64        // maximum number of logs to retain ( 0 = unlimited )
	LogsPerBlock uint64        // rate limit ( maximum # of logs per block, 0 = unlimited )
}

matches cache-filter this filter defines what logs should be cached cached logs can be retrieved with [types.EVMService.QueryLogsFromCache]

type Log

type Log struct {
	LogIndex    uint32     // index of the log inside of the block
	BlockHash   Hash       // hash of the block containing this log
	BlockNumber *big.Int   // number of the block containing this log
	Topics      []Hash     // indexed fields of the log
	EventSig    Hash       // keccak256 hash of log event signature
	Address     Address    // address of the contract that emmited the log
	TxHash      Hash       // hash of the transaction this log is produced by
	Data        ABIPayload // abi encoded data of the log
	Removed     bool       // flag if log was removed during reorg
}

matches evm-style logs

type Receipt

type Receipt struct {
	Status            uint64   // 1 for success 0 for revert
	Logs              []*Log   // logs emmited by the transaction
	TxHash            Hash     // hash of the transaction this receipt is for
	ContractAddress   Address  // Address of the contract if one was created by this transaction
	GasUsed           uint64   // actual gas used during execution in gas units
	BlockHash         Hash     // hash of the block containing this receipt
	BlockNumber       *big.Int // number of the block containing this receipt
	TransactionIndex  uint64   // index of the transaction inside of the block
	EffectiveGasPrice *big.Int // actual price in wei paid per gas unit
}

matches evm-style receipt

type ReceiptGasInfo

type ReceiptGasInfo struct {
	GasUsed           uint64   // actual gas used during execution in gas units
	EffectiveGasPrice *big.Int // actual price in wei paid per gas unit
}

type SignedReport

type SignedReport struct {
	RawReport     []byte
	ReportContext []byte
	Signatures    [][]byte
	ID            []byte
}

type SubmitTransactionRequest

type SubmitTransactionRequest struct {
	To   Address
	Data ABIPayload
	// Default to nil. If not specified the configured gas estimator config will be used
	GasConfig *GasConfig
}

type Transaction

type Transaction struct {
	To       Address    // receipient address
	Data     ABIPayload // input data for func call payload
	Hash     Hash       // derived from transaction structure
	Nonce    uint64     // number of txs sent from sender
	Gas      uint64     // max gas allowed per execution (in gas units)
	GasPrice *big.Int   // price for a single gas unit in wei
	Value    *big.Int   // amount of eth sent in wei
}

matches evm-style transaction

type TransactionFee

type TransactionFee struct {
	TransactionFee *big.Int // Cost of transaction in wei
}

type TransactionResult

type TransactionResult struct {
	TxStatus TransactionStatus
	TxHash   Hash
}

PLEX-1524 - Refactor this to return the Tx Hash in a Transaction type and a second return value for the TxStatus. We may even be able to return the whole transaction object instead of just the hash.

type TransactionStatus

type TransactionStatus int

TransactionStatus is the result of the transaction sent to the chain

const (
	// Transaction processing failed due to a network issue, RPC issue, or other fatal error
	TxFatal TransactionStatus = iota
	// Transaction was sent successfully to the chain but the smart contract execution reverted
	TxReverted
	// Transaction was sent successfully to the chain, smart contract executed successfully and mined into a block.
	TxSuccess
)

type TxError

type TxError struct {
	// Internal ID used for tracking purposes of transactions.
	TxID string
}

func (*TxError) Error

func (e *TxError) Error() string

Jump to

Keyboard shortcuts

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