Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
97a7e30
Basics
Sep 21, 2022
a85608f
WIP: change the data format
Sep 23, 2022
6db840a
Refactor
Sep 24, 2022
fa3a2a7
Remove redundant new() method
Sep 24, 2022
472a753
Rename settings
Sep 24, 2022
2611dd4
Enable tests
Sep 24, 2022
52d7d38
Merge branch 'js/uniques-v2-main-branch' into js/uniques-v2-feature-f…
Sep 24, 2022
46a6b7e
Chore
Sep 24, 2022
5ff7048
Change params order
Sep 24, 2022
f7ddfed
Delete the config on collection removal
Sep 24, 2022
d0d1d60
Chore
Sep 24, 2022
7d4b31f
Remove redundant system features
Sep 24, 2022
dd84637
Rename force_item_status to force_collection_status
Sep 24, 2022
4920a0c
Update node runtime
Sep 26, 2022
7456e73
Chore
Sep 26, 2022
9ff45b8
Remove thaw_collection
Sep 26, 2022
c41a48c
Chore
Sep 26, 2022
fee3ade
Connect collection.is_frozen to config
Sep 26, 2022
a9ab6f8
Allow to lock the collection in a new way
Sep 26, 2022
254816d
Move free_holding into settings
Sep 26, 2022
5878197
Connect collection's metadata locker to feature flags
Sep 26, 2022
95e21fb
DRY
Sep 27, 2022
17b7c9e
Chore
Sep 27, 2022
dc6d2f0
Connect pallet level feature flags
Sep 27, 2022
cc64873
Prepare tests for the new changes
Sep 27, 2022
5153080
Implement Item settings
Sep 27, 2022
08a2048
Allow to lock the metadata or attributes of an item
Sep 27, 2022
1551714
Common -> Settings
Sep 27, 2022
8830a4c
Extract settings related code to a separate file
Sep 27, 2022
f8800df
Move feature flag checks inside the do_* methods
Sep 28, 2022
3ccf04e
Split settings.rs into parts
Sep 28, 2022
f83fb73
Extract repeated code into macro
Sep 28, 2022
df97cce
Extract macros into their own file
Sep 28, 2022
3bb6eb5
Chore
Sep 28, 2022
8563a31
Fix traits
Sep 29, 2022
09aca13
Fix traits
Sep 29, 2022
114e519
Test SystemFeatures
Sep 29, 2022
d6536fc
Fix benchmarks
Sep 29, 2022
09a4ed6
Add missing benchmark
Sep 29, 2022
d408b32
Fix node/runtime/lib.rs
Sep 29, 2022
fd86e41
".git/.scripts/bench-bot.sh" pallet dev pallet_nfts
Oct 3, 2022
c002f8b
Keep item's config on burn if it's not empty
Oct 5, 2022
b16435a
Merge branch 'js/uniques-v2-main-branch' into js/uniques-v2-feature-f…
Oct 5, 2022
d0ee824
Fix the merge artifacts
Oct 5, 2022
0eb568e
Fmt
Oct 5, 2022
998691e
Add SystemFeature::NoSwaps check
Oct 6, 2022
b8c6f5e
Rename SystemFeatures to PalletFeatures
Oct 7, 2022
8bef776
Rename errors
Oct 7, 2022
ddaa884
Add docs
Oct 7, 2022
4c01fc5
Change error message
Oct 7, 2022
30d2bde
Change the format of CollectionConfig to store more data
Oct 10, 2022
9449641
Move max supply to the CollectionConfig and allow to change it
Oct 10, 2022
443578d
Remove ItemConfig from the mint() function and use the one set in min…
Oct 11, 2022
0efc4ec
Add different mint options
Oct 11, 2022
2ab076f
Allow to change the mint settings
Oct 11, 2022
ad083ce
Add a force_mint() method
Oct 12, 2022
4ca6f00
Check mint params
Oct 12, 2022
340cb81
Some optimisations
Oct 12, 2022
025cfdd
Cover with tests
Oct 12, 2022
50b617c
Merge branch 'js/uniques-v2-main-branch' into js/uniques-v2-minting-o…
Oct 19, 2022
6b96856
Remove merge artifacts
Oct 19, 2022
45227f5
Chore
Oct 19, 2022
f36d4b9
Merge branch 'js/uniques-v2-main-branch' into js/uniques-v2-minting-o…
Oct 20, 2022
277d1a6
Use the new has_role() method
Oct 20, 2022
9d1d11b
Rework item deposits
Oct 20, 2022
8ffe4fd
More tests
Oct 21, 2022
c7dcdb0
Refactoring
Oct 21, 2022
e1195c5
Merge branch 'js/uniques-v2-main-branch' into js/uniques-v2-minting-o…
Oct 23, 2022
1ab5043
Address comments
Nov 1, 2022
387bf2c
Refactor lock_collection()
Nov 1, 2022
1c51efd
Update frame/nfts/src/types.rs
jsidorenko Nov 8, 2022
9e9b969
Update frame/nfts/src/types.rs
jsidorenko Nov 8, 2022
b82fbe9
Update frame/nfts/src/lib.rs
jsidorenko Nov 8, 2022
e495da6
Update frame/nfts/src/lib.rs
jsidorenko Nov 8, 2022
670bb28
Private => Issuer
Nov 8, 2022
5093b89
Add more tests
Nov 8, 2022
c376b43
Fix benchmarks
Nov 8, 2022
7fe301a
Add benchmarks for new methods
Nov 8, 2022
f246c52
Merge branch 'js/uniques-v2-minting-options_' into js/uniques-v2-mint…
Nov 8, 2022
cfa90dd
Merge branch 'js/uniques-v2-main-branch' into js/uniques-v2-minting-o…
Nov 8, 2022
d667fb7
[Uniques v2] Refactoring (#12570)
jsidorenko Nov 14, 2022
0ef95b7
Merge branch 'js/uniques-v2-main-branch' into js/uniques-v2-minting-o…
Nov 14, 2022
5102020
Smart attributes
Nov 14, 2022
820891c
Split force_collection_status into 2 methods
Nov 15, 2022
51328b0
Fix benchmarks
Nov 15, 2022
c1e71a2
Fix benchmarks
Nov 15, 2022
011db15
Merge branch 'js/uniques-v2-main-branch' into js/uniques-v2-minting-o…
Nov 16, 2022
67d5643
Update deps
Nov 16, 2022
43d84dd
Merge branch 'js/uniques-v2-minting-options' into js/uniques-v2-smart…
Nov 16, 2022
9bdd37d
Fix merge artifact
Nov 16, 2022
83e9221
Weights + benchmarks + docs
Nov 16, 2022
9531c9f
Merge branch 'js/uniques-v2-main-branch' into js/uniques-v2-smart-att…
Nov 16, 2022
255b095
Change params order
Nov 16, 2022
3b1f69d
Chore
Nov 16, 2022
9cad6fb
Update frame/nfts/src/lib.rs
jsidorenko Nov 16, 2022
be11b17
Update frame/nfts/src/lib.rs
jsidorenko Nov 16, 2022
ff3daf0
Update docs
Nov 16, 2022
01075b3
Update frame/nfts/src/lib.rs
jsidorenko Nov 16, 2022
3a5cabf
Add PalletId
Nov 16, 2022
fc5ab54
Chore
Nov 16, 2022
6b5fe82
Add tests
Nov 16, 2022
99249ae
More tests
Nov 16, 2022
7d98c81
Add doc
Nov 17, 2022
f59bdd8
Merge branch 'js/uniques-v2-main-branch' into js/uniques-v2-smart-att…
Nov 17, 2022
fae8421
Update errors snapshots
Nov 17, 2022
6737024
Ensure we track the owner_deposit field correctly
Nov 18, 2022
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
2 changes: 2 additions & 0 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,7 @@ parameter_types! {
pub const KeyLimit: u32 = 32;
pub const ValueLimit: u32 = 256;
pub const ApprovalsLimit: u32 = 20;
pub const ItemAttributesApprovalsLimit: u32 = 20;
pub const MaxTips: u32 = 10;
pub const MaxDeadlineDuration: BlockNumber = 12 * 30 * DAYS;
}
Expand Down Expand Up @@ -1535,6 +1536,7 @@ impl pallet_nfts::Config for Runtime {
type KeyLimit = KeyLimit;
type ValueLimit = ValueLimit;
type ApprovalsLimit = ApprovalsLimit;
type ItemAttributesApprovalsLimit = ItemAttributesApprovalsLimit;
type MaxTips = MaxTips;
type MaxDeadlineDuration = MaxDeadlineDuration;
type Features = Features;
Expand Down
106 changes: 101 additions & 5 deletions frame/nfts/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ fn add_item_attribute<T: Config<I>, I: 'static>(
SystemOrigin::Signed(caller.clone()).into(),
T::Helper::collection(0),
Some(item),
AttributeNamespace::CollectionOwner,
key.clone(),
vec![0; T::ValueLimit::get() as usize].try_into().unwrap(),
));
Expand Down Expand Up @@ -338,20 +339,115 @@ benchmarks_instance_pallet! {

let (collection, caller, _) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
add_item_metadata::<T, I>(item);
}: _(SystemOrigin::Signed(caller), collection, Some(item), key.clone(), value.clone())
}: _(SystemOrigin::Signed(caller), collection, Some(item), AttributeNamespace::CollectionOwner, key.clone(), value.clone())
verify {
assert_last_event::<T, I>(
Event::AttributeSet {
collection,
maybe_item: Some(item),
namespace: AttributeNamespace::CollectionOwner,
key,
value,
}
.into(),
);
}

