-
Notifications
You must be signed in to change notification settings - Fork 801
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
Adapter from tokens::fungible
to tokens::fungibles
#2858
Conversation
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//! Adapter to use `fungibles:*` implementations as `fungibles::*`. |
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.
//! Adapter to use `fungibles:*` implementations as `fungibles::*`. | |
//! Adapter to use `fungible::*` implementations as `fungibles::*`. |
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 but better wait for someone who knows more to review.
/// Redirects `fungibles` function to the `fungible` equivalent without | ||
/// the AssetId argument. |
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.
Please try to do line-breaks at exactly 100 chars.
|
||
/// Redirects `fungibles` function to the `fungible` equivalent without | ||
/// the AssetId argument. | ||
macro_rules! redirect { |
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.
I am generally not a fan of macros, but this looks like a good use.
Maybe we should do the same for the ItemOf
adapter.
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.
Yeah, me too. This one should not be too hard to read, and remove a lot of boilerplate.
Should the change in ItemOf
be done in this PR or another?
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.
In another merge request would be better 🙏
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.
}; | ||
} | ||
|
||
pub struct ConvertHandleImbalanceDrop<H>(PhantomData<H>); |
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.
Some doc please on all public items.
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.
item_of::ConvertImbalanceDropHandler
doesn't have documentation either, and both are not re-exported. Should both have documentation or none?
} | ||
} | ||
|
||
/// A wrapper to use a `fungible` as a `fungibles` with a single asset. |
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.
/// A wrapper to use a `fungible` as a `fungibles` with a single asset. | |
/// A wrapper to use a `fungible` as a `fungibles` with a single asset `()`. |
(maybe this is obvious to others but i am not that deep into the asset stuff)
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.
There are adapters, fungible::UnionOf
(adapts some fungible
to fungibles
) and fungibles::UnionOf
(adapts some fungibles
to new fungibles
). they have unit tests, audited and already in use.
|
yes, but we do not need new adapter impls to achieve this. we need union of some fungible/s and empty set. where empty set can be presented as no-op implementation over unit type. plus you can introduce some type alias with some predefined type arguments (convertor, empty set) for |
Currently there is
frame_support::traits::fungible::ItemOf
which converts afungibles
into afungible
, but not the other way around. This PR thus adds an adapter fromfungible
tofungibles
.