pub(crate) fn withdraw(&mut self, token: &AccountId, amount: Balance) {
        if let Some(x) = self.legacy_tokens.remove(token) {
            // need convert to 
            assert!(x >= amount, "{}", ERR22_NOT_ENOUGH_TOKENS);
            self.tokens.insert(token, &(x - amount));
        } else if let Some(x) = self.tokens.get(token) {
            assert!(x >= amount, "{}", ERR22_NOT_ENOUGH_TOKENS);
            self.tokens.insert(token, &(x - amount));
        } else {
            env::panic(ERR21_TOKEN_NOT_REG.as_bytes());
        }
    }
/// Withdraw amount of `token` from the internal balance.
/// Panics if `amount` is bigger than the current balance.
Withdraw amount of `token` from the internal balance.
Panics if `amount` is bigger than the current balance.
Withdraw amount of ` token ` from the internal balance . Panics if ` amount ` is bigger than the current balance .
pub(crate) fn withdraw(&mut self, token: &AccountId, amount: Balance) {
        if let Some(x) = self.legacy_tokens.remove(token) {
            // need convert to 
            assert!(x >= amount, "{}", ERR22_NOT_ENOUGH_TOKENS);
            self.tokens.insert(token, &(x - amount));
        } else if let Some(x) = self.tokens.get(token) {
            assert!(x >= amount, "{}", ERR22_NOT_ENOUGH_TOKENS);
            self.tokens.insert(token, &(x - amount));
        } else {
            env::panic(ERR21_TOKEN_NOT_REG.as_bytes());
        }
    }
pub ( crate ) fn withdraw ( & mut self , token : & AccountId , amount : Balance ) { if let Some ( x ) = self . legacy_tokens . remove ( token ) { // need convert to  assert ! ( x amount " " ERR22_NOT_ENOUGH_TOKENS ) ; self . tokens . insert ( token , & ( x - amount ) ) ; } else if let Some ( x ) = self . tokens . get ( token ) { assert ! ( x amount " " ERR22_NOT_ENOUGH_TOKENS ) ; self . tokens . insert ( token , & ( x - amount ) ) ; } else { env :: panic ( ERR21_TOKEN_NOT_REG . as_bytes ( ) ) ; } }
Withdraw amount of `token` from the internal balance.
Withdraw amount of ` token ` from the internal balance .
&mut self
token
&AccountId
amount
Balance
&mut self
token
&AccountId
amount
Balance