mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 04:01:02 +00:00
Rococo & Westend People Chain (#2281)
Rococo and Westend runtimes for the "People Chain". This chain contains the Identity pallet with plans to migrate all related data from the Relay Chain. Changes `IdentityInfo` to: - Remove `additional_fields`. - Add `github` and `discord` as first class fields. From scraping chain data, these were the only two additional fields used (for the Fellowship and Ambassador Program, respectively). - Rename `riot` to `matrix`. Note: This will use the script in https://github.com/paritytech/polkadot-sdk/pull/2025 to generate the genesis state. TODO: - [x] https://github.com/paritytech/polkadot-sdk/pull/1814 and integration of the Identity Migrator pallet for migration. - [x] Tests: https://github.com/paritytech/polkadot-sdk/pull/2373 --------- Co-authored-by: Muharem <ismailov.m.h@gmail.com> Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com> Co-authored-by: Dónal Murray <donal.murray@parity.io> Co-authored-by: Richard Melkonian <35300528+0xmovses@users.noreply.github.com> Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
This commit is contained in:
@@ -16,15 +16,12 @@
|
||||
use crate::OriginCaller;
|
||||
use frame_support::{
|
||||
dispatch::DispatchResultWithPostInfo,
|
||||
traits::{Currency, Get, Imbalance, OnUnbalanced, OriginTrait, PrivilegeCmp},
|
||||
traits::{Currency, PrivilegeCmp},
|
||||
weights::Weight,
|
||||
};
|
||||
use log;
|
||||
use pallet_alliance::{ProposalIndex, ProposalProvider};
|
||||
use parachains_common::impls::NegativeImbalance;
|
||||
use sp_runtime::DispatchError;
|
||||
use sp_std::{cmp::Ordering, marker::PhantomData, prelude::*};
|
||||
use xcm::latest::{Fungibility, Junction, Parent};
|
||||
|
||||
type AccountIdOf<T> = <T as frame_system::Config>::AccountId;
|
||||
|
||||
@@ -36,51 +33,6 @@ type HashOf<T> = <T as frame_system::Config>::Hash;
|
||||
pub type BalanceOf<T> =
|
||||
<pallet_balances::Pallet<T> as Currency<<T as frame_system::Config>::AccountId>>::Balance;
|
||||
|
||||
/// Implements `OnUnbalanced::on_unbalanced` to teleport slashed assets to relay chain treasury
|
||||
/// account.
|
||||
pub struct ToParentTreasury<TreasuryAccount, PalletAccount, T>(
|
||||
PhantomData<(TreasuryAccount, PalletAccount, T)>,
|
||||
);
|
||||
|
||||
impl<TreasuryAccount, PalletAccount, T> OnUnbalanced<NegativeImbalance<T>>
|
||||
for ToParentTreasury<TreasuryAccount, PalletAccount, T>
|
||||
where
|
||||
T: pallet_balances::Config + pallet_xcm::Config + frame_system::Config,
|
||||
<<T as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId: From<AccountIdOf<T>>,
|
||||
[u8; 32]: From<<T as frame_system::Config>::AccountId>,
|
||||
TreasuryAccount: Get<AccountIdOf<T>>,
|
||||
PalletAccount: Get<AccountIdOf<T>>,
|
||||
BalanceOf<T>: Into<Fungibility>,
|
||||
{
|
||||
fn on_unbalanced(amount: NegativeImbalance<T>) {
|
||||
let amount = match amount.drop_zero() {
|
||||
Ok(..) => return,
|
||||
Err(amount) => amount,
|
||||
};
|
||||
let imbalance = amount.peek();
|
||||
let pallet_acc: AccountIdOf<T> = PalletAccount::get();
|
||||
let treasury_acc: AccountIdOf<T> = TreasuryAccount::get();
|
||||
|
||||
<pallet_balances::Pallet<T>>::resolve_creating(&pallet_acc, amount);
|
||||
|
||||
let result = <pallet_xcm::Pallet<T>>::teleport_assets(
|
||||
<<T as frame_system::Config>::RuntimeOrigin>::signed(pallet_acc.into()),
|
||||
Box::new(Parent.into()),
|
||||
Box::new(
|
||||
Junction::AccountId32 { network: None, id: treasury_acc.into() }
|
||||
.into_location()
|
||||
.into(),
|
||||
),
|
||||
Box::new((Parent, imbalance).into()),
|
||||
0,
|
||||
);
|
||||
|
||||
if let Err(err) = result {
|
||||
log::warn!("Failed to teleport slashed assets: {:?}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Proposal provider for alliance pallet.
|
||||
/// Adapter from collective pallet to alliance proposal provider trait.
|
||||
pub struct AllianceProposalProvider<T, I = ()>(PhantomData<(T, I)>);
|
||||
@@ -157,6 +109,7 @@ pub mod benchmarks {
|
||||
use frame_support::traits::{
|
||||
fungible,
|
||||
tokens::{Pay, PaymentStatus},
|
||||
Get,
|
||||
};
|
||||
use pallet_ranked_collective::Rank;
|
||||
use parachains_common::{AccountId, Balance};
|
||||
|
||||
Reference in New Issue
Block a user