Skip to content

Commit

Permalink
Add pallet_uniques to shibuya-runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
Szegoo committed Dec 27, 2023
1 parent 4b31a2e commit d8b6ddf
Show file tree
Hide file tree
Showing 5 changed files with 492 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions runtime/shibuya/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pallet-insecure-randomness-collective-flip = { workspace = true }
pallet-multisig = { workspace = true }
pallet-preimage = { workspace = true }
pallet-proxy = { workspace = true }
pallet-uniques = { workspace = true }
pallet-scheduler = { workspace = true }
pallet-session = { workspace = true }
pallet-sudo = { workspace = true }
Expand Down Expand Up @@ -203,6 +204,7 @@ std = [
"pallet-timestamp/std",
"pallet-vesting/std",
"pallet-proxy/std",
"pallet-uniques/std",
"pallet-democracy/std",
"pallet-collective/std",
"pallet-treasury/std",
Expand Down Expand Up @@ -301,6 +303,7 @@ try-runtime = [
"pallet-insecure-randomness-collective-flip/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-proxy/try-runtime",
"pallet-uniques/try-runtime",
"pallet-contracts/try-runtime",
"pallet-democracy/try-runtime",
"pallet-collective/try-runtime",
Expand Down
38 changes: 36 additions & 2 deletions runtime/shibuya/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
pub const HOURS: BlockNumber = MINUTES * 60;
pub const DAYS: BlockNumber = HOURS * 24;

pub type CollectionId = u128;
pub type ItemId = u128;

impl AddressToAssetId<AssetId> for Runtime {
fn address_to_asset_id(address: H160) -> Option<AssetId> {
let mut data = [0u8; 16];
Expand Down Expand Up @@ -1184,9 +1187,9 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
ProxyType::Balances => {
matches!(c, RuntimeCall::Balances(..))
}
// All Runtime calls from Pallet Assets allowed for proxy account
// All Runtime calls from Pallet Assets and Uniques allowed for proxy account
ProxyType::Assets => {
matches!(c, RuntimeCall::Assets(..))
matches!(c, RuntimeCall::Assets(..) | RuntimeCall::Uniques(..))
}
ProxyType::Governance => {
matches!(
Expand Down Expand Up @@ -1279,6 +1282,35 @@ impl pallet_unified_accounts::Config for Runtime {
type WeightInfo = pallet_unified_accounts::weights::SubstrateWeight<Self>;
}

parameter_types! {
pub const UniquesCollectionDeposit: Balance = 10 * SBY;
pub const UniquesItemDeposit: Balance = 1 * SBY;
pub const UniquesMetadataDepositBase: Balance = deposit(1, 129);
pub const UniquesAttributeDepositBase: Balance = deposit(1, 0);
pub const UniquesDepositPerByte: Balance = deposit(0, 1);
}

impl pallet_uniques::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type CollectionId = CollectionId;
type ItemId = ItemId;
type Currency = Balances;
type ForceOrigin = EnsureRoot<AccountId>;
type CollectionDeposit = UniquesCollectionDeposit;
type ItemDeposit = UniquesItemDeposit;
type MetadataDepositBase = UniquesMetadataDepositBase;
type AttributeDepositBase = UniquesAttributeDepositBase;
type DepositPerByte = UniquesDepositPerByte;
type StringLimit = ConstU32<128>;
type KeyLimit = ConstU32<32>;
type ValueLimit = ConstU32<64>;
type WeightInfo = weights::pallet_uniques::WeightInfo<Runtime>;
#[cfg(feature = "runtime-benchmarks")]
type Helper = ();
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
type Locker = ();
}

construct_runtime!(
pub struct Runtime where
Block = Block,
Expand All @@ -1303,6 +1335,7 @@ construct_runtime!(
DappStaking: pallet_dapp_staking_v3 = 34,
Inflation: pallet_inflation = 35,
Assets: pallet_assets = 36,
Uniques: pallet_uniques = 37,

Authorship: pallet_authorship = 40,
CollatorSelection: pallet_collator_selection = 41,
Expand Down Expand Up @@ -1468,6 +1501,7 @@ mod benches {
[pallet_xvm, Xvm]
[pallet_dynamic_evm_base_fee, DynamicEvmBaseFee]
[pallet_unified_accounts, UnifiedAccounts]
[pallet_uniques, Uniques]
);
}

Expand Down
1 change: 1 addition & 0 deletions runtime/shibuya/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ pub mod pallet_balances;
pub mod pallet_dapp_staking_migration;
pub mod pallet_dapp_staking_v3;
pub mod pallet_inflation;
pub mod pallet_uniques;
pub mod pallet_xcm;
Loading

0 comments on commit d8b6ddf

Please sign in to comment.