From 6836ed8e83a865f79883fd3391dcbbe0b3304223 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Rios <54085674+JuaniRios@users.noreply.github.com> Date: Mon, 30 Sep 2024 14:47:27 +0200 Subject: [PATCH] Update types.rs --- pallets/funding/src/functions/6_settlement.rs | 17 ++++++++++------- pallets/funding/src/types.rs | 2 +- runtimes/polimec/src/lib.rs | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/pallets/funding/src/functions/6_settlement.rs b/pallets/funding/src/functions/6_settlement.rs index f70854b1e..86b3e938f 100644 --- a/pallets/funding/src/functions/6_settlement.rs +++ b/pallets/funding/src/functions/6_settlement.rs @@ -172,6 +172,8 @@ impl Pallet { let BidRefund { final_ct_usd_price, final_ct_amount, refunded_plmc, refunded_funding_asset_amount } = Self::calculate_refund(&bid, funding_success, wap)?; + Self::release_funding_asset(project_id, &bid.bidder, refunded_funding_asset_amount, bid.funding_asset)?; + if bid.mode == ParticipationMode::OTM { >::refund_fee( project_id, @@ -183,7 +185,7 @@ impl Pallet { } else { Self::release_participation_bond_for(&bid.bidder, refunded_plmc)?; } - Self::release_funding_asset(project_id, &bid.bidder, refunded_funding_asset_amount, bid.funding_asset)?; + if funding_success && bid.status != BidStatus::Rejected { let ct_vesting_duration = Self::set_plmc_bond_release_with_mode( @@ -264,6 +266,13 @@ impl Pallet { let funding_end_block = project_details.funding_end_block.ok_or(Error::::ImpossibleState)?; if outcome == FundingOutcome::Failure { + Self::release_funding_asset( + project_id, + &contribution.contributor, + contribution.funding_asset_amount, + contribution.funding_asset, + )?; + if contribution.mode == ParticipationMode::OTM { >::refund_fee( project_id, @@ -276,12 +285,6 @@ impl Pallet { Self::release_participation_bond_for(&contribution.contributor, contribution.plmc_bond)?; } - Self::release_funding_asset( - project_id, - &contribution.contributor, - contribution.funding_asset_amount, - contribution.funding_asset, - )?; } else { let ct_vesting_duration = Self::set_plmc_bond_release_with_mode( contribution.contributor.clone(), diff --git a/pallets/funding/src/types.rs b/pallets/funding/src/types.rs index 434801f3c..d2d016714 100644 --- a/pallets/funding/src/types.rs +++ b/pallets/funding/src/types.rs @@ -807,7 +807,7 @@ pub mod inner { pub enum ParticipationMode { /// One Token Model. User only needs funding assets, and pays a fee to bond treasury PLMC. OTM, - /// Normal model. User needs to bond PLMC based on a multiplier, and pays no fee. + /// Classic model. User needs to bond PLMC based on a multiplier, and pays no extra fee. Classic(u8), } impl ParticipationMode { diff --git a/runtimes/polimec/src/lib.rs b/runtimes/polimec/src/lib.rs index 3518df340..07a92449d 100644 --- a/runtimes/polimec/src/lib.rs +++ b/runtimes/polimec/src/lib.rs @@ -1083,7 +1083,7 @@ use polimec_common::{PLMC_DECIMALS, PLMC_FOREIGN_ID, USD_DECIMALS}; parameter_types! { // Fee is defined as 1.5% of the usd_amount. Since fee is applied to the plmc amount, and that is always 5 times // less than the usd_amount (multiplier of 5), we multiply the 1.5 by 5 to get 7.5% - pub const FeePercentage: Perbill = Perbill::from_percent(5); + pub FeePercentage: Perbill = Perbill::from_rational(75u32, 1000u32); // TODO: add a real account here pub FeeRecipient: AccountId = [0u8; 32].into(); pub const RootId: PalletId = PalletId(*b"treasury");