macro_rules! ensure {
    ($cond:expr, $e:expr) => { ... };
}
Expand description

Quick check for a guard. If the condition (first argument) is false, then return the second argument x wrapped in Err(x).

use secret_cosmwasm_std::ensure;
ensure!(permissions.delegate, ContractError::DelegatePerm {});

// is the same as

if !permissions.delegate {
  return Err(ContractError::DelegatePerm {});
}