Westend: Fellowship Treasury (#2532)

Treasury Pallet Instance for the Fellowship in Westend Collectives.

In this update, we present a Treasury Pallet Instance that is under the
control of the Fellowship body, with oversight from the Root and
Treasurer origins. Here's how it is governed:
- the Root origin have the authority to reject or approve spend
proposals, with no amount limit for approvals.
- the Treasurer origin have the authority to reject or approve spend
proposals, with approval limits of up to 10,000,000 DOT.
- Voice of all Fellows ranked at 3 or above can reject or approve spend
proposals, with a maximum approval limit of 10,000 DOT.
- Voice of Fellows ranked at 4 or above can also reject or approve spend
proposals, with a maximum approval limit of 10,000,000 DOT.

Additionally, we introduce the Asset Rate Pallet Instance to establish
conversion rates from asset A to B. This is used to determine if a
proposed spend amount involving a non-native asset is permissible by the
commanding origin. The rates can be set up by the Root, Treasurer
origins, or Voice of all Fellows.

---------

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: joepetrowski <joe@parity.io>
This commit is contained in:
Muharem
2023-12-08 14:02:09 +01:00
committed by GitHub
parent 1bdfb29587
commit da40d97a23
26 changed files with 827 additions and 27 deletions
@@ -0,0 +1,25 @@
[package]
name = "collectives-westend-emulated-chain"
version = "0.0.0"
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
description = "Collectives Westend emulated chain"
publish = false
[dependencies]
serde_json = "1.0.104"
# Substrate
sp-core = { path = "../../../../../../../../substrate/primitives/core", default-features = false }
sp-runtime = { path = "../../../../../../../../substrate/primitives/runtime", default-features = false }
frame-support = { path = "../../../../../../../../substrate/frame/support", default-features = false }
# Polakadot
parachains-common = { path = "../../../../../../../parachains/common" }
# Cumulus
cumulus-primitives-core = { path = "../../../../../../../primitives/core", default-features = false }
emulated-integration-tests-common = { path = "../../../../common", default-features = false }
collectives-westend-runtime = { path = "../../../../../../runtimes/collectives/collectives-westend" }
westend-emulated-chain = { path = "../../../relays/westend" }
@@ -0,0 +1,67 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Substrate
use sp_core::storage::Storage;
// Cumulus
use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators, SAFE_XCM_VERSION,
};
use parachains_common::Balance;
pub const PARA_ID: u32 = 1001;
pub const ED: Balance = parachains_common::westend::currency::EXISTENTIAL_DEPOSIT;
pub fn genesis() -> Storage {
let genesis_config = collectives_westend_runtime::RuntimeGenesisConfig {
system: collectives_westend_runtime::SystemConfig::default(),
balances: collectives_westend_runtime::BalancesConfig {
balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(),
},
parachain_info: collectives_westend_runtime::ParachainInfoConfig {
parachain_id: PARA_ID.into(),
..Default::default()
},
collator_selection: collectives_westend_runtime::CollatorSelectionConfig {
invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: ED * 16,
..Default::default()
},
session: collectives_westend_runtime::SessionConfig {
keys: collators::invulnerables()
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
collectives_westend_runtime::SessionKeys { aura }, // session keys
)
})
.collect(),
},
polkadot_xcm: collectives_westend_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
..Default::default()
};
build_genesis_storage(
&genesis_config,
collectives_westend_runtime::WASM_BINARY
.expect("WASM binary was not built, please build it!"),
)
}
@@ -0,0 +1,51 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
pub mod genesis;
// Substrate
use frame_support::traits::OnInitialize;
// Cumulus
use emulated_integration_tests_common::{
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain,
impls::Parachain, xcm_emulator::decl_test_parachains,
};
// CollectivesWestend Parachain declaration
decl_test_parachains! {
pub struct CollectivesWestend {
genesis = genesis::genesis(),
on_init = {
collectives_westend_runtime::AuraExt::on_initialize(1);
},
runtime = collectives_westend_runtime,
core = {
XcmpMessageHandler: collectives_westend_runtime::XcmpQueue,
LocationToAccountId: collectives_westend_runtime::xcm_config::LocationToAccountId,
ParachainInfo: collectives_westend_runtime::ParachainInfo,
},
pallets = {
PolkadotXcm: collectives_westend_runtime::PolkadotXcm,
Balances: collectives_westend_runtime::Balances,
FellowshipTreasury: collectives_westend_runtime::FellowshipTreasury,
AssetRate: collectives_westend_runtime::AssetRate,
}
},
}
// AssetHubWestend implementation
impl_accounts_helpers_for_parachain!(CollectivesWestend);
impl_assert_events_helpers_for_parachain!(CollectivesWestend);