Skip to content

Commit

Permalink
simplifications part 3
Browse files Browse the repository at this point in the history
  • Loading branch information
JuaniRios committed Jul 22, 2024
1 parent 3e4fb18 commit 447b78a
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions pallets/funding/src/functions/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,6 @@ impl<T: Config> Pallet<T> {
let project_details = ProjectsDetails::<T>::get(project_id).ok_or(Error::<T>::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,
Expand Down Expand Up @@ -286,20 +283,16 @@ impl<T: Config> Pallet<T> {
let details = ProjectsDetails::<T>::get(project_id).ok_or(Error::<T>::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);
let inverse_percentage_of_target_funding = Perquintill::from_percent(100) - percentage_of_target_funding;

let liquidity_pools_percentage = Perquintill::from_percent(50);
let liquidity_pools_reward_pot = liquidity_pools_percentage * total_fee_allocation;

let long_term_holder_percentage = if percentage_of_target_funding < Perquintill::from_percent(90) {
Perquintill::from_percent(50)
} else {
Perquintill::from_percent(20) + Perquintill::from_percent(30) * inverse_percentage_of_target_funding
Perquintill::from_percent(20)
};
let long_term_holder_reward_pot = long_term_holder_percentage * total_fee_allocation;

Expand Down Expand Up @@ -350,7 +343,7 @@ impl<T: Config> Pallet<T> {
) -> Xcm<()> {
// TODO: adjust this as benchmarks for polimec-receiver are written
const MAX_WEIGHT: Weight = Weight::from_parts(10_000, 0);
const MAX_RESPONSE_WEIGHT: Weight = Weight::from_parts(1_000_000_000, 50_000);
const MAX_RESPONSE_WEIGHT: Weight = Weight::from_parts(700_000_000, 10_000);
let migrations_item = Migrations::from(migrations.into());

// First byte is the pallet index, second byte is the call index
Expand Down

0 comments on commit 447b78a

Please sign in to comment.