2020-12-02 11:07:09 +01:00
|
|
|
type PoolFactory @entity {
|
2021-07-30 09:36:44 +02:00
|
|
|
id: ID!
|
|
|
|
|
|
|
|
totalValueLocked: BigDecimal # total value from all pools expressed in OCEAN
|
|
|
|
|
|
|
|
totalOceanLiquidity: BigDecimal! # Total of OCEAN liquidity from all pools
|
|
|
|
totalSwapVolume: BigDecimal! # All the swap volume in Ocean
|
|
|
|
totalSwapFee: BigDecimal! # All the swap fee in Ocean
|
|
|
|
totalOrderVolume: BigDecimal
|
2021-05-13 08:19:21 +02:00
|
|
|
|
2021-07-30 09:36:44 +02:00
|
|
|
poolCount: Int! # Number of pools
|
|
|
|
finalizedPoolCount: Int! # Number of finalized pools
|
|
|
|
orderCount: BigInt # Number of total consumes
|
|
|
|
pools: [Pool!] @derivedFrom(field: "factoryID")
|
2020-11-20 13:12:02 +01:00
|
|
|
}
|
|
|
|
|
2021-07-30 09:36:44 +02:00
|
|
|
type Global @entity {
|
|
|
|
id: ID!
|
|
|
|
totalValueLocked: BigDecimal # total value from all pools expressed in OCEAN
|
|
|
|
totalOceanLiquidity: BigDecimal! # Total of OCEAN liquidity from all pools
|
|
|
|
totalSwapVolume: BigDecimal! # All the swap volume in Ocean
|
|
|
|
totalOrderVolume: BigDecimal
|
|
|
|
orderCount: BigInt
|
|
|
|
poolCount: Int!
|
|
|
|
}
|
2021-05-13 08:19:21 +02:00
|
|
|
|
2021-07-30 09:36:44 +02:00
|
|
|
type Pool @entity {
|
|
|
|
id: ID! # Pool address
|
|
|
|
factoryID: PoolFactory!
|
|
|
|
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
|
|
|
|
|
|
|
|
totalWeight: BigDecimal!
|
|
|
|
totalShares: BigDecimal! # Total pool token shares
|
|
|
|
totalSwapVolume: BigDecimal! # Total swap volume in OCEAN
|
|
|
|
totalSwapFee: BigDecimal! # Total swap fee in OCEAN
|
|
|
|
|
|
|
|
valueLocked: BigDecimal! # value locked in pool expressed in OCEAN (captures both Ocean and Datatoken)
|
|
|
|
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!
|
|
|
|
transactionCount: BigInt! # Number of transactions in this pool involving liquidity changes
|
|
|
|
|
|
|
|
datatokenAddress: String!
|
|
|
|
createTime: Int! # Block time pool was created
|
|
|
|
tx: Bytes # Pool creation transaction id
|
|
|
|
|
|
|
|
tokens: [PoolToken!] @derivedFrom(field: "poolId")
|
|
|
|
shares: [PoolShare!] @derivedFrom(field: "poolId")
|
|
|
|
transactions: [PoolTransaction!] @derivedFrom(field: "poolAddress")
|
|
|
|
transactionsTokenValues: [PoolTransactionTokenValues!] @derivedFrom(field: "poolAddress")
|
2020-11-20 13:12:02 +01:00
|
|
|
}
|
|
|
|
|
2021-07-29 10:55:48 +02:00
|
|
|
|
2020-11-20 13:12:02 +01:00
|
|
|
type PoolToken @entity {
|
2021-07-29 10:55:48 +02:00
|
|
|
id: ID! # poolId + token address
|
|
|
|
poolId: Pool!
|
|
|
|
isDatatoken: Boolean!
|
|
|
|
address: String
|
|
|
|
tokenId: Datatoken
|
|
|
|
tokenAddress: String
|
|
|
|
balance: BigDecimal!
|
|
|
|
denormWeight: BigDecimal!
|
|
|
|
symbol: String
|
|
|
|
name: String
|
|
|
|
decimals: Int
|
2020-11-20 13:12:02 +01:00
|
|
|
}
|
|
|
|
|
2021-07-29 10:55:48 +02:00
|
|
|
|
|
|
|
|
2020-11-20 13:12:02 +01:00
|
|
|
type PoolShare @entity {
|
2021-05-13 08:19:21 +02:00
|
|
|
id: ID! # poolId + userAddress
|
|
|
|
userAddress: User!
|
|
|
|
poolId: Pool!
|
|
|
|
balance: BigDecimal!
|
2020-11-20 13:12:02 +01:00
|
|
|
}
|
|
|
|
|
2020-12-02 11:07:09 +01:00
|
|
|
type PoolTransactionTokenValues @entity {
|
2021-05-13 08:19:21 +02:00
|
|
|
id: ID! # pool tx + tokenAddress
|
|
|
|
txId: PoolTransaction!
|
|
|
|
poolToken: PoolToken!
|
|
|
|
poolAddress: Pool!
|
|
|
|
userAddress: User!
|
|
|
|
tokenAddress: String!
|
|
|
|
|
|
|
|
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 {
|
2021-05-13 08:19:21 +02:00
|
|
|
id: ID! # pool tx
|
|
|
|
poolAddress: Pool
|
|
|
|
userAddress: User # User address that initiates the swap
|
|
|
|
poolAddressStr: String!
|
|
|
|
userAddressStr: String!
|
|
|
|
|
|
|
|
sharesTransferAmount: BigDecimal! #
|
|
|
|
sharesBalance: BigDecimal!
|
|
|
|
|
|
|
|
spotPrice: BigDecimal!
|
|
|
|
consumePrice: BigDecimal!
|
|
|
|
tx: Bytes!
|
|
|
|
event: String
|
|
|
|
block: Int!
|
|
|
|
timestamp: Int!
|
|
|
|
gasUsed: BigDecimal!
|
|
|
|
gasPrice: BigDecimal!
|
|
|
|
|
|
|
|
oceanReserve: BigDecimal!
|
|
|
|
datatokenReserve: BigDecimal!
|
|
|
|
|
|
|
|
tokens: [PoolTransactionTokenValues!] @derivedFrom(field: "txId")
|
2020-11-20 13:12:02 +01:00
|
|
|
}
|
|
|
|
|
2020-12-02 11:07:09 +01:00
|
|
|
type DatatokenFactory @entity {
|
2021-05-13 08:19:21 +02:00
|
|
|
id: ID!
|
2020-12-02 11:07:09 +01:00
|
|
|
|
2021-05-13 08:19:21 +02:00
|
|
|
tokenCount: Int! # Number of datatokens
|
|
|
|
datatokens: [Datatoken!] @derivedFrom(field: "factoryID")
|
2020-11-26 07:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type Datatoken @entity {
|
2021-07-30 09:36:44 +02:00
|
|
|
id: ID! # token address
|
|
|
|
factoryID: DatatokenFactory!
|
|
|
|
|
|
|
|
symbol: String
|
|
|
|
name: String
|
|
|
|
decimals: Int!
|
|
|
|
address: String!
|
|
|
|
cap: BigDecimal!
|
|
|
|
supply: BigDecimal!
|
|
|
|
minter: User!
|
|
|
|
publisher: String!
|
|
|
|
|
|
|
|
holderCount: BigInt! # Number of addresses holding a balance of datatoken
|
|
|
|
orderCount: BigInt! # Number of orders executed for this dataset
|
|
|
|
metadataUpdateCount: BigInt!
|
|
|
|
|
|
|
|
orderVolume: BigDecimal
|
|
|
|
createTime: Int! # Block time datatoken was created
|
|
|
|
tx: Bytes # Datatoken creation transaction id
|
|
|
|
|
|
|
|
balances: [TokenBalance!] @derivedFrom(field: "datatokenId")
|
|
|
|
orders: [TokenOrder!] @derivedFrom(field: "datatokenId")
|
|
|
|
updates: [MetadataUpdate!] @derivedFrom(field: "datatokenId") # list of MetadataUpdate objects
|
2021-03-04 11:38:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type MetadataUpdate @entity {
|
2021-05-13 08:19:21 +02:00
|
|
|
id: ID! # update tx + datatokenAddress
|
|
|
|
datatokenId: Datatoken!
|
2021-03-04 11:38:20 +01:00
|
|
|
|
2021-05-13 08:19:21 +02:00
|
|
|
datatokenAddress: String!
|
|
|
|
userAddress: String!
|
2021-03-04 11:38:20 +01:00
|
|
|
|
2021-05-13 08:19:21 +02:00
|
|
|
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 {
|
2021-05-13 08:19:21 +02:00
|
|
|
id: ID! # datatokenId + userAddress + tx
|
|
|
|
datatokenId: Datatoken!
|
|
|
|
|
|
|
|
consumer: User!
|
|
|
|
payer: User!
|
|
|
|
amount: BigDecimal!
|
|
|
|
serviceId: Int!
|
|
|
|
marketFeeCollector: User
|
|
|
|
marketFee: BigDecimal!
|
|
|
|
|
|
|
|
timestamp: Int!
|
|
|
|
tx: Bytes
|
|
|
|
block: Int!
|
2020-11-26 12:10:45 +01:00
|
|
|
}
|
|
|
|
|
2020-11-26 07:38:08 +01:00
|
|
|
type TokenBalance @entity {
|
2021-05-13 08:19:21 +02:00
|
|
|
id: ID! # datatokenId + userAddress
|
|
|
|
userAddress: User!
|
|
|
|
datatokenId: Datatoken!
|
|
|
|
balance: BigDecimal!
|
2020-11-26 07:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type TokenTransaction @entity {
|
2021-05-13 08:19:21 +02:00
|
|
|
id: ID! # Log ID
|
|
|
|
event: String
|
|
|
|
datatokenAddress: Datatoken
|
|
|
|
userAddress: User
|
|
|
|
|
|
|
|
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 {
|
2021-05-13 08:19:21 +02:00
|
|
|
id: ID!
|
|
|
|
|
|
|
|
sharesOwned: [PoolShare!] @derivedFrom(field: "userAddress")
|
|
|
|
tokenBalancesOwned: [TokenBalance!] @derivedFrom(field: "userAddress")
|
|
|
|
tokensOwned: [Datatoken!] @derivedFrom(field: "minter")
|
2021-10-05 12:51:47 +02:00
|
|
|
nrSales: Int
|
2021-05-13 08:19:21 +02:00
|
|
|
poolTransactions: [PoolTransaction!] @derivedFrom(field: "userAddress")
|
|
|
|
poolTransactionsTokenValues: [PoolTransactionTokenValues!]
|
|
|
|
@derivedFrom(field: "userAddress")
|
|
|
|
tokenTransactions: [TokenTransaction!] @derivedFrom(field: "userAddress")
|
|
|
|
orders: [TokenOrder!] @derivedFrom(field: "payer")
|
|
|
|
freSwaps: [FixedRateExchangeSwap!] @derivedFrom(field: "by")
|
2020-12-02 11:07:09 +01:00
|
|
|
}
|
2021-03-10 22:36:51 +01:00
|
|
|
|
|
|
|
type FixedRateExchange @entity {
|
2021-05-13 08:19:21 +02:00
|
|
|
id: ID! # fixed rate exchange id
|
|
|
|
exchangeOwner: User!
|
|
|
|
datatoken: Datatoken!
|
|
|
|
baseToken: String!
|
2021-08-13 16:04:18 +02:00
|
|
|
baseTokenSymbol: String!
|
2021-05-13 08:19:21 +02:00
|
|
|
rate: BigDecimal!
|
|
|
|
active: Boolean!
|
|
|
|
updates: [FixedRateExchangeUpdate!] @derivedFrom(field: "exchangeId")
|
|
|
|
swaps: [FixedRateExchangeSwap!] @derivedFrom(field: "exchangeId")
|
2021-03-10 22:36:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type FixedRateExchangeUpdate @entity {
|
2021-05-13 08:19:21 +02:00
|
|
|
id: ID!
|
|
|
|
exchangeId: FixedRateExchange!
|
|
|
|
oldRate: BigDecimal!
|
|
|
|
newRate: BigDecimal!
|
|
|
|
oldActive: Boolean!
|
|
|
|
newActive: Boolean!
|
|
|
|
block: Int!
|
|
|
|
timestamp: Int!
|
|
|
|
tx: Bytes!
|
2021-03-10 22:36:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type FixedRateExchangeSwap @entity {
|
2021-05-13 08:19:21 +02:00
|
|
|
id: ID!
|
|
|
|
exchangeId: FixedRateExchange!
|
|
|
|
by: User!
|
|
|
|
baseTokenAmount: BigDecimal!
|
|
|
|
dataTokenAmount: BigDecimal!
|
|
|
|
block: Int!
|
|
|
|
timestamp: Int!
|
|
|
|
tx: Bytes!
|
|
|
|
}
|
|
|
|
|
|
|
|
type Dispenser @entity {
|
|
|
|
id: ID! # dispenser datatoken
|
|
|
|
active: Boolean!
|
|
|
|
owner: User!
|
|
|
|
minterApproved: Boolean!
|
|
|
|
isTrueMinter: Boolean!
|
|
|
|
maxTokens: BigDecimal!
|
|
|
|
maxBalance: BigDecimal!
|
|
|
|
balance: BigDecimal!
|
|
|
|
datatoken: Datatoken!
|
|
|
|
dispenses: [DispenserTransaction!] @derivedFrom(field: "dispenserId")
|
|
|
|
}
|
|
|
|
|
|
|
|
type DispenserTransaction @entity {
|
|
|
|
id: ID!
|
|
|
|
dispenserId: Dispenser!
|
|
|
|
datatoken: Datatoken!
|
|
|
|
user: User!
|
|
|
|
amount: BigDecimal!
|
|
|
|
block: Int!
|
|
|
|
timestamp: Int!
|
|
|
|
tx: Bytes!
|
|
|
|
type: String!
|
|
|
|
}
|