mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
e1df119197
* Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
632 lines
16 KiB
GraphQL
632 lines
16 KiB
GraphQL
type Token @entity {
|
|
id: ID!
|
|
symbol: String
|
|
name: String
|
|
decimals: Int!
|
|
address: String!
|
|
cap: BigDecimal
|
|
supply: BigDecimal
|
|
isDatatoken: Boolean!
|
|
|
|
"address of ERC721 that owns the token, valid only for datatokens"
|
|
nft: Nft
|
|
|
|
"array of addresses with minter role"
|
|
minter: [String!]
|
|
|
|
"array of addresses with payment manager minter role"
|
|
paymentManager: [String!]
|
|
|
|
"address that collects the payments (NOT fees)"
|
|
paymentCollector: String
|
|
|
|
"address of the market where the datatoken was created. This address collects market fees."
|
|
publishMarketFeeAddress: String
|
|
|
|
"adreess of fee token (can be Ocean, ETH, etc.)"
|
|
publishMarketFeeToken: String
|
|
|
|
"fee amount. Fixed value."
|
|
publishMarketFeeAmount: BigDecimal
|
|
|
|
"template ID of the datatoken"
|
|
templateId: Int
|
|
|
|
"number of addresses holding a balance of datatoken , TODO: can we actually calculate this? what happens when users trade the dts"
|
|
holderCount: BigInt!
|
|
|
|
"number of orders executed for this datatoken"
|
|
orderCount: BigInt!
|
|
|
|
"orders created with the datatoken, only available for datatokens"
|
|
orders: [Order!] @derivedFrom(field:"datatoken")
|
|
|
|
"fixed rate exchanges, only available for datatokens"
|
|
fixedRateExchanges: [FixedRateExchange!] @derivedFrom(field:"datatoken")
|
|
|
|
"dispensers using this token"
|
|
dispensers: [Dispenser!] @derivedFrom(field:"token")
|
|
|
|
"block time datatoken was created"
|
|
createdTimestamp: Int!
|
|
|
|
"datatoken creation transaction id"
|
|
tx: String!
|
|
eventIndex: Int!
|
|
"block number when it was created"
|
|
block: Int!
|
|
|
|
lastPriceToken: Token
|
|
lastPriceValue: BigDecimal!
|
|
}
|
|
|
|
"utility type"
|
|
type TokenValuePair @entity {
|
|
"address of the token"
|
|
id : ID!
|
|
token : Token!
|
|
value : BigDecimal!
|
|
}
|
|
|
|
type Nft @entity{
|
|
"nft address"
|
|
id: ID!
|
|
symbol: String!
|
|
name: String!
|
|
tokenUri: String
|
|
|
|
"address of the owner of the nft"
|
|
owner: User!
|
|
"address of the creator of the nft"
|
|
creator: User!
|
|
|
|
"same as id, it's just for easy discoverability"
|
|
address: String!
|
|
|
|
"provider url that can decrypt the ddo"
|
|
providerUrl: String
|
|
|
|
"state of the asset (described in docs)"
|
|
assetState: Int!
|
|
|
|
managerRole: [String!]
|
|
erc20DeployerRole: [String!]
|
|
storeUpdateRole: [String!]
|
|
"addresses that can update the metadata"
|
|
metadataRole: [String!]
|
|
|
|
"template address"
|
|
template: String!
|
|
|
|
"set if NFT is transferable"
|
|
transferable: Boolean!
|
|
|
|
"block time nft was created"
|
|
createdTimestamp: Int!
|
|
"nft creation transaction id"
|
|
tx: String!
|
|
eventIndex: Int!
|
|
"block number when it was created"
|
|
block: Int
|
|
|
|
"number of orders executed for all underlying datatokens"
|
|
orderCount: BigInt!
|
|
|
|
"has metadata"
|
|
hasMetadata: Boolean!
|
|
|
|
nftData: [NftData!] @derivedFrom(field: "nft")
|
|
transferHistory: [NftTransferHistory!] @derivedFrom(field: "nft")
|
|
}
|
|
|
|
type NftData @entity{
|
|
"nft address+key"
|
|
id: ID!
|
|
nft: Nft!
|
|
key: Bytes
|
|
value: Bytes
|
|
}
|
|
|
|
type OrderReuse @entity {
|
|
id: ID!
|
|
order: Order!
|
|
caller: String!
|
|
createdTimestamp: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
block: Int!
|
|
providerFee: String
|
|
providerFeeValidUntil: BigInt
|
|
"gas price in Wei"
|
|
gasPrice: BigInt
|
|
gasUsed: BigDecimal
|
|
}
|
|
|
|
type Order @entity {
|
|
"transaction hash - token address - from address - eventIndex"
|
|
id: ID!
|
|
datatoken: Token!
|
|
|
|
consumer: User!
|
|
payer: User!
|
|
amount: BigDecimal!
|
|
serviceIndex: Int!
|
|
nftOwner: User!
|
|
|
|
|
|
# the fees will be updated from an event that will be created after (todo)
|
|
publishingMarket: User
|
|
publishingMarketToken: Token #
|
|
publishingMarketAmmount: BigDecimal #call contract to get fee amount
|
|
providerFee: String
|
|
providerFeeValidUntil: BigInt
|
|
|
|
consumerMarket: User
|
|
consumerMarketToken: Token #
|
|
consumerMarketAmmount: BigDecimal #call contract to get fee amount
|
|
|
|
reuses: [OrderReuse!] @derivedFrom(field: "order")
|
|
|
|
createdTimestamp: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
block: Int!
|
|
|
|
lastPriceToken: Token
|
|
lastPriceValue: BigDecimal!
|
|
estimatedUSDValue: BigDecimal!
|
|
gasUsed: BigDecimal
|
|
"gas price in Wei"
|
|
gasPrice: BigInt
|
|
}
|
|
|
|
type User @entity {
|
|
id: ID!
|
|
tokenBalancesOwned: [TokenValuePair!]
|
|
orders: [Order!] @derivedFrom(field: "payer")
|
|
freSwaps: [FixedRateExchangeSwap!] @derivedFrom(field: "by")
|
|
|
|
"total number of orders made by this user"
|
|
totalOrders: BigInt!
|
|
|
|
"total number of orders made on assets owned by this user"
|
|
totalSales: BigInt!
|
|
}
|
|
|
|
type FixedRateExchange @entity {
|
|
"fixed rate exchange id"
|
|
id: ID!
|
|
contract: String!
|
|
exchangeId: String!
|
|
owner: User!
|
|
datatoken: Token!
|
|
baseToken: Token!
|
|
"amount of datatokens available to be sold, this is relevant if the exchange is not able to mint"
|
|
datatokenSupply: BigDecimal!
|
|
"amount of basetokens available to be collected by the owner"
|
|
baseTokenSupply: BigDecimal!
|
|
datatokenBalance: BigDecimal!
|
|
baseTokenBalance: BigDecimal!
|
|
price: BigDecimal!
|
|
active: Boolean!
|
|
"amount of total basetokens spent"
|
|
totalSwapValue: BigDecimal!
|
|
"address that is allowed to swap tokens"
|
|
allowedSwapper: String
|
|
"if the owner allowes the fre to mint"
|
|
withMint: Boolean
|
|
"if the fre has the minter role on the datatoken"
|
|
isMinter: Boolean
|
|
|
|
updates: [FixedRateExchangeUpdate!] @derivedFrom(field: "exchangeId")
|
|
swaps: [FixedRateExchangeSwap!] @derivedFrom(field: "exchangeId")
|
|
|
|
createdTimestamp: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
block: Int!
|
|
|
|
"address of the market where the datatoken was created. This address collects market fees."
|
|
publishMarketFeeAddress: String
|
|
|
|
"fee amount. Fixed value"
|
|
publishMarketSwapFee: BigDecimal
|
|
|
|
}
|
|
|
|
type FixedRateExchangeUpdate @entity {
|
|
id: ID!
|
|
exchangeId: FixedRateExchange!
|
|
|
|
oldPrice: BigDecimal
|
|
newPrice: BigDecimal
|
|
|
|
oldActive: Boolean
|
|
newActive: Boolean
|
|
|
|
oldAllowedSwapper: String
|
|
newAllowedSwapper: String
|
|
|
|
block: Int!
|
|
createdTimestamp: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
}
|
|
|
|
type FixedRateExchangeSwap @entity {
|
|
id: ID!
|
|
exchangeId: FixedRateExchange!
|
|
by: User!
|
|
baseTokenAmount: BigDecimal!
|
|
dataTokenAmount: BigDecimal!
|
|
block: Int!
|
|
createdTimestamp: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
oceanFeeAmount: BigDecimal!
|
|
marketFeeAmount: BigDecimal!
|
|
consumeMarketFeeAmount: BigDecimal!
|
|
}
|
|
|
|
|
|
type Dispenser @entity {
|
|
"token address"
|
|
id: ID!
|
|
contract: String!
|
|
active: Boolean!
|
|
"if using the enterprise template the owner will always be the erc721 factory, for normal template it will a user"
|
|
owner: String
|
|
token: Token!
|
|
|
|
allowedSwapper: String
|
|
isMinter: Boolean
|
|
"max tokens that can be dispensed"
|
|
maxTokens: BigDecimal!
|
|
"max balance of requester. If the balance is higher, the dispense is rejected"
|
|
maxBalance: BigDecimal!
|
|
"how many tokens are left"
|
|
balance: BigDecimal!
|
|
|
|
|
|
block: Int!
|
|
createdTimestamp: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
|
|
dispenses: [DispenserTransaction!] @derivedFrom(field: "dispenser")
|
|
}
|
|
|
|
type DispenserTransaction @entity {
|
|
id: ID!
|
|
dispenser: Dispenser!
|
|
user: User!
|
|
amount: BigDecimal!
|
|
|
|
block: Int!
|
|
createdTimestamp: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
}
|
|
|
|
"utility type"
|
|
type GlobalTotalLiquidityPair @entity {
|
|
"address of the token"
|
|
id : ID!
|
|
globalStatistic: GlobalStatistic!
|
|
token : Token!
|
|
value : BigDecimal!
|
|
}
|
|
|
|
"utility type"
|
|
type GlobalTotalFixedSwapPair @entity {
|
|
"address of the token"
|
|
id : ID!
|
|
globalStatistic: GlobalStatistic!
|
|
token : Token!
|
|
value : BigDecimal!
|
|
count: BigInt!
|
|
}
|
|
type GlobalStatistic @entity {
|
|
id: ID!
|
|
|
|
"total swap volume for each base token in fixed rate exchanges"
|
|
totalFixedSwapVolume: [GlobalTotalFixedSwapPair!] @derivedFrom(field: "globalStatistic")
|
|
|
|
"number of total orders. fixed rate exchange orders + dispenser orders"
|
|
orderCount: Int!
|
|
|
|
"total nfts(erc721) created"
|
|
nftCount: Int!
|
|
"total datatokens (tokens with isDatatoken = true) created"
|
|
datatokenCount:Int!
|
|
|
|
"number of fixed rate exchanges"
|
|
fixedCount: Int!
|
|
|
|
"number of dispensers created"
|
|
dispenserCount: Int!
|
|
|
|
"total ocean locked in veOcean"
|
|
totalOceanLocked:BigDecimal!
|
|
|
|
"current version"
|
|
version: String
|
|
}
|
|
|
|
type OPC @entity {
|
|
id: ID!
|
|
"fee in percent for swaps involving OPC approved tokens"
|
|
swapOceanFee: BigDecimal
|
|
"fee in percent for swaps involving non OPC approved tokens"
|
|
swapNonOceanFee: BigDecimal
|
|
"fee in percent taken by OPC from orderFees"
|
|
orderFee: BigDecimal
|
|
"fee in percent taken by OPC from providerFees"
|
|
providerFee: BigDecimal
|
|
approvedTokens: [Token!]
|
|
}
|
|
|
|
enum NftUpdateType {
|
|
METADATA_CREATED,
|
|
METADATA_UPDATED,
|
|
STATE_UPDATED,
|
|
TOKENURI_UPDATED
|
|
}
|
|
|
|
type NftUpdate @entity {
|
|
id: ID! # update tx + nft address
|
|
tokenUri: String
|
|
nft: Nft!
|
|
|
|
"provider url that can decrypt the ddo"
|
|
providerUrl: String
|
|
|
|
"user that made the update"
|
|
userAddress: String!
|
|
|
|
"state of the asset in this update"
|
|
assetState: Int!
|
|
|
|
"type of the update: metadata created, metadata update, state update, token uri update"
|
|
type: NftUpdateType!
|
|
|
|
block: Int!
|
|
timestamp: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
}
|
|
|
|
type Template @entity{
|
|
id: ID!
|
|
fixedRateTemplates: [String!]
|
|
dispenserTemplates: [String!]
|
|
ssTemplates: [String!]
|
|
}
|
|
|
|
# Not tracking allocationToId or idToAllocation
|
|
type VeAllocateUser @entity{
|
|
"id = {user}"
|
|
id: ID!
|
|
|
|
veAllocation: [VeAllocation!] @derivedFrom(field: "allocationUser")
|
|
allocatedTotal: BigDecimal!
|
|
|
|
block: Int!
|
|
firstContact: Int!
|
|
lastContact: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
veOcean: VeOCEAN!
|
|
}
|
|
|
|
type VeAllocateId @entity{
|
|
"id = {DataNFT Address}-{chain id}"
|
|
id: ID!
|
|
nftAddress: String!
|
|
chainId: BigInt!
|
|
|
|
veAllocation: [VeAllocation!] @derivedFrom(field: "allocationId")
|
|
allocatedTotal: BigDecimal!
|
|
|
|
block: Int!
|
|
firstContact: Int!
|
|
lastContact: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
}
|
|
|
|
# we need to track allocation of user to id
|
|
type VeAllocation @entity {
|
|
"id = {user}-{DataNFT Address}-{chain id}"
|
|
id: ID!
|
|
|
|
allocationUser: VeAllocateUser!
|
|
allocationId: VeAllocateId!
|
|
|
|
updates: [VeAllocationUpdate!] @derivedFrom(field: "veAllocation")
|
|
allocated: BigDecimal!
|
|
chainId: BigInt!
|
|
nftAddress: String!
|
|
|
|
block: Int!
|
|
firstContact: Int!
|
|
lastContact: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
}
|
|
|
|
enum veAllocationUpdateType {
|
|
SET,
|
|
REMOVED
|
|
}
|
|
|
|
type VeAllocationUpdate @entity {
|
|
"{tx}-{VeAllocation id}-{eventIndex}"
|
|
id: ID!
|
|
|
|
veAllocation: VeAllocation!
|
|
type: veAllocationUpdateType!
|
|
allocatedTotal: BigDecimal!
|
|
|
|
block: Int!
|
|
timestamp: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
}
|
|
|
|
type VeDelegation @entity {
|
|
"id = VeDelegation contract + tokenId"
|
|
id: ID!
|
|
delegator: VeOCEAN!
|
|
receiver: VeOCEAN!
|
|
tokenId: BigInt!
|
|
amount: BigDecimal!
|
|
cancelTime: BigInt!
|
|
expireTime: BigInt!
|
|
updates: [VeDelegationUpdate!] @derivedFrom(field: "veDelegation")
|
|
|
|
}
|
|
|
|
type VeDelegationUpdate @entity {
|
|
"id = {tx}-{eventIndex}"
|
|
id: ID!
|
|
block: Int!
|
|
timestamp: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
sender: String!
|
|
amount: BigDecimal!
|
|
cancelTime: BigInt!
|
|
expireTime: BigInt!
|
|
"type: CREATE_BOOST = 0, EXTEND_BOOST = 1, BURN_BOOST = 2"
|
|
type:Int!
|
|
veDelegation:VeDelegation!
|
|
}
|
|
|
|
|
|
type VeOCEAN @entity {
|
|
"id = {user address}"
|
|
id: ID!
|
|
"total amount of locked tokens"
|
|
lockedAmount: BigDecimal!
|
|
"unlock timestamp"
|
|
unlockTime: BigInt!
|
|
delegation: [VeDelegation!] @derivedFrom(field: "delegator")
|
|
delegates: [VeDelegation!] @derivedFrom(field: "receiver")
|
|
deposits: [VeDeposit!] @derivedFrom(field: "veOcean")
|
|
claims: [VeClaim!] @derivedFrom(field: "veOcean")
|
|
allocation: VeAllocateUser @derivedFrom(field: "veOcean")
|
|
block: Int!
|
|
}
|
|
|
|
type VeDeposit @entity {
|
|
"id = {user address}-{tx}-{eventIndex}"
|
|
id: ID!
|
|
"veOcean holder"
|
|
provider:String!
|
|
"who initiated the tx"
|
|
sender: String!
|
|
"amount of tokens locked"
|
|
value: BigDecimal!
|
|
"unlock timestamp"
|
|
unlockTime: BigInt!
|
|
"deposit type: DEPOSIT_FOR = 0, CREATE_LOCK_TYPE = 1,INCREASE_LOCK_AMOUNT = 2,INCREASE_UNLOCK_TIME = 3, WITHDRAW = 4"
|
|
type:BigInt!
|
|
timestamp: BigInt!
|
|
block: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
veOcean: VeOCEAN!
|
|
totalOceanLocked:BigDecimal!
|
|
}
|
|
|
|
|
|
type VeFeeDistributor @entity {
|
|
"id = contract address"
|
|
id: ID!
|
|
"token used by FeeDistributor"
|
|
token: Token!
|
|
claims: [VeClaim!] @derivedFrom(field: "VeFeeDistributor")
|
|
checkpoints: [VeFeeDistributorCheckPoint!] @derivedFrom(field: "VeFeeDistributor")
|
|
}
|
|
|
|
type VeFeeDistributorCheckPoint @entity {
|
|
"id = {tx}-{eventno}"
|
|
id: ID!
|
|
"amount of tokens for rewards"
|
|
tokens: BigDecimal!
|
|
"who initiated the tx"
|
|
sender: String!
|
|
VeFeeDistributor: VeFeeDistributor!
|
|
timestamp: BigInt!
|
|
block: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
}
|
|
|
|
type VeClaim @entity {
|
|
"id = {tx}-{eventno}"
|
|
id: ID!
|
|
"amount of tokens claimed"
|
|
amount: BigDecimal!
|
|
"claim epoch"
|
|
claim_epoch: BigInt
|
|
"max_epoch"
|
|
max_epoch: BigInt
|
|
timestamp: BigInt!
|
|
block: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
veOcean: VeOCEAN!
|
|
VeFeeDistributor: VeFeeDistributor!
|
|
}
|
|
|
|
enum DFHistoryType {
|
|
Allocated,
|
|
Claimed
|
|
}
|
|
|
|
type DFAvailableClaim @entity {
|
|
"id = {userId}-{tokenId}"
|
|
id: ID!
|
|
receiver: DFReward!
|
|
amount: BigDecimal!
|
|
token: Token!
|
|
}
|
|
|
|
|
|
type DFHistory @entity {
|
|
"id = {user-id}-{txId}-{eventId}"
|
|
id: ID!
|
|
receiver: DFReward!
|
|
amount: BigDecimal!
|
|
token: Token!
|
|
type: DFHistoryType!
|
|
timestamp: BigInt!
|
|
block: Int!
|
|
tx: String!
|
|
eventIndex: Int!
|
|
}
|
|
|
|
|
|
type DFReward @entity {
|
|
"id = {user address}"
|
|
id: ID!
|
|
receiver: User!
|
|
availableClaims: [DFAvailableClaim!] @derivedFrom(field: "receiver")
|
|
history: [DFHistory!] @derivedFrom(field: "receiver")
|
|
}
|
|
|
|
type NftTransferHistory @entity {
|
|
# ID = hash(nftAddress+txId+eventNumber)
|
|
id: ID!
|
|
nft: Nft!
|
|
oldOwner: User!
|
|
newOwner: User!
|
|
txId: String
|
|
eventIndex: Int!
|
|
timestamp: Int!
|
|
block: Int!
|
|
}
|
|
|