taproot-assets
taproot-assets copied to clipboard
[bug]: Decimals cause the Price Oracle to have significant price deviations or failures.
When Assets have decimals, for example, USDT with 5 decimals, and BTC/USDT = 60,000, then 1 unit of USDT = (1 BTC Sat) * 1,000 (msat) / (Price * decimal)
1 unit USDT = 100,000,000 * 1000 / (6000 * 100000) = 16.667 mSat.
Since the PriceOracle cannot return values below 1/1000 sat, after rounding, the result will be 17 mSat, the resulting price deviation can be quite significant.
For assets with more decimals or lower prices, it may no longer be possible to return 1 mSat.
if AssetA = 0.01 USDT , So 1 unit AssetA = 0.16667 mSat.
As a solution, since subject_asset_max_amount is already provided in the QueryRateTickRequest, could the Price Oracle return the total value instead of the unit price for the asset, thereby avoiding the issue described above?