-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow communities to send XCM (#360)
* Allow communities to send XCM * change(runtime-kreivo): convert Plurality beneficiary into community AccountId * Allow communities to send XCM * wip(pallet-communities): dispatch_as_origin * fix(kreivo-runtime): comment fixup * change: gate certain pallet-communities calls behind "testnet" feature --------- Co-authored-by: Pablo Andrés Dorado Suárez <[email protected]>
- Loading branch information
Showing
11 changed files
with
116 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use super::*; | ||
|
||
use crate::Communities; | ||
use sp_runtime::SaturatedConversion; | ||
use xcm::v3::{BodyId, Junction::Plurality}; | ||
use xcm_executor::traits::ConvertLocation; | ||
|
||
pub struct PluralityConvertsToCommunityAccountId; | ||
impl ConvertLocation<AccountId> for PluralityConvertsToCommunityAccountId { | ||
fn convert_location(location: &MultiLocation) -> Option<AccountId> { | ||
log::trace!("Attempting to convert {:?} into AccountId if plurality", location); | ||
match location { | ||
MultiLocation { | ||
parents: 0, | ||
interior: X1(Plurality { | ||
id: BodyId::Index(id), .. | ||
}), | ||
} => Some(Communities::community_account(&(*id).saturated_into())), | ||
_ => None, | ||
} | ||
} | ||
} |