mirror of
https://github.com/pezkuwichain/pezkuwi-runtime-templates.git
synced 2026-06-12 05:21:02 +00:00
Add pallet-assets (#94)
* init * add assets to xcm transactor * add empty genesis config for assets for now
This commit is contained in:
+40
-3
@@ -17,7 +17,10 @@ use frame_support::{
|
||||
dispatch::DispatchClass,
|
||||
genesis_builder_helper::{build_config, create_default_config},
|
||||
parameter_types,
|
||||
traits::{ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Everything, InstanceFilter},
|
||||
traits::{
|
||||
AsEnsureOriginWithArg, ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Everything,
|
||||
InstanceFilter,
|
||||
},
|
||||
weights::{
|
||||
constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, Weight, WeightToFeeCoefficient,
|
||||
WeightToFeeCoefficients, WeightToFeePolynomial,
|
||||
@@ -26,7 +29,7 @@ use frame_support::{
|
||||
};
|
||||
use frame_system::{
|
||||
limits::{BlockLength, BlockWeights},
|
||||
EnsureRoot,
|
||||
EnsureRoot, EnsureSigned,
|
||||
};
|
||||
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
|
||||
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
|
||||
@@ -56,7 +59,7 @@ use xcm::latest::prelude::BodyId;
|
||||
use xcm_executor::XcmExecutor;
|
||||
|
||||
use crate::{
|
||||
constants::currency::{deposit, EXISTENTIAL_DEPOSIT, MICROCENTS, MILLICENTS},
|
||||
constants::currency::{deposit, CENTS, EXISTENTIAL_DEPOSIT, MICROCENTS, MILLICENTS},
|
||||
weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},
|
||||
xcm_config::{RelayLocation, XcmConfig, XcmOriginToTransactDispatchOrigin},
|
||||
};
|
||||
@@ -427,6 +430,38 @@ impl pallet_balances::Config for Runtime {
|
||||
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const AssetDeposit: Balance = 10 * CENTS;
|
||||
pub const AssetAccountDeposit: Balance = deposit(1, 16);
|
||||
pub const ApprovalDeposit: Balance = EXISTENTIAL_DEPOSIT;
|
||||
pub const StringLimit: u32 = 50;
|
||||
pub const MetadataDepositBase: Balance = deposit(1, 68);
|
||||
pub const MetadataDepositPerByte: Balance = deposit(0, 1);
|
||||
}
|
||||
|
||||
impl pallet_assets::Config for Runtime {
|
||||
type ApprovalDeposit = ApprovalDeposit;
|
||||
type AssetAccountDeposit = AssetAccountDeposit;
|
||||
type AssetDeposit = AssetDeposit;
|
||||
type AssetId = u32;
|
||||
type AssetIdParameter = parity_scale_codec::Compact<u32>;
|
||||
type Balance = Balance;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type BenchmarkHelper = ();
|
||||
type CallbackHandle = ();
|
||||
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
|
||||
type Currency = Balances;
|
||||
type Extra = ();
|
||||
type ForceOrigin = EnsureRoot<AccountId>;
|
||||
type Freezer = ();
|
||||
type MetadataDepositBase = MetadataDepositBase;
|
||||
type MetadataDepositPerByte = MetadataDepositPerByte;
|
||||
type RemoveItemsLimit = ConstU32<1000>;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type StringLimit = StringLimit;
|
||||
type WeightInfo = pallet_assets::weights::SubstrateWeight<Runtime>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
/// Relay Chain `TransactionByteFee` / 10
|
||||
pub const TransactionByteFee: Balance = 10 * MICROCENTS;
|
||||
@@ -596,6 +631,7 @@ construct_runtime!(
|
||||
// Monetary stuff.
|
||||
Balances: pallet_balances = 10,
|
||||
TransactionPayment: pallet_transaction_payment = 11,
|
||||
Assets: pallet_assets = 12,
|
||||
|
||||
// Governance
|
||||
Sudo: pallet_sudo = 15,
|
||||
@@ -623,6 +659,7 @@ construct_runtime!(
|
||||
mod benches {
|
||||
frame_benchmarking::define_benchmarks!(
|
||||
[frame_system, SystemBench::<Runtime>]
|
||||
[pallet_assets, Assets]
|
||||
[pallet_balances, Balances]
|
||||
[pallet_session, SessionBench::<Runtime>]
|
||||
[pallet_timestamp, Timestamp]
|
||||
|
||||
Reference in New Issue
Block a user