Skip to content

Commit

Permalink
update substrate (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangjj9219 authored Feb 19, 2020
1 parent 046258d commit 373b319
Show file tree
Hide file tree
Showing 24 changed files with 609 additions and 426 deletions.
667 changes: 381 additions & 286 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ sc-chain-spec = { git = "https://github.com/paritytech/substrate.git" }
sc-consensus-babe = { git = "https://github.com/paritytech/substrate.git" }
sc-client-api = { git = "https://github.com/paritytech/substrate.git" }
sc-authority-discovery = { git = "https://github.com/paritytech/substrate.git" }
sc-consensus-epochs = { git = "https://github.com/paritytech/substrate.git" }
sc-keystore = { git = "https://github.com/paritytech/substrate.git" }
sc-consensus-babe-rpc = { git = "https://github.com/paritytech/substrate.git" }

frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate" }
Expand Down
7 changes: 4 additions & 3 deletions modules/accounts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ orml-tokens = { package = "orml-tokens", path = "../../orml/tokens", default-fea
orml-currencies = { package = "orml-currencies", path = "../../orml/currencies", default-features = false }
support = { package = "module-support", path = "../support", default-features = false }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-balances = { package = "pallet-balances", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-timestamp = { package = "pallet-timestamp", git = "https://github.com/paritytech/substrate.git", default-features = false }

[dev-dependencies]
primitives = { package = "sp-core", git = "https://github.com/paritytech/substrate.git", default-features = false }
runtime-io = { package = "sp-io", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-balances= { package = "pallet-balances", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-timestamp= { package = "pallet-timestamp", git = "https://github.com/paritytech/substrate.git", default-features = false }


[features]
default = ["std"]
Expand All @@ -38,4 +37,6 @@ std = [
"orml-currencies/std",
"support/std",
"pallet-transaction-payment/std",
"pallet-balances/std",
"pallet-timestamp/std",
]
8 changes: 4 additions & 4 deletions modules/accounts/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ impl system::Trait for Runtime {
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnReapAccount = ();
}

impl orml_tokens::Trait for Runtime {
Expand All @@ -77,13 +80,10 @@ pub type Tokens = orml_tokens::Module<Runtime>;

impl pallet_balances::Trait for Runtime {
type Balance = Balance;
type OnNewAccount = ();
type OnReapAccount = ();
type TransferPayment = ();
type DustRemoval = ();
type Event = ();
type ExistentialDeposit = ExistentialDeposit;
type CreationFee = CreationFee;
type AccountStore = system::Module<Runtime>;
}
pub type PalletBalances = pallet_balances::Module<Runtime>;

Expand Down
4 changes: 4 additions & 0 deletions modules/auction_manager/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mod auction_manager {

impl_outer_event! {
pub enum TestEvent for Runtime {
system<T>,
auction_manager<T>,
orml_tokens<T>,
orml_auction<T>,
Expand Down Expand Up @@ -68,6 +69,9 @@ impl system::Trait for Runtime {
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnReapAccount = ();
}
pub type System = system::Module<Runtime>;

Expand Down
9 changes: 5 additions & 4 deletions modules/cdp_engine/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mod cdp_engine {

impl_outer_event! {
pub enum TestEvent for Runtime {
system<T>,
cdp_engine<T>,
orml_tokens<T>,
loans<T>,
Expand Down Expand Up @@ -83,6 +84,9 @@ impl system::Trait for Runtime {
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnReapAccount = ();
}
pub type System = system::Module<Runtime>;

Expand All @@ -98,13 +102,10 @@ pub type Tokens = orml_tokens::Module<Runtime>;

impl pallet_balances::Trait for Runtime {
type Balance = Balance;
type OnNewAccount = ();
type OnReapAccount = ();
type TransferPayment = ();
type DustRemoval = ();
type Event = TestEvent;
type ExistentialDeposit = ExistentialDeposit;
type CreationFee = CreationFee;
type AccountStore = system::Module<Runtime>;
}
pub type PalletBalances = pallet_balances::Module<Runtime>;

Expand Down
9 changes: 5 additions & 4 deletions modules/cdp_treasury/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ impl_outer_origin! {

impl_outer_event! {
pub enum TestEvent for Runtime {
system<T>,
cdp_treasury<T>,
orml_tokens<T>,
pallet_balances<T>,
Expand Down Expand Up @@ -71,6 +72,9 @@ impl system::Trait for Runtime {
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnReapAccount = ();
}
pub type System = system::Module<Runtime>;

Expand All @@ -86,13 +90,10 @@ pub type Tokens = orml_tokens::Module<Runtime>;

impl pallet_balances::Trait for Runtime {
type Balance = Balance;
type OnNewAccount = ();
type OnReapAccount = ();
type TransferPayment = ();
type DustRemoval = ();
type Event = TestEvent;
type ExistentialDeposit = ExistentialDeposit;
type CreationFee = CreationFee;
type AccountStore = system::Module<Runtime>;
}
pub type PalletBalances = pallet_balances::Module<Runtime>;

Expand Down
3 changes: 2 additions & 1 deletion modules/dex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ orml-traits = { package = "orml-traits", path = "../../orml/traits", default-fea
orml-utilities = { package = "orml-utilities", path = "../../orml/utilities", default-features = false }
orml-tokens = { package = "orml-tokens", path = "../../orml/tokens", default-features = false }
support = { package = "module-support", path = "../support", default-features = false }
pallet-balances = { package = "pallet-balances", git = "https://github.com/paritytech/substrate.git", default-features = false }

[dev-dependencies]
primitives = { package = "sp-core", git = "https://github.com/paritytech/substrate.git", default-features = false }
runtime-io = { package = "sp-io", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-balances= { package = "pallet-balances", git = "https://github.com/paritytech/substrate.git", default-features = false }
orml-currencies = { package = "orml-currencies", path = "../../orml/currencies", default-features = false }

[features]
Expand All @@ -35,4 +35,5 @@ std = [
"orml-utilities/std",
"orml-tokens/std",
"support/std",
"pallet-balances/std",
]
4 changes: 2 additions & 2 deletions modules/dex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use frame_support::{decl_error, decl_event, decl_module, decl_storage, ensure, t
use orml_traits::{MultiCurrency, MultiCurrencyExtended};
use sp_runtime::{
traits::{
AccountIdConversion, CheckedAdd, CheckedSub, MaybeSerializeDeserialize, Member, Saturating, SimpleArithmetic,
AccountIdConversion, AtLeast32Bit, CheckedAdd, CheckedSub, MaybeSerializeDeserialize, Member, Saturating,
UniqueSaturatedInto, Zero,
},
DispatchResult, ModuleId,
Expand All @@ -23,7 +23,7 @@ type CurrencyIdOf<T> = <<T as Trait>::Currency as MultiCurrency<<T as system::Tr
pub trait Trait: system::Trait {
type Event: From<Event<Self>> + Into<<Self as system::Trait>::Event>;
type Currency: MultiCurrencyExtended<Self::AccountId>;
type Share: Parameter + Member + SimpleArithmetic + Default + Copy + MaybeSerializeDeserialize;
type Share: Parameter + Member + AtLeast32Bit + Default + Copy + MaybeSerializeDeserialize;
type GetBaseCurrencyId: Get<CurrencyIdOf<Self>>;
type GetExchangeFee: Get<Rate>;
}
Expand Down
7 changes: 6 additions & 1 deletion modules/dex/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ mod dex {

impl_outer_event! {
pub enum TestEvent for Runtime {
dex<T>, orml_tokens<T>,
system<T>,
dex<T>,
orml_tokens<T>,
}
}
impl_outer_origin! {
Expand Down Expand Up @@ -58,6 +60,9 @@ impl system::Trait for Runtime {
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnReapAccount = ();
}
pub type System = system::Module<Runtime>;

Expand Down
9 changes: 5 additions & 4 deletions modules/emergency_shutdown/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ mod emergency_shutdown {

impl_outer_event! {
pub enum TestEvent for Runtime {
system<T>,
emergency_shutdown<T>,
cdp_engine<T>,
orml_tokens<T>,
Expand Down Expand Up @@ -85,6 +86,9 @@ impl system::Trait for Runtime {
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnReapAccount = ();
}
pub type System = system::Module<Runtime>;

Expand All @@ -100,13 +104,10 @@ pub type Tokens = orml_tokens::Module<Runtime>;

impl pallet_balances::Trait for Runtime {
type Balance = Balance;
type OnNewAccount = ();
type OnReapAccount = ();
type TransferPayment = ();
type DustRemoval = ();
type Event = TestEvent;
type ExistentialDeposit = ExistentialDeposit;
type CreationFee = CreationFee;
type AccountStore = system::Module<Runtime>;
}
pub type PalletBalances = pallet_balances::Module<Runtime>;

Expand Down
3 changes: 2 additions & 1 deletion modules/honzon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ orml-tokens = { package = "orml-tokens", path = "../../orml/tokens", default-fea
cdp-engine = { package = "module-cdp-engine", path = "../cdp_engine", default-features = false }
loans = { package = "module-loans", path = "../loans", default-features = false }
support = { package = "module-support", path = "../support", default-features = false }
pallet-balances = { package = "pallet-balances", git = "https://github.com/paritytech/substrate.git", default-features = false }

[dev-dependencies]
runtime-io = { package = "sp-io", git = "https://github.com/paritytech/substrate.git", default-features = false }
primitives = { package = "sp-core", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-balances= { package = "pallet-balances", git = "https://github.com/paritytech/substrate.git", default-features = false }
orml-currencies = { package = "orml-currencies", path = "../../orml/currencies", default-features = false }
cdp-treasury = { package = "module-cdp-treasury", path = "../cdp_treasury", default-features = false }

Expand All @@ -39,4 +39,5 @@ std = [
"loans/std",
"cdp-engine/std",
"support/std",
"pallet-balances/std",
]
9 changes: 5 additions & 4 deletions modules/honzon/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ mod honzon {

impl_outer_event! {
pub enum TestEvent for Runtime {
system<T>,
honzon<T>,
cdp_engine<T>,
orml_tokens<T>,
Expand Down Expand Up @@ -84,6 +85,9 @@ impl system::Trait for Runtime {
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnReapAccount = ();
}
pub type System = system::Module<Runtime>;

Expand All @@ -99,13 +103,10 @@ pub type Tokens = orml_tokens::Module<Runtime>;

impl pallet_balances::Trait for Runtime {
type Balance = Balance;
type OnNewAccount = ();
type OnReapAccount = ();
type TransferPayment = ();
type DustRemoval = ();
type Event = TestEvent;
type ExistentialDeposit = ExistentialDeposit;
type CreationFee = CreationFee;
type AccountStore = system::Module<Runtime>;
}
pub type PalletBalances = pallet_balances::Module<Runtime>;

Expand Down
3 changes: 2 additions & 1 deletion modules/loans/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ primitives = { package = "module-primitives", path = "../primitives", default-fe
orml-traits = { package = "orml-traits", path = "../../orml/traits", default-features = false }
orml-tokens = { package = "orml-tokens", path = "../../orml/tokens", default-features = false }
support = { package = "module-support", path = "../support", default-features = false }
pallet-balances = { package = "pallet-balances", git = "https://github.com/paritytech/substrate.git", default-features = false }

[dev-dependencies]
su-primitives = { package = "sp-core", git = "https://github.com/paritytech/substrate.git", default-features = false }
runtime-io = { package = "sp-io", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-balances= { package = "pallet-balances", git = "https://github.com/paritytech/substrate.git", default-features = false }
orml-currencies = { package = "orml-currencies", path = "../../orml/currencies", default-features = false }
cdp-treasury = { package = "module-cdp-treasury", path = "../cdp_treasury", default-features = false }

Expand All @@ -36,4 +36,5 @@ std = [
"primitives/std",
"support/std",
"orml-tokens/std",
"pallet-balances/std",
]
6 changes: 2 additions & 4 deletions modules/loans/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ use orml_traits::{
};
use rstd::convert::{TryFrom, TryInto};
use sp_runtime::{
traits::{
AccountIdConversion, CheckedAdd, CheckedSub, Convert, MaybeSerializeDeserialize, Member, SimpleArithmetic,
},
traits::{AccountIdConversion, AtLeast32Bit, CheckedAdd, CheckedSub, Convert, MaybeSerializeDeserialize, Member},
DispatchResult, ModuleId,
};
use support::{CDPTreasury, RiskManager};
Expand All @@ -28,7 +26,7 @@ pub trait Trait: system::Trait {
type Convert: Convert<(CurrencyIdOf<Self>, Self::DebitBalance), BalanceOf<Self>>;
type Currency: MultiCurrencyExtended<Self::AccountId>;
type RiskManager: RiskManager<Self::AccountId, CurrencyIdOf<Self>, AmountOf<Self>, Self::DebitAmount>;
type DebitBalance: Parameter + Member + SimpleArithmetic + Default + Copy + MaybeSerializeDeserialize;
type DebitBalance: Parameter + Member + AtLeast32Bit + Default + Copy + MaybeSerializeDeserialize;
type DebitAmount: Signed
+ TryInto<Self::DebitBalance>
+ TryFrom<Self::DebitBalance>
Expand Down
9 changes: 5 additions & 4 deletions modules/loans/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ mod loans {

impl_outer_event! {
pub enum TestEvent for Runtime {
system<T>,
loans<T>,
orml_tokens<T>,
pallet_balances<T>,
Expand Down Expand Up @@ -68,6 +69,9 @@ impl system::Trait for Runtime {
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnReapAccount = ();
}
pub type System = system::Module<Runtime>;

Expand Down Expand Up @@ -95,13 +99,10 @@ parameter_types! {

impl pallet_balances::Trait for Runtime {
type Balance = Balance;
type OnNewAccount = ();
type OnReapAccount = ();
type TransferPayment = ();
type DustRemoval = ();
type Event = TestEvent;
type ExistentialDeposit = ExistentialDeposit;
type CreationFee = CreationFee;
type AccountStore = system::Module<Runtime>;
}

pub type PalletBalances = pallet_balances::Module<Runtime>;
Expand Down
3 changes: 3 additions & 0 deletions modules/prices/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ impl system::Trait for Runtime {
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type AccountData = ();
type OnNewAccount = ();
type OnReapAccount = ();
}

pub struct MockDataProvider;
Expand Down
2 changes: 1 addition & 1 deletion orml
Submodule orml updated from dbcbf6 to 387976
Loading

0 comments on commit 373b319

Please sign in to comment.