Skip to content

Commit

Permalink
rustfmt: disable merge_derives
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Jan 18, 2022
1 parent 6285be7 commit 17d8f3c
Show file tree
Hide file tree
Showing 26 changed files with 137 additions and 282 deletions.
9 changes: 6 additions & 3 deletions pallets/bridge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ pub trait Config: multisig::Config + BalancesConfig + pallet_base::Config {

/// The status of a bridge transaction.
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(Encode, Decode, TypeInfo, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum BridgeTxStatus {
/// No such transaction in the system.
Absent,
Expand All @@ -172,7 +173,8 @@ impl Default for BridgeTxStatus {

/// A unique lock-and-mint bridge transaction.
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(Encode, Decode, TypeInfo, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Default)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Default)]
pub struct BridgeTx<Account> {
/// A single transaction hash can have multiple locks. This nonce differentiates between them.
pub nonce: u32,
Expand All @@ -186,7 +188,8 @@ pub struct BridgeTx<Account> {
}

/// Additional details of a bridge transaction.
#[derive(Encode, Decode, TypeInfo, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Default)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Default)]
pub struct BridgeTxDetail<BlockNumber> {
/// Amount of POLYX tokens to credit.
pub amount: Balance,
Expand Down
3 changes: 2 additions & 1 deletion pallets/common/src/protocol_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ use sp_runtime::Perbill;
use sp_runtime::{Deserialize, Serialize};

/// Protocol fee operations.
#[derive(Decode, Encode, TypeInfo, Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Decode, Encode, TypeInfo)]
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub enum ProtocolOp {
AssetRegisterTicker,
Expand Down
5 changes: 2 additions & 3 deletions pallets/common/src/traits/balances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ use scale_info::TypeInfo;
use sp_runtime::RuntimeDebug;
use sp_std::ops::BitOr;

#[derive(
Encode, Decode, TypeInfo, Default, Clone, PartialEq, Eq, PartialOrd, Ord, SliceU8StrongTyped,
)]
#[derive(Encode, Decode, TypeInfo, SliceU8StrongTyped)]
#[derive(Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct Memo(pub [u8; 32]);

// POLYMESH-NOTE: Make `AccountData` public to access it from the outside module.
Expand Down
3 changes: 2 additions & 1 deletion pallets/common/src/traits/checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use sp_runtime::{Deserialize, Serialize};

/// ID of a `StoredSchedule`.
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(Encode, Decode, TypeInfo, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Default)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Default)]
pub struct ScheduleId(pub u64);
impl_checked_inc!(ScheduleId);

Expand Down
20 changes: 8 additions & 12 deletions pallets/corporate-actions/src/ballot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,20 @@ type ExternalAgents<T> = pallet_external_agents::Module<T>;

/// A wrapper for a motion title.
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(
Clone, PartialEq, Eq, Hash, Default, Debug, Decode, Encode, TypeInfo, VecU8StrongTyped,
)]
#[derive(Encode, Decode, TypeInfo, VecU8StrongTyped)]
#[derive(Clone, PartialEq, Eq, Hash, Default, Debug)]
pub struct MotionTitle(pub Vec<u8>);

/// A wrapper for a motion info link.
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(
Clone, PartialEq, Eq, Hash, Default, Debug, Decode, Encode, TypeInfo, VecU8StrongTyped,
)]
#[derive(Encode, Decode, TypeInfo, VecU8StrongTyped)]
#[derive(Clone, PartialEq, Eq, Hash, Default, Debug)]
pub struct MotionInfoLink(pub Vec<u8>);

/// A wrapper for a choice's title.
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(
Clone, PartialEq, Eq, Hash, Default, Debug, Decode, Encode, TypeInfo, VecU8StrongTyped,
)]
#[derive(Encode, Decode, TypeInfo, VecU8StrongTyped)]
#[derive(Clone, PartialEq, Eq, Hash, Default, Debug)]
pub struct ChoiceTitle(pub Vec<u8>);

/// Details about motions
Expand All @@ -144,9 +141,8 @@ pub struct Motion {

/// A wrapper for a ballot's title.
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(
Clone, PartialEq, Eq, Hash, Debug, Default, Decode, Encode, TypeInfo, VecU8StrongTyped,
)]
#[derive(Encode, Decode, TypeInfo, VecU8StrongTyped)]
#[derive(Clone, PartialEq, Eq, Hash, Debug, Default)]
pub struct BallotTitle(pub Vec<u8>);

/// Metadata about a ballot.
Expand Down
3 changes: 2 additions & 1 deletion pallets/corporate-actions/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ impl CAKind {
}

