Skip to content

Commit

Permalink
extract reward module
Browse files Browse the repository at this point in the history
  • Loading branch information
wuminzhe committed Jul 26, 2019
1 parent 47c627c commit 81ab7f5
Show file tree
Hide file tree
Showing 14 changed files with 487 additions and 332 deletions.
21 changes: 21 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ members = [
"srml/support",
"srml/aura",
"srml/try",
"srml/reward",
]

exclude = ["node/runtime/wasm"]
Expand Down
28 changes: 18 additions & 10 deletions node/cli/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use node_runtime::{
Perbill, SECS_PER_BLOCK, KtonConfig,
SessionConfig, SessionKeys, StakerStatus,
StakingConfig, SudoConfig, SystemConfig, TimestampConfig,
RewardConfig,
};
pub use node_runtime::GenesisConfig;
use primitives::{crypto::UncheckedInto, ed25519, Pair, sr25519};
Expand Down Expand Up @@ -109,12 +110,7 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
vesting: vec![],
}),
kton: Some(KtonConfig {
ring_balances: endowed_accounts.iter().cloned()
.map(|k| (k, ENDOWMENT, 12))
.chain(initial_authorities.iter().map(|x| (x.0.clone(), ENDOWMENT, 12)))
.collect(),
vesting: vec![],
sys_acc: hex!["984d592d15d930ac36e6716407fbed3f7d1e2e62bc11f8429345f8b8b0dfc107"].unchecked_into(),
}),
indices: Some(IndicesConfig {
ids: endowed_accounts.iter().cloned()
Expand Down Expand Up @@ -153,6 +149,15 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
grandpa: Some(GrandpaConfig {
authorities: initial_authorities.iter().map(|x| (x.3.clone(), 1)).collect(),
}),
reward: Some(RewardConfig {
ring_balances: endowed_accounts.iter().cloned()
.map(|k| (k, ENDOWMENT, 12))
.chain(initial_authorities.iter().map(|x| (x.0.clone(), ENDOWMENT, 12)))
.collect(),

sys_acc: hex!["984d592d15d930ac36e6716407fbed3f7d1e2e62bc11f8429345f8b8b0dfc107"].unchecked_into(),
}),

}
}

Expand Down Expand Up @@ -242,12 +247,7 @@ pub fn testnet_genesis(
vesting: vec![],
}),
kton: Some(KtonConfig {
ring_balances: endowed_accounts.iter().cloned()
.map(|k| (k, ENDOWMENT, 12))
.chain(initial_authorities.iter().map(|x| (x.0.clone(), ENDOWMENT, 12)))
.collect(),
vesting: vec![],
sys_acc: hex!["984d592d15d930ac36e6716407fbed3f7d1e2e62bc11f8429345f8b8b0dfc107"].unchecked_into(),
}),
session: Some(SessionConfig {
validators: initial_authorities.iter().map(|x| x.1.clone()).collect(),
Expand Down Expand Up @@ -285,6 +285,14 @@ pub fn testnet_genesis(
grandpa: Some(GrandpaConfig {
authorities: initial_authorities.iter().map(|x| (x.3.clone(), 1)).collect(),
}),
reward: Some(RewardConfig {
ring_balances: endowed_accounts.iter().cloned()
.map(|k| (k, ENDOWMENT, 12))
.chain(initial_authorities.iter().map(|x| (x.0.clone(), ENDOWMENT, 12)))
.collect(),

sys_acc: hex!["984d592d15d930ac36e6716407fbed3f7d1e2e62bc11f8429345f8b8b0dfc107"].unchecked_into(),
}),
}
}

Expand Down
3 changes: 2 additions & 1 deletion node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ substrate-keyring = { git = 'https://github.com/paritytech/substrate.git', optio
kton = { package = "evo-kton", path = '../../srml/kton', default-features = false}
staking = { package = "evo-staking", path = "../../srml/staking", default-features = false}
aura = { package = "srml-aura", path = "../../srml/aura", default-features = false }
#aura = { package = "srml-aura", path = "../../srml/aura", default-features = false}
reward = { package = "evo-reward", path = "../../srml/reward", default-features = false}

[features]
default = ["std"]
Expand Down Expand Up @@ -80,4 +80,5 @@ std = [
"substrate-keyring",
"offchain-primitives/std",
"kton/std",
"reward/std",
]
5 changes: 5 additions & 0 deletions node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ impl kton::Trait for Runtime {
type SystemRefund = ();
}

impl reward::Trait for Runtime {
type Currency = Kton;
type RewardCurrency = Balances;
type Event = Event;
}

impl timestamp::Trait for Runtime {
type Moment = u64;
Expand Down
1 change: 1 addition & 0 deletions node/runtime/wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 81ab7f5

Please sign in to comment.