ethereum

package
v0.0.0-...-2ac5be2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ZeroAddress = AddressFromString("0x0000000000000000000000000000000000000000")

ZeroAddress for minting or burning or nil values

Functions

This section is empty.

Types

type Address

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

these are unexported to force users to go through our normalisation methods

func AddressFromString

func AddressFromString(str string) Address

AddressFromString, taking the string and making it lowercase then coercing, does no safety checks!

func (Address) MarshalJSON

func (addr Address) MarshalJSON() ([]byte, error)

MarshalJSON and UnmarshalJSON implement the json interface, allowing us to pass this over rabbit and redis

func (Address) MarshalText

func (addr Address) MarshalText() (text []byte, err error)

func (*Address) Scan

func (addr *Address) Scan(value interface{}) error

func (Address) String

func (address Address) String() string

func (*Address) UnmarshalJSON

func (addr *Address) UnmarshalJSON(data []byte) error

func (*Address) UnmarshalText

func (addr *Address) UnmarshalText(text []byte) error

func (Address) Value

func (addr Address) Value() (driver.Value, error)

Value and Scan implement the sql interfaces, allowing us to use this in a database

type BlockHeader

type BlockHeader struct {
	BlockHash       Hash        `json:"block_hash"`
	ParentHash      Hash        `json:"parent_hash"`
	UncleHash       Hash        `json:"uncle_hash"`
	Coinbase        Address     `json:"coinbase"`
	Root            Hash        `json:"root"`
	TransactionHash Hash        `json:"transaction_hash"`
	Bloom           misc.Blob   `json:"bloom"`
	Difficulty      misc.BigInt `json:"difficulty"`
	Number          misc.BigInt `json:"number"`
	GasLimit        misc.BigInt `json:"gas_limit"`
	GasUsed         misc.BigInt `json:"gas_used"`
	Time            uint64      `json:"time"`
	Extra           misc.Blob   `json:"extra"`
	MixDigest       Hash        `json:"mix_digest"`
	Nonce           BlockNonce  `json:"nonce"`
	ReceiptHash     Hash        `json:"receipt_hash"`
	BaseFee         misc.BigInt `json:"base_fee"`
}

BlockHeader contained within a block on Ethereum, may be forked

func (BlockHeader) MarshalBinary

func (blockHeader BlockHeader) MarshalBinary() ([]byte, error)

type BlockNonce

type BlockNonce []byte

Some of the less complicated types that shadow the definition provided by Go Ethereum.

type Hash

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

Some of the less complicated types that shadow the definition provided by Go Ethereum.

func HashFromString

func HashFromString(str string) Hash

HashFromString, taking the string and making it lowercase then coercing

func (Hash) MarshalJSON

func (hash Hash) MarshalJSON() ([]byte, error)

func (Hash) MarshalText

func (hash Hash) MarshalText() (text []byte, err error)

func (*Hash) Scan

func (hash *Hash) Scan(value interface{}) error

func (Hash) String

func (hash Hash) String() string

func (*Hash) UnmarshalJSON

func (addr *Hash) UnmarshalJSON(data []byte) error

func (*Hash) UnmarshalText

func (hash *Hash) UnmarshalText(text []byte) error

func (Hash) Value

func (hash Hash) Value() (driver.Value, error)

type Log

type Log struct {
	// address of the contract that generated the event
	Address Address `json:"address"`

	// list of topics provided by the contract.
	Topics []Hash `json:"topics"`

	// supplied by the contract, usually ABI-encoded
	Data misc.Blob `json:"data"`

	// block in which the transaction was included
	BlockNumber misc.BigInt `json:"block_number"`

	// hash of the transaction
	TxHash Hash `json:"transaction_hash"`

	// index of the transaction in the block
	TxIndex misc.BigInt `json:"transaction_index"`

	// hash of the block in which the transaction was included
	BlockHash Hash `json:"block_hash"`

	// index of the log in the block
	Index misc.BigInt `json:"log_index"`

	// whether the log was removed due to a chain reorganisation!
	Removed bool `json:"removed"`
}

Log represents a contract event log that we have confirmed isn't removed

func (Log) MarshalBinary

func (log Log) MarshalBinary() ([]byte, error)

type Receipt

type Receipt struct {
	Type              uint8       `json:"type"`
	PostState         misc.Blob   `json:"root"`
	Status            uint64      `json:"status"`
	CumulativeGasUsed uint64      `json:"cumulative_gas_used"`
	Bloom             misc.Blob   `json:"logs_bloom"`
	Logs              []Log       `json:"logs"`
	TransactionHash   Hash        `json:"transaction_hash"`
	ContractAddress   Address     `json:"contract_address"`
	GasUsed           misc.BigInt `json:"gas_used"`
	BlockHash         Hash        `json:"block_hash"`
	BlockNumber       misc.BigInt `json:"block_number"`
	TransactionIndex  uint        `json:"transaction_index"`
}

Receipt is the type returned when you use ethclient TransactionReceipt on a transaction

func (Receipt) MarshalBinary

func (receipt Receipt) MarshalBinary() ([]byte, error)

type StakingEvent

type StakingEvent struct {
	Address      Address
	UsdAmount    misc.BigInt
	LockupLength int
	InsertedDate time.Time
}

type Transaction

type Transaction struct {
	BlockHash Hash      `json:"block_hash"`
	Data      misc.Blob `json:"data"`

	// GasLimit could be set by transactions prior to London
	GasLimit misc.BigInt `json:"gas"`

	// GasFeeCap is the maxFeePerGas
	GasFeeCap misc.BigInt `json:"gas_fee_cap"`

	// GasTipCap is the maxPriorityFeePerGas
	GasTipCap misc.BigInt `json:"gas_tip_cap"`

	GasPrice misc.BigInt `json:"gas_price"`
	Hash     Hash        `json:"hash"`
	To       Address     `json:"to"`
	From     Address     `json:"from"`
	Type     uint8       `json:"type"`
}

Transaction made on Ethereum, may be forked

func (Transaction) MarshalBinary

func (transaction Transaction) MarshalBinary() ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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