mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 15:11:02 +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:
@@ -14,19 +14,20 @@
|
||||
// limitations under the License.
|
||||
|
||||
pub mod currency {
|
||||
use kusama_runtime_constants as constants;
|
||||
use node_primitives::Balance;
|
||||
|
||||
/// The existential deposit. Set to 1/10 of its parent Relay Chain (v9020).
|
||||
pub const EXISTENTIAL_DEPOSIT: Balance = CENTS / 10;
|
||||
/// The existential deposit. Set to 1/10 of its parent Relay Chain.
|
||||
pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10;
|
||||
|
||||
pub const UNITS: Balance = 1_000_000_000_000;
|
||||
pub const CENTS: Balance = UNITS / 30_000;
|
||||
pub const GRAND: Balance = CENTS * 100_000;
|
||||
pub const MILLICENTS: Balance = CENTS / 1_000;
|
||||
pub const UNITS: Balance = constants::currency::UNITS;
|
||||
pub const CENTS: Balance = constants::currency::CENTS;
|
||||
pub const GRAND: Balance = constants::currency::GRAND;
|
||||
pub const MILLICENTS: Balance = constants::currency::MILLICENTS;
|
||||
|
||||
pub const fn deposit(items: u32, bytes: u32) -> Balance {
|
||||
// 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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user