Skip to content

Commit de7ff27

Browse files
authored
remove rewards migration (#611)
1 parent 67c52b2 commit de7ff27

File tree

3 files changed

+5
-262
lines changed

3 files changed

+5
-262
lines changed

rewards/src/lib.rs

+5-27
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
#![allow(clippy::unused_unit)]
22
#![cfg_attr(not(feature = "std"), no_std)]
33

4-
pub mod migrations;
54
mod mock;
65
mod tests;
76

8-
use codec::{FullCodec, HasCompact, MaxEncodedLen};
9-
use frame_support::{pallet_prelude::*, weights::Weight};
10-
pub use migrations::PoolInfoV0;
7+
use codec::{FullCodec, HasCompact};
8+
use frame_support::pallet_prelude::*;
119
use orml_traits::RewardHandler;
1210
use sp_core::U256;
1311
use sp_runtime::{
14-
traits::{AtLeast32BitUnsigned, Convert, MaybeSerializeDeserialize, Member, Saturating, UniqueSaturatedInto, Zero},
12+
traits::{AtLeast32BitUnsigned, MaybeSerializeDeserialize, Member, Saturating, UniqueSaturatedInto, Zero},
1513
FixedPointOperand, RuntimeDebug, SaturatedConversion,
1614
};
1715
use sp_std::{borrow::ToOwned, collections::btree_map::BTreeMap, fmt::Debug, prelude::*};
@@ -67,14 +65,6 @@ pub mod module {
6765
+ Debug
6866
+ FixedPointOperand;
6967

70-
/// The old version of reward pool ID type.
71-
/// NOTE: remove it after migration
72-
type PoolIdV0: Parameter + Member + Clone + FullCodec;
73-
74-
/// The convertor to convert PoolIdV0 to PoolId
75-
/// NOTE: remove it after migration
76-
type PoolIdConvertor: Convert<Self::PoolIdV0, Option<Self::PoolId>>;
77-
7868
/// The reward pool ID type.
7969
type PoolId: Parameter + Member + Clone + FullCodec;
8070

@@ -90,26 +80,14 @@ pub mod module {
9080
PoolDoesNotExist,
9181
}
9282

93-
/// Stores reward pool info.
94-
/// NOTE: remove it after migration
95-
#[pallet::storage]
96-
#[pallet::getter(fn pools)]
97-
pub type Pools<T: Config> = StorageMap<_, Twox64Concat, T::PoolIdV0, PoolInfoV0<T::Share, T::Balance>, ValueQuery>;
98-
9983
/// Record reward pool info.
84+
///
85+
/// map PoolId => PoolInfo
10086
#[pallet::storage]
10187
#[pallet::getter(fn pool_infos)]
10288
pub type PoolInfos<T: Config> =
10389
StorageMap<_, Twox64Concat, T::PoolId, PoolInfo<T::Share, T::Balance, T::CurrencyId>, ValueQuery>;
10490

105-
/// Record share amount and withdrawn reward amount for specific `AccountId`
106-
/// under `PoolId`.
107-
/// NOTE: remove it after migration
108-
#[pallet::storage]
109-
#[pallet::getter(fn share_and_withdrawn_reward)]
110-
pub type ShareAndWithdrawnReward<T: Config> =
111-
StorageDoubleMap<_, Twox64Concat, T::PoolIdV0, Twox64Concat, T::AccountId, (T::Share, T::Balance), ValueQuery>;
112-
11391
/// Record share amount, reward currency and withdrawn reward amount for
11492
/// specific `AccountId` under `PoolId`.
11593
///

rewards/src/migrations.rs

-226
This file was deleted.

rewards/src/mock.rs

-9
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,9 @@ impl RewardHandler<AccountId, CurrencyId> for Handler {
7878
}
7979
}
8080

81-
pub struct MockConvert;
82-
impl Convert<PoolId, Option<PoolId>> for MockConvert {
83-
fn convert(a: PoolId) -> Option<PoolId> {
84-
Some(a / 2)
85-
}
86-
}
87-
8881
impl Config for Runtime {
8982
type Share = Share;
9083
type Balance = Balance;
91-
type PoolIdV0 = PoolId;
92-
type PoolIdConvertor = MockConvert;
9384
type PoolId = PoolId;
9485
type CurrencyId = CurrencyId;
9586
type Handler = Handler;

0 commit comments

Comments
 (0)