1

I have struct that holds when it's created as BlockNumber.

#[derive(Encode, Decode, Default, Clone, PartialEq, RuntimeDebug, TypeInfo)]
#[scale_info(skip_type_params(BlockTime, MaxContentLength))]
pub struct Listing<BlockNumber, MaxContentLength: Get<u32>> {
    pub is_active: bool,
    pub content: Content<MaxContentLength>,
    pub created: BlockNumber,
    pub updated: Option<BlockNumber>,
}

And I'm trying to set it like this but getting an error saying type argument T not allowed.

Listings::<T>::insert(
    &property,
    &who,
    Listing {
        is_active: is_active.unwrap_or(false),
        content,
        created: frame_system::<T>::Pallet::current_block_number(),
        updated: None,
    },
);

error[E0109]: type arguments are not allowed for this type
  --> pallets/listing/src/lib.rs:87:30
   |
87 |                     created: frame_system::<T>::Pallet::current_block_number(),
   |                                             ^ type argument not allowed

For more information about this error, try `rustc --explain E0109`.
error: could not compile `pallet-listing` due to previous error

1 Answer 1

3

Try this:

Listings::<T>::insert(
    &property,
    &who,
    Listing {
        is_active: is_active.unwrap_or(false),
        content,
        created: frame_system::Pallet::<T>::current_block_number(),
        updated: None,
    },
);
1
  • That was a silly mistake, ^^. Thanks for the answer
    – Burak
    Commented Aug 22, 2022 at 19:38

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.