Skip to content

Commit

Permalink
asset-registry: updated call_index of registre_external()
Browse files Browse the repository at this point in the history
  • Loading branch information
martinfridrich committed Oct 18, 2023
1 parent eb801d7 commit beb4446
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pallets/asset-registry/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use crate::types::AssetDetails;
use frame_benchmarking::{account, benchmarks};
use frame_system::RawOrigin;
use orml_traits::MultiCurrencyExtended;
use sp_std::vec;

const UNIT: u128 = 1_000_000_000_000;

Expand All @@ -34,7 +35,7 @@ benchmarks! {

register {
let asset_id= T::AssetId::from(3);
let name = vec![97u8; T::StringLimit::get() as usize];
let name = vec![97u8; T::StringLimit::get() as usize];
let ed = 1_000_000_u128;
let symbol = vec![97u8; T::StringLimit::get() as usize];
let decimals = 12_u8;
Expand Down
6 changes: 3 additions & 3 deletions pallets/asset-registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ pub mod pallet {
})
}

#[pallet::call_index(3)]
//NOTE: call indices 2 and 3 were used by removed extrinsics.
#[pallet::call_index(4)]
#[pallet::weight(<T as Config>::WeightInfo::register_external())]
pub fn register_external(origin: OriginFor<T>, location: T::AssetNativeLocation) -> DispatchResult {
let who = ensure_signed(origin)?;
Expand Down Expand Up @@ -498,8 +499,7 @@ impl<T: Config> Pallet<T> {
}

/// Convert Vec<u8> to BoundedVec so it respects the max set limit, otherwise return TooLong error
//TODO: remove pub
pub fn try_into_bounded(name: Option<Vec<u8>>) -> Result<Option<BoundedVec<u8, T::StringLimit>>, Error<T>> {
fn try_into_bounded(name: Option<Vec<u8>>) -> Result<Option<BoundedVec<u8, T::StringLimit>>, Error<T>> {
if let Some(name) = name {
TryInto::<BoundedVec<u8, T::StringLimit>>::try_into(name)
.map_err(|_| Error::<T>::TooLong)
Expand Down

0 comments on commit beb4446

Please sign in to comment.