pub mod fee {
use crate::{consts::UNIT, weights::VerExtrinsicBaseWeight, Balance};
use frame_support::weights::{
constants::WEIGHT_REF_TIME_PER_SECOND, WeightToFeeCoefficient, WeightToFeeCoefficients,
WeightToFeePolynomial,
};
use smallvec::smallvec;
use sp_runtime::Perbill;
pub const RELAY_LOCAL_SCALE_FACTOR_UNADJUSTED: u128 = 10_000_000_000_u128; pub const RELAY_MGX_SCALE_FACTOR: u128 = 1000_000_000_u128; pub const KAR_MGR_SCALE_FACTOR: u128 = RELAY_MGX_SCALE_FACTOR / 100; pub const TUR_MGR_SCALE_FACTOR: u128 = RELAY_MGX_SCALE_FACTOR; pub struct WeightToFee;
impl WeightToFeePolynomial for WeightToFee {
type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
let p = base_tx_in_mgx();
let q = Balance::from(VerExtrinsicBaseWeight::get().ref_time());
smallvec![WeightToFeeCoefficient {
degree: 1,
negative: false,
coeff_frac: Perbill::from_rational(p % q, q),
coeff_integer: p / q,
}]
}
}
pub fn base_tx_in_mgx() -> Balance {
UNIT
}
pub fn mgx_per_second() -> u128 {
let base_weight = Balance::from(VerExtrinsicBaseWeight::get().ref_time());
let base_per_second = (WEIGHT_REF_TIME_PER_SECOND / base_weight as u64) as u128;
base_per_second * base_tx_in_mgx()
}
pub fn ksm_per_second() -> u128 {
mgx_per_second() / RELAY_LOCAL_SCALE_FACTOR_UNADJUSTED as u128
}
}
pub mod parachains {
pub mod mangata {
pub const ID: u32 = 2110;
}
pub mod karura {
pub const ID: u32 = 2000;
pub const KAR_KEY: &[u8] = &[0, 128];
pub const KUSD_KEY: &[u8] = &[0, 129];
pub const LKSM_KEY: &[u8] = &[0, 131];
}
pub mod turing {
pub const ID: u32 = 2114;
}
pub mod bifrost {
pub const ID: u32 = 2001;
pub const BNC_KEY: &[u8] = &[0, 1];
pub const VSKSM_KEY: &[u8] = &[4, 4];
pub const VKSM_KEY: &[u8] = &[1, 4];
}
pub mod imbue {
pub const ID: u32 = 2121;
pub const IMBU_KEY: &[u8] = &[0];
}
pub mod phala {
pub const ID: u32 = 2004;
}
}