mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 08:11:03 +00:00
Runtime: Polkadot Fellowship promotion/demotion periods, members activity and salaries (#2607)
* core fellowship * core fellowship weights * salary * weights * fellowship pot * registration period 15 days * use treasury account for salary pay, promotion origin * decision period for tracks 30 days * docs * comment * Couple of fixes and some refactoring * Alter curves to be a bit more conservative * Use `PayOverXcm` for fellowship salary payments * Docs and remove unneeded code * Fixes * Move Fellowship stuff in line with whitepaper * fix: induction by a single Fellow (not proficient) * doc fix * renames, pallet index, allow unpaid for salary pallet * Fix budget units * Fixes * Test sovereign account for Fellowship salaries * Nice address test * Fixes * test for PayOverXcm setup * Update parachains/runtimes/collectives/collectives-polkadot/src/fellowship/mod.rs Co-authored-by: Bastian Köcher <git@kchr.de> --------- Co-authored-by: Gav <gavin@parity.io> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
[package]
|
||||
name = "collectives-polkadot-it"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
description = "Polkadot Collectives parachain runtime integration tests based on xcm-emulator"
|
||||
|
||||
[dev-dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false }
|
||||
|
||||
# Substrate
|
||||
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-weights = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
pallet-core-fellowship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
pallet-salary = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
# Polkadot
|
||||
polkadot-core-primitives = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
|
||||
# Cumulus
|
||||
parachains-common = { path = "../../../../common" }
|
||||
cumulus-pallet-xcmp-queue = { default-features = false, path = "../../../../../pallets/xcmp-queue" }
|
||||
collectives-polkadot-runtime = { path = "../../../../runtimes/collectives/collectives-polkadot" }
|
||||
asset-hub-polkadot-runtime = { path = "../../../../runtimes/assets/asset-hub-polkadot" }
|
||||
|
||||
# Local
|
||||
xcm-emulator = { default-features = false, path = "../../../../../xcm/xcm-emulator" }
|
||||
integration-tests-common = { default-features = false, path = "../../common" }
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// Copyright Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Collectives Parachain integration tests based on xcm-emulator.
|
||||
|
||||
#![cfg(test)]
|
||||
|
||||
pub use frame_support::assert_ok;
|
||||
pub use integration_tests_common::{
|
||||
constants::accounts::ALICE, AccountId, AssetHubPolkadot as AssetHub,
|
||||
AssetHubPolkadotPallet as AssetHubPallet, Collectives, CollectivesPallet, Polkadot,
|
||||
PolkadotMockNet,
|
||||
};
|
||||
pub use xcm::prelude::*;
|
||||
pub use xcm_emulator::{assert_expected_events, Parachain};
|
||||
|
||||
mod tests;
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
// Copyright Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Integration tests concerning the Fellowship.
|
||||
|
||||
use crate::*;
|
||||
use collectives_polkadot_runtime::fellowship::FellowshipSalaryPaymaster;
|
||||
use frame_support::traits::{
|
||||
fungibles::{Create, Mutate},
|
||||
tokens::Pay,
|
||||
};
|
||||
use sp_core::crypto::Ss58Codec;
|
||||
use xcm_emulator::{Network, TestExt};
|
||||
|
||||
#[test]
|
||||
fn pay_salary() {
|
||||
let asset_id: u32 = 1984;
|
||||
let pay_from: AccountId =
|
||||
<AccountId as Ss58Codec>::from_string("13w7NdvSR1Af8xsQTArDtZmVvjE8XhWNdL4yed3iFHrUNCnS")
|
||||
.unwrap();
|
||||
let pay_to = Polkadot::account_id_of(ALICE);
|
||||
let pay_amount = 9000;
|
||||
|
||||
PolkadotMockNet::_init();
|
||||
PolkadotMockNet::reset();
|
||||
|
||||
AssetHub::execute_with(|| {
|
||||
type AssetHubAssets = <AssetHub as AssetHubPallet>::Assets;
|
||||
|
||||
assert_ok!(<AssetHubAssets as Create<_>>::create(
|
||||
asset_id,
|
||||
pay_to.clone(),
|
||||
true,
|
||||
pay_amount / 2
|
||||
));
|
||||
assert_ok!(<AssetHubAssets as Mutate<_>>::mint_into(asset_id, &pay_from, pay_amount * 2));
|
||||
});
|
||||
|
||||
Collectives::execute_with(|| {
|
||||
type RuntimeEvent = <Collectives as Parachain>::RuntimeEvent;
|
||||
|
||||
assert_ok!(FellowshipSalaryPaymaster::pay(&pay_to, (), pay_amount));
|
||||
assert_expected_events!(
|
||||
Collectives,
|
||||
vec![
|
||||
RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }) => {},
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
AssetHub::execute_with(|| {
|
||||
type RuntimeEvent = <AssetHub as Parachain>::RuntimeEvent;
|
||||
|
||||
assert_expected_events!(
|
||||
AssetHub,
|
||||
vec![
|
||||
RuntimeEvent::Assets(pallet_assets::Event::Transferred { asset_id: id, from, to, amount }) => {
|
||||
asset_id: id == &asset_id,
|
||||
from: from == &pay_from,
|
||||
to: to == &pay_to,
|
||||
amount: amount == &pay_amount,
|
||||
},
|
||||
RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Success { .. }) => {},
|
||||
]
|
||||
);
|
||||
});
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// Copyright Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
mod fellowship;
|
||||
Reference in New Issue
Block a user