mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 05:11:09 +00:00
Add tipping into treasury (#4480)
* First draft * Initial work on tests * Add tests. * Ensure old members can't tip. * Fix complexity * Update node runtime * Build fix. * build fix * Fix tests * Fix tests * Refactor Contains impl for tests * Introduce new way to avoid impl Contains conflicts * Fixes * Docs. * Docs. * Typo * Whitespace * Docs * Typo * Formatting * Update frame/treasury/src/lib.rs Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com> * Update frame/treasury/src/lib.rs Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com> * Update frame/treasury/src/lib.rs Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com> * Apply suggestions from code review Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com> * Add provisional weights. Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
committed by
Shawn Tabrizi
parent
586685fca0
commit
67202b7ec3
@@ -117,6 +117,31 @@ macro_rules! parameter_types {
|
||||
}
|
||||
}
|
||||
|
||||
/// Macro for easily creating a new implementation of both the `Get` and `Contains` traits. Use
|
||||
/// exactly as with `parameter_types`, only the type must be `Ord`.
|
||||
#[macro_export]
|
||||
macro_rules! ord_parameter_types {
|
||||
(
|
||||
$( #[ $attr:meta ] )*
|
||||
$vis:vis const $name:ident: $type:ty = $value:expr;
|
||||
$( $rest:tt )*
|
||||
) => (
|
||||
$( #[ $attr ] )*
|
||||
$vis struct $name;
|
||||
$crate::parameter_types!{IMPL $name , $type , $value}
|
||||
$crate::ord_parameter_types!{IMPL $name , $type , $value}
|
||||
$crate::ord_parameter_types!{ $( $rest )* }
|
||||
);
|
||||
() => ();
|
||||
(IMPL $name:ident , $type:ty , $value:expr) => {
|
||||
impl $crate::traits::Contains<$type> for $name {
|
||||
fn contains(t: &$type) -> bool { &$value == t }
|
||||
fn sorted_members() -> $crate::sp_std::prelude::Vec<$type> { vec![$value] }
|
||||
fn count() -> usize { 1 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(inline)]
|
||||
pub use frame_support_procedural::{decl_storage, construct_runtime};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user