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