Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/plmc 243 remove tstorageitemid and replace it with hardcoded u32 #75

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading