Skip to content

Commit d9a903a

Browse files
committed
Merge branch 'master' into sw/rococo-v1
2 parents 1db07de + f69c13b commit d9a903a

File tree

28 files changed

+223
-218
lines changed

28 files changed

+223
-218
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,6 @@ _In alphabetical order_
5454
- [Acala Network](https://github.com/AcalaNetwork/Acala)
5555
- [Bit.Country](https://github.com/bit-country/Bit-Country-Blockchain)
5656
- [ChainX](https://github.com/chainx-org/ChainX)
57+
- [HydraDX](https://github.com/galacticcouncil/hack.HydraDX-node)
5758
- [Laminar Chain](https://github.com/laminar-protocol/laminar-chain)
5859
- [_Add your project here_](https://github.com/open-web3-stack/open-runtime-module-library/edit/master/README.md)

auction/src/lib.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ pub trait WeightInfo {
3434
fn on_finalize(c: u32) -> Weight;
3535
}
3636

37-
pub trait Trait: frame_system::Trait {
38-
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
37+
pub trait Config: frame_system::Config {
38+
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
3939

4040
/// The balance type for bidding
4141
type Balance: Parameter + Member + AtLeast32BitUnsigned + Default + Copy + MaybeSerializeDeserialize;
@@ -53,17 +53,17 @@ pub trait Trait: frame_system::Trait {
5353

5454
decl_event!(
5555
pub enum Event<T> where
56-
<T as frame_system::Trait>::AccountId,
57-
<T as Trait>::Balance,
58-
<T as Trait>::AuctionId,
56+
<T as frame_system::Config>::AccountId,
57+
<T as Config>::Balance,
58+
<T as Config>::AuctionId,
5959
{
6060
/// A bid is placed. [auction_id, bidder, bidding_amount]
6161
Bid(AuctionId, AccountId, Balance),
6262
}
6363
);
6464

6565
decl_storage! {
66-
trait Store for Module<T: Trait> as Auction {
66+
trait Store for Module<T: Config> as Auction {
6767
/// Stores on-going and future auctions. Closed auction are removed.
6868
pub Auctions get(fn auctions): map hasher(twox_64_concat) T::AuctionId => Option<AuctionInfo<T::AccountId, T::Balance, T::BlockNumber>>;
6969

@@ -76,7 +76,7 @@ decl_storage! {
7676
}
7777

7878
decl_module! {
79-
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
79+
pub struct Module<T: Config> for enum Call where origin: T::Origin {
8080
type Error = Error<T>;
8181

8282
fn deposit_event() = default;
@@ -180,7 +180,7 @@ decl_module! {
180180

181181
decl_error! {
182182
/// Error for auction module.
183-
pub enum Error for Module<T: Trait> {
183+
pub enum Error for Module<T: Config> {
184184
AuctionNotExist,
185185
AuctionNotStarted,
186186
BidNotAccepted,
@@ -189,7 +189,7 @@ decl_error! {
189189
}
190190
}
191191

192-
impl<T: Trait> Module<T> {
192+
impl<T: Config> Module<T> {
193193
fn _on_finalize(now: T::BlockNumber) {
194194
for (auction_id, _) in <AuctionEndTime<T>>::drain_prefix(&now) {
195195
if let Some(auction) = <Auctions<T>>::take(&auction_id) {
@@ -199,7 +199,7 @@ impl<T: Trait> Module<T> {
199199
}
200200
}
201201

202-
impl<T: Trait> Auction<T::AccountId, T::BlockNumber> for Module<T> {
202+
impl<T: Config> Auction<T::AccountId, T::BlockNumber> for Module<T> {
203203
type AuctionId = T::AuctionId;
204204
type Balance = T::Balance;
205205

auction/src/mock.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub type Balance = u64;
3838
pub type BlockNumber = u64;
3939
pub type AuctionId = u64;
4040

41-
impl frame_system::Trait for Runtime {
41+
impl frame_system::Config for Runtime {
4242
type Origin = Origin;
4343
type Index = u64;
4444
type BlockNumber = BlockNumber;
@@ -92,7 +92,7 @@ impl AuctionHandler<AccountId, Balance, BlockNumber, AuctionId> for Handler {
9292
fn on_auction_ended(_id: AuctionId, _winner: Option<(AccountId, Balance)>) {}
9393
}
9494

95-
impl Trait for Runtime {
95+
impl Config for Runtime {
9696
type Event = TestEvent;
9797
type Balance = Balance;
9898
type AuctionId = AuctionId;

authority/src/lib.rs

+24-20
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! A module to provide features for governance including dispatch method on
33
//! behalf of other accounts and schedule dispatchables.
44
//!
5-
//! - [`Trait`](./trait.Trait.html)
5+
//! - [`Config`](./trait.Config.html)
66
//! - [`Call`](./enum.Call.html)
77
//! - [`Module`](./struct.Module.html)
88
//!
@@ -90,7 +90,7 @@ impl<
9090
}
9191

9292
/// Origin for the authority module.
93-
pub type Origin<T> = DelayedOrigin<<T as frame_system::Trait>::BlockNumber, <T as Trait>::PalletsOrigin>;
93+
pub type Origin<T> = DelayedOrigin<<T as frame_system::Config>::BlockNumber, <T as Config>::PalletsOrigin>;
9494

9595
/// Config for orml-authority
9696
pub trait AuthorityConfig<Origin, PalletsOrigin, BlockNumber> {
@@ -123,44 +123,48 @@ pub trait AsOriginId<Origin, PalletsOrigin> {
123123
fn check_dispatch_from(&self, origin: Origin) -> DispatchResult;
124124
}
125125

126-
type CallOf<T> = <T as Trait>::Call;
126+
type CallOf<T> = <T as Config>::Call;
127127

128128
/// The schedule task index type.
129129
pub type ScheduleTaskIndex = u32;
130130

131131
/// orml-authority configuration trait.
132-
pub trait Trait: frame_system::Trait {
132+
pub trait Config: frame_system::Config {
133133
/// The overarching event type.
134-
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
134+
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
135135

136136
/// The outer origin type.
137-
type Origin: From<DelayedOrigin<Self::BlockNumber, <Self as Trait>::PalletsOrigin>>
138-
+ IsType<<Self as frame_system::Trait>::Origin>
137+
type Origin: From<DelayedOrigin<Self::BlockNumber, <Self as Config>::PalletsOrigin>>
138+
+ IsType<<Self as frame_system::Config>::Origin>
139139
+ OriginTrait<PalletsOrigin = Self::PalletsOrigin>;
140140

141141
/// The caller origin, overarching type of all pallets origins.
142-
type PalletsOrigin: Parameter + Into<<Self as frame_system::Trait>::Origin>;
142+
type PalletsOrigin: Parameter + Into<<Self as frame_system::Config>::Origin>;
143143

144144
/// The aggregated call type.
145145
type Call: Parameter
146-
+ Dispatchable<Origin = <Self as frame_system::Trait>::Origin, PostInfo = PostDispatchInfo>
146+
+ Dispatchable<Origin = <Self as frame_system::Config>::Origin, PostInfo = PostDispatchInfo>
147147
+ GetDispatchInfo;
148148

149149
/// The Scheduler.
150-
type Scheduler: ScheduleNamed<Self::BlockNumber, <Self as Trait>::Call, Self::PalletsOrigin>;
150+
type Scheduler: ScheduleNamed<Self::BlockNumber, <Self as Config>::Call, Self::PalletsOrigin>;
151151

152152
/// The type represent origin that can be dispatched by other origins.
153-
type AsOriginId: Parameter + AsOriginId<<Self as frame_system::Trait>::Origin, Self::PalletsOrigin>;
153+
type AsOriginId: Parameter + AsOriginId<<Self as frame_system::Config>::Origin, Self::PalletsOrigin>;
154154

155155
/// Additional permission config.
156-
type AuthorityConfig: AuthorityConfig<<Self as frame_system::Trait>::Origin, Self::PalletsOrigin, Self::BlockNumber>;
156+
type AuthorityConfig: AuthorityConfig<
157+
<Self as frame_system::Config>::Origin,
158+
Self::PalletsOrigin,
159+
Self::BlockNumber,
160+
>;
157161

158162
/// Weight information for extrinsics in this module.
159163
type WeightInfo: WeightInfo;
160164
}
161165

162166
decl_error! {
163-
pub enum Error for Module<T: Trait> {
167+
pub enum Error for Module<T: Config> {
164168
/// Calculation overflow.
165169
Overflow,
166170
/// Failed to schedule a task.
@@ -175,16 +179,16 @@ decl_error! {
175179
}
176180

177181
decl_storage! {
178-
trait Store for Module<T: Trait> as Authority {
182+
trait Store for Module<T: Config> as Authority {
179183
/// Track the next task ID.
180184
pub NextTaskIndex get(fn next_task_index): ScheduleTaskIndex;
181185
}
182186
}
183187

184188
decl_event! {
185189
pub enum Event<T> where
186-
<T as Trait>::PalletsOrigin,
187-
<T as frame_system::Trait>::BlockNumber,
190+
<T as Config>::PalletsOrigin,
191+
<T as frame_system::Config>::BlockNumber,
188192
{
189193
/// A call is dispatched. [result]
190194
Dispatched(DispatchResult),
@@ -200,7 +204,7 @@ decl_event! {
200204
}
201205

202206
decl_module! {
203-
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
207+
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {
204208
type Error = Error<T>;
205209

206210
fn deposit_event() = default;
@@ -245,14 +249,14 @@ decl_module! {
245249
};
246250

247251
let schedule_origin = if with_delayed_origin {
248-
let origin: <T as Trait>::Origin = From::from(origin);
249-
let origin: <T as Trait>::Origin = From::from(DelayedOrigin::<T::BlockNumber, T::PalletsOrigin> {
252+
let origin: <T as Config>::Origin = From::from(origin);
253+
let origin: <T as Config>::Origin = From::from(DelayedOrigin::<T::BlockNumber, T::PalletsOrigin> {
250254
delay,
251255
origin: Box::new(origin.caller().clone())
252256
});
253257
origin
254258
} else {
255-
<T as Trait>::Origin::from(origin)
259+
<T as Config>::Origin::from(origin)
256260
};
257261

258262
let pallets_origin = schedule_origin.caller().clone();

authority/src/mock.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ parameter_types! {
2727
pub const AvailableBlockRatio: Perbill = Perbill::one();
2828
}
2929

30-
impl frame_system::Trait for Runtime {
30+
impl frame_system::Config for Runtime {
3131
type Origin = Origin;
3232
type Index = u64;
3333
type BlockNumber = BlockNumber;
@@ -58,7 +58,7 @@ impl frame_system::Trait for Runtime {
5858
parameter_types! {
5959
pub MaximumSchedulerWeight: u32 = Perbill::from_percent(80) * MaximumBlockWeight::get();
6060
}
61-
impl pallet_scheduler::Trait for Runtime {
61+
impl pallet_scheduler::Config for Runtime {
6262
type Event = Event;
6363
type Origin = Origin;
6464
type PalletsOrigin = OriginCaller;
@@ -144,7 +144,7 @@ impl AsOriginId<Origin, OriginCaller> for MockAsOriginId {
144144
}
145145
}
146146

147-
impl Trait for Runtime {
147+
impl Config for Runtime {
148148
type Event = Event;
149149
type Origin = Origin;
150150
type PalletsOrigin = OriginCaller;

authority/src/tests.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ fn fast_track_scheduled_dispatch_work() {
195195
assert!(System::events().iter().any(|record| record.event == event));
196196

197197
let schedule_origin = {
198-
let origin: <Runtime as Trait>::Origin = From::from(Origin::root());
199-
let origin: <Runtime as Trait>::Origin =
200-
From::from(DelayedOrigin::<BlockNumber, <Runtime as Trait>::PalletsOrigin> {
198+
let origin: <Runtime as Config>::Origin = From::from(Origin::root());
199+
let origin: <Runtime as Config>::Origin =
200+
From::from(DelayedOrigin::<BlockNumber, <Runtime as Config>::PalletsOrigin> {
201201
delay: 1,
202202
origin: Box::new(origin.caller().clone()),
203203
});
@@ -269,9 +269,9 @@ fn delay_scheduled_dispatch_work() {
269269
assert!(System::events().iter().any(|record| record.event == event));
270270

271271
let schedule_origin = {
272-
let origin: <Runtime as Trait>::Origin = From::from(Origin::root());
273-
let origin: <Runtime as Trait>::Origin =
274-
From::from(DelayedOrigin::<BlockNumber, <Runtime as Trait>::PalletsOrigin> {
272+
let origin: <Runtime as Config>::Origin = From::from(Origin::root());
273+
let origin: <Runtime as Config>::Origin =
274+
From::from(DelayedOrigin::<BlockNumber, <Runtime as Config>::PalletsOrigin> {
275275
delay: 1,
276276
origin: Box::new(origin.caller().clone()),
277277
});
@@ -342,9 +342,9 @@ fn cancel_scheduled_dispatch_work() {
342342
assert!(System::events().iter().any(|record| record.event == event));
343343

344344
let schedule_origin = {
345-
let origin: <Runtime as Trait>::Origin = From::from(Origin::root());
346-
let origin: <Runtime as Trait>::Origin =
347-
From::from(DelayedOrigin::<BlockNumber, <Runtime as Trait>::PalletsOrigin> {
345+
let origin: <Runtime as Config>::Origin = From::from(Origin::root());
346+
let origin: <Runtime as Config>::Origin =
347+
From::from(DelayedOrigin::<BlockNumber, <Runtime as Config>::PalletsOrigin> {
348348
delay: 1,
349349
origin: Box::new(origin.caller().clone()),
350350
});

benchmarking/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ pub use sp_runtime::traits::Zero;
127127
/// Test functions are automatically generated for each benchmark and are
128128
/// accessible to you when you run `cargo test`. All tests are named
129129
/// `test_benchmark_<benchmark_name>`, expect you to pass them the Runtime
130-
/// Trait, and run them in a test externalities environment. The test function
130+
/// Config, and run them in a test externalities environment. The test function
131131
/// runs your benchmark just like a regular benchmark, but only testing at the
132132
/// lowest and highest values for each component. The function will return
133133
/// `Ok(())` if the benchmarks return no errors.
@@ -813,7 +813,7 @@ macro_rules! impl_benchmark {
813813
let mut whitelist = whitelist.to_vec();
814814
let whitelisted_caller_key =
815815
<frame_system::Account::<$runtime> as frame_support::storage::StorageMap<_,_>>::hashed_key_for(
816-
$crate::whitelisted_caller::<<$runtime as frame_system::Trait>::AccountId>()
816+
$crate::whitelisted_caller::<<$runtime as frame_system::Config>::AccountId>()
817817
);
818818
whitelist.push(whitelisted_caller_key.into());
819819
$crate::benchmarking::set_whitelist(whitelist);

benchmarking/src/tests.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ use sp_runtime::{
1515
use sp_std::prelude::*;
1616

1717
decl_storage! {
18-
trait Store for Module<T: Trait> as Test {
18+
trait Store for Module<T: Config> as Test {
1919
Value get(fn value): Option<u32>;
2020
}
2121
}
2222

2323
decl_module! {
24-
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
24+
pub struct Module<T: Config> for enum Call where origin: T::Origin {
2525
#[weight = 0]
2626
fn set_value(origin, n: u32) -> DispatchResult {
2727
let _sender = ensure_signed(origin)?;
@@ -41,7 +41,7 @@ impl_outer_origin! {
4141
pub enum Origin for Test {}
4242
}
4343

44-
pub trait Trait: frame_system::Trait {
44+
pub trait Config: frame_system::Config {
4545
type Event;
4646
type BlockNumber;
4747
}
@@ -51,7 +51,7 @@ type AccountId = u128;
5151
#[derive(Clone, Eq, PartialEq)]
5252
pub struct Test;
5353

54-
impl frame_system::Trait for Test {
54+
impl frame_system::Config for Test {
5555
type Origin = Origin;
5656
type Index = u64;
5757
type BlockNumber = u64;
@@ -79,7 +79,7 @@ impl frame_system::Trait for Test {
7979
type SystemWeightInfo = ();
8080
}
8181

82-
impl Trait for Test {
82+
impl Config for Test {
8383
type Event = ();
8484
type BlockNumber = u32;
8585
}

currencies/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ The currencies module provides a mixed currencies system, by configuring a nativ
66

77
It also provides an adapter, to adapt `frame_support::traits::Currency` implementations into `BasicCurrencyExtended`.
88

9-
The currencies module provides functionality of both `MultiCurrencyExtended` and `BasicCurrencyExtended`, via unified interfaces, and all calls would be delegated to the underlying multi-currency and base currency system. A native currency ID could be set by `Trait::GetNativeCurrencyId`, to identify the native currency.
9+
The currencies module provides functionality of both `MultiCurrencyExtended` and `BasicCurrencyExtended`, via unified interfaces, and all calls would be delegated to the underlying multi-currency and base currency system. A native currency ID could be set by `Config::GetNativeCurrencyId`, to identify the native currency.

0 commit comments

Comments
 (0)