From 9b41d025e8e9483006f9f0816eea0e3cccc7e0a8 Mon Sep 17 00:00:00 2001 From: trizin <25263018+trizin@users.noreply.github.com> Date: Thu, 4 May 2023 13:36:09 +0300 Subject: [PATCH] Add lockedAmount to veDelegation --- schema.graphql | 2 +- src/mappings/veDelegation.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/schema.graphql b/schema.graphql index cfb3b93..6198669 100644 --- a/schema.graphql +++ b/schema.graphql @@ -468,6 +468,7 @@ type VeDelegation @entity { receiver: VeOCEAN! tokenId: BigInt! amount: BigDecimal! + lockedAmount BigDecimal! cancelTime: BigInt! expireTime: BigInt! updates: [VeDelegationUpdate!] @derivedFrom(field: "veDelegation") @@ -609,4 +610,3 @@ type NftTransferHistory @entity { timestamp: Int! block: Int! } - diff --git a/src/mappings/veDelegation.ts b/src/mappings/veDelegation.ts index 3362ff4..8d774e9 100644 --- a/src/mappings/veDelegation.ts +++ b/src/mappings/veDelegation.ts @@ -18,7 +18,7 @@ export function handleDelegation(event: DelegateBoost): void { const _expireTime = event.params._expire_time // create veOcean if does not exists getveOCEAN(_receiver) - getveOCEAN(_delegator) + const delegator = getveOCEAN(_delegator) const veDelegation = getveDelegation(event.address, _tokenId.toHex()) veDelegation.delegator = _delegator @@ -28,9 +28,11 @@ export function handleDelegation(event: DelegateBoost): void { _amount.toBigDecimal(), BigInt.fromI32(18).toI32() ) + veDelegation.lockedAmount = delegator.lockedAmount veDelegation.cancelTime = _cancelTime veDelegation.expireTime = _expireTime - veDelegation.save() + veDelegation. + veDelegation.save() const veDelegationUpdate = new VeDelegationUpdate( event.transaction.hash.toHex() + '-' + event.logIndex.toString()