update pool tx

This commit is contained in:
mihaisc 2021-09-10 13:49:37 +03:00
parent bcc520f38d
commit 028e83cbe6

View File

@ -1,9 +1,9 @@
type PoolFactory @entity { type PoolFactory @entity {
id: ID! id: ID!
totalValueLocked: [TokenValuePair] # total value locked represented in the base token totalValueLocked: [TokenValue] # total value locked represented in the base token
totalLiquidity: [TokenValuePair] # total liquidity for each base token totalLiquidity: [TokenValue] # total liquidity for each base token
totalSwapVolume: [TokenValuePair] # total swap volume for each base token totalSwapVolume: [TokenValue] # total swap volume for each base token
totalSwapFee: [TokenValuePair] # All the swap fee in Ocean totalSwapFee: [TokenValue] # All the swap fee in Ocean
poolCount: Int! # Number of pools poolCount: Int! # Number of pools
finalizedPoolCount: Int! # Number of finalized pools finalizedPoolCount: Int! # Number of finalized pools
@ -30,7 +30,7 @@ type Global @entity {
} }
type TokenValuePair @entity { type TokenValue @entity {
token : Token! token : Token!
value : BigDecimal! value : BigDecimal!
@ -63,8 +63,6 @@ type Token @entity {
block: Int # Block number when it was created block: Int # Block number when it was created
} }
type Pool @entity { type Pool @entity {
id: ID! # Pool address id: ID! # Pool address
poolFactory: PoolFactory! # Pool factory poolFactory: PoolFactory! # Pool factory
@ -103,9 +101,7 @@ type Pool @entity {
tokens: [PoolToken!] @derivedFrom(field: "poolId") tokens: [PoolToken!] @derivedFrom(field: "poolId")
shares: [PoolShare!] @derivedFrom(field: "poolId") shares: [PoolShare!] @derivedFrom(field: "poolId")
transactions: [PoolTransaction!] @derivedFrom(field: "poolAddress") transactions: [PoolTransaction!] @derivedFrom(field: "pool")
//this doesn't make sens, probably here because we had to link to pool
transactionsTokenValues: [PoolTransactionTokenValues!] @derivedFrom(field: "poolAddress")
} }
//PoolToken - all good as it is //PoolToken - all good as it is
@ -122,7 +118,6 @@ type PoolToken @entity {
decimals: Int # should we keep this, it is found on token? decimals: Int # should we keep this, it is found on token?
} }
type PoolShare @entity { type PoolShare @entity {
id: ID! # poolId + userAddress id: ID! # poolId + userAddress
user: User! user: User!
@ -132,42 +127,16 @@ type PoolShare @entity {
// Will be replaced with a generic PoolTokenValue WIP // Will be replaced with a generic PoolTokenValue WIP
type PoolTransactionTokenValues @entity {
id: ID! # pool tx + tokenAddress
txId: PoolTransaction!
// should be an array of PoolToken
poolToken: PoolToken!
// not sure if needed
poolAddress: Pool!
//not sure if needed
userAddress: User!
// we will have the poolToken array, what will this be?
tokenAddress: String!
// value of what?
value: BigDecimal!
// should be an array if we keep this
tokenReserve: BigDecimal!
feeValue: BigDecimal! # Swap fee value in OCEAN
type: String!
}
type PoolTransaction @entity { type PoolTransaction @entity {
id: ID! # pool tx id: ID! # pool tx
poolAddress --> pool: Pool pool: Pool # Pool related to this tx
userAddress --> user: User # User address that initiates the swap user: User # User that initiates the swap
poolAddressStr --> poolAddress: String!
userAddressStr --> userAddress: String! sharesTransferAmount: BigDecimal! # Number of shares transfered
sharesBalance: BigDecimal! # TODO: what is this?
sharesTransferAmount: BigDecimal! #
sharesBalance: BigDecimal!
spotPrice: BigDecimal!
// should not be here
consumePrice: BigDecimal!
tx: Bytes! tx: Bytes!
event: String event: String
block: Int! block: Int!
@ -175,20 +144,14 @@ type PoolTransaction @entity {
gasUsed: BigDecimal! gasUsed: BigDecimal!
gasPrice: BigDecimal! gasPrice: BigDecimal!
// should be an array, we will not have only ocean, it will be the tokens array tokens: [TokenValue!] # tokens transfered
oceanReserve: BigDecimal!
datatokenReserve: BigDecimal!
tokens: [PoolTransactionTokenValues!] @derivedFrom(field: "txId")
} }
// we will have 2 dt factories ?
type DatatokenFactory @entity { type DatatokenFactory @entity {
id: ID! id: ID!
tokenCount: Int! # Number of datatokens tokenCount: Int! # Number of datatokens
datatokens: [Datatoken!] @derivedFrom(field: "factoryID") datatokens: [Tokens!] @derivedFrom(field: "factory")
} }