mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
Add lockedAmount to veDelegation (#672)
* Add lockedAmount to veDelegation
* Fix typo
* Fixes
* Add lockedAmountinVe
* Replace lockedAmountinVe with timeLeft
* Use event.params.ts
* Fixes
* Fix
* Delete maxtime
* Fix
* Fix and rename
* Revert "Fix and rename"
This reverts commit 70846eafe2
.
* fix
* fix
---------
Co-authored-by: alexcos20 <alex.coseru@gmail.com>
This commit is contained in:
parent
e1df119197
commit
2ca1280328
@ -481,6 +481,8 @@ type VeDelegation @entity {
|
||||
receiver: VeOCEAN!
|
||||
tokenId: BigInt!
|
||||
amount: BigDecimal!
|
||||
lockedAmount: BigDecimal!
|
||||
timeLeftUnlock: Int!
|
||||
cancelTime: BigInt!
|
||||
expireTime: BigInt!
|
||||
updates: [VeDelegationUpdate!] @derivedFrom(field: "veDelegation")
|
||||
@ -628,4 +630,3 @@ type NftTransferHistory @entity {
|
||||
timestamp: Int!
|
||||
block: Int!
|
||||
}
|
||||
|
||||
|
@ -140,6 +140,8 @@ export function getveDelegation(
|
||||
veDelegation.amount = BigDecimal.zero()
|
||||
veDelegation.receiver = ''
|
||||
veDelegation.delegator = ''
|
||||
veDelegation.lockedAmount = BigDecimal.zero()
|
||||
veDelegation.timeLeftUnlock = 0
|
||||
veDelegation.save()
|
||||
}
|
||||
return veDelegation
|
||||
|
@ -18,9 +18,10 @@ 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())
|
||||
const ts = event.block.timestamp.toI32()
|
||||
|
||||
veDelegation.delegator = _delegator
|
||||
veDelegation.receiver = _receiver
|
||||
veDelegation.tokenId = _tokenId
|
||||
@ -28,6 +29,8 @@ export function handleDelegation(event: DelegateBoost): void {
|
||||
_amount.toBigDecimal(),
|
||||
BigInt.fromI32(18).toI32()
|
||||
)
|
||||
veDelegation.lockedAmount = delegator.lockedAmount
|
||||
veDelegation.timeLeftUnlock = delegator.unlockTime.toI32() - ts
|
||||
veDelegation.cancelTime = _cancelTime
|
||||
veDelegation.expireTime = _expireTime
|
||||
veDelegation.save()
|
||||
|
Loading…
Reference in New Issue
Block a user