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 OracleMembershipInst = pallet_membership::Instance1;
24pub type MainCouncilMembershipInst = pallet_membership::Instance2;
25pub type TechnicalCommitteeMembershipInst = pallet_membership::Instance3;
26pub type CommunityCouncilMembershipInst = pallet_membership::Instance4;
27
28// Leaving instance 1 for potentially having an oracle membership collective instance
29pub type MainCouncilCollectiveInst = pallet_collective::Instance2;
30pub type TechnicalCommitteeCollectiveInst = pallet_collective::Instance3;
31pub type CommunityCouncilCollectiveInst = pallet_collective::Instance4;
32
33pub type MainTreasuryInst = pallet_treasury::Instance1;
34pub type CommunityTreasuryInst = pallet_treasury::Instance2;
35
36// Main Council
37pub type EnsureRootOrAllMainCouncil = EitherOfDiverse<
38    EnsureRoot<AccountId>,
39    pallet_collective::EnsureProportionAtLeast<AccountId, MainCouncilCollectiveInst, 1, 1>,
40>;
41
42pub type EnsureRootOrTwoThirdsMainCouncil = EitherOfDiverse<
43    EnsureRoot<AccountId>,
44    pallet_collective::EnsureProportionAtLeast<AccountId, MainCouncilCollectiveInst, 2, 3>,
45>;
46
47pub type EnsureRootOrThreeFourthMainCouncil = EitherOfDiverse<
48    EnsureRoot<AccountId>,
49    pallet_collective::EnsureProportionAtLeast<AccountId, MainCouncilCollectiveInst, 3, 4>,
50>;
51
52pub type EnsureRootOrHalfMainCouncil = EitherOfDiverse<
53    EnsureRoot<AccountId>,
54    pallet_collective::EnsureProportionAtLeast<AccountId, MainCouncilCollectiveInst, 1, 2>,
55>;
56
57// Technical Committee
58pub type EnsureRootOrAllTechnicalCommittee = EitherOfDiverse<
59    EnsureRoot<AccountId>,
60    pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCommitteeCollectiveInst, 1, 1>,
61>;
62
63pub type EnsureRootOrTwoThirdsTechnicalCommittee = EitherOfDiverse<
64    EnsureRoot<AccountId>,
65    pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCommitteeCollectiveInst, 2, 3>,
66>;
67
68pub type EnsureRootOrHalfTechnicalCommittee = EitherOfDiverse<
69    EnsureRoot<AccountId>,
70    pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCommitteeCollectiveInst, 1, 2>,
71>;
72
73// Community Council
74pub type EnsureRootOrAllCommunityCouncil = EitherOfDiverse<
75    EnsureRoot<AccountId>,
76    pallet_collective::EnsureProportionAtLeast<AccountId, CommunityCouncilCollectiveInst, 1, 1>,
77>;
78
79pub type EnsureRootOrTwoThirdsCommunityCouncil = EitherOfDiverse<
80    EnsureRoot<AccountId>,
81    pallet_collective::EnsureProportionAtLeast<AccountId, CommunityCouncilCollectiveInst, 2, 3>,
82>;
83
84pub type EnsureRootOrHalfCommunityCouncil = EitherOfDiverse<
85    EnsureRoot<AccountId>,
86    pallet_collective::EnsureProportionAtLeast<AccountId, CommunityCouncilCollectiveInst, 1, 2>,
87>;
88
89pub type EnsureRootOrFourFifthsCommunityCouncil = EitherOfDiverse<
90    EnsureRoot<AccountId>,
91    pallet_collective::EnsureProportionAtLeast<AccountId, CommunityCouncilCollectiveInst, 4, 5>,
92>;
93
94// Combination
95pub type EnsureRootOrHalfTechCommitteeOrTwoThirdCouncil = EitherOfDiverse<
96    EnsureRootOrHalfTechnicalCommittee,
97    pallet_collective::EnsureProportionAtLeast<AccountId, MainCouncilCollectiveInst, 2, 3>,
98>;