-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.ts
153 lines (125 loc) · 2.49 KB
/
types.ts
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
export interface Block {
number: number
timestamp: string
}
export interface ChartEntry {
date: number
volumeUSD: number
liquidityUSD: number
}
/**
* Formatted type for Candlestick charts
*/
export interface PriceChartEntry {
time: number
open: number
close: number
high: number
low: number
}
export enum TransactionType {
SWAP,
MINT,
BURN,
}
export type Transaction = {
type: TransactionType
hash: string
timestamp: string
sender: string
token0Symbol: string
token1Symbol: string
token0Address: string
token1Address: string
amountUSD: number
amountToken0: number
amountToken1: number
}
export interface ProtocolData {
volumeUSD: number
volumeUSDChange: number // in 24h, as percentage
liquidityUSD: number
liquidityUSDChange: number // in 24h, as percentage
txCount: number
txCountChange: number
}
export interface ProtocolState {
readonly overview?: ProtocolData
readonly chartData?: ChartEntry[]
readonly transactions?: Transaction[]
}
// POOLS
export interface PoolData {
address: string
token0: {
name: string
symbol: string
address: string
}
token1: {
name: string
symbol: string
address: string
}
volumeUSD: number
volumeUSDChange: number
volumeUSDWeek: number
volumeUSDChangeWeek: number
totalFees24h: number
totalFees7d: number
lpFees24h: number
lpFees7d: number
lpApr7d: number
liquidityUSD: number
liquidityUSDChange: number
token0Price: number
token1Price: number
liquidityToken0: number
liquidityToken1: number
}
export interface PoolsState {
byAddress: {
[address: string]: {
data?: PoolData
chartData?: ChartEntry[]
transactions?: Transaction[]
}
}
}
// TOKENS
export type TokenData = {
exists: boolean
name: string
symbol: string
address: string
volumeUSD: number
volumeUSDChange: number
volumeUSDWeek: number
txCount: number
liquidityToken: number
liquidityUSD: number
liquidityUSDChange: number
priceUSD: number
priceUSDChange: number
priceUSDChangeWeek: number
}
export interface TokensState {
byAddress: {
[address: string]: {
data?: TokenData
poolAddresses?: string[]
chartData?: ChartEntry[]
priceData: {
oldestFetchedTimestamp?: number
[secondsInterval: number]: PriceChartEntry[] | undefined
}
transactions?: Transaction[]
}
}
}
// Info redux state
export interface InfoState {
protocol: ProtocolState
pools: PoolsState
tokens: TokensState
}