pub fn credit_allowance(&mut self, owner: &TokenHolder, spender: &TokenHolder, value: Nat) {
        match self.allowances.get(&owner) {
            Some(inner) => {
                let mut temp = inner.clone();
                if value == 0 {
                    temp.remove(&spender);
                    if temp.len() > 0 {
                        self.allowances.insert(owner.clone(), temp);
                    } else {
                        self.allowances.remove(&owner);
                    }
                } else {
                    temp.insert(spender.clone(), value.clone());
                    self.allowances.insert(owner.clone(), temp);
                }
            }
            None => {
                if value.gt(&Nat::from(0)) {
                    let mut inner = HashMap::new();
                    inner.insert(spender.clone(), value.clone());
                    self.allowances.insert(owner.clone(), inner);
                }
            }
        };
    }
//credit token spender's allowance
credit token spender's allowance
credit token spender ' s allowance
pub fn credit_allowance(&mut self, owner: &TokenHolder, spender: &TokenHolder, value: Nat) {
        match self.allowances.get(&owner) {
            Some(inner) => {
                let mut temp = inner.clone();
                if value == 0 {
                    temp.remove(&spender);
                    if temp.len() > 0 {
                        self.allowances.insert(owner.clone(), temp);
                    } else {
                        self.allowances.remove(&owner);
                    }
                } else {
                    temp.insert(spender.clone(), value.clone());
                    self.allowances.insert(owner.clone(), temp);
                }
            }
            None => {
                if value.gt(&Nat::from(0)) {
                    let mut inner = HashMap::new();
                    inner.insert(spender.clone(), value.clone());
                    self.allowances.insert(owner.clone(), inner);
                }
            }
        };
    }
pub fn credit_allowance ( & mut self , owner : & TokenHolder , spender : & TokenHolder , value : Nat ) { match self . allowances . get ( & owner ) { Some ( inner ) => { let mut temp = inner . clone ( ) ; if value == 0 { temp . remove ( & spender ) ; if temp . len ( ) > 0 { self . allowances . insert ( owner . clone ( ) , temp ) ; } else { self . allowances . remove ( & owner ) ; } } else { temp . insert ( spender . clone ( ) , value . clone ( ) ) ; self . allowances . insert ( owner . clone ( ) , temp ) ; } } None => { if value . gt ( & Nat :: from ( 0 ) ) { let mut inner = HashMap :: new ( ) ; inner . insert ( spender . clone ( ) , value . clone ( ) ) ; self . allowances . insert ( owner . clone ( ) , inner ) ; } } } ; }
credit token spender's allowance
credit token spender ' s allowance
&mut self
owner
&TokenHolder
spender
&TokenHolder
value
Nat
&mut self
owner
&TokenHolder
spender
&TokenHolder
value
Nat