-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
222 lines (195 loc) · 4.87 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
type Account @entity {
id: ID!
address: Bytes!
nftOwnership: [NftOwnership!] @derivedFrom(field: "account")
createdNfts: [Nft!] @derivedFrom(field: "artist")
auctions: [Auction!] @derivedFrom(field: "seller")
offers: [Offer!] @derivedFrom(field: "bidder")
}
type NftContract @entity {
id: ID!
name: String!
symbol: String!
category: String!
createdAt: BigInt!
searchText: String!
royalties: BigInt
royaltiesRecipient: Bytes
nfts: [Nft!]! @derivedFrom(field: "contract")
offers: [Offer!] @derivedFrom(field: "nftContract")
}
type NftOwnershipPerContract @entity {
id: ID!
account: Account!
contract: NftContract!
tokensCount: BigInt!
}
type NftOwnership @entity {
id: ID!
account: Account!
nft: Nft
value: BigInt!
#copy fields from nft because graph can't filter / sort on child collection
nftContractId: Bytes!
nftCategory: String
nftPrice: BigInt!
nftAuctionSortingPrice: BigDecimal!
nftBurned: Boolean!
nftCreatedAt: BigInt!
nftListedAt: BigInt!
nftIsOnSale: Boolean!
nftPaymentErc20TokenAddress: Bytes!
#denormalized for received offers query
nftOfferIds: [BigInt!]!
}
type Nft @entity {
id: ID!
contract: NftContract!
tokenId: BigInt!
type: String! #erc-721 or erc-1155
artist: Account
artistId: Bytes
category: String
burned: Boolean!
updatedAt: BigInt!
createdAt: BigInt!
#specific royalties for this nft
royalties: BigInt
#listing
listedAt: BigInt!
isOnSale: Boolean!
price: BigInt!
lastSalePrice: BigInt
auctionIds: [String!]!
paymentErc20TokenAddress: Bytes!
#metadata
tokenURI: String
name: String
description: String
image: String
thumbnail: String
attributes: [String!]
blockchain: String!
#denormalized for performance
contractId: Bytes!
contractName: String
auctionSortingPrice: BigDecimal!
searchText: String
#for erc-1155
supply: BigInt
ownershipId: String
ownership: [NftOwnership!] @derivedFrom(field: "nft")
auctions: [Auction!] @derivedFrom(field: "nft")
offers: [Offer!] @derivedFrom(field: "nft")
}
type Auction @entity {
id: ID!
seller: Account!
buyer: Bytes
paymentErc20TokenAddress: Bytes!
startingPrice: BigInt!
endingPrice: BigInt!
isDutch: Boolean!
startedAt: BigInt!
endingAt: BigInt!
nft: Nft!
tokenAmount: BigInt!
soldTokenAmount: BigInt!
totalPrice: BigInt
sourceVersion: SourceVersion!
# endingPrice in high denomination -> used for sorting on UI
sortingPrice: BigDecimal!
}
type Offer @entity {
id: ID!
nft: Nft
nftContract: NftContract!
bidder: Account!
paymentErc20TokenAddress: Bytes!
price: BigInt!
expiresAt: BigInt!
createdAt: BigInt!
isForCollection: Boolean!
sourceVersion: SourceVersion!
}
type Activity @entity {
id: ID!
nft: Nft
nftContract: NftContract
type: ActivityType!
createdAt: BigInt!
transactionHash: Bytes!
initiator: Account! #address of user who initiated activity
from: Account #This field is account that unifies “transferFrom, auctionSeller and offerAccepter depending of activity type
to: Account #This field is account that unifies “transferTo, auctionBuyer and offerBidder depending of activity type
price: BigInt #This field is price that unifies "offerPrice, privatePrice and auction starting price (if dutch auction); Depending on activity type"
totalPrice: BigInt #This field is total price that unifies "offerPrice, privatePrice and auction starting price (if dutch auction); Plus fee depending on activity type"
fee: BigInt #This field is fee that we get after auctionSuccess, offerAccept or privateSaleSuccess events
paymentErc20TokenAddress: Bytes
#auction activity
auctionStartingPrice: BigInt
#denormalized for queries
nftId: String
nftContractId: String
}
type CollectionHistoricData @entity {
id: ID! # collection address
totalCount: BigInt!
onSaleCount: BigInt!
volumeTraded: BigInt!
ownersCount: BigInt!
}
type UserHistoricData @entity {
id: ID! # user address
createdCount: BigInt!
ownedCount: BigInt!
onSaleCount: BigInt!
makerVolume: BigInt!
takerVolume: BigInt!
}
type CollectionHourData @entity {
##timestamp rounded to nearest hour
id: ID!
epoch: Int!
contractId: Bytes!
volumeTraded: BigInt!
paymentErc20TokenAddress: Bytes
}
type UserHourData @entity {
##timestamp rounded to nearest hour
id: ID!
epoch: Int!
accountId: Account!
makerVolume: BigInt!
takerVolume: BigInt!
paymentErc20TokenAddress: Bytes
}
type UserErc20Volume @entity {
id: ID!
makerVolume: BigInt!
takerVolume: BigInt!
paymentErc20TokenAddress: String
}
type CollectionErc20Volume @entity {
id: ID!
volumeTraded: BigInt!
paymentErc20TokenAddress: String
}
enum SourceVersion @entity {
V1
V2
}
enum ActivityType @entity {
mint
burn
transfer
auctionCreate
auctionSuccess
auctionCancel
offerCreate
offerAccept
offerCancel
reserveOffer
collectionOfferCreate
collectionOfferCancel
}