-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
154 lines (144 loc) · 3.07 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
enum State {
Open
Closed
Awarding_Winner
Randomness_Fulfilled
}
type PrizeProtocol @entity {
# ID: set to 1
id: ID!
# Address of the protocol
address: Bytes!
# Name
name: String!
# Address of the owner
owner: Bytes!
# Address of the controller
controller: Bytes!
# Drawing period
drawingPeriod: BigInt!
# Minimum deposit
minimumDeposit: BigInt!
# ==================== Tokens ====================
# Token address
token: Bytes!
# Token name
tokenName: String!
# Token symbol
tokenSymbol: String!
# cToken address
cToken: Bytes!
# cToken name
cTokenName: String!
# cToken symbol
cTokenSymbol: String!
# Native Token (PRZ) address
nativeToken: Bytes!
# Native Token (PRZ) name
nativeTokenName: String!
# Native Token (PRZ) symbol
nativeTokenSymbol: String!
# Ticket address
ticket: Bytes!
# Ticket name
ticketName: String!
# Ticket symbol
ticketSymbol: String!
# ================================================
# Amount deposited
amountDeposited: BigInt!
# Reserve
reserve: BigInt!
# Prize Pool
prizePool: BigInt!
# Lotteries
lotteries: [Lottery!]! @derivedFrom(field: "protocol")
# Players
players: [Player!] @derivedFrom(field: "protocol")
# Winners
wins: [Win!] @derivedFrom(field: "protocol")
}
type Lottery @entity {
# ID: `${lotteryId}`
id: ID!
# Protocol
protocol: PrizeProtocol!
# State
state: State!
# Timestamp of the start of the lottery run
startTimestamp: BigInt!
# Timestamp of the end of the lottery run
endTimestamp: BigInt
# Amount deposited
amountDeposited: BigInt!
# Reserve
reserve: BigInt!
# Prize Pool
prizePool: BigInt!
# Winner
win: Win
# Players
players: [Player!] @derivedFrom(field: "lottery")
# Deposits
deposits: [Deposit!] @derivedFrom(field: "lottery")
# Redeems
redeems: [Redeem!] @derivedFrom(field: "lottery")
}
type Player @entity {
# ID: `${player.address}`
id: ID!
# Address of the player
address: Bytes!
# Protocol
protocol: PrizeProtocol!
# Lottery entered
lottery: Lottery!
# Every deposit
deposits: [Deposit!]! @derivedFrom(field: "from")
# Every redeem
redeems: [Redeem!] @derivedFrom(field: "from")
# Ticket balance
balance: BigInt!
}
type Deposit @entity {
# ID: `${transaction.hash}`
id: ID!
# Timestamp
timestamp: BigInt!
# Protocol
protocol: PrizeProtocol!
# Lottery where the deposit happened
lottery: Lottery!
# Address of the player that deposited
from: Player!
# Amount of tokens deposited and tickets minted
amount: BigInt!
}
type Redeem @entity {
# ID: `${transaction.hash}`
id: ID!
# Timestamp
timestamp: BigInt!
# Protocol
protocol: PrizeProtocol!
# Lottery where the redeem happened
lottery: Lottery!
# Address of the player that redeemed
from: Player!
# Amount of tokens redeemed and tickets burned
amount: BigInt!
}
type Win @entity {
# ID: `${transaction.hash}`
id: ID!
# Timestamp
timestamp: BigInt!
# Winner
winner: Player!
# Amount
amount: BigInt!
# Protocol
protocol: PrizeProtocol!
# Lottery
lottery: Lottery!
}