-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
166 lines (152 loc) · 4.69 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
# The idea with event counters is that a backend (or anywhere) service can watch for changes in the number of events, and respond to that.
type EventCounter @entity {
id: ID! # this will have a fixed id of '1' since there will only be one place to count events.
buyEventCount: BigInt!
buyEvents: [BuyEvent!]
stateChanges: [StateChange]!
changePriceEventCount: BigInt
}
type Global @entity {
id: ID! # will just be '1' since only one global namespace
version: BigInt! # NOTE: this will say version 0 for version 0-2, after v3 it will always be correct.
totalCollected: BigInt!
totalCollectedAccurate: BigInt!
timeLastCollected: BigInt!
# totalCollectedOrDue: BigInt!
totalCollectedOrDueAccurate: BigInt!
# totalTokenCostScaledNumerator: BigInt! # Used to calculate the above value
totalTokenCostScaledNumeratorAccurate: BigInt! # Used to calculate the above value
# totalCollectedPortionOverstatedDueToForeclosures: BigInt! # only the portion that is overstated
# totalTokenCostScaledNumeratorForeclosedTokens: BigInt! # Used to calculate the above value
stewardAddress: Bytes!
erc721Address: Bytes!
defaultAuctionStartPrice: BigInt!
defaultAuctionEndPrice: BigInt!
defaultAuctionLength: BigInt!
}
type Wildcard @entity {
id: ID! # Just the tokenId
tokenId: BigInt!
currPrice: BigInt! #because it is useful to filter directly on the price!
price: Price!
owner: Patron! # address
patronageNumerator: BigInt!
patronageNumeratorPriceScaled: BigInt!
timeAcquired: BigInt!
previousOwners: [PreviousPatron!]
priceHistory: [Price!]
tokenUri: TokenUri!
totalCollected: BigInt!
timeCollected: BigInt! # this is the timestamp of the last collection on the wildcard not the total time collected for wildcard
auctionStartPrice: BigInt
launchTime: BigInt!
}
type TokenUri @entity {
id: ID!
uriString: String!
# -- parsing of this needs to be done on the client-side. JSON parsing still seems difficult in assemblyscript: https://github.com/AssemblyScript/assemblyscript/issues/292
# artist: String!
# name: String!
# type: String!
# ipfs: String!
}
type Price @entity {
id: ID!
price: BigInt!
timeSet: BigInt!
}
type PreviousPatron @entity {
id: ID!
patron: Patron!
timeAcquired: BigInt!
timeSold: BigInt!
}
type Patron @entity {
id: ID! # Just the address
address: Bytes! # address
lastUpdated: BigInt!
previouslyOwnedTokens: [Wildcard!]!
tokens: [Wildcard!]!
availableDeposit: BigInt! # only updated via depositAbleToWithdraw function
patronTokenCostScaledNumerator: BigInt!
effectivePatronTokenCostScaledNumerator: BigInt! # for when deposit = 0
foreclosureTime: BigInt! # timestamp in future when patron will foreclose (run out of deposit), zero if patron doensn't own tokens.
# deposit: BigInt!
totalContributed: BigInt!
totalTimeHeld: BigInt! # cumulative parallel time for each token (timePassed*patron.tokens.length)
totalLoyaltyTokens: BigInt!
totalLoyaltyTokensIncludingUnRedeemed: BigInt!
currentBalance: BigInt!
isMarkedAsForeclosed: Boolean!
}
type BuyEvent @entity {
id: ID! # tx id
token: Wildcard!
price: Price!
newOwner: Patron!
timestamp: BigInt!
}
type EventParam @entity {
id: ID!
index: Int!
param: String!
paramName: String!
paramType: String!
}
type EventParams @entity {
id: ID!
index: Int!
eventName: String!
params: [EventParam!]!
}
type StateChange @entity {
id: ID! # tx
timestamp: BigInt!
blockNumber: BigInt!
contractVersion: Int!
txEventParamList: [EventParams!]!
patronChanges: [Patron!]!
wildcardChanges: [Wildcard!]!
}
# # For every transaction, list the changes, and stat
# type StateChange @entity {
# id: ID! # tx
# timestamp: BigInt!
# blockNumber: BigInt!
# contractVersion: Int!
# txEventList: [String!]! #call event logs or something
# txEventParamListDeprecated: [String!]!
# txEventParamList: [EventParams!]
# patronChanges: [Patron!]!
# wildcardChanges: [Wildcard!]!
# }
type ChangePriceEvent @entity {
id: ID! # tx id
token: Wildcard!
price: Price!
timestamp: BigInt!
}
# Types for rewrite. Plan is to merge/replace the old entities when rewrite works.
type VoteStatus @entity {
id: ID! # <iteration>-<projectId>
projectVote: BigInt!
}
type Vote @entity {
id: ID! # <iteration>-<projectId>-<address>
voteAmount: BigInt!
voter: Patron!
}
type Iteration @entity {
id: ID! # the iteration number
projectVoteTallies: [VoteStatus!]
individualVotes: [Vote!]
totalVotes: BigInt!
winningProposal: BigInt!
fundsDistributed: BigInt!
winningVotes: BigInt!
}
type VoteManager @entity {
id: ID! # this should be a singleton. Give it a constant id of "VOTE_MANAGER"
currentIteration: Iteration!
latestCompleteIteration: Iteration
}