-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
34 lines (30 loc) · 1.15 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
type Vault @entity {
id: Bytes!
prizeClaims: [PrizeClaim!]! @derivedFrom(field: "vault") # prize claims for this draw
}
# TODO: Figure out the byte business going on with IDs.
# TODO: Create a User entity. Account is a combo of user + account.
# TODO: Add chain ID to IDs so we can dedupe in the future when aggregating subgraphs.
type Account @entity {
id: Bytes! # user's address
prizesWon: [PrizeClaim!]! @derivedFrom(field: "winner") # prize claims where this user is the winner
prizesReceived: [PrizeClaim!]! @derivedFrom(field: "winner") # prize claims where this user is the prize recipient
fees: [PrizeClaim!]! @derivedFrom(field: "feeRecipient") # prize claim fees earned by this user
}
type Draw @entity {
id: String! # draw ID
prizeClaims: [PrizeClaim!]! @derivedFrom(field: "draw") # prize claims for this draw
}
# Could be: "id: String! # vault ID + winner ID + draw ID + tier + chain ID" (with chainId)
type PrizeClaim @entity {
id: String! # vault ID + winner ID + draw ID + tier
draw: Draw!
vault: Vault!
winner: Account!
tier: Int!
payout: BigInt!
fee: BigInt!
to: Account!
feeRecipient: Account!
timestamp: BigInt!
}