⚠ INTERNAL — Operator UX mock · Design preview of V2 development path · demo-wired ≠ production-live · back to dev guide
Polygon · pUSD 10
📓 Developer Guide 📋 Reason Codes 📈 Shadow Mode
JD John Doe · Admin

AllowanceMonitor

sec.allowancemonitor
Security planned Spec started frozen

Track ERC-20 allowances per token and contract; alert and shrink to a tight ceiling on idle.

What it does

Track ERC-20 allowances per token and contract; alert and shrink to a tight ceiling on idle.

Pipeline placement

runs after: Strategy OrderIntent AllowanceMonitor runs before: Any order that requires an on-chain allowance

Applies to: All ERC-20 allowances on Polygon for the trading wallet

Why it matters

If this failsConsequence
Unbounded ERC-20 allowance left idleA compromised or malicious contract can drain the wallet's pUSD balance at any future time.
Allowance not shrunk after idle periodUnlimited approvals compound risk; industry incidents show dormant allowances are frequently exploited.
No alert on unbounded approvalOperators remain unaware of excessive exposure until an incident occurs.

Inputs

Polymarket inputs

InputSourceRequiredUse
ERC-20 allowance(owner, spender) on PolygononchainrequiredRead current pUSD allowance for CTFExchangeV2 and NegRiskAdapter.
Block timestamp for last useonchainrequiredDetermine idle duration to trigger auto-shrink.

Internal inputs

InputSourceRequiredUse
Configured max_allowance_usd and idle_revoke_hAdmin UIrequiredThresholds for alert and auto-shrink decisions.
KillSwitch active flagKillSwitchrequiredHalt allowance operations when kill switch is active.

Authority

What this bot is permitted to do

Reject Pause

State

Readiness

Spec started

Status

planned

Class

Guardrail

Default mode

shadow_only

Developer owner

Polytraders core

Capital impact

Direct

Reason codes emitted

CodeSeverityMeaningAction
KILL_SWITCH_ACTIVEHARD_REJECTGlobal kill switch is active.Immediately return DENY.
ALLOWANCE_EXCEEDS_CEILINGHARD_REJECTERC-20 allowance for a spender exceeds max_allowance_usd and auto_shrink is disabled.Return DENY and emit alert.
STALE_DATAHARD_REJECTRPC call to read allowance failed or returned stale data.Return DENY; retry on next order.
ALLOWANCE_NEAR_CEILINGWARNAllowance is within 10% of max_allowance_usd.Log warning; continue.
ALLOWANCE_SHRUNKINFOauto_shrink triggered and approval reduced to exact order size.Log info; proceed.

Used by

Reverse index — strategies that currently reference sec.allowancemonitor. If you change this bot's authority or reason codes, these strategies must re-pass shadow.

StrategyStateActivity
Crypto Q2 — basket rebalancefrozenlast triggered 35m ago
US Elect — book-builderdemo-wiredlast triggered 42m ago

Showing 2 of 2 · demo-wired ≠ production-live

Why this matters

Security bots does NOT propose or execute trades; only guards signing and wallet operations. Understanding the authority boundary prevents misuse and makes promotion-gate reviews faster and more reliable. View raw spec JSON →
Polytraders Operator UX Mock · INTERNAL · demo-wired ≠ production-live · the plan · reason codes · shadow-mode pipeline
⚙ Page Configuration
Current page settings
Loading configuration…