0

I want to make a storage for the pallet but I'm getting this error

    /// The target parachains to ping.
#[pallet::storage]
pub type Targets<T:Config> = StorageValue<
    _,
    BoundedVec<(ParaId, BoundedVec<u8, MaxPayloadSize>), MaxParachains>,
    ValueQuery,
>;

And the Error

  error: Invalid generic declaration, trait is defined with instance but generic use none
  --> pallets/xnft/src/lib.rs:50:11
   |
50 |     pub type Targets<T:Config> = StorageValue<
   |              ^^^^^^^

1 Answer 1

0

It looks like your pallet supports multi-instances.

You need to add I to your storage items as well.

/// The target parachains to ping.
#[pallet::storage]
pub type Targets<T: Config, I: 'static = ()> = StorageValue<
    _,
    BoundedVec<(ParaId, BoundedVec<u8, MaxPayloadSize>), MaxParachains>,
    ValueQuery,
>;

Real world example:

https://github.com/paritytech/substrate/blob/4b6e735f0fab0c50f13e5b7f656512c101cacdeb/frame/balances/src/lib.rs#L372-L376.

/// The total units issued in the system.
#[pallet::storage]
#[pallet::getter(fn total_issuance)]
#[pallet::whitelist_storage]
pub type TotalIssuance<T: Config<I>, I: 'static = ()> = StorageValue<_, T::Balance, ValueQuery>;

Your Answer

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

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