Skip to content

Commit 2cb08f7

Browse files
committed
feat: update configuration of pallet-nfts
1 parent 4aab5d7 commit 2cb08f7

1 file changed

Lines changed: 34 additions & 23 deletions

File tree

runtime/peaq-dev/src/lib.rs

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use frame_system::{
1212
limits::{BlockLength, BlockWeights},
1313
EnsureRoot, EnsureRootWithSuccess, EnsureSigned,
1414
};
15-
use sp_runtime::traits;
1615

1716
use address_unification::{CallKillEVMLinkAccount, EVMAddressMapping};
1817
use inflation_manager::types::{InflationConfiguration, InflationParameters};
@@ -36,10 +35,10 @@ use peaq_pallet_rbac::{
3635
};
3736
use peaq_pallet_storage::traits::Storage;
3837
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
39-
use sp_runtime::{self, traits::IdentityLookup};
38+
use sp_runtime::traits::{self, IdentityLookup};
4039

4140
use frame_support::traits::{
42-
tokens::{fungible::HoldConsideration, PayFromAccount, UnityAssetBalanceConversion},
41+
tokens::{fungible::HoldConsideration, Locker, PayFromAccount, UnityAssetBalanceConversion},
4342
EqualPrivilegeOnly, LinearStoragePrice,
4443
};
4544
use smallvec::smallvec;
@@ -1103,41 +1102,53 @@ impl pallet_preimage::Config for Runtime {
11031102

11041103
parameter_types! {
11051104
pub const CollectionDeposit: Balance = 100 * DOLLARS;
1106-
pub const ItemDeposit: Balance = 1 * DOLLARS;
1107-
pub const ApprovalsLimit: u32 = 20;
1108-
pub const ItemAttributesApprovalsLimit: u32 = 20;
1105+
pub const ItemDeposit: Balance = DOLLARS;
1106+
pub const ApprovalsLimit: u32 = 3;
1107+
pub const ItemAttributesApprovalsLimit: u32 = 3;
11091108
pub const MaxTips: u32 = 10;
11101109
pub const MaxDeadlineDuration: BlockNumber = 12 * 30 * DAYS;
11111110
pub const MaxAttributesPerCall: u32 = 10;
11121111
}
11131112

1113+
/// This is an helper struct definition for checking different sources of possible locks on NFTs.
1114+
/// Currently, there is only one source planned to check for possible locks on NFTs, it is
1115+
/// `peaq-pallet-rwa`. All possible sources shall implement `frame_support::traits::tokens::Locker`.
1116+
pub struct NftLockChecker();
1117+
1118+
impl Locker<u128, u128> for NftLockChecker {
1119+
fn is_locked(_collection: u128, _item: u128) -> bool {
1120+
// TODO: Replace default return value by future implementations of `is_locked()`
1121+
false
1122+
}
1123+
}
1124+
11141125
impl pallet_nfts::Config for Runtime {
1115-
type RuntimeEvent = RuntimeEvent;
1116-
type CollectionId = u32;
1117-
type ItemId = u32;
1126+
type ApprovalsLimit = ApprovalsLimit;
1127+
type AttributeDepositBase = MetadataDepositBase;
1128+
type CollectionDeposit = CollectionDeposit;
1129+
type CollectionId = u128;
1130+
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
11181131
type Currency = Balances;
1132+
type DepositPerByte = MetadataDepositPerByte;
1133+
type Features = ();
11191134
type ForceOrigin = frame_system::EnsureRoot<AccountId>;
1120-
type CollectionDeposit = CollectionDeposit;
1135+
#[cfg(feature = "runtime-benchmarks")]
1136+
type Helper = ();
1137+
type ItemAttributesApprovalsLimit = ItemAttributesApprovalsLimit;
11211138
type ItemDeposit = ItemDeposit;
1122-
type MetadataDepositBase = MetadataDepositBase;
1123-
type AttributeDepositBase = MetadataDepositBase;
1124-
type DepositPerByte = MetadataDepositPerByte;
1125-
type StringLimit = ConstU32<256>;
1139+
type ItemId = u128;
11261140
type KeyLimit = ConstU32<64>;
1127-
type ValueLimit = ConstU32<256>;
1128-
type ApprovalsLimit = ApprovalsLimit;
1129-
type ItemAttributesApprovalsLimit = ItemAttributesApprovalsLimit;
1141+
type Locker = NftLockChecker;
11301142
type MaxTips = MaxTips;
11311143
type MaxDeadlineDuration = MaxDeadlineDuration;
11321144
type MaxAttributesPerCall = MaxAttributesPerCall;
1133-
type Features = ();
1134-
type OffchainSignature = Signature;
1145+
type MetadataDepositBase = MetadataDepositBase;
11351146
type OffchainPublic = <Signature as traits::Verify>::Signer;
1147+
type OffchainSignature = Signature;
1148+
type RuntimeEvent = RuntimeEvent;
1149+
type StringLimit = ConstU32<256>;
1150+
type ValueLimit = ConstU32<256>;
11361151
type WeightInfo = pallet_nfts::weights::SubstrateWeight<Runtime>;
1137-
#[cfg(feature = "runtime-benchmarks")]
1138-
type Helper = ();
1139-
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
1140-
type Locker = ();
11411152
}
11421153

11431154
// Create the runtime by composing the FRAME pallets that were previously configured.

0 commit comments

Comments
 (0)