force_set_attribute {
let key: BoundedVec<_, _> = vec![0u8; T::KeyLimit::get() as usize].try_into().unwrap();
let value: BoundedVec<_, _> = vec![0u8; T::ValueLimit::get() as usize].try_into().unwrap();

let (collection, caller, _) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
}: _(SystemOrigin::Root, Some(caller), collection, Some(item), AttributeNamespace::CollectionOwner, key.clone(), value.clone())
verify {
assert_last_event::<T, I>(Event::AttributeSet { collection, maybe_item: Some(item), key, value }.into());
assert_last_event::<T, I>(
Event::AttributeSet {
collection,
maybe_item: Some(item),
namespace: AttributeNamespace::CollectionOwner,
key,
value,
}
.into(),
);
}

clear_attribute {
let (collection, caller, _) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
add_item_metadata::<T, I>(item);
let (key, ..) = add_item_attribute::<T, I>(item);
}: _(SystemOrigin::Signed(caller), collection, Some(item), key.clone())
}: _(SystemOrigin::Signed(caller), collection, Some(item), AttributeNamespace::CollectionOwner, key.clone())
verify {
assert_last_event::<T, I>(
Event::AttributeCleared {
collection,
maybe_item: Some(item),
namespace: AttributeNamespace::CollectionOwner,
key,
}.into(),
);
}

