Add HoldReason to the NIS pallet (#13823)

* Add HoldReason to the NIS pallet

* Rename composable_enum to composite_enum

* Add encoding test

* Add more doc comments
This commit is contained in:
Keith Yeung
2023-04-06 14:24:45 +08:00
committed by GitHub
parent 3ace2f50c5
commit 38f3b053d7
8 changed files with 27 additions and 9 deletions
@@ -35,6 +35,7 @@ pub fn expand_outer_freeze_reason(pallet_decls: &[Pallet], scrate: &TokenStream)
}
quote! {
/// A reason for placing a freeze on funds.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd,
#scrate::codec::Encode, #scrate::codec::Decode, #scrate::codec::MaxEncodedLen,
@@ -35,6 +35,7 @@ pub fn expand_outer_hold_reason(pallet_decls: &[Pallet], scrate: &TokenStream) -
}
quote! {
/// A reason for placing a hold on funds.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd,
#scrate::codec::Encode, #scrate::codec::Decode, #scrate::codec::MaxEncodedLen,
@@ -35,6 +35,7 @@ pub fn expand_outer_lock_id(pallet_decls: &[Pallet], scrate: &TokenStream) -> To
}
quote! {
/// An identifier for each lock placed on funds.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd,
#scrate::codec::Encode, #scrate::codec::Decode, #scrate::codec::MaxEncodedLen,
@@ -35,6 +35,7 @@ pub fn expand_outer_slash_reason(pallet_decls: &[Pallet], scrate: &TokenStream)
}
quote! {
/// A reason for slashing funds.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd,
#scrate::codec::Encode, #scrate::codec::Decode, #scrate::codec::MaxEncodedLen,
@@ -1412,7 +1412,7 @@ pub fn origin(_: TokenStream, _: TokenStream) -> TokenStream {
pallet_macro_stub()
}
/// The `#[pallet::composable_enum]` attribute allows you to define an enum that gets composed as an
/// The `#[pallet::composite_enum]` attribute allows you to define an enum that gets composed as an
/// aggregate enum by `construct_runtime`. This is similar in principle with `#[pallet::event]` and
/// `#[pallet::error]`.
///
@@ -1431,10 +1431,10 @@ pub fn origin(_: TokenStream, _: TokenStream) -> TokenStream {
/// ```
///
/// For ease of usage, when no `#[derive]` attributes are found for the enum under
/// `#[pallet::composable_enum]`, the aforementioned traits are automatically derived for it. The
/// `#[pallet::composite_enum]`, the aforementioned traits are automatically derived for it. The
/// inverse is also true: if there are any `#[derive]` attributes found for the enum, then no traits
/// will automatically be derived for it.
#[proc_macro_attribute]
pub fn composable_enum(_: TokenStream, _: TokenStream) -> TokenStream {
pub fn composite_enum(_: TokenStream, _: TokenStream) -> TokenStream {
pallet_macro_stub()
}