Fixing decimals issue
This commit is contained in:
parent
b803f1eb6b
commit
249a3f4124
|
@ -6,6 +6,7 @@ import {
|
||||||
TransferBoost
|
TransferBoost
|
||||||
} from '../@types/veDelegation/veDelegation'
|
} from '../@types/veDelegation/veDelegation'
|
||||||
import { getveDelegation, getveOCEAN } from './utils/veUtils'
|
import { getveDelegation, getveOCEAN } from './utils/veUtils'
|
||||||
|
import { weiToDecimal } from './utils/generic'
|
||||||
|
|
||||||
export function handleDelegation(event: DelegateBoost): void {
|
export function handleDelegation(event: DelegateBoost): void {
|
||||||
const _delegator = event.params._delegator.toHex()
|
const _delegator = event.params._delegator.toHex()
|
||||||
|
@ -44,7 +45,7 @@ export function handleExtendBoost(event: ExtendBoost): void {
|
||||||
const veDelegation = getveDelegation(_tokenId.toHex())
|
const veDelegation = getveDelegation(_tokenId.toHex())
|
||||||
const delegatorVeOcean = getveOCEAN(_delegator)
|
const delegatorVeOcean = getveOCEAN(_delegator)
|
||||||
if (_amount && delegatorVeOcean.lockedAmount) {
|
if (_amount && delegatorVeOcean.lockedAmount) {
|
||||||
veDelegation.amountFraction = _amount.divDecimal(
|
veDelegation.amountFraction = weiToDecimal(_amount.toBigDecimal(), 18).div(
|
||||||
delegatorVeOcean.lockedAmount
|
delegatorVeOcean.lockedAmount
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue