/
tables.go
116 lines (104 loc) · 3.29 KB
/
tables.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package mongodb
import (
"go.mongodb.org/mongo-driver/bson/primitive"
)
// MgoSwap registered swap
type MgoSwap struct {
Key string `bson:"_id"` // txid + pairid + bind
PairID string `bson:"pairid"`
TxID string `bson:"txid"`
TxTo string `bson:"txto"`
TxType uint32 `bson:"txtype"`
Bind string `bson:"bind"`
Status SwapStatus `bson:"status"`
InitTime int64 `bson:"inittime"`
Timestamp int64 `bson:"timestamp"`
Memo string `bson:"memo"`
}
// MgoSwapResult swap result (verified swap)
type MgoSwapResult struct {
Key string `bson:"_id"` // txid + pairid + bind
PairID string `bson:"pairid"`
TxID string `bson:"txid"`
TxTo string `bson:"txto"`
TxHeight uint64 `bson:"txheight"`
TxTime uint64 `bson:"txtime"`
From string `bson:"from"`
To string `bson:"to"`
Bind string `bson:"bind"`
Value string `bson:"value"`
SwapTx string `bson:"swaptx"`
OldSwapTxs []string `bson:"oldswaptxs"`
OldSwapVals []string `bson:"oldswapvals"`
SwapHeight uint64 `bson:"swapheight"`
SwapTime uint64 `bson:"swaptime"`
SwapValue string `bson:"swapvalue"`
SwapType uint32 `bson:"swaptype"`
SwapNonce uint64 `bson:"swapnonce"`
Status SwapStatus `bson:"status"`
InitTime int64 `bson:"inittime"`
Timestamp int64 `bson:"timestamp"`
Memo string `bson:"memo"`
}
// SwapResultUpdateItems swap update items
type SwapResultUpdateItems struct {
SwapTx string
OldSwapTxs []string
OldSwapVals []string
SwapHeight uint64
SwapTime uint64
SwapValue string
SwapType uint32
SwapNonce uint64
Status SwapStatus
Timestamp int64
Memo string
}
// MgoP2shAddress key is the bind address
type MgoP2shAddress struct {
Key string `bson:"_id"`
P2shAddress string `bson:"p2shaddress"`
Timestamp int64 `bson:"timestamp"`
}
// MgoRegisteredAddress key is address (in whitelist)
type MgoRegisteredAddress struct {
Key string `bson:"_id"`
Timestamp int64 `bson:"timestamp"`
}
// MgoLatestScanInfo latest scan info
type MgoLatestScanInfo struct {
Key string `bson:"_id"`
BlockHeight uint64 `bson:"blockheight"`
Timestamp int64 `bson:"timestamp"`
}
// MgoBlackAccount key is address
type MgoBlackAccount struct {
Key string `bson:"_id"` // address + pairid
Address string `bson:"address"`
PairID string `bson:"pairid"`
Timestamp int64 `bson:"timestamp"`
}
// MgoLatestSwapNonce latest swap nonce
type MgoLatestSwapNonce struct {
Key string `bson:"_id"` // address + isswapin
Address string `bson:"address"`
IsSwapin bool `bson:"isswapin"`
SwapNonce uint64 `bson:"swapnonce"`
Timestamp int64 `bson:"timestamp"`
}
// MgoSwapHistory swap history
type MgoSwapHistory struct {
Key primitive.ObjectID `bson:"_id"`
IsSwapin bool `bson:"isswapin"`
TxID string `bson:"txid"`
Bind string `bson:"bind"`
SwapTx string `bson:"swaptx"`
}
// MgoUsedRValue security enhancement
type MgoUsedRValue struct {
Key string `bson:"_id"` // r + pubkey
Timestamp int64 `bson:"timestamp"`
}
func newObjectID() primitive.ObjectID {
return primitive.NewObjectID()
}