core.numericInvariant guard asserts a numeric comparison against an op’s output port at simulation time, turning the observed value into an on-chain invariant. Use it when you need an explicit bound on a produced amount — for example, requiring that a deposit returns at least some minimum number of shares, or that a leftover balance is exactly zero.
Unlike slippage, which expresses tolerance relative to the expected amount in basis points, core.numericInvariant compares against an absolute threshold you supply. It targets handle outputs only.
Config
| Field | Type | Description |
|---|---|---|
port | string | The op output port (a handle) to assert against. |
op | 'gte' | 'gt' | 'lte' | 'lt' | 'eq' | 'neq' | The comparison operator applied as value <op> threshold. |
threshold | string | The bound to compare against, as a decimal-integer string (base-unit, no decimals). |
Example
Require that a zap’samountOut port produces at least 1000000 base units:

