From 95fcfe9ba7e90f91155964ad5fc73f9d369cb1d9 Mon Sep 17 00:00:00 2001 From: mihaisc Date: Fri, 30 Sep 2022 16:10:16 +0300 Subject: [PATCH] add chainId and nftAddress (#552) * add chainId and nftAddress * handle null --- schema.graphql | 4 +++- src/mappings/utils/veUtils.ts | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/schema.graphql b/schema.graphql index dfd3c93..b0f78f8 100644 --- a/schema.graphql +++ b/schema.graphql @@ -404,7 +404,9 @@ type VeAllocateUser @entity{ type VeAllocateId @entity{ "id = {DataNFT Address}-{chain id}" id: ID! - + nftAddress: String! + chainId: BigInt! + veAllocation: [VeAllocation!] @derivedFrom(field: "allocationId") allocatedTotal: BigDecimal! diff --git a/src/mappings/utils/veUtils.ts b/src/mappings/utils/veUtils.ts index 7e84c13..8acf192 100644 --- a/src/mappings/utils/veUtils.ts +++ b/src/mappings/utils/veUtils.ts @@ -62,6 +62,8 @@ export function getveAllocateId( allocateId.tx = event.transaction.hash.toHex() allocateId.block = event.block.number.toI32() allocateId.lastContact = 0 + allocateId.chainId = BigInt.zero() + allocateId.nftAddress = '' allocateId.save() } @@ -196,6 +198,9 @@ export function handleOneAllocation( allocationAmount ) + allocateId.chainId = chainId + allocateId.nftAddress = nftAddress + // save entities allocateUser.save() allocateId.save()