fn create_pool(
		currency_id: CurrencyId,
		protocol_interest_factor: Rate,
		max_borrow_rate: Rate,
		collateral_factor: Rate,
		protocol_interest_threshold: Balance,
	) -> DispatchResult {
		ensure!(
			!ControllerParams::<T>::contains_key(currency_id),
			Error::<T>::PoolAlreadyCreated
		);
		ensure!(
			Self::is_valid_max_borrow_rate(max_borrow_rate),
			Error::<T>::MaxBorrowRateCannotBeZero
		);
		ensure!(
			Self::is_valid_collateral_factor(collateral_factor),
			Error::<T>::CollateralFactorIncorrectValue
		);

		ControllerParams::<T>::insert(
			currency_id,
			ControllerData {
				last_interest_accrued_block: <frame_system::Pallet<T>>::block_number(),
				protocol_interest_factor,
				max_borrow_rate,
				collateral_factor,
				borrow_cap: None,
				protocol_interest_threshold,
			},
		);
		PauseKeepers::<T>::insert(
			currency_id,
			PauseKeeper {
				deposit_paused: false,
				redeem_paused: false,
				borrow_paused: false,
				repay_paused: false,
				transfer_paused: false,
			},
		);
		Ok(())
	}
/// This is a part of a pool creation flow
/// Creates storage records for ControllerParams and PauseKeepers
/// All operations are unpaused after this function call
This is a part of a pool creation flow
Creates storage records for ControllerParams and PauseKeepers
All operations are unpaused after this function call
This is a part of a pool creation flow Creates storage records for ControllerParams and PauseKeepers All operations are unpaused after this function call
fn create_pool(
		currency_id: CurrencyId,
		protocol_interest_factor: Rate,
		max_borrow_rate: Rate,
		collateral_factor: Rate,
		protocol_interest_threshold: Balance,
	) -> DispatchResult {
		ensure!(
			!ControllerParams::<T>::contains_key(currency_id),
			Error::<T>::PoolAlreadyCreated
		);
		ensure!(
			Self::is_valid_max_borrow_rate(max_borrow_rate),
			Error::<T>::MaxBorrowRateCannotBeZero
		);
		ensure!(
			Self::is_valid_collateral_factor(collateral_factor),
			Error::<T>::CollateralFactorIncorrectValue
		);
		ControllerParams::<T>::insert(
			currency_id,
			ControllerData {
				last_interest_accrued_block: <frame_system::Pallet<T>>::block_number(),
				protocol_interest_factor,
				max_borrow_rate,
				collateral_factor,
				borrow_cap: None,
				protocol_interest_threshold,
			},
		);
		PauseKeepers::<T>::insert(
			currency_id,
			PauseKeeper {
				deposit_paused: false,
				redeem_paused: false,
				borrow_paused: false,
				repay_paused: false,
				transfer_paused: false,
			},
		);
		Ok(())
	}
fn create_pool ( currency_id : CurrencyId , protocol_interest_factor : Rate , max_borrow_rate : Rate , collateral_factor : Rate , protocol_interest_threshold : Balance , ) -> DispatchResult { ensure ! ( ControllerParams T contains_key ( currency_id ) Error T PoolAlreadyCreated ) ; ensure ! ( Self is_valid_max_borrow_rate ( max_borrow_rate ) Error T MaxBorrowRateCannotBeZero ) ; ensure ! ( Self is_valid_collateral_factor ( collateral_factor ) Error T CollateralFactorIncorrectValue ) ; ControllerParams :: < T > :: insert ( currency_id , ControllerData { last_interest_accrued_block : < frame_system :: Pallet < T > > :: block_number ( ) , protocol_interest_factor , max_borrow_rate , collateral_factor , borrow_cap : None , protocol_interest_threshold , } , ) ; PauseKeepers :: < T > :: insert ( currency_id , PauseKeeper { deposit_paused : false , redeem_paused : false , borrow_paused : false , repay_paused : false , transfer_paused : false , } , ) ; Ok ( ( ) ) }
This is a part of a pool creation flow
Creates storage records for ControllerParams and PauseKeepers
All operations are unpaused after this function call
This is a part of a pool creation flow Creates storage records for ControllerParams and PauseKeepers All operations are unpaused after this function call
currency_id
CurrencyId
protocol_interest_factor
Rate
max_borrow_rate
Rate
collateral_factor
Rate
protocol_interest_threshold
Balance
currency_id
CurrencyId
protocol_interest_factor
Rate
max_borrow_rate
Rate
collateral_factor
Rate
protocol_interest_threshold
Balance