models

package
v0.0.0-...-95106c8 Latest Latest
Warning

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

Go to latest
Published: May 23, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BLOCKS    = "blocks"
	TXNS      = "transactions"
	UNCLES    = "uncles"
	TRANSFERS = "tokentransfers"
	REORGS    = "forkedblocks"
	CHARTS    = "charts"
	STORE     = "sysstores"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Number    uint64 `bson:"number" json:"number"`
	Timestamp uint64 `bson:"timestamp" json:"timestamp"`
	//
	// Transactions contains raw transactions to be processed, is not encoded in db.
	// Txs is the number of txs in a block, is encoded as "transactions"
	//
	Transactions []RawTransaction `bson:"-" json:"-"`
	Txs          int              `bson:"transactions" json:"transactions"`
	//
	Hash            string `bson:"hash" json:"hash"`
	ParentHash      string `bson:"parentHash" json:"parentHash"`
	Sha3Uncles      string `bson:"sha3Uncles" json:"sha3Uncles"`
	Miner           string `bson:"miner" json:"miner"`
	Difficulty      string `bson:"difficulty" json:"difficulty"`
	TotalDifficulty string `bson:"totalDifficulty" json:"totalDifficulty"`
	Size            uint64 `bson:"size" json:"size"`
	GasUsed         uint64 `bson:"gasUsed" json:"gasUsed"`
	GasLimit        uint64 `bson:"gasLimit" json:"gasLimit"`
	Nonce           string `bson:"nonce" json:"nonce"`
	// Same as Txs
	Uncles  []string `bson:"-" json:"-"`
	UncleNo int      `bson:"uncles" json:"uncles"`
	// TODO: These should be strings
	BlockReward  string `bson:"blockReward" json:"blockReward"`
	UnclesReward string `bson:"unclesReward" json:"unclesReward"`
	AvgGasPrice  string `bson:"avgGasPrice" json:"avgGasPrice"`
	TxFees       string `bson:"txFees" json:"txFees"`
	//
	ExtraData string `bson:"extraData" json:"extraData"`
}

type LineChart

type LineChart struct {
	Chart  string   `bson:"chart" json:"chart"`
	Labels []string `bson:"labels" json:"labels"`
	Values []string `bson:"values" json:"values"`
}

type MLineChart

type MLineChart struct {
	Chart  string              `bson:"chart" json:"chart"`
	Labels []string            `bson:"labels" json:"labels"`
	Values map[string][]string `bson:"values" json:"values"`
}

type RawBlock

type RawBlock struct {
	Number          string           `bson:"number" json:"number"`
	Timestamp       string           `bson:"timestamp" json:"timestamp"`
	Transactions    []RawTransaction `bson:"transactions" json:"transactions"`
	Hash            string           `bson:"hash" json:"hash"`
	ParentHash      string           `bson:"parentHash" json:"parentHash"`
	Sha3Uncles      string           `bson:"sha3Uncles" json:"sha3Uncles"`
	Miner           string           `bson:"miner" json:"miner"`
	Difficulty      string           `bson:"difficulty" json:"difficulty"`
	TotalDifficulty string           `bson:"totalDifficulty" json:"totalDifficulty"`
	Size            string           `bson:"size" json:"size"`
	GasUsed         string           `bson:"gasUsed" json:"gasUsed"`
	GasLimit        string           `bson:"gasLimit" json:"gasLimit"`
	Nonce           string           `bson:"nonce" json:"nonce"`
	Uncles          []string         `bson:"uncles" json:"uncles"`
	//
	BlockReward  string `bson:"blockReward" json:"blockReward"`
	UnclesReward string `bson:"unclesReward" json:"unclesReward"`
	AvgGasPrice  string `bson:"avgGasPrice" json:"avgGasPrice"`
	TxFees       string `bson:"txFees" json:"txFees"`
	//
	ExtraData string `bson:"extraData" json:"extraData"`
}

func (*RawBlock) Convert

func (b *RawBlock) Convert() *Block

type RawBlockDetails

type RawBlockDetails struct {
	Number string `bson:"number" json:"number"`
	Hash   string `bson:"hash" json:"hash"`
}

func (*RawBlockDetails) Convert

func (rbn *RawBlockDetails) Convert() (uint64, string)

type RawTransaction

type RawTransaction struct {
	BlockHash        string `json:"blockHash"`
	BlockNumber      string `json:"blockNumber"`
	From             string `json:"from"`
	Gas              string `json:"gas"`
	GasPrice         string `json:"gasPrice"`
	Hash             string `json:"hash"`
	Input            string `json:"input"`
	Nonce            string `json:"nonce"`
	To               string `json:"to"`
	TransactionIndex string `json:"transactionIndex"`
	Value            string `json:"value"`
	V                string `json:"v"`
	R                string `json:"r"`
	S                string `json:"s"`
}

func (*RawTransaction) Convert

func (rt *RawTransaction) Convert() *Transaction

type RawTxReceipt

type RawTxReceipt struct {
	TransactionHash   string  `json:"transactionHash"`
	TransactionIndex  string  `json:"transactionIndex"`
	BlockNumber       string  `json:"blockNumber"`
	BlockHash         string  `json:"blockHash"`
	CumulativeGasUsed string  `json:"cumulativeGasUsed"`
	GasUsed           string  `json:"gasUsed"`
	ContractAddress   string  `json:"contractAddress"`
	Logs              []TxLog `json:"logs"`
	LogsBloom         string  `json:"logsBloom"`
	Status            string  `json:"status"`
}

