-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphql
198 lines (174 loc) · 3.25 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
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
enum ProposalState {
Null
Pending
Accepted
Rejected
Lapsed
Withdrawn
}
# vault-related entities
enum SpectreState {
Null
Locked
Unlocked
}
type NFT @entity {
id: ID! # address#id
collection: Bytes!
tokenId: BigInt!
tokenURI: String!
creator: Bytes!
}
type Spectre @entity {
id: ID! # ERC1155 tokenType
NFT: NFT!
sERC20: sERC20!
state: SpectreState!
vault: Bytes!
broker: Bytes!
timestamp: BigInt!
}
type SpectresCounter @entity {
id: String!
count: Int!
}
# sERC20-related entities
type sERC20 @entity {
id: ID! # ERC20 address
address: Bytes!
spectre: Spectre!
name: String!
symbol: String!
cap: BigInt!
minted: BigInt!
sale: Sale
issuance: Issuance
pool: Pool
holders: [sERC20Holder!]! @derivedFrom(field: "sERC20")
price: BigInt!
}
type sERC20Holder @entity {
id: ID!
address: Bytes!
amount: BigInt!
sERC20: sERC20!
}
# buyout-related entities
enum SaleState {
Null
Pending
Opened
Closed
}
type Sale @entity {
id: ID! # ERC20 address
sERC20: sERC20!
state: SaleState!
guardian: Bytes!
reserve: BigInt!
multiplier: BigInt!
opening: BigInt!
stock: BigInt!
flash: Boolean!
escape: Boolean!
proposals: [BuyoutProposal!]! @derivedFrom(field: "sale")
buyout: Buyout
}
type BuyoutProposal @entity {
id: ID!
sale: Sale!
state: ProposalState!
timestamp: BigInt!
buyer: Bytes!
value: BigInt!
collateral: BigInt!
expiration: BigInt!
}
type Buyout @entity {
id: ID!
sale: Sale!
timestamp: BigInt!
buyer: Bytes!
value: BigInt!
collateral: BigInt!
stock: BigInt!
claims: [Claim!]! @derivedFrom(field: "buyout")
}
type Claim @entity {
id: ID!
buyout: Buyout!
timestamp: BigInt!
holder: Bytes!
value: BigInt!
collateral: BigInt!
}
# issuance-related entities
enum IssuanceState {
Null
Opened
Closed
}
type Issuance @entity {
id: ID! # ERC20 address
sERC20: sERC20!
state: IssuanceState!
guardian: Bytes!
pool: Bytes!
poolId: Bytes!
reserve: BigInt!
allocation: BigInt!
fee: BigInt!
flash: Boolean
issues: [Issue!]! @derivedFrom(field: "issuance")
proposals: [IssuanceProposal!]! @derivedFrom(field: "issuance")
}
type Issue @entity {
id: ID!
issuance: Issuance!
timestamp: BigInt!
recipient: Bytes!
value: BigInt! # ETH
amount: BigInt! # sERC20!
}
type IssuanceProposal @entity {
id: ID!
issuance: Issuance!
state: ProposalState!
timestamp: BigInt!
buyer: Bytes!
value: BigInt!
price: BigInt!
expiration: BigInt!
}
# pool-related entities
type Pool @entity {
id: ID! # poolId
address: Bytes!
sERC20: sERC20!
sERC20IsToken0: Boolean!
states: [PoolState!]! @derivedFrom(field: "pool")
swaps: [Swap!]! @derivedFrom(field: "pool")
joins: [Join!]! @derivedFrom(field: "pool")
}
type PoolState @entity {
id: ID!
pool: Pool!
timestamp: BigInt!
balances: [BigInt!]! # sERC20 is always first, ETH second
weights: [BigInt!]! # sERC20 is always first, ETH second
price: BigDecimal! # in ETH per sERC20
}
type Swap @entity {
id: ID!
pool: Pool!
timestamp: BigInt!
from: Bytes!
amounts: [BigInt!]! # sERC20 is always first, ETH second
}
type Join @entity {
id: ID!
pool: Pool!
timestamp: BigInt!
from: Bytes!
amounts: [BigInt!]! # sERC20 is always first, ETH second
}