2020-12-02 11:07:09 +01:00
|
|
|
type PoolFactory @entity {
|
2021-07-30 09:36:44 +02:00
|
|
|
id: ID!
|
2021-09-10 12:49:37 +02:00
|
|
|
totalValueLocked: [TokenValue] # total value locked represented in the base token
|
|
|
|
totalLiquidity: [TokenValue] # total liquidity for each base token
|
|
|
|
totalSwapVolume: [TokenValue] # total swap volume for each base token
|
|
|
|
totalSwapFee: [TokenValue] # All the swap fee in Ocean
|
2021-09-02 11:08:47 +02:00
|
|
|
|
|
|
|
poolCount: Int! # Number of pools
|
|
|
|
finalizedPoolCount: Int! # Number of finalized pools
|
|
|
|
orderCount: BigInt # Number of total consumes
|
|
|
|
totalOrderVolume: BigDecimal # probably remove due to inconsistencies and imposibility to calculate
|
|
|
|
|
2021-07-30 09:36:44 +02:00
|
|
|
pools: [Pool!] @derivedFrom(field: "factoryID")
|
2020-11-20 13:12:02 +01:00
|
|
|
}
|
|
|
|
|
2021-09-13 15:20:29 +02:00
|
|
|
type DatatokenFactory @entity {
|
|
|
|
id: ID!
|
|
|
|
tokenCount: Int! # Number of datatokens
|
|
|
|
datatokens: [Tokens!] @derivedFrom(field: "factory")
|
|
|
|
}
|
2021-09-02 11:08:47 +02:00
|
|
|
|
2021-07-30 09:36:44 +02:00
|
|
|
type Global @entity {
|
|
|
|
id: ID!
|
2021-09-02 11:08:47 +02:00
|
|
|
|
|
|
|
totalValueLocked: [TokenValuePair] # total value locked represented in the base token
|
|
|
|
totalLiquidity: [TokenValuePair] # total liquidity for each base token
|
|
|
|
totalSwapVolume: [TokenValuePair] # total swap volume for each base token. pools and fre
|
|
|
|
|
2021-07-30 09:36:44 +02:00
|
|
|
totalOrderVolume: BigDecimal
|
2021-09-02 11:08:47 +02:00
|
|
|
|
|
|
|
orderCount: BigInt # Number of total consumes, pools + fre
|
|
|
|
|
|
|
|
poolCount: Int! # Number of pools for all factories
|
|
|
|
finalizedPoolCount: Int! # Number of finalized pools for all factories
|
|
|
|
}
|
|
|
|
|
2021-09-13 15:20:29 +02:00
|
|
|
type TokenValue {
|
2021-09-02 11:08:47 +02:00
|
|
|
|
|
|
|
token : Token!
|
|
|
|
value : BigDecimal!
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
type Token @entity {
|
|
|
|
id: ID! #
|
|
|
|
symbol: String #
|
|
|
|
name: String #
|
|
|
|
decimals: Int! #
|
|
|
|
address: String! #
|
|
|
|
cap: BigDecimal! #
|
|
|
|
supply: BigDecimal! #
|
|
|
|
isDatatoken: Boolean! #
|
|
|
|
|
|
|
|
factory: DatatokenFactory #
|
|
|
|
|
2021-09-02 16:57:14 +02:00
|
|
|
creator: String # TODO:
|
|
|
|
publisher: String # TODO:
|
|
|
|
minter: String # TODO:
|
|
|
|
editor: String # TODO:
|
2021-09-02 11:08:47 +02:00
|
|
|
|
|
|
|
holderCount: BigInt # Number of addresses holding a balance of datatoken
|
|
|
|
orderCount: BigInt # Number of orders executed for this datatoken
|
|
|
|
|
|
|
|
createTime: Int # Block time datatoken was created
|
|
|
|
tx: Bytes # Datatoken creation transaction id
|
|
|
|
block: Int # Block number when it was created
|
2021-07-30 09:36:44 +02:00
|
|
|
}
|
2021-05-13 08:19:21 +02:00
|
|
|
|
2021-07-30 09:36:44 +02:00
|
|
|
type Pool @entity {
|
|
|
|
id: ID! # Pool address
|
2021-09-02 16:57:14 +02:00
|
|
|
poolFactory: PoolFactory! # Pool factory
|
2021-07-30 09:36:44 +02:00
|
|
|
controller: Bytes! # Controller address
|
2021-09-02 16:57:14 +02:00
|
|
|
isPublicSwap: Boolean! # TODO : what is this?
|
|
|
|
isFinalized: Boolean! # only finalized pools are relevant to us
|
2021-09-02 11:08:47 +02:00
|
|
|
|
2021-07-30 09:36:44 +02:00
|
|
|
symbol: String # Pool token symbol
|
|
|
|
name: String # Pool token name
|
|
|
|
cap: BigInt # Maximum supply if any
|
2021-09-02 16:57:14 +02:00
|
|
|
isActive: Boolean! #
|
2021-07-30 09:36:44 +02:00
|
|
|
swapFee: BigDecimal! # Swap Fees
|
|
|
|
|
2021-09-02 16:57:14 +02:00
|
|
|
totalWeight: BigDecimal! # TODO: What is this?
|
2021-07-30 09:36:44 +02:00
|
|
|
totalShares: BigDecimal! # Total pool token shares
|
2021-09-02 11:08:47 +02:00
|
|
|
totalSwapVolume: BigDecimal! # Total swap volume in main token
|
2021-09-02 16:57:14 +02:00
|
|
|
totalSwapFee: BigDecimal! # TODO: is this correct ? Total swap fee in main token
|
2021-07-30 09:36:44 +02:00
|
|
|
|
2021-09-02 16:57:14 +02:00
|
|
|
totalValueLocked: BigDecimal! # value locked in pool expressed in main token (captures both Ocean and Datatoken)
|
2021-09-02 11:08:47 +02:00
|
|
|
|
2021-07-30 09:36:44 +02:00
|
|
|
spotPrice: BigDecimal!
|
2021-09-02 16:57:14 +02:00
|
|
|
consumePrice: BigDecimal! # TODO: still need?
|
2021-09-02 11:08:47 +02:00
|
|
|
|
2021-10-27 12:06:30 +02:00
|
|
|
# what is the point of the counts, we never used them => remove
|
2021-07-30 09:36:44 +02:00
|
|
|
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
|
|
|
|
|
2021-09-02 11:08:47 +02:00
|
|
|
// remove
|
2021-07-30 09:36:44 +02:00
|
|
|
datatokenAddress: String!
|
2021-09-02 11:08:47 +02:00
|
|
|
|
2021-07-30 09:36:44 +02:00
|
|
|
createTime: Int! # Block time pool was created
|
|
|
|
tx: Bytes # Pool creation transaction id
|
2021-09-02 11:08:47 +02:00
|
|
|
block
|
2021-07-30 09:36:44 +02:00
|
|
|
|
|
|
|
tokens: [PoolToken!] @derivedFrom(field: "poolId")
|
|
|
|
shares: [PoolShare!] @derivedFrom(field: "poolId")
|
2021-09-10 12:49:37 +02:00
|
|
|
transactions: [PoolTransaction!] @derivedFrom(field: "pool")
|
2020-11-20 13:12:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type PoolToken @entity {
|
2021-07-29 10:55:48 +02:00
|
|
|
id: ID! # poolId + token address
|
2021-09-08 13:34:33 +02:00
|
|
|
pool: Pool! #
|
|
|
|
isDatatoken: Boolean! # if the token is a datatoken , not sure if this makes sense since it is duplicate information found on token
|
|
|
|
token: Token!
|
|
|
|
balance: BigDecimal! # balance of the token in this pool
|
|
|
|
denormWeight: BigDecimal!
|
|
|
|
symbol: String # should we keep this, it is found on token?
|
|
|
|
name: String # should we keep this, it is found on token?
|
|
|
|
decimals: Int # should we keep this, it is found on token?
|
2020-11-20 13:12:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type PoolShare @entity {
|
2021-09-13 15:20:29 +02:00
|
|
|
id: ID! # poolId + userAddress
|
2021-09-08 13:34:33 +02:00
|
|
|
user: User!
|
|
|
|
pool: Pool!
|
2021-05-13 08:19:21 +02:00
|
|
|
balance: BigDecimal!
|
2020-11-20 13:12:02 +01:00
|
|
|
}
|
|
|
|
|
2021-09-10 12:49:37 +02:00
|
|
|
type PoolTransaction @entity {
|
|
|
|
id: ID! # pool tx
|
|
|
|
pool: Pool # Pool related to this tx
|
|
|
|
user: User # User that initiates the swap
|
2021-05-13 08:19:21 +02:00
|
|
|
|
2021-09-10 12:49:37 +02:00
|
|
|
sharesTransferAmount: BigDecimal! # Number of shares transfered
|
|
|
|
sharesBalance: BigDecimal! # TODO: what is this?
|
2021-09-02 11:08:47 +02:00
|
|
|
|
2020-11-20 13:12:02 +01:00
|
|
|
|
2021-05-13 08:19:21 +02:00
|
|
|
tx: Bytes!
|
|
|
|
event: String
|
|
|
|
block: Int!
|
|
|
|
timestamp: Int!
|
|
|
|
gasUsed: BigDecimal!
|
|
|
|
gasPrice: BigDecimal!
|
|
|
|
|
2021-09-10 12:49:37 +02:00
|
|
|
tokens: [TokenValue!] # tokens transfered
|
2020-11-20 13:12:02 +01:00
|
|
|
}
|
|
|
|
|
2021-09-13 15:20:29 +02:00
|
|
|
type Order @entity { # renamed from TokenOrder to Order
|
|
|
|
id: ID! # datatokenId + userAddress + tx
|
|
|
|
token: Token!
|
2021-05-13 08:19:21 +02:00
|
|
|
|
|
|
|
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 TokenTransaction @entity {
|
2021-05-13 08:19:21 +02:00
|
|
|
id: ID! # Log ID
|
|
|
|
event: String
|
2021-09-13 15:20:29 +02:00
|
|
|
token: Token
|
|
|
|
user: User
|
2021-05-13 08:19:21 +02: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 {
|
2021-05-13 08:19:21 +02:00
|
|
|
id: ID!
|
2021-09-13 15:20:29 +02:00
|
|
|
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")
|
2021-05-13 08:19:21 +02: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 {
|
2021-09-13 15:20:29 +02:00
|
|
|
id: ID! # fixed rate exchange id
|
2021-05-13 08:19:21 +02:00
|
|
|
exchangeOwner: User!
|
2021-09-13 15:20:29 +02:00
|
|
|
datatoken: Token!
|
|
|
|
baseToken: Token!
|
2021-05-13 08:19:21 +02:00
|
|
|
rate: BigDecimal!
|
|
|
|
active: Boolean!
|
2021-10-27 12:06:30 +02:00
|
|
|
suppy: Int!
|
2021-05-13 08:19:21 +02:00
|
|
|
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 {
|
2021-10-27 12:06:30 +02:00
|
|
|
id: ID! # it's the datatoken address
|
|
|
|
active: Boolean!
|
2021-05-13 08:19:21 +02:00
|
|
|
owner: User!
|
|
|
|
minterApproved: Boolean!
|
|
|
|
isTrueMinter: Boolean!
|
2021-10-27 12:06:30 +02:00
|
|
|
maxTokens: BigDecimal! # max tokens that can be dispensed
|
|
|
|
maxBalance: BigDecimal! # max balance of requester. If the balance is higher, the dispense is rejected
|
2021-05-13 08:19:21 +02:00
|
|
|
balance: BigDecimal!
|
|
|
|
datatoken: Datatoken!
|
|
|
|
dispenses: [DispenserTransaction!] @derivedFrom(field: "dispenserId")
|
|
|
|
}
|
|
|
|
|
|
|
|
type DispenserTransaction @entity {
|
|
|
|
id: ID!
|
|
|
|
dispenserId: Dispenser!
|
2021-09-15 11:53:50 +02:00
|
|
|
datatoken: Token!
|
2021-05-13 08:19:21 +02:00
|
|
|
user: User!
|
|
|
|
amount: BigDecimal!
|
|
|
|
block: Int!
|
|
|
|
timestamp: Int!
|
|
|
|
tx: Bytes!
|
|
|
|
type: String!
|
|
|
|
}
|
2021-09-02 16:57:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
type PoolSnapshotTokenValue @entity {
|
2021-09-15 11:53:50 +02:00
|
|
|
id: ID! # pool tx + tokenAddress
|
|
|
|
token: Token!
|
|
|
|
value: BigDecimal!
|
2021-09-02 16:57:14 +02:00
|
|
|
tokenReserve: BigDecimal!
|
2021-09-15 11:53:50 +02:00
|
|
|
feeValue: BigDecimal! # Swap fee value in OCEAN
|
2021-09-02 16:57:14 +02:00
|
|
|
type: String!
|
|
|
|
poolSnapshot: PoolSnapshot!
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type PoolSnapshot @entity {
|
|
|
|
id: ID!
|
|
|
|
pool: Pool!
|
|
|
|
totalShares: BigDecimal!
|
2021-09-15 11:53:50 +02:00
|
|
|
swapVolume: BigDecimal! # swap value 24h
|
|
|
|
swapFees: BigDecimal! # swap fee value 24h
|
|
|
|
timestamp: Int! # date without time
|
|
|
|
spotPrice: BigDecimal! # TODO: last spot price or first one?
|
2021-09-02 16:57:14 +02:00
|
|
|
tokens: [PoolSnapshotTokenValue!] @derivedFrom(field: "poolSnapshot")
|
|
|
|
}
|
|
|
|
|
2021-09-13 15:20:29 +02:00
|
|
|
|
2021-10-27 12:06:30 +02:00
|
|
|
# shouldn't we move this to aquarius?
|
2021-09-13 15:20:29 +02:00
|
|
|
type MetadataUpdate @entity {
|
|
|
|
id: ID! # update tx + datatokenAddress
|
|
|
|
datatokenId: Datatoken!
|
|
|
|
|
|
|
|
datatokenAddress: String!
|
|
|
|
userAddress: String!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
block: Int!
|
|
|
|
timestamp: Int!
|
|
|
|
tx: Bytes!
|
|
|
|
}
|