Add lockedAmount to veDelegation

This commit is contained in:
trizin 2023-05-04 13:36:09 +03:00 committed by GitHub
parent e30047c430
commit 9b41d025e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -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!
}

View File

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