difftreelog
Create collection method fixed
in: master
2 files changed
README.mddiffbeforeafterboth145 "Description": "Vec<u16>",145 "Description": "Vec<u16>",146 "TokenPrefix": "Vec<u8>",146 "TokenPrefix": "Vec<u8>",147 "CustomDataSize": "u32",147 "CustomDataSize": "u32",148 "MintMode": "bool",148 "OffchainSchema": "Vec<u8>",149 "OffchainSchema": "Vec<u8>",149 "Sponsor": "AccountId",150 "Sponsor": "AccountId",150 "UnconfirmedSponsor": "AccountId"151 "UnconfirmedSponsor": "AccountId"pallets/nft/src/lib.rsdiffbeforeafterboth--- 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!(
+ <FungibleItemList<T>>::contains_key(collection_id, item_id),
+ "Item not exists"
+ );
+
let full_item = <FungibleItemList<T>>::get(collection_id, item_id);
let amount = full_item.value;
@@ -1005,6 +1011,12 @@
owner: T::AccountId,
new_owner: T::AccountId,
) -> DispatchResult {
+
+ ensure!(
+ <ReFungibleItemList<T>>::contains_key(collection_id, item_id),
+ "Item not exists"
+ );
+
let full_item = <ReFungibleItemList<T>>::get(collection_id, item_id);
let item = full_item
.owner
@@ -1085,6 +1097,12 @@
sender: T::AccountId,
new_owner: T::AccountId,
) -> DispatchResult {
+
+ ensure!(
+ <NftItemList<T>>::contains_key(collection_id, item_id),
+ "Item not exists"
+ );
+
let mut item = <NftItemList<T>>::get(collection_id, item_id);
ensure!(