feat: Rebrand Polkadot/Substrate references to PezkuwiChain
This commit systematically rebrands various references from Parity Technologies' Polkadot/Substrate ecosystem to PezkuwiChain within the kurdistan-sdk. Key changes include: - Updated external repository URLs (zombienet-sdk, parity-db, parity-scale-codec, wasm-instrument) to point to pezkuwichain forks. - Modified internal documentation and code comments to reflect PezkuwiChain naming and structure. - Replaced direct references to with or specific paths within the for XCM, Pezkuwi, and other modules. - Cleaned up deprecated issue and PR references in various and files, particularly in and modules. - Adjusted image and logo URLs in documentation to point to PezkuwiChain assets. - Removed or rephrased comments related to external Polkadot/Substrate PRs and issues. This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
This commit is contained in:
@@ -0,0 +1,159 @@
|
||||
// This file is part of Pezcumulus.
|
||||
// SPDX-License-Identifier: Unlicense
|
||||
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
|
||||
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
// distribute this software, either in source code form or as a compiled
|
||||
// binary, for any purpose, commercial or non-commercial, and by any
|
||||
// means.
|
||||
|
||||
// In jurisdictions that recognize copyright laws, the author or authors
|
||||
// of this software dedicate any and all copyright interest in the
|
||||
// software to the public domain. We make this dedication for the benefit
|
||||
// of the public at large and to the detriment of our heirs and
|
||||
// successors. We intend this dedication to be an overt act of
|
||||
// relinquishment in perpetuity of all present and future rights to this
|
||||
// software under copyright law.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
//! Penpal Teyrchain Runtime genesis config presets
|
||||
|
||||
use crate::*;
|
||||
use alloc::{vec, vec::Vec};
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use pezframe_support::build_struct_json_patch;
|
||||
use pezsp_genesis_builder::PresetId;
|
||||
use pezsp_keyring::Sr25519Keyring;
|
||||
use teyrchains_common::{AccountId, AuraId};
|
||||
|
||||
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
|
||||
|
||||
const DEFAULT_PARA_ID: ParaId = ParaId::new(2000);
|
||||
const ENDOWMENT: u128 = 1 << 60;
|
||||
|
||||
fn penpal_teyrchain_genesis(
|
||||
sudo: AccountId,
|
||||
invulnerables: Vec<(AccountId, AuraId)>,
|
||||
endowed_accounts: Vec<AccountId>,
|
||||
endowment: Balance,
|
||||
id: ParaId,
|
||||
) -> serde_json::Value {
|
||||
build_struct_json_patch!(RuntimeGenesisConfig {
|
||||
balances: BalancesConfig {
|
||||
balances: endowed_accounts.iter().cloned().map(|k| (k, endowment)).collect(),
|
||||
},
|
||||
teyrchain_info: TeyrchainInfoConfig { teyrchain_id: id },
|
||||
collator_selection: CollatorSelectionConfig {
|
||||
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
|
||||
candidacy_bond: crate::EXISTENTIAL_DEPOSIT * 16,
|
||||
},
|
||||
session: SessionConfig {
|
||||
keys: invulnerables
|
||||
.into_iter()
|
||||
.map(|(acc, aura)| {
|
||||
(
|
||||
acc.clone(), // account id
|
||||
acc, // validator id
|
||||
penpal_session_keys(aura), // session keys
|
||||
)
|
||||
})
|
||||
.collect(),
|
||||
},
|
||||
pezkuwi_xcm: PezkuwiXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
|
||||
sudo: SudoConfig { key: Some(sudo.clone()) },
|
||||
assets: AssetsConfig {
|
||||
assets: vec![(
|
||||
crate::xcm_config::TELEPORTABLE_ASSET_ID,
|
||||
sudo.clone(), // owner
|
||||
false, // is_sufficient
|
||||
crate::EXISTENTIAL_DEPOSIT,
|
||||
)],
|
||||
metadata: vec![(
|
||||
crate::xcm_config::TELEPORTABLE_ASSET_ID,
|
||||
"pal-2".as_bytes().to_vec(),
|
||||
"pal-2".as_bytes().to_vec(),
|
||||
12,
|
||||
)],
|
||||
accounts: vec![(
|
||||
crate::xcm_config::TELEPORTABLE_ASSET_ID,
|
||||
sudo.clone(),
|
||||
crate::EXISTENTIAL_DEPOSIT * 4096,
|
||||
)]
|
||||
},
|
||||
foreign_assets: ForeignAssetsConfig {
|
||||
assets: vec![(
|
||||
crate::xcm_config::RelayLocation::get(),
|
||||
sudo.clone(),
|
||||
true,
|
||||
crate::EXISTENTIAL_DEPOSIT
|
||||
)],
|
||||
metadata: vec![(
|
||||
crate::xcm_config::RelayLocation::get(),
|
||||
"relay".as_bytes().to_vec(),
|
||||
"relay".as_bytes().to_vec(),
|
||||
12
|
||||
)],
|
||||
accounts: vec![(
|
||||
crate::xcm_config::RelayLocation::get(),
|
||||
sudo,
|
||||
crate::EXISTENTIAL_DEPOSIT * 4096,
|
||||
)]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Provides the JSON representation of predefined genesis config for given `id`.
|
||||
pub fn get_preset(id: &PresetId) -> Option<Vec<u8>> {
|
||||
let genesis_fn = |authorities| {
|
||||
penpal_teyrchain_genesis(
|
||||
Sr25519Keyring::Alice.to_account_id(),
|
||||
authorities,
|
||||
Sr25519Keyring::well_known().map(|x| x.to_account_id()).collect(),
|
||||
ENDOWMENT,
|
||||
DEFAULT_PARA_ID,
|
||||
)
|
||||
};
|
||||
|
||||
let patch = match id.as_ref() {
|
||||
pezsp_genesis_builder::DEV_RUNTIME_PRESET => genesis_fn(vec![(
|
||||
Sr25519Keyring::Alice.to_account_id(),
|
||||
Sr25519Keyring::Alice.public().into(),
|
||||
)]),
|
||||
pezsp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET => genesis_fn(vec![
|
||||
(Sr25519Keyring::Alice.to_account_id(), Sr25519Keyring::Alice.public().into()),
|
||||
(Sr25519Keyring::Bob.to_account_id(), Sr25519Keyring::Bob.public().into()),
|
||||
]),
|
||||
_ => return None,
|
||||
};
|
||||
|
||||
Some(
|
||||
serde_json::to_string(&patch)
|
||||
.expect("serialization to json is expected to work. qed.")
|
||||
.into_bytes(),
|
||||
)
|
||||
}
|
||||
|
||||
/// List of supported presets.
|
||||
pub fn preset_names() -> Vec<PresetId> {
|
||||
vec![
|
||||
PresetId::from(pezsp_genesis_builder::DEV_RUNTIME_PRESET),
|
||||
PresetId::from(pezsp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET),
|
||||
]
|
||||
}
|
||||
|
||||
/// Generate the session keys from individual elements.
|
||||
///
|
||||
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
|
||||
pub fn penpal_session_keys(keys: AuraId) -> crate::SessionKeys {
|
||||
crate::SessionKeys { aura: keys }
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,64 @@
|
||||
// This file is part of Pezcumulus.
|
||||
// SPDX-License-Identifier: Unlicense
|
||||
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
|
||||
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
// distribute this software, either in source code form or as a compiled
|
||||
// binary, for any purpose, commercial or non-commercial, and by any
|
||||
// means.
|
||||
|
||||
// In jurisdictions that recognize copyright laws, the author or authors
|
||||
// of this software dedicate any and all copyright interest in the
|
||||
// software to the public domain. We make this dedication for the benefit
|
||||
// of the public at large and to the detriment of our heirs and
|
||||
// successors. We intend this dedication to be an overt act of
|
||||
// relinquishment in perpetuity of all present and future rights to this
|
||||
// software under copyright law.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
pub mod constants {
|
||||
use pezframe_support::{
|
||||
parameter_types,
|
||||
weights::{constants, Weight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// Importing a block with 0 Extrinsics.
|
||||
pub const BlockExecutionWeight: Weight =
|
||||
Weight::from_parts(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000), 0);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_weights {
|
||||
use pezframe_support::weights::constants;
|
||||
|
||||
/// Checks that the weight exists and is sane.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
let w = super::constants::BlockExecutionWeight::get();
|
||||
|
||||
// At least 100 µs.
|
||||
assert!(
|
||||
w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||
"Weight should be at least 100 µs."
|
||||
);
|
||||
// At most 50 ms.
|
||||
assert!(
|
||||
w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||
"Weight should be at most 50 ms."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// This file is part of Pezcumulus.
|
||||
// SPDX-License-Identifier: Unlicense
|
||||
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
|
||||
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
// distribute this software, either in source code form or as a compiled
|
||||
// binary, for any purpose, commercial or non-commercial, and by any
|
||||
// means.
|
||||
|
||||
// In jurisdictions that recognize copyright laws, the author or authors
|
||||
// of this software dedicate any and all copyright interest in the
|
||||
// software to the public domain. We make this dedication for the benefit
|
||||
// of the public at large and to the detriment of our heirs and
|
||||
// successors. We intend this dedication to be an overt act of
|
||||
// relinquishment in perpetuity of all present and future rights to this
|
||||
// software under copyright law.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
pub mod constants {
|
||||
use pezframe_support::{
|
||||
parameter_types,
|
||||
weights::{constants, Weight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||
pub const ExtrinsicBaseWeight: Weight =
|
||||
Weight::from_parts(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000), 0);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_weights {
|
||||
use pezframe_support::weights::constants;
|
||||
|
||||
/// Checks that the weight exists and is sane.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
let w = super::constants::ExtrinsicBaseWeight::get();
|
||||
|
||||
// At least 10 µs.
|
||||
assert!(
|
||||
w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||
"Weight should be at least 10 µs."
|
||||
);
|
||||
// At most 1 ms.
|
||||
assert!(
|
||||
w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||
"Weight should be at most 1 ms."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// This file is part of Pezcumulus.
|
||||
// SPDX-License-Identifier: Unlicense
|
||||
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
|
||||
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
// distribute this software, either in source code form or as a compiled
|
||||
// binary, for any purpose, commercial or non-commercial, and by any
|
||||
// means.
|
||||
|
||||
// In jurisdictions that recognize copyright laws, the author or authors
|
||||
// of this software dedicate any and all copyright interest in the
|
||||
// software to the public domain. We make this dedication for the benefit
|
||||
// of the public at large and to the detriment of our heirs and
|
||||
// successors. We intend this dedication to be an overt act of
|
||||
// relinquishment in perpetuity of all present and future rights to this
|
||||
// software under copyright law.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
//! Expose the auto generated weight files.
|
||||
|
||||
pub mod block_weights;
|
||||
pub mod extrinsic_weights;
|
||||
pub mod paritydb_weights;
|
||||
pub mod rocksdb_weights;
|
||||
|
||||
pub use block_weights::constants::BlockExecutionWeight;
|
||||
pub use extrinsic_weights::constants::ExtrinsicBaseWeight;
|
||||
pub use rocksdb_weights::constants::RocksDbWeight;
|
||||
@@ -0,0 +1,74 @@
|
||||
// This file is part of Pezcumulus.
|
||||
// SPDX-License-Identifier: Unlicense
|
||||
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
|
||||
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
// distribute this software, either in source code form or as a compiled
|
||||
// binary, for any purpose, commercial or non-commercial, and by any
|
||||
// means.
|
||||
|
||||
// In jurisdictions that recognize copyright laws, the author or authors
|
||||
// of this software dedicate any and all copyright interest in the
|
||||
// software to the public domain. We make this dedication for the benefit
|
||||
// of the public at large and to the detriment of our heirs and
|
||||
// successors. We intend this dedication to be an overt act of
|
||||
// relinquishment in perpetuity of all present and future rights to this
|
||||
// software under copyright law.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
pub mod constants {
|
||||
use pezframe_support::{
|
||||
parameter_types,
|
||||
weights::{constants, RuntimeDbWeight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
||||
/// are available for brave runtime engineers who may want to try this out as default.
|
||||
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||
read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||
write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_db_weights {
|
||||
use super::constants::ParityDbWeight as W;
|
||||
use pezframe_support::weights::constants;
|
||||
|
||||
/// Checks that all weights exist and have sane values.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
// At least 1 µs.
|
||||
assert!(
|
||||
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||
"Read weight should be at least 1 µs."
|
||||
);
|
||||
assert!(
|
||||
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||
"Write weight should be at least 1 µs."
|
||||
);
|
||||
// At most 1 ms.
|
||||
assert!(
|
||||
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||
"Read weight should be at most 1 ms."
|
||||
);
|
||||
assert!(
|
||||
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||
"Write weight should be at most 1 ms."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
// This file is part of Pezcumulus.
|
||||
// SPDX-License-Identifier: Unlicense
|
||||
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
|
||||
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
// distribute this software, either in source code form or as a compiled
|
||||
// binary, for any purpose, commercial or non-commercial, and by any
|
||||
// means.
|
||||
|
||||
// In jurisdictions that recognize copyright laws, the author or authors
|
||||
// of this software dedicate any and all copyright interest in the
|
||||
// software to the public domain. We make this dedication for the benefit
|
||||
// of the public at large and to the detriment of our heirs and
|
||||
// successors. We intend this dedication to be an overt act of
|
||||
// relinquishment in perpetuity of all present and future rights to this
|
||||
// software under copyright law.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
pub mod constants {
|
||||
use pezframe_support::{
|
||||
parameter_types,
|
||||
weights::{constants, RuntimeDbWeight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// By default, Bizinikiwi uses `RocksDB`, so this will be the weight used throughout
|
||||
/// the runtime.
|
||||
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||
read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||
write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_db_weights {
|
||||
use super::constants::RocksDbWeight as W;
|
||||
use pezframe_support::weights::constants;
|
||||
|
||||
/// Checks that all weights exist and have sane values.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
// At least 1 µs.
|
||||
assert!(
|
||||
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||
"Read weight should be at least 1 µs."
|
||||
);
|
||||
assert!(
|
||||
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||
"Write weight should be at least 1 µs."
|
||||
);
|
||||
// At most 1 ms.
|
||||
assert!(
|
||||
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||
"Read weight should be at most 1 ms."
|
||||
);
|
||||
assert!(
|
||||
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||
"Write weight should be at most 1 ms."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,515 @@
|
||||
// This file is part of Pezcumulus.
|
||||
// SPDX-License-Identifier: Unlicense
|
||||
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
|
||||
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
// distribute this software, either in source code form or as a compiled
|
||||
// binary, for any purpose, commercial or non-commercial, and by any
|
||||
// means.
|
||||
|
||||
// In jurisdictions that recognize copyright laws, the author or authors
|
||||
// of this software dedicate any and all copyright interest in the
|
||||
// software to the public domain. We make this dedication for the benefit
|
||||
// of the public at large and to the detriment of our heirs and
|
||||
// successors. We intend this dedication to be an overt act of
|
||||
// relinquishment in perpetuity of all present and future rights to this
|
||||
// software under copyright law.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
//! Holds the XCM specific configuration that would otherwise be in lib.rs
|
||||
//!
|
||||
//! This configuration dictates how the Penpal chain will communicate with other chains.
|
||||
//!
|
||||
//! One of the main uses of the penpal chain will be to be a benefactor of reserve asset transfers
|
||||
//! with Asset Hub as the reserve. At present no derivative tokens are minted on receipt of a
|
||||
//! `ReserveAssetTransferDeposited` message but that will but the intension will be to support this
|
||||
//! soon.
|
||||
use super::{
|
||||
AccountId, AllPalletsWithSystem, AssetId as AssetIdPalletAssets, Assets, Authorship, Balance,
|
||||
Balances, CollatorSelection, ForeignAssets, ForeignAssetsInstance, NonZeroIssuance, PezkuwiXcm,
|
||||
Runtime, RuntimeCall, RuntimeEvent, RuntimeHoldReason, RuntimeOrigin, TeyrchainInfo,
|
||||
TeyrchainSystem, WeightToFee, XcmpQueue,
|
||||
};
|
||||
use crate::{BaseDeliveryFee, FeeAssetId, TransactionByteFee};
|
||||
use assets_common::TrustBackedAssetsAsLocation;
|
||||
use core::marker::PhantomData;
|
||||
use pezframe_support::{
|
||||
parameter_types,
|
||||
traits::{
|
||||
fungible::HoldConsideration, tokens::imbalance::ResolveAssetTo, ConstU32, Contains,
|
||||
ContainsPair, Equals, Everything, EverythingBut, Get, LinearStoragePrice, Nothing,
|
||||
PalletInfoAccess,
|
||||
},
|
||||
weights::Weight,
|
||||
};
|
||||
use pezframe_system::EnsureRoot;
|
||||
use pezpallet_xcm::{AuthorizedAliasers, XcmPassthrough};
|
||||
use pezkuwi_runtime_common::{impls::ToAuthor, xcm_sender::ExponentialPrice};
|
||||
use pezkuwi_teyrchain_primitives::primitives::Sibling;
|
||||
use pezsp_runtime::traits::{AccountIdConversion, ConvertInto, Identity, TryConvertInto};
|
||||
use testnet_teyrchains_constants::zagros::currency::deposit;
|
||||
use teyrchains_common::{
|
||||
xcm_config::{AssetFeeAsExistentialDepositMultiplier, ConcreteAssetFromSystem},
|
||||
TREASURY_PALLET_ID,
|
||||
};
|
||||
use xcm::latest::{prelude::*, ZAGROS_GENESIS_HASH};
|
||||
use xcm_builder::{
|
||||
AccountId32Aliases, AliasChildLocation, AliasOriginRootUsingFilter,
|
||||
AllowExplicitUnpaidExecutionFrom, AllowHrmpNotificationsFromRelayChain,
|
||||
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
|
||||
AsPrefixedGeneralIndex, ConvertedConcreteId, DescribeAllTerminal, DescribeFamily,
|
||||
DescribeTerminus, EnsureXcmOrigin, ExternalConsensusLocationsConverterFor, FixedWeightBounds,
|
||||
FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter, HashedDescription, IsConcrete,
|
||||
LocalMint, NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
|
||||
SendXcmFeeToAccount, SiblingTeyrchainAsNative, SiblingTeyrchainConvertsVia,
|
||||
SignedAccountId32AsNative, SignedToAccountId32, SingleAssetExchangeAdapter,
|
||||
SovereignSignedViaLocation, StartsWith, TakeWeightCredit, TrailingSetTopicAsId,
|
||||
UsingComponents, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
|
||||
};
|
||||
use xcm_executor::{traits::JustTry, XcmExecutor};
|
||||
|
||||
parameter_types! {
|
||||
pub const RelayLocation: Location = Location::parent();
|
||||
// Local native currency which is stored in `pezpallet_balances`
|
||||
pub const PenpalNativeCurrency: Location = Location::here();
|
||||
// The Penpal runtime is utilized for testing with various environment setups.
|
||||
// This storage item allows us to customize the `NetworkId` where Penpal is deployed.
|
||||
// By default, it is set to `Zagros Network` and can be changed using `System::set_storage`.
|
||||
pub storage RelayNetworkId: NetworkId = NetworkId::ByGenesis(ZAGROS_GENESIS_HASH);
|
||||
pub RelayNetwork: Option<NetworkId> = Some(RelayNetworkId::get());
|
||||
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
|
||||
pub UniversalLocation: InteriorLocation = [
|
||||
GlobalConsensus(RelayNetworkId::get()),
|
||||
Teyrchain(TeyrchainInfo::teyrchain_id().into())
|
||||
].into();
|
||||
pub TreasuryAccount: AccountId = TREASURY_PALLET_ID.into_account_truncating();
|
||||
pub StakingPot: AccountId = CollatorSelection::account_id();
|
||||
pub TrustBackedAssetsPalletIndex: u8 = <Assets as PalletInfoAccess>::index() as u8;
|
||||
pub TrustBackedAssetsPalletLocation: Location =
|
||||
PalletInstance(TrustBackedAssetsPalletIndex::get()).into();
|
||||
}
|
||||
|
||||
/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used
|
||||
/// when determining ownership of accounts for asset transacting and when attempting to use XCM
|
||||
/// `Transact` in order to determine the dispatch Origin.
|
||||
pub type LocationToAccountId = (
|
||||
// The parent (Relay-chain) origin converts to the parent `AccountId`.
|
||||
ParentIsPreset<AccountId>,
|
||||
// Sibling teyrchain origins convert to AccountId via the `ParaId::into`.
|
||||
SiblingTeyrchainConvertsVia<Sibling, AccountId>,
|
||||
// Straight up local `AccountId32` origins just alias directly to `AccountId`.
|
||||
AccountId32Aliases<RelayNetwork, AccountId>,
|
||||
// Foreign locations alias into accounts according to a hash of their standard description.
|
||||
HashedDescription<AccountId, (DescribeTerminus, DescribeFamily<DescribeAllTerminal>)>,
|
||||
// Different global consensus locations sovereign accounts.
|
||||
ExternalConsensusLocationsConverterFor<UniversalLocation, AccountId>,
|
||||
);
|
||||
|
||||
/// Means for transacting assets on this chain.
|
||||
pub type FungibleTransactor = FungibleAdapter<
|
||||
// Use this currency:
|
||||
Balances,
|
||||
// Use this currency when it is a fungible asset matching the given location or name:
|
||||
IsConcrete<PenpalNativeCurrency>,
|
||||
// Do a simple punn to convert an AccountId32 Location into a native chain account ID:
|
||||
LocationToAccountId,
|
||||
// Our chain's account ID type (we can't get away without mentioning it explicitly):
|
||||
AccountId,
|
||||
// We don't track any teleports.
|
||||
(),
|
||||
>;
|
||||
|
||||
/// Means for transacting assets besides the native currency on this chain.
|
||||
pub type FungiblesTransactor = FungiblesAdapter<
|
||||
// Use this fungibles implementation:
|
||||
Assets,
|
||||
// Use this currency when it is a fungible asset matching the given location or name:
|
||||
(
|
||||
ConvertedConcreteId<
|
||||
AssetIdPalletAssets,
|
||||
Balance,
|
||||
AsPrefixedGeneralIndex<AssetsPalletLocation, AssetIdPalletAssets, JustTry>,
|
||||
JustTry,
|
||||
>,
|
||||
ConvertedConcreteId<
|
||||
AssetIdPalletAssets,
|
||||
Balance,
|
||||
AsPrefixedGeneralIndex<
|
||||
SystemAssetHubAssetsPalletLocation,
|
||||
AssetIdPalletAssets,
|
||||
JustTry,
|
||||
>,
|
||||
JustTry,
|
||||
>,
|
||||
),
|
||||
// Convert an XCM Location into a local account id:
|
||||
LocationToAccountId,
|
||||
// Our chain's account ID type (we can't get away without mentioning it explicitly):
|
||||
AccountId,
|
||||
// We only want to allow teleports of known assets. We use non-zero issuance as an indication
|
||||
// that this asset is known.
|
||||
LocalMint<NonZeroIssuance<AccountId, Assets>>,
|
||||
// The account to use for tracking teleports.
|
||||
CheckingAccount,
|
||||
>;
|
||||
|
||||
// Using the latest `Location`, we don't need to worry about migrations for Penpal.
|
||||
pub type ForeignAssetsAssetId = Location;
|
||||
pub type ForeignAssetsConvertedConcreteId = xcm_builder::MatchedConvertedConcreteId<
|
||||
Location,
|
||||
Balance,
|
||||
EverythingBut<(
|
||||
// Here we rely on fact that something like this works:
|
||||
// assert!(Location::new(1,
|
||||
// [Teyrchain(100)]).starts_with(&Location::parent()));
|
||||
// assert!([Teyrchain(100)].into().starts_with(&Here));
|
||||
StartsWith<assets_common::matching::LocalLocationPattern>,
|
||||
)>,
|
||||
Identity,
|
||||
TryConvertInto,
|
||||
>;
|
||||
|
||||
/// Means for transacting foreign assets from different global consensus.
|
||||
pub type ForeignFungiblesTransactor = FungiblesAdapter<
|
||||
// Use this fungibles implementation:
|
||||
ForeignAssets,
|
||||
// Use this currency when it is a fungible asset matching the given location or name:
|
||||
ForeignAssetsConvertedConcreteId,
|
||||
// Convert an XCM Location into a local account id:
|
||||
LocationToAccountId,
|
||||
// Our chain's account ID type (we can't get away without mentioning it explicitly):
|
||||
AccountId,
|
||||
// We don't need to check teleports here.
|
||||
NoChecking,
|
||||
// The account to use for tracking teleports.
|
||||
CheckingAccount,
|
||||
>;
|
||||
|
||||
/// Means for transacting assets on this chain.
|
||||
pub type AssetTransactors = (FungibleTransactor, ForeignFungiblesTransactor, FungiblesTransactor);
|
||||
|
||||
/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
|
||||
/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can
|
||||
/// biases the kind of local `Origin` it will become.
|
||||
pub type XcmOriginToTransactDispatchOrigin = (
|
||||
// Sovereign account converter; this attempts to derive an `AccountId` from the origin location
|
||||
// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
|
||||
// foreign chains who want to have a local sovereign account on this chain which they control.
|
||||
SovereignSignedViaLocation<LocationToAccountId, RuntimeOrigin>,
|
||||
// Native converter for Relay-chain (Parent) location; will convert to a `Relay` origin when
|
||||
// recognized.
|
||||
RelayChainAsNative<RelayChainOrigin, RuntimeOrigin>,
|
||||
// Native converter for sibling Teyrchains; will convert to a `SiblingPara` origin when
|
||||
// recognized.
|
||||
SiblingTeyrchainAsNative<cumulus_pallet_xcm::Origin, RuntimeOrigin>,
|
||||
// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
|
||||
// transaction from the Root origin.
|
||||
ParentAsSuperuser<RuntimeOrigin>,
|
||||
// Native signed account converter; this just converts an `AccountId32` origin into a normal
|
||||
// `RuntimeOrigin::Signed` origin of the same 32-byte value.
|
||||
SignedAccountId32AsNative<RelayNetwork, RuntimeOrigin>,
|
||||
// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.
|
||||
XcmPassthrough<RuntimeOrigin>,
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
pub const RootLocation: Location = Location::here();
|
||||
// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
|
||||
pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024);
|
||||
pub const MaxInstructions: u32 = 100;
|
||||
pub const MaxAssetsIntoHolding: u32 = 64;
|
||||
pub XcmAssetFeesReceiver: Option<AccountId> = Authorship::author();
|
||||
}
|
||||
|
||||
pub struct ParentOrParentsExecutivePlurality;
|
||||
impl Contains<Location> for ParentOrParentsExecutivePlurality {
|
||||
fn contains(location: &Location) -> bool {
|
||||
matches!(location.unpack(), (1, []) | (1, [Plurality { id: BodyId::Executive, .. }]))
|
||||
}
|
||||
}
|
||||
|
||||
pub type Barrier = TrailingSetTopicAsId<(
|
||||
TakeWeightCredit,
|
||||
// Expected responses are OK.
|
||||
AllowKnownQueryResponses<PezkuwiXcm>,
|
||||
// Allow XCMs with some computed origins to pass through.
|
||||
WithComputedOrigin<
|
||||
(
|
||||
// If the message is one that immediately attempts to pay for execution, then
|
||||
// allow it.
|
||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||
// Parent and its pluralities (i.e. governance bodies) get free execution.
|
||||
AllowExplicitUnpaidExecutionFrom<(ParentOrParentsExecutivePlurality,)>,
|
||||
// Subscriptions for version tracking are OK.
|
||||
AllowSubscriptionsFrom<Everything>,
|
||||
// HRMP notifications from the relay chain are OK.
|
||||
AllowHrmpNotificationsFromRelayChain,
|
||||
),
|
||||
UniversalLocation,
|
||||
ConstU32<8>,
|
||||
>,
|
||||
)>;
|
||||
|
||||
/// Type alias to conveniently refer to `pezframe_system`'s `Config::AccountId`.
|
||||
pub type AccountIdOf<R> = <R as pezframe_system::Config>::AccountId;
|
||||
|
||||
/// Asset filter that allows all assets from a certain location matching asset id.
|
||||
pub struct AssetPrefixFrom<Prefix, Origin>(PhantomData<(Prefix, Origin)>);
|
||||
impl<Prefix, Origin> ContainsPair<Asset, Location> for AssetPrefixFrom<Prefix, Origin>
|
||||
where
|
||||
Prefix: Get<Location>,
|
||||
Origin: Get<Location>,
|
||||
{
|
||||
fn contains(asset: &Asset, origin: &Location) -> bool {
|
||||
let loc = Origin::get();
|
||||
&loc == origin &&
|
||||
matches!(asset, Asset { id: AssetId(asset_loc), fun: Fungible(_a) }
|
||||
if asset_loc.starts_with(&Prefix::get()))
|
||||
}
|
||||
}
|
||||
|
||||
type AssetsFrom<T> = AssetPrefixFrom<T, T>;
|
||||
|
||||
// This asset can be added to AH as Asset and reserved transfer between Penpal and AH
|
||||
pub const RESERVABLE_ASSET_ID: u32 = 1;
|
||||
// This asset can be added to AH as ForeignAsset and teleported between Penpal and AH
|
||||
pub const TELEPORTABLE_ASSET_ID: u32 = 2;
|
||||
|
||||
pub const ASSETS_PALLET_ID: u8 = 50;
|
||||
pub const ASSET_HUB_ID: u32 = 1000;
|
||||
|
||||
pub const USDT_ASSET_ID: u128 = 1984;
|
||||
|
||||
parameter_types! {
|
||||
/// The location that this chain recognizes as the Relay network's Asset Hub.
|
||||
pub SystemAssetHubLocation: Location = Location::new(1, [Teyrchain(ASSET_HUB_ID)]);
|
||||
// the Relay Chain's Asset Hub's Assets pallet index
|
||||
pub SystemAssetHubAssetsPalletLocation: Location =
|
||||
Location::new(1, [Teyrchain(ASSET_HUB_ID), PalletInstance(ASSETS_PALLET_ID)]);
|
||||
pub AssetsPalletLocation: Location =
|
||||
Location::new(0, [PalletInstance(ASSETS_PALLET_ID)]);
|
||||
pub CheckingAccount: AccountId = PezkuwiXcm::check_account();
|
||||
pub LocalReservableFromAssetHub: Location = Location::new(
|
||||
1,
|
||||
[Teyrchain(ASSET_HUB_ID), PalletInstance(ASSETS_PALLET_ID), GeneralIndex(RESERVABLE_ASSET_ID.into())]
|
||||
);
|
||||
pub UsdtFromAssetHub: Location = Location::new(
|
||||
1,
|
||||
[Teyrchain(ASSET_HUB_ID), PalletInstance(ASSETS_PALLET_ID), GeneralIndex(USDT_ASSET_ID)],
|
||||
);
|
||||
|
||||
/// The Penpal runtime is utilized for testing with various environment setups.
|
||||
/// This storage item provides the opportunity to customize testing scenarios
|
||||
/// by configuring the trusted asset from the `SystemAssetHub`.
|
||||
///
|
||||
/// By default, it is configured as a `SystemAssetHubLocation` and can be modified using `System::set_storage`.
|
||||
pub storage CustomizableAssetFromSystemAssetHub: Location = SystemAssetHubLocation::get();
|
||||
pub storage LocalTeleportableToAssetHub: Location = Location::new(
|
||||
0,
|
||||
[PalletInstance(ASSETS_PALLET_ID), GeneralIndex(TELEPORTABLE_ASSET_ID.into())]
|
||||
);
|
||||
|
||||
pub const NativeAssetId: AssetId = AssetId(Location::here());
|
||||
pub const NativeAssetFilter: AssetFilter = Wild(AllOf { fun: WildFungible, id: NativeAssetId::get() });
|
||||
pub AssetHubTrustedTeleporter: (AssetFilter, Location) = (NativeAssetFilter::get(), SystemAssetHubLocation::get());
|
||||
}
|
||||
|
||||
/// Accepts asset with ID `AssetLocation` and is coming from `Origin` chain.
|
||||
pub struct AssetFromChain<AssetLocation, Origin>(PhantomData<(AssetLocation, Origin)>);
|
||||
impl<AssetLocation: Get<Location>, Origin: Get<Location>> ContainsPair<Asset, Location>
|
||||
for AssetFromChain<AssetLocation, Origin>
|
||||
{
|
||||
fn contains(asset: &Asset, origin: &Location) -> bool {
|
||||
tracing::trace!(target: "xcm::contains", ?asset, ?origin, "AssetFromChain");
|
||||
*origin == Origin::get() &&
|
||||
matches!(asset.id.clone(), AssetId(id) if id == AssetLocation::get())
|
||||
}
|
||||
}
|
||||
|
||||
pub type TrustedReserves = (
|
||||
NativeAsset,
|
||||
ConcreteAssetFromSystem<RelayLocation>,
|
||||
AssetsFrom<SystemAssetHubLocation>,
|
||||
AssetPrefixFrom<CustomizableAssetFromSystemAssetHub, SystemAssetHubLocation>,
|
||||
);
|
||||
|
||||
pub type TrustedTeleporters = (
|
||||
AssetFromChain<LocalTeleportableToAssetHub, SystemAssetHubLocation>,
|
||||
// This is used in the `IsTeleporter` configuration, meaning it accepts
|
||||
// native tokens teleported from Asset Hub.
|
||||
xcm_builder::Case<AssetHubTrustedTeleporter>,
|
||||
);
|
||||
|
||||
/// Defines origin aliasing rules for this chain.
|
||||
///
|
||||
/// - Allow any origin to alias into a child sub-location (equivalent to DescendOrigin),
|
||||
/// - Allow AssetHub root to alias into anything,
|
||||
/// - Allow origins explicitly authorized by the alias target location.
|
||||
pub type TrustedAliasers = (
|
||||
AliasChildLocation,
|
||||
AliasOriginRootUsingFilter<SystemAssetHubLocation, Everything>,
|
||||
AuthorizedAliasers<Runtime>,
|
||||
);
|
||||
|
||||
pub type WaivedLocations = Equals<RootLocation>;
|
||||
/// `AssetId`/`Balance` converter for `TrustBackedAssets`.
|
||||
pub type TrustBackedAssetsConvertedConcreteId =
|
||||
assets_common::TrustBackedAssetsConvertedConcreteId<AssetsPalletLocation, Balance>;
|
||||
|
||||
/// Asset converter for pool assets.
|
||||
/// Used to convert assets in pools to the asset required for fee payment.
|
||||
/// The pool must be between the first asset and the one required for fee payment.
|
||||
/// This type allows paying fees with any asset in a pool with the asset required for fee payment.
|
||||
pub type PoolAssetsExchanger = SingleAssetExchangeAdapter<
|
||||
crate::AssetConversion,
|
||||
crate::NativeAndAssets,
|
||||
(
|
||||
TrustBackedAssetsAsLocation<
|
||||
TrustBackedAssetsPalletLocation,
|
||||
Balance,
|
||||
xcm::latest::Location,
|
||||
>,
|
||||
ForeignAssetsConvertedConcreteId,
|
||||
),
|
||||
AccountId,
|
||||
>;
|
||||
|
||||
pub struct XcmConfig;
|
||||
impl xcm_executor::Config for XcmConfig {
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type XcmSender = XcmRouter;
|
||||
type XcmEventEmitter = PezkuwiXcm;
|
||||
// How to withdraw and deposit an asset.
|
||||
type AssetTransactor = AssetTransactors;
|
||||
type OriginConverter = XcmOriginToTransactDispatchOrigin;
|
||||
type IsReserve = TrustedReserves;
|
||||
// no teleport trust established with other chains
|
||||
type IsTeleporter = TrustedTeleporters;
|
||||
type UniversalLocation = UniversalLocation;
|
||||
type Barrier = Barrier;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
|
||||
type Trader = (
|
||||
UsingComponents<WeightToFee, RelayLocation, AccountId, Balances, ToAuthor<Runtime>>,
|
||||
// Allow native asset to pay the execution fee
|
||||
UsingComponents<WeightToFee, PenpalNativeCurrency, AccountId, Balances, ToAuthor<Runtime>>,
|
||||
cumulus_primitives_utility::SwapFirstAssetTrader<
|
||||
RelayLocation,
|
||||
crate::AssetConversion,
|
||||
WeightToFee,
|
||||
crate::NativeAndAssets,
|
||||
(
|
||||
TrustBackedAssetsAsLocation<
|
||||
TrustBackedAssetsPalletLocation,
|
||||
Balance,
|
||||
xcm::latest::Location,
|
||||
>,
|
||||
ForeignAssetsConvertedConcreteId,
|
||||
),
|
||||
ResolveAssetTo<StakingPot, crate::NativeAndAssets>,
|
||||
AccountId,
|
||||
>,
|
||||
);
|
||||
type ResponseHandler = PezkuwiXcm;
|
||||
type AssetTrap = PezkuwiXcm;
|
||||
type AssetClaims = PezkuwiXcm;
|
||||
type SubscriptionService = PezkuwiXcm;
|
||||
type PalletInstancesInfo = AllPalletsWithSystem;
|
||||
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
|
||||
type AssetLocker = ();
|
||||
type AssetExchanger = PoolAssetsExchanger;
|
||||
type FeeManager = XcmFeeManagerFromComponents<
|
||||
WaivedLocations,
|
||||
SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
|
||||
>;
|
||||
type MessageExporter = ();
|
||||
type UniversalAliases = Nothing;
|
||||
type CallDispatcher = RuntimeCall;
|
||||
type SafeCallFilter = Everything;
|
||||
type Aliasers = TrustedAliasers;
|
||||
type TransactionalProcessor = FrameTransactionalProcessor;
|
||||
type HrmpNewChannelOpenRequestHandler = ();
|
||||
type HrmpChannelAcceptedHandler = ();
|
||||
type HrmpChannelClosingHandler = ();
|
||||
type XcmRecorder = PezkuwiXcm;
|
||||
}
|
||||
|
||||
/// Multiplier used for dedicated `TakeFirstAssetTrader` with `ForeignAssets` instance.
|
||||
pub type ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger =
|
||||
AssetFeeAsExistentialDepositMultiplier<
|
||||
Runtime,
|
||||
WeightToFee,
|
||||
pezpallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto, ForeignAssetsInstance>,
|
||||
ForeignAssetsInstance,
|
||||
>;
|
||||
|
||||
/// Converts a local signed origin into an XCM location. Forms the basis for local origins
|
||||
/// sending/executing XCMs.
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
|
||||
|
||||
pub type PriceForParentDelivery =
|
||||
ExponentialPrice<FeeAssetId, BaseDeliveryFee, TransactionByteFee, TeyrchainSystem>;
|
||||
|
||||
/// The means for routing XCM messages which are not for local execution into the right message
|
||||
/// queues.
|
||||
pub type XcmRouter = WithUniqueTopic<(
|
||||
// Two routers - use UMP to communicate with the relay chain:
|
||||
cumulus_primitives_utility::ParentAsUmp<TeyrchainSystem, PezkuwiXcm, PriceForParentDelivery>,
|
||||
// ..and XCMP to communicate with the sibling chains.
|
||||
XcmpQueue,
|
||||
)>;
|
||||
|
||||
parameter_types! {
|
||||
pub const DepositPerItem: Balance = deposit(1, 0);
|
||||
pub const DepositPerByte: Balance = deposit(0, 1);
|
||||
pub const AuthorizeAliasHoldReason: RuntimeHoldReason = RuntimeHoldReason::PezkuwiXcm(pezpallet_xcm::HoldReason::AuthorizeAlias);
|
||||
}
|
||||
|
||||
impl pezpallet_xcm::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
type XcmRouter = XcmRouter;
|
||||
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
type XcmExecuteFilter = Everything;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = Everything;
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
|
||||
type UniversalLocation = UniversalLocation;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
|
||||
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
|
||||
// ^ Override for AdvertisedXcmVersion default
|
||||
type AdvertisedXcmVersion = pezpallet_xcm::CurrentXcmVersion;
|
||||
type Currency = Balances;
|
||||
type CurrencyMatcher = ();
|
||||
type TrustedLockers = ();
|
||||
type SovereignAccountOf = LocationToAccountId;
|
||||
type MaxLockers = ConstU32<8>;
|
||||
type WeightInfo = pezpallet_xcm::TestWeightInfo;
|
||||
type AdminOrigin = EnsureRoot<AccountId>;
|
||||
type MaxRemoteLockConsumers = ConstU32<0>;
|
||||
type RemoteLockConsumerIdentifier = ();
|
||||
// xcm_executor::Config::Aliasers also uses pezpallet_xcm::AuthorizedAliasers.
|
||||
type AuthorizedAliasConsideration = HoldConsideration<
|
||||
AccountId,
|
||||
Balances,
|
||||
AuthorizeAliasHoldReason,
|
||||
LinearStoragePrice<DepositPerItem, DepositPerByte, Balance>,
|
||||
>;
|
||||
}
|
||||
|
||||
impl cumulus_pallet_xcm::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
}
|
||||
Reference in New Issue
Block a user