-
Notifications
You must be signed in to change notification settings - Fork 33
/
message_models.py
115 lines (85 loc) · 2.63 KB
/
message_models.py
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
from typing import Dict
from typing import List
from pydantic import BaseModel
from snapshotter.utils.models.message_models import AggregateBase
class EpochBaseSnapshot(BaseModel):
begin: int
end: int
class SnapshotBase(BaseModel):
contract: str
chainHeightRange: EpochBaseSnapshot
timestamp: int
class UniswapPairTotalReservesSnapshot(SnapshotBase):
token0Reserves: Dict[
str,
float,
] # block number to corresponding total reserves
token1Reserves: Dict[
str,
float,
] # block number to corresponding total reserves
token0ReservesUSD: Dict[str, float]
token1ReservesUSD: Dict[str, float]
token0Prices: Dict[str, float]
token1Prices: Dict[str, float]
class logsTradeModel(BaseModel):
logs: List
trades: Dict[str, float]
class UniswapTradeEvents(BaseModel):
Swap: logsTradeModel
Mint: logsTradeModel
Burn: logsTradeModel
Trades: Dict[str, float]
class UniswapTradesSnapshot(SnapshotBase):
totalTrade: float # in USD
totalFee: float # in USD
token0TradeVolume: float # in token native decimals supply
token1TradeVolume: float # in token native decimals supply
token0TradeVolumeUSD: float
token1TradeVolumeUSD: float
events: UniswapTradeEvents
class UniswapTradesAggregateSnapshot(AggregateBase):
totalTrade: float = 0 # in USD
totalFee: float = 0 # in USD
token0TradeVolume: float = 0 # in token native decimals supply
token1TradeVolume: float = 0 # in token native decimals supply
token0TradeVolumeUSD: float = 0
token1TradeVolumeUSD: float = 0
complete: bool = True
class UniswapTopTokenSnapshot(BaseModel):
name: str
symbol: str
decimals: int
address: str
price: float
priceChange24h: float
volume24h: float
liquidity: float
class UniswapTopTokensSnapshot(AggregateBase):
tokens: List[UniswapTopTokenSnapshot] = []
complete: bool = True
class UniswapTopPair24hSnapshot(BaseModel):
name: str
address: str
liquidity: float
volume24h: float
fee24h: float
class UniswapTopPairs24hSnapshot(AggregateBase):
pairs: List[UniswapTopPair24hSnapshot] = []
complete: bool = True
class UniswapTopPair7dSnapshot(BaseModel):
name: str
address: str
volume7d: float
fee7d: float
class UniswapTopPairs7dSnapshot(AggregateBase):
pairs: List[UniswapTopPair7dSnapshot] = []
complete: bool = True
class UniswapStatsSnapshot(AggregateBase):
volume24h: float = 0
tvl: float = 0
fee24h: float = 0
volumeChange24h: float = 0
tvlChange24h: float = 0
feeChange24h: float = 0
complete: bool = True