Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

avoid breaking change on asset id #12774

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,7 @@ impl pallet_assets::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Balance = u128;
type AssetId = u32;
type AssetIdParameter = codec::Compact<u32>;
type Currency = Balances;
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
type ForceOrigin = EnsureRoot<AccountId>;
Expand Down
5 changes: 4 additions & 1 deletion frame/assets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ pub mod pallet {
/// Identifier for the class of asset.
type AssetId: Member + Parameter + Copy + MaybeSerializeDeserialize + MaxEncodedLen;

type AssetIdParameter: Parameter + Copy + Into<Self::AssetId> + From<Self::AssetId>;

/// The currency mechanism.
type Currency: ReservableCurrency<Self::AccountId>;

Expand Down Expand Up @@ -554,10 +556,11 @@ pub mod pallet {
#[pallet::call_index(30)]
pub fn create(
origin: OriginFor<T>,
id: T::AssetId,
id: T::AssetIdParameter,
admin: AccountIdLookupOf<T>,
min_balance: T::Balance,
) -> DispatchResult {
let id: T::AssetId = id.into();
let owner = T::CreateOrigin::ensure_origin(origin, &id)?;
let admin = T::Lookup::lookup(admin)?;

Expand Down