Skip to content

Commit

Permalink
Cleanup unused RegistryQueryForEvm
Browse files Browse the repository at this point in the history
  • Loading branch information
vgantchev committed Nov 7, 2023
1 parent 23f862b commit 0afe548
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 37 deletions.
28 changes: 1 addition & 27 deletions pallets/asset-registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub use pallet::*;

pub use crate::types::{AssetDetails, AssetMetadata};
use frame_support::BoundedVec;
use hydradx_traits::{AssetKind, CreateRegistry, InspectRegistry, Registry, RegistryQueryForEvm, ShareTokenRegistry};
use hydradx_traits::{AssetKind, CreateRegistry, InspectRegistry, Registry, ShareTokenRegistry};

#[frame_support::pallet]
pub mod pallet {
Expand Down Expand Up @@ -551,32 +551,6 @@ impl<T: Config> Pallet<T> {
}
}

impl<T: Config> RegistryQueryForEvm<T::AssetId, T::StringLimit, DispatchError> for Pallet<T> {
fn retrieve_asset_name(id: T::AssetId) -> Result<BoundedVec<u8, <T as Config>::StringLimit>, DispatchError> {
if let Some(details) = Assets::<T>::get(id) {
Ok(details.name)
} else {
Err(Error::<T>::AssetNotFound.into())
}
}

fn retrieve_asset_symbol(id: T::AssetId) -> Result<BoundedVec<u8, <T as Config>::StringLimit>, DispatchError> {
if let Some(meta) = AssetMetadataMap::<T>::get(id) {
Ok(meta.symbol)
} else {
Err(Error::<T>::AssetNotFound.into())
}
}

fn retrieve_asset_decimals(id: T::AssetId) -> Result<u8, DispatchError> {
if let Some(meta) = AssetMetadataMap::<T>::get(id) {
Ok(meta.decimals)
} else {
Err(Error::<T>::AssetNotFound.into())
}
}
}

impl<T: Config> Registry<T::AssetId, Vec<u8>, T::Balance, DispatchError> for Pallet<T> {
fn exists(asset_id: T::AssetId) -> bool {
Assets::<T>::contains_key(asset_id)
Expand Down
1 change: 0 additions & 1 deletion runtime/hydradx/src/evm/precompiles/multicurrency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ use crate::{
};
use codec::EncodeLike;
use frame_support::traits::OriginTrait;
use hydradx_traits::RegistryQueryForEvm;
use num_enum::{IntoPrimitive, TryFromPrimitive};
use orml_traits::{MultiCurrency as MultiCurrencyT, MultiCurrency};
use pallet_evm::{AddressMapping, ExitRevert, Precompile, PrecompileFailure, PrecompileHandle, PrecompileResult};
Expand Down
9 changes: 0 additions & 9 deletions traits/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ pub trait Registry<AssetId, AssetName, Balance, Error> {
}
}
}

pub trait RegistryQueryForEvm<AssetId, NameStringLimit, Error> {
fn retrieve_asset_name(name: AssetId) -> Result<BoundedVec<u8, NameStringLimit>, Error>;

fn retrieve_asset_symbol(name: AssetId) -> Result<BoundedVec<u8, NameStringLimit>, Error>;

fn retrieve_asset_decimals(name: AssetId) -> Result<u8, Error>;
}

// Use CreateRegistry if possible
pub trait ShareTokenRegistry<AssetId, AssetName, Balance, Error>: Registry<AssetId, AssetName, Balance, Error> {
fn retrieve_shared_asset(name: &AssetName, assets: &[AssetId]) -> Result<AssetId, Error>;
Expand Down

0 comments on commit 0afe548

Please sign in to comment.