Skip to content

Commit 028e83c

Browse files
committed
update pool tx
1 parent bcc520f commit 028e83c

File tree

1 file changed

+14
-51
lines changed

1 file changed

+14
-51
lines changed

schema.graphql

+14-51
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
type PoolFactory @entity {
22
id: ID!
3-
totalValueLocked: [TokenValuePair] # total value locked represented in the base token
4-
totalLiquidity: [TokenValuePair] # total liquidity for each base token
5-
totalSwapVolume: [TokenValuePair] # total swap volume for each base token
6-
totalSwapFee: [TokenValuePair] # All the swap fee in Ocean
3+
totalValueLocked: [TokenValue] # total value locked represented in the base token
4+
totalLiquidity: [TokenValue] # total liquidity for each base token
5+
totalSwapVolume: [TokenValue] # total swap volume for each base token
6+
totalSwapFee: [TokenValue] # All the swap fee in Ocean
77

88
poolCount: Int! # Number of pools
99
finalizedPoolCount: Int! # Number of finalized pools
@@ -30,7 +30,7 @@ type Global @entity {
3030
}
3131

3232

33-
type TokenValuePair @entity {
33+
type TokenValue @entity {
3434

3535
token : Token!
3636
value : BigDecimal!
@@ -63,8 +63,6 @@ type Token @entity {
6363
block: Int # Block number when it was created
6464
}
6565

66-
67-
6866
type Pool @entity {
6967
id: ID! # Pool address
7068
poolFactory: PoolFactory! # Pool factory
@@ -103,9 +101,7 @@ type Pool @entity {
103101

104102
tokens: [PoolToken!] @derivedFrom(field: "poolId")
105103
shares: [PoolShare!] @derivedFrom(field: "poolId")
106-
transactions: [PoolTransaction!] @derivedFrom(field: "poolAddress")
107-
//this doesn't make sens, probably here because we had to link to pool
108-
transactionsTokenValues: [PoolTransactionTokenValues!] @derivedFrom(field: "poolAddress")
104+
transactions: [PoolTransaction!] @derivedFrom(field: "pool")
109105
}
110106

111107
//PoolToken - all good as it is
@@ -122,7 +118,6 @@ type PoolToken @entity {
122118
decimals: Int # should we keep this, it is found on token?
123119
}
124120

125-
126121
type PoolShare @entity {
127122
id: ID! # poolId + userAddress
128123
user: User!
@@ -132,63 +127,31 @@ type PoolShare @entity {
132127

133128
// Will be replaced with a generic PoolTokenValue WIP
134129

135-
type PoolTransactionTokenValues @entity {
136-
id: ID! # pool tx + tokenAddress
137-
txId: PoolTransaction!
138130

139-
// should be an array of PoolToken
140-
poolToken: PoolToken!
141-
// not sure if needed
142-
poolAddress: Pool!
143-
//not sure if needed
144-
userAddress: User!
131+
type PoolTransaction @entity {
132+
id: ID! # pool tx
133+
pool: Pool # Pool related to this tx
134+
user: User # User that initiates the swap
145135

146-
// we will have the poolToken array, what will this be?
147-
tokenAddress: String!
136+
sharesTransferAmount: BigDecimal! # Number of shares transfered
137+
sharesBalance: BigDecimal! # TODO: what is this?
148138

149-
// value of what?
150-
value: BigDecimal!
151139

152-
// should be an array if we keep this
153-
tokenReserve: BigDecimal!
154-
feeValue: BigDecimal! # Swap fee value in OCEAN
155-
type: String!
156-
}
157-
158-
type PoolTransaction @entity {
159-
id: ID! # pool tx
160-
poolAddress --> pool: Pool
161-
userAddress --> user: User # User address that initiates the swap
162-
poolAddressStr --> poolAddress: String!
163-
userAddressStr --> userAddress: String!
164-
165-
sharesTransferAmount: BigDecimal! #
166-
sharesBalance: BigDecimal!
167-
168-
spotPrice: BigDecimal!
169-
// should not be here
170-
consumePrice: BigDecimal!
171140
tx: Bytes!
172141
event: String
173142
block: Int!
174143
timestamp: Int!
175144
gasUsed: BigDecimal!
176145
gasPrice: BigDecimal!
177146

178-
// should be an array, we will not have only ocean, it will be the tokens array
179-
oceanReserve: BigDecimal!
180-
datatokenReserve: BigDecimal!
181-
182-
tokens: [PoolTransactionTokenValues!] @derivedFrom(field: "txId")
147+
tokens: [TokenValue!] # tokens transfered
183148
}
184149

185150

186-
// we will have 2 dt factories ?
187151
type DatatokenFactory @entity {
188152
id: ID!
189-
190153
tokenCount: Int! # Number of datatokens
191-
datatokens: [Datatoken!] @derivedFrom(field: "factoryID")
154+
datatokens: [Tokens!] @derivedFrom(field: "factory")
192155
}
193156

194157

0 commit comments

Comments
 (0)