Skip to content

Commit

Permalink
Renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
andor0 committed Jan 26, 2022
1 parent 12e35bb commit b44e1de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions frame/assets-registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub mod pallet {
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode, TypeInfo)]
pub struct Metadata {
pub struct ForeignMetadata {
pub decimals: u8,
}

Expand Down Expand Up @@ -120,10 +120,10 @@ pub mod pallet {
>;

#[pallet::storage]
#[pallet::getter(fn asset_metadata)]
/// Mapping local asset to asset metadata.
pub type AssetMetadata<T: Config> =
StorageMap<_, Blake2_128Concat, T::LocalAssetId, Metadata, OptionQuery>;
#[pallet::getter(fn foreign_asset_metadata)]
/// Mapping local asset to foreign asset metadata.
pub type ForeignAssetMetadata<T: Config> =
StorageMap<_, Blake2_128Concat, T::LocalAssetId, ForeignMetadata, OptionQuery>;

#[pallet::type_value]
pub fn LocalAdminOnEmpty<T: Config>() -> T::AccountId {
Expand Down Expand Up @@ -244,16 +244,16 @@ pub mod pallet {
pub fn set_metadata(
origin: OriginFor<T>,
local_asset_id: T::LocalAssetId,
metadata: Metadata,
metadata: ForeignMetadata,
) -> DispatchResultWithPostInfo {
let _who = ensure_signed(origin.clone())?;
let _ = ensure_signed(origin.clone())?;
Self::ensure_admins_only(origin)?;
ensure!(
<LocalToForeign<T>>::contains_key(local_asset_id),
Error::<T>::LocalAssetIdNotFound
);

<AssetMetadata<T>>::insert(local_asset_id, metadata);
<ForeignAssetMetadata<T>>::insert(local_asset_id, metadata);
Self::deposit_event(Event::AssetMetadataUpdated(local_asset_id));
Ok(().into())
}
Expand Down
4 changes: 2 additions & 2 deletions frame/assets-registry/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fn set_metadata_tests() {
AssetsRegistry::set_metadata(
Origin::signed(ALICE),
local_asset_id,
Metadata { decimals: 12 }
ForeignMetadata { decimals: 12 }
),
Error::<Test>::LocalAssetIdNotFound
);
Expand All @@ -128,7 +128,7 @@ fn set_metadata_tests() {
assert_ok!(AssetsRegistry::set_metadata(
Origin::signed(ALICE),
local_asset_id,
Metadata { decimals: 12 }
ForeignMetadata { decimals: 12 }
));
})
}

0 comments on commit b44e1de

Please sign in to comment.