GasOracle
GasOracle continuously monitors the Polygon network gas-price environment and advises the execution layer on whether on-chain operations (order submis
What it does
GasOracle continuously monitors the Polygon network gas-price environment and advises the execution layer on whether on-chain operations (order submission, cancel-and-replace, neg-risk conversions) are economically viable at the current gas price. It defers non-urgent operations when gas is above the rolling percentile threshold, and never defers risk-critical operations such as emergency cancellations.
Pipeline placement
Applies to: Every on-chain operation that can be deferred without breaching a risk constraint
Why it matters
| If this fails | Consequence |
|---|---|
| Submitting during a gas spike | Transaction costs erode trade profitability; maker rebates (paid in pUSD) can be wiped out by gas fees on low-edge positions. |
| Deferring a risk-critical cancellation | A resting order that should be pulled stays live during adverse market movement, accumulating unintended exposure. |
| Using a stale 24h gas baseline | The percentile thresholds are miscalibrated, causing GasOracle to defer operations during normal conditions or approve during actual spikes. |
Inputs
Internal inputs
| Input | Source | Required | Use |
|---|---|---|---|
| Polygon mempool gas-price snapshot (gwei) | onchain RPC (eth_gasPrice / fee history) | required | Current gas price evaluated against the rolling 24h percentile baseline. |
| Rolling 24h gas-price baseline | internal time-series store | required | Compute the max_gas_percentile_for_ops threshold from historical distribution. |
| Pending operation queue with urgency flags | internal execution scheduler | required | Identify whether each pending op is risk-critical (never_defer) or deferrable. |
Authority
What this bot is permitted to do
State
Readiness
General live
Status
live
Class
Execution Utility
Default mode
general_live
Developer owner
Polytraders core
Capital impact
Direct
Reason codes emitted
| Code | Severity | Meaning | Action |
|---|---|---|---|
| GAS_ORACLE_OK | INFO | Current gas price is below max_gas_percentile_for_ops; operation approved. | Emit GasDecision.PASS. Operation proceeds normally. |
| GAS_ORACLE_ELEVATED | WARN | Gas price is in the warning band (within 10 percentile points above threshold). Operation approved with annotation. | Emit GasDecision.PASS with warn=true; monitor for further elevation. |
| GAS_ORACLE_SPIKE_BLOCK | RESHAPE | Gas price exceeds max_gas_percentile_for_ops; non-urgent operation deferred. | Emit GasDecision.DEFER with retry_after_s. Operation queued for next lower-gas window. |
| GAS_ORACLE_EV_BELOW_FLOOR | RESHAPE | Neg-risk conversion net EV (after gas cost) is below conversion_min_ev_usd threshold. | Emit GasDecision.DEFER. Conversion not submitted. |
| GAS_ORACLE_RISK_BYPASS | INFO | Risk-critical operation approved unconditionally despite elevated gas (never_defer_risk=true locked). | Emit GasDecision.PASS. Gas check bypassed. Log gas_gwei for audit. |
| GAS_ORACLE_RPC_FAILURE | HARD_REJECT | Polygon RPC gas feed is unreachable; current gas price cannot be determined. | Defer all non-urgent ops. Emit GAS_ORACLE_RPC_FAILURE. Risk-critical ops still approved. |
| GAS_ORACLE_BASELINE_UNAVAILABLE | WARN | Rolling 24h gas baseline store is unreachable or stale; falling back to hard static cap. | Use static 100 gwei cap. Emit WARN annotation on all GasDecision records this cycle. |
| KILL_SWITCH_ACTIVE | HARD_REJECT | Global kill switch is active; all on-chain operations except emergency cancellations are halted. | Defer all non-risk-critical ops. No GasDecision.PASS emitted. |
Related bots in Execution
Used by
Reverse index — strategies that currently reference exec.gasoracle. If you change this bot's authority or reason codes, these strategies must re-pass shadow.
| Strategy | State | Activity |
|---|---|---|
| US Elections — sentiment fade | demo-wired | last triggered 6m ago |
Showing 1 of 1 · demo-wired ≠ production-live
Why this matters
Execution bots does NOT propose new positions; only routes and shapes approved intents. Understanding the authority boundary prevents misuse and makes promotion-gate reviews faster and more reliable. View raw spec JSON →