Skip to content

Commit

Permalink
choe(243): unused const removed
Browse files Browse the repository at this point in the history
feat(243): fmt

feat(243): fmt

feat(243): StorageItemId config type removed. We now always use u32

feat(249): Option no longer required for multipliers

fix(243): rebase error

chore(243): add import

feat(245): manual and automatic release of PLMC and funding assets implemented and tested

feat(247): manual and automatic release of PLMC and funding assets implemented and tested

feat(247): manual release implemented and tested

feat(247): automatic release implemented and tested

feat(247): automatic release implemented and tested

feat(248): manual release implemented and tested

feat(248): automatic release implemented and tested

wip

feat(242): small optimization

chore(242): fmt

feat(242): change week to day conversion on config type

feat(242): small changes from Leonardo's feedback

Update pallets/funding/src/types.rs

Co-authored-by: Leonardo Razovic <[email protected]>

feat(244): linear increase of duration based on vesting

wip
  • Loading branch information
JuaniRios committed Aug 25, 2023
1 parent fd6d268 commit 5e8ed75
Show file tree
Hide file tree
Showing 8 changed files with 238 additions and 306 deletions.
47 changes: 24 additions & 23 deletions pallets/funding/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@

//! Functions for the Funding pallet.

use super::*;
use sp_std::marker::PhantomData;

use crate::traits::{BondingRequirementCalculation, ProvideStatemintPrice, VestingDurationCalculation};
use frame_support::{
dispatch::DispatchResult,
ensure,
Expand All @@ -33,13 +29,18 @@ use frame_support::{
Get,
},
};

use sp_arithmetic::Perquintill;
use sp_arithmetic::{
traits::{CheckedDiv, CheckedSub, Zero},
Perquintill,
};
use sp_runtime::traits::Convert;
use sp_std::marker::PhantomData;

use polimec_traits::ReleaseSchedule;
use sp_arithmetic::traits::{CheckedDiv, CheckedSub, Zero};
use sp_runtime::traits::Convert;
use sp_std::prelude::*;

use crate::traits::{BondingRequirementCalculation, ProvideStatemintPrice, VestingDurationCalculation};

use super::*;

