Introduce a new price system so we can convert asset->usd->asset correctly when they have different decimals.
Why?
Even if issuers use 10 decimals for their CT, we already know USDT and USDC use 6 decimals, so any conversions would be wrong.
How?
Change the price of assets instead of being for example PriceOf::from_float(1.5) for a price of 1.5$, we now use a relationship between our USD decimals and the asset decimals like so PriceOf::from_rational(1.5 * 10^6, 1 * 10^10) for the case where our base USD decimals is 6, and the asset being priced has 10 decimals
Testing?
test_usd_price_decimal_aware
All other tests are broken and will be fixed in a following PR on the stack
What?
asset->usd->asset
correctly when they have different decimals.Why?
How?
Change the price of assets instead of being for example PriceOf::from_float(1.5) for a price of 1.5$, we now use a relationship between our USD decimals and the asset decimals like so
PriceOf::from_rational(1.5 * 10^6, 1 * 10^10)
for the case where our base USD decimals is 6, and the asset being priced has 10 decimalsTesting?
test_usd_price_decimal_aware
All other tests are broken and will be fixed in a following PR on the stackScreenshots (optional)