#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(Clone, PartialEq, Eq, Encode, Decode, TypeInfo, Default, Debug, VecU8StrongTyped)]
#[derive(Encode, Decode, TypeInfo, VecU8StrongTyped)]
#[derive(Clone, PartialEq, Eq, Default, Debug)]
pub struct CADetails(pub Vec<u8>);

/// Defines how to identify a CA's associated checkpoint, if any.
Expand Down
41 changes: 10 additions & 31 deletions pallets/pips/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,41 +165,18 @@ pub trait WeightInfo {
}

/// A wrapper for a proposal url.
#[derive(
Decode,
Encode,
TypeInfo,
Clone,
Debug,
Default,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
VecU8StrongTyped,
)]
#[derive(Decode, Encode, TypeInfo, VecU8StrongTyped)]
#[derive(Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct Url(pub Vec<u8>);

/// A wrapper for a proposal description.
#[derive(
Decode,
Encode,
TypeInfo,
Clone,
Debug,
Default,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
VecU8StrongTyped,
)]
#[derive(Decode, Encode, TypeInfo, VecU8StrongTyped)]
#[derive(Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct PipDescription(pub Vec<u8>);

/// The global and unique identitifer of a Polymesh Improvement Proposal (PIP).
#[derive(Encode, Decode, TypeInfo, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default, Debug)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default, Debug)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct PipId(pub u32);
impl_checked_inc!(PipId);
Expand Down Expand Up @@ -249,7 +226,8 @@ pub enum VoteCount {

/// Either the entire proposal encoded as a byte vector or its hash. The latter represents large
/// proposals.
#[derive(Encode, Decode, TypeInfo, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub enum ProposalData {
/// The hash of the proposal.
Hash(H256),
Expand Down Expand Up @@ -364,7 +342,8 @@ pub struct DepositInfo<AccountId> {
}

/// ID of the taken snapshot in a sequence.
#[derive(Encode, Decode, TypeInfo, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default, Debug)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default, Debug)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct SnapshotId(pub u32);
impl_checked_inc!(SnapshotId);
Expand Down
3 changes: 2 additions & 1 deletion pallets/portfolio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ use sp_std::prelude::Vec;
type Identity<T> = identity::Module<T>;

/// The ticker and balance of an asset to be moved from one portfolio to another.
#[derive(Encode, Decode, TypeInfo, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
pub struct MovePortfolioItem {
/// The ticker of the asset to be moved.
pub ticker: Ticker,
Expand Down
3 changes: 2 additions & 1 deletion pallets/relayer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ type Identity<T> = pallet_identity::Module<T>;
///
/// This holds the subsidiser's paying key and the remaining POLYX balance
/// available for subsidising transaction and protocol fees.
#[derive(Encode, Decode, TypeInfo, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
pub struct Subsidy<Acc> {
/// The subsidiser's paying key.
pub paying_key: Acc,
Expand Down
60 changes: 23 additions & 37 deletions pallets/settlement/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,14 @@ pub trait Config:
}

/// A global and unique venue ID.
#[derive(Copy, Clone, Encode, Decode, TypeInfo, PartialEq, Eq, PartialOrd, Ord, Default, Debug)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default, Debug)]
pub struct VenueId(pub u64);
impl_checked_inc!(VenueId);

/// A wrapper for VenueDetails
#[derive(
Decode,
Encode,
TypeInfo,
Clone,
Debug,
Default,
PartialEq,
Eq,
PartialOrd,
Ord,
VecU8StrongTyped,
)]
#[derive(Encode, Decode, TypeInfo, VecU8StrongTyped)]
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
pub struct VenueDetails(Vec<u8>);

/// Status of an instruction
Expand All @@ -150,7 +140,8 @@ impl Default for InstructionStatus {
}

/// Type of the venue. Used for offchain filtering.
#[derive(Encode, Decode, TypeInfo, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum VenueType {
/// Default type - used for mixed and unknown types
Other,
Expand Down Expand Up @@ -203,7 +194,8 @@ impl Default for AffirmationStatus {
}

/// Type of settlement
#[derive(Encode, Decode, TypeInfo, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum SettlementType<BlockNumber> {
/// Instruction should be settled in the next block as soon as all affirmations are received.
SettleOnAffirmation,
Expand All @@ -218,12 +210,14 @@ impl<BlockNumber> Default for SettlementType<BlockNumber> {
}

