[NFTs] Track item's metadata depositor (#13124)

* Refactor do_mint()

* Track the depositor of item's metadata

* Revert back the access control

* On collection destroy return the metadata deposit

* Clear the metadata on item burn returning the deposit

* Address comments

* Fix clippy

* Don't return Ok on non-existing attribute removal
This commit is contained in:
Jegor Sidorenko
2023-01-11 15:27:59 +02:00
committed by GitHub
parent 643b69c64d
commit 836acb1bd3
8 changed files with 162 additions and 107 deletions
+2 -2
View File
@@ -608,7 +608,7 @@ fn set_item_metadata_should_work() {
);
assert_noop!(
Nfts::clear_metadata(RuntimeOrigin::signed(1), 1, 42),
Error::<Test>::UnknownCollection,
Error::<Test>::MetadataNotFound,
);
assert_ok!(Nfts::clear_metadata(RuntimeOrigin::root(), 0, 42));
assert!(!ItemMetadataOf::<Test>::contains_key(0, 42));
@@ -1267,7 +1267,7 @@ fn burn_works() {
assert_noop!(
Nfts::burn(RuntimeOrigin::signed(5), 0, 42, Some(5)),
Error::<Test>::UnknownCollection
Error::<Test>::UnknownItem
);
assert_ok!(Nfts::force_mint(RuntimeOrigin::signed(2), 0, 42, 5, default_item_config()));