Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions pallets/api/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ type NftsInstance = pallet_nfts::Instance1;
impl pallet_nfts::Config<NftsInstance> for Test {
type ApprovalsLimit = ConstU32<10>;
type AttributeDepositBase = ConstU128<1>;
type BlockNumberProvider = frame_system::Pallet<Test>;
type CollectionApprovalDeposit = ConstU128<1>;
type CollectionBalanceDeposit = ConstU128<1>;
type CollectionDeposit = ConstU128<2>;
Expand Down
4 changes: 2 additions & 2 deletions pallets/api/src/nonfungibles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
dispatch::WithPostDispatchInfo,
traits::{nonfungibles_v2::Inspect, Currency},
};
use frame_system::pallet_prelude::BlockNumberFor;
pub use pallet::*;
use pallet_nfts::WeightInfo as NftsWeightInfoTrait;
pub use pallet_nfts::{
Expand All @@ -26,6 +25,7 @@
/// Weights for non-fungibles dispatchables.
pub mod weights;

type BlockNumberFor<T> = pallet_nfts::BlockNumberFor<T, NftsInstanceOf<T>>;
type AccountBalanceOf<T> = pallet_nfts::AccountBalance<T, NftsInstanceOf<T>>;
type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;
type AccountIdOf<T> = <T as frame_system::Config>::AccountId;
Expand Down Expand Up @@ -55,7 +55,7 @@
pallet_prelude::*,
traits::Incrementable,
};
use frame_system::pallet_prelude::*;
use frame_system::{ensure_signed, pallet_prelude::OriginFor};
use sp_runtime::BoundedVec;

