Add a filter for filtering unsupported MultiLocation#714
Add a filter for filtering unsupported MultiLocation#714xlc merged 8 commits intoopen-web3-stack:masterfrom
MultiLocation#714Conversation
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.
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.
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.
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.
I cannot use Parachain(_), becasue it will match all para id.
Signed-off-by: Dengjianping <djptux@gmail.com>
Closes #714
Add an associated type
MultiLocationsFilterto filter unsupportedMultiLocation.