forked from JordanGallant/monsters.fun-demo-indexer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschema.graphql
114 lines (104 loc) · 3.22 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
type Monster {
id: ID! # Token Address
name: String!
symbol: String!
supply: BigInt!
price: BigDecimal!
marketCap: BigDecimal!
marketCapSnapshots: [MarketCapSnapshot!]! @derivedFrom(field: "monster")
totalVolumeTraded: BigInt! # total ethAmount of all buy / sells / trades
totalVolumeTradedSnapshots: [TotalVolumeTradedSnapshot!]! @derivedFrom(field: "monster")
trades: [Trade!]! @derivedFrom(field: "monster")
depositsTotal: BigInt! # total ethAmount of all trades where isBuy
withdrawalsTotal: BigInt! # total ethAmount of all trades where !isBuy
experiencePoints: BigDecimal!
battleOutcomes: [BattleOutcome!]! @derivedFrom(field: "monster")
totalWinsCount: Int! # total wins
totalLossesCount: Int! # total losses
winLoseRatio: Float! # wins / (wins + losses)
holdings: [CurrentHoldings!]! @derivedFrom(field: "monster")
isInBattle: Boolean! # true if there is a battle in progress
activeOpponent: String # address of the opponent in the current battle
contractOwner: String! # address of the owner of the monster contract
paused: Boolean! # true if the monster is paused
}
type MarketCapSnapshot {
id: ID! # txHash-logIndex
monster: String! @index
timestamp: BigInt! @index
supply: BigInt!
price: BigDecimal!
marketCap: BigDecimal!
}
type TotalVolumeTradedSnapshot {
id: ID! # txHash-logIndex
monster: String! @index
timestamp: BigInt! @index
totalVolumeTraded: BigInt!
}
type BattleOutcome {
id: ID! # txHash-logIndex
monster: String! @index
win: Boolean!
opponent: String! @index
transferredValue: BigInt! @index
timestamp: BigInt! @index
}
enum TradeType {
BUY
SELL
TRANSFER_IN
TRANSFER_OUT
}
type Trade {
id: ID! # txHash-logIndex-trader
txHash: String!
logIndexTransfer: Int!
logIndexTrade: Int!
monster: String!
trader: String! @index
tradeType: TradeType!
amount: BigInt! @index
ethAmount: BigInt! @index
blockTimestamp: BigInt! @index # Timestamp for 24-hour Data Queries # todo: make this an Int
blockNumber: BigInt!
}
type Trader {
id: ID! # Account Address
trades: [Trade!]! @derivedFrom(field: "trader")
numberOfTrades: Int!
holdings: [CurrentHoldings!]! @derivedFrom(field: "trader")
holdingsSnapshots: [HoldingsSnapshot!]! @derivedFrom(field: "trader")
whitelistPurchaseSnapshots: [WhitelistPurchaseSnapshot!]! @derivedFrom(field: "trader")
points: BigInt! # in 10^18
}
type CurrentHoldings {
id: ID! # monster-trader
monster: Monster! @index
trader: String! @index
balance: BigInt!
lastTradePrice: BigDecimal!
lastTradeMarketCap: BigDecimal!
totalHoldingsCost: BigDecimal!
totalHoldingsSales: BigDecimal!
}
type HoldingsSnapshot {
id: ID! # txHash-logIndex
monster: Monster! @index
price: BigDecimal!
trader: String! @index
balance: BigInt!
marketCap: BigDecimal!
timestamp: Int! @index
}
type WhitelistPurchaseSnapshot {
id: ID! # txHash-logIndex
monster: Monster! @index
trader: String! @index
timestamp: Int! @index
ethAmountPurchased: BigInt!
}
type GlobalStats {
id: ID! # 'global'
protocolFees: BigInt!
}