Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ETHAddress represents ether type in address type ETHAddress = common.BytesToAddress([]byte("ETH")) // ETHBytes represents ether type in bytes array type ETHBytes = ETHAddress.Bytes() // RewardToMiner represents a constant at from field in transfer event RewardToMiner = common.BytesToAddress([]byte("MINER REWARD")) // RewardToUncle represents a constant at from field in transfer event RewardToUncle = common.BytesToAddress([]byte("UNCLE REWARD")) // Maximum number of uncles allowed in a single block MaxUncles = 2 // ErrTooManyUncles is returned if uncles is larger than 2 ErrTooManyUncles = errors.New("too many uncles") // ErrTooManyMiners is returned if miner is larger than 1 ErrTooManyMiners = errors.New("too many miners") ErrConfusedUncles = errors.New("confused numbers of uncle") )
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { ContractAddress []byte BlockNumber int64 `db:"block_number"` Address []byte `db:"address"` Balance string `db:"balance"` Group int64 `db:"group"` }
Account represents the either ERC20 or ETH balances of externally owned accounts in Ethereum at given block The account is considered an eth account and insert to account table if ContractAddress is ETHBytes, or considered an erc20 account and insert to erc20_balance_{ContractAddress} table.
type ERC20 ¶
type ERC20 struct { BlockNumber int64 `db:"block_number"` Address []byte `db:"address"` TotalSupply string `db:"total_supply"` Decimals int `db:"decimals"` Name string `db:"name"` }
ERC20 represents the ERC20 contract
type Header ¶
type Header struct { ID int64 `db:"id"` Hash []byte `db:"hash"` ParentHash []byte `db:"parent_hash"` UncleHash []byte `db:"uncle_hash"` Coinbase []byte `db:"coinbase"` Root []byte `db:"root"` TxHash []byte `db:"tx_hash"` ReceiptHash []byte `db:"receipt_hash"` Difficulty int64 `db:"difficulty"` Number int64 `db:"number"` GasLimit int64 `db:"gas_limit"` GasUsed int64 `db:"gas_used"` Time int64 `db:"time"` ExtraData []byte `db:"extra_data"` MixDigest []byte `db:"mix_digest"` Nonce []byte `db:"nonce"` // MinerBaseReward plus UnclesInclusionReward plus TxsFee is MinerReward. MinerReward string `db:"miner_reward"` UnclesInclusionReward string `db:"uncles_inclusion_reward"` TxsFee string `db:"txs_fee"` // Total of uncles reward. At most 2. Uncle1Reward string `db:"uncle1_reward"` Uncle1Coinbase []byte `db:"uncle1_coinbase"` Uncle1Hash []byte `db:"uncle1_hash"` Uncle2Reward string `db:"uncle2_reward"` Uncle2Coinbase []byte `db:"uncle2_coinbase"` Uncle2Hash []byte `db:"uncle2_hash"` CreatedAt *time.Time `db:"created_at"` }
Header represents the header of a block
type Log ¶
type Log struct { TxHash []byte `db:"tx_hash"` BlockNumber int64 `db:"block_number"` ContractAddress []byte `db:"contract_address"` // The sha3 of the event method EventName []byte `db:"event_name"` // Indexed parameters of event. At most 3 topics. Topic1 []byte `db:"topic1"` Topic2 []byte `db:"topic2"` Topic3 []byte `db:"topic3"` Data []byte `db:"data"` }
Log represents a receipt log
type QueryParameters ¶
type Receipt ¶
type Receipt struct { Root []byte `db:"root"` Status uint `db:"status"` CumulativeGasUsed int64 `db:"cumulative_gas_used"` Bloom []byte `db:"bloom"` TxHash []byte `db:"tx_hash"` ContractAddress []byte `db:"contract_address"` GasUsed int64 `db:"gas_used"` BlockNumber int64 `db:"block_number"` Logs []*Log }
Receipt represents a transaction receipt
type Reorg ¶
type Reorg struct { From int64 `db:"from"` FromHash []byte `db:"from_hash"` To int64 `db:"to"` ToHash []byte `db:"to_hash"` CreatedAt time.Time `db:"created_at" deepequal:"-"` }
Reorg represents the Reorg model
type Subscription ¶
type Subscription struct { ID int64 `db:"id"` BlockNumber int64 `db:"block_number"` Group int64 `db:"group"` Address []byte `db:"address"` CreatedAt time.Time `db:"created_at" deepequal:"-"` UpdatedAt time.Time `db:"updated_at" deepequal:"-"` }
Subscription represents the Subscription model
type TotalBalance ¶
type TotalBalance struct { Token []byte `db:"token"` BlockNumber int64 `db:"block_number"` Group int64 `db:"group"` Balance string `db:"balance"` TxFee string `db:"tx_fee"` MinerReward string `db:"miner_reward"` UnclesReward string `db:"uncles_reward"` }
TotalBalance represents the total balance of subscription accounts in different group
type TotalDifficulty ¶
type TotalDifficulty struct { Block int64 `db:"block"` Hash []byte `db:"hash"` Td string `db:"td"` }
TotalDifficulty represents total difficulty for this block
type Transaction ¶
type Transaction struct { Hash []byte `db:"hash"` BlockHash []byte `db:"block_hash"` From []byte `db:"from"` To []byte `db:"to"` Nonce int64 `db:"nonce"` GasPrice int64 `db:"gas_price"` GasLimit int64 `db:"gas_limit"` Amount string `db:"amount"` Payload []byte `db:"payload"` BlockNumber int64 `db:"block_number"` }
Transaction represents a transaction
type Transfer ¶
type Transfer struct { Address []byte BlockNumber int64 `db:"block_number"` TxHash []byte `db:"tx_hash"` From []byte `db:"from"` To []byte `db:"to"` Value string `db:"value"` }
Transfer represents the transfer event in either ether or ERC20 tokens The event is considered an eth transfer event and insert to eth_transfer table if Address is ETHBytes, or considered an erc20 transfer event and insert to erc20_transfer_{Address} table.
func (Transfer) IsMinerRewardEvent ¶
IsMinerRewardEvent represents a miner or uncle event.
Note that the event is defined by us. It's not a standard ethereum event.
func (Transfer) IsUncleRewardEvent ¶
IsUncleRewardEvent represents a miner or uncle event.
Note that the event is defined by us. It's not a standard ethereum event.