-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathschema.graphql
More file actions
126 lines (117 loc) · 3.29 KB
/
schema.graphql
File metadata and controls
126 lines (117 loc) · 3.29 KB
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
type Platform @entity {
id: ID!
address: Bytes!
totalSale: BigInt
totalSaleInWei: BigInt
platformFirstSalePercentage: BigInt
platformSecondSalePercentage: BigInt
artistSecondSalePercentage: BigInt
lastModifiedTimestamp: BigInt
}
# TYPE @Master
# Master image with id of `tokenId`
# Contains layers (ControlTokens) of type `Layer` (see below)
type Master @entity {
id: ID! # unique `tokenId`
uri: String!
layerCount: Int!
layers: [Layer!]! @derivedFrom(field: "master")
creators: [Account!]!
owner: Account!
pastOwners: [Account!]! # inclusive of current owner
highBid: BidLog
pastBids: [BidLog!] @derivedFrom(field: "master")
lastUpdate: String # format `txHash-timestamp`
numUpdates: Int!
lastSale: SaleLog
pastSales: [SaleLog!] @derivedFrom(field: "master")
lastTransfer: TransferLog @derivedFrom(field: "master")
pastTransfers: [TransferLog!] @derivedFrom(field: "master")
buyNowPriceInWei: BigInt
}
# TYPE @Layer
# Represents the `ControlToken`
# Lives on a unique `Master`
# Contains lever(s) of type `Lever`
type Layer @entity {
id: ID! # unique `tokenId`
uri: String
numLevers: Int
levers: [Lever]! @derivedFrom(field: "layer")
owner: Account!
creators: [Account!]!
pastOwners: [Account!]! # inclusive of current owner
highBid: BidLog
pastBids: [BidLog!] @derivedFrom(field: "layer")
lastUpdate: String # format `txHash-timestamp`
numUpdates: Int!
allUpdates: [LayerUpdate!] @derivedFrom(field: "layer")
averageUpdateCost: BigInt # Average (gasPrice * gasUsed) for each associated `LayerUpdate` in wei
lastSale: SaleLog
pastSales: [SaleLog!] @derivedFrom(field: "layer")
lastTransfer: TransferLog @derivedFrom(field: "layer")
pastTransfers: [TransferLog!] @derivedFrom(field: "layer")
buyNowPriceInWei: BigInt
master: Master
}
# TYPE @LayerUpdate
# A transaction that updates some arbitrary number of `Levers` on a `Layer`
# Lives on a `Layer`
# Contains transaction metadata for `Layer` updates
type LayerUpdate @entity {
id: ID! # tx hash of `LayerUpdate` transaction
gasPrice: BigInt!
gasUsed: BigInt!
costInWei: BigInt!
layer: Layer
}
# TYPE @Lever
# Represents the state of a `ControlToken`
# Lives on a unique `Layer`
# Contains a list of values which map to `Layer` states
type Lever @entity {
id: ID! # unique `tokenId` + lever index ? TODO
minValue: Int!
maxValue: Int!
currentValue: Int!
layer: Layer
}
type Account @entity {
id: ID! # eth address of owner as `HexString`
isArtist: Boolean!
bids: [BidLog!] @derivedFrom(field: "bidder")
createdMasters: [Master!] @derivedFrom(field: "creators")
createdLayers: [Layer!] @derivedFrom(field: "creators")
ownedMasters: [Master!] @derivedFrom(field: "owner")
ownedLayer: [Layer!] @derivedFrom(field: "owner")
}
type SaleLog @entity {
id: ID!
timestamp: BigInt!
tokenId: String!
amountInWei: BigInt!
buyer: Account!
seller: Account!
master: Master
layer: Layer
}
type BidLog @entity {
id: ID!
timestamp: BigInt!
master: Master
layer: Layer
amountInWei: BigInt!
bidder: Account!
isWithdrawn: Boolean! # whether or not the bid has been withdrawn
wasSale: Boolean!
withdrawnTimestamp: BigInt
}
type TransferLog @entity {
id: ID!
timestamp: BigInt!
tokenId: String!
from: Account!
to: Account!
master: Master
layer: Layer
}