Attribute Macro frame_support::pallet_macros::weight

source ·
Expand description

Allows specifying the weight of a call.

Each dispatchable needs to define a weight with the #[pallet::weight($expr)] attribute. The first argument must be origin: OriginFor<T>.


mod pallet {
	pub struct Pallet<T>(_);

	impl<T: Config> Pallet<T> {
		#[pallet::weight({0})] // <- set actual weight here
		pub fn something(
			_: OriginFor<T>,
			foo: u32,
		) -> DispatchResult {

Documentation for this macro can be found at frame_support::pallet_macros::weight.