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