mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 16:51:03 +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:
@@ -880,6 +880,7 @@ impl pallet_treasury::Config for Runtime {
|
|||||||
type OnSlash = ();
|
type OnSlash = ();
|
||||||
type ProposalBond = ProposalBond;
|
type ProposalBond = ProposalBond;
|
||||||
type ProposalBondMinimum = ProposalBondMinimum;
|
type ProposalBondMinimum = ProposalBondMinimum;
|
||||||
|
type ProposalBondMaximum = ();
|
||||||
type SpendPeriod = SpendPeriod;
|
type SpendPeriod = SpendPeriod;
|
||||||
type Burn = Burn;
|
type Burn = Burn;
|
||||||
type BurnDestination = ();
|
type BurnDestination = ();
|
||||||
|
|||||||
@@ -199,6 +199,7 @@ As mentioned above, Bounties, Tips and Lottery have been extracted out of treasu
|
|||||||
type OnSlash = ();
|
type OnSlash = ();
|
||||||
type ProposalBond = ProposalBond;
|
type ProposalBond = ProposalBond;
|
||||||
type ProposalBondMinimum = ProposalBondMinimum;
|
type ProposalBondMinimum = ProposalBondMinimum;
|
||||||
|
type ProposalBondMaximum = ();
|
||||||
type SpendPeriod = SpendPeriod;
|
type SpendPeriod = SpendPeriod;
|
||||||
type Burn = Burn;
|
type Burn = Burn;
|
||||||
+ type BurnDestination = ();
|
+ type BurnDestination = ();
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ impl pallet_treasury::Config for Test {
|
|||||||
type OnSlash = ();
|
type OnSlash = ();
|
||||||
type ProposalBond = ProposalBond;
|
type ProposalBond = ProposalBond;
|
||||||
type ProposalBondMinimum = ConstU64<1>;
|
type ProposalBondMinimum = ConstU64<1>;
|
||||||
|
type ProposalBondMaximum = ();
|
||||||
type SpendPeriod = ConstU64<2>;
|
type SpendPeriod = ConstU64<2>;
|
||||||
type Burn = Burn;
|
type Burn = Burn;
|
||||||
type BurnDestination = (); // Just gets burned.
|
type BurnDestination = (); // Just gets burned.
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ impl pallet_treasury::Config for Test {
|
|||||||
type OnSlash = ();
|
type OnSlash = ();
|
||||||
type ProposalBond = ProposalBond;
|
type ProposalBond = ProposalBond;
|
||||||
type ProposalBondMinimum = ConstU64<1>;
|
type ProposalBondMinimum = ConstU64<1>;
|
||||||
|
type ProposalBondMaximum = ();
|
||||||
type SpendPeriod = ConstU64<2>;
|
type SpendPeriod = ConstU64<2>;
|
||||||
type Burn = Burn;
|
type Burn = Burn;
|
||||||
type BurnDestination = ();
|
type BurnDestination = ();
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ impl pallet_treasury::Config for Test {
|
|||||||
type OnSlash = ();
|
type OnSlash = ();
|
||||||
type ProposalBond = ProposalBond;
|
type ProposalBond = ProposalBond;
|
||||||
type ProposalBondMinimum = ConstU64<1>;
|
type ProposalBondMinimum = ConstU64<1>;
|
||||||
|
type ProposalBondMaximum = ();
|
||||||
type SpendPeriod = ConstU64<2>;
|
type SpendPeriod = ConstU64<2>;
|
||||||
type Burn = Burn;
|
type Burn = Burn;
|
||||||
type BurnDestination = (); // Just gets burned.
|
type BurnDestination = (); // Just gets burned.
|
||||||
|
|||||||
@@ -168,6 +168,10 @@ pub mod pallet {
|
|||||||
#[pallet::constant]
|
#[pallet::constant]
|
||||||
type ProposalBondMinimum: Get<BalanceOf<Self, I>>;
|
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.
|
/// Period between successive spends.
|
||||||
#[pallet::constant]
|
#[pallet::constant]
|
||||||
type SpendPeriod: Get<Self::BlockNumber>;
|
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`.
|
/// The needed bond for a proposal whose spend is `value`.
|
||||||
fn calculate_bond(value: BalanceOf<T, I>) -> BalanceOf<T, I> {
|
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.
|
/// Spend some money! returns number of approvals before spend.
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ impl Config for Test {
|
|||||||
type OnSlash = ();
|
type OnSlash = ();
|
||||||
type ProposalBond = ProposalBond;
|
type ProposalBond = ProposalBond;
|
||||||
type ProposalBondMinimum = ConstU64<1>;
|
type ProposalBondMinimum = ConstU64<1>;
|
||||||
|
type ProposalBondMaximum = ();
|
||||||
type SpendPeriod = ConstU64<2>;
|
type SpendPeriod = ConstU64<2>;
|
||||||
type Burn = Burn;
|
type Burn = Burn;
|
||||||
type BurnDestination = (); // Just gets burned.
|
type BurnDestination = (); // Just gets burned.
|
||||||
|
|||||||
Reference in New Issue
Block a user