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
@ -99,7 +99,10 @@ type Nft @entity{
|
|||||||
"nft creation transaction id"
|
"nft creation transaction id"
|
||||||
tx: String!
|
tx: String!
|
||||||
"block number when it was created"
|
"block number when it was created"
|
||||||
block: Int
|
block: Int
|
||||||
|
|
||||||
|
"number of orders executed for all underlying datatokens"
|
||||||
|
orderCount: BigInt!
|
||||||
}
|
}
|
||||||
|
|
||||||
type Pool @entity {
|
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 { BigInt } from '@graphprotocol/graph-ts'
|
||||||
import {
|
import {
|
||||||
NewPaymentCollector,
|
NewPaymentCollector,
|
||||||
@ -60,6 +60,13 @@ export function handleOrderStarted(event: OrderStarted): void {
|
|||||||
order.save()
|
order.save()
|
||||||
token.save()
|
token.save()
|
||||||
addOrder()
|
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 {}
|
export function handleNewPaymentCollector(event: NewPaymentCollector): void {}
|
||||||
|
@ -17,6 +17,7 @@ export function handleCreated(event: MetadataCreated): void {
|
|||||||
|
|
||||||
nft.assetState = event.params.state
|
nft.assetState = event.params.state
|
||||||
nft.providerUrl = event.params.decryptorUrl.toString()
|
nft.providerUrl = event.params.decryptorUrl.toString()
|
||||||
|
|
||||||
const nftUpdate = new NftUpdate(
|
const nftUpdate = new NftUpdate(
|
||||||
getId(event.transaction.hash.toHex(), nftAddress)
|
getId(event.transaction.hash.toHex(), nftAddress)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user