Add lockedAmountinVe

This commit is contained in:
trizin 2023-05-04 13:55:53 +03:00 committed by GitHub
parent e14f78e1ca
commit 392e1f28d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -19,8 +19,10 @@ export function handleDelegation(event: DelegateBoost): void {
// create veOcean if does not exists
getveOCEAN(_receiver)
const delegator = getveOCEAN(_delegator)
const veDelegation = getveDelegation(event.address, _tokenId.toHex())
const MAX_TIME = 4 * 365 * 86400 // max lock time
veDelegation.delegator = _delegator
veDelegation.receiver = _receiver
veDelegation.tokenId = _tokenId
@ -29,6 +31,7 @@ export function handleDelegation(event: DelegateBoost): void {
BigInt.fromI32(18).toI32()
)
veDelegation.lockedAmount = delegator.lockedAmount
veDelegation.lockedAmountinVe = delegator.lockedAmount.mul(timeLeft).divDecimal(MAX_TIME)
veDelegation.cancelTime = _cancelTime
veDelegation.expireTime = _expireTime
veDelegation.save()