forked from asyncart/async-subgraph_v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
174 lines (162 loc) · 4.34 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
#####################################
####### GLOBAL STATE TOP LEVEL ######
#####################################
type GlobalState @entity {
id: ID! #Singleton "MASTER"
latestMasterTokenId: BigInt!
currentExpectedTokenSupply: BigInt!
minBidIncreasePercent: BigInt!
artistSecondSalePercentage: BigInt!
platformAddress: Bytes!
totalSaleAmount: BigInt!
tokenMasterIDs: [BigInt!]!
}
#####################################
####### TOKEN & DERIVED OBJECTS #####
#####################################
type Token @entity {
id: ID! # token id
owner: User # No owner if its only whitelisted
previousOwner: User
tokenId: BigInt!
uri: String # Will be empty if only whitelisted
isMaster: Boolean!
tokenMaster: TokenMaster
tokenController: TokenController
currentBid: Bid
pastBids: [Bid!]
platformFirstSalePercentage: BigInt!
platformSecondSalePercentage: BigInt!
currentBuyPrice: BigInt!
lastSale: Sale
allSales: [Sale!]
numberOfSales: BigInt!
lastTransfer: TokenTransfer
allTransfers: [TokenTransfer!]
uniqueTokenCreators: [User!]
pastOwners: [User!]
tokenDidHaveFirstSale: Boolean!
permissionedAddress: Bytes
}
type TokenMaster @entity {
id: ID! # token id - "Master"
layerCount: BigInt!
tokenDetails: Token!
layers: [TokenController!] # These are difficult to define as non-nullable depending on token migration order from v1
}
type TokenController @entity {
id: ID! # token id - "Controller"
numControlLevers: BigInt!
numRemainingUpdates: BigInt!
numberOfUpdates: BigInt!
averageUpdateCost: BigInt
isSetup: Boolean!
tokenDetails: Token!
associatedMasterToken: TokenMaster # These are difficult to define as non-nullable depending on token migration order from v1
levers: [TokenControlLever!] # will be null if not set up
lastUpdate: LayerUpdate
allUpdates: [LayerUpdate!]
}
type TokenControlLever @entity {
id: ID! # token ID - token lever ID
numberOfUpdates: BigInt!
minValue: BigInt!
maxValue: BigInt!
currentValue: BigInt!
previousValue: BigInt!
layer: TokenController!
latestUpdate: LayerUpdate
}
type LayerUpdate @entity {
id: ID! # token id - 'update number'
updateNumber: BigInt!
gasPrice: BigInt!
gasUsed: BigInt!
costInWei: BigInt!
priorityTip: BigInt!
layer: TokenController!
leversUpdated: [TokenControlLever!]!
userPerformingUpdate: User!
}
#####################################
########## PLATFORM USERS ###########
#####################################
type User @entity {
id: ID! # users address
isArtist: Boolean!
totalSalesAmount: BigInt!
totalBuysAmount: BigInt!
numberOfBuys: BigInt!
numberOfSells: BigInt!
numberOfBids: BigInt!
numberOfLayerUpdates: BigInt!
numberOfCreatedMasters: BigInt!
numberOfCreatedControllers: BigInt!
numberOfOwnedMasters: BigInt!
numberOfOwnedControllers: BigInt!
layerUpdates: [LayerUpdate!]
bids: [Bid!]
buys: [Sale!]
sells: [Sale!]
createdMasters: [TokenMaster!]
createdControllers: [TokenController!]
ownedMasters: [TokenMaster!]
ownerControllers: [TokenController!]
}
#####################################
########## SALES AND BIDS ###########
#####################################
type Bid @entity {
id: ID! # tokenId - txhash
tokenDetails: Token!
bidAmount: BigInt!
bidder: User! #Change to user object
bidTimestamp: BigInt!
bidActive: Boolean!
bidAccepted: Boolean!
BidWithdrawnTimestamp: BigInt
}
type Sale @entity {
id: ID! # tokenId - tokenSaleNumber (i.e. "1-3" Token1, 3rd sale)
tokenDetails: Token!
buyer: User!
seller: User!
salePrice: BigInt!
tokenSaleNumber: BigInt! # i.e. this was the 3rd sale of this token
saleTimestamp: BigInt!
isBidSale: Boolean!
bidDetails: Bid
}
type TokenTransfer @entity {
id: ID! # tokenId - tx timestamp
tokenDetails: Token!
to: User!
from: User!
timestamp: BigInt!
}
#####################################
####### STATE AND EVENT CHANGES #####
#####################################
type EventParam @entity {
id: ID!
index: Int!
param: String!
paramName: String!
paramType: String!
}
type EventParams @entity {
id: ID!
index: Int!
eventName: String!
params: [EventParam!]!
}
# For every transaction, list the changes, and stat
type StateChange @entity {
id: ID! # tx
timestamp: BigInt!
blockNumber: BigInt!
contractVersion: Int!
txEventParamList: [EventParams!]
userChanges: [User!]
tokenChanges: [Token!]
}