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 `gorm:"-"`
BlockNumber int64 `gorm:"size:8;index;unique_index:idx_block_number_address"`
Address []byte `gorm:"size:20;index;unique_index:idx_block_number_address"`
Balance string `gorm:"size:32"`
}
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 Header ¶
type Header struct {
ID int64
Hash []byte
ParentHash []byte
UncleHash []byte
Coinbase []byte
Root []byte
TxHash []byte
ReceiptHash []byte
Difficulty int64
Number int64
GasLimit int64
GasUsed int64
Time int64
ExtraData []byte
MixDigest []byte
Nonce []byte
// MinerBaseReward plus UnclesInclusionReward plus TxsFee is MinerReward.
MinerReward string
UnclesInclusionReward string
TxsFee string
// Total of uncles reward. At most 2.
Uncle1Reward string
Uncle1Coinbase []byte
Uncle1Hash []byte
Uncle2Reward string
Uncle2Coinbase []byte
Uncle2Hash []byte
CreatedAt *time.Time
}
Header represents the header of a block
type Log ¶
type Log struct {
TxHash []byte
BlockNumber int64
ContractAddress []byte
// The sha3 of the event method
EventName []byte
// Indexed parameters of event. At most 3 topics.
Topic1 []byte
Topic2 []byte
Topic3 []byte
Data []byte
}
Log represents a receipt log
type QueryParameters ¶ added in v0.2.0
func (*QueryParameters) OrderString ¶ added in v0.2.0
func (q *QueryParameters) OrderString() string
type Receipt ¶
type Receipt struct {
Root []byte
Status uint
CumulativeGasUsed int64
Bloom []byte
TxHash []byte
ContractAddress []byte
GasUsed int64
BlockNumber int64
Logs []*Log
}
Receipt represents a transaction receipt
type Reorg ¶ added in v0.3.0
type Reorg struct {
From int64
FromHash []byte
To int64
ToHash []byte
CreatedAt time.Time `deepequal:"-"`
}
Reorg represents the Reorg model
type Subscription ¶ added in v0.2.0
type Subscription struct {
ID int64
BlockNumber int64
Group int64
Address []byte
CreatedAt time.Time `deepequal:"-"`
UpdatedAt time.Time `deepequal:"-"`
}
Subscription represents the Subscription model
func (Subscription) TableName ¶ added in v0.2.0
func (s Subscription) TableName() string
TableName retruns the table name of this erc20 contract
type TotalBalance ¶ added in v0.2.0
type TotalBalance struct {
Token []byte
BlockNumber int64
Group int64
Balance string
TxFee string
MinerReward string
UnclesReward string
}
TotalBalance represents the total balance of subscription accounts in different group
func (TotalBalance) TableName ¶ added in v0.2.0
func (s TotalBalance) TableName() string
TableName retruns the table name of this model
type TotalDifficulty ¶
TotalDifficulty represents total difficulty for this block
func (TotalDifficulty) TableName ¶
func (t TotalDifficulty) TableName() string
TableName returns the table name of this model
type Transaction ¶
type Transaction struct {
Hash []byte
BlockHash []byte
From []byte
To []byte
Nonce int64
GasPrice int64
GasLimit int64
Amount string
Payload []byte
BlockNumber int64
}
Transaction represents a transaction
func (Transaction) TableName ¶
func (t Transaction) TableName() string
TableName returns the table name of this model
type Transfer ¶ added in v0.2.0
type Transfer struct {
Address []byte `gorm:"-"`
BlockNumber int64 `gorm:"size:8;index"`
TxHash []byte `gorm:"size:32;index"`
From []byte `gorm:"size:20;index"`
To []byte `gorm:"size:20;index"`
Value string `gorm:"size:32"`
}
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 ¶ added in v0.2.5
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 ¶ added in v0.2.5
IsUncleRewardEvent represents a miner or uncle event.
Note that the event is defined by us. It's not a standard ethereum event.