approve_item_attributes {
let (collection, caller, _) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
let target: T::AccountId = account("target", 0, SEED);
let target_lookup = T::Lookup::unlookup(target.clone());
}: _(SystemOrigin::Signed(caller), collection, item, target_lookup)
verify {
assert_last_event::<T, I>(Event::AttributeCleared { collection, maybe_item: Some(item), key }.into());
assert_last_event::<T, I>(
Event::ItemAttributesApprovalAdded {
collection,
item,
delegate: target,
}
.into(),
);
}

cancel_item_attributes_approval {
let n in 0 .. 1_000;

let (collection, caller, _) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
let target: T::AccountId = account("target", 0, SEED);
let target_lookup = T::Lookup::unlookup(target.clone());
Nfts::<T, I>::approve_item_attributes(
SystemOrigin::Signed(caller.clone()).into(),
collection,
item,
target_lookup.clone(),
)?;
T::Currency::make_free_balance_be(&target, DepositBalanceOf::<T, I>::max_value());
let value: BoundedVec<_, _> = vec![0u8; T::ValueLimit::get() as usize].try_into().unwrap();
for i in 0..n {
let mut key = vec![0u8; T::KeyLimit::get() as usize];
let mut s = Vec::from((i as u16).to_be_bytes());
key.truncate(s.len());
key.append(&mut s);

Nfts::<T, I>::set_attribute(
SystemOrigin::Signed(target.clone()).into(),
T::Helper::collection(0),
Some(item),
AttributeNamespace::Account(target.clone()),
key.try_into().unwrap(),
value.clone(),
)?;
}
let witness = CancelAttributesApprovalWitness { account_attributes: n };
}: _(SystemOrigin::Signed(caller), collection, item, target_lookup, witness)
verify {
assert_last_event::<T, I>(
Event::ItemAttributesApprovalRemoved {
collection,
item,
delegate: target,
}
.into(),
);
}

set_metadata {
Expand Down
Loading