-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
67 lines (60 loc) · 1.45 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package main
import (
"github.com/ethereum/go-ethereum/ethclient"
"github.com/mailru/dbr"
"go.uber.org/zap"
)
type TConfig struct {
NodeUrl string `yaml:"node_url"`
Clickhouse string `yaml:"clickhouse"`
Threads int `yaml:"threads"`
BlockInterval int `yaml:"blockInterval"`
}
type TTransaction struct {
Date string `db:"date"`
Hash string `db:"hash"`
BlockNumber uint64 `db:"blockNumber"`
Value string `db:"value"`
GasUsed uint64 `db:"gasUsed"`
GasPrice uint64 `db:"gasPrice"`
Nonce uint64 `db:"nonce"`
To string `db:"to"`
From string `db:"from"`
Timestamp uint64 `db:"timestamp"`
//Data []byte
}
type TBlock struct {
Date string `db:"date"`
Number uint64 `db:"number"`
Timestamp int64 `db:"timestamp"`
Hash string `db:"hash"`
ParentHash string `db:"parentHash"`
UncleHash string `db:"uncleHash"`
MinedBy string `db:"minedBy"`
GasUsed uint64 `db:"gasUsed"`
GasLimit uint64 `db:"gasLimit"`
Nonce uint64 `db:"nonce"`
Size string `db:"size"`
TransactionsCount int `db:"transactionsCount"`
Difficulty uint64 `db:"difficulty"`
Extra string `db:"extra"`
}
type TAccount struct {
Address string
Balance string
TransactionsCount uint64
IsContract bool
Code string
}
type Watcher struct {
etherClient *ethclient.Client
db *dbr.Session
logger *zap.Logger
lastParsedBlockNumber int64
lastBlockNumber int64
queue chan int64
}
type Rest struct {
db *dbr.Session
etherClient *ethclient.Client
}