2

Pallet token:

  #[pallet::config]
   pub trait Config: frame_system::Config + pallet_balances::Config {

       type TokenId: Member
           + Parameter
           + AtLeast32BitUnsigned
           + Default
           + PartialEq
           + Copy
           + Codec
           + MaybeSerializeDeserialize;
   }

This is function with the type parameters

        pub fn do_mint(
            token: T::TokenId,
            beneficiary: &T::AccountId,
            amount: BalanceOf<T>,
            _maybe_check_issuer: Option<T::AccountId>,
        ) -> DispatchResult 

The benchmarking code.

        where         
        T: pallet_token::Config,
        let token : T::TokenId = 1;
        pallet_token::Pallet::<T>::mint_into(
            token,
            &ferdie,
            10000000.into(),
        )?;

result:

  --> pallet-verifier/src/benchmarking.rs:87:15
   |
87 |             1.into(),
   |               ^^^^ the trait `std::convert::From<i32>` is not implemented for `<T as pallet_fuso_token::Config>::TokenId`
   |
   = note: required because of the requirements on the impl of `std::convert::Into<<T as pallet_fuso_token::Config>::TokenId>` for `i32`

2 Answers 2

5

This should work:

let token: T::TokenId = 1u32;
1
  • --> pallet-fuso-verifier/src/benchmarking.rs:86:34 | 86 | let token : T::TokenId = 1u32; | ---------- ^^^^ expected associated type, found u32 | | | expected due to this | = note: expected associated type <T as pallet_fuso_token::Config>::TokenId found type u32
    – Ben2077
    Commented Apr 3, 2022 at 0:42
5

The error message is very clear

the trait std::convert::From<i32> is not implemented for <T as pallet_fuso_token::Config>::TokenId

i.e. It doesn't know how to convert i32 to TokenId

Your TokenId is AtLeast32BitUnsigned which implements From<u32> so the solution is simple, make it u32 instead of i32.

1u32.into()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.