pub(crate) fn sub_reward(&mut self, token: &AccountId, amount: Balance) -> Balance {
        let value = *self.rewards.get(token).expect(ERR21_TOKEN_NOT_REG);
        assert!(value >= amount, "{}", ERR22_NOT_ENOUGH_TOKENS);
        if amount == 0 {
            self.rewards.remove(&token.clone());
            value
        } else {
            self.rewards.insert(token.clone(), value - amount);
            amount
        }
    }
/// Subtract from `reward` balance.
/// if amount == 0, subtract all reward balance.
/// Panics if `amount` is bigger than the current balance.
/// return actual subtract amount
Subtract from `reward` balance.
if amount == 0, subtract all reward balance.
Panics if `amount` is bigger than the current balance.
return actual subtract amount
Subtract from ` reward ` balance . if amount == 0 subtract all reward balance . Panics if ` amount ` is bigger than the current balance . return actual subtract amount
pub(crate) fn sub_reward(&mut self, token: &AccountId, amount: Balance) -> Balance {
        let value = *self.rewards.get(token).expect(ERR21_TOKEN_NOT_REG);
        assert!(value >= amount, "{}", ERR22_NOT_ENOUGH_TOKENS);
        if amount == 0 {
            self.rewards.remove(&token.clone());
            value
        } else {
            self.rewards.insert(token.clone(), value - amount);
            amount
        }
    }
pub ( crate ) fn sub_reward ( & mut self , token : & AccountId , amount : Balance ) -> Balance { let value = * self . rewards . get ( token ) . expect ( ERR21_TOKEN_NOT_REG ) ; assert ! ( value amount " " ERR22_NOT_ENOUGH_TOKENS ) ; if amount == 0 { self . rewards . remove ( & token . clone ( ) ) ; value } else { self . rewards . insert ( token . clone ( ) , value - amount ) ; amount } }
Subtract from `reward` balance.
Subtract from ` reward ` balance .
&mut self
token
&AccountId
amount
Balance
&mut self
token
&AccountId
amount
Balance