-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove the expiry storage from the swapping and lp pallets
expiry is now done in the ingress-egress pallet
- Loading branch information
Showing
9 changed files
with
103 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pub mod remove_expiries; | ||
|
||
use cf_runtime_upgrade_utilities::VersionedMigration; | ||
|
||
pub type PalletMigration<T> = | ||
(VersionedMigration<crate::Pallet<T>, remove_expiries::Migration<T>, 0, 1>,); |
35 changes: 35 additions & 0 deletions
35
state-chain/pallets/cf-lp/src/migrations/remove_expiries.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use crate::*; | ||
use frame_support::{dispatch::Vec, traits::OnRuntimeUpgrade}; | ||
use sp_std::marker::PhantomData; | ||
|
||
pub struct Migration<T: Config>(PhantomData<T>); | ||
|
||
mod old { | ||
|
||
use super::*; | ||
|
||
use cf_primitives::ChannelId; | ||
use frame_support::pallet_prelude::ValueQuery; | ||
|
||
#[frame_support::storage_alias] | ||
pub type SwapTTL<T: Config> = StorageValue<Pallet<T>, BlockNumberFor<T>, ValueQuery>; | ||
|
||
#[frame_support::storage_alias] | ||
pub type SwapChannelExpiries<T: Config> = StorageMap< | ||
Pallet<T>, | ||
Twox64Concat, | ||
BlockNumberFor<T>, | ||
Vec<(ChannelId, ForeignChainAddress)>, | ||
ValueQuery, | ||
>; | ||
} | ||
|
||
impl<T: Config> OnRuntimeUpgrade for Migration<T> { | ||
fn on_runtime_upgrade() -> frame_support::weights::Weight { | ||
let _ = old::SwapChannelExpiries::<T>::drain().collect::<Vec<_>>(); | ||
|
||
let _ = old::SwapTTL::<T>::take(); | ||
|
||
Weight::zero() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pub mod remove_expiries; | ||
|
||
use cf_runtime_upgrade_utilities::VersionedMigration; | ||
|
||
pub type PalletMigration<T> = | ||
(VersionedMigration<crate::Pallet<T>, remove_expiries::Migration<T>, 0, 1>,); |
34 changes: 34 additions & 0 deletions
34
state-chain/pallets/cf-swapping/src/migrations/remove_expiries.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use crate::*; | ||
use frame_support::traits::OnRuntimeUpgrade; | ||
use sp_std::marker::PhantomData; | ||
|
||
pub struct Migration<T: Config>(PhantomData<T>); | ||
|
||
mod old { | ||
|
||
use super::*; | ||
|
||
use frame_support::pallet_prelude::ValueQuery; | ||
|
||
#[frame_support::storage_alias] | ||
pub type SwapTTL<T: Config> = StorageValue<Pallet<T>, BlockNumberFor<T>, ValueQuery>; | ||
|
||
#[frame_support::storage_alias] | ||
pub type SwapChannelExpiries<T: Config> = StorageMap< | ||
Pallet<T>, | ||
Twox64Concat, | ||
BlockNumberFor<T>, | ||
Vec<(ChannelId, ForeignChainAddress)>, | ||
ValueQuery, | ||
>; | ||
} | ||
|
||
impl<T: Config> OnRuntimeUpgrade for Migration<T> { | ||
fn on_runtime_upgrade() -> frame_support::weights::Weight { | ||
let _ = old::SwapChannelExpiries::<T>::drain().collect::<Vec<_>>(); | ||
|
||
let _ = old::SwapTTL::<T>::take(); | ||
|
||
Weight::zero() | ||
} | ||
} |