Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Reif <Garandor@manta.network>
  • Loading branch information
Adam Reif authored and Adam Reif committed Apr 4, 2023
1 parent b72881e commit 6ad4586
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions pallets/asset-manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ pub mod pallet {
};
use frame_system::pallet_prelude::*;
use manta_primitives::assets::{
self, AssetConfig, AssetIdLocationMap, AssetIdType, AssetMetadata, AssetStorageMetadata, AssetRegistry,
FungibleLedger, LocationType,
self, AssetConfig, AssetIdLocationMap, AssetIdType, AssetMetadata, AssetRegistry,
AssetStorageMetadata, FungibleLedger, LocationType,
};
use orml_traits::GetByKey;
use sp_runtime::{
Expand Down Expand Up @@ -351,10 +351,7 @@ pub mod pallet {
!LocationAssetId::<T>::contains_key(&location),
Error::<T>::LocationAlreadyExists
);
ensure!(
Self::contains(&location),
Error::<T>::LocationNotSupported
);
ensure!(Self::contains(&location), Error::<T>::LocationNotSupported);
let asset_id = Self::next_asset_id_and_increment()?;
<T::AssetConfig as AssetConfig<T>>::AssetRegistry::create_asset(
asset_id,
Expand Down Expand Up @@ -406,10 +403,7 @@ pub mod pallet {
!LocationAssetId::<T>::contains_key(&location),
Error::<T>::LocationAlreadyExists
);
ensure!(
Self::contains(&location),
Error::<T>::LocationNotSupported
);
ensure!(Self::contains(&location), Error::<T>::LocationNotSupported);
// change the ledger state.
let old_location =
AssetIdLocation::<T>::get(asset_id).ok_or(Error::<T>::UpdateNonExistentAsset)?;
Expand Down Expand Up @@ -461,8 +455,7 @@ pub mod pallet {
origin: OriginFor<T>,
asset_id: T::AssetId,
metadata: <<T as Config>::AssetConfig as AssetConfig<T>>::StorageMetadata,
) -> DispatchResult
{
) -> DispatchResult {
T::ModifierOrigin::ensure_origin(origin)?;
ensure!(
asset_id != <T::AssetConfig as AssetConfig<T>>::NativeAssetId::get(),
Expand All @@ -476,10 +469,10 @@ pub mod pallet {
&asset_id,
metadata.clone().into(),
)?;
let new_metadata = AssetIdMetadata::<T>::try_mutate(asset_id, |registry_metadata|{
let new_metadata = AssetIdMetadata::<T>::try_mutate(asset_id, |registry_metadata| {
if let Some(meta) = *registry_metadata {
meta.metadata = metadata.clone().into();
Ok(meta)
meta.metadata = metadata.clone().into();
Ok(meta)
} else {
Err(Error::<T>::UpdateNonExistentAsset.into())
}
Expand Down

0 comments on commit 6ad4586

Please sign in to comment.