pub(crate) fn create_canister_with_cycles(
        &self,
        sender: PrincipalId,
        cycles_amount: Option<u64>,
        settings: CanisterSettings,
        state: &mut ReplicatedState,
        provisional_whitelist: &ProvisionalWhitelist,
        max_number_of_canisters: u64,
    ) -> Result<CanisterId, CanisterManagerError> {
        if !provisional_whitelist.contains(&sender) {
            return Err(CanisterManagerError::SenderNotInWhitelist(sender));
        }

        let cycles = match cycles_amount {
            Some(cycles_amount) => Cycles::from(cycles_amount),
            None => self.config.default_provisional_cycles_balance,
        };

        // Validate settings before `create_canister_helper` applies them
        // No creation fee applied.
        match self.validate_settings(
            settings,
            state.total_compute_allocation(),
            state.total_memory_taken(),
        ) {
            Err(err) => Err(err),
            Ok(validated_settings) => self.create_canister_helper(
                sender,
                cycles,
                Cycles::new(0),
                validated_settings,
                max_number_of_canisters,
                state,
            ),
        }
    }
/// Creates a new canister with the cycles amount specified and inserts it
/// into `ReplicatedState`.
///
/// Note that this method is meant to only be invoked in local development
/// by a list of whitelisted principals.
///
/// Returns the auto-generated id the new canister that has been created.
Creates a new canister with the cycles amount specified and inserts it
into `ReplicatedState`.

Note that this method is meant to only be invoked in local development
by a list of whitelisted principals.

Returns the auto-generated id the new canister that has been created.
Creates a new canister with the cycles amount specified and inserts it into ` ReplicatedState ` . Note that this method is meant to only be invoked in local development by a list of whitelisted principals . Returns the auto - generated id the new canister that has been created .
pub(crate) fn create_canister_with_cycles(
        &self,
        sender: PrincipalId,
        cycles_amount: Option<u64>,
        settings: CanisterSettings,
        state: &mut ReplicatedState,
        provisional_whitelist: &ProvisionalWhitelist,
        max_number_of_canisters: u64,
    ) -> Result<CanisterId, CanisterManagerError> {
        if !provisional_whitelist.contains(&sender) {
            return Err(CanisterManagerError::SenderNotInWhitelist(sender));
        }
        let cycles = match cycles_amount {
            Some(cycles_amount) => Cycles::from(cycles_amount),
            None => self.config.default_provisional_cycles_balance,
        };
        // Validate settings before `create_canister_helper` applies them
        // No creation fee applied.
        match self.validate_settings(
            settings,
            state.total_compute_allocation(),
            state.total_memory_taken(),
        ) {
            Err(err) => Err(err),
            Ok(validated_settings) => self.create_canister_helper(
                sender,
                cycles,
                Cycles::new(0),
                validated_settings,
                max_number_of_canisters,
                state,
            ),
        }
    }
pub ( crate ) fn create_canister_with_cycles ( & self , sender : PrincipalId , cycles_amount : Option < u64 > , settings : CanisterSettings , state : & mut ReplicatedState , provisional_whitelist : & ProvisionalWhitelist , max_number_of_canisters : u64 , ) -> Result < CanisterId , CanisterManagerError > { if ! provisional_whitelist . contains ( & sender ) { return Err ( CanisterManagerError :: SenderNotInWhitelist ( sender ) ) ; } let cycles = match cycles_amount { Some ( cycles_amount ) => Cycles :: from ( cycles_amount ) , None => self . config . default_provisional_cycles_balance , } ; // Validate settings before `create_canister_helper` applies them // No creation fee applied. match self . validate_settings ( settings , state . total_compute_allocation ( ) , state . total_memory_taken ( ) , ) { Err ( err ) => Err ( err ) , Ok ( validated_settings ) => self . create_canister_helper ( sender , cycles , Cycles :: new ( 0 ) , validated_settings , max_number_of_canisters , state , ) , } }
Creates a new canister with the cycles amount specified and inserts it
into `ReplicatedState`.
Creates a new canister with the cycles amount specified and inserts it into ` ReplicatedState ` .
&self
sender
PrincipalId
cycles_amount
Option<u64>
settings
CanisterSettings
state
&mut ReplicatedState
provisional_whitelist
&ProvisionalWhitelist
max_number_of_canisters
u64
&self
sender
PrincipalId
cycles_amount
Option<u64>
settings
CanisterSettings
state
&mut ReplicatedState
provisional_whitelist
&ProvisionalWhitelist
max_number_of_canisters
u64