Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pallets/flexible-fee/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ mod mock;
mod tests;
mod weights;

const MAX_ORDER_LIST_LEN: u32 = 20;

#[frame_support::pallet]
pub mod pallet {
use super::*;
Expand Down Expand Up @@ -149,6 +151,7 @@ pub mod pallet {
#[pallet::error]
pub enum Error<T> {
NotEnoughBalance,
ExceedMaxListLength,
}

#[pallet::call]
Expand All @@ -163,6 +166,11 @@ pub mod pallet {
let who = ensure_signed(origin)?;

if let Some(mut asset_order_list) = asset_order_list_vec {
ensure!(
(asset_order_list.len()) as u32 <= MAX_ORDER_LIST_LEN,
Error::<T>::ExceedMaxListLength
);

asset_order_list.insert(0, T::NativeCurrencyId::get());
asset_order_list.dedup();
UserFeeChargeOrderList::<T>::insert(&who, asset_order_list);
Expand Down