git.delta.rocks / unique-network / refs/commits / 9c3e59a24962

difftreelog

fix clippy

Daniel Shiposha2023-10-24parent: #cafc907.patch.diff
in: master

5 files changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
2387 amount: u128,2387 amount: u128,
2388 nesting_budget: &dyn Budget,2388 nesting_budget: &dyn Budget,
2389 ) -> DispatchResult {2389 ) -> DispatchResult {
2390 if T::CrossTokenAddressMapping::is_token_address(&to) {2390 if T::CrossTokenAddressMapping::is_token_address(to) {
2391 return unsupported!(T);2391 return unsupported!(T);
2392 }2392 }
23932393
modifiedpallets/foreign-assets/src/lib.rsdiffbeforeafterboth
240 ) -> Result<Option<CollectionId>, XcmError> {240 ) -> Result<Option<CollectionId>, XcmError> {
241 let self_location = T::SelfLocation::get();241 let self_location = T::SelfLocation::get();
242242
243 if *asset_location == Here.into() {243 if *asset_location == Here.into() || *asset_location == self_location {
244 Ok(Some(NATIVE_FUNGIBLE_COLLECTION_ID))
245 } else if *asset_location == self_location {
246 Ok(Some(NATIVE_FUNGIBLE_COLLECTION_ID))244 Ok(Some(NATIVE_FUNGIBLE_COLLECTION_ID))
247 } else if asset_location.parents == self_location.parents {245 } else if asset_location.parents == self_location.parents {
248 match asset_location246 match asset_location
395 asset_instance: &AssetInstance,393 asset_instance: &AssetInstance,
396 from: T::CrossAccountId,394 from: T::CrossAccountId,
397 ) -> XcmResult {395 ) -> XcmResult {
398 let token_id = Self::asset_instance_to_token_id(collection_id, &asset_instance)?396 let token_id = Self::asset_instance_to_token_id(collection_id, asset_instance)?
399 .ok_or(XcmError::AssetNotFound)?;397 .ok_or(XcmError::AssetNotFound)?;
400398
401 if xcm_ext.token_has_children(token_id) {399 if xcm_ext.token_has_children(token_id) {
569 Fungible(u8),567 Fungible(u8),
570}568}
571569
572impl Into<CollectionMode> for ForeignCollectionMode {570impl From<ForeignCollectionMode> for CollectionMode {
573 fn into(self) -> CollectionMode {571 fn from(value: ForeignCollectionMode) -> Self {
574 match self {572 match value {
575 Self::NFT => CollectionMode::NFT,573 ForeignCollectionMode::NFT => Self::NFT,
576 Self::Fungible(decimals) => CollectionMode::Fungible(decimals),574 ForeignCollectionMode::Fungible(decimals) => Self::Fungible(decimals),
577 }575 }
578 }576 }
579}577}
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
470 up_data_structs::CreateItemData::Fungible(fungible_data) => {470 up_data_structs::CreateItemData::Fungible(fungible_data) => {
471 <Pallet<T>>::create_multiple_items(471 <Pallet<T>>::create_multiple_items(
472 self,472 self,
473 &depositor,473 depositor,
474 [(to, fungible_data.value)].into_iter().collect(),474 [(to, fungible_data.value)].into_iter().collect(),
475 nesting_budget,475 nesting_budget,
476 )?476 )?
495 <CommonError<T>>::FungibleItemsHaveNoId495 <CommonError<T>>::FungibleItemsHaveNoId
496 );496 );
497497
498 <Pallet<T>>::transfer_internal(self, &depositor, &from, &to, amount, nesting_budget)498 <Pallet<T>>::transfer_internal(self, depositor, from, to, amount, nesting_budget)
499 .map(|_| ())499 .map(|_| ())
500 .map_err(|post_info| post_info.error)500 .map_err(|post_info| post_info.error)
501 }501 }
506 token: TokenId,506 token: TokenId,
507 amount: u128,507 amount: u128,
508 ) -> sp_runtime::DispatchResult {508 ) -> sp_runtime::DispatchResult {
509 <Self as CommonCollectionOperations<T>>::burn_item(&self, from, token, amount)509 <Self as CommonCollectionOperations<T>>::burn_item(self, from, token, amount)
510 .map(|_| ())510 .map(|_| ())
511 .map_err(|post_info| post_info.error)511 .map_err(|post_info| post_info.error)
512 }512 }
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
585 ) -> Result<TokenId, sp_runtime::DispatchError> {585 ) -> Result<TokenId, sp_runtime::DispatchError> {
586 <Pallet<T>>::create_multiple_items(586 <Pallet<T>>::create_multiple_items(
587 self,587 self,
588 &depositor,588 depositor,
589 vec![map_create_data::<T>(data, &to)?],589 vec![map_create_data::<T>(data, &to)?],
590 nesting_budget,590 nesting_budget,
591 )?;591 )?;
604 ) -> sp_runtime::DispatchResult {604 ) -> sp_runtime::DispatchResult {
605 ensure!(amount == 1, <Error<T>>::NonfungibleItemsHaveNoAmount);605 ensure!(amount == 1, <Error<T>>::NonfungibleItemsHaveNoAmount);
606606
607 <Pallet<T>>::transfer_internal(self, &depositor, &from, &to, token, nesting_budget)607 <Pallet<T>>::transfer_internal(self, depositor, from, to, token, nesting_budget)
608 .map(|_| ())608 .map(|_| ())
609 .map_err(|post_info| post_info.error)609 .map_err(|post_info| post_info.error)
610 }610 }
modifiedruntime/common/config/pallets/foreign_asset.rsdiffbeforeafterboth
26{26{
27 fn convert_location(location: &MultiLocation) -> Option<ConfigCrossAccountId> {27 fn convert_location(location: &MultiLocation) -> Option<ConfigCrossAccountId> {
28 LocationToAccountId::convert_location(location)28 LocationToAccountId::convert_location(location)
29 .map(|sub| ConfigCrossAccountId::from_sub(sub))29 .map(ConfigCrossAccountId::from_sub)
30 .or_else(|| {30 .or_else(|| {
31 let eth_address =31 let eth_address =
32 AccountKey20Aliases::<RelayNetwork, H160>::convert_location(location)?;32 AccountKey20Aliases::<RelayNetwork, H160>::convert_location(location)?;