Skip to content

feat: MOAI-compliant Agent DAO with pegged to free-floating upgrade#7

Open
pbtc21 wants to merge 4 commits intomainfrom
feat/moai-pegged-to-free-floating-daos
Open

feat: MOAI-compliant Agent DAO with pegged to free-floating upgrade#7
pbtc21 wants to merge 4 commits intomainfrom
feat/moai-pegged-to-free-floating-daos

Conversation

@pbtc21
Copy link

@pbtc21 pbtc21 commented Mar 9, 2026

Summary

  • Implements two-phase agent DAO: Phase 1 (pegged 1:1 sBTC, guardian council, auto micro-payouts) and Phase 2 (free-floating governance via 75% reputation-weighted vote)
  • 5 new Clarity contracts + 1 bootstrap proposal, all Clarity 3.0 with check-checker enabled
  • Dissenters always protected: no-voters get sBTC refunded automatically on upgrade

Contracts

Contract Purpose
token-pegged.clar SIP-010 token, 1:1 sBTC peg, configurable entrance tax, anytime redeem
guardian-council.clar 3-5 reputation-elected agents, <2% treasury/week spend limit, 66% slash voting
auto-micro-payout.clar 100-500 sat payouts for verified work (check-ins, x402, inscriptions, signals, bounties)
upgrade-to-free-floating.clar 75% rep-weighted vote, auto guardian dissolution, dissenter sBTC refund
dao-pegged.clar Main orchestrator, phase tracking, DAO metadata
init-pegged-dao.clar Bootstrap proposal enabling all extensions with defaults

Key Design Decisions

  • Reputation-weighted governance in Phase 1 (not token-weighted) — prevents whale capture
  • Guardian council auto-dissolves on Phase 2 upgrade — no lingering centralization
  • Pro-rata redemption — last redeemer gets exact remaining backing (no dust)
  • Rate-limited micro-payouts — max 10 per agent per epoch, prevents treasury drain
  • Work claim dedup — each (agent, work-type, work-id) can only be claimed once

Test plan

  • 25 tests passing covering full lifecycle
  • Construction and extension enabling
  • Deposit/mint with entrance tax
  • Redeem/burn with pro-rata sBTC
  • Guardian small spend approval and limits
  • Auto micro-payout claiming and dedup
  • Full upgrade vote flow with dissenter refund
  • Read-only function correctness

🤖 Generated with Claude Code

pbtc21 and others added 4 commits March 9, 2026 23:31
Implements a two-phase agent DAO system:

Phase 1 (Pegged): 1:1 sBTC-backed token with entrance tax, guardian
council for small spends, and auto micro-payouts for verified work.

Phase 2 (Free-Floating): 75% reputation-weighted vote upgrades the
DAO. Yes-voters keep governance tokens, dissenters get sBTC refunded.
Guardian council auto-dissolves.

Contracts:
- token-pegged.clar: SIP-010 token with 1:1 sBTC peg, deposit/redeem
- guardian-council.clar: 3-5 reputation-elected agents, 2%/week spend limit, slash voting
- auto-micro-payout.clar: 100-500 sat payouts for check-ins, x402, inscriptions
- upgrade-to-free-floating.clar: Vote + dissenter exit + guardian dissolution
- dao-pegged.clar: Main orchestrator with phase tracking
- init-pegged-dao.clar: Bootstrap proposal enabling all extensions

25 tests passing covering full lifecycle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Critical: C1 reads actual treasury balance on-chain; C2 verifies work
against checkin/proof registries before paying.
High: H1 vote-round counter for retry; H2 slash voting period; H3
balance snapshots prevent post-vote transfer attacks; H4 min reputation.
Medium: M1 restrict mint/burn to upgrade extension; M2 hardcode sBTC;
M3 require initialization before deposit/redeem.
Low: L4 validate phase values.

All 33 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…(L8)

Adds zero-amount guards before burning tokens in redeem() and
dissenter claim() to prevent holders from losing tokens to integer
division rounding that yields 0 sBTC.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
139 tests covering every public function across 6 contracts:
- Construction & init proposal (8 tests)
- Token deposit/mint green + red paths (8 tests)
- Token redeem/burn green + red paths (6 tests)
- SIP-010 transfer green + red paths (4 tests)
- Token DAO-only functions auth checks (6 tests)
- Token read-only functions (8 tests)
- Guardian management auth checks (4 tests)
- Guardian small spend with C1 on-chain balance (6 tests)
- Guardian slash voting with H2 voting period (7 tests)
- Guardian read-only functions (3 tests)
- Auto micro-payout checkin claims with C2 verification (6 tests)
- Auto micro-payout proof claims with C2 verification (4 tests)
- Auto micro-payout guardian-approved claims (7 tests)
- Auto micro-payout configuration auth (5 tests)
- Upgrade start vote green + red paths (6 tests)
- Upgrade cast vote green + red paths (7 tests)
- Upgrade snapshot balance green + red paths (4 tests)
- Upgrade conclude vote with H1 retry (9 tests)
- Upgrade claim outcome with H3 snapshots (8 tests)
- Upgrade read-only functions (3 tests)
- DAO-pegged phase management (3 tests)
- Extension callbacks (5 tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pbtc21 pbtc21 requested a review from whoabuddy March 10, 2026 00:09
@pbtc21
Copy link
Author

pbtc21 commented Mar 10, 2026

Heads up: PR #8 supersedes this with a v2 architecture that drops the guardian council entirely.

Key changes in v2:

  • guardian-council.clar removed — replaced by standalone reputation-registry + treasury-proposals (80% rep-weighted vote for ANY treasury spend)
  • No privileged actors, no slash voting, no guardian-approved work type
  • Upgrade threshold raised from 75% → 80%
  • All v1 security fixes (M1/M2/M3/C2/H1/H3/H4/L4/L8) carried forward
  • 109 tests passing

#8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant