schema updates

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>
This commit is contained in:
mihaisc 2021-09-13 16:20:29 +03:00
parent 028e83cbe6
commit d8c0d1c9ae
No known key found for this signature in database
GPG Key ID: 4FB0C2329B4C6E29

View File

@ -13,6 +13,11 @@ type PoolFactory @entity {
pools: [Pool!] @derivedFrom(field: "factoryID")
}
type DatatokenFactory @entity {
id: ID!
tokenCount: Int! # Number of datatokens
datatokens: [Tokens!] @derivedFrom(field: "factory")
}
type Global @entity {
id: ID!
@ -29,15 +34,13 @@ type Global @entity {
finalizedPoolCount: Int! # Number of finalized pools for all factories
}
type TokenValue @entity {
type TokenValue {
token : Token!
value : BigDecimal!
}
type Token @entity {
id: ID! #
symbol: String #
@ -104,8 +107,6 @@ type Pool @entity {
transactions: [PoolTransaction!] @derivedFrom(field: "pool")
}
//PoolToken - all good as it is
type PoolToken @entity {
id: ID! # poolId + token address
pool: Pool! #
@ -125,9 +126,6 @@ type PoolShare @entity {
balance: BigDecimal!
}
// Will be replaced with a generic PoolTokenValue WIP
type PoolTransaction @entity {
id: ID! # pool tx
pool: Pool # Pool related to this tx
@ -147,50 +145,9 @@ type PoolTransaction @entity {
tokens: [TokenValue!] # tokens transfered
}
type DatatokenFactory @entity {
id: ID!
tokenCount: Int! # Number of datatokens
datatokens: [Tokens!] @derivedFrom(field: "factory")
}
type MetadataUpdate @entity {
id: ID! # update tx + datatokenAddress
datatokenId: Datatoken!
datatokenAddress: String!
userAddress: String!
//all fields from the market edit
name
description
author
links
timeout
block: Int!
timestamp: Int!
tx: Bytes!
}
type Asset {
did
name
description
author
services ? [ access, compute ] ?
datatoken : Datatoken
}
type TokenOrder @entity {
type Order @entity { # renamed from TokenOrder to Order
id: ID! # datatokenId + userAddress + tx
datatokenId: Datatoken!
token: Token!
consumer: User!
payer: User!
@ -204,18 +161,11 @@ type TokenOrder @entity {
block: Int!
}
type TokenBalance @entity {
id: ID! # datatokenId + userAddress
userAddress: User!
datatokenId: Datatoken!
balance: BigDecimal!
}
type TokenTransaction @entity {
id: ID! # Log ID
event: String
datatokenAddress: Datatoken
userAddress: User
token: Token
user: User
block: Int!
gasUsed: BigDecimal!
@ -226,26 +176,20 @@ type TokenTransaction @entity {
type User @entity {
id: ID!
sharesOwned: [PoolShare!] @derivedFrom(field: "userAddress")
tokenBalancesOwned: [TokenBalance!] @derivedFrom(field: "userAddress")
tokensOwned: [Datatoken!] @derivedFrom(field: "minter")
poolTransactions: [PoolTransaction!] @derivedFrom(field: "userAddress")
poolTransactionsTokenValues: [PoolTransactionTokenValues!]
@derivedFrom(field: "userAddress")
tokenTransactions: [TokenTransaction!] @derivedFrom(field: "userAddress")
orders: [TokenOrder!] @derivedFrom(field: "payer")
sharesOwned: [PoolShare!] @derivedFrom(field: "user")
tokenBalancesOwned: [TokenValue!]
tokensOwned: [Token!] @derivedFrom(field: "minter")
poolTransactions: [PoolTransaction!] @derivedFrom(field: "user")
tokenTransactions: [TokenTransaction!] @derivedFrom(field: "user")
orders: [Order!] @derivedFrom(field: "payer")
freSwaps: [FixedRateExchangeSwap!] @derivedFrom(field: "by")
}
type FixedRateExchange @entity {
id: ID! # fixed rate exchange id
exchangeOwner: User!
datatoken: Datatoken!
// will be a token not just an address
baseToken: String!
// no need for this, since it will be on token
baseTokenSymbol: String!
datatoken: Token!
baseToken: Token!
rate: BigDecimal!
active: Boolean!
updates: [FixedRateExchangeUpdate!] @derivedFrom(field: "exchangeId")
@ -322,3 +266,35 @@ type PoolSnapshot @entity {
tokens: [PoolSnapshotTokenValue!] @derivedFrom(field: "poolSnapshot")
}
type MetadataUpdate @entity {
id: ID! # update tx + datatokenAddress
datatokenId: Datatoken!
datatokenAddress: String!
userAddress: String!
//all fields from the market edit
name
description
author
links
timeout
block: Int!
timestamp: Int!
tx: Bytes!
}
type Asset {
did
name
description
author
services ? [ access, compute ] ?
datatoken : Datatoken
}