-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
122 lines (107 loc) · 2.11 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
enum ActionType {
IncreasePosition
DecreasePosition
UpdatePosition
ClosePosition
LiquidatePosition
Swap
BuyNDOL
SellNDOL
# Claim
# ZapSP :
# Deposit
# Withdraw
}
type Position @entity {
id: ID!
key: Bytes!
account: Account!
size: BigInt!
collateral: BigInt!
collateralToken: Bytes!
indexToken: Bytes!
isLong: Boolean!
averagePrice: BigInt!
entryFundingRate: BigInt!
reserveAmount: BigInt!
realisedPnl: BigInt!
lastIncreasedTime: BigInt!
}
# Polymorphism :))
type Action @entity {
id: ID!
type: ActionType!
account: Account!
timestamp: BigInt!
# IncreasePosition | DecreasePosition
collateralToken: Bytes
indexToken: Bytes
collateralDelta: BigInt
sizeDelta: BigInt
isLong: Boolean
price: BigInt
fee: BigInt
# UpdatePosition | ClosePosition | LiquidatePosition
realisedPnl: BigInt
# LiquidatePosition
key: Bytes
size: BigInt
collateral: BigInt
reserveAmount: BigInt
markPrice: BigInt
liquidatedStatus: BigInt
# UpdatePosition
averagePrice: BigInt
entryFundingRate: BigInt
# Swap
tokenIn: Bytes
tokenOut: Bytes
amountIn: BigInt
amountOut: BigInt
# BuyNDOL | SellNDOL
token: Bytes
tokenAmount: BigInt
ndolAmount: BigInt
# RedeemReward
amount: BigInt
# TODO:
# SentNDOL
# ReceivedNDOL
# DYT.transferMintedRewards
# DYT.claim
}
type LP @entity {
id: ID!
account: Account!
token: Bytes
tokenAmount: BigInt
ndolAmount: BigInt
}
type Collateral @entity {
id: ID!
feeReserves: BigInt!
guaranteedUsd: BigInt!
ndolAmounts: BigInt!
reservedAmounts: BigInt!
poolAmounts: BigInt!
cumulativeFundingRate: BigInt!
lastFundingTime: BigInt!
utilisationRate: BigInt!
longLiquidations: BigInt!
shortLiquidations: BigInt!
longs: BigInt!
shorts: BigInt!
longOpenInterest: BigInt!
shortOpenInterest: BigInt!
}
type Account @entity {
id: ID!
actions: [Action!]! @derivedFrom(field: "account")
positions: [Position!]! @derivedFrom(field: "account")
lps: [LP!]! @derivedFrom(field: "account")
}
type DirectPoolDeposit @entity {
id: ID!
token: Bytes! # address
amount: BigInt! # uint256
}