No description
Find a file
despiegk 4d08cb92d6
Some checks failed
Build and Test / build (push) Failing after 10s
docs: update README to use Makefile targets
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 10:11:53 +04:00
.forgejo/workflows feat: add build system with Makefile, buildenv.sh, and Forgejo CI workflows 2026-02-07 10:08:41 +04:00
data/daemon feat: initial spore_daemon for monitoring TFT→Spore token migrations 2026-01-07 17:48:43 +01:00
scripts feat: add build system with Makefile, buildenv.sh, and Forgejo CI workflows 2026-02-07 10:08:41 +04: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
buildenv.sh feat: add build system with Makefile, buildenv.sh, and Forgejo CI workflows 2026-02-07 10:08:41 +04:00
Cargo.toml feat: initial spore_daemon for monitoring TFT→Spore token migrations 2026-01-07 17:48:43 +01:00
Makefile feat: add build system with Makefile, buildenv.sh, and Forgejo CI workflows 2026-02-07 10:08:41 +04:00
README.md docs: update README to use Makefile targets 2026-02-07 10:11:53 +04: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

make build        # Release build
make install      # Build and install to ~/hero/bin
make installdev   # Debug build and install (fastest)

Usage

make run          # Build and run the daemon
make dev          # Run with debug logging

# Or directly:
mycelium-daemon start
mycelium-daemon status
mycelium-daemon config
mycelium-daemon transfers
mycelium-daemon transfers --status completed

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

make check        # Fast code check
make test         # Run tests
make fmt          # Format code
make lint         # Run clippy
make help         # Show all available targets

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