-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschema.graphql
76 lines (67 loc) · 1.83 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
# Base entities
type Donation @entity(immutable: true) {
id: Bytes!
from: Account!
to: Account!
amount: BigInt!
createdAtTimestamp: BigInt!
}
type Endorsement @entity(immutable: true) {
id: Bytes!
from: Account!
to: Account!
endorsementType: String!
easUid: Bytes!
donationAmount: BigInt!
createdAtTimestamp: BigInt!
}
type Withdrawal @entity(immutable: true) {
id: Bytes!
address: Account!
amount: BigInt!
createdAtTimestamp: BigInt!
}
type FeeWithdrawal @entity(immutable: true) {
id: Bytes!
# Event has a uint8 feeType, but we can store it as an Int8 as we will not overflow it
withdrawalType: String!
address: Bytes!
amount: BigInt!
}
# Aggregated entities
# Single account information
type Account @entity(immutable: false) {
id: Bytes! # address
# Relationships
receivedDonations: [Donation!]! @derivedFrom(field: "to")
receivedEndorsements: [Endorsement!]! @derivedFrom(field: "to")
withdrawals: [Withdrawal!]! @derivedFrom(field: "address")
sentDonations: [Donation!]! @derivedFrom(field: "from")
sentEndorsements: [Endorsement!]! @derivedFrom(field: "from")
# Aggregated data
totalDonationsReceived: BigInt!
totalEndorsementsReceived: BigInt!
totalDonationsSent: BigInt!
totalEndorsementsSent: BigInt!
# Other information
firstEndorsementReceivedTimestamp: BigInt
firstDonationReceivedTimestamp: BigInt
firstEndorsementSentTimestamp: BigInt
firstDonationSentTimestamp: BigInt
}
# User pair information (from - to)
type AggregatedInformation @entity(immutable: false) {
id: Bytes! # from - to
from: Account!
to: Account!
donationAmount: BigInt!
endorsementCount: BigInt!
}
# Global statistics
type GlobalStatistics @entity(immutable: false) {
id: Bytes!
totalEndorsements: BigInt!
totalDonations: BigInt!
totalDonationAmount: BigInt!
totalWithdrawnAmount: BigInt!
}