-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
117 lines (105 loc) · 2.19 KB
/
schema.graphql
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
type Factory @entity {
id: Bytes!
pools: [Pool!] @derivedFrom(field: "factory")
}
type Pool @entity {
id: Bytes!
address: Bytes!
factory: Factory!
name: String!
symbol: String!
totalShares: BigDecimal!
swapFee: BigDecimal!
isInitialized: Boolean!
weights: [BigDecimal!]!
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
swapsCount: BigInt!
holdersCount: BigInt!
tokens: [PoolToken!]! @derivedFrom(field: "pool")
snapshots: [PoolSnapshot!]! @derivedFrom(field: "pool")
swaps: [Swap!]! @derivedFrom(field: "pool")
}
type PoolToken @entity {
id: Bytes!
pool: Pool!
token: Token!
name: String!
symbol: String!
decimals: Int!
address: Bytes!
balance: BigDecimal!
volume: BigDecimal!
surplus: BigDecimal!
swapFee: BigDecimal!
weight: BigDecimal!
index: Int!
}
type Token @entity {
id: Bytes!
name: String!
symbol: String!
decimals: Int!
address: Bytes!
}
type Swap @entity(immutable: true) {
id: Bytes!
pool: Pool!
tokenIn: Bytes!
tokenInSymbol: String!
tokenOutSymbol: String!
tokenAmountOut: BigDecimal!
expectedAmountOut: BigDecimal
tokenOut: Bytes!
tokenAmountIn: BigDecimal!
swapFeeToken: Bytes
swapFeeAmount: BigDecimal
surplusToken: Bytes
surplusAmount: BigDecimal
user: User!
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
logIndex: BigInt!
}
enum InvestType {
Add
Remove
}
type AddRemove @entity(immutable: true) {
id: Bytes!
type: InvestType!
sender: Bytes!
amounts: [BigDecimal!]!
pool: Pool!
user: User!
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
logIndex: BigInt!
}
type PoolShare @entity {
id: Bytes!
pool: Pool!
user: User!
balance: BigDecimal!
}
type PoolSnapshot @entity {
id: Bytes!
pool: Pool!
timestamp: Int!
totalShares: BigDecimal!
swapsCount: BigInt!
holdersCount: BigInt!
balances: [BigDecimal!]!
totalSwapFees: [BigDecimal!]!
totalSurpluses: [BigDecimal!]!
totalSwapVolumes: [BigDecimal!]!
}
type User @entity {
id: Bytes!
swaps: [Swap!] @derivedFrom(field: "user")
shares: [PoolShare!] @derivedFrom(field: "user")
addRemoves: [AddRemove!] @derivedFrom(field: "user")
}