macro_rules! ensure_ne {
($a:expr, $b:expr, $e:expr) => { ... };
}
Expand description
Quick check for a guard. Like assert_ne!
, but rather than panic,
it returns the third argument x
wrapped in Err(x).
use cosmwasm_std::ensure_ne;
ensure_ne!(voting_power, 0, ContractError::NotAVoter {});
// is the same as
if voting_power != 0 {
return Err(ContractError::NotAVoter {});
}