mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
Fixing decimals issue (#644)
* Fixing decimals issue * Updating package.json
This commit is contained in:
parent
b803f1eb6b
commit
0cf40d40ce
@ -32,7 +32,6 @@
|
||||
"test-ve": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/VeOcean.test.ts'",
|
||||
"test-df": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/DFRewards.test.ts'",
|
||||
"test-dt": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/Datatoken.test.ts'",
|
||||
"test-delegation": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/veDelegation.test.ts'",
|
||||
"test-zend": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/ZEnding.test.ts'",
|
||||
"lint": "eslint --ignore-path .gitignore --ext .js --ext .ts --ext .tsx .",
|
||||
"lint:fix": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx . --fix",
|
||||
|
@ -6,6 +6,7 @@ import {
|
||||
TransferBoost
|
||||
} from '../@types/veDelegation/veDelegation'
|
||||
import { getveDelegation, getveOCEAN } from './utils/veUtils'
|
||||
import { weiToDecimal } from './utils/generic'
|
||||
|
||||
export function handleDelegation(event: DelegateBoost): void {
|
||||
const _delegator = event.params._delegator.toHex()
|
||||
@ -44,7 +45,7 @@ export function handleExtendBoost(event: ExtendBoost): void {
|
||||
const veDelegation = getveDelegation(_tokenId.toHex())
|
||||
const delegatorVeOcean = getveOCEAN(_delegator)
|
||||
if (_amount && delegatorVeOcean.lockedAmount) {
|
||||
veDelegation.amountFraction = _amount.divDecimal(
|
||||
veDelegation.amountFraction = weiToDecimal(_amount.toBigDecimal(), 18).div(
|
||||
delegatorVeOcean.lockedAmount
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user