Skip to content

Commit

Permalink
check user has enough balance and limit max transfer to their free ba…
Browse files Browse the repository at this point in the history
…lance
  • Loading branch information
Ank4n committed Aug 29, 2023
1 parent 783aadc commit 7c83f4a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion substrate/frame/nomination-pools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2660,7 +2660,8 @@ pub mod pallet {
#[pallet::compact] max_transfer: BalanceOf<T>,
) -> DispatchResult {
let who = ensure_signed(origin)?;
Self::do_top_up_reward_deficit(who, pool_id, max_transfer)
let caller_balance = T::Currency::free_balance(&who);
Self::do_top_up_reward_deficit(who, pool_id, max_transfer.min(caller_balance))
}
}

Expand Down

0 comments on commit 7c83f4a

Please sign in to comment.