here are few examples which should help in conversion of number of type u128 to Balance Type:
//declare following import
use frame_support::sp_runtime::SaturatedConversion;
//then saturated_into can be used to convert number into Balance type as follows
let cost_in_u128: u128 = 250; //or expression like 200 + 50;
let cost: BalanceOf<T> = cost_in_u128.saturated_into::<BalanceOf<T>>();
//convert 1010 of type u32 into Balance
let cost2: BalanceOf<T> = 1010u32.into();
//set zero balance
let cost3 = BalanceOf::<T>::zero();
where BalanceOf is defined in cfg as follows
#[cfg(feature = "std")]
type BalanceOf<T> =
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
here are few examples which should help in conversion of number to Balance Type:
//declare following import
use frame_support::sp_runtime::traits::Zero;
use frame_support::sp_runtime::SaturatedConversion;
//then saturated_into can be used to convert number into Balance type as follows
let cost_in_u64: u64 = 250; //or expression like 200 + 50;
let cost: BalanceOf<T> = cost_in_u64.saturated_into::<BalanceOf<T>>();
//convert 1010 of type u32 into Balance
let cost2: BalanceOf<T> = 1010u32.into();
//set zero balance
let cost3 = BalanceOf::<T>::zero();
where BalanceOf<T> is defined in cfg as follows
#[cfg(feature = "std")]
type BalanceOf<T> =
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;