Skip to content

Commit

Permalink
cap dot protocol fees at 100 dot
Browse files Browse the repository at this point in the history
  • Loading branch information
Wizdave97 committed Nov 12, 2024
1 parent ef737b4 commit 8700c63
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/ismp/pallets/asset-gateway/src/xcm_utilities.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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)?
Expand Down

0 comments on commit 8700c63

Please sign in to comment.