@@ -1414,6 +1414,52 @@ pub type Migrations = migrations::Unreleased;
14141414pub mod migrations {
14151415 use super :: * ;
14161416
1417+ use frame_support:: traits:: LockIdentifier ;
1418+ use frame_system:: pallet_prelude:: BlockNumberFor ;
1419+
1420+ parameter_types ! {
1421+ pub const DemocracyPalletName : & ' static str = "Democracy" ;
1422+ pub const CouncilPalletName : & ' static str = "Council" ;
1423+ pub const TechnicalCommitteePalletName : & ' static str = "TechnicalCommittee" ;
1424+ pub const PhragmenElectionPalletName : & ' static str = "PhragmenElection" ;
1425+ pub const TechnicalMembershipPalletName : & ' static str = "TechnicalMembership" ;
1426+ pub const TipsPalletName : & ' static str = "Tips" ;
1427+ pub const PhragmenElectionPalletId : LockIdentifier = * b"phrelect" ;
1428+ }
1429+
1430+ // Special Config for Gov V1 pallets, allowing us to run migrations for them without
1431+ // implementing their configs on [`Runtime`].
1432+ pub struct UnlockConfig ;
1433+ impl pallet_democracy:: migrations:: unlock_and_unreserve_all_funds:: UnlockConfig for UnlockConfig {
1434+ type Currency = Balances ;
1435+ type MaxVotes = ConstU32 < 100 > ;
1436+ type MaxDeposits = ConstU32 < 100 > ;
1437+ type AccountId = AccountId ;
1438+ type BlockNumber = BlockNumberFor < Runtime > ;
1439+ type DbWeight = <Runtime as frame_system:: Config >:: DbWeight ;
1440+ type PalletName = DemocracyPalletName ;
1441+ }
1442+ impl pallet_elections_phragmen:: migrations:: unlock_and_unreserve_all_funds:: UnlockConfig
1443+ for UnlockConfig
1444+ {
1445+ type Currency = Balances ;
1446+ type MaxVotesPerVoter = ConstU32 < 16 > ;
1447+ type PalletId = PhragmenElectionPalletId ;
1448+ type AccountId = AccountId ;
1449+ type DbWeight = <Runtime as frame_system:: Config >:: DbWeight ;
1450+ type PalletName = PhragmenElectionPalletName ;
1451+ }
1452+ impl pallet_tips:: migrations:: unreserve_deposits:: UnlockConfig < ( ) > for UnlockConfig {
1453+ type Currency = Balances ;
1454+ type Hash = Hash ;
1455+ type DataDepositPerByte = DataDepositPerByte ;
1456+ type TipReportDepositBase = TipReportDepositBase ;
1457+ type AccountId = AccountId ;
1458+ type BlockNumber = BlockNumberFor < Runtime > ;
1459+ type DbWeight = <Runtime as frame_system:: Config >:: DbWeight ;
1460+ type PalletName = TipsPalletName ;
1461+ }
1462+
14171463 /// Unreleased migrations. Add new ones here:
14181464 pub type Unreleased = (
14191465 pallet_society:: migrations:: VersionCheckedMigrateToV2 < Runtime , ( ) , ( ) > ,
@@ -1426,6 +1472,21 @@ pub mod migrations {
14261472 paras_registrar:: migration:: VersionCheckedMigrateToV1 < Runtime , ( ) > ,
14271473 pallet_referenda:: migration:: v1:: MigrateV0ToV1 < Runtime , ( ) > ,
14281474 pallet_referenda:: migration:: v1:: MigrateV0ToV1 < Runtime , pallet_referenda:: Instance2 > ,
1475+
1476+ // Unlock & unreserve Gov1 funds
1477+
1478+ pallet_elections_phragmen:: migrations:: unlock_and_unreserve_all_funds:: UnlockAndUnreserveAllFunds < UnlockConfig > ,
1479+ pallet_democracy:: migrations:: unlock_and_unreserve_all_funds:: UnlockAndUnreserveAllFunds < UnlockConfig > ,
1480+ pallet_tips:: migrations:: unreserve_deposits:: UnreserveDeposits < UnlockConfig , ( ) > ,
1481+
1482+ // Delete all Gov v1 pallet storage key/values.
1483+
1484+ frame_support:: migrations:: RemovePallet < DemocracyPalletName , <Runtime as frame_system:: Config >:: DbWeight > ,
1485+ frame_support:: migrations:: RemovePallet < CouncilPalletName , <Runtime as frame_system:: Config >:: DbWeight > ,
1486+ frame_support:: migrations:: RemovePallet < TechnicalCommitteePalletName , <Runtime as frame_system:: Config >:: DbWeight > ,
1487+ frame_support:: migrations:: RemovePallet < PhragmenElectionPalletName , <Runtime as frame_system:: Config >:: DbWeight > ,
1488+ frame_support:: migrations:: RemovePallet < TechnicalMembershipPalletName , <Runtime as frame_system:: Config >:: DbWeight > ,
1489+ frame_support:: migrations:: RemovePallet < TipsPalletName , <Runtime as frame_system:: Config >:: DbWeight > ,
14291490 ) ;
14301491}
14311492
0 commit comments