Skip to content

Commit

Permalink
numbers make sense when you think about it
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronmgdr committed Feb 5, 2024
1 parent 64ce40b commit e2f34f9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/cli/src/utils/exchange.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('calculateExpectedSlippage', () => {
const sellingAmount = new BigNumber(100)
const quotedAmountToReceiveWithBuffer = new BigNumber(110)
const oracleMedianRate = new BigNumber('1.1')
const slippage = 0 // 2% slippage
const slippage = 0 // % slippage
// (Executed Price – Expected Price) / Expected Price * 100
expect(
calculateExpectedSlippage(sellingAmount, quotedAmountToReceiveWithBuffer, oracleMedianRate)
Expand All @@ -20,7 +20,7 @@ describe('calculateExpectedSlippage', () => {
const sellingAmount = new BigNumber(100)
const quotedAmountToReceiveWithBuffer = new BigNumber(105)
const oracleMedianRate = new BigNumber('1.1')
const slippage = -1.81 // 2% slippage
const slippage = -4.761904761904762 // % slippage
// (Executed Price – Expected Price) / Expected Price * 100
expect(
calculateExpectedSlippage(sellingAmount, quotedAmountToReceiveWithBuffer, oracleMedianRate)
Expand All @@ -32,8 +32,7 @@ describe('calculateExpectedSlippage', () => {
const sellingAmount = new BigNumber(100)
const quotedAmountToReceiveWithBuffer = new BigNumber(115)
const oracleMedianRate = new BigNumber('1.1')
const slippage = 1.81 // 2% slippage
// (Executed Price – Expected Price) / Expected Price * 100
const slippage = 4.3478260869565215 // % slippage
expect(
calculateExpectedSlippage(sellingAmount, quotedAmountToReceiveWithBuffer, oracleMedianRate)
).toEqual(slippage)
Expand Down

0 comments on commit e2f34f9

Please sign in to comment.