Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto Gen Types #134

Closed
wants to merge 12 commits into from
Closed
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
4 changes: 2 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Detailed logs may be shown by running the node with the following environment va

If you want to see the multi-node consensus algorithm in action locally, then you can create a local testnet with two validator nodes for Alice and Bob, who are the initial authorities of the genesis chain specification that have been endowed with a testnet Ring.

We'll start Alice's Darwinia node first with her chain database stored locally at `/tmp/darwinia-develop/alice`.
We'll start Alice's Darwinia node first with her chain database stored locally at `/tmp/darwinia-develop/alice`:

[source, shell]
cargo run --release \-- \
Expand All @@ -178,7 +178,7 @@ Or just:
[source, shell]
cargo run --release -- --alice --conf=boot-conf/develop/alice.json

In the second terminal, we'll run the following to start Bob's Darwinia node on a different TCP port of 30334, and with his chain database stored locally at `/tmp/darwinia-develop/bob`. We'll specify a value for the `--bootnodes` option that will connect his node to Alice's Bootnode ID on TCP port 30333:
In the second terminal, we'll run the following to start Bob's Darwinia node on a different TCP port, and with his chain database stored locally at `/tmp/darwinia-develop/bob`:

[source, shell]
cargo run --release \-- \
Expand Down
10 changes: 5 additions & 5 deletions srml/staking/src/inflation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ use sr_primitives::{
};
use substrate_primitives::U256;

use crate::{KtonBalanceOf, Moment, RingBalanceOf, Trait};
use crate::{Kton, Moment, Ring, Trait};

// 1 - (99 / 100) ^ sqrt(year)
// <T: Trait + 'static>() -> RingBalanceOf<T>
pub fn compute_total_payout<T: Trait>(
era_duration: Moment,
living_time: Moment,
total_left: u128,
) -> (RingBalanceOf<T>, RingBalanceOf<T>) {
) -> (Ring<T>, Ring<T>) {
// Milliseconds per year for the Julian year (365.25 days).
const MILLISECONDS_PER_YEAR: Moment = ((36525 * 24 * 60 * 60) / 100) * 1000;

Expand All @@ -27,16 +27,16 @@ pub fn compute_total_payout<T: Trait>(

let payout = maximum * 1; // TODO: add treasury ratio: Perbill::from_rational_approximation(npos_token_staked, total_tokens);

let payout: RingBalanceOf<T> = <RingBalanceOf<T>>::saturated_from::<u128>(payout);
let payout: Ring<T> = <Ring<T>>::saturated_from::<u128>(payout);

let maximum: RingBalanceOf<T> = <RingBalanceOf<T>>::saturated_from::<u128>(maximum);
let maximum: Ring<T> = <Ring<T>>::saturated_from::<u128>(maximum);

(payout, maximum)
}

// consistent with the formula in smart contract in evolution land which can be found in
// https://github.com/evolutionlandorg/bank/blob/master/contracts/GringottsBank.sol#L280
pub fn compute_kton_return<T: Trait>(value: RingBalanceOf<T>, months: u64) -> KtonBalanceOf<T> {
pub fn compute_kton_return<T: Trait>(value: Ring<T>, months: u64) -> Kton<T> {
let value = value.saturated_into::<u64>();
let no = U256::from(67).pow(U256::from(months));
let de = U256::from(66).pow(U256::from(months));
Expand Down
Loading