diff --git a/pallets/living-assets-ownership/src/functions.rs b/pallets/living-assets-ownership/src/functions.rs index c9c8f39..c456b64 100644 --- a/pallets/living-assets-ownership/src/functions.rs +++ b/pallets/living-assets-ownership/src/functions.rs @@ -20,6 +20,12 @@ impl Pallet { collection_id.checked_add(One::one()).ok_or(Error::::CollectionIdOverflow)?; CollectionCounter::::put(counter); + // Attempt to increment the collection counter by 1. If this operation + // would result in an overflow, return early with an error + let counter = + collection_id.checked_add(One::one()).ok_or(Error::::CollectionIdOverflow)?; + CollectionCounter::::put(counter); + Self::deposit_event(Event::CollectionCreated { collection_id, who }); Ok(collection_id) diff --git a/pallets/living-assets-ownership/src/lib.rs b/pallets/living-assets-ownership/src/lib.rs index c1b64e0..33c356e 100644 --- a/pallets/living-assets-ownership/src/lib.rs +++ b/pallets/living-assets-ownership/src/lib.rs @@ -5,7 +5,7 @@ /// pub use pallet::*; use parity_scale_codec::alloc::string::ToString; -use sp_core::{H160, U256}; +use sp_core::H160; use sp_std::vec::Vec; mod functions; @@ -21,6 +21,7 @@ pub mod pallet { BoundedVec, }; use frame_system::pallet_prelude::*; + use sp_core::{H160, U256}; /// Collection id type pub type CollectionId = u64; diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 20b8804..0e0fb97 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -211,7 +211,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("laos-parachain"), impl_name: create_runtime_str!("laos-parachain"), authoring_version: 1, - spec_version: 4, + spec_version: 5, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1,