add chainId and nftAddress (#552)

* add chainId and nftAddress

* handle null
This commit is contained in:
mihaisc 2022-09-30 16:10:16 +03:00 committed by GitHub
parent 7be20246c0
commit 95fcfe9ba7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -404,6 +404,8 @@ type VeAllocateUser @entity{
type VeAllocateId @entity{
"id = {DataNFT Address}-{chain id}"
id: ID!
nftAddress: String!
chainId: BigInt!
veAllocation: [VeAllocation!] @derivedFrom(field: "allocationId")
allocatedTotal: BigDecimal!

View File

@ -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()