mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
add nft.orderCount (#332)
This commit is contained in:
parent
f3b501b728
commit
cd27a2432d
@ -100,6 +100,9 @@ type Nft @entity{
|
||||
tx: String!
|
||||
"block number when it was created"
|
||||
block: Int
|
||||
|
||||
"number of orders executed for all underlying datatokens"
|
||||
orderCount: BigInt!
|
||||
}
|
||||
|
||||
type Pool @entity {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Order } from '../@types/schema'
|
||||
import { Order, Nft } from '../@types/schema'
|
||||
import { BigInt } from '@graphprotocol/graph-ts'
|
||||
import {
|
||||
NewPaymentCollector,
|
||||
@ -60,6 +60,13 @@ export function handleOrderStarted(event: OrderStarted): void {
|
||||
order.save()
|
||||
token.save()
|
||||
addOrder()
|
||||
if (token.nft) {
|
||||
const nft = Nft.load(token.nft as string) as Nft
|
||||
if (nft) {
|
||||
nft.orderCount = nft.orderCount.plus(integer.ONE)
|
||||
nft.save()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function handleNewPaymentCollector(event: NewPaymentCollector): void {}
|
||||
|
@ -17,6 +17,7 @@ export function handleCreated(event: MetadataCreated): void {
|
||||
|
||||
nft.assetState = event.params.state
|
||||
nft.providerUrl = event.params.decryptorUrl.toString()
|
||||
|
||||
const nftUpdate = new NftUpdate(
|
||||
getId(event.transaction.hash.toHex(), nftAddress)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user