Skip to content

Commit

Permalink
Merge pull request #44 from consenlabs/feature/fix_bignumber_bug
Browse files Browse the repository at this point in the history
fix bignumber bug
  • Loading branch information
BenjaminLu authored Oct 14, 2022
2 parents a7176f4 + 706c509 commit 71163f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/handler/newOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ function extractAssetAmounts(
makerToken.decimal
)
takerAssetAmount = fromUnitToDecimalBN(
amountBN.dividedBy(rate).toFixed(findSuitablePrecision(takerToken.decimal)),
amountBN.dividedBy(rate.toString()).toFixed(findSuitablePrecision(takerToken.decimal)),
takerToken.decimal
)
} else {
makerAssetAmount = fromUnitToDecimalBN(
amountBN.times(rate).toFixed(findSuitablePrecision(makerToken.decimal)),
amountBN.times(rate.toString()).toFixed(findSuitablePrecision(makerToken.decimal)),
makerToken.decimal
)
takerAssetAmount = fromUnitToDecimalBN(
Expand Down
4 changes: 2 additions & 2 deletions src/quoting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BackendError } from './handler/errors'
import { updaterStack } from './worker'
import { truncateAmount, toBN, getSupportedTokens } from './utils'

const DISPLAY_PRECEISION = 8
const DISPLAY_PRECEISION = 16

const getPrefix = (): string => `${updaterStack.markerMakerConfigUpdater.cacheResult.mmId}--`

Expand All @@ -30,7 +30,7 @@ export const constructQuoteResponse = (indicativePrice: IndicativePriceApiResult
salt,
minAmount,
maxAmount,
rate: toBN((+rate).toFixed(DISPLAY_PRECEISION)).toNumber(),
rate: (+rate).toFixed(DISPLAY_PRECEISION),
makerAddress,
}
}
Expand Down

0 comments on commit 71163f5

Please sign in to comment.