No description
Find a file
Timur Gordon 7cdcac5af0 feat: initial spore_daemon for monitoring TFT→Spore token migrations
Mycelium Network daemon that monitors:
- TFT to Spore token migration events
- Network health and sync status
- Pending migrations across the network

Features:
- Schema-driven code generation with OSIS
- HTTP monitoring API at /api/monitor/
- Configurable poll interval and endpoints
- Auto-reconnect with exponential backoff

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 17:48:43 +01:00
data/daemon feat: initial spore_daemon for monitoring TFT→Spore token migrations 2026-01-07 17:48:43 +01:00
src feat: initial spore_daemon for monitoring TFT→Spore token migrations 2026-01-07 17:48:43 +01:00
.gitignore feat: initial spore_daemon for monitoring TFT→Spore token migrations 2026-01-07 17:48:43 +01:00
build.rs feat: initial spore_daemon for monitoring TFT→Spore token migrations 2026-01-07 17:48:43 +01:00
build.sh feat: initial spore_daemon for monitoring TFT→Spore token migrations 2026-01-07 17:48:43 +01:00
Cargo.toml feat: initial spore_daemon for monitoring TFT→Spore token migrations 2026-01-07 17:48:43 +01:00
README.md feat: initial spore_daemon for monitoring TFT→Spore token migrations 2026-01-07 17:48:43 +01:00
run.sh feat: initial spore_daemon for monitoring TFT→Spore token migrations 2026-01-07 17:48:43 +01:00

Mycelium Daemon

Monitors TFChain escrow wallet for incoming TFT transfers and mints equivalent Spore tokens on HeroLedger.

Overview

The Mycelium Daemon is a background service that:

  1. Monitors TFChain: Watches for incoming TFT transfers to the designated escrow wallet
  2. Tracks Migrations: Records all detected transfers with their confirmation status
  3. Mints Spore Tokens: Once transfers are confirmed, mints equivalent Spore tokens on HeroLedger (NEAR-based)
  4. Maintains State: Uses OSIS for persistent storage of transfer records and configuration

Architecture

TFChain (TFT) ──────────────────┐
                                │
     User sends TFT to    ──────┼──> Daemon detects transfer
     escrow wallet              │
                                │
                                ▼
                        ┌───────────────┐
                        │  OSIS Store   │
                        │ (transfers,   │
                        │  config)      │
                        └───────────────┘
                                │
                                ▼
                        ┌───────────────┐
                        │  HeroLedger   │
                        │  (SPORE mint) │
                        └───────────────┘

Building

./build.sh

Or manually:

cargo build --release

Usage

Start the daemon

./run.sh

Or manually:

./target/release/mycelium-daemon start

Check status

./target/release/mycelium-daemon status

View configuration

./target/release/mycelium-daemon config

List transfers

# All transfers
./target/release/mycelium-daemon transfers

# Filter by status
./target/release/mycelium-daemon transfers --status completed

# With pagination
./target/release/mycelium-daemon transfers --offset 0 --limit 50

Configuration

The daemon stores its configuration in the OSIS database. Default values:

Setting Default Description
escrow_wallet 5GrwvaEF... TFChain address to monitor
tfchain_url wss://tfchain.grid.tf:443 TFChain WebSocket endpoint
heroledger_url https://rpc.mainnet.near.org NEAR RPC endpoint
spore_contract spore.near SPORE token contract
exchange_rate 1.5 SPORE/TFT Conversion rate (stored as nanoSpore)
min_confirmations 12 Blocks before processing
poll_interval_ms 10000 Check frequency

Transfer Status Flow

Detected → Confirmed → Minting → Completed
                ↓
              Failed (can be retried)

Development

Schema

The daemon uses OSIS schemas defined in src/domains/daemon/monitor.oschema:

  • MonitoredTransfer: Tracks individual TFT→SPORE migrations
  • DaemonConfig: Global daemon configuration
  • DaemonStats: Runtime statistics

Generated Code

Code is auto-generated from schemas during build. The generated modules are in src/code/.

License

Apache-2.0