Skip to main content

Questions tagged [generics]

The tag has no usage guidance.

0 votes
1 answer
33 views

facing unconstrained type parameter issue

I'm using fresh node template and trying to implement below code: #[pallet::storage] pub type Author<T: Config> = StorageValue<_, sr25519::Public, OptionQuery>; pub struct ...
Deepak Chaudhary's user avatar
1 vote
1 answer
62 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
2 votes
1 answer
159 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
207 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::...
Raf's user avatar
  • 139
6 votes
1 answer
140 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
  • 501
5 votes
1 answer
772 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