Skip to content

Commit

Permalink
Update types.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
JuaniRios committed Oct 9, 2024
1 parent 7fdefed commit 6a561be
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
17 changes: 10 additions & 7 deletions pallets/funding/src/functions/6_settlement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ impl<T: Config> Pallet<T> {
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 {
<pallet_proxy_bonding::Pallet<T>>::refund_fee(
project_id,
Expand All @@ -183,7 +185,7 @@ impl<T: Config> Pallet<T> {
} 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(
Expand Down Expand Up @@ -264,6 +266,13 @@ impl<T: Config> Pallet<T> {
let funding_end_block = project_details.funding_end_block.ok_or(Error::<T>::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 {
<pallet_proxy_bonding::Pallet<T>>::refund_fee(
project_id,
Expand All @@ -276,12 +285,6 @@ impl<T: Config> Pallet<T> {
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(),
Expand Down
2 changes: 1 addition & 1 deletion pallets/funding/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion runtimes/polimec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 6a561be

Please sign in to comment.