Skip to content

Commit

Permalink
revert rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
sameh-farouk committed May 20, 2024
1 parent 070c50d commit cb433c7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/mappings/tftPrice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ export async function priceStored(

let priceEvent
if (priceStoredEvent.isV9) {
// TODO: fix me U16F16 -> number
// use @encointer/util to parse U16F16 to number
priceEvent = BigDecimal(parseI16F16(new BN(priceStoredEvent.asV9[0], 'le'), 6)) // [Uint8Array, Uint8Array] <- U16F16, AccountId
priceEvent = BigDecimal(parseI16F16(new BN(priceStoredEvent.asV9[0], 'le'))) // [Uint8Array, Uint8Array] <- U16F16, AccountId
ctx.log.debug("V9: block number: " + block.height.toString() + ", timestamp: " + timestamp.toString() + ", Price: " + priceEvent.toString() + ", Raw: " + priceStoredEvent.asV9[0])

} else if (priceStoredEvent.isV49) {
// TODO: fix me U16F16 -> number
priceEvent = BigDecimal(parseI16F16(new BN(priceStoredEvent.asV49, 'le'), 6)) // Uint8Array <-U16F16
priceEvent = BigDecimal(parseI16F16(new BN(priceStoredEvent.asV49, 'le'))) // Uint8Array <-U16F16
ctx.log.debug("V49: block number: " + block.height.toString() + ", timestamp: " + timestamp.toString() + ", Price: " + priceEvent.toString() + ", Raw: " + priceStoredEvent.asV49[0])

} else if (priceStoredEvent.isV101) {
Expand Down

0 comments on commit cb433c7

Please sign in to comment.