-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: order book working with local currencies #1773
Conversation
pallets/order-book/src/lib.rs
Outdated
let from_decimals = T::AssetRegistry::metadata(&T::NativeCurrency::get()) | ||
.ok_or(Error::<T>::InvalidCurrencyId)? | ||
.decimals; | ||
|
||
let to_decimals = T::AssetRegistry::metadata(¤cy) | ||
.ok_or(Error::<T>::InvalidCurrencyId)? | ||
.decimals; | ||
|
||
Ok(convert_balance_decimals( | ||
from_decimals, | ||
to_decimals, | ||
T::MinFulfillmentAmountNative::get().into(), | ||
)? | ||
.into()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can avoid having an external trait to do this if we know the Native currency
5bf28de
to
99e0bcf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except for the two debugging leftovers. Thanks a lot for taking care of this so quickly! I propose to open a follow up PR which bumps spec versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Faster than Usain Bolt!
😆, thanks for reviewing William! |
Not so fast, benchmarking is failing |
Modified the fix a bit to use the native decimals instead of the native currency itself, to avoid difficult initializations of the native currency in benchmarking of pallets that uses order-book |
Description
DecimalConverter
trait, which does not handle Local currencies.order-book
generically for any currency.