use super::*;
Expand Down Expand Up @@ -149,7 +149,7 @@
.max(NftsWeightInfoOf::<T>::cancel_approval())
.max(NftsWeightInfoOf::<T>::cancel_collection_approval()))
]
pub fn approve(

Check warning on line 152 in pallets/api/src/nonfungibles/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

useless conversion to the same type: `frame_support::dispatch::PostDispatchInfo`

warning: useless conversion to the same type: `frame_support::dispatch::PostDispatchInfo` --> pallets/api/src/nonfungibles/mod.rs:152:17 | 152 | pub fn approve( | ^ help: consider removing | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

Check warning on line 152 in pallets/api/src/nonfungibles/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

useless conversion to the same type: `sp_runtime::DispatchErrorWithPostInfo<frame_support::dispatch::PostDispatchInfo>`

warning: useless conversion to the same type: `sp_runtime::DispatchErrorWithPostInfo<frame_support::dispatch::PostDispatchInfo>` --> pallets/api/src/nonfungibles/mod.rs:152:17 | 152 | pub fn approve( | ^ help: consider removing | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
origin: OriginFor<T>,
collection: CollectionIdOf<T>,
operator: AccountIdOf<T>,
Expand Down Expand Up @@ -230,7 +230,7 @@
witness.item_configs,
witness.attributes,
))]
pub fn destroy(

Check warning on line 233 in pallets/api/src/nonfungibles/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

useless conversion to the same type: `frame_support::dispatch::PostDispatchInfo`

warning: useless conversion to the same type: `frame_support::dispatch::PostDispatchInfo` --> pallets/api/src/nonfungibles/mod.rs:233:17 | 233 | pub fn destroy( | ^ help: consider removing | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
origin: OriginFor<T>,
collection: CollectionIdOf<T>,
witness: DestroyWitness,
Expand Down Expand Up @@ -425,7 +425,7 @@
/// - `limit` - The number of collection approvals that will be cleared.
#[pallet::call_index(19)]
#[pallet::weight(NftsWeightInfoOf::<T>::clear_collection_approvals(*limit))]
pub fn clear_collection_approvals(

Check warning on line 428 in pallets/api/src/nonfungibles/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

useless conversion to the same type: `frame_support::dispatch::PostDispatchInfo`

warning: useless conversion to the same type: `frame_support::dispatch::PostDispatchInfo` --> pallets/api/src/nonfungibles/mod.rs:428:36 | 428 | pub fn clear_collection_approvals( | ^ help: consider removing | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

Check warning on line 428 in pallets/api/src/nonfungibles/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

useless conversion to the same type: `sp_runtime::DispatchErrorWithPostInfo<frame_support::dispatch::PostDispatchInfo>`

warning: useless conversion to the same type: `sp_runtime::DispatchErrorWithPostInfo<frame_support::dispatch::PostDispatchInfo>` --> pallets/api/src/nonfungibles/mod.rs:428:36 | 428 | pub fn clear_collection_approvals( | ^ help: consider removing | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
origin: OriginFor<T>,
collection: CollectionIdOf<T>,
limit: u32,
Expand Down
20 changes: 11 additions & 9 deletions pallets/api/src/nonfungibles/weights.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@

//! Autogenerated weights for `nonfungibles`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 45.0.0
//! DATE: 2025-01-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 47.0.0
//! DATE: 2025-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `R0GUE`, CPU: `<UNKNOWN>`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("pop-devnet-dev")`, DB CACHE: `1024`

// Executed Command:
// ./target/production/pop-node
// benchmark
// pallet
// --chain=dev
// --wasm-execution=compiled
// --pallet=nonfungibles
// --chain=pop-devnet-dev
// --steps=50
// --repeat=20
// --json
// --template
// ./scripts/pallet-weights-template.hbs
// --pallet=nonfungibles
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./pallets/api/src/nonfungibles/weights.rs
// --template=./scripts/templates/pallet-weight-template.hbs
// --extrinsic=

#![cfg_attr(rustfmt, rustfmt_skip)]
Expand Down
2 changes: 1 addition & 1 deletion pallets/nfts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license.workspace = true
name = "pallet-nfts"
readme = "README.md"
repository.workspace = true
version = "31.0.0"
version = "34.1.0"

[package.metadata.docs.rs]
targets = [ "x86_64-unknown-linux-gnu" ]
Expand Down
3 changes: 1 addition & 2 deletions pallets/nfts/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ targets = [ "x86_64-unknown-linux-gnu" ]

[dependencies]
codec = { features = [ "derive" ], workspace = true }
pallet-nfts.workspace = true
sp-api.workspace = true

[features]
default = [ "std" ]
std = [ "codec/std", "pallet-nfts/std", "sp-api/std" ]
std = [ "codec/std", "sp-api/std" ]
36 changes: 18 additions & 18 deletions pallets/nfts/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ use frame_support::{
traits::{EnsureOrigin, Get, UnfilteredDispatchable},
BoundedVec,
};
use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin as SystemOrigin};
use sp_runtime::traits::{Bounded, One};
use frame_system::RawOrigin as SystemOrigin;
use sp_runtime::traits::{Bounded, One, Zero};

use super::*;
use crate::Pallet as Nfts;
Expand Down Expand Up @@ -579,7 +579,7 @@ benchmarks_instance_pallet! {
let (item, ..) = mint_item::<T, I>(0);
let delegate: T::AccountId = account("delegate", 0, SEED);
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
let deadline = BlockNumberFor::<T>::max_value();
let deadline = BlockNumberFor::<T, I>::max_value();
}: _(SystemOrigin::Signed(caller.clone()), collection, item, delegate_lookup, Some(deadline))
verify {
assert_last_event::<T, I>(Event::TransferApproved { collection, item: Some(item), owner: caller, delegate, deadline: Some(deadline) }.into());
Expand All @@ -591,7 +591,7 @@ benchmarks_instance_pallet! {
let delegate: T::AccountId = account("delegate", 0, SEED);
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
let origin = SystemOrigin::Signed(caller.clone()).into();
let deadline = BlockNumberFor::<T>::max_value();
let deadline = BlockNumberFor::<T, I>::max_value();
Nfts::<T, I>::approve_transfer(origin, collection, item, delegate_lookup.clone(), Some(deadline))?;
}: _(SystemOrigin::Signed(caller.clone()), collection, item, delegate_lookup)
verify {
Expand All @@ -604,7 +604,7 @@ benchmarks_instance_pallet! {
let delegate: T::AccountId = account("delegate", 0, SEED);
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
let origin = SystemOrigin::Signed(caller.clone()).into();
let deadline = BlockNumberFor::<T>::max_value();
let deadline = BlockNumberFor::<T, I>::max_value();
Nfts::<T, I>::approve_transfer(origin, collection, item, delegate_lookup.clone(), Some(deadline))?;
}: _(SystemOrigin::Signed(caller.clone()), collection, item)
verify {
Expand Down Expand Up @@ -714,10 +714,10 @@ benchmarks_instance_pallet! {
let price_direction = PriceDirection::Receive;
let price_with_direction = PriceWithDirection { amount: price, direction: price_direction };
let duration = T::MaxDeadlineDuration::get();
frame_system::Pallet::<T>::set_block_number(One::one());
T::BlockNumberProvider::set_block_number(One::one());
}: _(SystemOrigin::Signed(caller.clone()), collection, item1, collection, Some(item2), Some(price_with_direction.clone()), duration)
verify {
let current_block = frame_system::Pallet::<T>::block_number();
let current_block = T::BlockNumberProvider::current_block_number();
assert_last_event::<T, I>(Event::SwapCreated {
offered_collection: collection,
offered_item: item1,
Expand All @@ -737,7 +737,7 @@ benchmarks_instance_pallet! {
let duration = T::MaxDeadlineDuration::get();
let price_direction = PriceDirection::Receive;
let price_with_direction = PriceWithDirection { amount: price, direction: price_direction };
frame_system::Pallet::<T>::set_block_number(One::one());
T::BlockNumberProvider::set_block_number(One::one());
Nfts::<T, I>::create_swap(origin, collection, item1, collection, Some(item2), Some(price_with_direction.clone()), duration)?;
}: _(SystemOrigin::Signed(caller.clone()), collection, item1)
verify {
Expand All @@ -763,7 +763,7 @@ benchmarks_instance_pallet! {
let target_lookup = T::Lookup::unlookup(target.clone());
T::Currency::make_free_balance_be(&target, T::Currency::minimum_balance() + T::CollectionBalanceDeposit::get());
let origin = SystemOrigin::Signed(caller.clone());
frame_system::Pallet::<T>::set_block_number(One::one());
T::BlockNumberProvider::set_block_number(One::one());
Nfts::<T, I>::transfer(origin.clone().into(), collection, item2, target_lookup)?;
Nfts::<T, I>::create_swap(
origin.clone().into(),
Expand All @@ -776,7 +776,7 @@ benchmarks_instance_pallet! {
)?;
}: _(SystemOrigin::Signed(target.clone()), collection, item2, collection, item1, Some(price_with_direction.clone()))
verify {
let current_block = frame_system::Pallet::<T>::block_number();
let currnet_block = T::BlockNumberProvider::current_block_number();
assert_last_event::<T, I>(Event::SwapClaimed {
sent_collection: collection,
sent_item: item2,
Expand Down Expand Up @@ -824,7 +824,7 @@ benchmarks_instance_pallet! {

let target: T::AccountId = account("target", 0, SEED);
T::Currency::make_free_balance_be(&target, DepositBalanceOf::<T, I>::max_value());
frame_system::Pallet::<T>::set_block_number(One::one());
T::BlockNumberProvider::set_block_number(One::one());
}: _(SystemOrigin::Signed(target.clone()), Box::new(mint_data), signature, caller)
verify {
let metadata: BoundedVec<_, _> = metadata.try_into().unwrap();
Expand Down Expand Up @@ -867,7 +867,7 @@ benchmarks_instance_pallet! {
let message = Encode::encode(&pre_signed_data);
let signature = T::Helper::sign(&signer_public, &message);

frame_system::Pallet::<T>::set_block_number(One::one());
T::BlockNumberProvider::set_block_number(One::one());
}: _(SystemOrigin::Signed(item_owner.clone()), pre_signed_data, signature, signer.clone())
verify {
assert_last_event::<T, I>(
Expand All @@ -885,7 +885,7 @@ benchmarks_instance_pallet! {
mint_item::<T, I>(0);
let delegate: T::AccountId = account("delegate", 0, SEED);
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
let deadline = BlockNumberFor::<T>::max_value();
let deadline = BlockNumberFor::<T, I>::max_value();
}: _(SystemOrigin::Signed(caller.clone()), collection, delegate_lookup, Some(deadline))
verify {
assert_last_event::<T, I>(Event::TransferApproved { collection, item: None, owner: caller, delegate, deadline: Some(deadline) }.into());
Expand All @@ -896,7 +896,7 @@ benchmarks_instance_pallet! {
mint_item::<T, I>(0);
let delegate: T::AccountId = account("delegate", 0, SEED);
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
let deadline = BlockNumberFor::<T>::max_value();
let deadline = BlockNumberFor::<T, I>::max_value();
}: _(SystemOrigin::Root, caller_lookup, collection, delegate_lookup, Some(deadline))
verify {
assert_last_event::<T, I>(Event::TransferApproved { collection, item: None, owner: caller, delegate, deadline: Some(deadline) }.into());
Expand All @@ -908,7 +908,7 @@ benchmarks_instance_pallet! {
let delegate: T::AccountId = account("delegate", 0, SEED);
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
let origin = SystemOrigin::Signed(caller.clone()).into();
let deadline = BlockNumberFor::<T>::max_value();
let deadline = BlockNumberFor::<T, I>::max_value();
Nfts::<T, I>::approve_collection_transfer(origin, collection, delegate_lookup.clone(), Some(deadline))?;
}: _(SystemOrigin::Signed(caller.clone()), collection, delegate_lookup)
verify {
Expand All @@ -920,7 +920,7 @@ benchmarks_instance_pallet! {
mint_item::<T, I>(0);
let delegate: T::AccountId = account("delegate", 0, SEED);
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
let deadline = BlockNumberFor::<T>::max_value();
let deadline = BlockNumberFor::<T, I>::max_value();
Nfts::<T, I>::approve_collection_transfer(SystemOrigin::Signed(caller.clone()).into(), collection, delegate_lookup.clone(), Some(deadline))?;
}: _(SystemOrigin::Root, caller_lookup, collection, delegate_lookup)
verify {
Expand All @@ -937,7 +937,7 @@ benchmarks_instance_pallet! {
SystemOrigin::Signed(caller.clone()).into(),
collection,
T::Lookup::unlookup(delegate),
Some(BlockNumberFor::<T>::max_value()),
Some(BlockNumberFor::<T, I>::max_value()),
)?;
}
}: _(SystemOrigin::Signed(caller.clone()), collection, n)
Expand All @@ -956,7 +956,7 @@ benchmarks_instance_pallet! {
SystemOrigin::Signed(caller.clone()).into(),
collection,
T::Lookup::unlookup(delegate),
Some(BlockNumberFor::<T>::max_value()),
Some(BlockNumberFor::<T, I>::max_value()),
)?;
}
}: _(SystemOrigin::Root, caller_lookup, collection, n)
Expand Down
Loading
Loading