func (*RawTxReceipt) Convert

func (rtr *RawTxReceipt) Convert() *TxReceipt

type RawUncle

type RawUncle struct {
	Number      string `bson:"number" json:"number"`
	Position    string `bson:"position" json:"position"`
	BlockNumber string `bson:"blockNumber" json:"blockNumber"`
	Hash        string `bson:"hash" json:"hash"`
	ParentHash  string `bson:"parentHash" json:"parentHash"`
	Sha3Uncles  string `bson:"sha3Uncles" json:"sha3Uncles"`
	Miner       string `bson:"miner" json:"miner"`
	Difficulty  string `bson:"difficulty" json:"difficulty"`
	GasUsed     string `bson:"gasUsed" json:"gasUsed"`
	GasLimit    string `bson:"gasLimit" json:"gasLimit"`
	Timestamp   string `bson:"timestamp" json:"timestamp"`
	Reward      string `bson:"reward" json:"reward"`
}

func (*RawUncle) Convert

func (rw *RawUncle) Convert() *Uncle

type Store

type Store struct {
	Timestamp   int64     `bson:"timestamp" json:"timestamp"`
	Symbol      string    `bson:"symbol" json:"symbol"`
	Supply      string    `bson:"supply" json:"supply"`
	LatestBlock Block     `bson:"latestBlock" json:"latestBlock"`
	Price       string    `bson:"price" json:"price"`
	Sync        [1]uint64 `bson:"sync"`
}

type TokenTransfer

type TokenTransfer struct {
	BlockNumber uint64 `bson:"blockNumber" json:"blockNumber"`
	Hash        string `bson:"hash" json:"hash"`
	Timestamp   uint64 `bson:"timestamp" json:"timestamp"`
	From        string `bson:"from" json:"from"`
	To          string `bson:"to" json:"to"`
	Value       string `bson:"value" json:"value"`
	Contract    string `bson:"contract" json:"contract"`
	Method      string `bson:"method" json:"method"`
}

type Transaction

type Transaction struct {
	BlockHash        string `bson:"blockHash" json:"blockHash"`
	BlockNumber      uint64 `bson:"blockNumber" json:"blockNumber"`
	Hash             string `bson:"hash" json:"hash"`
	Timestamp        uint64 `bson:"timestamp" json:"timestamp"`
	Input            string `bson:"input" json:"input"`
	Value            string `bson:"value" json:"value"`
	Gas              uint64 `bson:"gas" json:"gas"`
	GasPrice         uint64 `bson:"gasPrice" json:"gasPrice"`
	Nonce            string `bson:"nonce" json:"nonce"`
	TransactionIndex uint64 `bson:"transactionIndex" json:"transactionIndex"`
	From             string `bson:"from" json:"from"`
	To               string `bson:"to" json:"to"`
	//
	GasUsed         uint64  `bson:"gasUsed" json:"gasUsed"`
	ContractAddress string  `bson:"contractAddress" json:"contractAddress"`
	Logs            []TxLog `bson:"logs" json:"logs"`
}

func (*Transaction) GetTokenTransfer

func (tx *Transaction) GetTokenTransfer() *TokenTransfer

func (*Transaction) IsTokenTransfer

func (tx *Transaction) IsTokenTransfer() bool

type TxLog

type TxLog struct {
	Address          string   `bson:"address" json:"address"`
	Topics           []string `bson:"topics" json:"topics"`
	Data             string   `bson:"data" json:"data"`
	BlockNumber      string   `bson:"blockNumber" json:"blockNumber"`
	TransactionIndex string   `bson:"transactionIndex" json:"transactionIndex"`
	TransactionHash  string   `bson:"transactionHash" json:"transactionHash"`
	BlockHash        string   `bson:"blockHash" json:"blockHash"`
	LogIndex         string   `bson:"logIndex" json:"logIndex"`
	Removed          bool     `bson:"removed" json:"removed"`
}

FIXME: this is broken, also probably useless, setting everything to string

type TxReceipt

type TxReceipt struct {
	TransactionHash   string  `json:"transactionHash"`
	TransactionIndex  string  `json:"transactionIndex"`
	BlockNumber       uint64  `json:"blockNumber"`
	BlockHash         string  `json:"blockHash"`
	CumulativeGasUsed uint64  `json:"cumulativeGasUsed"`
	GasUsed           uint64  `json:"gasUsed"`
	ContractAddress   string  `json:"contractAddress"`
	Logs              []TxLog `json:"logs"`
	LogsBloom         string  `json:"logsBloom"`
	Status            string  `json:"status"`
}

type Uncle

type Uncle struct {
	Number      uint64 `bson:"number" json:"number"`
	Position    uint64 `bson:"position" json:"position"`
	BlockNumber uint64 `bson:"blockNumber" json:"blockNumber"`
	Hash        string `bson:"hash" json:"hash"`
	ParentHash  string `bson:"parentHash" json:"parentHash"`
	Sha3Uncles  string `bson:"sha3Uncles" json:"sha3Uncles"`
	Miner       string `bson:"miner" json:"miner"`
	Difficulty  string `bson:"difficulty" json:"difficulty"`
	GasUsed     uint64 `bson:"gasUsed" json:"gasUsed"`
	GasLimit    uint64 `bson:"gasLimit" json:"gasLimit"`
	Timestamp   uint64 `bson:"timestamp" json:"timestamp"`
	Reward      string `bson:"reward" json:"reward"`
}

Jump to

Keyboard shortcuts

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