Skip to content

Commit

Permalink
Comprehensive funding end tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JuaniRios committed May 24, 2024
1 parent 89d340a commit 34508c8
Show file tree
Hide file tree
Showing 6 changed files with 335 additions and 59 deletions.
1 change: 1 addition & 0 deletions integration-tests/src/tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ fn ct_minted() {
excel_contributions(),
excel_remainders(),
);
dbg!(inst.get_project_details(project_id).funding_amount_reached_usd);
inst.advance_time(<PolitestRuntime as Config>::SuccessToSettlementTime::get()).unwrap();

inst.settle_project(project_id).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions pallets/funding/src/functions/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ impl<T: Config> Pallet<T> {
}

/// Computes the total fee from all defined fee brackets.
fn compute_total_fee_from_brackets(funding_reached: BalanceOf<T>) -> BalanceOf<T> {
pub fn compute_total_fee_from_brackets(funding_reached: BalanceOf<T>) -> BalanceOf<T> {
let mut remaining_for_fee = funding_reached;

T::FeeBrackets::get()
Expand All @@ -420,7 +420,7 @@ impl<T: Config> Pallet<T> {
}

/// Calculate the fee for a particular bracket.
fn compute_fee_for_bracket(
pub fn compute_fee_for_bracket(
remaining_for_fee: &mut BalanceOf<T>,
fee: Percent,
limit: BalanceOf<T>,
Expand Down
2 changes: 1 addition & 1 deletion pallets/funding/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ parameter_types! {
pub const FundingPalletId: PalletId = PalletId(*b"py/cfund");
pub FeeBrackets: Vec<(Percent, Balance)> = vec![
(Percent::from_percent(10), 1_000_000 * USD_UNIT),
(Percent::from_percent(8), 5_000_000 * USD_UNIT),
(Percent::from_percent(8), 4_000_000 * USD_UNIT),
(Percent::from_percent(6), u128::MAX), // Making it max signifies the last bracket
];
pub EarlyEvaluationThreshold: Percent = Percent::from_percent(10);
Expand Down
Loading

0 comments on commit 34508c8

Please sign in to comment.