Skip to main content
The core.numericInvariant guard compares an op’s handle output against a constant threshold, on chain at execution time. If the comparison fails, the transaction reverts. The simulated value plays no part, and the compile result reports no minimum.

When to use it

Use it for an absolute bound, such as “the Aave health factor is at least 1.2”. It accepts handle outputs only, for example aave.getHealthFactor.healthFactor, core.call.result or uniswapV3.mint.liquidity. For a resource output such as lifi.zap.amountOut, use slippage or bind the output to an invariant.gte node. See the guard catalog to compare guards.

Config

Example

Revert unless the signer’s Aave v3 health factor on Base is at least 1.2:
In a real flow, put this check after the ops that change the position, for example after an aave.borrow. The compile doesn’t evaluate the threshold by default: a violated threshold still returns a transaction, which reverts on chain. With simulateUserProgram: true, as above, the compile fails with simulation_revert instead.