pub fn new_vesting_with_deadline<T, const VESTING_APPLICABLE_FROM: u32>(
	amount: types::VestingBalanceOf<T>,
	ends_in: types::BlockNumberOf<T>,
) -> (Option<types::VestingInfoOf<T>>, types::VestingBalanceOf<T>)
where
	T: pallet_vesting::Config,
{
	const MIN_AMOUNT_PER_BLOCK: u32 = 1u32;

	type BlockToBalance<T> = <T as pallet_vesting::Config>::BlockNumberToBalance;
	let mut vesting = None;

	let ends_in_as_balance = BlockToBalance::<T>::convert(ends_in);
	let transfer_over = ends_in_as_balance.saturating_sub(VESTING_APPLICABLE_FROM.into());

	let idol_transfer_multiple = transfer_over * MIN_AMOUNT_PER_BLOCK.into();

	let remainding_amount = amount % idol_transfer_multiple;
	let primary_transfer_amount = amount.saturating_sub(remainding_amount);

	let per_block = primary_transfer_amount
		.checked_div(&idol_transfer_multiple)
		.unwrap_or_else(Bounded::min_value);

	if per_block > Bounded::min_value() {
		vesting = Some(types::VestingInfoOf::<T>::new(
			primary_transfer_amount,
			per_block,
			VESTING_APPLICABLE_FROM.into(),
		));
	}

	(vesting, remainding_amount)
}
/// Reuturns an optional vesting schedule which when applied release given amount
/// which will be complete in given block. If
/// Also return amount which is remaineder if amount can't be perfectly divided
/// in per block basis
Reuturns an optional vesting schedule which when applied release given amount
which will be complete in given block. If
Also return amount which is remaineder if amount can't be perfectly divided
in per block basis
Reuturns an optional vesting schedule which when applied release given amount which will be complete in given block . If Also return amount which is remaineder if amount can ' t be perfectly divided in per block basis
pub fn new_vesting_with_deadline<T, const VESTING_APPLICABLE_FROM: u32>(
	amount: types::VestingBalanceOf<T>,
	ends_in: types::BlockNumberOf<T>,
) -> (Option<types::VestingInfoOf<T>>, types::VestingBalanceOf<T>)
where
	T: pallet_vesting::Config,
{
	const MIN_AMOUNT_PER_BLOCK: u32 = 1u32;
	type BlockToBalance<T> = <T as pallet_vesting::Config>::BlockNumberToBalance;
	let mut vesting = None;
	let ends_in_as_balance = BlockToBalance::<T>::convert(ends_in);
	let transfer_over = ends_in_as_balance.saturating_sub(VESTING_APPLICABLE_FROM.into());
	let idol_transfer_multiple = transfer_over * MIN_AMOUNT_PER_BLOCK.into();
	let remainding_amount = amount % idol_transfer_multiple;
	let primary_transfer_amount = amount.saturating_sub(remainding_amount);
	let per_block = primary_transfer_amount
		.checked_div(&idol_transfer_multiple)
		.unwrap_or_else(Bounded::min_value);
	if per_block > Bounded::min_value() {
		vesting = Some(types::VestingInfoOf::<T>::new(
			primary_transfer_amount,
			per_block,
			VESTING_APPLICABLE_FROM.into(),
		));
	}
	(vesting, remainding_amount)
}
pub fn new_vesting_with_deadline < T , const VESTING_APPLICABLE_FROM : u32 > ( amount : types :: VestingBalanceOf < T > , ends_in : types :: BlockNumberOf < T > , ) -> ( Option < types :: VestingInfoOf < T > > , types :: VestingBalanceOf < T > ) where T : pallet_vesting :: Config , { const MIN_AMOUNT_PER_BLOCK : u32 = 1u32 ; type BlockToBalance < T > = < T as pallet_vesting :: Config > :: BlockNumberToBalance ; let mut vesting = None ; let ends_in_as_balance = BlockToBalance :: < T > :: convert ( ends_in ) ; let transfer_over = ends_in_as_balance . saturating_sub ( VESTING_APPLICABLE_FROM . into ( ) ) ; let idol_transfer_multiple = transfer_over * MIN_AMOUNT_PER_BLOCK . into ( ) ; let remainding_amount = amount % idol_transfer_multiple ; let primary_transfer_amount = amount . saturating_sub ( remainding_amount ) ; let per_block = primary_transfer_amount . checked_div ( & idol_transfer_multiple ) . unwrap_or_else ( Bounded :: min_value ) ; if per_block > Bounded :: min_value ( ) { vesting = Some ( types :: VestingInfoOf :: < T > :: new ( primary_transfer_amount , per_block , VESTING_APPLICABLE_FROM . into ( ) , ) ) ; } ( vesting , remainding_amount ) }
Reuturns an optional vesting schedule which when applied release given amount
which will be complete in given block.
Reuturns an optional vesting schedule which when applied release given amount which will be complete in given block .
amount
types::VestingBalanceOf<T>
ends_in
types::BlockNumberOf<T>