Skip to content

Commit

Permalink
revert serde change
Browse files Browse the repository at this point in the history
Signed-off-by: Charles Ferrell <[email protected]>
  • Loading branch information
ferrell-code committed Apr 23, 2024
1 parent b28287b commit 18e79c8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pallets/pallet-lottery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function_name = { workspace = true }
jsonrpsee = { workspace = true, features = ["server", "macros"], optional = true }
log = { workspace = true }
scale-info = { workspace = true }
serde = { workspace = true, optional = true }
serde = { workspace = true }

# Substrate dependencies
frame-support = { workspace = true }
Expand Down
4 changes: 1 addition & 3 deletions pallets/pallet-lottery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ pub mod pallet {
use manta_primitives::types::PoolId;
use orml_traits::MultiCurrency;
use pallet_parachain_staking::BalanceOf;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
use sp_arithmetic::traits::SaturatedConversion;
use sp_core::U256;
Expand Down Expand Up @@ -278,8 +277,7 @@ pub mod pallet {
pub(super) type StakedCollators<T: Config> =
StorageMap<_, Blake2_128Concat, T::AccountId, BalanceOf<T>, ValueQuery>;

#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(Clone, Copy, Encode, Decode, TypeInfo, Default)]
#[derive(Clone, Copy, Encode, Decode, TypeInfo, Default, Serialize, Deserialize)]
pub struct FarmingParams<T: Default + Copy> {
pub mint_farming_token: bool,
pub destroy_farming_token: bool,
Expand Down
2 changes: 1 addition & 1 deletion pallets/parachain-staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version.workspace = true

[dependencies]
log = { workspace = true }
serde = { workspace = true, optional = true }
serde = { workspace = true }

# Substrate
codec = { workspace = true }
Expand Down
20 changes: 15 additions & 5 deletions pallets/parachain-staking/src/inflation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use crate::pallet::{BalanceOf, Config, Pallet};
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::traits::Currency;
use scale_info::TypeInfo;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
use sp_runtime::{PerThing, Perbill, RuntimeDebug};
use substrate_fixed::{transcendental::pow as floatpow, types::I64F64};
Expand All @@ -33,9 +32,19 @@ fn rounds_per_year<T: Config>() -> u32 {
BLOCKS_PER_YEAR / blocks_per_round
}

#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(
Eq, PartialEq, Clone, Copy, Encode, Decode, Default, RuntimeDebug, MaxEncodedLen, TypeInfo,
Eq,
PartialEq,
Clone,
Copy,
Encode,
Decode,
Default,
RuntimeDebug,
MaxEncodedLen,
TypeInfo,
Serialize,
Deserialize,
)]
pub struct Range<T> {
pub min: T,
Expand Down Expand Up @@ -97,8 +106,9 @@ pub fn round_issuance_range<T: Config>(round: Range<Perbill>) -> Range<BalanceOf
}
}

#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Encode, Decode, Default, RuntimeDebug, TypeInfo)]
#[derive(
Eq, PartialEq, Clone, Encode, Decode, Default, RuntimeDebug, TypeInfo, Serialize, Deserialize,
)]
pub struct InflationInfo<Balance> {
/// Staking expectations
pub expect: Range<Balance>,
Expand Down
6 changes: 3 additions & 3 deletions pallets/parachain-staking/src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
/* TODO: use orml_utilities::OrderedSet without leaking substrate v2.0 dependencies*/
use codec::{Decode, Encode};
use scale_info::TypeInfo;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
use sp_runtime::RuntimeDebug;
use sp_std::prelude::*;

/// An ordered set backed by `Vec`
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(RuntimeDebug, PartialEq, Eq, Encode, Decode, Default, Clone, TypeInfo)]
#[derive(
RuntimeDebug, PartialEq, Eq, Encode, Decode, Default, Clone, TypeInfo, Serialize, Deserialize,
)]
pub struct OrderedSet<T>(pub Vec<T>);

impl<T: Ord> OrderedSet<T> {
Expand Down

0 comments on commit 18e79c8

Please sign in to comment.