diff --git a/modules/ismp/pallets/asset-gateway/src/xcm_utilities.rs b/modules/ismp/pallets/asset-gateway/src/xcm_utilities.rs index 3a12b07f7..a11043675 100644 --- a/modules/ismp/pallets/asset-gateway/src/xcm_utilities.rs +++ b/modules/ismp/pallets/asset-gateway/src/xcm_utilities.rs @@ -1,7 +1,7 @@ use crate::{AssetIds, Config, Pallet}; use alloc::vec::Vec; use codec::Encode; -use core::marker::PhantomData; +use core::{cmp::min, marker::PhantomData}; use frame_support::traits::{ fungibles::{self, Mutate}, Contains, @@ -200,7 +200,9 @@ where // messages let base_fee = if who.dest_state_machine == StateMachine::Evm(1) { 20_000_000_000u128 } else { 0 }; - let protocol_fees = protocol_percentage * u128::from(amount) + base_fee; + // Cap protocol fees at 100 DOT + let protocol_fees = + min(protocol_percentage * u128::from(amount) + base_fee, 1000_000_000_000u128); let remainder = u128::from(amount) .checked_sub(protocol_fees.into()) .ok_or_else(|| XcmError::Overflow)?