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 fails | Consequence |
|---|---|
| Unbounded ERC-20 allowance left idle | A compromised or malicious contract can drain the wallet's pUSD balance at any future time. |
| Allowance not shrunk after idle period | Unlimited approvals compound risk; industry incidents show dormant allowances are frequently exploited. |
| No alert on unbounded approval | Operators remain unaware of excessive exposure until an incident occurs. |
Inputs
Polymarket inputs
| Input | Source | Required | Use |
|---|---|---|---|
| ERC-20 allowance(owner, spender) on Polygon | onchain | required | Read current pUSD allowance for CTFExchangeV2 and NegRiskAdapter. |
| Block timestamp for last use | onchain | required | Determine idle duration to trigger auto-shrink. |
Internal inputs
| Input | Source | Required | Use |
|---|---|---|---|
| Configured max_allowance_usd and idle_revoke_h | Admin UI | required | Thresholds for alert and auto-shrink decisions. |
| KillSwitch active flag | KillSwitch | required | Halt 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
| Code | Severity | Meaning | Action |
|---|---|---|---|
| KILL_SWITCH_ACTIVE | HARD_REJECT | Global kill switch is active. | Immediately return DENY. |
| ALLOWANCE_EXCEEDS_CEILING | HARD_REJECT | ERC-20 allowance for a spender exceeds max_allowance_usd and auto_shrink is disabled. | Return DENY and emit alert. |
| STALE_DATA | HARD_REJECT | RPC call to read allowance failed or returned stale data. | Return DENY; retry on next order. |
| ALLOWANCE_NEAR_CEILING | WARN | Allowance is within 10% of max_allowance_usd. | Log warning; continue. |
| ALLOWANCE_SHRUNK | INFO | auto_shrink triggered and approval reduced to exact order size. | Log info; proceed. |
Related bots in Security
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.
| Strategy | State | Activity |
|---|---|---|
| Crypto Q2 — basket rebalance | frozen | last triggered 35m ago |
| US Elect — book-builder | demo-wired | last 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 →