astar_primitives/
governance.rs

1// This file is part of Astar.
2
3// Copyright (C) Stake Technologies Pte.Ltd.
4// SPDX-License-Identifier: GPL-3.0-or-later
5
6// Astar is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10
11// Astar is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License
17// along with Astar. If not, see <http://www.gnu.org/licenses/>.
18
19use crate::AccountId;
20use frame_support::traits::EitherOfDiverse;
21use frame_system::EnsureRoot;
22
23pub type MainCouncilMembershipInst = pallet_membership::Instance2;
24pub type TechnicalCommitteeMembershipInst = pallet_membership::Instance3;
25pub type CommunityCouncilMembershipInst = pallet_membership::Instance4;
26
27// Instance 1 was previously used for OracleMembership (now removed)
28pub type MainCouncilCollectiveInst = pallet_collective::Instance2;
29pub type TechnicalCommitteeCollectiveInst = pallet_collective::Instance3;
30pub type CommunityCouncilCollectiveInst = pallet_collective::Instance4;
31
32pub type MainTreasuryInst = pallet_treasury::Instance1;
33pub type CommunityTreasuryInst = pallet_treasury::Instance2;
34
35// Main Council
36pub type EnsureRootOrAllMainCouncil = EitherOfDiverse<
37    EnsureRoot<AccountId>,
38    pallet_collective::EnsureProportionAtLeast<AccountId, MainCouncilCollectiveInst, 1, 1>,
39>;
40
41pub type EnsureRootOrTwoThirdsMainCouncil = EitherOfDiverse<
42    EnsureRoot<AccountId>,
43    pallet_collective::EnsureProportionAtLeast<AccountId, MainCouncilCollectiveInst, 2, 3>,
44>;
45
46pub type EnsureRootOrThreeFourthMainCouncil = EitherOfDiverse<
47    EnsureRoot<AccountId>,
48    pallet_collective::EnsureProportionAtLeast<AccountId, MainCouncilCollectiveInst, 3, 4>,
49>;
50
51pub type EnsureRootOrHalfMainCouncil = EitherOfDiverse<
52    EnsureRoot<AccountId>,
53    pallet_collective::EnsureProportionAtLeast<AccountId, MainCouncilCollectiveInst, 1, 2>,
54>;
55
56// Technical Committee
57pub type EnsureRootOrAllTechnicalCommittee = EitherOfDiverse<
58    EnsureRoot<AccountId>,
59    pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCommitteeCollectiveInst, 1, 1>,
60>;
61
62pub type EnsureRootOrTwoThirdsTechnicalCommittee = EitherOfDiverse<
63    EnsureRoot<AccountId>,
64    pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCommitteeCollectiveInst, 2, 3>,
65>;
66
67pub type EnsureRootOrHalfTechnicalCommittee = EitherOfDiverse<
68    EnsureRoot<AccountId>,
69    pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCommitteeCollectiveInst, 1, 2>,
70>;
71
72// Community Council
73pub type EnsureRootOrAllCommunityCouncil = EitherOfDiverse<
74    EnsureRoot<AccountId>,
75    pallet_collective::EnsureProportionAtLeast<AccountId, CommunityCouncilCollectiveInst, 1, 1>,
76>;
77
78pub type EnsureRootOrTwoThirdsCommunityCouncil = EitherOfDiverse<
79    EnsureRoot<AccountId>,
80    pallet_collective::EnsureProportionAtLeast<AccountId, CommunityCouncilCollectiveInst, 2, 3>,
81>;
82
83pub type EnsureRootOrHalfCommunityCouncil = EitherOfDiverse<
84    EnsureRoot<AccountId>,
85    pallet_collective::EnsureProportionAtLeast<AccountId, CommunityCouncilCollectiveInst, 1, 2>,
86>;
87
88pub type EnsureRootOrFourFifthsCommunityCouncil = EitherOfDiverse<
89    EnsureRoot<AccountId>,
90    pallet_collective::EnsureProportionAtLeast<AccountId, CommunityCouncilCollectiveInst, 4, 5>,
91>;
92
93// Combination
94pub type EnsureRootOrHalfTechCommitteeOrTwoThirdCouncil = EitherOfDiverse<
95    EnsureRootOrHalfTechnicalCommittee,
96    pallet_collective::EnsureProportionAtLeast<AccountId, MainCouncilCollectiveInst, 2, 3>,
97>;