Adapter from tokens::fungible to tokens::fungibles#2858
Adapter from tokens::fungible to tokens::fungibles#2858nanocryk wants to merge 2 commits intoparitytech:masterfrom
tokens::fungible to tokens::fungibles#2858Conversation
| // 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.
| //! Adapter to use `fungibles:*` implementations as `fungibles::*`. | |
| //! Adapter to use `fungible::*` implementations as `fungibles::*`. |
ggwpez
left a comment
There was a problem hiding this comment.
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.
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.
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.
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.
In another merge request would be better 🙏
| }; | ||
| } | ||
|
|
||
| pub struct ConvertHandleImbalanceDrop<H>(PhantomData<H>); |
There was a problem hiding this comment.
Some doc please on all public items.
There was a problem hiding this comment.
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.
| /// 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)
muharem
left a comment
There was a problem hiding this comment.
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::ItemOfwhich converts afungiblesinto afungible, but not the other way around. This PR thus adds an adapter fromfungibletofungibles.