macro_rules! require {
($condition:expr) => { ... };
($condition:expr, $message:tt) => { ... };
}Expand description
Verify inputs and conditions
§Result
If the condition was not satisfied, the execution will be stopped with error code 300 (RuntimeError::Exception)
§Usage
use we_cdk::*;
#[action]
fn _constructor() {
let balance = get_balance!(this);
require!(balance > 42);
}
#[action]
fn require_with_message() {
let balance = get_balance!(this);
require!(balance > 1337, "Balance is less than 1337!");
}