// Round transition functions
impl<T: Config> Pallet<T> {
Expand Down Expand Up @@ -769,7 +770,7 @@ impl<T: Config> Pallet<T> {
let mut project_details = ProjectsDetails::<T>::get(project_id).ok_or(Error::<T>::ProjectInfoNotFound)?;
let now = <frame_system::Pallet<T>>::block_number();
let evaluation_id = Self::next_evaluation_id();
let caller_existing_evaluations: Vec<(StorageItemIdOf<T>, EvaluationInfoOf<T>)> =
let caller_existing_evaluations: Vec<(u32, EvaluationInfoOf<T>)> =
Evaluations::<T>::iter_prefix((project_id, evaluator.clone())).collect();
let plmc_usd_price = T::PriceProvider::get_price(PLMC_STATEMINT_ID).ok_or(Error::<T>::PLMCPriceNotAvailable)?;
let early_evaluation_reward_threshold_usd =
Expand Down Expand Up @@ -1132,7 +1133,7 @@ impl<T: Config> Pallet<T> {
releaser: AccountIdOf<T>,
project_id: T::ProjectIdentifier,
bidder: AccountIdOf<T>,
bid_id: T::StorageItemId,
bid_id: u32,
) -> DispatchResult {
// * Get variables *
let mut bid = Bids::<T>::get((project_id, bidder.clone(), bid_id)).ok_or(Error::<T>::BidNotFound)?;
Expand Down Expand Up @@ -1167,7 +1168,7 @@ impl<T: Config> Pallet<T> {
releaser: AccountIdOf<T>,
project_id: T::ProjectIdentifier,
contributor: AccountIdOf<T>,
contribution_id: T::StorageItemId,
contribution_id: u32,
) -> DispatchResult {
// * Get variables *
let mut contribution = Contributions::<T>::get((project_id, contributor.clone(), contribution_id))
Expand Down Expand Up @@ -1202,7 +1203,7 @@ impl<T: Config> Pallet<T> {
releaser: AccountIdOf<T>,
project_id: T::ProjectIdentifier,
evaluator: AccountIdOf<T>,
evaluation_id: T::StorageItemId,
evaluation_id: u32,
) -> Result<(), DispatchError> {
// * Get variables *
let project_details = ProjectsDetails::<T>::get(project_id).ok_or(Error::<T>::ProjectInfoNotFound)?;
Expand Down Expand Up @@ -1244,7 +1245,7 @@ impl<T: Config> Pallet<T> {
caller: AccountIdOf<T>,
project_id: T::ProjectIdentifier,
evaluator: AccountIdOf<T>,
evaluation_id: StorageItemIdOf<T>,
evaluation_id: u32,
) -> Result<(), DispatchError> {
// * Get variables *
let project_details = ProjectsDetails::<T>::get(project_id).ok_or(Error::<T>::ProjectInfoNotFound)?;
Expand Down Expand Up @@ -1301,7 +1302,7 @@ impl<T: Config> Pallet<T> {
caller: AccountIdOf<T>,
project_id: T::ProjectIdentifier,
evaluator: AccountIdOf<T>,
evaluation_id: StorageItemIdOf<T>,
evaluation_id: u32,
) -> Result<(), DispatchError> {
// * Get variables *
let project_details = ProjectsDetails::<T>::get(project_id).ok_or(Error::<T>::ProjectInfoNotFound)?;
Expand Down Expand Up @@ -1355,7 +1356,7 @@ impl<T: Config> Pallet<T> {
caller: AccountIdOf<T>,
project_id: T::ProjectIdentifier,
bidder: AccountIdOf<T>,
bid_id: StorageItemIdOf<T>,
bid_id: u32,
) -> Result<(), DispatchError> {
// * Get variables *
let project_details = ProjectsDetails::<T>::get(project_id).ok_or(Error::<T>::ProjectInfoNotFound)?;
Expand Down Expand Up @@ -1401,7 +1402,7 @@ impl<T: Config> Pallet<T> {
caller: AccountIdOf<T>,
project_id: T::ProjectIdentifier,
contributor: AccountIdOf<T>,
contribution_id: StorageItemIdOf<T>,
contribution_id: u32,
) -> Result<(), DispatchError> {
// * Get variables *
let project_details = ProjectsDetails::<T>::get(project_id).ok_or(Error::<T>::ProjectInfoNotFound)?;
Expand Down Expand Up @@ -1473,7 +1474,7 @@ impl<T: Config> Pallet<T> {
caller: AccountIdOf<T>,
project_id: T::ProjectIdentifier,
bidder: AccountIdOf<T>,
bid_id: StorageItemIdOf<T>,
bid_id: u32,
) -> Result<(), DispatchError> {
// * Get variables *
let project_details = ProjectsDetails::<T>::get(project_id).ok_or(Error::<T>::ProjectInfoNotFound)?;
Expand Down Expand Up @@ -1518,7 +1519,7 @@ impl<T: Config> Pallet<T> {
caller: AccountIdOf<T>,
project_id: T::ProjectIdentifier,
bidder: AccountIdOf<T>,
bid_id: StorageItemIdOf<T>,
bid_id: u32,
) -> Result<(), DispatchError> {
// * Get variables *
let project_details = ProjectsDetails::<T>::get(project_id).ok_or(Error::<T>::ProjectInfoNotFound)?;
Expand Down Expand Up @@ -1551,7 +1552,7 @@ impl<T: Config> Pallet<T> {
caller: AccountIdOf<T>,
project_id: T::ProjectIdentifier,
contributor: AccountIdOf<T>,
contribution_id: StorageItemIdOf<T>,
contribution_id: u32,
) -> Result<(), DispatchError> {
// * Get variables *
let project_details = ProjectsDetails::<T>::get(project_id).ok_or(Error::<T>::ProjectInfoNotFound)?;
Expand Down Expand Up @@ -1593,7 +1594,7 @@ impl<T: Config> Pallet<T> {
caller: AccountIdOf<T>,
project_id: T::ProjectIdentifier,
contributor: AccountIdOf<T>,
contribution_id: StorageItemIdOf<T>,
contribution_id: u32,
) -> Result<(), DispatchError> {
// * Get variables *
let project_details = ProjectsDetails::<T>::get(project_id).ok_or(Error::<T>::ProjectInfoNotFound)?;
Expand Down Expand Up @@ -1627,7 +1628,7 @@ impl<T: Config> Pallet<T> {
caller: AccountIdOf<T>,
project_id: T::ProjectIdentifier,
bidder: AccountIdOf<T>,
bid_id: StorageItemIdOf<T>,
bid_id: u32,
) -> Result<(), DispatchError> {
// * Get variables *
let project_details = ProjectsDetails::<T>::get(project_id).ok_or(Error::<T>::ProjectInfoNotFound)?;
Expand Down Expand Up @@ -1673,7 +1674,7 @@ impl<T: Config> Pallet<T> {
caller: AccountIdOf<T>,
project_id: T::ProjectIdentifier,
contributor: AccountIdOf<T>,
contribution_id: StorageItemIdOf<T>,
contribution_id: u32,
) -> Result<(), DispatchError> {
// * Get variables *
let project_details = ProjectsDetails::<T>::get(project_id).ok_or(Error::<T>::ProjectInfoNotFound)?;
Expand Down
5 changes: 3 additions & 2 deletions pallets/funding/src/impls.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::{traits::DoRemainingOperation, *};
use frame_support::{traits::Get, weights::Weight};
use sp_runtime::{traits::AccountIdConversion, DispatchError};
use sp_std::{marker::PhantomData, prelude::*};
use sp_std::marker::PhantomData;

use crate::{traits::DoRemainingOperation, *};

impl Cleaner {
pub fn has_remaining_operations(&self) -> bool {
Expand Down
Loading

0 comments on commit 5e8ed75

Please sign in to comment.