Skip to content

Commit

Permalink
chore(240): fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
JuaniRios committed Aug 10, 2023
1 parent 6658e89 commit e0c87be
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 28 deletions.
1 change: 0 additions & 1 deletion pallets/funding/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,6 @@ impl<T: Config> Pallet<T> {
let project_details = ProjectsDetails::<T>::get(project_id).ok_or(Error::<T>::ProjectInfoNotFound)?;
let mut bid = Bids::<T>::get((project_id, bidder.clone(), bid_id)).ok_or(Error::<T>::BidNotFound)?;


// * Validity checks *
ensure!(
project_details.status == ProjectStatus::FundingSuccessful &&
Expand Down
1 change: 0 additions & 1 deletion pallets/funding/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,6 @@ fn issuer_funding_payout_one_bid<T: Config>(project_id: T::ProjectIdentifier) ->
}),
};
(Weight::zero(), remaining_bids.count() as u64)

} else {
(Weight::zero(), 0u64)
}
Expand Down
47 changes: 21 additions & 26 deletions pallets/funding/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2965,61 +2965,56 @@ mod auction_round_success {
let remainder_contributions = vec![];

let finished_project = FinishedProject::new_with(
&test_env,
project,
issuer,
evaluations,
bids,
community_contributions,
remainder_contributions,
&test_env,
project,
issuer,
evaluations,
bids,
community_contributions,
remainder_contributions,
);
let project_id = finished_project.get_project_id();
let final_bid_payouts = test_env.in_ext(|| {
Bids::<TestRuntime>::iter_prefix_values((finished_project.project_id,))
.map(|bid| (bid.bidder, bid.funding_asset_amount_locked, bid.funding_asset.to_statemint_id()))
.collect::<UserToStatemintAsset>()
});
let total_expected_bid_payout = final_bid_payouts.iter().map(|bid| bid.1.clone()).sum::<BalanceOf<TestRuntime>>();
let total_expected_bid_payout =
final_bid_payouts.iter().map(|bid| bid.1.clone()).sum::<BalanceOf<TestRuntime>>();

let prev_issuer_funding_balance = test_env.get_free_statemint_asset_balances_for(
final_bid_payouts[0].2,
vec![issuer.clone()],
)[0].1;
let prev_issuer_funding_balance =
test_env.get_free_statemint_asset_balances_for(final_bid_payouts[0].2, vec![issuer.clone()])[0].1;
let prev_bidders_funding_balances = test_env.get_free_statemint_asset_balances_for(
final_bid_payouts[0].2,
final_bid_payouts.iter().map(|(acc, _, _)| acc.clone()).collect::<Vec<_>>(),
);
let prev_total_bidder_balance = prev_bidders_funding_balances
.iter()
.map(|(_, balance, _)| balance)
.sum::<BalanceOf<TestRuntime>>();
let prev_total_bidder_balance =
prev_bidders_funding_balances.iter().map(|(_, balance, _)| balance).sum::<BalanceOf<TestRuntime>>();
let prev_project_pot_funding_balance = test_env.get_free_statemint_asset_balances_for(
final_bid_payouts[0].2,
vec![Pallet::<TestRuntime>::fund_account_id(project_id)],
)[0].1;
)[0]
.1;

test_env.advance_time(<TestRuntime as Config>::SuccessToSettlementTime::get() + 1).unwrap();
assert_eq!(
finished_project.get_project_details().cleanup,
Cleaner::Success(CleanerState::Finished(PhantomData))
);

let post_issuer_funding_balance = test_env.get_free_statemint_asset_balances_for(
final_bid_payouts[0].2,
vec![issuer.clone()],
)[0].1;
let post_issuer_funding_balance =
test_env.get_free_statemint_asset_balances_for(final_bid_payouts[0].2, vec![issuer.clone()])[0].1;
let post_bidders_funding_balances = test_env.get_free_statemint_asset_balances_for(
final_bid_payouts[0].2,
final_bid_payouts.iter().map(|(acc, _, _)| acc.clone()).collect::<Vec<_>>(),
);
let post_total_bidder_balance = post_bidders_funding_balances
.iter()
.map(|(_, balance, _)| balance)
.sum::<BalanceOf<TestRuntime>>();
let post_total_bidder_balance =
post_bidders_funding_balances.iter().map(|(_, balance, _)| balance).sum::<BalanceOf<TestRuntime>>();
let post_project_pot_funding_balance = test_env.get_free_statemint_asset_balances_for(
final_bid_payouts[0].2,
vec![Pallet::<TestRuntime>::fund_account_id(project_id)],
)[0].1;
)[0]
.1;

let issuer_funding_delta = post_issuer_funding_balance - prev_issuer_funding_balance;
let bidders_funding_delta = prev_total_bidder_balance - post_total_bidder_balance;
Expand Down

0 comments on commit e0c87be

Please sign in to comment.