-
Notifications
You must be signed in to change notification settings - Fork 2
/
schema.graphql
96 lines (90 loc) · 1.89 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
### GENERIC TYPES ***
"""
Represents a collateral or debt position.
"""
type Position @entity {
"User Ethereum address concatenated with token contract address"
id: ID!
"Token amount"
amount: BigDecimal!
"Token details"
token: Token!
}
"""
Represents a basic ERC20 token.
"""
type Token @entity {
"Contract address"
id: ID!
"Token decimals"
decimals: Int!
"Token name"
name: String!
"Token symbol"
symbol: String!
}
"""
High-level overview.
"""
type Hifi @entity {
"Always set to 1"
id: ID!
"Array of all listed bonds"
listedBonds: [Token!]!
"Array of all listed collaterals"
listedCollaterals: [Token!]!
"Array of all AMM pools"
pools: [Pool!]!
"Array of all user vaults"
vaults: [Vault!]!
}
"""
Stores the collaterals deposited by the user, along with the debts.
"""
type Vault @entity {
"User Ethereum address"
id: ID!
"Collaterals deposited"
collaterals: [Position!]!
"Creation block timestamp"
createTime: BigInt!
"Debts owed by the vault owner"
debts: [Position!]!
}
"""
Stores the pool reserves, along with the swaps.
"""
type Pool @entity {
"Pool contract address"
id: ID!
"HToken in pool"
hToken: Token!
"Pool reserve of hToken"
hTokenReserve: BigDecimal!
"The hToken maturity timestamp"
maturity: BigInt!
"Array of all pool trades"
swaps: [Swap!]! @derivedFrom(field: "pool")
"Underlying in pool"
underlying: Token!
"Pool reserve of underlying token"
underlyingReserve: BigDecimal!
}
type Swap @entity {
"Sequential id"
id: ID!
"Account that sends token being sold"
from: Bytes!
"hTokens swapped"
hTokenAmount: BigDecimal!
"Pool where swap occurred"
pool: Pool!
"Fee paid by user for swap (in underlying)"
swapFee: BigDecimal!
"Timestamp for when the swap happened"
timestamp: BigInt!
"Account that receives token being bought"
to: Bytes!
"Underlying tokens swapped"
underlyingAmount: BigDecimal!
}