mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 08:11:03 +00:00
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:
Generated
+3
@@ -10954,6 +10954,7 @@ dependencies = [
|
|||||||
"frame-system-rpc-runtime-api",
|
"frame-system-rpc-runtime-api",
|
||||||
"frame-try-runtime",
|
"frame-try-runtime",
|
||||||
"hex-literal 0.3.4",
|
"hex-literal 0.3.4",
|
||||||
|
"kusama-runtime-constants",
|
||||||
"log",
|
"log",
|
||||||
"node-primitives",
|
"node-primitives",
|
||||||
"pallet-asset-tx-payment",
|
"pallet-asset-tx-payment",
|
||||||
@@ -11043,6 +11044,7 @@ dependencies = [
|
|||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
"polkadot-parachain",
|
"polkadot-parachain",
|
||||||
"polkadot-runtime-common",
|
"polkadot-runtime-common",
|
||||||
|
"polkadot-runtime-constants",
|
||||||
"scale-info",
|
"scale-info",
|
||||||
"serde",
|
"serde",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
@@ -12478,6 +12480,7 @@ dependencies = [
|
|||||||
"sp-transaction-pool",
|
"sp-transaction-pool",
|
||||||
"sp-version",
|
"sp-version",
|
||||||
"substrate-wasm-builder",
|
"substrate-wasm-builder",
|
||||||
|
"westend-runtime-constants",
|
||||||
"xcm",
|
"xcm",
|
||||||
"xcm-builder",
|
"xcm-builder",
|
||||||
"xcm-executor",
|
"xcm-executor",
|
||||||
|
|||||||
@@ -54,8 +54,9 @@ impl PurgeChainCmd {
|
|||||||
relay_config: sc_service::Configuration,
|
relay_config: sc_service::Configuration,
|
||||||
) -> sc_cli::Result<()> {
|
) -> sc_cli::Result<()> {
|
||||||
let databases = match (self.parachain, self.relaychain) {
|
let databases = match (self.parachain, self.relaychain) {
|
||||||
(true, true) | (false, false) =>
|
(true, true) | (false, false) => {
|
||||||
vec![("parachain", para_config.database), ("relaychain", relay_config.database)],
|
vec![("parachain", para_config.database), ("relaychain", relay_config.database)]
|
||||||
|
},
|
||||||
(true, false) => vec![("parachain", para_config.database)],
|
(true, false) => vec![("parachain", para_config.database)],
|
||||||
(false, true) => vec![("relaychain", relay_config.database)],
|
(false, true) => vec![("relaychain", relay_config.database)],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ pub fn run() -> Result<()> {
|
|||||||
You can enable it with `--features runtime-benchmarks`."
|
You can enable it with `--features runtime-benchmarks`."
|
||||||
.into())
|
.into())
|
||||||
},
|
},
|
||||||
Some(Subcommand::TryRuntime(cmd)) =>
|
Some(Subcommand::TryRuntime(cmd)) => {
|
||||||
if cfg!(feature = "try-runtime") {
|
if cfg!(feature = "try-runtime") {
|
||||||
let runner = cli.create_runner(cmd)?;
|
let runner = cli.create_runner(cmd)?;
|
||||||
|
|
||||||
@@ -256,7 +256,8 @@ pub fn run() -> Result<()> {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Err("Try-runtime must be enabled by `--features try-runtime`.".into())
|
Err("Try-runtime must be enabled by `--features try-runtime`.".into())
|
||||||
},
|
}
|
||||||
|
},
|
||||||
None => {
|
None => {
|
||||||
let runner = cli.create_runner(&cli.run.normalize())?;
|
let runner = cli.create_runner(&cli.run.normalize())?;
|
||||||
|
|
||||||
|
|||||||
@@ -418,7 +418,7 @@ pub fn run() -> Result<()> {
|
|||||||
You can enable it with `--features runtime-benchmarks`."
|
You can enable it with `--features runtime-benchmarks`."
|
||||||
.into())
|
.into())
|
||||||
},
|
},
|
||||||
Some(Subcommand::TryRuntime(cmd)) =>
|
Some(Subcommand::TryRuntime(cmd)) => {
|
||||||
if cfg!(feature = "try-runtime") {
|
if cfg!(feature = "try-runtime") {
|
||||||
// grab the task manager.
|
// grab the task manager.
|
||||||
let runner = cli.create_runner(cmd)?;
|
let runner = cli.create_runner(cmd)?;
|
||||||
@@ -448,7 +448,8 @@ pub fn run() -> Result<()> {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Err("Try-runtime must be enabled by `--features try-runtime`.".into())
|
Err("Try-runtime must be enabled by `--features try-runtime`.".into())
|
||||||
},
|
}
|
||||||
|
},
|
||||||
Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?),
|
Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?),
|
||||||
None => {
|
None => {
|
||||||
let runner = cli.create_runner(&cli.run.normalize())?;
|
let runner = cli.create_runner(&cli.run.normalize())?;
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ parachains-common = { path = "../parachains-common", default-features = false }
|
|||||||
# Polkadot dependencies
|
# Polkadot dependencies
|
||||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
|
kusama-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
|
|||||||
@@ -14,19 +14,20 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
pub mod currency {
|
pub mod currency {
|
||||||
|
use kusama_runtime_constants as constants;
|
||||||
use node_primitives::Balance;
|
use node_primitives::Balance;
|
||||||
|
|
||||||
/// The existential deposit. Set to 1/10 of its parent Relay Chain (v9020).
|
/// The existential deposit. Set to 1/10 of its parent Relay Chain.
|
||||||
pub const EXISTENTIAL_DEPOSIT: Balance = CENTS / 10;
|
pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10;
|
||||||
|
|
||||||
pub const UNITS: Balance = 1_000_000_000_000;
|
pub const UNITS: Balance = constants::currency::UNITS;
|
||||||
pub const CENTS: Balance = UNITS / 30_000;
|
pub const CENTS: Balance = constants::currency::CENTS;
|
||||||
pub const GRAND: Balance = CENTS * 100_000;
|
pub const GRAND: Balance = constants::currency::GRAND;
|
||||||
pub const MILLICENTS: Balance = CENTS / 1_000;
|
pub const MILLICENTS: Balance = constants::currency::MILLICENTS;
|
||||||
|
|
||||||
pub const fn deposit(items: u32, bytes: u32) -> Balance {
|
pub const fn deposit(items: u32, bytes: u32) -> Balance {
|
||||||
// map to 1/10 of what the kusama relay chain charges (v9020)
|
// map to 1/10 of what the kusama relay chain charges (v9020)
|
||||||
(items as Balance * 2_000 * CENTS + (bytes as Balance) * 100 * MILLICENTS) / 10
|
constants::currency::deposit(items, bytes) / 10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ parachains-common = { path = "../parachains-common", default-features = false }
|
|||||||
# Polkadot dependencies
|
# Polkadot dependencies
|
||||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
|
polkadot-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
|
|||||||
@@ -15,18 +15,19 @@
|
|||||||
|
|
||||||
pub mod currency {
|
pub mod currency {
|
||||||
use node_primitives::Balance;
|
use node_primitives::Balance;
|
||||||
|
use polkadot_runtime_constants as constants;
|
||||||
|
|
||||||
/// The existential deposit. Set to 1/10 of its parent Relay Chain (v9010).
|
/// The existential deposit. Set to 1/10 of its parent Relay Chain (v9010).
|
||||||
pub const EXISTENTIAL_DEPOSIT: Balance = 10 * CENTS;
|
pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10;
|
||||||
|
|
||||||
pub const UNITS: Balance = 10_000_000_000;
|
pub const UNITS: Balance = constants::currency::UNITS;
|
||||||
pub const DOLLARS: Balance = UNITS;
|
pub const DOLLARS: Balance = constants::currency::DOLLARS;
|
||||||
pub const CENTS: Balance = UNITS / 100; // 100_000_000
|
pub const CENTS: Balance = constants::currency::CENTS;
|
||||||
pub const MILLICENTS: Balance = CENTS / 1_000; // 100_000
|
pub const MILLICENTS: Balance = constants::currency::MILLICENTS;
|
||||||
|
|
||||||
pub const fn deposit(items: u32, bytes: u32) -> Balance {
|
pub const fn deposit(items: u32, bytes: u32) -> Balance {
|
||||||
// 1/10 of Polkadot v9010
|
// 1/10 of Polkadot v9010
|
||||||
(items as Balance * 20 * DOLLARS + (bytes as Balance) * 100 * MILLICENTS) / 10
|
constants::currency::deposit(items, bytes) / 10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ parachains-common = { path = "../parachains-common", default-features = false }
|
|||||||
# Polkadot dependencies
|
# Polkadot dependencies
|
||||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
|
westend-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
|
|||||||
@@ -15,18 +15,19 @@
|
|||||||
|
|
||||||
pub mod currency {
|
pub mod currency {
|
||||||
use node_primitives::Balance;
|
use node_primitives::Balance;
|
||||||
|
use westend_runtime_constants as constants;
|
||||||
|
|
||||||
/// The existential deposit. Set to 1/10 of its parent Relay Chain.
|
/// 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 UNITS: Balance = constants::currency::UNITS;
|
||||||
pub const CENTS: Balance = UNITS / 100;
|
pub const CENTS: Balance = constants::currency::CENTS;
|
||||||
pub const MILLICENTS: Balance = CENTS / 1_000;
|
pub const MILLICENTS: Balance = constants::currency::MILLICENTS;
|
||||||
pub const GRAND: Balance = CENTS * 100_000;
|
pub const GRAND: Balance = constants::currency::GRAND;
|
||||||
|
|
||||||
pub const fn deposit(items: u32, bytes: u32) -> Balance {
|
pub const fn deposit(items: u32, bytes: u32) -> Balance {
|
||||||
// 1/10 of Westend testnet
|
// 1/10 of Westend testnet
|
||||||
(items as Balance * 100 * CENTS + (bytes as Balance) * 5 * MILLICENTS) / 10
|
constants::currency::deposit(items, bytes) / 10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user