-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
48 lines (45 loc) · 1.63 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
type TreasuryTransfer @entity(timeseries: true) {
id: Int8!
_from: Bytes! # address
_to: Bytes! # address
amountInflowETH: BigDecimal!
amountOutflowETH: BigDecimal!
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
timestamp: Timestamp!
tokenAddress: String!
source: String! # Source of the transfer (e.g., "Breed", "Marketplace", etc.)
treasury: Block!
}
type Block @entity(timeseries: true) {
# The id; it is the id of one of the data points that were aggregated into
# this bucket, but which one is undefined and should not be relied on
id: Int8!
# The timestamp of the bucket is always the timestamp of the beginning of
# the interval
timestamp: Timestamp!
amountETH: BigInt!
# amountAXS: BigInt!
transfers: [TreasuryTransfer!]! @derivedFrom(field: "treasury") # Derived relationship
blockNumber: BigInt!
blockTimestamp: BigInt!
# amountInflowETH: BigDecimal!
# amountOutflowETH: BigDecimal!
}
# Aggregations for daily intervals
type TreasuryTransferDay @aggregation(intervals: ["day"], source: "TreasuryTransfer") {
id: Int8!
timestamp: Timestamp!
count: Int! @aggregate(fn: "count")
totalInflowETH: BigDecimal! @aggregate(fn: "sum", arg: "amountInflowETH")
totalOutflowETH: BigDecimal! @aggregate(fn: "sum", arg: "amountOutflowETH")
}
# Aggregations for daily intervals
type TreasuryBlockDay @aggregation(intervals: ["day"], source: "Block") {
id: Int8!
timestamp: Timestamp!
blocksCount: Int! @aggregate(fn: "count")
# amountETH: BigInt! @aggregate(fn: "sum", arg: "amountETH")
# transfers: [TreasuryTransferDay!]! @derivedFrom(field: "transfers") # Derived relationship
}