From 5e4bd9c4c53b5fcc920af21b0869cd94f1143234 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 16 Aug 2024 10:53:54 +0200 Subject: [PATCH] chore: fix migration --- .../src/migrations/add_dca_params.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/state-chain/pallets/cf-ingress-egress/src/migrations/add_dca_params.rs b/state-chain/pallets/cf-ingress-egress/src/migrations/add_dca_params.rs index dcbec0f961..17059a0500 100644 --- a/state-chain/pallets/cf-ingress-egress/src/migrations/add_dca_params.rs +++ b/state-chain/pallets/cf-ingress-egress/src/migrations/add_dca_params.rs @@ -20,6 +20,7 @@ pub(super) mod old { CcmTransfer { destination_asset: Asset, destination_address: ForeignChainAddress, + broker_fees: Beneficiaries, channel_metadata: CcmChannelMetadata, refund_params: Option, }, @@ -81,13 +82,14 @@ impl, I: 'static> OnRuntimeUpgrade for Migration { old::ChannelAction::CcmTransfer { destination_asset, destination_address, + broker_fees, channel_metadata, refund_params, } => ChannelAction::CcmTransfer { destination_asset, destination_address, channel_metadata, - broker_fees: Default::default(), + broker_fees, refund_params, dca_params: None, }, @@ -129,6 +131,8 @@ mod tests { }, Bitcoin, }; + use cf_primitives::Beneficiary; + use sp_core::bounded_vec; fn mock_deposit_channel() -> DepositChannel { DepositChannel { @@ -160,6 +164,9 @@ mod tests { min_price: 2.into(), }; + let broker_fees: Beneficiaries = + bounded_vec![Beneficiary { account: 1234, bps: 100 }]; + let old_details_swap = old::DepositChannelDetails:: { deposit_channel: mock_deposit_channel(), opened_at: Default::default(), @@ -168,7 +175,7 @@ mod tests { action: old::ChannelAction::Swap { destination_asset: Asset::Flip, destination_address: output_address.clone(), - broker_fees: Default::default(), + broker_fees: broker_fees.clone(), refund_params: Some(refund_params.clone()), }, boost_fee: 0, @@ -178,6 +185,7 @@ mod tests { action: old::ChannelAction::CcmTransfer { destination_asset: Asset::Flip, destination_address: output_address.clone(), + broker_fees: broker_fees.clone(), channel_metadata: CcmChannelMetadata { message: vec![0u8, 1u8, 2u8, 3u8, 4u8].try_into().unwrap(), gas_budget: 50 * 10u128.pow(18), @@ -207,7 +215,7 @@ mod tests { action: ChannelAction::Swap { destination_asset: Asset::Flip, destination_address: output_address.clone(), - broker_fees: Default::default(), + broker_fees: broker_fees.clone(), refund_params: Some(refund_params.clone()), dca_params: None, }, @@ -229,7 +237,7 @@ mod tests { gas_budget: 50 * 10u128.pow(18), cf_parameters: Default::default(), }, - broker_fees: Default::default(), + broker_fees, refund_params: Some(refund_params.clone()), dca_params: None, },