Use Polkadot Constants instead of Hardcoding (#868)

* added Polkadot constants

* remove hardcoded constants

* cargo +nightly fmt

* add const existential deposit

* update

* cargo +nightly fmt

* not pulling

* readd constants.rs modules

* update

* Cargo.lock

* update

* add balance constants

* Update polkadot-parachains/statemine/src/constants.rs

Co-authored-by: Alexander Popiak <alexander.popiak@gmail.com>

* cargo fmt

Co-authored-by: Alexander Popiak <alexander.popiak@gmail.com>
This commit is contained in:
Doordashcon
2022-01-13 12:54:59 +01:00
committed by GitHub
parent 66e536f773
commit 60f5e0cf2d
10 changed files with 37 additions and 25 deletions
@@ -15,18 +15,19 @@
pub mod currency {
use node_primitives::Balance;
use westend_runtime_constants as constants;
/// The existential deposit. Set to 1/10 of its parent Relay Chain.
pub const EXISTENTIAL_DEPOSIT: Balance = 100 * MILLICENTS;
pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10;
pub const UNITS: Balance = 1_000_000_000_000;
pub const CENTS: Balance = UNITS / 100;
pub const MILLICENTS: Balance = CENTS / 1_000;
pub const GRAND: Balance = CENTS * 100_000;
pub const UNITS: Balance = constants::currency::UNITS;
pub const CENTS: Balance = constants::currency::CENTS;
pub const MILLICENTS: Balance = constants::currency::MILLICENTS;
pub const GRAND: Balance = constants::currency::GRAND;
pub const fn deposit(items: u32, bytes: u32) -> Balance {
// 1/10 of Westend testnet
(items as Balance * 100 * CENTS + (bytes as Balance) * 5 * MILLICENTS) / 10
constants::currency::deposit(items, bytes) / 10
}
}