-
Notifications
You must be signed in to change notification settings - Fork 301
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
Add a filter for filtering unsupported MultiLocation
#714
Add a filter for filtering unsupported MultiLocation
#714
Conversation
Signed-off-by: Dengjianping <djptux@gmail.com>
Signed-off-by: Dengjianping <djptux@gmail.com>
Signed-off-by: Dengjianping <djptux@gmail.com>
Signed-off-by: Dengjianping <djptux@gmail.com>
Signed-off-by: Dengjianping <djptux@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #714 +/- ##
==========================================
+ Coverage 75.37% 75.46% +0.08%
==========================================
Files 83 83
Lines 7441 7476 +35
==========================================
+ Hits 5609 5642 +33
- Misses 1832 1834 +2
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
|
||
ParaB::execute_with(|| { | ||
assert_ok!(ParaTokens::deposit(CurrencyId::B, &ALICE, 1_000)); | ||
assert_noop!( |
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.
more test with transfer_multiassets
and transfer_multicurrencies
etc
Signed-off-by: Dengjianping <djptux@gmail.com>
xtokens/src/mock/para.rs
Outdated
} | ||
|
||
pub struct WhiteListingMultiLocations; | ||
impl Contains<MultiLocation> for WhiteListingMultiLocations { |
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 could offer some default implementation(in trait/location.rs), and use Tuple combine with fall-through way. i.e. AllowParentAccount
, AllowParachainAccount
, AllowLocalAccount
. so parachain can use like type MultiLocationsFilter = (AllowParentAccount, AllowParachainAccount)
or type MultiLocationsFilter = (AllowParentAccount, AllowParachainAccount, AllowLocalAccount)
if they allow local 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.
or a simple way like:
match_type! {
pub type ParentOrParachain: impl Contains<MultiLocation> = {
MultiLocation { parents: 1, interior: X1(AccountId32(_)) } |
MultiLocation { parents: 1, interior: X2(Parachain(_), AccountId32(_)) }
};
}
if allow local asset:
match_type! {
pub type ParentOrParachainOrLocal: impl Contains<MultiLocation> = {
MultiLocation { parents: 0, interior: X1(AccountId32(_)) } |
MultiLocation { parents: 1, interior: X1(AccountId32(_)) } |
MultiLocation { parents: 1, interior: X2(Parachain(_), AccountId32(_)) }
};
}
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 cannot use Parachain(_)
, becasue it will match all para id.
Signed-off-by: Dengjianping <djptux@gmail.com>
Closes #714
Add an associated type
MultiLocationsFilter
to filter unsupportedMultiLocation
.