Questions tagged [generics]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
56 views

How to implement the `Get` trait for a `Pallet<T>`?

I'm writing a pallet that implements evm::executor::stack::PrecompileSet. The goal is to use this pallet in conjunction with Frontier's pallet-evm, which has the following types in its Config trait: ...
Bernardo Rodrigues's user avatar
1 vote
1 answer
85 views

How to create a RuntimeCall with custom values and submit it to the utility pallet's batch function?

I have a custom pallet that is tightly coupled to the utility pallet. I am trying to call the batch function to perform a batch of balance transfers. The tests of the utility pallet (that create ...
Paul Neale's user avatar
1 vote
1 answer
114 views

Type casting to trait. T as Config

this is rust-based question. In Substrate code, there are lots of type casting. For example, for the BalanceOf type alias, <<T as Config>::Currency as Currency<<T as frame_system::...
coco_yoon's user avatar
4 votes
1 answer
94 views

How does `#[codec(mel_bound())]` work?

When declaring types, with generic parameters, to be stored in runtime storage, it’s common to see this pattern #[derive(Encode, Decode, MaxEncodedLen, TypeInfo)] pub struct MyItem<TypeA, TypeB> ...
Angelo's user avatar
  • 451
5 votes
1 answer
350 views

Cannot infer type for type parameter 'T'

I have a function using the following 2 types: pub type BalanceOf<T> = <<T as pallet::Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance; pub ...
Kazunobu Ndong's user avatar