diff --git a/pallets/funding/src/functions/2_evaluation.rs b/pallets/funding/src/functions/2_evaluation.rs index aeb8ea11b..0297faa98 100644 --- a/pallets/funding/src/functions/2_evaluation.rs +++ b/pallets/funding/src/functions/2_evaluation.rs @@ -22,15 +22,15 @@ impl Pallet { // * Get variables * let project_metadata = ProjectsMetadata::::get(project_id).ok_or(Error::::ProjectMetadataNotFound)?; let mut project_details = ProjectsDetails::::get(project_id).ok_or(Error::::ProjectDetailsNotFound)?; - + // * Validity checks * ensure!(project_details.issuer_account == caller, Error::::NotIssuer); ensure!(!project_details.is_frozen, Error::::ProjectAlreadyFrozen); ensure!(project_metadata.policy_ipfs_cid.is_some(), Error::::CidNotProvided); - + // * Update storage * project_details.is_frozen = true; - + // * Transition Round * Self::transition_project( project_id, @@ -77,7 +77,8 @@ impl Pallet { // * Calculate new variables * let usd_total_amount_bonded = project_details.evaluation_round_info.total_bonded_usd; - let evaluation_target_usd = ::EvaluationSuccessThreshold::get() * project_details.fundraising_target_usd; + let evaluation_target_usd = + ::EvaluationSuccessThreshold::get() * project_details.fundraising_target_usd; // Check which logic path to follow let is_funded = usd_total_amount_bonded >= evaluation_target_usd; @@ -86,10 +87,10 @@ impl Pallet { // Successful path if is_funded { return Self::transition_project( - project_id, - project_details, - ProjectStatus::EvaluationRound, - ProjectStatus::AuctionInitializePeriod, + project_id, + project_details, + ProjectStatus::EvaluationRound, + ProjectStatus::AuctionInitializePeriod, T::AuctionInitializePeriodDuration::get(), false, ) diff --git a/pallets/funding/src/functions/3_auction.rs b/pallets/funding/src/functions/3_auction.rs index 69134c167..aa11a91f7 100644 --- a/pallets/funding/src/functions/3_auction.rs +++ b/pallets/funding/src/functions/3_auction.rs @@ -46,10 +46,11 @@ impl Pallet { pub fn do_end_auction(project_id: ProjectId) -> DispatchResultWithPostInfo { // * Get variables * let project_metadata = ProjectsMetadata::::get(project_id).ok_or(Error::::ProjectMetadataNotFound)?; - let bucket = Buckets::::get(project_id).ok_or(Error::::BucketNotFound)?; - + let bucket = Buckets::::get(project_id).ok_or(Error::::BucketNotFound)?; + // * Calculate WAP * - let auction_allocation_size = project_metadata.auction_round_allocation_percentage * project_metadata.total_allocation_size; + let auction_allocation_size = + project_metadata.auction_round_allocation_percentage * project_metadata.total_allocation_size; let weighted_token_price = bucket.calculate_wap(auction_allocation_size); // * Update Storage * @@ -149,10 +150,7 @@ impl Pallet { ensure!(ct_amount > Zero::zero(), Error::::TooLow); ensure!(did != project_details.issuer_did, Error::::ParticipationToOwnProject); - ensure!( - matches!(project_details.status, ProjectStatus::Auction), - Error::::IncorrectRound - ); + ensure!(matches!(project_details.status, ProjectStatus::Auction), Error::::IncorrectRound); ensure!( project_metadata.participation_currencies.contains(&funding_asset), Error::::FundingAssetNotAccepted @@ -240,8 +238,7 @@ impl Pallet { ensure!(total_bids_for_project < T::MaxBidsPerProject::get(), Error::::TooManyProjectParticipations); // * Calculate new variables * - let plmc_bond = - Self::calculate_plmc_bond(ticket_size, multiplier).map_err(|_| Error::::BadMath)?; + let plmc_bond = Self::calculate_plmc_bond(ticket_size, multiplier).map_err(|_| Error::::BadMath)?; let funding_asset_amount_locked = Self::calculate_funding_asset_amount(ticket_size, funding_asset)?; let new_bid = BidInfoOf:: { diff --git a/pallets/funding/src/functions/4_contribution.rs b/pallets/funding/src/functions/4_contribution.rs index c71bb3309..d106353dc 100644 --- a/pallets/funding/src/functions/4_contribution.rs +++ b/pallets/funding/src/functions/4_contribution.rs @@ -1,7 +1,6 @@ use super::*; impl Pallet { - /// Buy tokens in the Community Round at the price set in the Bidding Round /// /// # Arguments @@ -24,14 +23,14 @@ impl Pallet { ) -> DispatchResultWithPostInfo { let mut project_details = ProjectsDetails::::get(project_id).ok_or(Error::::ProjectDetailsNotFound)?; let did_has_winning_bid = DidWithWinningBids::::get(project_id, did.clone()); - + let remainder_start = match project_details.status { ProjectStatus::CommunityRound(remainder_start) => remainder_start, _ => return Err(Error::::IncorrectRound.into()), }; - + let now = >::block_number(); - let remainder_started = now > remainder_start; + let remainder_started = now >= remainder_start; let round_end = project_details.round_duration.end().ok_or(Error::::ImpossibleState)?; ensure!(!did_has_winning_bid || remainder_started, Error::::UserHasWinningBid); ensure!(now < round_end, Error::::TooLateForRound); @@ -104,7 +103,11 @@ impl Pallet { caller_existing_contributions.len() < T::MaxContributionsPerUser::get() as usize, Error::::TooManyUserParticipations ); - ensure!(contributor_ticket_size.usd_ticket_above_minimum_per_participation(ticket_size) || project_details.remaining_contribution_tokens.is_zero(), Error::::TooLow); + ensure!( + contributor_ticket_size.usd_ticket_above_minimum_per_participation(ticket_size) || + project_details.remaining_contribution_tokens.is_zero(), + Error::::TooLow + ); ensure!( contributor_ticket_size.usd_ticket_below_maximum_per_did(total_usd_bought_by_did + ticket_size), Error::::TooHigh diff --git a/pallets/funding/src/functions/5_funding_end.rs b/pallets/funding/src/functions/5_funding_end.rs index e4e47b8e2..7e445d9eb 100644 --- a/pallets/funding/src/functions/5_funding_end.rs +++ b/pallets/funding/src/functions/5_funding_end.rs @@ -65,29 +65,25 @@ impl Pallet { }; project_details.evaluation_round_info.evaluators_outcome = evaluator_outcome; - + let (next_status, duration, actual_weight) = if funding_ratio <= T::FundingSuccessThreshold::get() { - ( - ProjectStatus::FundingFailed, - 1u32.into(), - WeightInfoOf::::end_funding_automatically_rejected_evaluators_slashed(1) - ) - } else { - ( - ProjectStatus::FundingSuccessful, - T::SuccessToSettlementTime::get(), - WeightInfoOf::::end_funding_automatically_accepted_evaluators_rewarded(1,1) - ) + ( + ProjectStatus::FundingFailed, + 1u32.into(), + WeightInfoOf::::end_funding_automatically_rejected_evaluators_slashed(1), + ) + } else { + ( + ProjectStatus::FundingSuccessful, + T::SuccessToSettlementTime::get(), + WeightInfoOf::::end_funding_automatically_accepted_evaluators_rewarded(1, 1), + ) }; 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; - Ok(PostDispatchInfo { - actual_weight: Some(actual_weight), - pays_fee: Pays::Yes, - }) + Ok(PostDispatchInfo { actual_weight: Some(actual_weight), pays_fee: Pays::Yes }) } - } diff --git a/pallets/funding/src/functions/6_settlement.rs b/pallets/funding/src/functions/6_settlement.rs index af6168021..b17d63412 100644 --- a/pallets/funding/src/functions/6_settlement.rs +++ b/pallets/funding/src/functions/6_settlement.rs @@ -4,9 +4,9 @@ use frame_support::{ dispatch::DispatchResult, ensure, traits::{ - fungible::{MutateHold as FungibleMutateHold, Inspect as FungibleInspect}, - fungibles::{Inspect, Mutate as FungiblesMutate}, - tokens::{Fortitude, Precision, Preservation, Restriction, Provenance, DepositConsequence}, + fungible::{MutateHold as FungibleMutateHold}, + fungibles::{Mutate as FungiblesMutate}, + tokens::{Fortitude, Precision, Preservation, Restriction}, Get, }, }; @@ -192,7 +192,7 @@ impl Pallet { ensure!(T::ContributionTokenCurrency::asset_exists(project_id), Error::::TooEarlyForRound); let (refund_plmc, refund_funding_asset) = Self::calculate_refund(&bid)?; - + let bidder = bid.bidder; // Calculate the vesting info and add the release schedule let funding_end_block = project_details.funding_end_block.ok_or(Error::::ImpossibleState)?; @@ -222,7 +222,7 @@ impl Pallet { let new_funding_asset_amount_locked = bid.funding_asset_amount_locked.saturating_sub(refund_funding_asset); if refund_funding_asset > Zero::zero() { - Self::release_funding_asset(project_id, &bidder, refund_funding_asset , bid.funding_asset)?; + Self::release_funding_asset(project_id, &bidder, refund_funding_asset, bid.funding_asset)?; } // Payout the bid funding asset amount to the project account @@ -257,14 +257,19 @@ impl Pallet { /// Calculate the amount of funds the biider should receive back based on the original bid /// amount and price compared to the final bid amount and price. fn calculate_refund(bid: &BidInfoOf) -> Result<(BalanceOf, BalanceOf), DispatchError> { - let new_ticket_size = - bid.final_ct_usd_price.checked_mul_int(bid.final_ct_amount).ok_or(Error::::BadMath)?; - + let new_ticket_size = bid.final_ct_usd_price.checked_mul_int(bid.final_ct_amount).ok_or(Error::::BadMath)?; + let new_plmc_bond = Self::calculate_plmc_bond(new_ticket_size, bid.multiplier)?; let new_funding_asset_amount = Self::calculate_funding_asset_amount(new_ticket_size, bid.funding_asset)?; let refund_plmc = bid.plmc_bond.saturating_sub(new_plmc_bond); let refund_funding_asset = bid.funding_asset_amount_locked.saturating_sub(new_funding_asset_amount); - if T::FundingCurrency::can_deposit(bid.funding_asset.to_assethub_id(), &bid.bidder, refund_funding_asset, Provenance::Extant) != DepositConsequence::Success { + if T::FundingCurrency::can_deposit( + bid.funding_asset.to_assethub_id(), + &bid.bidder, + refund_funding_asset, + Provenance::Extant, + ) != DepositConsequence::Success + { refund_funding_asset = Zero::zero(); } if T::NativeCurrency::can_deposit(&bid.bidder, refund_plmc, Provenance::Extant) != DepositConsequence::Success { @@ -277,7 +282,8 @@ impl Pallet { pub fn do_settle_failed_bid(bid: BidInfoOf, project_id: ProjectId) -> DispatchResult { let project_details = ProjectsDetails::::get(project_id).ok_or(Error::::ProjectDetailsNotFound)?; ensure!( - matches!(project_details.status, ProjectStatus::SettlementStarted(FundingOutcome::FundingFailed)) || bid.status == BidStatus::Rejected, + matches!(project_details.status, ProjectStatus::SettlementStarted(FundingOutcome::FundingFailed)) || + bid.status == BidStatus::Rejected, Error::::FundingFailedSettlementNotStarted ); diff --git a/pallets/funding/src/functions/misc.rs b/pallets/funding/src/functions/misc.rs index 42343b88f..dccff35a5 100644 --- a/pallets/funding/src/functions/misc.rs +++ b/pallets/funding/src/functions/misc.rs @@ -15,7 +15,6 @@ impl Pallet { T::PalletId::get().into_sub_account_truncating(index.saturating_add(One::one())) } - pub fn create_bucket_from_metadata(metadata: &ProjectMetadataOf) -> Result, DispatchError> { let auction_allocation_size = metadata.auction_round_allocation_percentage * metadata.total_allocation_size; let bucket_delta_amount = Percent::from_percent(10) * auction_allocation_size; @@ -36,7 +35,11 @@ impl Pallet { let plmc_usd_price = T::PriceProvider::get_decimals_aware_price(PLMC_FOREIGN_ID, USD_DECIMALS, PLMC_DECIMALS) .ok_or(Error::::PriceNotFound)?; let usd_bond = multiplier.calculate_bonding_requirement::(ticket_size).map_err(|_| Error::::BadMath)?; - plmc_usd_price.reciprocal().ok_or(Error::::BadMath)?.checked_mul_int(usd_bond).ok_or(Error::::BadMath.into()) + plmc_usd_price + .reciprocal() + .ok_or(Error::::BadMath)? + .checked_mul_int(usd_bond) + .ok_or(Error::::BadMath.into()) } pub fn calculate_funding_asset_amount( @@ -45,13 +48,12 @@ impl Pallet { ) -> Result, DispatchError> { let asset_id = asset_id.to_assethub_id(); let asset_decimals = T::FundingCurrency::decimals(asset_id); - let asset_usd_price = - T::PriceProvider::get_decimals_aware_price(asset_id, USD_DECIMALS, asset_decimals) - .ok_or(Error::::PriceNotFound)?; + let asset_usd_price = T::PriceProvider::get_decimals_aware_price(asset_id, USD_DECIMALS, asset_decimals) + .ok_or(Error::::PriceNotFound)?; asset_usd_price - .reciprocal() - .and_then(|recip| recip.checked_mul_int(ticket_size)) - .ok_or(Error::::BadMath.into()) + .reciprocal() + .and_then(|recip| recip.checked_mul_int(ticket_size)) + .ok_or(Error::::BadMath.into()) } // Based on the amount of tokens and price to buy, a desired multiplier, and the type of investor the caller is, @@ -113,13 +115,12 @@ impl Pallet { .partition(|bid| matches!(bid.status, BidStatus::Accepted | BidStatus::PartiallyAccepted(..))); let accepted_bid_len = accepted_bids.len() as u32; - let total_auction_allocation_usd: BalanceOf = accepted_bids.into_iter() - .try_fold(Zero::zero(), |acc: BalanceOf, bid: BidInfoOf| { - bid.final_ct_usd_price.checked_mul_int(bid.final_ct_amount).and_then( - |ticket| acc.checked_add(&ticket) - ) - } - ).ok_or(Error::::BadMath)?; + let total_auction_allocation_usd: BalanceOf = accepted_bids + .into_iter() + .try_fold(Zero::zero(), |acc: BalanceOf, bid: BidInfoOf| { + bid.final_ct_usd_price.checked_mul_int(bid.final_ct_amount).and_then(|ticket| acc.checked_add(&ticket)) + }) + .ok_or(Error::::BadMath)?; ProjectsDetails::::mutate(project_id, |maybe_info| -> DispatchResult { if let Some(info) = maybe_info { @@ -134,7 +135,6 @@ impl Pallet { Ok((accepted_bid_len, rejected_bids.len() as u32)) } - pub fn try_plmc_participation_lock( who: &T::AccountId, project_id: ProjectId, @@ -248,10 +248,13 @@ impl Pallet { let project_details = ProjectsDetails::::get(project_id).ok_or(Error::::ProjectDetailsNotFound)?; let total_fee_allocation = Self::calculate_fee_allocation(project_id)?; - // Calculate the percentage of target funding based on available documentation. - // A.K.A variable "Y" in the documentation. We mean it to saturate to 1 even if the ratio is above 1 when funding raised - // is above the target. - let percentage_of_target_funding = Perquintill::from_rational(project_details.funding_amount_reached_usd, project_details.fundraising_target_usd); + // Calculate the percentage of target funding based on available documentation. + // A.K.A variable "Y" in the documentation. We mean it to saturate to 1 even if the ratio is above 1 when funding raised + // is above the target. + let percentage_of_target_funding = Perquintill::from_rational( + project_details.funding_amount_reached_usd, + project_details.fundraising_target_usd, + ); // Calculate rewards. let evaluator_rewards = percentage_of_target_funding * Perquintill::from_percent(30) * total_fee_allocation; @@ -263,7 +266,8 @@ impl Pallet { let normal_evaluator_total_bonded_usd = project_details.evaluation_round_info.total_bonded_usd; let early_evaluation_reward_threshold_usd = T::EvaluationSuccessThreshold::get() * project_details.fundraising_target_usd; - let early_evaluator_total_bonded_usd = normal_evaluator_total_bonded_usd.min(early_evaluation_reward_threshold_usd); + let early_evaluator_total_bonded_usd = + normal_evaluator_total_bonded_usd.min(early_evaluation_reward_threshold_usd); // Construct the reward information object. let reward_info = RewardInfo { @@ -282,10 +286,11 @@ impl Pallet { let details = ProjectsDetails::::get(project_id).ok_or(Error::::ProjectDetailsNotFound)?; let total_fee_allocation = Self::calculate_fee_allocation(project_id)?; - // Calculate the percentage of target funding based on available documentation. - // A.K.A variable "Y" in the documentation. We mean it to saturate to 1 even if the ratio is above 1 when funding raised - // is above the target. - let percentage_of_target_funding = Perquintill::from_rational(details.funding_amount_reached_usd, details.fundraising_target_usd); + // Calculate the percentage of target funding based on available documentation. + // A.K.A variable "Y" in the documentation. We mean it to saturate to 1 even if the ratio is above 1 when funding raised + // is above the target. + let percentage_of_target_funding = + Perquintill::from_rational(details.funding_amount_reached_usd, details.fundraising_target_usd); let inverse_percentage_of_target_funding = Perquintill::from_percent(100) - percentage_of_target_funding; let liquidity_pools_percentage = Perquintill::from_percent(50); @@ -409,15 +414,14 @@ impl Pallet { let now = >::block_number(); ensure!(project_details.round_duration.ended(now) || skip_end_check, Error::::TooEarlyForRound); ensure!(project_details.status == current_round, Error::::IncorrectRound); - - + let round_end = now.saturating_add(round_duration).saturating_sub(One::one()); project_details.round_duration.update(Some(now), Some(round_end)); project_details.status = next_round; - + // * Update storage * ProjectsDetails::::insert(project_id, project_details); - + // TODO: FIX event transmition by either doing it outside function or map ProjectStatus // -> ProjectPhase // * Emit events * diff --git a/pallets/funding/src/instantiator/chain_interactions.rs b/pallets/funding/src/instantiator/chain_interactions.rs index 998b8bb7a..567de7f06 100644 --- a/pallets/funding/src/instantiator/chain_interactions.rs +++ b/pallets/funding/src/instantiator/chain_interactions.rs @@ -689,11 +689,7 @@ impl< self.advance_time(1u32.into()).unwrap(); let project_details = self.get_project_details(project_id); assert!( - matches!( - project_details.status, - ProjectStatus::FundingSuccessful | - ProjectStatus::FundingFailed - ), + matches!(project_details.status, ProjectStatus::FundingSuccessful | ProjectStatus::FundingFailed), "Project should be in Finished status" ); if project_details.status == ProjectStatus::AwaitingProjectDecision { diff --git a/pallets/funding/src/lib.rs b/pallets/funding/src/lib.rs index e602dbbe1..1d41cf761 100644 --- a/pallets/funding/src/lib.rs +++ b/pallets/funding/src/lib.rs @@ -469,7 +469,6 @@ pub mod pallet { /// StorageMap containing additional information for the projects, relevant for correctness of the protocol pub type ProjectsDetails = StorageMap<_, Blake2_128Concat, ProjectId, ProjectDetailsOf>; - #[pallet::storage] /// Keep track of the PLMC bonds made to each project by each evaluator pub type Evaluations = StorageNMap< @@ -853,11 +852,7 @@ pub mod pallet { /// Starts the evaluation round of a project. It needs to be called by the project issuer. #[pallet::call_index(3)] #[pallet::weight(WeightInfoOf::::start_evaluation(1))] - pub fn start_evaluation( - origin: OriginFor, - jwt: UntrustedToken, - project_id: ProjectId, - ) -> DispatchResult { + pub fn start_evaluation(origin: OriginFor, jwt: UntrustedToken, project_id: ProjectId) -> DispatchResult { let (account, _did, investor_type, _cid) = T::InvestorOrigin::ensure_origin(origin, &jwt, T::VerifierPublicKey::get())?; ensure!(investor_type == InvestorType::Institutional, Error::::WrongInvestorType); @@ -869,11 +864,7 @@ pub mod pallet { /// Any bids from this point until the auction_closing starts, will be considered as valid. #[pallet::call_index(4)] #[pallet::weight(WeightInfoOf::::start_auction_manually(1))] - pub fn start_auction( - origin: OriginFor, - jwt: UntrustedToken, - project_id: ProjectId, - ) -> DispatchResult { + pub fn start_auction(origin: OriginFor, jwt: UntrustedToken, project_id: ProjectId) -> DispatchResult { let (account, _did, investor_type, _cid) = T::InvestorOrigin::ensure_origin(origin, &jwt, T::VerifierPublicKey::get())?; ensure!(investor_type == InvestorType::Institutional, Error::::WrongInvestorType); @@ -899,7 +890,7 @@ pub mod pallet { #[pallet::call_index(6)] #[pallet::weight(WeightInfoOf::::end_evaluation_success( - 1, + 1, ))] pub fn root_do_evaluation_end(origin: OriginFor, project_id: ProjectId) -> DispatchResult { ensure_root(origin)?; @@ -939,19 +930,19 @@ pub mod pallet { #[pallet::call_index(10)] #[pallet::weight(WeightInfoOf::::end_auction_closing( - 1, - ::MaxBidsPerProject::get() / 2, - ::MaxBidsPerProject::get() / 2, + 1, + ::MaxBidsPerProject::get() / 2, + ::MaxBidsPerProject::get() / 2, ) .max(WeightInfoOf::::end_auction_closing( - 1, - ::MaxBidsPerProject::get(), - 0u32, + 1, + ::MaxBidsPerProject::get(), + 0u32, )) .max(WeightInfoOf::::end_auction_closing( - 1, - 0u32, - ::MaxBidsPerProject::get(), + 1, + 0u32, + ::MaxBidsPerProject::get(), )))] pub fn root_do_end_auction(origin: OriginFor, project_id: ProjectId) -> DispatchResultWithPostInfo { ensure_root(origin)?; @@ -974,32 +965,22 @@ pub mod pallet { let (account, did, investor_type, whitelisted_policy) = T::InvestorOrigin::ensure_origin(origin, &jwt, T::VerifierPublicKey::get())?; - Self::do_contribute( - &account, - project_id, - amount, - multiplier, - asset, - did, - investor_type, - whitelisted_policy, - ) + Self::do_contribute(&account, project_id, amount, multiplier, asset, did, investor_type, whitelisted_policy) } #[pallet::call_index(15)] #[pallet::weight(WeightInfoOf::::end_funding_automatically_rejected_evaluators_slashed( - 1, + 1, ) .max(WeightInfoOf::::end_funding_automatically_accepted_evaluators_rewarded( - 1, - ::MaxEvaluationsPerProject::get(), + 1, + ::MaxEvaluationsPerProject::get(), )))] pub fn root_do_end_funding(origin: OriginFor, project_id: ProjectId) -> DispatchResultWithPostInfo { ensure_root(origin)?; Self::do_end_funding(project_id) } - #[pallet::call_index(18)] #[pallet::weight(WeightInfoOf::::start_settlement_funding_success() .max(WeightInfoOf::::start_settlement_funding_failure()))] diff --git a/pallets/funding/src/tests/misc.rs b/pallets/funding/src/tests/misc.rs index 2d558c2e4..602680a52 100644 --- a/pallets/funding/src/tests/misc.rs +++ b/pallets/funding/src/tests/misc.rs @@ -223,7 +223,6 @@ mod helper_functions { #[test] fn bucket_wap_calculation() { - let initial_price = FixedU128::from_float(10.0); let mut bucket = Bucket::new(100u32, initial_price, FixedU128::from_float(1.0), 10u32); let wap = bucket.calculate_wap(100u32); diff --git a/pallets/funding/src/types.rs b/pallets/funding/src/types.rs index eb65bbd9f..ddae6c917 100644 --- a/pallets/funding/src/types.rs +++ b/pallets/funding/src/types.rs @@ -498,15 +498,16 @@ pub mod storage_types { price = price.saturating_sub(self.delta_price); amount = self.delta_amount; } - + if total_amount > Balance::zero() { bucket_sizes.push((self.initial_price.saturating_mul_int(total_amount), self.initial_price)); } let sum = bucket_sizes.iter().map(|x| x.0).fold(Balance::zero(), |acc, x| acc.saturating_add(x)); - let wap = bucket_sizes.into_iter() - .map(|x| ::saturating_from_rational(x.0, sum).saturating_mul(x.1) ) + let wap = bucket_sizes + .into_iter() + .map(|x| ::saturating_from_rational(x.0, sum).saturating_mul(x.1)) .fold(Price::zero(), |acc: Price, p: Price| acc.saturating_add(p)); return wap @@ -714,8 +715,6 @@ pub mod inner_types { FundingFailed, } - - #[derive(Default, Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, MaxEncodedLen, TypeInfo)] pub struct BlockNumberPair { pub start: Option, @@ -771,7 +770,6 @@ pub mod inner_types { PartiallyAccepted(Balance), } - #[derive(Clone, Copy, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo, MaxEncodedLen)] pub struct VestingInfo { pub total_amount: Balance, diff --git a/runtimes/polimec/src/benchmarks/mod.rs b/runtimes/polimec/src/benchmarks/mod.rs index 8c7349dd1..33f8b68c9 100644 --- a/runtimes/polimec/src/benchmarks/mod.rs +++ b/runtimes/polimec/src/benchmarks/mod.rs @@ -27,8 +27,7 @@ fn output_max_pallet_funding_values() { let start_evaluation = SubstrateWeight::::start_evaluation(1); dbg!(start_evaluation); - let start_auction_manually = - SubstrateWeight::::start_auction_manually(1); + let start_auction_manually = SubstrateWeight::::start_auction_manually(1); dbg!(start_auction_manually); let evaluation = SubstrateWeight::::evaluation(max_evaluations_per_user - 1); @@ -40,10 +39,8 @@ fn output_max_pallet_funding_values() { let contribution = SubstrateWeight::::contribution(max_contributions_per_user); dbg!(contribution); - let contribution_ends_round = SubstrateWeight::::contribution_ends_round( - max_contributions_per_user - 1, - 1, - ); + let contribution_ends_round = + SubstrateWeight::::contribution_ends_round(max_contributions_per_user - 1, 1); dbg!(contribution_ends_round); let settle_successful_evaluation = SubstrateWeight::::settle_successful_evaluation(); @@ -64,52 +61,34 @@ fn output_max_pallet_funding_values() { let settle_failed_contribution = SubstrateWeight::::settle_failed_contribution(); dbg!(settle_failed_contribution); - let end_evaluation_success = - SubstrateWeight::::end_evaluation_success(1); + let end_evaluation_success = SubstrateWeight::::end_evaluation_success(1); dbg!(end_evaluation_success); - let end_evaluation_failure = - SubstrateWeight::::end_evaluation_failure(1); + let end_evaluation_failure = SubstrateWeight::::end_evaluation_failure(1); dbg!(end_evaluation_failure); - let start_auction_closing_phase = - SubstrateWeight::::start_auction_closing_phase(1); + let start_auction_closing_phase = SubstrateWeight::::start_auction_closing_phase(1); dbg!(start_auction_closing_phase); - let end_auction_closing = SubstrateWeight::::end_auction_closing( - 1, - max_bids_per_project, - 0, - ); + let end_auction_closing = SubstrateWeight::::end_auction_closing(1, max_bids_per_project, 0); dbg!(end_auction_closing); - let start_community_funding = SubstrateWeight::::start_community_funding( - 1, - max_bids_per_project, - 0, - ); + let start_community_funding = SubstrateWeight::::start_community_funding(1, max_bids_per_project, 0); dbg!(start_community_funding); - let start_remainder_funding = - SubstrateWeight::::start_remainder_funding(1); + let start_remainder_funding = SubstrateWeight::::start_remainder_funding(1); dbg!(start_remainder_funding); let end_funding_automatically_rejected_evaluators_slashed = - SubstrateWeight::::end_funding_automatically_rejected_evaluators_slashed( - 1, - ); + SubstrateWeight::::end_funding_automatically_rejected_evaluators_slashed(1); dbg!(end_funding_automatically_rejected_evaluators_slashed); let end_funding_awaiting_decision_evaluators_slashed = - SubstrateWeight::::end_funding_awaiting_decision_evaluators_slashed( - 1, - ); + SubstrateWeight::::end_funding_awaiting_decision_evaluators_slashed(1); dbg!(end_funding_awaiting_decision_evaluators_slashed); let end_funding_awaiting_decision_evaluators_unchanged = - SubstrateWeight::::end_funding_awaiting_decision_evaluators_unchanged( - 1, - ); + SubstrateWeight::::end_funding_awaiting_decision_evaluators_unchanged(1); dbg!(end_funding_awaiting_decision_evaluators_unchanged); let end_funding_automatically_accepted_evaluators_rewarded =