Skip to content

Commit

Permalink
Merge pull request #11 from mangrovedao/fix/maxence/price
Browse files Browse the repository at this point in the history
fix: update price calculation
  • Loading branch information
maxencerb authored May 3, 2024
2 parents dd76563 + 485538b commit 37fd9d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/angry-beans-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@mangrovedao/mgv": patch
---

Fix price on bids
4 changes: 2 additions & 2 deletions src/lib/human-readable.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { formatUnits } from 'viem'
import type { BA } from './enums.js'
import { inboundFromOutbound, outboundFromInbound } from './tick.js'
import { inboundFromOutbound } from './tick.js'

// if ask, then outbound is the base, inbound is the quote
// if bid, then outbound is the quote, inbound is the base
Expand Down Expand Up @@ -33,7 +33,7 @@ export function rpcOfferToHumanOffer({
}
const total = Number(formatUnits(gives, quoteDecimals))
const volume = Number(
formatUnits(outboundFromInbound(tick, gives), baseDecimals),
formatUnits(inboundFromOutbound(tick, gives), baseDecimals),
)
const price = total / volume
return {
Expand Down

0 comments on commit 37fd9d7

Please sign in to comment.