Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pallets/asset-index/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ pub mod pallet {
/// into the sovereign account of either:
/// - the given `recipient` if provided
/// - the caller's account if `recipient` is `None`
#[pallet::weight(T::WeightInfo::remove_asset())] // TODO: Set weights
#[pallet::weight(T::WeightInfo::remove_asset())]
pub fn remove_asset(
origin: OriginFor<T>,
asset_id: T::AssetId,
Expand Down Expand Up @@ -479,7 +479,7 @@ pub mod pallet {
///
/// The distribution of the underlying assets will be equivalent to the
/// ratio of the liquid assets in the index.
#[pallet::weight(T::WeightInfo::withdraw())] // TODO: Set weights
#[pallet::weight(T::WeightInfo::withdraw())]
#[transactional]
pub fn withdraw(origin: OriginFor<T>, amount: T::Balance) -> DispatchResultWithPostInfo {
let caller = ensure_signed(origin)?;
Expand Down Expand Up @@ -564,7 +564,7 @@ pub mod pallet {
/// as soon as the aforementioned conditions are met, regardless of
/// whether the other `AssetWithdrawal`s in the same `PendingWithdrawal` set
/// can also be closed successfully.
#[pallet::weight(T::WeightInfo::complete_withdraw())] // TODO: Set weights
#[pallet::weight(T::WeightInfo::complete_withdraw())]
pub fn complete_withdraw(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
let caller = ensure_signed(origin)?;

Expand Down
1 change: 1 addition & 0 deletions runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
pub mod constants;
pub mod traits;
pub mod types;
pub mod weights;
9 changes: 9 additions & 0 deletions runtime/common/src/types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2021 ChainSafe Systems
// SPDX-License-Identifier: LGPL-3.0-only

/// Origin that approved by committee
pub type GovernanceOrigin<AccountId, Runtime> = frame_system::EnsureOneOf<
AccountId,
frame_system::EnsureRoot<AccountId>,
pallet_committee::EnsureApprovedByCommittee<Runtime>,
>;
16 changes: 4 additions & 12 deletions runtime/dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ use xcm_executor::XcmExecutor;

use frame_support::traits::Everything;
use pallet_committee::EnsureMember;
pub use pint_runtime_common::{constants::*, weights};
pub use pint_runtime_common::{constants::*, types::GovernanceOrigin, weights};
use primitives::traits::MultiAssetRegistry;
pub use primitives::*;
use xcm_calls::{
Expand Down Expand Up @@ -384,7 +384,7 @@ impl pallet_session::Config for Runtime {
impl pallet_collator_selection::Config for Runtime {
type Event = Event;
type Currency = Balances;
type UpdateOrigin = EnsureApprovedByCommittee;
type UpdateOrigin = GovernanceOrigin<AccountId, Runtime>;
type PotId = PotId;
type MaxCandidates = MaxCandidates;
type MinCandidates = MinCandidates;
Expand All @@ -407,21 +407,14 @@ impl pallet_local_treasury::Config for Runtime {
}

impl pallet_saft_registry::Config for Runtime {
// Using signed as the admin origin for now
type AdminOrigin = frame_system::EnsureSigned<AccountId>;
type AdminOrigin = GovernanceOrigin<AccountId, Runtime>;
type AssetRecorder = AssetIndex;
type Balance = Balance;
type AssetId = AssetId;
type Event = Event;
type WeightInfo = weights::pallet_saft_registry::WeightInfo<Runtime>;
}

type EnsureApprovedByCommittee = frame_system::EnsureOneOf<
AccountId,
frame_system::EnsureRoot<AccountId>,
pallet_committee::EnsureApprovedByCommittee<Runtime>,
>;

impl pallet_committee::Config for Runtime {
type Origin = Origin;
type Action = Call;
Expand All @@ -431,13 +424,12 @@ impl pallet_committee::Config for Runtime {
type MinCouncilVotes = MinCouncilVotes;
type ProposalSubmissionOrigin = EnsureSigned<AccountId>;
type ProposalExecutionOrigin = EnsureMember<Self>;
type ApprovedByCommitteeOrigin = EnsureApprovedByCommittee;
type ApprovedByCommitteeOrigin = GovernanceOrigin<AccountId, Runtime>;
type Event = Event;
type WeightInfo = weights::pallet_committee::WeightInfo<Runtime>;
}

impl pallet_price_feed::Config for Runtime {
// Using root as the admin origin for now
type AdminOrigin = frame_system::EnsureRoot<AccountId>;
type SelfAssetId = PINTAssetId;
type AssetId = AssetId;
Expand Down
15 changes: 4 additions & 11 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ use xcm_executor::XcmExecutor;

use frame_support::traits::Everything;
use pallet_committee::EnsureMember;
pub use pint_runtime_common::{constants::*, weights};
pub use pint_runtime_common::{constants::*, types::GovernanceOrigin, weights};
use primitives::traits::MultiAssetRegistry;
pub use primitives::*;
use xcm_calls::{
Expand Down Expand Up @@ -382,7 +382,7 @@ impl pallet_session::Config for Runtime {
impl pallet_collator_selection::Config for Runtime {
type Event = Event;
type Currency = Balances;
type UpdateOrigin = EnsureApprovedByCommittee;
type UpdateOrigin = GovernanceOrigin<AccountId, Runtime>;
type PotId = PotId;
type MaxCandidates = MaxCandidates;
type MinCandidates = MinCandidates;
Expand All @@ -405,21 +405,14 @@ impl pallet_local_treasury::Config for Runtime {
}

impl pallet_saft_registry::Config for Runtime {
// Using signed as the admin origin for now
type AdminOrigin = frame_system::EnsureSigned<AccountId>;
type AdminOrigin = GovernanceOrigin<AccountId, Runtime>;
type AssetRecorder = AssetIndex;
type Balance = Balance;
type AssetId = AssetId;
type Event = Event;
type WeightInfo = weights::pallet_saft_registry::WeightInfo<Runtime>;
}

type EnsureApprovedByCommittee = frame_system::EnsureOneOf<
AccountId,
frame_system::EnsureRoot<AccountId>,
pallet_committee::EnsureApprovedByCommittee<Runtime>,
>;

impl pallet_committee::Config for Runtime {
type Origin = Origin;
type Action = Call;
Expand All @@ -429,7 +422,7 @@ impl pallet_committee::Config for Runtime {
type MinCouncilVotes = MinCouncilVotes;
type ProposalSubmissionOrigin = EnsureSigned<AccountId>;
type ProposalExecutionOrigin = EnsureMember<Self>;
type ApprovedByCommitteeOrigin = EnsureApprovedByCommittee;
type ApprovedByCommitteeOrigin = GovernanceOrigin<AccountId, Runtime>;
type Event = Event;
type WeightInfo = weights::pallet_committee::WeightInfo<Runtime>;
}
Expand Down
18 changes: 5 additions & 13 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ use xcm_executor::XcmExecutor;

use frame_support::traits::Everything;
use pallet_committee::EnsureMember;
pub use pint_runtime_common::{constants::*, weights};
pub use pint_runtime_common::{constants::*, types::GovernanceOrigin, weights};
use primitives::traits::MultiAssetRegistry;
pub use primitives::*;
use xcm_calls::{
Expand Down Expand Up @@ -384,7 +384,7 @@ impl pallet_session::Config for Runtime {
impl pallet_collator_selection::Config for Runtime {
type Event = Event;
type Currency = Balances;
type UpdateOrigin = EnsureApprovedByCommittee;
type UpdateOrigin = GovernanceOrigin<AccountId, Runtime>;
type PotId = PotId;
type MaxCandidates = MaxCandidates;
type MinCandidates = MinCandidates;
Expand All @@ -407,21 +407,14 @@ impl pallet_local_treasury::Config for Runtime {
}

impl pallet_saft_registry::Config for Runtime {
// Using signed as the admin origin for now
type AdminOrigin = frame_system::EnsureSigned<AccountId>;
type AdminOrigin = GovernanceOrigin<AccountId, Runtime>;
type AssetRecorder = AssetIndex;
type Balance = Balance;
type AssetId = AssetId;
type Event = Event;
type WeightInfo = weights::pallet_saft_registry::WeightInfo<Runtime>;
}

type EnsureApprovedByCommittee = frame_system::EnsureOneOf<
AccountId,
frame_system::EnsureRoot<AccountId>,
pallet_committee::EnsureApprovedByCommittee<Runtime>,
>;

impl pallet_committee::Config for Runtime {
type Origin = Origin;
type Action = Call;
Expand All @@ -431,7 +424,7 @@ impl pallet_committee::Config for Runtime {
type MinCouncilVotes = MinCouncilVotes;
type ProposalSubmissionOrigin = EnsureSigned<AccountId>;
type ProposalExecutionOrigin = EnsureMember<Self>;
type ApprovedByCommitteeOrigin = EnsureApprovedByCommittee;
type ApprovedByCommitteeOrigin = GovernanceOrigin<AccountId, Runtime>;
type Event = Event;
type WeightInfo = weights::pallet_committee::WeightInfo<Runtime>;
}
Expand Down Expand Up @@ -461,8 +454,7 @@ impl pallet_chainlink_feed::Config for Runtime {
}

impl pallet_asset_index::Config for Runtime {
// Using signed as the admin origin for testing now
type AdminOrigin = frame_system::EnsureSigned<AccountId>;
type AdminOrigin = GovernanceOrigin<AccountId, Runtime>;
type IndexToken = Balances;
type Balance = Balance;
type LockupPeriod = LockupPeriod;
Expand Down