Skip to content

Commit

Permalink
Fix precision on toExchangeAmount
Browse files Browse the repository at this point in the history
Broken in b7b8bc5
  • Loading branch information
peachbits committed Oct 4, 2024
1 parent 78ebad1 commit 126b6af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- added: (LI.FI) Added unique parent contract addresses
- fixed: Division precision for Thorchain `toExchangeAmount`

## 2.8.1 (2024-10-02)

Expand Down
4 changes: 2 additions & 2 deletions src/swap/defi/thorchain/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { add, div, gt, mul, round, sub } from 'biggystring'
import { add, gt, mul, round, sub } from 'biggystring'
import {
asArray,
asBoolean,
Expand Down Expand Up @@ -888,7 +888,7 @@ const calcSwapFrom = async ({

log(`toThorAmountWithSpread = limit: ${toThorAmountWithSpread}`)

const toExchangeAmount = div(toThorAmountWithSpread, THOR_LIMIT_UNITS)
const toExchangeAmount = div18(toThorAmountWithSpread, THOR_LIMIT_UNITS)
log(`toExchangeAmount: ${toExchangeAmount}`)

const toNativeAmountFloat = await toWallet.denominationToNative(
Expand Down

0 comments on commit 126b6af

Please sign in to comment.