blockchain

package
v0.0.0-...-b6c1db7 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAddresses

func GetAddresses(dump *state.Dump) []string

GetAddresses extracts all addresses specified in the provided state dump and returns them as a slice

func GetBlock

func GetBlock(ec *ethclient.Client, blockNumber *big.Int) (*types.Block, error)

GetBlock returns the full block (including transactional data) for the given block number

func GetBlockState

func GetBlockState(c *rpc.Client, blockNumber *big.Int) (*state.Dump, error)

GetBlockState returns the state dump for the given block number

func GetGoldTokenBalanceFromStateDump

func GetGoldTokenBalanceFromStateDump(c *rpc.Client, accountAddressHex string, atBlockNumber *big.Int) (*big.Int, error)

GetGoldTokenBalanceFromStateDump returns the gold token balanace of an address on the Celo blockchain at a particular block height as reported by the state dump. This function is relevant to fetch balances for when the GoldToken contract hasn't been activated on the blockchain. i.e. for block numbers : 0 (genesis) to T-1 (where T is the block height at which the GoldToken contract is initialised)

func GetLatestBlockNumber

func GetLatestBlockNumber(c *rpc.Client) (*big.Int, error)

GetLatestBlockNumber returns the latest block number encountered by the full node of the Celo blockchain

func GetStateAddressesWithRelevantData

func GetStateAddressesWithRelevantData(dump *state.Dump) map[string]RelevantStateData

GetStateAddressesWithRelevantData extracts all addresses specified in a state dump and returns a mapping of these addresses to their corresponding gold token balances as reported by the state dump

func GetSystemGoldTokenSupplyFromStateDump

func GetSystemGoldTokenSupplyFromStateDump(c *rpc.Client, atBlockNumber *big.Int) (*big.Int, error)

GetSystemGoldTokenSupplyFromStateDump returns the total gold token supply of the Celo blockchain at a particular block height as reported by the state dump This function is relevant to fetch total gold token supply when the GoldToken contract hasn't been activated on the blockchain. i.e. for block numbers : 0 (genesis) to T-1 (where T is the block height at which the GoldToken contract is initialised)

Types

type GasReceipt

type GasReceipt struct {
	TxHash            common.Hash `json:"transactionHash"`
	CumulativeGasUsed uint64      `json:"cumulativeGasUsed"`
	GasUsed           uint64      `json:"gasUsed"`
}

GasReceipt is a struct to store gas related details from a transaction receipt

func GetGasReceipt

func GetGasReceipt(ec *ethclient.Client, txHash common.Hash) *GasReceipt

GetGasReceipt extracts and returns gas details from the transaction receipt of the given tx hash

type HeaderLite

type HeaderLite struct {
	Number    string `json:"number"`
	Timestamp string `json:"timestamp"`
}

func GetGenesisHeaderLite

func GetGenesisHeaderLite(c *rpc.Client) (*HeaderLite, error)

GetGenesisHeaderLite returns the timestamp of the genesis blocknumber wrapped in a HeaderLite object

func GetHeaderLite

func GetHeaderLite(c *rpc.Client, blockNumber *big.Int) (*HeaderLite, error)

GetHeaderLite returns the timestamp of the specified blocknumber wrapped in a HeaderLite object

func GetLatestHeaderLite

func GetLatestHeaderLite(c *rpc.Client) (*HeaderLite, error)

GetLatestHeaderLite returns the timestamp of the latest blocknumber wrapped in a HeaderLite object

type ReceiptLite

type ReceiptLite struct {
	TxHash string       `json:"transactionHash" gencodec:"required"`
	Logs   []*types.Log `json:"logs"              gencodec:"required"`
	From   string       `json:"from"`
	To     string       `json:"to"`
}

ReceiptLite represents a subset of a transaction receipt to store receipt data relevant to Icarus

func GetReceiptLite

func GetReceiptLite(c *rpc.Client, txHash string) (*ReceiptLite, error)

GetReceiptLite extracts and returns (relevant to Icarus) details from the transaction receipt of the given txhash

type RelevantStateData

type RelevantStateData struct {
	GoldTokenBalance *big.Int
}

RelevantStateData is a wrapper around state dump data points that we intend to return for each address in GetStateAddressesWithRelevantData Currently, it only contains Gold Token Balance

Jump to

Keyboard shortcuts

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