--- a/README.md +++ b/README.md @@ -145,6 +145,7 @@ "Description": "Vec", "TokenPrefix": "Vec", "CustomDataSize": "u32", + "MintMode": "bool", "OffchainSchema": "Vec", "Sponsor": "AccountId", "UnconfirmedSponsor": "AccountId" --- a/pallets/nft/src/lib.rs +++ b/pallets/nft/src/lib.rs @@ -258,11 +258,11 @@ ensure!(prefix.len() <= 16, "Token prefix can not be longer than 15 char"); // Generate next collection ID - let next_id = NextCollectionID::get() + let next_id = CreatedCollectionCount::get() .checked_add(1) .expect("collection id error"); - NextCollectionID::put(next_id); + CreatedCollectionCount::put(next_id); // Create new collection let new_collection = CollectionType { @@ -921,6 +921,12 @@ owner: T::AccountId, new_owner: T::AccountId, ) -> DispatchResult { + + ensure!( + >::contains_key(collection_id, item_id), + "Item not exists" + ); + let full_item = >::get(collection_id, item_id); let amount = full_item.value; @@ -1005,6 +1011,12 @@ owner: T::AccountId, new_owner: T::AccountId, ) -> DispatchResult { + + ensure!( + >::contains_key(collection_id, item_id), + "Item not exists" + ); + let full_item = >::get(collection_id, item_id); let item = full_item .owner @@ -1085,6 +1097,12 @@ sender: T::AccountId, new_owner: T::AccountId, ) -> DispatchResult { + + ensure!( + >::contains_key(collection_id, item_id), + "Item not exists" + ); + let mut item = >::get(collection_id, item_id); ensure!(