Making percentage update conditional

This commit is contained in:
Jamie Hewitt 2023-03-22 15:22:32 +03:00
parent dd98790cc8
commit 0178464cff
1 changed files with 10 additions and 6 deletions

View File

@ -19,9 +19,11 @@ export function handleDelegation(event: DelegateBoost): void {
veDelegation.delegator = _delegator
getveOCEAN(_receiver)
const delegatorVeOcean = getveOCEAN(_delegator)
veDelegation.amountFraction = _amount.divDecimal(
delegatorVeOcean.lockedAmount
)
if (_amount && delegatorVeOcean.lockedAmount) {
veDelegation.amountFraction = _amount.divDecimal(
delegatorVeOcean.lockedAmount
)
}
veDelegation.receiver = _receiver
veDelegation.tokenId = _tokenId
veDelegation.amount = _amount
@ -41,9 +43,11 @@ export function handleExtendBoost(event: ExtendBoost): void {
const veDelegation = getveDelegation(_tokenId.toHex())
const delegatorVeOcean = getveOCEAN(_delegator)
veDelegation.amountFraction = _amount.divDecimal(
delegatorVeOcean.lockedAmount
)
if (_amount && delegatorVeOcean.lockedAmount) {
veDelegation.amountFraction = _amount.divDecimal(
delegatorVeOcean.lockedAmount
)
}
veDelegation.delegator = _delegator
veDelegation.receiver = _receiver
veDelegation.tokenId = _tokenId