pub(crate) fn add_cycles(
        &self,
        sender: PrincipalId,
        cycles_amount: Option<u64>,
        canister: &mut CanisterState,
        provisional_whitelist: &ProvisionalWhitelist,
    ) -> Result<(), CanisterManagerError> {
        if !provisional_whitelist.contains(&sender) {
            return Err(CanisterManagerError::SenderNotInWhitelist(sender));
        }

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

        self.cycles_account_manager
            .add_cycles(&mut canister.system_state, cycles_amount);

        Ok(())
    }
/// Adds cycles to the canister.
Adds cycles to the canister.
Adds cycles to the canister .
pub(crate) fn add_cycles(
        &self,
        sender: PrincipalId,
        cycles_amount: Option<u64>,
        canister: &mut CanisterState,
        provisional_whitelist: &ProvisionalWhitelist,
    ) -> Result<(), CanisterManagerError> {
        if !provisional_whitelist.contains(&sender) {
            return Err(CanisterManagerError::SenderNotInWhitelist(sender));
        }
        let cycles_amount = match cycles_amount {
            Some(cycles_amount) => Cycles::from(cycles_amount),
            None => self.config.default_provisional_cycles_balance,
        };
        self.cycles_account_manager
            .add_cycles(&mut canister.system_state, cycles_amount);
        Ok(())
    }
pub ( crate ) fn add_cycles ( & self , sender : PrincipalId , cycles_amount : Option < u64 > , canister : & mut CanisterState , provisional_whitelist : & ProvisionalWhitelist , ) -> Result < ( ) , CanisterManagerError > { if ! provisional_whitelist . contains ( & sender ) { return Err ( CanisterManagerError :: SenderNotInWhitelist ( sender ) ) ; } let cycles_amount = match cycles_amount { Some ( cycles_amount ) => Cycles :: from ( cycles_amount ) , None => self . config . default_provisional_cycles_balance , } ; self . cycles_account_manager . add_cycles ( & mut canister . system_state , cycles_amount ) ; Ok ( ( ) ) }
Adds cycles to the canister.
Adds cycles to the canister .
&self
sender
PrincipalId
cycles_amount
Option<u64>
canister
&mut CanisterState
provisional_whitelist
&ProvisionalWhitelist
&self
sender
PrincipalId
cycles_amount
Option<u64>
canister
&mut CanisterState
provisional_whitelist
&ProvisionalWhitelist