Skip to content

Commit

Permalink
Simplifications part 5
Browse files Browse the repository at this point in the history
  • Loading branch information
JuaniRios committed Jul 26, 2024
1 parent 5d4ca77 commit 1f39ae7
Show file tree
Hide file tree
Showing 19 changed files with 11,704 additions and 11,888 deletions.
2 changes: 1 addition & 1 deletion pallets/funding/src/functions/1_application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl<T: Config> Pallet<T> {
evaluation_round_info: EvaluationRoundInfoOf::<T> {
total_bonded_usd: Zero::zero(),
total_bonded_plmc: Zero::zero(),
evaluators_outcome: EvaluatorsOutcome::Unchanged,
evaluators_outcome: None,
},
usd_bid_on_oversubscription: None,
funding_end_block: None,
Expand Down
17 changes: 6 additions & 11 deletions pallets/funding/src/functions/5_funding_end.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,17 @@ impl<T: Config> Pallet<T> {

// * Update Storage *
DidWithActiveProjects::<T>::set(issuer_did, None);
let evaluator_outcome = match funding_ratio {
ratio if ratio <= Perquintill::from_percent(75u64) => EvaluatorsOutcome::Slashed,
ratio if ratio < Perquintill::from_percent(90u64) => EvaluatorsOutcome::Unchanged,
_ => {
let reward_info = Self::generate_evaluator_rewards_info(project_id)?;
EvaluatorsOutcome::Rewarded(reward_info)
},
};

project_details.evaluation_round_info.evaluators_outcome = evaluator_outcome;

let (next_status, duration, actual_weight) = if funding_ratio <= T::FundingSuccessThreshold::get() {
let (next_status, duration, actual_weight) = if funding_ratio < T::FundingSuccessThreshold::get() {
project_details.evaluation_round_info.evaluators_outcome = Some(EvaluatorsOutcome::Slashed);
(
ProjectStatus::FundingFailed,
1u32.into(),
WeightInfoOf::<T>::end_funding_automatically_rejected_evaluators_slashed(1),
)
} else {
let reward_info = Self::generate_evaluator_rewards_info(project_id)?;
project_details.evaluation_round_info.evaluators_outcome = Some(EvaluatorsOutcome::Rewarded(reward_info));
(
ProjectStatus::FundingSuccessful,
T::SuccessToSettlementTime::get(),
Expand All @@ -83,6 +76,8 @@ impl<T: Config> Pallet<T> {
let round_end = now.saturating_add(duration).saturating_sub(One::one());
project_details.round_duration.update(Some(now), Some(round_end));
project_details.status = next_status;
ProjectsDetails::<T>::insert(project_id, project_details);
dbg!(&project_details);

Ok(PostDispatchInfo { actual_weight: Some(actual_weight), pays_fee: Pays::Yes })
}
Expand Down
Loading

0 comments on commit 1f39ae7

Please sign in to comment.