import type { BigDecimal } from './type'

export const greaterThan = (x: BigDecimal, y: BigDecimal): boolean => {
  // adjust the decimals and values
  const decimals = Math.max(x.decimals, y.decimals)
  const valueX = x.value * 10n ** BigInt(decimals - x.decimals)
  const valueY = y.value * 10n ** BigInt(decimals - y.decimals)
  return valueX > valueY
}
