-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphql
74 lines (68 loc) · 1.6 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
### Tickers and Positions
# Ticker entity represents unique derivative params
type Ticker @entity {
# derivative hash
id: ID!
# LibDerivative.Derivative-related data
margin: BigInt!
endTime: BigInt!
params: [BigInt!]!
oracleId: Bytes!
token: Bytes!
syntheticId: Bytes!
# positions-data
longPosition: Position!
shortPosition: Position!
# on-chain action-related metadata
createdAt: BigInt!
createdTx: Bytes!
}
# Position entity represents specific LONG / SHORT position params and data of the derivative
type Position @entity {
# position's address
id: ID!
# erc20-related data
name: String!
symbol: String!
totalSupply: BigInt!
# ticker-related data
isLong: Boolean!
ticker: Ticker!
endTime: BigInt!
}
# Holder entity represents Positions holders
type Holder @entity {
# account's address
id: ID!
# positions-related data
positions: [HolderPosition!]! @derivedFrom(field: "holder")
# on-chain action-related metadata
createdAt: BigInt!
createdTx: Bytes!
}
# HolderPosition entity connects Holders to Positions through Ticker
type HolderPosition @entity {
# Holder id + Ticker id
# `${holder.id}:${ticker.id}`
id: ID!
holder: Holder!
ticker: Ticker!
longBalance: BigInt!
shortBalance: BigInt!
}
### Oracles
type OracleId @entity {
# oracleId's account address
id: ID!
oracleData: [OracleData!] @derivedFrom(field: "oracleId")
}
type OracleData @entity {
# oracleId's account address + timestamp
id: ID!
oracleId: OracleId!
timestamp: BigInt!
data: BigInt!
# on-chain action-related metadata
createdAt: BigInt!
createdTx: Bytes!
}