/// A per-Instruction leg ID.
#[derive(Copy, Clone, Encode, Decode, TypeInfo, PartialEq, Eq, PartialOrd, Ord, Default, Debug)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default, Debug)]
pub struct LegId(pub u64);
impl_checked_inc!(LegId);

/// A global and unique instruction ID.
#[derive(Copy, Clone, Encode, Decode, TypeInfo, PartialEq, Eq, PartialOrd, Ord, Default, Debug)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default, Debug)]
pub struct InstructionId(pub u64);
impl_checked_inc!(InstructionId);

Expand All @@ -234,8 +228,9 @@ impl InstructionId {
}
}

/// Details about an instruction
#[derive(Encode, Decode, TypeInfo, Default, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)]
/// Details about an instruction.
#[derive(Encode, Decode, TypeInfo)]
#[derive(Default, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)]
pub struct Instruction<Moment, BlockNumber> {
/// Unique instruction id. It is an auto incrementing number
pub instruction_id: InstructionId,
Expand All @@ -253,8 +248,9 @@ pub struct Instruction<Moment, BlockNumber> {
pub value_date: Option<Moment>,
}

/// Details of a leg including the leg id in the instruction
#[derive(Encode, Decode, TypeInfo, Default, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)]
/// Details of a leg including the leg id in the instruction.
#[derive(Encode, Decode, TypeInfo)]
#[derive(Default, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)]
pub struct Leg {
/// Portfolio of the sender
pub from: PortfolioId,
Expand All @@ -266,8 +262,9 @@ pub struct Leg {
pub amount: Balance,
}

/// Details about a venue
#[derive(Encode, Decode, TypeInfo, Clone, Default, PartialEq, Eq, Debug, PartialOrd, Ord)]
/// Details about a venue.
#[derive(Encode, Decode, TypeInfo)]
#[derive(Clone, Default, PartialEq, Eq, Debug, PartialOrd, Ord)]
pub struct Venue {
/// Identity of the venue's creator
pub creator: IdentityId,
Expand All @@ -291,19 +288,8 @@ pub struct Receipt<Balance> {
}

/// A wrapper for VenueDetails
#[derive(
Decode,
Encode,
TypeInfo,
Clone,
Debug,
Default,
PartialEq,
Eq,
PartialOrd,
Ord,
VecU8StrongTyped,
)]
#[derive(Encode, Decode, TypeInfo, VecU8StrongTyped)]
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
pub struct ReceiptMetadata(Vec<u8>);

/// Details about an offchain transaction receipt that a user must input
Expand Down
29 changes: 11 additions & 18 deletions pallets/sto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ type Settlement<T> = pallet_settlement::Module<T>;
type Timestamp<T> = pallet_timestamp::Pallet<T>;

/// The per-ticker ID of a fundraiser.
#[derive(Copy, Clone, Encode, Decode, TypeInfo, PartialEq, Eq, PartialOrd, Ord, Default, Debug)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default, Debug)]
pub struct FundraiserId(pub u64);
impl_checked_inc!(FundraiserId);

Expand All @@ -80,7 +81,8 @@ impl Default for FundraiserStatus {
}

/// Details about the Fundraiser.
#[derive(Encode, Decode, TypeInfo, Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "std", derive(Debug))]
pub struct Fundraiser<Moment> {
/// The permissioned agent that created the `Fundraiser`.
Expand Down Expand Up @@ -116,7 +118,8 @@ impl<Moment> Fundraiser<Moment> {
}

/// Single tier of a tiered pricing model.
#[derive(Encode, Decode, TypeInfo, Default, Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Default, Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct PriceTier {
/// Total amount available.
pub total: Balance,
Expand All @@ -126,7 +129,8 @@ pub struct PriceTier {

/// Single price tier of a `Fundraiser`.
/// Similar to a `PriceTier` but with an extra field `remaining` for tracking the amount available for purchase in a tier.
#[derive(Encode, Decode, TypeInfo, Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Encode, Decode, TypeInfo)]
#[derive(Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "std", derive(Debug))]
pub struct FundraiserTier {
/// Total amount available.
Expand All @@ -147,20 +151,9 @@ impl Into<FundraiserTier> for PriceTier {
}
}

/// Wrapper type for Fundraiser name
#[derive(
Decode,
Encode,
TypeInfo,
Clone,
Default,
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
VecU8StrongTyped,
)]
/// Wrapper type for Fundraiser name.
#[derive(Encode, Decode, TypeInfo, VecU8StrongTyped)]
#[derive(Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct FundraiserName(Vec<u8>);

pub trait WeightInfo {
Expand Down
Loading

0 comments on commit 17d8f3c

Please sign in to comment.