difftreelog
feat impl dispatchable methods
in: master
5 files changed
pallets/balances-adapter/src/common.rsdiffbeforeafterboth1use alloc::vec::Vec;1use alloc::{vec, vec::Vec};2use core::marker::PhantomData;2use core::marker::PhantomData;3use crate::{Config, NativeFungibleHandle};3use crate::{Config, NativeFungibleHandle};4use frame_support::{5 traits::{Currency, ExistenceRequirement},6 fail,7};4use pallet_common::{CommonCollectionOperations, CommonWeightInfo};8use pallet_common::{erc::CrossAccountId, CommonCollectionOperations, CommonWeightInfo, with_weight};9use up_data_structs::TokenId;5106pub struct CommonWeights<T: Config>(PhantomData<T>);11pub struct CommonWeights<T: Config>(PhantomData<T>);7impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {12impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {92 data: up_data_structs::CreateItemData,97 data: up_data_structs::CreateItemData,93 nesting_budget: &dyn up_data_structs::budget::Budget,98 nesting_budget: &dyn up_data_structs::budget::Budget,94 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {99 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {95 todo!()100 fail!(<pallet_common::Error<T>>::UnsupportedOperation);96 }101 }9710298 fn create_multiple_items(103 fn create_multiple_items(102 data: Vec<up_data_structs::CreateItemData>,107 data: Vec<up_data_structs::CreateItemData>,103 nesting_budget: &dyn up_data_structs::budget::Budget,108 nesting_budget: &dyn up_data_structs::budget::Budget,104 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {109 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {105 todo!()110 fail!(<pallet_common::Error<T>>::UnsupportedOperation);106 }111 }107112108 fn create_multiple_items_ex(113 fn create_multiple_items_ex(111 data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,116 data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,112 nesting_budget: &dyn up_data_structs::budget::Budget,117 nesting_budget: &dyn up_data_structs::budget::Budget,113 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {118 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {114 todo!()119 fail!(<pallet_common::Error<T>>::UnsupportedOperation);115 }120 }116121117 fn burn_item(122 fn burn_item(118 &self,123 &self,119 sender: <T>::CrossAccountId,124 sender: <T>::CrossAccountId,120 token: up_data_structs::TokenId,125 token: TokenId,121 amount: u128,126 amount: u128,122 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {127 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {123 todo!()128 fail!(<pallet_common::Error<T>>::UnsupportedOperation);124 }129 }125130126 fn burn_item_recursively(131 fn burn_item_recursively(127 &self,132 &self,128 sender: <T>::CrossAccountId,133 sender: <T>::CrossAccountId,129 token: up_data_structs::TokenId,134 token: TokenId,130 self_budget: &dyn up_data_structs::budget::Budget,135 self_budget: &dyn up_data_structs::budget::Budget,131 breadth_budget: &dyn up_data_structs::budget::Budget,136 breadth_budget: &dyn up_data_structs::budget::Budget,132 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {137 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {133 todo!()138 fail!(<pallet_common::Error<T>>::UnsupportedOperation);134 }139 }135140136 fn set_collection_properties(141 fn set_collection_properties(137 &self,142 &self,138 sender: <T>::CrossAccountId,143 sender: <T>::CrossAccountId,139 properties: Vec<up_data_structs::Property>,144 properties: Vec<up_data_structs::Property>,140 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {145 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {141 todo!()146 fail!(<pallet_common::Error<T>>::UnsupportedOperation);142 }147 }143148144 fn delete_collection_properties(149 fn delete_collection_properties(145 &self,150 &self,146 sender: &<T>::CrossAccountId,151 sender: &<T>::CrossAccountId,147 property_keys: Vec<up_data_structs::PropertyKey>,152 property_keys: Vec<up_data_structs::PropertyKey>,148 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {153 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {149 todo!()154 fail!(<pallet_common::Error<T>>::UnsupportedOperation);150 }155 }151156152 fn set_token_properties(157 fn set_token_properties(153 &self,158 &self,154 sender: <T>::CrossAccountId,159 sender: <T>::CrossAccountId,155 token_id: up_data_structs::TokenId,160 token_id: TokenId,156 properties: Vec<up_data_structs::Property>,161 properties: Vec<up_data_structs::Property>,157 budget: &dyn up_data_structs::budget::Budget,162 budget: &dyn up_data_structs::budget::Budget,158 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {163 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {159 todo!()164 fail!(<pallet_common::Error<T>>::UnsupportedOperation);160 }165 }161166162 fn delete_token_properties(167 fn delete_token_properties(163 &self,168 &self,164 sender: <T>::CrossAccountId,169 sender: <T>::CrossAccountId,165 token_id: up_data_structs::TokenId,170 token_id: TokenId,166 property_keys: Vec<up_data_structs::PropertyKey>,171 property_keys: Vec<up_data_structs::PropertyKey>,167 budget: &dyn up_data_structs::budget::Budget,172 budget: &dyn up_data_structs::budget::Budget,168 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {173 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {169 todo!()174 fail!(<pallet_common::Error<T>>::UnsupportedOperation);170 }175 }171176172 fn set_token_property_permissions(177 fn set_token_property_permissions(173 &self,178 &self,174 sender: &<T>::CrossAccountId,179 sender: &<T>::CrossAccountId,175 property_permissions: Vec<up_data_structs::PropertyKeyPermission>,180 property_permissions: Vec<up_data_structs::PropertyKeyPermission>,176 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {181 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {177 todo!()182 fail!(<pallet_common::Error<T>>::UnsupportedOperation);178 }183 }179184180 fn transfer(185 fn transfer(181 &self,186 &self,182 sender: <T>::CrossAccountId,187 sender: <T>::CrossAccountId,183 to: <T>::CrossAccountId,188 to: <T>::CrossAccountId,184 token: up_data_structs::TokenId,189 token: TokenId,185 amount: u128,190 amount: u128,186 budget: &dyn up_data_structs::budget::Budget,191 budget: &dyn up_data_structs::budget::Budget,187 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {192 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {193 with_weight(194 <T as Config>::Currency::transfer(195 sender.as_sub(),196 to.as_sub(),197 amount.into(),198 ExistenceRequirement::KeepAlive,199 ),188 todo!()200 Default::default(),201 )189 }202 }190203191 fn approve(204 fn approve(192 &self,205 &self,193 sender: <T>::CrossAccountId,206 sender: <T>::CrossAccountId,194 spender: <T>::CrossAccountId,207 spender: <T>::CrossAccountId,195 token: up_data_structs::TokenId,208 token: TokenId,196 amount: u128,209 amount: u128,197 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {210 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {198 todo!()211 fail!(<pallet_common::Error<T>>::UnsupportedOperation);199 }212 }200213201 fn approve_from(214 fn approve_from(202 &self,215 &self,203 sender: <T>::CrossAccountId,216 sender: <T>::CrossAccountId,204 from: <T>::CrossAccountId,217 from: <T>::CrossAccountId,205 to: <T>::CrossAccountId,218 to: <T>::CrossAccountId,206 token: up_data_structs::TokenId,219 token: TokenId,207 amount: u128,220 amount: u128,208 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {221 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {209 todo!()222 fail!(<pallet_common::Error<T>>::UnsupportedOperation);210 }223 }211224212 fn transfer_from(225 fn transfer_from(213 &self,226 &self,214 sender: <T>::CrossAccountId,227 sender: <T>::CrossAccountId,215 from: <T>::CrossAccountId,228 from: <T>::CrossAccountId,216 to: <T>::CrossAccountId,229 to: <T>::CrossAccountId,217 token: up_data_structs::TokenId,230 token: TokenId,218 amount: u128,231 amount: u128,219 budget: &dyn up_data_structs::budget::Budget,232 budget: &dyn up_data_structs::budget::Budget,220 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {233 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {234 with_weight(235 <T as Config>::Currency::transfer(236 sender.as_sub(),237 to.as_sub(),238 amount.into(),239 ExistenceRequirement::KeepAlive,240 ),221 todo!()241 Default::default(),242 )222 }243 }223244224 fn burn_from(245 fn burn_from(225 &self,246 &self,226 sender: <T>::CrossAccountId,247 sender: <T>::CrossAccountId,227 from: <T>::CrossAccountId,248 from: <T>::CrossAccountId,228 token: up_data_structs::TokenId,249 token: TokenId,229 amount: u128,250 amount: u128,230 budget: &dyn up_data_structs::budget::Budget,251 budget: &dyn up_data_structs::budget::Budget,231 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {252 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {232 todo!()253 fail!(<pallet_common::Error<T>>::UnsupportedOperation);233 }254 }234255235 fn check_nesting(256 fn check_nesting(236 &self,257 &self,237 sender: <T>::CrossAccountId,258 sender: <T>::CrossAccountId,238 from: (up_data_structs::CollectionId, up_data_structs::TokenId),259 from: (up_data_structs::CollectionId, TokenId),239 under: up_data_structs::TokenId,260 under: TokenId,240 budget: &dyn up_data_structs::budget::Budget,261 budget: &dyn up_data_structs::budget::Budget,241 ) -> frame_support::sp_runtime::DispatchResult {262 ) -> frame_support::sp_runtime::DispatchResult {242 todo!()263 fail!(<pallet_common::Error<T>>::UnsupportedOperation);243 }264 }244265245 fn nest(266 fn nest(&self, under: TokenId, to_nest: (up_data_structs::CollectionId, TokenId)) {}246 &self,247 under: up_data_structs::TokenId,248 to_nest: (up_data_structs::CollectionId, up_data_structs::TokenId),249 ) {250 todo!()251 }252267253 fn unnest(268 fn unnest(&self, under: TokenId, to_nest: (up_data_structs::CollectionId, TokenId)) {}254 &self,255 under: up_data_structs::TokenId,256 to_nest: (up_data_structs::CollectionId, up_data_structs::TokenId),257 ) {258 todo!()259 }260269261 fn account_tokens(&self, account: <T>::CrossAccountId) -> Vec<up_data_structs::TokenId> {270 fn account_tokens(&self, account: <T>::CrossAccountId) -> Vec<TokenId> {271 let balance = <T as Config>::Currency::total_balance(account.as_sub());272 if balance != 0 {262 todo!()273 vec![TokenId::default()]274 } else {275 vec![]276 }263 }277 }264278265 fn collection_tokens(&self) -> Vec<up_data_structs::TokenId> {279 fn collection_tokens(&self) -> Vec<TokenId> {266 todo!()280 vec![TokenId::default()]267 }281 }268282269 fn token_exists(&self, token: up_data_structs::TokenId) -> bool {283 fn token_exists(&self, token: TokenId) -> bool {270 todo!()284 token == TokenId::default()271 }285 }272286273 fn last_token_id(&self) -> up_data_structs::TokenId {287 fn last_token_id(&self) -> TokenId {274 todo!()288 TokenId::default()275 }289 }276290277 fn token_owner(291 fn token_owner(278 &self,292 &self,279 token: up_data_structs::TokenId,293 token: TokenId,280 ) -> Result<<T>::CrossAccountId, up_data_structs::TokenOwnerError> {294 ) -> Result<<T>::CrossAccountId, up_data_structs::TokenOwnerError> {281 todo!()295 Err(up_data_structs::TokenOwnerError::MultipleOwners)282 }296 }283297284 fn token_owners(&self, token: up_data_structs::TokenId) -> Vec<<T>::CrossAccountId> {298 fn token_owners(&self, token: TokenId) -> Vec<<T>::CrossAccountId> {285 todo!()299 vec![]286 }300 }287301288 fn token_property(302 fn token_property(289 &self,303 &self,290 token_id: up_data_structs::TokenId,304 token_id: TokenId,291 key: &up_data_structs::PropertyKey,305 key: &up_data_structs::PropertyKey,292 ) -> Option<up_data_structs::PropertyValue> {306 ) -> Option<up_data_structs::PropertyValue> {293 todo!()307 None294 }308 }295309296 fn token_properties(310 fn token_properties(297 &self,311 &self,298 token: up_data_structs::TokenId,312 token: TokenId,299 keys: Option<Vec<up_data_structs::PropertyKey>>,313 keys: Option<Vec<up_data_structs::PropertyKey>>,300 ) -> Vec<up_data_structs::Property> {314 ) -> Vec<up_data_structs::Property> {301 todo!()315 vec![]302 }316 }303317304 fn total_supply(&self) -> u32 {318 fn total_supply(&self) -> u32 {305 todo!()319 1306 }320 }307321308 fn account_balance(&self, account: <T>::CrossAccountId) -> u32 {322 fn account_balance(&self, account: <T>::CrossAccountId) -> u32 {323 let balance: u128 = <T as Config>::Currency::free_balance(account.as_sub()).into();309 todo!()324 (balance != 0).into()310 }325 }311326312 fn balance(&self, account: <T>::CrossAccountId, token: up_data_structs::TokenId) -> u128 {327 fn balance(&self, account: <T>::CrossAccountId, token: TokenId) -> u128 {328 if token != TokenId::default() {329 return 0;330 }313 todo!()331 <T as Config>::Currency::free_balance(account.as_sub()).into()314 }332 }315333316 fn total_pieces(&self, token: up_data_structs::TokenId) -> Option<u128> {334 fn total_pieces(&self, token: TokenId) -> Option<u128> {335 if token != TokenId::default() {336 return None;337 }317 todo!()338 let total = <T as Config>::Currency::total_issuance();339 Some(total.into())318 }340 }319341320 fn allowance(342 fn allowance(321 &self,343 &self,322 sender: <T>::CrossAccountId,344 sender: <T>::CrossAccountId,323 spender: <T>::CrossAccountId,345 spender: <T>::CrossAccountId,324 token: up_data_structs::TokenId,346 token: TokenId,325 ) -> u128 {347 ) -> u128 {326 todo!()348 0327 }349 }328350329 fn refungible_extensions(&self) -> Option<&dyn pallet_common::RefungibleExtensions<T>> {351 fn refungible_extensions(&self) -> Option<&dyn pallet_common::RefungibleExtensions<T>> {330 todo!()352 None331 }353 }332354333 fn set_allowance_for_all(355 fn set_allowance_for_all(336 operator: <T>::CrossAccountId,358 operator: <T>::CrossAccountId,337 approve: bool,359 approve: bool,338 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {360 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {339 todo!()361 fail!(<pallet_common::Error<T>>::UnsupportedOperation);340 }362 }341363342 fn allowance_for_all(&self, owner: <T>::CrossAccountId, operator: <T>::CrossAccountId) -> bool {364 fn allowance_for_all(&self, owner: <T>::CrossAccountId, operator: <T>::CrossAccountId) -> bool {343 todo!()365 false344 }366 }345367346 fn repair_item(368 fn repair_item(347 &self,369 &self,348 token: up_data_structs::TokenId,370 token: TokenId,349 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {371 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {350 todo!()372 fail!(<pallet_common::Error<T>>::UnsupportedOperation);351 }373 }352}374}353375pallets/balances-adapter/src/lib.rsdiffbeforeafterboth44 Self::AccountId,44 Self::AccountId,45 Balance = Self::CurrencyBalance,45 Balance = Self::CurrencyBalance,46 >;46 >;47 type CurrencyBalance: Into<U256> + TryFrom<U256>;47 type CurrencyBalance: Into<U256> + TryFrom<U256> + PartialEq<u128> + From<u128> + Into<u128>;484849 type Decimals: Get<u8>;49 type Decimals: Get<u8>;50 type Name: Get<String>;50 type Name: Get<String>;pallets/common/src/lib.rsdiffbeforeafterboth462 }462 }463463464 const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);464 const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);465 pub const NATIVE_FINGIBLE_COLLECTION_ID: CollectionId = CollectionId(0);465466466 #[pallet::pallet]467 #[pallet::pallet]467 #[pallet::storage_version(STORAGE_VERSION)]468 #[pallet::storage_version(STORAGE_VERSION)]pallets/unique/src/lib.rsdiffbeforeafterboth440 collection_id: CollectionId,440 collection_id: CollectionId,441 address: T::CrossAccountId,441 address: T::CrossAccountId,442 ) -> DispatchResult {442 ) -> DispatchResult {443 if collection_id == pallet_common::NATIVE_FINGIBLE_COLLECTION_ID {444 fail!(<pallet_common::Error<T>>::UnsupportedOperation);445 }446443 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);447 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);444 let collection = <CollectionHandle<T>>::try_get(collection_id)?;448 let collection = <CollectionHandle<T>>::try_get(collection_id)?;467 collection_id: CollectionId,471 collection_id: CollectionId,468 address: T::CrossAccountId,472 address: T::CrossAccountId,469 ) -> DispatchResult {473 ) -> DispatchResult {474 if collection_id == pallet_common::NATIVE_FINGIBLE_COLLECTION_ID {475 fail!(<pallet_common::Error<T>>::UnsupportedOperation);476 }477470 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);478 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);471 let collection = <CollectionHandle<T>>::try_get(collection_id)?;479 let collection = <CollectionHandle<T>>::try_get(collection_id)?;493 collection_id: CollectionId,501 collection_id: CollectionId,494 new_owner: T::AccountId,502 new_owner: T::AccountId,495 ) -> DispatchResult {503 ) -> DispatchResult {504 if collection_id == pallet_common::NATIVE_FINGIBLE_COLLECTION_ID {505 fail!(<pallet_common::Error<T>>::UnsupportedOperation);506 }496 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);507 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);497 let new_owner = T::CrossAccountId::from_sub(new_owner);508 let new_owner = T::CrossAccountId::from_sub(new_owner);498 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;509 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;522 collection_id: CollectionId,533 collection_id: CollectionId,523 new_admin_id: T::CrossAccountId,534 new_admin_id: T::CrossAccountId,524 ) -> DispatchResult {535 ) -> DispatchResult {536 if collection_id == pallet_common::NATIVE_FINGIBLE_COLLECTION_ID {537 fail!(<pallet_common::Error<T>>::UnsupportedOperation);538 }525 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);539 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);526 let collection = <CollectionHandle<T>>::try_get(collection_id)?;540 let collection = <CollectionHandle<T>>::try_get(collection_id)?;527 <PalletCommon<T>>::toggle_admin(&collection, &sender, &new_admin_id, true)541 <PalletCommon<T>>::toggle_admin(&collection, &sender, &new_admin_id, true)548 collection_id: CollectionId,562 collection_id: CollectionId,549 account_id: T::CrossAccountId,563 account_id: T::CrossAccountId,550 ) -> DispatchResult {564 ) -> DispatchResult {565 if collection_id == pallet_common::NATIVE_FINGIBLE_COLLECTION_ID {566 fail!(<pallet_common::Error<T>>::UnsupportedOperation);567 }551 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);568 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);552 let collection = <CollectionHandle<T>>::try_get(collection_id)?;569 let collection = <CollectionHandle<T>>::try_get(collection_id)?;553 <PalletCommon<T>>::toggle_admin(&collection, &sender, &account_id, false)570 <PalletCommon<T>>::toggle_admin(&collection, &sender, &account_id, false)573 collection_id: CollectionId,590 collection_id: CollectionId,574 new_sponsor: T::AccountId,591 new_sponsor: T::AccountId,575 ) -> DispatchResult {592 ) -> DispatchResult {593 if collection_id == pallet_common::NATIVE_FINGIBLE_COLLECTION_ID {594 fail!(<pallet_common::Error<T>>::UnsupportedOperation);595 }576 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);596 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);577 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;597 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;578 target_collection.set_sponsor(&sender, new_sponsor.clone())598 target_collection.set_sponsor(&sender, new_sponsor.clone())597 origin: OriginFor<T>,617 origin: OriginFor<T>,598 collection_id: CollectionId,618 collection_id: CollectionId,599 ) -> DispatchResult {619 ) -> DispatchResult {620 if collection_id == pallet_common::NATIVE_FINGIBLE_COLLECTION_ID {621 fail!(<pallet_common::Error<T>>::UnsupportedOperation);622 }600 let sender = ensure_signed(origin)?;623 let sender = ensure_signed(origin)?;601 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;624 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;602 target_collection.confirm_sponsorship(&sender)625 target_collection.confirm_sponsorship(&sender)617 origin: OriginFor<T>,640 origin: OriginFor<T>,618 collection_id: CollectionId,641 collection_id: CollectionId,619 ) -> DispatchResult {642 ) -> DispatchResult {643 if collection_id == pallet_common::NATIVE_FINGIBLE_COLLECTION_ID {644 fail!(<pallet_common::Error<T>>::UnsupportedOperation);645 }620 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);646 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);621 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;647 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;622 target_collection.remove_sponsor(&sender)648 target_collection.remove_sponsor(&sender)894 collection_id: CollectionId,920 collection_id: CollectionId,895 value: bool,921 value: bool,896 ) -> DispatchResult {922 ) -> DispatchResult {923 if collection_id == pallet_common::NATIVE_FINGIBLE_COLLECTION_ID {924 fail!(<pallet_common::Error<T>>::UnsupportedOperation);925 }897 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);926 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);898 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;927 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;899 target_collection.check_is_internal()?;928 target_collection.check_is_internal()?;1146 collection_id: CollectionId,1175 collection_id: CollectionId,1147 new_limit: CollectionLimits,1176 new_limit: CollectionLimits,1148 ) -> DispatchResult {1177 ) -> DispatchResult {1178 if collection_id == pallet_common::NATIVE_FINGIBLE_COLLECTION_ID {1179 fail!(<pallet_common::Error<T>>::UnsupportedOperation);1180 }1149 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1181 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1150 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;1182 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;1151 <PalletCommon<T>>::update_limits(&sender, &mut target_collection, new_limit)1183 <PalletCommon<T>>::update_limits(&sender, &mut target_collection, new_limit)1170 collection_id: CollectionId,1202 collection_id: CollectionId,1171 new_permission: CollectionPermissions,1203 new_permission: CollectionPermissions,1172 ) -> DispatchResult {1204 ) -> DispatchResult {1205 if collection_id == pallet_common::NATIVE_FINGIBLE_COLLECTION_ID {1206 fail!(<pallet_common::Error<T>>::UnsupportedOperation);1207 }1173 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1208 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1174 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;1209 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;1175 <PalletCommon<T>>::update_permissions(&sender, &mut target_collection, new_permission)1210 <PalletCommon<T>>::update_permissions(&sender, &mut target_collection, new_permission)1238 origin: OriginFor<T>,1273 origin: OriginFor<T>,1239 collection_id: CollectionId,1274 collection_id: CollectionId,1240 ) -> DispatchResult {1275 ) -> DispatchResult {1276 if collection_id == pallet_common::NATIVE_FINGIBLE_COLLECTION_ID {1277 fail!(<pallet_common::Error<T>>::UnsupportedOperation);1278 }1241 ensure_root(origin)?;1279 ensure_root(origin)?;1242 <PalletCommon<T>>::repair_collection(collection_id)1280 <PalletCommon<T>>::repair_collection(collection_id)1243 }1281 }runtime/common/dispatch.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use frame_support::{dispatch::DispatchResult, ensure};17use frame_support::{dispatch::DispatchResult, ensure, fail};18use pallet_evm::{PrecompileHandle, PrecompileResult};18use pallet_evm::{PrecompileHandle, PrecompileResult};19use sp_core::H160;19use sp_core::H160;20use sp_runtime::DispatchError;20use sp_runtime::DispatchError;100 }100 }101101102 fn destroy(sender: T::CrossAccountId, collection_id: CollectionId) -> DispatchResult {102 fn destroy(sender: T::CrossAccountId, collection_id: CollectionId) -> DispatchResult {103 if collection_id == pallet_common::NATIVE_FINGIBLE_COLLECTION_ID {104 fail!(<pallet_common::Error<T>>::UnsupportedOperation);105 }106103 let collection = <CollectionHandle<T>>::try_get(collection_id)?;107 let collection = <CollectionHandle<T>>::try_get(collection_id)?;104 collection.check_is_internal()?;108 collection.check_is_internal()?;