mirror of
https://github.com/pezkuwichain/pezkuwi-runtime-templates.git
synced 2026-06-18 01:21:08 +00:00
Complete terminology rebrand to Pezkuwi ecosystem
Applied global changes: Polkadot->Pezkuwi, Parachain->TeyrChain, pallet->pezpallet, frame->pezframe. Updated authors in Cargo.toml to include Kurdistan Tech Institute and pezkuwichain team. Used Cargo aliases to maintain SDK compatibility while using rebranded names in source code.
This commit is contained in:
@@ -73,11 +73,11 @@ function sendToken(address token, ParaID destinationChain, MultiAddress destinat
|
||||
payable;
|
||||
```
|
||||
|
||||
If the ERC20 tokens has not been bridged before, there is a prerequisite step to register the ERC20 token on AssetHub via the `ForeignAssets` pallet. To register ERC20 tokens for the first time, the user may send the following transaction to the Gateway:
|
||||
If the ERC20 tokens has not been bridged before, there is a prerequisite step to register the ERC20 token on AssetHub via the `ForeignAssets` pezpallet. To register ERC20 tokens for the first time, the user may send the following transaction to the Gateway:
|
||||
```solidity, ignore
|
||||
function registerToken(address token) external payable;
|
||||
```
|
||||
The above function sends a message to the AssetHub parachain to register a new fungible asset in the `ForeignAssets` pallet. To account for delivery costs, the above function charges a fee in Ether which may be retrieved beforehand by calling `quoteRegisterFee`.
|
||||
The above function sends a message to the AssetHub parachain to register a new fungible asset in the `ForeignAssets` pezpallet. To account for delivery costs, the above function charges a fee in Ether which may be retrieved beforehand by calling `quoteRegisterFee`.
|
||||
|
||||
For more information, see the link:https://docs.snowbridge.network[Snowbridge Docs]. For more information on the Snowbridge deployment to Polkadot, see the link:https://polkadot.polkassembly.io/referenda/680[governance proposal which initialized Snowbridge on BridgeHub and AssetHub].
|
||||
|
||||
|
||||
@@ -19,12 +19,12 @@ To add oracle members, you'll need to submit transactions with sudo or root priv
|
||||
# Add a member (replace with actual address)
|
||||
subxt tx --url "ws://localhost:9944" \
|
||||
--suri "<sudo-suri>" \
|
||||
pallet-membership add_member \
|
||||
pezpallet-membership add_member \
|
||||
--account "<oracle-public-key>"
|
||||
|
||||
# Verify members
|
||||
subxt query --url "ws://localhost:9944" \
|
||||
pallet-membership members
|
||||
pezpallet-membership members
|
||||
----
|
||||
|
||||
=== 2. Format Oracle Values
|
||||
@@ -88,12 +88,12 @@ done
|
||||
|
||||
== Opting out
|
||||
|
||||
If you want to opt out of this feature, then you can just replace the `pallet_asset_tx_payment` with `pallet_transaction_payment` piece in `SignedExtra`:
|
||||
If you want to opt out of this feature, then you can just replace the `pezpallet_asset_tx_payment` with `pezpallet_transaction_payment` piece in `SignedExtra`:
|
||||
|
||||
[source,patch]
|
||||
pub type SignedExtra = (
|
||||
...
|
||||
- pallet_asset_tx_payment::ChargeAssetTxPayment<Runtime>,
|
||||
+ pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
|
||||
- pezpallet_asset_tx_payment::ChargeAssetTxPayment<Runtime>,
|
||||
+ pezpallet_transaction_payment::ChargeTransactionPayment<Runtime>,
|
||||
...
|
||||
);
|
||||
+44
-44
@@ -2,19 +2,19 @@
|
||||
:highlightjs-languages: rust
|
||||
:github-icon: pass:[<svg class="icon"><use href="#github-icon"/></svg>]
|
||||
|
||||
= OpenZeppelin Pallet Abstractions
|
||||
= OpenZeppelin Pezpallet Abstractions
|
||||
|
||||
=== Introduction
|
||||
|
||||
link:https://github.com/OpenZeppelin/openzeppelin-pallet-abstractions[openzeppelin-pallet-abstractions] is a Rust macro library designed to simplify and secure the configuration of Polkadot parachain runtimes. By reducing repetitive boilerplate and providing sensible defaults, the library helps developers configure their runtimes with fewer lines of code while ensuring flexibility for customizations.
|
||||
link:https://github.com/OpenZeppelin/openzeppelin-pezpallet-abstractions[openzeppelin-pezpallet-abstractions] is a Rust macro library designed to simplify and secure the configuration of Polkadot parachain runtimes. By reducing repetitive boilerplate and providing sensible defaults, the library helps developers configure their runtimes with fewer lines of code while ensuring flexibility for customizations.
|
||||
|
||||
Note: This library has not been audited yet and should not be used in production environments.
|
||||
|
||||
=== 1. Installation
|
||||
To start using the `openzeppelin-pallet-abstractions`, add it as a dependency in your Cargo.toml file:
|
||||
To start using the `openzeppelin-pezpallet-abstractions`, add it as a dependency in your Cargo.toml file:
|
||||
```toml
|
||||
[dependencies]
|
||||
openzeppelin-pallet-abstractions = { git = "https://github.com/OpenZeppelin/openzeppelin-pallet-abstractions", tag = "v0.1.0" }
|
||||
openzeppelin-pezpallet-abstractions = { git = "https://github.com/OpenZeppelin/openzeppelin-pezpallet-abstractions", tag = "v0.1.0" }
|
||||
```
|
||||
Then, import the required macros in your runtime configuration file.
|
||||
|
||||
@@ -25,7 +25,7 @@ The library offers a collection of macros for configuring various core runtime e
|
||||
===== 1. System configuration
|
||||
The `impl_openzeppelin_system!` macro facilitates the setup of foundational runtime components by implementing the `SystemConfig` trait for your custom runtime structure.
|
||||
```rust
|
||||
use openzeppelin_pallet_abstractions::{impl_openzeppelin_system, SystemConfig};
|
||||
use openzeppelin_pezpallet_abstractions::{impl_openzeppelin_system, SystemConfig};
|
||||
|
||||
pub struct OpenZeppelinRuntime;
|
||||
|
||||
@@ -39,15 +39,15 @@ impl SystemConfig for OpenZeppelinRuntime {
|
||||
}
|
||||
impl_openzeppelin_system!(OpenZeppelinRuntime);
|
||||
```
|
||||
This expands to configure multiple core pallets like `frame_system`, `pallet_timestamp`, `parachain_info`, and others essential for a functioning parachain runtime.
|
||||
This expands to configure multiple core pezpallets like `pezframe_system`, `pezpallet_timestamp`, `parachain_info`, and others essential for a functioning parachain runtime.
|
||||
|
||||
===== 2. Additional configurations
|
||||
|
||||
Further configuration can be achieved for pallets grouped by functionality, such as Assets, Consensus, EVM, Governance, and XCM. Each grouping has its own macro and configuration trait, making it easier to set up advanced components without redundant code.
|
||||
Further configuration can be achieved for pezpallets grouped by functionality, such as Assets, Consensus, EVM, Governance, and XCM. Each grouping has its own macro and configuration trait, making it easier to set up advanced components without redundant code.
|
||||
|
||||
Example setup for additional configurations in an EVM-based runtime:
|
||||
```rust
|
||||
use openzeppelin_pallet_abstractions::{
|
||||
use openzeppelin_pezpallet_abstractions::{
|
||||
impl_openzeppelin_assets, impl_openzeppelin_consensus, impl_openzeppelin_evm,
|
||||
impl_openzeppelin_governance, impl_openzeppelin_xcm, AssetsConfig,
|
||||
ConsensusConfig, EvmConfig, GovernanceConfig, XcmConfig,
|
||||
@@ -84,35 +84,35 @@ Custom Implementations: Integrate custom types (like `EitherOf`, `ConstU32`) or
|
||||
While the library is built with security in mind, it’s essential to review each configuration for your specific runtime and context.
|
||||
|
||||
===== 5. Contributing and Feedback
|
||||
We encourage contributions from the community to improve the library. Please refer to the link:https://github.com/OpenZeppelin/openzeppelin-pallet-abstractions/blob/main/CONTRIBUTING.MD[CONTRIBUTING.md] for guidelines.
|
||||
We encourage contributions from the community to improve the library. Please refer to the link:https://github.com/OpenZeppelin/openzeppelin-pezpallet-abstractions/blob/main/CONTRIBUTING.MD[CONTRIBUTING.md] for guidelines.
|
||||
|
||||
=== 3. Using Procedural Macros in OpenZeppelin Pallet Abstractions
|
||||
=== 3. Using Procedural Macros in OpenZeppelin Pezpallet Abstractions
|
||||
|
||||
==== 1. `construct_runtime!` Macro
|
||||
|
||||
The `construct_runtime!` macro simplifies the assembly of runtime modules by abstracting over both OpenZeppelin abstractions and standard pallets. This is useful for developers aiming to build a runtime quickly, without manually managing each pallet’s configuration.
|
||||
The `construct_runtime!` macro simplifies the assembly of runtime modules by abstracting over both OpenZeppelin abstractions and standard pezpallets. This is useful for developers aiming to build a runtime quickly, without manually managing each pezpallet’s configuration.
|
||||
|
||||
===== Usage Example
|
||||
|
||||
To use the macro, annotate a module with `#[openzeppelin_construct_runtime]` and define structs for each desired abstraction or regular pallet. Here’s a basic example:
|
||||
To use the macro, annotate a module with `#[openzeppelin_construct_runtime]` and define structs for each desired abstraction or regular pezpallet. Here’s a basic example:
|
||||
```rust
|
||||
#[openzeppelin_construct_runtime]
|
||||
mod runtime {
|
||||
#[abstraction]
|
||||
struct System; // Available abstractions: System, Consensus, XCM, Assets, Governance, EVM.
|
||||
#[pallet]
|
||||
type Pallet = pallet_crate; // Regular pallets defined with `#[pallet]` mimic the `construct_runtime!` structure.
|
||||
#[pezpallet]
|
||||
type Pezpallet = pezpallet_crate; // Regular pezpallets defined with `#[pezpallet]` mimic the `construct_runtime!` structure.
|
||||
}
|
||||
```
|
||||
Note: Pallet index assignments are handled automatically by this macro. If you require explicit control over pallet indices, please consider submitting a link:https://github.com/OpenZeppelin/openzeppelin-pallet-abstractions/issues[feature request].
|
||||
Note: Pezpallet index assignments are handled automatically by this macro. If you require explicit control over pezpallet indices, please consider submitting a link:https://github.com/OpenZeppelin/openzeppelin-pezpallet-abstractions/issues[feature request].
|
||||
|
||||
===== Supported Abstractions and their Pallets:
|
||||
* System -- frame_system, pallet_timestamp, parachain_info, pallet_scheduler, pallet_preimage, pallet_proxy, pallet_balances, pallet_utility, cumulus_pallet_parachain_system, pallet_multisig, pallet_session
|
||||
* Assets -- pallet_assets, pallet_transaction_payment, pallet_asset_manager
|
||||
* Consensus -- pallet_authorship, pallet_aura, cumulus_pallet_aura_ext, pallet_collator_selection
|
||||
* Governance -- pallet_sudo, pallet_treasury, pallet_conviction_voting, pallet_whitelist, pallet_custom_origins, pallet_referenda
|
||||
* XCM -- pallet_message_queue, cumulus_pallet_xcmp_queue, pallet_xcm, cumulus_pallet_xcm, pallet_xcm_transactor, orml_xtokens, pallet_xcm_weight_trader
|
||||
* EVM -- pallet_ethereum, pallet_evm, pallet_base_fee, pallet_evm_chain_id, pallet_erc20_xcm_bridge
|
||||
===== Supported Abstractions and their Pezpallets:
|
||||
* System -- pezframe_system, pezpallet_timestamp, parachain_info, pezpallet_scheduler, pezpallet_preimage, pezpallet_proxy, pezpallet_balances, pezpallet_utility, cumulus_pezpallet_parachain_system, pezpallet_multisig, pezpallet_session
|
||||
* Assets -- pezpallet_assets, pezpallet_transaction_payment, pezpallet_asset_manager
|
||||
* Consensus -- pezpallet_authorship, pezpallet_aura, cumulus_pezpallet_aura_ext, pezpallet_collator_selection
|
||||
* Governance -- pezpallet_sudo, pezpallet_treasury, pezpallet_conviction_voting, pezpallet_whitelist, pezpallet_custom_origins, pezpallet_referenda
|
||||
* XCM -- pezpallet_message_queue, cumulus_pezpallet_xcmp_queue, pezpallet_xcm, cumulus_pezpallet_xcm, pezpallet_xcm_transactor, orml_xtokens, pezpallet_xcm_weight_trader
|
||||
* EVM -- pezpallet_ethereum, pezpallet_evm, pezpallet_base_fee, pezpallet_evm_chain_id, pezpallet_erc20_xcm_bridge
|
||||
|
||||
==== 2. `impl_runtime_apis!` Macro
|
||||
|
||||
@@ -148,24 +148,24 @@ mod apis {
|
||||
| * `fp_rpc::EthereumRuntimeRPCApi` +
|
||||
* `fp_rpc::ConvertTransactionRuntimeApi`
|
||||
| * `RuntimeCall` -- runtime call generated by `construct_runtime` macro +
|
||||
* `Executive` -- `frame_executive::Executive` specification used by parachain system +
|
||||
* `Ethereum` -- `pallet_ethereum` pallet struct generated by `construct_runtime` macro
|
||||
* `Executive` -- `pezframe_executive::Executive` specification used by parachain system +
|
||||
* `Ethereum` -- `pezpallet_ethereum` pezpallet struct generated by `construct_runtime` macro
|
||||
|
||||
| assets
|
||||
| * `pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi` +
|
||||
* `pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi`
|
||||
| * `TransactionPayment` -- `pallet_transaction_payment` struct pallet generated by `construct_runtime` macro +
|
||||
| * `pezpallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi` +
|
||||
* `pezpallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi`
|
||||
| * `TransactionPayment` -- `pezpallet_transaction_payment` struct pezpallet generated by `construct_runtime` macro +
|
||||
* `RuntimeCall` -- runtime call generated by `construct_runtime` macro +
|
||||
* `Balance` -- type used for balance specification (e.g., in `pallet_balances` config)
|
||||
* `Balance` -- type used for balance specification (e.g., in `pezpallet_balances` config)
|
||||
|
||||
| consensus
|
||||
| * `sp_consensus_aura::AuraApi` +
|
||||
* `sp_session::SessionKeys` +
|
||||
* `cumulus_primitives_aura::AuraUnincludedSegmentApi` (if `async-backing` feature is enabled)
|
||||
| * `SessionKeys` -- struct generated by `impl_opaque_keys` macro +
|
||||
* `Aura` -- `pallet_aura` struct pallet generated by `construct_runtime` macro (only if `async-backing` feature is not enabled) +
|
||||
* `Aura` -- `pezpallet_aura` struct pezpallet generated by `construct_runtime` macro (only if `async-backing` feature is not enabled) +
|
||||
* `SlotDuration` -- constant used for slot duration definition (only if `async-backing` feature is enabled) +
|
||||
* `ConsensusHook` -- type used in `cumulus_pallet_parachain_system::Config::ConsensusHook` (only if `async-backing` feature is enabled)
|
||||
* `ConsensusHook` -- type used in `cumulus_pezpallet_parachain_system::Config::ConsensusHook` (only if `async-backing` feature is enabled)
|
||||
|
||||
| system
|
||||
| * `sp_api::Core` +
|
||||
@@ -173,37 +173,37 @@ mod apis {
|
||||
* `sp_block_builder::BlockBuilder` +
|
||||
* `sp_transaction_pool::runtime_api::TaggedTransactionQueue` +
|
||||
* `sp_offchain::OffchainWorkerApi` +
|
||||
* `frame_system_rpc_runtime_api::AccountNonceApi` +
|
||||
* `pezframe_system_rpc_runtime_api::AccountNonceApi` +
|
||||
* `cumulus_primitives_core::CollectCollationInfo` +
|
||||
* `frame_try_runtime::TryRuntime` (under a `try-runtime` feature) +
|
||||
* `pezframe_try_runtime::TryRuntime` (under a `try-runtime` feature) +
|
||||
* `sp_genesis_builder::GenesisBuilder`
|
||||
| * `Executive` -- `frame_executive::Executive` specification used by parachain system +
|
||||
* `System` -- `frame_system` pallet struct generated by `construct_runtime` macro +
|
||||
* `ParachainSystem` -- `cumulus_pallet_parachain_system` pallet struct generated by `construct_runtime` macro +
|
||||
| * `Executive` -- `pezframe_executive::Executive` specification used by parachain system +
|
||||
* `System` -- `pezframe_system` pezpallet struct generated by `construct_runtime` macro +
|
||||
* `ParachainSystem` -- `cumulus_pezpallet_parachain_system` pezpallet struct generated by `construct_runtime` macro +
|
||||
* `RuntimeVersion` -- runtime version, generated by `sp_version::runtime_version` +
|
||||
* `AccountId` -- account id type specified in `frame_system::Config` +
|
||||
* `Nonce` -- nonce type specified in `frame_system::Config` +
|
||||
* `AccountId` -- account id type specified in `pezframe_system::Config` +
|
||||
* `Nonce` -- nonce type specified in `pezframe_system::Config` +
|
||||
* `RuntimeGenesisConfig` -- type generated by `construct_runtime` macro +
|
||||
* `RuntimeBlockWeights` -- type implementing `Get<BlockWeights>`, often built by `BlockWeights::builder`
|
||||
|
||||
| benchmarks
|
||||
| * `frame_benchmarking::Benchmark` (under `runtime-benchmarks` feature)
|
||||
| * `Assets` -- `pallet_assets` pallet struct generated by `construct_runtime` macro +
|
||||
* `AssetManager` -- `pallet_asset_manager` pallet struct generated by `construct_runtime` macro +
|
||||
| * `pezframe_benchmarking::Benchmark` (under `runtime-benchmarks` feature)
|
||||
| * `Assets` -- `pezpallet_assets` pezpallet struct generated by `construct_runtime` macro +
|
||||
* `AssetManager` -- `pezpallet_asset_manager` pezpallet struct generated by `construct_runtime` macro +
|
||||
* `AssetType` -- struct describing foreign assets in XCM configuration +
|
||||
* `RuntimeOrigin` -- type generated by `construct_runtime` macro +
|
||||
* `RelayLocation` -- `Location` type pointing to the relaychain +
|
||||
* `System` -- `frame_system` pallet struct generated by `construct_runtime` macro +
|
||||
* `ParachainSystem` -- `cumulus_pallet_parachain_system` pallet struct generated by `construct_runtime` macro +
|
||||
* `System` -- `pezframe_system` pezpallet struct generated by `construct_runtime` macro +
|
||||
* `ParachainSystem` -- `cumulus_pezpallet_parachain_system` pezpallet struct generated by `construct_runtime` macro +
|
||||
* `ExistentialDeposit` -- type describing existential deposit +
|
||||
* `AssetId` -- type describing internal asset id +
|
||||
* `XCMConfig` -- struct implementing `xcm_executor::Config`, generated by XCM abstraction as `XcmExecutorConfig` +
|
||||
* `AccountId` -- account id type specified in `frame_system::Config` +
|
||||
* `AccountId` -- account id type specified in `pezframe_system::Config` +
|
||||
* `Cents` -- constant representing 1/100 of the native token +
|
||||
* `FeeAssetId` -- asset for XCM fees, generated by XCM abstraction +
|
||||
* `TransactionByteFee` -- fee per byte of data, generated by assets abstraction +
|
||||
* `Address` -- type describing address format for accounts +
|
||||
* `Balances` -- `pallet_balances` pallet struct generated by `construct_runtime` macro
|
||||
* `Balances` -- `pezpallet_balances` pezpallet struct generated by `construct_runtime` macro
|
||||
|===
|
||||
|
||||
This macro allows for clear modularization of APIs, facilitating easier maintenance and extension of runtime functionalities.
|
||||
@@ -132,4 +132,4 @@ At this point, you are free to use the omni-node. The command for using omni-nod
|
||||
- Read our general guides to understand more about the concepts of runtime development.
|
||||
|
||||
- Learn more about the runtime configuration. Currently, we have two runtime templates: xref:runtimes/generic.adoc[Generic Runtime Template] and xref:runtimes/evm.adoc[EVM Runtime Template].
|
||||
- Explore the documentation for pallets. It may be useful if you are considering building a frontend for your parachain.
|
||||
- Explore the documentation for pezpallets. It may be useful if you are considering building a frontend for your parachain.
|
||||
|
||||
@@ -30,18 +30,18 @@ cargo build --features runtime-benchmarks
|
||||
# Build release runtime benchmarks
|
||||
cargo build --release --features=runtime-benchmarks
|
||||
|
||||
# Collect all pallets needed for benchmarking
|
||||
# Makes the assumption all pallets are present at: /pallets/$PALLET_NAME
|
||||
pallets=$(ls pallets/)
|
||||
# Collect all pezpallets needed for benchmarking
|
||||
# Makes the assumption all pezpallets are present at: /pezpallets/$PALLET_NAME
|
||||
pezpallets=$(ls pezpallets/)
|
||||
|
||||
# Generate weights
|
||||
for pallet_name in $pallets; do
|
||||
./target/release/node benchmark pallet \
|
||||
--pallet pallet_$pallet_name \
|
||||
for pezpallet_name in $pezpallets; do
|
||||
./target/release/node benchmark pezpallet \
|
||||
--pezpallet pezpallet_$pezpallet_name \
|
||||
--extrinsic "*" \
|
||||
--steps 50 \
|
||||
--repeat 20 \
|
||||
--output ./runtime/src/weights/$pallet_name.rs
|
||||
--output ./runtime/src/weights/$pezpallet_name.rs
|
||||
done
|
||||
```
|
||||
[start=3]
|
||||
|
||||
Reference in New Issue
Block a user