You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The buyout possibly involves tokens with different decimals. We have to take that difference into account during the price calculation, otherwise the resulting exchange rates shift a lot.
Add a coupling to the asset registry pallet where the decimals are stored in the metadata of each asset
Use the DecimalsLookup trait defined in Spacewalk and either use one of the existing implementations for each runtime (eg. Pendulum) or implement that trait anew so that it tries to get the decimals from the asset registry metadata.
I think the approach to use the DecimalsLookup trait but implementing it so that it accesses the asset registry is the best approach.
The implementation for the price conversion can look similar to this one.
The text was updated successfully, but these errors were encountered:
Context
The buyout possibly involves tokens with different decimals. We have to take that difference into account during the price calculation, otherwise the resulting exchange rates shift a lot.
TODO
Take the asset decimals into account when calculating the respective amounts in calc_amount_to_exchange and calc_buyout_amount.
We can do this in two ways:
I think the approach to use the
DecimalsLookup
trait but implementing it so that it accesses the asset registry is the best approach.The implementation for the price conversion can look similar to this one.
The text was updated successfully, but these errors were encountered: