feat(oneshot): add auto-redemption via RedeemEngine
When a position's market expires, RedeemEngine automatically polls the CTF contract and redeems the winning position on-chain — no manual redeem needed. Flow: 1. expirePosition() queues the expired position into RedeemEngine 2. RedeemEngine polls every 30s (ONESHOT_REDEEM_POLL_MS) 3. Checks Gamma API first, then CTF.payoutDenominator() on-chain 4. When settled: emits redemption:complete event with final P&L 5. Orchestrator passes P&L to RiskEngine DRY_RUN=true: simulates by reading on-chain payouts and logging win/loss DRY_RUN=false: submits real redeemPositions() tx on Polygon (gasLimit 300k) Also stores conditionId and negRisk in PositionEngine state so the expired position has all data needed for redemption without extra lookups. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
2692694309
commit
89a7803aa8
@@ -188,6 +188,10 @@ ONESHOT_DAILY_LOSS_CAP=20
|
||||
# Maximum milliseconds to wait for a FOK fill ack (timeout → cancel → IDLE)
|
||||
ONESHOT_FILL_TIMEOUT_MS=800
|
||||
|
||||
# How often (ms) to poll for on-chain redemption after market expiry.
|
||||
# 5m markets typically settle on-chain within 2–5 minutes after close.
|
||||
ONESHOT_REDEEM_POLL_MS=30000
|
||||
|
||||
# Enable verbose debug logging (discovery probes, gate results, scoring, heartbeat)
|
||||
# Can also be enabled with: npm run oneshot-debug
|
||||
# Or on the command line: ONESHOT_DEBUG=true npm run oneshot
|
||||
|
||||
Reference in New Issue
Block a user