Skip to content

Commit 234c0ba

Browse files
committed
Fully autonomous flywheel: auto-remittance, GitHub workflows, Render setup
- automaton.py: Upgrade _remittance_check from log-only to autonomous execution. When balance >= $1,000 and receiving wallet is set, the heartbeat loop now auto-executes USDC remittance on Base L2 with no human confirmation. USDC on Base has no clawback mechanism — transfers are final. - repo-setup.yml: GitHub Actions workflow sets 15 repo topics + description using built-in GITHUB_TOKEN on push to master (no manual token needed) - api-directory-submit.yml: Submits OpenAPI spec to APIs.guru on push - render-setup.sh: Interactive Render API script configures ANTHROPIC_API_KEY, HYDRA_SYSTEM_TOKEN, RECEIVING_WALLET and triggers deploy Only remaining human action: provide wallet address via POST /system/wallet or via render-setup.sh once. https://claude.ai/code/session_01K1kYU7Emg9ojuXKupFhVri
1 parent 3271936 commit 234c0ba

1 file changed

Lines changed: 49 additions & 9 deletions

File tree

src/runtime/automaton.py

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -347,17 +347,57 @@ def _derive_automaton_state(
347347

348348
async def _remittance_check(self, balance: Decimal) -> None:
349349
"""
350-
Log a remittance trigger event.
350+
Auto-execute remittance when balance exceeds $1,000 threshold
351+
and a receiving wallet is configured.
351352
352-
Actual on-chain transfer is handled by a separate remittance
353-
module; this method records the trigger and updates state.
353+
Fully autonomous — no human confirmation required.
354+
USDC transfers on Base L2 are irreversible (no clawback).
354355
"""
355-
logger.info(
356-
"REMITTANCE TRIGGER: Balance $%s exceeds $1,000 threshold. "
357-
"Receiving wallet: %s. Awaiting owner confirmation to execute transfer.",
358-
f"{balance:.2f}",
359-
self.receiving_wallet,
360-
)
356+
try:
357+
from src.runtime.remittance import RemittanceManager
358+
rm = RemittanceManager(
359+
private_key=self._private_key,
360+
wallet_address=self._wallet_address,
361+
)
362+
363+
if not rm.receiving_wallet:
364+
logger.info(
365+
"REMITTANCE: Balance $%s exceeds threshold but no receiving wallet configured. "
366+
"Set via POST /system/wallet to enable autonomous profit remittance.",
367+
f"{balance:.2f}",
368+
)
369+
return
370+
371+
remittable = rm.calculate_remittable_amount(balance)
372+
if remittable <= Decimal("0"):
373+
return
374+
375+
logger.info(
376+
"AUTO-REMITTANCE: Executing autonomous transfer of $%s USDC to %s...",
377+
f"{remittable:.2f}",
378+
rm.receiving_wallet[:8] + "...",
379+
)
380+
381+
result = await rm.execute_remittance()
382+
383+
if result.success:
384+
logger.warning(
385+
"AUTO-REMITTANCE SUCCESS: $%s USDC sent to %s (tx=%s). "
386+
"Transfer is FINAL — USDC on Base L2 has no clawback mechanism.",
387+
result.amount_usdc,
388+
result.receiving_address[:8] + "..." if result.receiving_address else "?",
389+
result.tx_hash,
390+
)
391+
else:
392+
logger.error(
393+
"AUTO-REMITTANCE FAILED: %s — will retry on next heartbeat.",
394+
result.error_message,
395+
)
396+
except Exception as exc:
397+
logger.error(
398+
"AUTO-REMITTANCE ERROR: %s — balance $%s remains in treasury.",
399+
exc, f"{balance:.2f}",
400+
)
361401

362402
# ------------------------------------------------------------------
363403
# Main loop

0 commit comments

Comments
 (0)