2020-12-02 11:07:09 +01:00
|
|
|
type PoolFactory @entity {
|
2020-11-20 13:12:02 +01:00
|
|
|
id: ID!
|
2020-12-02 11:07:09 +01:00
|
|
|
|
2021-02-09 11:13:31 +01:00
|
|
|
totalValueLocked: BigDecimal # total value from all pools expressed in OCEAN
|
|
|
|
|
|
|
|
totalOceanLiquidity: BigDecimal! # Total of OCEAN liquidity from all pools
|
2020-11-20 13:12:02 +01:00
|
|
|
totalSwapVolume: BigDecimal! # All the swap volume in Ocean
|
|
|
|
totalSwapFee: BigDecimal! # All the swap fee in Ocean
|
2020-12-02 11:07:09 +01:00
|
|
|
|
|
|
|
poolCount: Int! # Number of pools
|
|
|
|
finalizedPoolCount: Int! # Number of finalized pools
|
|
|
|
|
|
|
|
pools: [Pool!] @derivedFrom(field: "factoryID")
|
2020-11-20 13:12:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type Pool @entity {
|
|
|
|
id: ID! # Pool address
|
2020-12-02 11:07:09 +01:00
|
|
|
factoryID: PoolFactory!
|
2020-11-20 13:12:02 +01:00
|
|
|
controller: Bytes! # Controller address
|
|
|
|
publicSwap: Boolean! # isPublicSwap
|
|
|
|
finalized: Boolean! # isFinalized
|
|
|
|
symbol: String # Pool token symbol
|
|
|
|
name: String # Pool token name
|
|
|
|
cap: BigInt # Maximum supply if any
|
|
|
|
active: Boolean! # isActive
|
|
|
|
swapFee: BigDecimal! # Swap Fees
|
2020-12-02 11:07:09 +01:00
|
|
|
|
2020-11-20 13:12:02 +01:00
|
|
|
totalWeight: BigDecimal!
|
|
|
|
totalShares: BigDecimal! # Total pool token shares
|
|
|
|
totalSwapVolume: BigDecimal! # Total swap volume in OCEAN
|
|
|
|
totalSwapFee: BigDecimal! # Total swap fee in OCEAN
|
2020-12-02 11:07:09 +01:00
|
|
|
|
2021-02-09 11:13:31 +01:00
|
|
|
valueLocked: BigDecimal! # value locked in pool expressed in OCEAN (captures both Ocean and Datatoken)
|
2020-12-02 11:07:09 +01:00
|
|
|
datatokenReserve: BigDecimal! # Total pool reserve of Datatoken
|
|
|
|
oceanReserve: BigDecimal! # Total pool reserve of OCEAN
|
|
|
|
spotPrice: BigDecimal!
|
|
|
|
consumePrice: BigDecimal!
|
|
|
|
|
|
|
|
tokenCount: BigInt! # Number of tokens in the pool
|
|
|
|
holderCount: BigInt! # Number of addresses holding a positive balance of pool shares
|
|
|
|
joinCount: BigInt! # liquidity has been added
|
|
|
|
exitCount: BigInt! # liquidity has been removed
|
|
|
|
swapCount: BigInt!
|
2020-12-09 11:54:13 +01:00
|
|
|
transactionCount: BigInt! # Number of transactions in this pool involving liquidity changes
|
2020-12-02 11:07:09 +01:00
|
|
|
|
|
|
|
datatokenAddress: String!
|
2020-11-20 13:12:02 +01:00
|
|
|
createTime: Int! # Block time pool was created
|
|
|
|
tx: Bytes # Pool creation transaction id
|
2020-12-02 11:07:09 +01:00
|
|
|
|
|
|
|
tokens: [PoolToken!] @derivedFrom(field: "poolId")
|
|
|
|
shares: [PoolShare!] @derivedFrom(field: "poolId")
|
|
|
|
transactions: [PoolTransaction!] @derivedFrom(field: "poolAddress")
|
2020-12-02 17:20:29 +01:00
|
|
|
transactionsTokenValues: [PoolTransactionTokenValues!] @derivedFrom(field: "poolAddress")
|
2020-11-20 13:12:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type PoolToken @entity {
|
|
|
|
id: ID! # poolId + token address
|
|
|
|
poolId: Pool!
|
2020-11-26 07:38:08 +01:00
|
|
|
tokenId: Datatoken
|
2020-12-02 11:07:09 +01:00
|
|
|
tokenAddress: String
|
2020-11-20 13:12:02 +01:00
|
|
|
balance: BigDecimal!
|
|
|
|
denormWeight: BigDecimal!
|
|
|
|
}
|
|
|
|
|
|
|
|
type PoolShare @entity {
|
|
|
|
id: ID! # poolId + userAddress
|
|
|
|
userAddress: User!
|
|
|
|
poolId: Pool!
|
|
|
|
balance: BigDecimal!
|
|
|
|
}
|
|
|
|
|
2020-12-02 11:07:09 +01:00
|
|
|
type PoolTransactionTokenValues @entity {
|
|
|
|
id: ID! # pool tx + tokenAddress
|
|
|
|
txId: PoolTransaction!
|
|
|
|
poolToken: PoolToken!
|
2020-12-02 17:20:29 +01:00
|
|
|
poolAddress: Pool!
|
|
|
|
userAddress: User!
|
|
|
|
tokenAddress: String!
|
|
|
|
|
2020-12-02 11:07:09 +01:00
|
|
|
value: BigDecimal!
|
|
|
|
tokenReserve: BigDecimal!
|
|
|
|
feeValue: BigDecimal! # Swap fee value in OCEAN
|
|
|
|
type: String!
|
2020-11-20 13:12:02 +01:00
|
|
|
}
|
|
|
|
|
2020-12-02 11:07:09 +01:00
|
|
|
type PoolTransaction @entity {
|
|
|
|
id: ID! # pool tx
|
2020-11-20 13:12:02 +01:00
|
|
|
poolAddress: Pool
|
|
|
|
userAddress: User # User address that initiates the swap
|
2020-12-02 17:20:29 +01:00
|
|
|
poolAddressStr: String!
|
|
|
|
userAddressStr: String!
|
2020-11-20 13:12:02 +01:00
|
|
|
|
2020-12-02 11:07:09 +01:00
|
|
|
sharesTransferAmount: BigDecimal! #
|
|
|
|
sharesBalance: BigDecimal!
|
|
|
|
|
|
|
|
spotPrice: BigDecimal!
|
2020-12-09 11:54:13 +01:00
|
|
|
consumePrice: BigDecimal!
|
2020-11-20 13:12:02 +01:00
|
|
|
tx: Bytes!
|
|
|
|
event: String
|
|
|
|
block: Int!
|
|
|
|
timestamp: Int!
|
|
|
|
gasUsed: BigDecimal!
|
|
|
|
gasPrice: BigDecimal!
|
|
|
|
|
2020-12-08 17:57:09 +01:00
|
|
|
oceanReserve: BigDecimal!
|
|
|
|
datatokenReserve: BigDecimal!
|
|
|
|
|
2020-12-02 11:07:09 +01:00
|
|
|
tokens: [PoolTransactionTokenValues!] @derivedFrom(field: "txId")
|
2020-11-20 13:12:02 +01:00
|
|
|
}
|
|
|
|
|
2020-12-02 11:07:09 +01:00
|
|
|
type DatatokenFactory @entity {
|
2020-11-26 07:38:08 +01:00
|
|
|
id: ID!
|
2020-12-02 11:07:09 +01:00
|
|
|
|
2020-11-26 07:38:08 +01:00
|
|
|
tokenCount: Int! # Number of datatokens
|
2020-12-02 11:07:09 +01:00
|
|
|
|
|
|
|
datatokens: [Datatoken!] @derivedFrom(field: "factoryID")
|
2020-11-26 07:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type Datatoken @entity {
|
|
|
|
id: ID! # token address
|
2020-12-02 11:07:09 +01:00
|
|
|
factoryID: DatatokenFactory!
|
|
|
|
|
2020-11-26 07:38:08 +01:00
|
|
|
symbol: String
|
|
|
|
name: String
|
|
|
|
decimals: Int!
|
|
|
|
address: String!
|
|
|
|
cap: BigDecimal!
|
|
|
|
supply: BigDecimal!
|
|
|
|
minter: User!
|
2020-12-02 11:26:50 +01:00
|
|
|
publisher: String!
|
2020-12-02 11:07:09 +01:00
|
|
|
|
|
|
|
holderCount: BigInt! # Number of addresses holding a balance of datatoken
|
2020-11-26 12:10:45 +01:00
|
|
|
orderCount: BigInt! # Number of orders executed for this dataset
|
2021-03-04 11:38:20 +01:00
|
|
|
metadataUpdateCount: BigInt!
|
2020-12-02 11:07:09 +01:00
|
|
|
|
|
|
|
createTime: Int! # Block time datatoken was created
|
2020-11-26 07:38:08 +01:00
|
|
|
tx: Bytes # Datatoken creation transaction id
|
2020-12-02 11:07:09 +01:00
|
|
|
|
|
|
|
balances: [TokenBalance!] @derivedFrom(field: "datatokenId")
|
|
|
|
orders: [TokenOrder!] @derivedFrom(field: "datatokenId")
|
2021-03-04 11:38:20 +01:00
|
|
|
updates: [MetadataUpdate!] @derivedFrom(field: "datatokenId") # list of MetadataUpdate objects
|
|
|
|
}
|
|
|
|
|
|
|
|
type MetadataUpdate @entity {
|
|
|
|
id: ID! # update tx + datatokenAddress
|
|
|
|
datatokenId: Datatoken!
|
|
|
|
|
|
|
|
datatokenAddress: String!
|
|
|
|
userAddress: String!
|
|
|
|
|
|
|
|
block: Int!
|
|
|
|
timestamp: Int!
|
|
|
|
tx: Bytes!
|
2020-11-26 07:38:08 +01:00
|
|
|
}
|
|
|
|
|
2020-11-26 12:10:45 +01:00
|
|
|
type TokenOrder @entity {
|
|
|
|
id: ID! # datatokenId + userAddress + tx
|
2020-12-02 11:07:09 +01:00
|
|
|
|
2020-11-26 12:10:45 +01:00
|
|
|
datatokenId: Datatoken!
|
2020-12-02 11:07:09 +01:00
|
|
|
|
2020-11-26 12:10:45 +01:00
|
|
|
consumer: User!
|
|
|
|
payer: User!
|
|
|
|
amount: BigDecimal!
|
|
|
|
serviceId: Int!
|
|
|
|
marketFeeCollector: User
|
|
|
|
marketFee: BigDecimal!
|
2020-12-02 11:07:09 +01:00
|
|
|
|
|
|
|
timestamp: Int!
|
2020-11-26 12:10:45 +01:00
|
|
|
tx: Bytes
|
2021-03-25 09:44:50 +01:00
|
|
|
block: Int!
|
2020-11-26 12:10:45 +01:00
|
|
|
}
|
|
|
|
|
2020-11-26 07:38:08 +01:00
|
|
|
type TokenBalance @entity {
|
|
|
|
id: ID! # datatokenId + userAddress
|
|
|
|
userAddress: User!
|
|
|
|
datatokenId: Datatoken!
|
|
|
|
balance: BigDecimal!
|
|
|
|
}
|
|
|
|
|
|
|
|
type TokenTransaction @entity {
|
|
|
|
id: ID! # Log ID
|
2020-12-02 11:07:09 +01:00
|
|
|
|
2020-11-26 07:38:08 +01:00
|
|
|
event: String
|
|
|
|
datatokenAddress: Datatoken
|
|
|
|
userAddress: User
|
|
|
|
|
2020-12-02 11:07:09 +01:00
|
|
|
block: Int!
|
|
|
|
gasUsed: BigDecimal!
|
|
|
|
gasPrice: BigDecimal!
|
|
|
|
timestamp: Int!
|
|
|
|
tx: Bytes!
|
2020-11-26 07:38:08 +01:00
|
|
|
}
|
|
|
|
|
2020-12-02 11:07:09 +01:00
|
|
|
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")
|
2020-12-02 17:20:29 +01:00
|
|
|
poolTransactionsTokenValues: [PoolTransactionTokenValues!] @derivedFrom(field: "userAddress")
|
2020-12-02 11:07:09 +01:00
|
|
|
tokenTransactions: [TokenTransaction!] @derivedFrom(field: "userAddress")
|
|
|
|
orders: [TokenOrder!] @derivedFrom(field: "payer")
|
2021-03-10 22:36:51 +01:00
|
|
|
freSwaps: [FixedRateExchangeSwap!] @derivedFrom(field: "by")
|
2020-12-02 11:07:09 +01:00
|
|
|
}
|
2021-03-10 22:36:51 +01:00
|
|
|
|
|
|
|
type FixedRateExchange @entity {
|
|
|
|
id: ID! # fixed rate exchange id
|
|
|
|
exchangeOwner: User!
|
|
|
|
datatoken: Datatoken!
|
|
|
|
baseToken: String!
|
|
|
|
rate: BigDecimal!
|
|
|
|
active: Boolean!
|
|
|
|
updates: [FixedRateExchangeUpdate!] @derivedFrom(field: "exchangeId")
|
|
|
|
swaps: [FixedRateExchangeSwap!] @derivedFrom(field: "exchangeId")
|
|
|
|
}
|
|
|
|
|
|
|
|
type FixedRateExchangeUpdate @entity {
|
|
|
|
id: ID!
|
|
|
|
exchangeId: FixedRateExchange!
|
|
|
|
oldRate: BigDecimal!
|
|
|
|
newRate: BigDecimal!
|
|
|
|
oldActive: Boolean!
|
|
|
|
newActive: Boolean!
|
|
|
|
block: Int!
|
|
|
|
timestamp: Int!
|
|
|
|
tx: Bytes!
|
|
|
|
}
|
|
|
|
|
|
|
|
type FixedRateExchangeSwap @entity {
|
|
|
|
id: ID!
|
|
|
|
exchangeId: FixedRateExchange!
|
|
|
|
by: User!
|
|
|
|
baseTokenAmount: BigDecimal!
|
|
|
|
dataTokenAmount: BigDecimal!
|
|
|
|
block: Int!
|
|
|
|
timestamp: Int!
|
|
|
|
tx: Bytes!
|
|
|
|
}
|