mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Allow the treasury to have a maximum bound on the bond (#10689)
* Allow the treasury to have a maximum bound on the bond * Update frame/treasury/src/lib.rs Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
@@ -168,6 +168,10 @@ pub mod pallet {
|
||||
#[pallet::constant]
|
||||
type ProposalBondMinimum: Get<BalanceOf<Self, I>>;
|
||||
|
||||
/// Maximum amount of funds that should be placed in a deposit for making a proposal.
|
||||
#[pallet::constant]
|
||||
type ProposalBondMaximum: Get<Option<BalanceOf<Self, I>>>;
|
||||
|
||||
/// Period between successive spends.
|
||||
#[pallet::constant]
|
||||
type SpendPeriod: Get<Self::BlockNumber>;
|
||||
@@ -404,7 +408,11 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
|
||||
/// The needed bond for a proposal whose spend is `value`.
|
||||
fn calculate_bond(value: BalanceOf<T, I>) -> BalanceOf<T, I> {
|
||||
T::ProposalBondMinimum::get().max(T::ProposalBond::get() * value)
|
||||
let mut r = T::ProposalBondMinimum::get().max(T::ProposalBond::get() * value);
|
||||
if let Some(m) = T::ProposalBondMaximum::get() {
|
||||
r = r.min(m);
|
||||
}
|
||||
r
|
||||
}
|
||||
|
||||
/// Spend some money! returns number of approvals before spend.
|
||||
|
||||
@@ -115,6 +115,7 @@ impl Config for Test {
|
||||
type OnSlash = ();
|
||||
type ProposalBond = ProposalBond;
|
||||
type ProposalBondMinimum = ConstU64<1>;
|
||||
type ProposalBondMaximum = ();
|
||||
type SpendPeriod = ConstU64<2>;
|
||||
type Burn = Burn;
|
||||
type BurnDestination = (); // Just gets burned.
|
||||
|
||||
Reference in New Issue
Block a user