Attribute Macro frame_support::pallet_macros::compact
source · #[compact]
Expand description
Declares the arguments of a call
function to be encoded using
[codec::Compact
].
This will results in smaller extrinsic encoding.
A common example of compact
is for numeric values that are often times far far away
from their theoretical maximum. For example, in the context of a crypto-currency, the
balance of an individual account is oftentimes way less than what the numeric type
allows. In all such cases, using compact
is sensible.
#[frame_support::pallet(dev_mode)]
pub mod custom_pallet {
#[pallet::call]
impl<T: Config> Pallet<T> {
pub fn some_dispatchable(_origin: OriginFor<T>, #[pallet::compact] _input: u32) -> DispatchResult {
Ok(())
}
}
}
---
Documentation for this macro can be found at `frame_support::pallet_macros::compact`.