From a21b03c495f537c37b4f92a270264ce647e248b8 Mon Sep 17 00:00:00 2001 From: trizin <25263018+trizin@users.noreply.github.com> Date: Thu, 4 May 2023 14:01:57 +0300 Subject: [PATCH] Fixes --- schema.graphql | 2 +- src/mappings/utils/veUtils.ts | 2 +- src/mappings/veDelegation.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/schema.graphql b/schema.graphql index 2275f2a..e38eede 100644 --- a/schema.graphql +++ b/schema.graphql @@ -469,7 +469,7 @@ type VeDelegation @entity { tokenId: BigInt! amount: BigDecimal! lockedAmount: BigDecimal! - timeLeft: BigDecimal! + timeLeft: Int! cancelTime: BigInt! expireTime: BigInt! updates: [VeDelegationUpdate!] @derivedFrom(field: "veDelegation") diff --git a/src/mappings/utils/veUtils.ts b/src/mappings/utils/veUtils.ts index de63e09..20ba3a7 100644 --- a/src/mappings/utils/veUtils.ts +++ b/src/mappings/utils/veUtils.ts @@ -137,7 +137,7 @@ export function getveDelegation( veDelegation.receiver = '' veDelegation.delegator = '' veDelegation.lockedAmount = BigDecimal.zero() - veDelegation.timeLeft = BigDecimal.zero() + veDelegation.timeLeft = BigInt.zero() veDelegation.save() } return veDelegation diff --git a/src/mappings/veDelegation.ts b/src/mappings/veDelegation.ts index a551ddc..9adac08 100644 --- a/src/mappings/veDelegation.ts +++ b/src/mappings/veDelegation.ts @@ -20,7 +20,7 @@ export function handleDelegation(event: DelegateBoost): void { getveOCEAN(_receiver) const delegator = getveOCEAN(_delegator) const veDelegation = getveDelegation(event.address, _tokenId.toHex()) - const ts = event.params.ts + const ts = event.block.timestamp.toI32() const MAX_TIME = 4 * 365 * 86400 // max lock time veDelegation.delegator = _delegator @@ -31,7 +31,7 @@ export function handleDelegation(event: DelegateBoost): void { BigInt.fromI32(18).toI32() ) veDelegation.lockedAmount = delegator.lockedAmount - veDelegation.timeLeft = ts - delegator.unlockTime + veDelegation.timeLeft = delegator.unlockTime - ts veDelegation.cancelTime = _cancelTime veDelegation.expireTime = _expireTime veDelegation.save()