pendulum-chain / pendulum

GNU General Public License v3.0
43 stars 14 forks source link

Convert DIA prices to correct FixedPoint numbers #412

Closed ebma closed 4 months ago

ebma commented 4 months ago

Context

At the moment, the conversion of u128 prices to UnsignedFixedPoint numbers we use in our runtimes (see here) is not correct.

The prices are 10 ** 6 times smaller than they should because we are using u128 as the inner type of our UnsignedFixedPoint implementation, see here, which makes the FixedPoint implementation use a DIV of 1_000_000_000_000_000_000 (10e18), see here. The batching server converts the prices to u128 numbers considering 12 decimals in this function however. Thus we have a mismatch.

This is not problematic for the price conversions in Spacewalk but we should still try to fix this.

Related notion page here.

TODO

Change the conversion functions in the runtime to convert the incoming prices to correct FixedPoint numbers.