Macro anchor_lang::require_gte
source · [−]macro_rules! require_gte {
($value1: expr, $value2: expr, $error_code: expr $(,)?) => { ... };
($value1: expr, $value2: expr $(,)?) => { ... };
}
Expand description
Ensures the first NON-PUBKEY value is greater than or equal to the second NON-PUBKEY value.
Can be used with or without a custom error code.
Example
ⓘ
pub fn set_data(ctx: Context<SetData>, data: u64) -> Result<()> {
require_gte!(ctx.accounts.data.data, 1);
ctx.accounts.data.data = data;
Ok(());
}