infrastructure-upgrade/lib/v3-core/test/shared/format.ts
T-Hax 735546619e
init
Signed-off-by: T-Hax <>
2023-04-08 18:46:18 +00:00

11 lines
385 B
TypeScript

import { Decimal } from 'decimal.js'
import { BigNumberish } from 'ethers'
export function formatTokenAmount(num: BigNumberish): string {
return new Decimal(num.toString()).dividedBy(new Decimal(10).pow(18)).toPrecision(5)
}
export function formatPrice(price: BigNumberish): string {
return new Decimal(price.toString()).dividedBy(new Decimal(2).pow(96)).pow(2).toPrecision(5)
}