difftreelog
Add first draft of Properties
in: master
14 files changed
pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -18,7 +18,7 @@
use core::ops::{Deref, DerefMut};
use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
-use sp_std::vec::Vec;
+use sp_std::{vec::Vec, collections::btree_map::BTreeMap};
use pallet_evm::account::CrossAccountId;
use frame_support::{
dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, Weight, PostDispatchInfo},
@@ -35,7 +35,8 @@
FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MAX_SPONSOR_TIMEOUT,
CUSTOM_DATA_LIMIT, CollectionLimits, CustomDataLimit, CreateCollectionData, SponsorshipState,
CreateItemExData, SponsoringRateLimit, budget::Budget, COLLECTION_FIELD_LIMIT, CollectionField,
- PhantomType,
+ PhantomType, Property, Properties, PropertiesPermissionMap, PropertyKey, PropertyPermission,
+ PropertiesError,
};
pub use pallet::*;
use sp_core::H160;
@@ -288,6 +289,10 @@
T::CrossAccountId,
u128,
),
+
+ CollectionPropertySet(CollectionId, Property),
+
+ TokenPropertySet(CollectionId, TokenId, Property),
}
#[pallet::error]
@@ -319,7 +324,6 @@
CollectionLimitBoundsExceeded,
/// Tried to enable permissions which are only permitted to be disabled
OwnerPermissionsCantBeReverted,
-
/// Collection settings not allowing items transferring
TransferNotAllowed,
/// Account token limit exceeded per collection
@@ -372,6 +376,25 @@
QueryKind = OptionQuery,
>;
+ /// Collection properties
+ #[pallet::storage]
+ pub type CollectionProperties<T> = StorageMap<
+ Hasher = Blake2_128Concat,
+ Key = CollectionId,
+ Value = Properties,
+ QueryKind = ValueQuery,
+ OnEmpty = up_data_structs::CollectionProperties,
+ >;
+
+ #[pallet::storage]
+ #[pallet::getter(fn property_permission)]
+ pub type CollectionPropertyPermissions<T> = StorageMap<
+ Hasher = Blake2_128Concat,
+ Key = CollectionId,
+ Value = PropertiesPermissionMap,
+ QueryKind = ValueQuery,
+ >;
+
/// Large variable-size collection fields are extracted here
#[pallet::storage]
pub type CollectionData<T> = StorageNMap<
@@ -538,6 +561,7 @@
sponsorship,
limits,
meta_update_permission,
+ ..
} = <CollectionById<T>>::get(collection)?;
Some(RpcCollection {
name: name.into_inner(),
@@ -615,8 +639,25 @@
.map(|limits| Self::clamp_limits(data.mode.clone(), &Default::default(), limits))
.unwrap_or_else(|| Ok(CollectionLimits::default()))?,
meta_update_permission: data.meta_update_permission.unwrap_or_default(),
+ // token_property_permissions: data.token_property_permissions.unwrap_or_default(),
+ // properties: Properties::from_collection_props_vec(data.properties)?
};
+ CollectionProperties::<T>::insert(
+ id,
+ Properties::from_collection_props_vec(data.properties)?,
+ );
+
+ let token_props_permissions: PropertiesPermissionMap = data
+ .token_property_permissions
+ .into_iter()
+ .map(|property| (property.key, property.permission))
+ .collect::<BTreeMap<_, _>>()
+ .try_into()
+ .map_err(|_| PropertiesError::PropertyLimitReached)?;
+
+ CollectionPropertyPermissions::<T>::insert(id, token_props_permissions);
+
// Take a (non-refundable) deposit of collection creation
{
let mut imbalance =
@@ -688,6 +729,34 @@
Ok(())
}
+ pub fn change_collection_property(
+ collection: &CollectionHandle<T>,
+ sender: &T::CrossAccountId,
+ property: Property,
+ ) -> DispatchResult {
+ collection.check_is_owner_or_admin(sender)?;
+
+ CollectionProperties::<T>::get(collection.id).try_change_property(property)?;
+
+ Ok(())
+ }
+
+ pub fn change_property_permission(
+ collection: &CollectionHandle<T>,
+ sender: &T::CrossAccountId,
+ property_key: PropertyKey,
+ permission: PropertyPermission,
+ ) -> DispatchResult {
+ collection.check_is_owner_or_admin(sender)?;
+
+ CollectionPropertyPermissions::<T>::try_mutate(collection.id, |permissions| {
+ permissions.try_insert(property_key, permission)
+ })
+ .map_err(|_| PropertiesError::PropertyLimitReached)?;
+
+ Ok(())
+ }
+
fn set_field_raw(
collection_id: CollectionId,
field: CollectionField,
@@ -840,6 +909,7 @@
fn create_multiple_items(amount: u32) -> Weight;
fn create_multiple_items_ex(cost: &CreateItemExData<CrossAccountId>) -> Weight;
fn burn_item() -> Weight;
+ fn set_property() -> Weight;
fn transfer() -> Weight;
fn approve() -> Weight;
fn transfer_from() -> Weight;
@@ -875,6 +945,19 @@
amount: u128,
) -> DispatchResultWithPostInfo;
+ fn change_collection_property(
+ &self,
+ sender: T::CrossAccountId,
+ property: Property,
+ ) -> DispatchResultWithPostInfo;
+
+ fn change_token_property(
+ &self,
+ sender: T::CrossAccountId,
+ token_id: TokenId,
+ property: Property,
+ ) -> DispatchResultWithPostInfo;
+
fn transfer(
&self,
sender: T::CrossAccountId,
pallets/fungible/src/common.rsdiffbeforeafterboth--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -21,7 +21,7 @@
use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};
use sp_runtime::ArithmeticError;
use sp_std::{vec::Vec, vec};
-use up_data_structs::CustomDataLimit;
+use up_data_structs::{CustomDataLimit, Property};
use crate::{
Allowance, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf, weights::WeightInfo,
@@ -50,6 +50,10 @@
<SelfWeightOf<T>>::burn_item()
}
+ fn set_property() -> Weight {
+ <SelfWeightOf<T>>::set_property()
+ }
+
fn transfer() -> Weight {
<SelfWeightOf<T>>::transfer()
}
@@ -225,6 +229,23 @@
)
}
+ fn change_collection_property(
+ &self,
+ _sender: T::CrossAccountId,
+ _property: Property,
+ ) -> DispatchResultWithPostInfo {
+ fail!(<Error<T>>::PropertiesNotAllowed)
+ }
+
+ fn change_token_property(
+ &self,
+ _sender: T::CrossAccountId,
+ _token_id: TokenId,
+ _property: Property,
+ ) -> DispatchResultWithPostInfo {
+ fail!(<Error<T>>::PropertiesNotAllowed)
+ }
+
fn set_variable_metadata(
&self,
_sender: T::CrossAccountId,
pallets/fungible/src/lib.rsdiffbeforeafterboth--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -61,6 +61,8 @@
FungibleItemsDontHaveData,
/// Fungible token does not support nested
FungibleDisallowsNesting,
+ /// Item properties are not allowed
+ PropertiesNotAllowed,
}
#[pallet::config]
pallets/fungible/src/weights.rsdiffbeforeafterboth--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -35,6 +35,7 @@
fn create_item() -> Weight;
fn create_multiple_items_ex(b: u32, ) -> Weight;
fn burn_item() -> Weight;
+ fn set_property() -> Weight;
fn transfer() -> Weight;
fn approve() -> Weight;
fn transfer_from() -> Weight;
@@ -69,6 +70,12 @@
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
+
+ fn set_property() -> Weight {
+ // Error
+ 0
+ }
+
// Storage: Fungible Balance (r:2 w:2)
fn transfer() -> Weight {
(17_713_000 as Weight)
@@ -126,6 +133,12 @@
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
+
+ fn set_property() -> Weight {
+ // Error
+ 0
+ }
+
// Storage: Fungible Balance (r:2 w:2)
fn transfer() -> Weight {
(17_713_000 as Weight)
pallets/nonfungible/src/common.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use core::marker::PhantomData;1819use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, BoundedVec};20use up_data_structs::{TokenId, CustomDataLimit, CreateItemExData, CollectionId, budget::Budget};21use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};22use sp_runtime::DispatchError;23use sp_std::vec::Vec;2425use crate::{26 AccountBalance, Allowance, Config, CreateItemData, Error, NonfungibleHandle, Owned, Pallet,27 SelfWeightOf, TokenData, weights::WeightInfo, TokensMinted,28};2930pub struct CommonWeights<T: Config>(PhantomData<T>);31impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {32 fn create_item() -> Weight {33 <SelfWeightOf<T>>::create_item()34 }3536 fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {37 match data {38 CreateItemExData::NFT(t) => <SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32),39 _ => 0,40 }41 }4243 fn create_multiple_items(amount: u32) -> Weight {44 <SelfWeightOf<T>>::create_multiple_items(amount)45 }4647 fn burn_item() -> Weight {48 <SelfWeightOf<T>>::burn_item()49 }5051 fn transfer() -> Weight {52 <SelfWeightOf<T>>::transfer()53 }5455 fn approve() -> Weight {56 <SelfWeightOf<T>>::approve()57 }5859 fn transfer_from() -> Weight {60 <SelfWeightOf<T>>::transfer_from()61 }6263 fn burn_from() -> Weight {64 <SelfWeightOf<T>>::burn_from()65 }6667 fn set_variable_metadata(bytes: u32) -> Weight {68 <SelfWeightOf<T>>::set_variable_metadata(bytes)69 }70}7172fn map_create_data<T: Config>(73 data: up_data_structs::CreateItemData,74 to: &T::CrossAccountId,75) -> Result<CreateItemData<T>, DispatchError> {76 match data {77 up_data_structs::CreateItemData::NFT(data) => Ok(CreateItemData::<T> {78 const_data: data.const_data,79 variable_data: data.variable_data,80 owner: to.clone(),81 }),82 _ => fail!(<Error<T>>::NotNonfungibleDataUsedToMintFungibleCollectionToken),83 }84}8586impl<T: Config> CommonCollectionOperations<T> for NonfungibleHandle<T> {87 fn create_item(88 &self,89 sender: T::CrossAccountId,90 to: T::CrossAccountId,91 data: up_data_structs::CreateItemData,92 nesting_budget: &dyn Budget,93 ) -> DispatchResultWithPostInfo {94 with_weight(95 <Pallet<T>>::create_item(96 self,97 &sender,98 map_create_data::<T>(data, &to)?,99 nesting_budget,100 ),101 <CommonWeights<T>>::create_item(),102 )103 }104105 fn create_multiple_items(106 &self,107 sender: T::CrossAccountId,108 to: T::CrossAccountId,109 data: Vec<up_data_structs::CreateItemData>,110 nesting_budget: &dyn Budget,111 ) -> DispatchResultWithPostInfo {112 let data = data113 .into_iter()114 .map(|d| map_create_data::<T>(d, &to))115 .collect::<Result<Vec<_>, DispatchError>>()?;116117 let amount = data.len();118 with_weight(119 <Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),120 <CommonWeights<T>>::create_multiple_items(amount as u32),121 )122 }123124 fn create_multiple_items_ex(125 &self,126 sender: <T>::CrossAccountId,127 data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,128 nesting_budget: &dyn Budget,129 ) -> DispatchResultWithPostInfo {130 let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);131 let data = match data {132 up_data_structs::CreateItemExData::NFT(nft) => nft,133 _ => fail!(Error::<T>::NotNonfungibleDataUsedToMintFungibleCollectionToken),134 };135136 with_weight(137 <Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),138 weight,139 )140 }141142 fn burn_item(143 &self,144 sender: T::CrossAccountId,145 token: TokenId,146 amount: u128,147 ) -> DispatchResultWithPostInfo {148 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);149 if amount == 1 {150 with_weight(151 <Pallet<T>>::burn(self, &sender, token),152 <CommonWeights<T>>::burn_item(),153 )154 } else {155 Ok(().into())156 }157 }158159 fn transfer(160 &self,161 from: T::CrossAccountId,162 to: T::CrossAccountId,163 token: TokenId,164 amount: u128,165 nesting_budget: &dyn Budget,166 ) -> DispatchResultWithPostInfo {167 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);168 if amount == 1 {169 with_weight(170 <Pallet<T>>::transfer(self, &from, &to, token, nesting_budget),171 <CommonWeights<T>>::transfer(),172 )173 } else {174 Ok(().into())175 }176 }177178 fn approve(179 &self,180 sender: T::CrossAccountId,181 spender: T::CrossAccountId,182 token: TokenId,183 amount: u128,184 ) -> DispatchResultWithPostInfo {185 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);186187 with_weight(188 if amount == 1 {189 <Pallet<T>>::set_allowance(self, &sender, token, Some(&spender))190 } else {191 <Pallet<T>>::set_allowance(self, &sender, token, None)192 },193 <CommonWeights<T>>::approve(),194 )195 }196197 fn transfer_from(198 &self,199 sender: T::CrossAccountId,200 from: T::CrossAccountId,201 to: T::CrossAccountId,202 token: TokenId,203 amount: u128,204 nesting_budget: &dyn Budget,205 ) -> DispatchResultWithPostInfo {206 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);207208 if amount == 1 {209 with_weight(210 <Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget),211 <CommonWeights<T>>::transfer_from(),212 )213 } else {214 Ok(().into())215 }216 }217218 fn burn_from(219 &self,220 sender: T::CrossAccountId,221 from: T::CrossAccountId,222 token: TokenId,223 amount: u128,224 nesting_budget: &dyn Budget,225 ) -> DispatchResultWithPostInfo {226 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);227228 if amount == 1 {229 with_weight(230 <Pallet<T>>::burn_from(self, &sender, &from, token, nesting_budget),231 <CommonWeights<T>>::burn_from(),232 )233 } else {234 Ok(().into())235 }236 }237238 fn set_variable_metadata(239 &self,240 sender: T::CrossAccountId,241 token: TokenId,242 data: BoundedVec<u8, CustomDataLimit>,243 ) -> DispatchResultWithPostInfo {244 let len = data.len();245 with_weight(246 <Pallet<T>>::set_variable_metadata(self, &sender, token, data),247 <CommonWeights<T>>::set_variable_metadata(len as u32),248 )249 }250251 fn check_nesting(252 &self,253 sender: T::CrossAccountId,254 from: (CollectionId, TokenId),255 under: TokenId,256 budget: &dyn Budget,257 ) -> sp_runtime::DispatchResult {258 <Pallet<T>>::check_nesting(self, sender, from, under, budget)259 }260261 fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {262 <Owned<T>>::iter_prefix((self.id, account))263 .map(|(id, _)| id)264 .collect()265 }266267 fn collection_tokens(&self) -> Vec<TokenId> {268 <TokenData<T>>::iter_prefix((self.id,))269 .map(|(id, _)| id)270 .collect()271 }272273 fn token_exists(&self, token: TokenId) -> bool {274 <Pallet<T>>::token_exists(self, token)275 }276277 fn last_token_id(&self) -> TokenId {278 TokenId(<TokensMinted<T>>::get(self.id))279 }280281 fn token_owner(&self, token: TokenId) -> Option<T::CrossAccountId> {282 <TokenData<T>>::get((self.id, token)).map(|t| t.owner)283 }284 fn const_metadata(&self, token: TokenId) -> Vec<u8> {285 <TokenData<T>>::get((self.id, token))286 .map(|t| t.const_data)287 .unwrap_or_default()288 .into_inner()289 }290 fn variable_metadata(&self, token: TokenId) -> Vec<u8> {291 <TokenData<T>>::get((self.id, token))292 .map(|t| t.variable_data)293 .unwrap_or_default()294 .into_inner()295 }296297 fn total_supply(&self) -> u32 {298 <Pallet<T>>::total_supply(self)299 }300301 fn account_balance(&self, account: T::CrossAccountId) -> u32 {302 <AccountBalance<T>>::get((self.id, account))303 }304305 fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {306 if <TokenData<T>>::get((self.id, token))307 .map(|a| a.owner == account)308 .unwrap_or(false)309 {310 1311 } else {312 0313 }314 }315316 fn allowance(317 &self,318 sender: T::CrossAccountId,319 spender: T::CrossAccountId,320 token: TokenId,321 ) -> u128 {322 if <TokenData<T>>::get((self.id, token))323 .map(|a| a.owner != sender)324 .unwrap_or(true)325 {326 0327 } else if <Allowance<T>>::get((self.id, token)) == Some(spender) {328 1329 } else {330 0331 }332 }333}1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use core::marker::PhantomData;1819use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, BoundedVec};20use up_data_structs::{21 TokenId, CustomDataLimit, CreateItemExData, CollectionId, budget::Budget, Property,22};23use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};24use sp_runtime::DispatchError;25use sp_std::vec::Vec;2627use crate::{28 AccountBalance, Allowance, Config, CreateItemData, Error, NonfungibleHandle, Owned, Pallet,29 SelfWeightOf, TokenData, weights::WeightInfo, TokensMinted,30};3132pub struct CommonWeights<T: Config>(PhantomData<T>);33impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {34 fn create_item() -> Weight {35 <SelfWeightOf<T>>::create_item()36 }3738 fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {39 match data {40 CreateItemExData::NFT(t) => <SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32),41 _ => 0,42 }43 }4445 fn create_multiple_items(amount: u32) -> Weight {46 <SelfWeightOf<T>>::create_multiple_items(amount)47 }4849 fn burn_item() -> Weight {50 <SelfWeightOf<T>>::burn_item()51 }5253 fn set_property() -> Weight {54 <SelfWeightOf<T>>::set_property()55 }5657 fn transfer() -> Weight {58 <SelfWeightOf<T>>::transfer()59 }6061 fn approve() -> Weight {62 <SelfWeightOf<T>>::approve()63 }6465 fn transfer_from() -> Weight {66 <SelfWeightOf<T>>::transfer_from()67 }6869 fn burn_from() -> Weight {70 <SelfWeightOf<T>>::burn_from()71 }7273 fn set_variable_metadata(bytes: u32) -> Weight {74 <SelfWeightOf<T>>::set_variable_metadata(bytes)75 }76}7778fn map_create_data<T: Config>(79 data: up_data_structs::CreateItemData,80 to: &T::CrossAccountId,81) -> Result<CreateItemData<T>, DispatchError> {82 match data {83 up_data_structs::CreateItemData::NFT(data) => Ok(CreateItemData::<T> {84 const_data: data.const_data,85 variable_data: data.variable_data,86 owner: to.clone(),87 }),88 _ => fail!(<Error<T>>::NotNonfungibleDataUsedToMintFungibleCollectionToken),89 }90}9192impl<T: Config> CommonCollectionOperations<T> for NonfungibleHandle<T> {93 fn create_item(94 &self,95 sender: T::CrossAccountId,96 to: T::CrossAccountId,97 data: up_data_structs::CreateItemData,98 nesting_budget: &dyn Budget,99 ) -> DispatchResultWithPostInfo {100 with_weight(101 <Pallet<T>>::create_item(102 self,103 &sender,104 map_create_data::<T>(data, &to)?,105 nesting_budget,106 ),107 <CommonWeights<T>>::create_item(),108 )109 }110111 fn create_multiple_items(112 &self,113 sender: T::CrossAccountId,114 to: T::CrossAccountId,115 data: Vec<up_data_structs::CreateItemData>,116 nesting_budget: &dyn Budget,117 ) -> DispatchResultWithPostInfo {118 let data = data119 .into_iter()120 .map(|d| map_create_data::<T>(d, &to))121 .collect::<Result<Vec<_>, DispatchError>>()?;122123 let amount = data.len();124 with_weight(125 <Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),126 <CommonWeights<T>>::create_multiple_items(amount as u32),127 )128 }129130 fn create_multiple_items_ex(131 &self,132 sender: <T>::CrossAccountId,133 data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,134 nesting_budget: &dyn Budget,135 ) -> DispatchResultWithPostInfo {136 let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);137 let data = match data {138 up_data_structs::CreateItemExData::NFT(nft) => nft,139 _ => fail!(Error::<T>::NotNonfungibleDataUsedToMintFungibleCollectionToken),140 };141142 with_weight(143 <Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),144 weight,145 )146 }147148 fn burn_item(149 &self,150 sender: T::CrossAccountId,151 token: TokenId,152 amount: u128,153 ) -> DispatchResultWithPostInfo {154 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);155 if amount == 1 {156 with_weight(157 <Pallet<T>>::burn(self, &sender, token),158 <CommonWeights<T>>::burn_item(),159 )160 } else {161 Ok(().into())162 }163 }164165 fn transfer(166 &self,167 from: T::CrossAccountId,168 to: T::CrossAccountId,169 token: TokenId,170 amount: u128,171 nesting_budget: &dyn Budget,172 ) -> DispatchResultWithPostInfo {173 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);174 if amount == 1 {175 with_weight(176 <Pallet<T>>::transfer(self, &from, &to, token, nesting_budget),177 <CommonWeights<T>>::transfer(),178 )179 } else {180 Ok(().into())181 }182 }183184 fn approve(185 &self,186 sender: T::CrossAccountId,187 spender: T::CrossAccountId,188 token: TokenId,189 amount: u128,190 ) -> DispatchResultWithPostInfo {191 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);192193 with_weight(194 if amount == 1 {195 <Pallet<T>>::set_allowance(self, &sender, token, Some(&spender))196 } else {197 <Pallet<T>>::set_allowance(self, &sender, token, None)198 },199 <CommonWeights<T>>::approve(),200 )201 }202203 fn transfer_from(204 &self,205 sender: T::CrossAccountId,206 from: T::CrossAccountId,207 to: T::CrossAccountId,208 token: TokenId,209 amount: u128,210 nesting_budget: &dyn Budget,211 ) -> DispatchResultWithPostInfo {212 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);213214 if amount == 1 {215 with_weight(216 <Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget),217 <CommonWeights<T>>::transfer_from(),218 )219 } else {220 Ok(().into())221 }222 }223224 fn burn_from(225 &self,226 sender: T::CrossAccountId,227 from: T::CrossAccountId,228 token: TokenId,229 amount: u128,230 nesting_budget: &dyn Budget,231 ) -> DispatchResultWithPostInfo {232 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);233234 if amount == 1 {235 with_weight(236 <Pallet<T>>::burn_from(self, &sender, &from, token, nesting_budget),237 <CommonWeights<T>>::burn_from(),238 )239 } else {240 Ok(().into())241 }242 }243244 fn change_collection_property(245 &self,246 sender: T::CrossAccountId,247 property: Property,248 ) -> DispatchResultWithPostInfo {249 // let token_id = None;250 with_weight(251 // <Pallet<T>>::change_property(self, &sender, token_id, property),252 Ok(()),253 <CommonWeights<T>>::set_property(),254 )255 }256257 fn change_token_property(258 &self,259 sender: T::CrossAccountId,260 token_id: TokenId,261 property: Property,262 ) -> DispatchResultWithPostInfo {263 with_weight(264 // <Pallet<T>>::change_property(self, &sender, Some(token_id), property),265 Ok(()),266 <CommonWeights<T>>::set_property(),267 )268 }269270 fn set_variable_metadata(271 &self,272 sender: T::CrossAccountId,273 token: TokenId,274 data: BoundedVec<u8, CustomDataLimit>,275 ) -> DispatchResultWithPostInfo {276 let len = data.len();277 with_weight(278 <Pallet<T>>::set_variable_metadata(self, &sender, token, data),279 <CommonWeights<T>>::set_variable_metadata(len as u32),280 )281 }282283 fn check_nesting(284 &self,285 sender: T::CrossAccountId,286 from: (CollectionId, TokenId),287 under: TokenId,288 budget: &dyn Budget,289 ) -> sp_runtime::DispatchResult {290 <Pallet<T>>::check_nesting(self, sender, from, under, budget)291 }292293 fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {294 <Owned<T>>::iter_prefix((self.id, account))295 .map(|(id, _)| id)296 .collect()297 }298299 fn collection_tokens(&self) -> Vec<TokenId> {300 <TokenData<T>>::iter_prefix((self.id,))301 .map(|(id, _)| id)302 .collect()303 }304305 fn token_exists(&self, token: TokenId) -> bool {306 <Pallet<T>>::token_exists(self, token)307 }308309 fn last_token_id(&self) -> TokenId {310 TokenId(<TokensMinted<T>>::get(self.id))311 }312313 fn token_owner(&self, token: TokenId) -> Option<T::CrossAccountId> {314 <TokenData<T>>::get((self.id, token)).map(|t| t.owner)315 }316 fn const_metadata(&self, token: TokenId) -> Vec<u8> {317 <TokenData<T>>::get((self.id, token))318 .map(|t| t.const_data)319 .unwrap_or_default()320 .into_inner()321 }322 fn variable_metadata(&self, token: TokenId) -> Vec<u8> {323 <TokenData<T>>::get((self.id, token))324 .map(|t| t.variable_data)325 .unwrap_or_default()326 .into_inner()327 }328329 fn total_supply(&self) -> u32 {330 <Pallet<T>>::total_supply(self)331 }332333 fn account_balance(&self, account: T::CrossAccountId) -> u32 {334 <AccountBalance<T>>::get((self.id, account))335 }336337 fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {338 if <TokenData<T>>::get((self.id, token))339 .map(|a| a.owner == account)340 .unwrap_or(false)341 {342 1343 } else {344 0345 }346 }347348 fn allowance(349 &self,350 sender: T::CrossAccountId,351 spender: T::CrossAccountId,352 token: TokenId,353 ) -> u128 {354 if <TokenData<T>>::get((self.id, token))355 .map(|a| a.owner != sender)356 .unwrap_or(true)357 {358 0359 } else if <Allowance<T>>::get((self.id, token)) == Some(spender) {360 1361 } else {362 0363 }364 }365}pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -20,7 +20,7 @@
use frame_support::{BoundedVec, ensure, fail};
use up_data_structs::{
AccessMode, CollectionId, CustomDataLimit, TokenId, CreateCollectionData, CreateNftExData,
- mapping::TokenAddressMapping, NestingRule, budget::Budget,
+ mapping::TokenAddressMapping, NestingRule, budget::Budget, Property, PropertyPermission,
};
use pallet_evm::account::CrossAccountId;
use pallet_common::{
@@ -94,6 +94,14 @@
QueryKind = OptionQuery,
>;
+ #[pallet::storage]
+ pub type TokenProperties<T: Config> = StorageNMap<
+ Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
+ Value = up_data_structs::Properties,
+ QueryKind = ValueQuery,
+ OnEmpty = up_data_structs::TokenProperties,
+ >;
+
/// Used to enumerate tokens owned by account
#[pallet::storage]
pub type Owned<T: Config> = StorageNMap<
@@ -246,6 +254,56 @@
Ok(())
}
+ pub fn change_token_property(
+ collection: &NonfungibleHandle<T>,
+ sender: &T::CrossAccountId,
+ token_id: TokenId,
+ property: Property,
+ ) -> DispatchResult {
+ let permission = <PalletCommon<T>>::property_permission(collection.id)
+ .get(&property.key)
+ .map(|p| p.clone())
+ .unwrap_or(PropertyPermission::None);
+
+ let check_token_owner = || -> DispatchResult {
+ let token_data = <TokenData<T>>::get((collection.id, token_id))
+ .ok_or(<CommonError<T>>::TokenNotFound)?;
+
+ ensure!(&token_data.owner == sender, <CommonError<T>>::NoPermission);
+
+ Ok(())
+ };
+
+ let is_property_exists = TokenProperties::<T>::get((collection.id, token_id))
+ .get_property(&property.key)
+ .is_some();
+
+ match (permission, is_property_exists) {
+ (PropertyPermission::AdminConst, false) => {
+ collection.check_is_owner_or_admin(sender)?
+ }
+ (PropertyPermission::Admin, _) => collection.check_is_owner_or_admin(sender)?,
+ (PropertyPermission::ItemOwnerConst, false) => check_token_owner()?,
+ (PropertyPermission::ItemOwner, _) => check_token_owner()?,
+ (PropertyPermission::ItemOwnerOrAdmin, _) => {
+ check_token_owner().or(collection.check_is_owner_or_admin(sender))?;
+ }
+ _ => return Err(<CommonError<T>>::NoPermission.into()),
+ }
+
+ <TokenProperties<T>>::try_mutate((collection.id, token_id), |properties| {
+ properties.try_change_property(property.clone())
+ })?;
+
+ <PalletCommon<T>>::deposit_event(CommonEvent::TokenPropertySet(
+ collection.id,
+ token_id,
+ property,
+ ));
+
+ Ok(())
+ }
+
pub fn transfer(
collection: &NonfungibleHandle<T>,
from: &T::CrossAccountId,
pallets/nonfungible/src/weights.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -36,6 +36,7 @@
fn create_multiple_items(b: u32, ) -> Weight;
fn create_multiple_items_ex(b: u32, ) -> Weight;
fn burn_item() -> Weight;
+ fn set_property() -> Weight;
fn transfer() -> Weight;
fn approve() -> Weight;
fn transfer_from() -> Weight;
@@ -90,6 +91,12 @@
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
+
+ fn set_property() -> Weight {
+ // TODO calculate appropriate weight
+ 50_000_000 as Weight
+ }
+
// Storage: Nonfungible TokenData (r:1 w:1)
// Storage: Nonfungible AccountBalance (r:2 w:2)
// Storage: Nonfungible Allowance (r:1 w:0)
@@ -179,6 +186,12 @@
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
}
+
+ fn set_property() -> Weight {
+ // TODO calculate appropriate weight
+ 50_000_000 as Weight
+ }
+
// Storage: Nonfungible TokenData (r:1 w:1)
// Storage: Nonfungible AccountBalance (r:2 w:2)
// Storage: Nonfungible Allowance (r:1 w:0)
pallets/refungible/src/common.rsdiffbeforeafterboth--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -20,7 +20,7 @@
use frame_support::{dispatch::DispatchResultWithPostInfo, fail, weights::Weight, BoundedVec};
use up_data_structs::{
CollectionId, TokenId, CustomDataLimit, CreateItemExData, CreateRefungibleExData,
- budget::Budget,
+ budget::Budget, Property,
};
use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};
use sp_runtime::DispatchError;
@@ -66,6 +66,10 @@
max_weight_of!(burn_item_partial(), burn_item_fully())
}
+ fn set_property() -> Weight {
+ <SelfWeightOf<T>>::set_property()
+ }
+
fn transfer() -> Weight {
max_weight_of!(
transfer_normal(),
@@ -244,6 +248,23 @@
)
}
+ fn change_collection_property(
+ &self,
+ _sender: T::CrossAccountId,
+ _property: Property,
+ ) -> DispatchResultWithPostInfo {
+ fail!(<Error<T>>::PropertiesNotAllowed)
+ }
+
+ fn change_token_property(
+ &self,
+ _sender: T::CrossAccountId,
+ _token_id: TokenId,
+ _property: Property,
+ ) -> DispatchResultWithPostInfo {
+ fail!(<Error<T>>::PropertiesNotAllowed)
+ }
+
fn set_variable_metadata(
&self,
sender: T::CrossAccountId,
pallets/refungible/src/lib.rsdiffbeforeafterboth--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -62,6 +62,8 @@
WrongRefungiblePieces,
/// Refungible token can't nest other tokens
RefungibleDisallowsNesting,
+ /// Item properties are not allowed
+ PropertiesNotAllowed,
}
#[pallet::config]
pallets/refungible/src/weights.rsdiffbeforeafterboth--- a/pallets/refungible/src/weights.rs
+++ b/pallets/refungible/src/weights.rs
@@ -38,6 +38,7 @@
fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight;
fn burn_item_partial() -> Weight;
fn burn_item_fully() -> Weight;
+ fn set_property() -> Weight;
fn transfer_normal() -> Weight;
fn transfer_creating() -> Weight;
fn transfer_removing() -> Weight;
@@ -129,6 +130,12 @@
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
+
+ fn set_property() -> Weight {
+ // Error
+ 0
+ }
+
// Storage: Refungible Balance (r:2 w:2)
fn transfer_normal() -> Weight {
(19_766_000 as Weight)
@@ -297,6 +304,12 @@
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
}
+
+ fn set_property() -> Weight {
+ // Error
+ 0
+ }
+
// Storage: Refungible Balance (r:2 w:2)
fn transfer_normal() -> Weight {
(19_766_000 as Weight)
pallets/unique/src/lib.rsdiffbeforeafterboth--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -39,7 +39,7 @@
MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
AccessMode, CreateItemData, CollectionLimits, CollectionId, CollectionMode, TokenId,
SchemaVersion, SponsorshipState, MetaUpdatePermission, CreateCollectionData, CustomDataLimit,
- CreateItemExData, budget, CollectionField,
+ CreateItemExData, budget, CollectionField, Property,
};
use pallet_evm::account::CrossAccountId;
use pallet_common::{
primitives/data-structs/src/lib.rsdiffbeforeafterboth--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -22,13 +22,14 @@
};
use frame_support::{
storage::{bounded_btree_map::BoundedBTreeMap, bounded_btree_set::BoundedBTreeSet},
+ traits::Get,
};
#[cfg(feature = "serde")]
use serde::{Serialize, Deserialize};
use sp_core::U256;
-use sp_runtime::{ArithmeticError, sp_std::prelude::Vec};
+use sp_runtime::{ArithmeticError, sp_std::prelude::Vec, DispatchError};
use codec::{Decode, Encode, EncodeLike, MaxEncodedLen};
use frame_support::{BoundedVec, traits::ConstU32};
use derivative::Derivative;
@@ -85,6 +86,26 @@
pub const MAX_COLLECTION_DESCRIPTION_LENGTH: u32 = 256;
pub const MAX_TOKEN_PREFIX_LENGTH: u32 = 16;
+pub const MAX_PROPERTY_KEY_LENGTH: u32 = 256;
+pub const MAX_PROPERTY_VALUE_LENGTH: u32 = 32768;
+pub const MAX_PROPERTIES_PER_ITEM: u32 = 64;
+
+// pub const MAX_PROPERTY_KEYS_OVERALL_LENGTH: u32 = MAX_PROPERTY_KEY_LENGTH * MAX_PROPERTIES_PER_ITEM;
+pub const MAX_COLLECTION_PROPERTIES_SIZE: u32 = 40960;
+pub const MAX_TOKEN_PROPERTIES_SIZE: u32 = 32768;
+
+pub const MAX_COLLECTION_PROPERTIES_ENCODE_LEN: u32 =
+ MAX_PROPERTIES_PER_ITEM * MAX_PROPERTY_KEY_LENGTH + MAX_COLLECTION_PROPERTIES_SIZE;
+
+pub struct MaxPropertiesPermissionsEncodeLen;
+
+impl Get<u32> for MaxPropertiesPermissionsEncodeLen {
+ fn get() -> u32 {
+ MAX_PROPERTIES_PER_ITEM * MAX_PROPERTY_KEY_LENGTH
+ + <PropertyPermission as MaxEncodedLen>::max_encoded_len() as u32
+ }
+}
+
/// How much items can be created per single
/// create_many call
pub const MAX_ITEMS_PER_BATCH: u32 = 200;
@@ -310,31 +331,32 @@
OffchainSchema,
}
-#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, Debug, Derivative, MaxEncodedLen)]
-#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
-#[derivative(Default(bound = ""))]
+#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, Derivative, MaxEncodedLen)]
+#[derivative(Debug, Default(bound = ""))]
pub struct CreateCollectionData<AccountId> {
#[derivative(Default(value = "CollectionMode::NFT"))]
pub mode: CollectionMode,
pub access: Option<AccessMode>,
- #[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
pub name: BoundedVec<u16, ConstU32<MAX_COLLECTION_NAME_LENGTH>>,
- #[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
pub description: BoundedVec<u16, ConstU32<MAX_COLLECTION_DESCRIPTION_LENGTH>>,
- #[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
pub token_prefix: BoundedVec<u8, ConstU32<MAX_TOKEN_PREFIX_LENGTH>>,
- #[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
pub offchain_schema: BoundedVec<u8, ConstU32<OFFCHAIN_SCHEMA_LIMIT>>,
pub schema_version: Option<SchemaVersion>,
pub pending_sponsor: Option<AccountId>,
pub limits: Option<CollectionLimits>,
- #[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
pub variable_on_chain_schema: BoundedVec<u8, ConstU32<VARIABLE_ON_CHAIN_SCHEMA_LIMIT>>,
- #[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
pub const_on_chain_schema: BoundedVec<u8, ConstU32<CONST_ON_CHAIN_SCHEMA_LIMIT>>,
pub meta_update_permission: Option<MetaUpdatePermission>,
+ pub token_property_permissions: CollectionPropertiesPermissionsVec,
+ pub properties: CollectionPropertiesVec,
}
+pub type CollectionPropertiesPermissionsVec =
+ BoundedVec<PropertyKeyPermission, MaxPropertiesPermissionsEncodeLen>;
+
+pub type CollectionPropertiesVec =
+ BoundedVec<Property, ConstU32<MAX_COLLECTION_PROPERTIES_ENCODE_LEN>>;
+
#[derive(Encode, Decode, Debug, Clone, PartialEq, TypeInfo)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
pub struct NftItemType<AccountId> {
@@ -607,3 +629,128 @@
0
}
}
+
+pub type PropertyKey = BoundedVec<u8, ConstU32<MAX_PROPERTY_KEY_LENGTH>>;
+pub type PropertyValue = BoundedVec<u8, ConstU32<MAX_PROPERTY_VALUE_LENGTH>>;
+
+#[derive(Encode, Decode, TypeInfo, Debug, MaxEncodedLen, PartialEq, Clone)]
+pub enum PropertyPermission {
+ None,
+ AdminConst,
+ Admin,
+ ItemOwnerConst,
+ ItemOwner,
+ ItemOwnerOrAdmin,
+}
+
+#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq, MaxEncodedLen)]
+pub struct Property {
+ pub key: PropertyKey,
+ pub value: PropertyValue,
+}
+
+#[derive(Encode, Decode, TypeInfo, Debug, MaxEncodedLen, PartialEq, Clone)]
+pub struct PropertyKeyPermission {
+ pub key: PropertyKey,
+ pub permission: PropertyPermission,
+}
+
+pub enum PropertiesError {
+ NoSpaceForProperty,
+ PropertyLimitReached,
+}
+
+impl From<PropertiesError> for DispatchError {
+ fn from(error: PropertiesError) -> Self {
+ match error {
+ PropertiesError::NoSpaceForProperty => DispatchError::Other("no space for property"),
+ PropertiesError::PropertyLimitReached => {
+ DispatchError::Other("property key limit reached")
+ }
+ }
+ }
+}
+
+pub type PropertiesMap =
+ BoundedBTreeMap<PropertyKey, PropertyValue, ConstU32<MAX_PROPERTIES_PER_ITEM>>;
+pub type PropertiesPermissionMap =
+ BoundedBTreeMap<PropertyKey, PropertyPermission, ConstU32<MAX_PROPERTIES_PER_ITEM>>;
+
+#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, MaxEncodedLen)]
+pub struct Properties {
+ map: PropertiesMap,
+ consumed_space: u32,
+ space_limit: u32,
+}
+
+impl Properties {
+ pub fn new(space_limit: u32) -> Self {
+ Self {
+ map: BoundedBTreeMap::new(),
+ consumed_space: 0,
+ space_limit,
+ }
+ }
+
+ pub fn from_collection_props_vec(
+ data: CollectionPropertiesVec,
+ ) -> Result<Self, PropertiesError> {
+ let mut props = Self::new(MAX_COLLECTION_PROPERTIES_SIZE);
+
+ for property in data.into_iter() {
+ props.try_change_property(property)?;
+ }
+
+ Ok(props)
+ }
+
+ pub fn try_change_property(&mut self, property: Property) -> Result<(), PropertiesError> {
+ let value_len = property.value.len();
+
+ if self.consumed_space as usize + value_len > self.space_limit as usize {
+ return Err(PropertiesError::NoSpaceForProperty);
+ }
+
+ self.map
+ .try_insert(property.key, property.value)
+ .map_err(|_| PropertiesError::PropertyLimitReached)?;
+
+ self.consumed_space += value_len as u32;
+
+ Ok(())
+ }
+
+ pub fn get_property(&self, key: &PropertyKey) -> Option<&PropertyValue> {
+ self.map.get(key)
+ }
+}
+
+pub struct CollectionProperties;
+
+impl Get<Properties> for CollectionProperties {
+ fn get() -> Properties {
+ Properties::new(MAX_COLLECTION_PROPERTIES_SIZE)
+ }
+}
+
+pub struct TokenProperties;
+
+impl Get<Properties> for TokenProperties {
+ fn get() -> Properties {
+ Properties::new(MAX_TOKEN_PROPERTIES_SIZE)
+ }
+}
+
+// #[cfg(not(feature = "std"))]
+// fn properties_map_debug(_properties: &PropertiesMap, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
+// write!(f, "<properties>")
+// }
+
+// #[cfg(not(feature = "std"))]
+// fn opt_properties_permissions_map_debug(properties: &Option<PropertiesPermissionMap>, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
+// if properties.is_some() {
+// write!(f, "Some(<properties permissions>)")
+// } else {
+// write!(f, "None")
+// }
+// }
primitives/rpc/src/lib.rsdiffbeforeafterboth--- a/primitives/rpc/src/lib.rs
+++ b/primitives/rpc/src/lib.rs
@@ -16,7 +16,9 @@
#![cfg_attr(not(feature = "std"), no_std)]
-use up_data_structs::{CollectionId, TokenId, RpcCollection, CollectionStats, CollectionLimits};
+use up_data_structs::{
+ CollectionId, TokenId, RpcCollection, CollectionStats, CollectionLimits, Property,
+};
use sp_std::vec::Vec;
use codec::Decode;
use sp_runtime::DispatchError;
runtime/common/src/weights.rsdiffbeforeafterboth--- a/runtime/common/src/weights.rs
+++ b/runtime/common/src/weights.rs
@@ -54,6 +54,10 @@
dispatch_weight::<T>() + max_weight_of!(burn_item())
}
+ fn set_property() -> Weight {
+ dispatch_weight::<T>() + max_weight_of!(set_property())
+ }
+
fn transfer() -> Weight {
dispatch_weight::<T>() + max_weight_of!(transfer())
}