Skip to content

Commit

Permalink
change the location of the old data structure during storage migration
Browse files Browse the repository at this point in the history
  • Loading branch information
SunTiebing committed Jun 19, 2024
1 parent d048613 commit 35d003e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
19 changes: 15 additions & 4 deletions pallets/slpx/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@ impl<T: Config> OnRuntimeUpgrade for BifrostPolkadotAddCurrencyToSupportXcmFee<T
}

mod v0 {
use frame_support::pallet_prelude::ValueQuery;

use crate::types::OldOrder;

use super::*;
use frame_support::pallet_prelude::ValueQuery;
use parity_scale_codec::{Decode, Encode};

#[storage_alias]
pub(super) type OrderQueue<T: Config> = StorageValue<
Expand All @@ -92,6 +90,19 @@ mod v0 {
>,
ValueQuery,
>;

#[derive(Encode, Decode)]
pub struct OldOrder<AccountId, CurrencyId, Balance, BlockNumber> {
pub source_chain_caller: OrderCaller<AccountId>,
pub bifrost_chain_caller: AccountId,
pub derivative_account: AccountId,
pub create_block_number: BlockNumber,
pub currency_id: CurrencyId,
pub currency_amount: Balance,
pub order_type: OrderType,
pub remark: BoundedVec<u8, ConstU32<32>>,
pub target_chain: TargetChain<AccountId>,
}
}

pub mod v1 {
Expand Down
13 changes: 0 additions & 13 deletions pallets/slpx/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,3 @@ pub struct Order<AccountId, CurrencyId, Balance, BlockNumber> {
pub target_chain: TargetChain<AccountId>,
pub channel_id: u32,
}

#[derive(Encode, Decode, Clone, Eq, PartialEq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
pub struct OldOrder<AccountId, CurrencyId, Balance, BlockNumber> {
pub source_chain_caller: OrderCaller<AccountId>,
pub bifrost_chain_caller: AccountId,
pub derivative_account: AccountId,
pub create_block_number: BlockNumber,
pub currency_id: CurrencyId,
pub currency_amount: Balance,
pub order_type: OrderType,
pub remark: BoundedVec<u8, ConstU32<32>>,
pub target_chain: TargetChain<AccountId>,
}

0 comments on commit 35d003e

Please sign in to comment.