-
Notifications
You must be signed in to change notification settings - Fork 14
/
schema.graphql
169 lines (155 loc) · 4.19 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
type ContractRegistry @entity {
id: ID!
converterRegistries: [ConverterRegistry!]
contracts: [BancorContract!] @derivedFrom(field: "registry")
owner: String
}
type BancorContract @entity {
id: ID!
name: String
registry: ContractRegistry
}
type ConverterRegistry @entity {
id: ID!
converters: [Converter!]
smartTokens: [Token!]
connectorTokens: [Token!]
owner: String
addedToContractRegistryAtBlockTimestamp: BigInt
addedToContractRegistryAtTransactionHash: String
addedToContractRegistryAtBlockNumber: BigInt
lastUsedAtBlockTimestamp: BigInt
lastUsedAtTransactionHash: String
lastUsedAtBlockNumber: BigInt
numConverters: BigInt
}
type Converter @entity {
id: ID!
version: String
type: String
smartToken: Token
connectorTokens: [Token!]
connectors: [Connector!] @derivedFrom(field: "converter")
quickBuyPath: [QuickBuyPathMember!]
quickBuyPathLength: Int
owner: String
manager: String
conversionFee: BigInt
weight: BigInt
# maxWeight: BigInt
maxConversionFee: BigInt
lastResetBlockNumber: BigInt
lastResetTimestamp: BigInt
firstAddedToRegistryBlockNumber: BigInt
firstAddedToRegistryBlockTimestamp: BigInt
currentConverterRegistry: ConverterRegistry
currentContractRegistry: ContractRegistry
tokenBalances: [ConverterTokenBalance!] @derivedFrom(field: "converter")
tokenSwapTotals: [ConverterTokenSwapTotal!] @derivedFrom(field: "converter")
}
type QuickBuyPathMember @entity {
id: ID!
index: Int!
token: Token!
}
type Token @entity {
id: ID!
name: String
symbol: String
decimals: Int
isSmartToken: Boolean
version: String
standard: String
smartTokenType: String # Relay, Liquid, BNT?, Others?
transfersEnabled: Boolean
converters: [Converter!]
connectorTokens: [Token!]
shortestQuickBuyPath: [QuickBuyPathMember!]
converterWithShortestQuickBuyPath: Converter
owner: String
tokenSwapTotals: [TokenSwapTotal!] @derivedFrom(field: "toToken")
currentConverterRegistry: ConverterRegistry
addedToRegistryBlockNumber: BigInt
addedToRegistryTransactionHash: String
}
type Connector @entity {
id: ID!
virtualBalance: BigInt
weight: BigInt
isVirtualBalanceEnabled: Boolean
isPurchaseEnabled: Boolean
isSet: Boolean
connectorToken: Token
converter: Converter
}
type Swap @entity {
id: ID! # Concatenation of transaction hash + "-" + logIndex + "-" + trader address (User.id)
fromToken: Token!
toToken: Token!
amountPurchased: BigInt
amountReturned: BigInt
price: BigDecimal
inversePrice: BigDecimal
converterWeight: BigInt
converterFromTokenBalanceBeforeSwap: BigInt
converterFromTokenBalanceAfterSwap: BigInt
converterToTokenBalanceBeforeSwap: BigInt
converterToTokenBalanceAfterSwap: BigInt
slippage: BigDecimal
conversionFee: BigInt
converterUsed: Converter
transaction: Transaction
trader: User
timestamp: BigInt
logIndex: Int
}
type Transaction @entity {
id: ID!
blockNumber: BigInt
blockTimestamp: BigInt
gasUsed: BigInt
gasPrice: BigInt
swaps: [Swap!] @derivedFrom(field: "transaction")
}
type UserTokenSwapTotal @entity {
id: ID! # Concatenation of user, fromToken, and toToken addresses
user: User!
fromToken: Token!
toToken: Token!
totalAmountPurchased: BigInt
totalAmountReturned: BigInt
}
type TokenSwapTotal @entity {
id: ID! # Concatenation of fromToken and toToken addresses
fromToken: Token!
toToken: Token!
totalAmountPurchased: BigInt
totalAmountReturned: BigInt
}
type ConverterTokenSwapTotal @entity {
id: ID! # Concatenation of converter, fromToken, and toToken addresses
converter: Converter!
fromToken: Token!
toToken: Token!
totalAmountPurchased: BigInt
totalAmountReturned: BigInt
}
type ConverterTokenBalance @entity {
id: ID! # Concatenation of converter address and token address
converter: Converter
token: Token
balance: BigInt
}
type UserSmartTokenBalance @entity {
id: ID! # Concatenation of user and smartToken address
user: User!
smartToken: Token
balance: BigInt
}
type User @entity {
id: ID!
numSwaps: BigInt
swaps: [Swap!] @derivedFrom(field: "trader")
tokenSwapTotals: [UserTokenSwapTotal!] @derivedFrom(field: "user")
smartTokenBalances: [UserSmartTokenBalance!] @derivedFrom (field: "user")
}