-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.graphql
116 lines (108 loc) · 2.78 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
type Converter @entity {
id: ID!
activated: Boolean!
anchor: String!
"Conversion fee in decimal format"
conversionFee: BigDecimal!
factory: String!
priceOracle: String
platform: PlatformStat!
type: BigInt!
version: BigInt!
createdAtTimestamp: BigInt!
createdAtTransaction: String!
createdAtBlockNumber: BigInt!
createdAtLogIndex: BigInt!
upgradedTo: Converter
upgradedFrom: Converter
numSwaps: BigInt!
balances: [ConverterBalance!]! @derivedFrom(field: "converter")
swaps: [Swap!]! @derivedFrom(field: "converter")
volumes: [VolumeStat!]! @derivedFrom(field: "converter")
poolTokens: [PoolToken!]! @derivedFrom(field: "converter")
}
type ConverterBalance @entity {
id: ID! # Converter - Token
converter: Converter!
"Reserve token"
token: Token!
"Ownership token"
poolToken: PoolToken
"Staked balance of reserve token"
stakedAmount: BigDecimal!
"Actual balance of reserve token"
balance: BigDecimal!
"Weight"
weight: BigDecimal!
}
type LiquidityProviderBalance @entity {
id: ID! # Account - PoolToken
provider: User!
poolToken: PoolToken!
# ownership: BigDecimal!
poolTokenAmount: BigDecimal!
# underlyingToken: Token!
# underlyingAmount: BigInt!
}
type VolumeStat @entity {
id: ID! # Converter - Token
converter: Converter
token: Token!
sellVolume: BigDecimal!
buyVolume: BigDecimal!
totalVolume: BigDecimal!
platform: PlatformStat!
}
type Token @entity {
id: ID!
name: String!
symbol: String!
decimals: BigInt!
converterVolumes: [VolumeStat!]! @derivedFrom(field: "token")
}
type PoolToken @entity {
id: ID!
converter: Converter!
name: String!
symbol: String!
decimals: BigInt!
supply: BigDecimal!
"Value of PoolToken, in terms of reserve token"
shareValue: BigDecimal!
"Value of PoolToken, in terms of ETH"
shareValueEth: BigDecimal!
# underlyingTokens: [ReserveToken!]! @derivedFrom(field: "poolToken")
underlyingToken: Token!
}
type User @entity {
id: ID!
swaps: [Swap!]! @derivedFrom(field: "trader")
liquidity: [LiquidityProviderBalance!]! @derivedFrom(field: "provider")
}
type Swap @entity {
id: ID! # Transaction hash - log index
converter: Converter!
"Conversion fee, paid in toToken"
conversionFee: BigDecimal!
fromToken: Token!
fromAmount: BigDecimal!
toToken: Token!
toAmount: BigDecimal!
"fromAmount div toAmount"
price: BigDecimal!
trader: User!
txTo: String!
txFrom: String!
createdAtTimestamp: BigInt!
createdAtTransaction: String!
createdAtBlockNumber: BigInt!
createdAtLogIndex: BigInt!
}
type PlatformStat @entity {
id: ID! # Always "Bancor"
numActiveConverters: BigInt!
numConvertersTracked: BigInt!
swaps: BigInt!
converters: [Converter!]! @derivedFrom(field: "platform")
converterVolumes: [VolumeStat!]! @derivedFrom(field: "platform")
}