Skip to content

Commit

Permalink
Improve is_empty() check
Browse files Browse the repository at this point in the history
  • Loading branch information
maurolacy committed Sep 14, 2020
1 parent 5b7094d commit c9d315e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/cw0/src/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::ops;

use cosmwasm_std::{Coin, StdError, StdResult};
use cosmwasm_std::{Coin, StdError, StdResult, Uint128};

// Balance wraps Vec<Coin> and provides some nice helpers. It mutates the Vec and can be
// unwrapped when done.
Expand Down Expand Up @@ -65,7 +65,7 @@ impl Balance {
}

pub fn is_empty(&self) -> bool {
self.0.is_empty()
!self.0.iter().any(|x| x.amount != Uint128(0))
}

/// similar to `Balance.sub`, but doesn't fail when minuend less than subtrahend
Expand Down

0 comments on commit c9d315e

Please sign in to comment.