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

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

        let canister = state.canister_state_mut(&canister_id).unwrap();
        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,
        canister_id: CanisterId,
        cycles_amount: Option<u64>,
        state: &mut ReplicatedState,
        provisional_whitelist: &ProvisionalWhitelist,
    ) -> Result<(), CanisterManagerError> {
        if !provisional_whitelist.contains(&sender) {
            return Err(CanisterManagerError::SenderNotInWhitelist(sender));
        }
        self.validate_canister_exists(state, canister_id)?;
        let cycles_amount = match cycles_amount {
            Some(cycles_amount) => Cycles::from(cycles_amount),
            None => self.config.default_provisional_cycles_balance,
        };
        let canister = state.canister_state_mut(&canister_id).unwrap();
        self.cycles_account_manager
            .add_cycles(&mut canister.system_state, cycles_amount);
        Ok(())
    }
pub ( crate ) fn add_cycles ( & self , sender : PrincipalId , canister_id : CanisterId , cycles_amount : Option < u64 > , state : & mut ReplicatedState , provisional_whitelist : & ProvisionalWhitelist , ) -> Result < ( ) , CanisterManagerError > { if ! provisional_whitelist . contains ( & sender ) { return Err ( CanisterManagerError :: SenderNotInWhitelist ( sender ) ) ; } self . validate_canister_exists ( state , canister_id ) ? ; let cycles_amount = match cycles_amount { Some ( cycles_amount ) => Cycles :: from ( cycles_amount ) , None => self . config . default_provisional_cycles_balance , } ; let canister = state . canister_state_mut ( & canister_id ) . unwrap ( ) ; 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
canister_id
CanisterId
cycles_amount
Option<u64>
state
&mut ReplicatedState
provisional_whitelist
&ProvisionalWhitelist
&self
sender
PrincipalId
canister_id
CanisterId
cycles_amount
Option<u64>
state
&mut ReplicatedState
provisional_whitelist
&ProvisionalWhitelist