pub fn debit_balance(&mut self, holder: &TokenHolder, value: Nat) -> CommonResult<()> {
        if self._balance_of(holder) < value {
            Err(DFTError::InsufficientBalance)
        } else {
            // calc new balance
            let new_balance = self._balance_of(holder) - value;

            if new_balance > Nat::from(0) {
                self.balances.insert(holder.clone(), new_balance);
            } else {
                self.balances.remove(holder);
            }

            Ok(())
        }
    }
// debit token holder's balance
debit token holder's balance
debit token holder ' s balance
pub fn debit_balance(&mut self, holder: &TokenHolder, value: Nat) -> CommonResult<()> {
        if self._balance_of(holder) < value {
            Err(DFTError::InsufficientBalance)
        } else {
            // calc new balance
            let new_balance = self._balance_of(holder) - value;
            if new_balance > Nat::from(0) {
                self.balances.insert(holder.clone(), new_balance);
            } else {
                self.balances.remove(holder);
            }
            Ok(())
        }
    }
pub fn debit_balance ( & mut self , holder : & TokenHolder , value : Nat ) -> CommonResult < ( ) > { if self . _balance_of ( holder ) < value { Err ( DFTError :: InsufficientBalance ) } else { // calc new balance let new_balance = self . _balance_of ( holder ) - value ; if new_balance > Nat :: from ( 0 ) { self . balances . insert ( holder . clone ( ) , new_balance ) ; } else { self . balances . remove ( holder ) ; } Ok ( ( ) ) } }
debit token holder's balance
debit token holder ' s balance
&mut self
holder
&TokenHolder
value
Nat
&mut self
holder
&TokenHolder
value
Nat