Skip to content

Commit

Permalink
Remove structs mentioned under TODO(#986) (#1342)
Browse files Browse the repository at this point in the history
* Remove structs under TODO(#968)

* Remove OldOutcomeInfo and related structs

* Satisfy check-license
  • Loading branch information
saboonikhil authored Jun 11, 2024
1 parent 07afe1a commit 9e0c522
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 39 deletions.
10 changes: 1 addition & 9 deletions zrml/global-disputes/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022-2023 Forecasting Technologies LTD.
// Copyright 2022-2024 Forecasting Technologies LTD.
//
// This file is part of Zeitgeist.
//
Expand Down Expand Up @@ -80,9 +80,6 @@ mod pallet {
pub type LockInfoOf<T> =
BoundedVec<(MarketIdOf<T>, BalanceOf<T>), <T as Config>::MaxGlobalDisputeVotes>;

// TODO(#968): to remove after the storage migration
pub type WinnerInfoOf<T> = OldWinnerInfo<BalanceOf<T>, OwnerInfoOf<T>>;

/// The current storage version.
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
const LOG_TARGET: &str = "runtime::zrml-global-disputes";
Expand Down Expand Up @@ -181,11 +178,6 @@ mod pallet {
pub type GlobalDisputesInfo<T: Config> =
StorageMap<_, Twox64Concat, MarketIdOf<T>, GlobalDisputeInfoOf<T>, OptionQuery>;

// TODO(#986): to remove after the storage migration
#[pallet::storage]
pub type Winners<T: Config> =
StorageMap<_, Twox64Concat, MarketIdOf<T>, WinnerInfoOf<T>, OptionQuery>;

#[pallet::event]
#[pallet::generate_deposit(fn deposit_event)]
pub enum Event<T>
Expand Down
31 changes: 1 addition & 30 deletions zrml/global-disputes/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022-2023 Forecasting Technologies LTD.
// Copyright 2022-2024 Forecasting Technologies LTD.
//
// This file is part of Zeitgeist.
//
Expand Down Expand Up @@ -93,35 +93,6 @@ pub enum GdStatus<BlockNumber> {
Destroyed,
}

// TODO(#986): to remove after the storage migration

/// The information about a voting outcome of a global dispute.
#[derive(Debug, TypeInfo, Decode, Encode, MaxEncodedLen, Clone, PartialEq, Eq)]
pub struct OldOutcomeInfo<Balance, OwnerInfo> {
/// The current sum of all locks on this outcome.
pub outcome_sum: Balance,
/// The vector of owners of the outcome.
pub owners: OwnerInfo,
}

/// The information about the current highest winning outcome.
#[derive(TypeInfo, Decode, Encode, MaxEncodedLen, Clone, PartialEq, Eq)]
pub struct OldWinnerInfo<Balance, OwnerInfo> {
/// The outcome, which is in the lead.
pub outcome: OutcomeReport,
/// The information about the winning outcome.
pub outcome_info: OldOutcomeInfo<Balance, OwnerInfo>,
/// Check, if the global dispute is finished.
pub is_finished: bool,
}

impl<Balance: Saturating, OwnerInfo: Default> OldWinnerInfo<Balance, OwnerInfo> {
pub fn new(outcome: OutcomeReport, vote_sum: Balance) -> Self {
let outcome_info = OldOutcomeInfo { outcome_sum: vote_sum, owners: Default::default() };
OldWinnerInfo { outcome, is_finished: false, outcome_info }
}
}

/// An initial vote outcome item with the outcome owner and the initial vote amount.
pub struct InitialItem<AccountId, Balance> {
/// The outcome which is added as initial global dispute vote possibility.
Expand Down

0 comments on commit 9e0c522

Please sign in to comment.