1
// Copyright 2024 Moonbeam Foundation Inc.
2
// This file is part of Moonbeam.
3

            
4
// Moonbeam is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8

            
9
// Moonbeam is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13

            
14
// You should have received a copy of the GNU General Public License
15
// along with Moonbeam.  If not, see <http://www.gnu.org/licenses/>.
16

            
17
//! # Moonbeam specific Migrations
18

            
19
use crate::Runtime;
20
use frame_support::{traits::OnRuntimeUpgrade, weights::Weight};
21
use pallet_migrations::{GetMigrations, Migration};
22
use pallet_parachain_staking::migrations::MultiplyRoundLenBy2;
23
use sp_std::{prelude::*, vec};
24

            
25
pub struct MoonbeamMigrations;
26

            
27
impl GetMigrations for MoonbeamMigrations {
28
1
	fn get_migrations() -> Vec<Box<dyn Migration>> {
29
1
		vec![Box::new(PalletStakingMultiplyRoundLenBy2)]
30
1
	}
31
}
32

            
33
// This migration should only be applied to runtimes with async backing enabled
34
pub struct PalletStakingMultiplyRoundLenBy2;
35
impl Migration for PalletStakingMultiplyRoundLenBy2 {
36
1
	fn friendly_name(&self) -> &str {
37
1
		"MM_MultiplyRoundLenBy2"
38
1
	}
39

            
40
	fn migrate(&self, _available_weight: Weight) -> Weight {
41
		MultiplyRoundLenBy2::<Runtime>::on_runtime_upgrade()
42
	}
43
}