Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 7 additions & 3 deletions frame/mosaic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ pub mod pallet {
+ PartialEq;

type NetworkId: FullCodec + TypeInfo + Clone + Debug + PartialEq;

/// Origin capable of setting the relayer. Inteded to be RootOrHalfCouncil, as it is also
/// used as the origin capable of stopping attackers.
type ControlOrigin: EnsureOrigin<Self::Origin>;
}

#[pallet::pallet]
Expand Down Expand Up @@ -254,7 +258,7 @@ pub mod pallet {
origin: OriginFor<T>,
relayer: T::AccountId,
) -> DispatchResultWithPostInfo {
ensure_root(origin)?;
T::ControlOrigin::ensure_origin(origin)?;
Relayer::<T>::set(Some(StaleRelayer::new(relayer.clone())));
Self::deposit_event(Event::RelayerSet { relayer });
Ok(().into())
Expand Down Expand Up @@ -308,7 +312,7 @@ pub mod pallet {
) -> DispatchResultWithPostInfo {
// Can also be token governance associated I reckon, as Angular holders should be able
// to grant mosaic permission to mint. We'll save that for phase 3.
ensure_root(origin)?;
T::ControlOrigin::ensure_origin(origin)?;
let current_block = <frame_system::Pallet<T>>::block_number();

AssetsInfo::<T>::mutate(asset_id, |item| {
Expand Down Expand Up @@ -549,7 +553,7 @@ pub mod pallet {
origin: OriginFor<T>,
period: BlockNumberOf<T>,
) -> DispatchResultWithPostInfo {
ensure_root(origin)?;
T::ControlOrigin::ensure_origin(origin)?;
ensure!(period > T::MinimumTimeLockPeriod::get(), Error::<T>::BadTimelockPeriod);
TimeLockPeriod::<T>::set(period);
Ok(().into())
Expand Down
1 change: 1 addition & 0 deletions frame/mosaic/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ impl pallet_mosaic::Config for Test {
type BudgetPenaltyDecayer = pallet_mosaic::BudgetPenaltyDecayer<Balance, BlockNumber>;

type NetworkId = NetworkId;
type ControlOrigin = EnsureRoot<Self::AccountId>;
}

// Build genesis storage according to the mock runtime.
Expand Down
3 changes: 2 additions & 1 deletion runtime/dali/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ impl dutch_auction::Config for Runtime {
}

parameter_types! {
pub const MosaicId: PalletId = PalletId(*b"plmosaic");
pub const MosaicId: PalletId = PalletId(*b"plmosaic");
pub const MinimumTTL: BlockNumber = 10;
pub const MinimumTimeLockPeriod: BlockNumber = 20;
}
Expand All @@ -873,6 +873,7 @@ impl mosaic::Config for Runtime {
type MinimumTimeLockPeriod = MinimumTimeLockPeriod;
type BudgetPenaltyDecayer = mosaic::BudgetPenaltyDecayer<Balance, BlockNumber>;
type NetworkId = u32;
type ControlOrigin = EnsureRootOrHalfCouncil;
}

construct_runtime!(
Expand Down