Skip to content

Commit

Permalink
Remove unused ProposalBond parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
chungquantin committed Mar 25, 2024
1 parent 1a3d5f1 commit 3d26a92
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 27 deletions.
2 changes: 1 addition & 1 deletion substrate/frame/treasury/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn setup_proposal<T: Config<I>, I: 'static>(
u: u32,
) -> (T::AccountId, BalanceOf<T, I>, AccountIdLookupOf<T>) {
let caller = account("caller", u, SEED);
let value: BalanceOf<T, I> = T::ProposalBondMinimum::get().saturating_mul(100u32.into());
let value: BalanceOf<T, I> = 100u32.try_into().ok().unwrap();
let _ = T::Currency::make_free_balance_be(&caller, value);
let beneficiary = account("beneficiary", u, SEED);
let beneficiary_lookup = T::Lookup::unlookup(beneficiary);
Expand Down
22 changes: 0 additions & 22 deletions substrate/frame/treasury/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,19 +213,6 @@ pub mod pallet {
/// Handler for the unbalanced decrease when slashing for a rejected proposal or bounty.
type OnSlash: OnUnbalanced<NegativeImbalanceOf<Self, I>>;

/// Fraction of a proposal's value that should be bonded in order to place the proposal.
/// An accepted proposal gets these back. A rejected proposal does not.
#[pallet::constant]
type ProposalBond: Get<Permill>;

/// Minimum amount of funds that should be placed in a deposit for making a proposal.
#[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<BlockNumberFor<Self>>;
Expand Down Expand Up @@ -806,15 +793,6 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
T::PalletId::get().into_account_truncating()
}

/// The needed bond for a proposal whose spend is `value`.
fn calculate_bond(value: BalanceOf<T, I>) -> BalanceOf<T, I> {
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.
pub fn spend_funds() -> Weight {
let mut total_weight = Weight::zero();
Expand Down
4 changes: 0 additions & 4 deletions substrate/frame/treasury/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ impl Pay for TestPay {
}

parameter_types! {
pub const ProposalBond: Permill = Permill::from_percent(5);
pub const Burn: Permill = Permill::from_percent(50);
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
pub TreasuryAccount: u128 = Treasury::account_id();
Expand Down Expand Up @@ -178,9 +177,6 @@ impl Config for Test {
type RejectOrigin = frame_system::EnsureRoot<u128>;
type RuntimeEvent = RuntimeEvent;
type OnSlash = ();
type ProposalBond = ProposalBond;
type ProposalBondMinimum = ConstU64<1>;
type ProposalBondMaximum = ();
type SpendPeriod = ConstU64<2>;
type Burn = Burn;
type BurnDestination = (); // Just gets burned.
Expand Down

0 comments on commit 3d26a92

Please sign in to comment.