Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractL1Fee(transaction *api.EthereumTransaction) *big.Int
- func IsDepositTx(tx *api.EthereumTransaction) bool
- func NewArbitrumChecker(params internal.ParserParams) (internal.Checker, error)
- func NewArbitrumNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
- func NewAvacchainChecker(params internal.ParserParams) (internal.Checker, error)
- func NewAvacchainNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
- func NewBaseChecker(params internal.ParserParams) (internal.Checker, error)
- func NewBaseNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
- func NewBaseRosettaParser(params internal.ParserParams, nativeParser internal.NativeParser, ...) (internal.RosettaParser, error)
- func NewBaseValidator(params internal.ParserParams) internal.TrustlessValidator
- func NewBscNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
- func NewEthereumChecker(params internal.ParserParams) (internal.Checker, error)
- func NewEthereumNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
- func NewEthereumRosettaParser(params internal.ParserParams, nativeParser internal.NativeParser, ...) (internal.RosettaParser, error)
- func NewEthereumValidator(params internal.ParserParams) internal.TrustlessValidator
- func NewFantomNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
- func NewOptimismNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
- func NewOptimismValidator(params internal.ParserParams) internal.TrustlessValidator
- func NewPolygonChecker(params internal.ParserParams) (internal.Checker, error)
- func NewPolygonNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
- func NewPolygonRosettaParser(params internal.ParserParams, nativeParser internal.NativeParser, ...) (internal.RosettaParser, error)
- func NewPolygonValidator(params internal.ParserParams) internal.TrustlessValidator
- func WithEthereumChecksumAddress() internal.ParserFactoryOption
- func WithEthereumNodeType(nodeType types.EthereumNodeType) internal.ParserFactoryOption
- func WithTraceType(traceType types.TraceType) internal.ParserFactoryOption
- type AccountResult
- type EthereumBigFloat
- type EthereumBigQuantity
- type EthereumBlock
- type EthereumBlockLit
- type EthereumEventLog
- type EthereumHexString
- type EthereumQuantity
- type EthereumTransaction
- type EthereumTransactionAccess
- type EthereumTransactionLit
- type EthereumTransactionReceipt
- type EthereumTransactionReceiptLit
- type EthereumTransactionTrace
- type EthereumWithdrawal
- type ParityTraceAction
- type ParityTraceResult
- type ParityTransactionTrace
- type PolygonHeader
- type StorageResult
Constants ¶
View Source
const ( // UnclesRewardMultiplier is the uncle reward multiplier. // Ref: https://github.com/coinbase/rosetta-ethereum/blob/79a9b97d0a3ed08ae151a3f313aa57b88dd128a4/ethereum/types.go#L108 UnclesRewardMultiplier = 32 // MaxUncleDepth is the maximum depth for // an uncle to be rewarded. // Ref: https://github.com/coinbase/rosetta-ethereum/blob/79a9b97d0a3ed08ae151a3f313aa57b88dd128a4/ethereum/types.go#L112 MaxUncleDepth = int64(8) )
View Source
const ( // ContractAddressKey is the key used to denote the contract address // for a token, provided via Currency metadata. ContractAddressKey string = "token_address" )
View Source
const (
MintOpType = "MINT"
)
View Source
const ( // TransferEventTopic is the hash of the Transfer event: // ERC-20: Transfer(address indexed _from, address indexed _to, uint256 _value) // ERC-721: Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId) TransferEventTopic = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" )
Variables ¶
View Source
var ( // The BaseFeeVault predeploy receives the basefees on L2. // The basefee is not burnt on L2 like it is on L1. // Once the contract has received a certain amount of fees, // the ETH can be permissionlessly withdrawn to an immutable address on L1. BaseFeeVault = "0x4200000000000000000000000000000000000019" // The L1FeeVault predeploy receives the L1 portion of the transaction fees. // Once the contract has received a certain amount of fees, // the ETH can be permissionlessly withdrawn to an immutable address on L1. L1FeeVault = "0x420000000000000000000000000000000000001a" )
Optimism Predeploy Addresses (represented as 0x-prefixed hex string) See PredeployedContracts for more information.
View Source
var ( FrontierBlockReward = int64(5e+18) // Block reward in wei for successfully mining a block ByzantiumBlockReward = int64(3e+18) // Block reward in wei for successfully mining a block upward from Byzantium ConstantinopleBlockReward = int64(2e+18) // Block reward in wei for successfully mining a block upward from Constantinople )
View Source
var ( ErrInvalidBlockHash = xerrors.New("invalid block hash") ErrInvalidWithdrawalsHash = xerrors.New("invalid withdrawals hash") ErrInvalidTransactionsHash = xerrors.New("invalid transactions hash") ErrInvalidReceiptsHash = xerrors.New("invalid receipts hash") ErrAccountVerifyProofFailure = xerrors.New("account verification fails") ErrAccountNonceNotMatched = xerrors.New("mismatched account nonce") ErrAccountBalanceNotMatched = xerrors.New("mismatched account balance") ErrAccountStorageHashNotMatched = xerrors.New("mismatched account storage hash") ErrAccountCodeHashNotMatched = xerrors.New("mismatched account code hash") )
View Source
var Module = fx.Options( internal.NewParserBuilder("bsc", NewBscNativeParser). Build(), internal.NewParserBuilder("ethereum", NewEthereumNativeParser). SetRosettaParserFactory(NewEthereumRosettaParser). SetCheckerFactory(NewEthereumChecker). SetValidatorFactory(NewEthereumValidator). Build(), internal.NewParserBuilder("polygon", NewPolygonNativeParser). SetRosettaParserFactory(NewPolygonRosettaParser). SetCheckerFactory(NewPolygonChecker). SetValidatorFactory(NewPolygonValidator). Build(), internal.NewParserBuilder("avacchain", NewAvacchainNativeParser). SetCheckerFactory(NewAvacchainChecker). Build(), internal.NewParserBuilder("arbitrum", NewArbitrumNativeParser). SetCheckerFactory(NewArbitrumChecker). Build(), internal.NewParserBuilder("optimism", NewOptimismNativeParser). SetValidatorFactory(NewOptimismValidator). Build(), internal.NewParserBuilder("base", NewBaseNativeParser). SetRosettaParserFactory(NewBaseRosettaParser). SetCheckerFactory(NewBaseChecker). SetValidatorFactory(NewBaseValidator). Build(), internal.NewParserBuilder("fantom", NewFantomNativeParser). Build(), beacon.Module, )
View Source
var ( // Ref: https://github.com/blockchain-etl/ethereum-etl/blob/25fc768f39d6a3175f8175d42b7699eb33166ebf/ethereumetl/mappers/trace_mapper.py#L151 TraceCallTypeMap = map[string]bool{ "CALL": true, "CALLCODE": true, "DELEGATECALL": true, "STATICCALL": true, } )
Functions ¶
func ExtractL1Fee ¶
func ExtractL1Fee(transaction *api.EthereumTransaction) *big.Int
ExtractL1Fee attempts to extract L1Fee from the transaction L1Fee = L1GasPrice * ( L1GasUsed + 2100) * L1FeeScalar See https://community.optimism.io/docs/developers/build/transaction-fees/#the-l1-data-fee
func IsDepositTx ¶
func IsDepositTx(tx *api.EthereumTransaction) bool
IsDepositTx returns true if the transaction is a deposit tx type.
func NewArbitrumChecker ¶
func NewArbitrumChecker(params internal.ParserParams) (internal.Checker, error)
func NewArbitrumNativeParser ¶
func NewArbitrumNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
func NewAvacchainChecker ¶
func NewAvacchainChecker(params internal.ParserParams) (internal.Checker, error)
func NewAvacchainNativeParser ¶
func NewAvacchainNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
func NewBaseChecker ¶
func NewBaseChecker(params internal.ParserParams) (internal.Checker, error)
func NewBaseNativeParser ¶
func NewBaseNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
func NewBaseRosettaParser ¶
func NewBaseRosettaParser(params internal.ParserParams, nativeParser internal.NativeParser, opts ...internal.ParserFactoryOption) (internal.RosettaParser, error)
func NewBaseValidator ¶
func NewBaseValidator(params internal.ParserParams) internal.TrustlessValidator
func NewBscNativeParser ¶
func NewBscNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
func NewEthereumChecker ¶
func NewEthereumChecker(params internal.ParserParams) (internal.Checker, error)
func NewEthereumNativeParser ¶
func NewEthereumNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
func NewEthereumRosettaParser ¶
func NewEthereumRosettaParser(params internal.ParserParams, nativeParser internal.NativeParser, opts ...internal.ParserFactoryOption) (internal.RosettaParser, error)
func NewEthereumValidator ¶
func NewEthereumValidator(params internal.ParserParams) internal.TrustlessValidator
func NewFantomNativeParser ¶
func NewFantomNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
func NewOptimismNativeParser ¶
func NewOptimismNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
func NewOptimismValidator ¶
func NewOptimismValidator(params internal.ParserParams) internal.TrustlessValidator
func NewPolygonChecker ¶
func NewPolygonChecker(params internal.ParserParams) (internal.Checker, error)
func NewPolygonNativeParser ¶
func NewPolygonNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
func NewPolygonRosettaParser ¶
func NewPolygonRosettaParser(params internal.ParserParams, nativeParser internal.NativeParser, opts ...internal.ParserFactoryOption) (internal.RosettaParser, error)
func NewPolygonValidator ¶
func NewPolygonValidator(params internal.ParserParams) internal.TrustlessValidator
func WithEthereumChecksumAddress ¶
func WithEthereumChecksumAddress() internal.ParserFactoryOption
func WithEthereumNodeType ¶
func WithEthereumNodeType(nodeType types.EthereumNodeType) internal.ParserFactoryOption
func WithTraceType ¶
func WithTraceType(traceType types.TraceType) internal.ParserFactoryOption
Types ¶
type AccountResult ¶
type AccountResult struct { Address geth.Address `json:"address"` AccountProof []string `json:"accountProof"` Balance *hexutil.Big `json:"balance"` CodeHash geth.Hash `json:"codeHash"` Nonce hexutil.Uint64 `json:"nonce"` StorageHash geth.Hash `json:"storageHash"` StorageProof []StorageResult `json:"storageProof"` }
Result structs for eth_getProof
type EthereumBigFloat ¶
func (EthereumBigFloat) MarshalJSON ¶
func (v EthereumBigFloat) MarshalJSON() ([]byte, error)
func (*EthereumBigFloat) UnmarshalJSON ¶
func (v *EthereumBigFloat) UnmarshalJSON(input []byte) error
func (EthereumBigFloat) Value ¶
func (v EthereumBigFloat) Value() string
type EthereumBigQuantity ¶
func (EthereumBigQuantity) MarshalJSON ¶
func (v EthereumBigQuantity) MarshalJSON() ([]byte, error)
func (EthereumBigQuantity) Uint64 ¶
func (v EthereumBigQuantity) Uint64() (uint64, error)
func (*EthereumBigQuantity) UnmarshalJSON ¶
func (v *EthereumBigQuantity) UnmarshalJSON(input []byte) error
func (EthereumBigQuantity) Value ¶
func (v EthereumBigQuantity) Value() string
type EthereumBlock ¶
type EthereumBlock struct { Hash EthereumHexString `json:"hash" validate:"required"` ParentHash EthereumHexString `json:"parentHash" validate:"required"` Number EthereumQuantity `json:"number"` Timestamp EthereumQuantity `json:"timestamp" validate:"required_with=Number"` Transactions []*EthereumTransaction `json:"transactions"` Nonce EthereumHexString `json:"nonce"` Sha3Uncles EthereumHexString `json:"sha3Uncles"` LogsBloom EthereumHexString `json:"logsBloom"` TransactionsRoot EthereumHexString `json:"transactionsRoot"` StateRoot EthereumHexString `json:"stateRoot"` ReceiptsRoot EthereumHexString `json:"receiptsRoot"` Miner EthereumHexString `json:"miner"` Difficulty EthereumQuantity `json:"difficulty"` TotalDifficulty EthereumBigQuantity `json:"totalDifficulty"` ExtraData EthereumHexString `json:"extraData"` Size EthereumQuantity `json:"size"` GasLimit EthereumQuantity `json:"gasLimit"` GasUsed EthereumQuantity `json:"gasUsed"` Uncles []EthereumHexString `json:"uncles"` // The EIP-1559 base fee for the block, if it exists. BaseFeePerGas *EthereumQuantity `json:"baseFeePerGas"` ExtraHeader PolygonHeader `json:"extraHeader"` MixHash EthereumHexString `json:"mixHash"` // EIP-4895 introduces new fields in the execution payload // https://eips.ethereum.org/EIPS/eip-4895 // Note that the unit of withdrawal `amount` is in Gwei (1e9 wei). Withdrawals []*EthereumWithdrawal `json:"withdrawals"` WithdrawalsRoot EthereumHexString `json:"withdrawalsRoot"` // EIP-4788 introduces the parent beacon block root in the execution payload. // https://eips.ethereum.org/EIPS/eip-4788 ParentBeaconBlockRoot EthereumHexString `json:"parentBeaconBlockRoot"` // EIP-4844 introduces blob gas fields in the execution payload. // https://eips.ethereum.org/EIPS/eip-4844 BlobGasUsed *EthereumQuantity `json:"blobGasUsed"` ExcessBlobGas *EthereumQuantity `json:"excessBlobGas"` }
type EthereumBlockLit ¶
type EthereumBlockLit struct { Hash EthereumHexString `json:"hash" validate:"required"` ParentHash EthereumHexString `json:"parentHash" validate:"required"` Number EthereumQuantity `json:"number"` Transactions []*EthereumTransactionLit `json:"transactions"` Uncles []EthereumHexString `json:"uncles"` Timestamp EthereumQuantity `json:"timestamp"` Miner EthereumHexString `json:"miner"` }
EthereumBlockLit is a light version of EthereumBlock. Fields not used during data ingestion are removed.
type EthereumEventLog ¶
type EthereumEventLog struct { Removed bool `json:"removed"` LogIndex EthereumQuantity `json:"logIndex"` TransactionHash EthereumHexString `json:"transactionHash"` TransactionIndex EthereumQuantity `json:"transactionIndex"` BlockHash EthereumHexString `json:"blockHash"` BlockNumber EthereumQuantity `json:"blockNumber"` Address EthereumHexString `json:"address"` Data EthereumHexString `json:"data"` Topics []EthereumHexString `json:"topics"` }
type EthereumHexString ¶
type EthereumHexString string
func (EthereumHexString) MarshalJSON ¶
func (v EthereumHexString) MarshalJSON() ([]byte, error)
func (*EthereumHexString) UnmarshalJSON ¶
func (v *EthereumHexString) UnmarshalJSON(input []byte) error
func (EthereumHexString) Value ¶
func (v EthereumHexString) Value() string
type EthereumQuantity ¶
type EthereumQuantity uint64
func (EthereumQuantity) MarshalJSON ¶
func (v EthereumQuantity) MarshalJSON() ([]byte, error)
func (*EthereumQuantity) UnmarshalJSON ¶
func (v *EthereumQuantity) UnmarshalJSON(input []byte) error
func (EthereumQuantity) Value ¶
func (v EthereumQuantity) Value() uint64
type EthereumTransaction ¶
type EthereumTransaction struct { BlockHash EthereumHexString `json:"blockHash"` BlockNumber EthereumQuantity `json:"blockNumber"` From EthereumHexString `json:"from"` Gas EthereumQuantity `json:"gas"` GasPrice EthereumBigQuantity `json:"gasPrice"` Hash EthereumHexString `json:"hash"` Input EthereumHexString `json:"input"` To EthereumHexString `json:"to"` Index EthereumQuantity `json:"transactionIndex"` Value EthereumBigQuantity `json:"value"` Nonce EthereumQuantity `json:"nonce"` V EthereumHexString `json:"v"` R EthereumHexString `json:"r"` S EthereumHexString `json:"s"` // The EIP-155 related fields ChainId *EthereumQuantity `json:"chainId"` // The EIP-2718 type of the transaction Type EthereumQuantity `json:"type"` // The EIP-1559 related fields MaxFeePerGas *EthereumQuantity `json:"maxFeePerGas"` MaxPriorityFeePerGas *EthereumQuantity `json:"maxPriorityFeePerGas"` AccessList *[]*EthereumTransactionAccess `json:"accessList"` Mint *EthereumBigQuantity `json:"mint"` // The EIP-4844 related fields MaxFeePerBlobGas *EthereumBigQuantity `json:"maxFeePerBlobGas"` BlobVersionedHashes *[]EthereumHexString `json:"blobVersionedHashes"` // Deposit transaction fields for Optimism and Base. SourceHash EthereumHexString `json:"sourceHash"` IsSystemTx bool `json:"isSystemTx"` }
type EthereumTransactionAccess ¶
type EthereumTransactionAccess struct { Address EthereumHexString `json:"address"` StorageKeys []EthereumHexString `json:"storageKeys"` }
type EthereumTransactionLit ¶
type EthereumTransactionLit struct { Hash EthereumHexString `json:"hash"` From EthereumHexString `json:"from"` To EthereumHexString `json:"to"` }
EthereumTransactionLit is a light version of EthereumTransaction. Fields not used during data ingestion are removed.
func (*EthereumTransactionLit) UnmarshalJSON ¶
func (v *EthereumTransactionLit) UnmarshalJSON(input []byte) error
type EthereumTransactionReceipt ¶
type EthereumTransactionReceipt struct { TransactionHash EthereumHexString `json:"transactionHash"` TransactionIndex EthereumQuantity `json:"transactionIndex"` BlockHash EthereumHexString `json:"blockHash"` BlockNumber EthereumQuantity `json:"blockNumber"` From EthereumHexString `json:"from"` To EthereumHexString `json:"to"` CumulativeGasUsed EthereumQuantity `json:"cumulativeGasUsed"` GasUsed EthereumQuantity `json:"gasUsed"` ContractAddress EthereumHexString `json:"contractAddress"` Logs []*EthereumEventLog `json:"logs"` LogsBloom EthereumHexString `json:"logsBloom"` Root EthereumHexString `json:"root"` Status *EthereumQuantity `json:"status"` Type EthereumQuantity `json:"type"` EffectiveGasPrice *EthereumQuantity `json:"effectiveGasPrice"` GasUsedForL1 *EthereumQuantity `json:"gasUsedForL1"` // For Arbitrum network https://github.com/OffchainLabs/arbitrum/blob/6ca0d163417470b9d2f7eea930c3ad71d702c0b2/packages/arb-evm/evm/result.go#L336 L1GasUsed *EthereumBigQuantity `json:"l1GasUsed"` // For Optimism and Base networks https://github.com/ethereum-optimism/optimism/blob/3c3e1a88b234a68bcd59be0c123d9f3cc152a91e/l2geth/core/types/receipt.go#L73 L1GasPrice *EthereumBigQuantity `json:"l1GasPrice"` L1Fee *EthereumBigQuantity `json:"l1Fee"` L1FeeScaler *EthereumBigFloat `json:"l1FeeScalar"` // Base/Optimism specific fields. DepositNonce *EthereumQuantity `json:"depositNonce"` DepositReceiptVersion *EthereumQuantity `json:"depositReceiptVersion"` // The EIP-4844 related fields BlobGasPrice *EthereumQuantity `json:"blobGasPrice"` BlobGasUsed *EthereumQuantity `json:"blobGasUsed"` }
type EthereumTransactionReceiptLit ¶
type EthereumTransactionReceiptLit struct {
BlockHash EthereumHexString `json:"blockHash"`
}
type EthereumTransactionTrace ¶
type EthereumTransactionTrace struct { Error string `json:"error"` Type string `json:"type"` From EthereumHexString `json:"from"` To EthereumHexString `json:"to"` Value EthereumBigQuantity `json:"value"` Gas EthereumQuantity `json:"gas"` GasUsed EthereumQuantity `json:"gasUsed"` Input EthereumHexString `json:"input"` Output EthereumHexString `json:"output"` Calls []EthereumTransactionTrace `json:"calls"` }
type EthereumWithdrawal ¶
type EthereumWithdrawal struct { Index EthereumQuantity `json:"index"` ValidatorIndex EthereumQuantity `json:"validatorIndex"` Address EthereumHexString `json:"address"` Amount EthereumQuantity `json:"amount"` }
type ParityTraceAction ¶
type ParityTraceAction struct { CallType string `json:"callType"` From EthereumHexString `json:"from"` Gas EthereumQuantity `json:"gas"` Input EthereumHexString `json:"input"` To EthereumHexString `json:"to"` Value EthereumBigQuantity `json:"value"` Type string `json:"type"` }
type ParityTraceResult ¶
type ParityTraceResult struct { GasUsed EthereumQuantity `json:"gasUsed"` Output EthereumHexString `json:"output"` }
type ParityTransactionTrace ¶
type ParityTransactionTrace struct { Error string `json:"error"` Action ParityTraceAction `json:"action"` Result ParityTraceResult `json:"result"` Subtraces uint64 `json:"subtraces"` TraceAddress []uint64 `json:"traceAddress"` TraceType string `json:"type"` BlockHash EthereumHexString `json:"blockHash"` BlockNumber EthereumQuantity `json:"blockNumber"` TransactionHash EthereumHexString `json:"transactionHash"` TransactionPosition EthereumQuantity `json:"transactionPosition"` }
type PolygonHeader ¶
type PolygonHeader struct {
Author EthereumHexString `json:"author"`
}
Source Files ¶
- arbitrum_native.go
- arbitrum_preprocessor.go
- avacchain_native.go
- avacchain_preprocessor.go
- base_native.go
- base_preprocessor.go
- base_rosetta.go
- base_validator.go
- bsc_native.go
- ethereum_native.go
- ethereum_preprocessor.go
- ethereum_rosetta.go
- ethereum_validator.go
- evm_common.go
- fantom_native.go
- module.go
- optimism_native.go
- optimism_validator.go
- polygon_native.go
- polygon_preprocessor.go
- polygon_rosetta.go
- polygon_validator.go
Click to show internal directories.
Click to hide internal directories.