#| | | | | | | |/ ` / _| ' \
#| || | || | | | (| _ \ | | |
Guilds is a contract-first Starknet system for on-chain guild governance, treasury operations, and dual revenue distribution (members + shareholders).
src/guild/guild_contract.cairo: guild core state machine (membership, roles, treasury, revenue, shares)src/token/guild_token.cairo: ERC20Votes-style guild token with inactivity handlingsrc/governor/guild_governor.cairo: governance control planesrc/models/*: canonical structs, constants, and eventstests/*.cairo: unit + integration-style coverage by domainsdk/: typed TypeScript SDK with compatibility gate and smoke tests
# Option A: use your existing local Scarb/Snforge install
scarb fmt --check --workspace
snforge test
# Option B: project verify fallback
bash -lc 'sozo test || scarb test'cd sdk
npm install
npm run verifyGuilds uses Graphite stack workflows for incremental contract delivery.
gt create -m "feat(guilds): <scope>"
gt restack --upstack --no-interactive
gt submit --stack --no-interactiveOperator scripts:
scripts/operator/repair-graphite-stack.sh: detects/tracks untracked branches, restacks with fallbackscripts/operator/qa-self-heal.sh: verify-loop with deduplicated failure task generation
- Contracts:
scarb fmt --check --workspace && snforge test - Fallback verify:
sozo test || scarb test - SDK type + compat + tests + build:
cd sdk && npm run verify
Package: @runelabsxyz/guilds-sdk
- Typed client API (
core/client/types/utils/errors/config/bindings) - Contract compatibility gate via
sdk/generated/contracts.signature.json - Deterministic error model (
GuildsSdkErrorwith fixed error codes) - Retry support for transport operations
- Example flows in
sdk/examples/
Common flows:
- Create guild
- Register/wire addresses
- Governance action + vote
- Treasury and token/share operations
- Governor-only and permission-gated boundaries enforced in guild logic
- Explicit numeric bound checks (BPS sums, plugin action ranges)
- Deterministic panic/error paths for negative scenarios
- Event coverage for indexers (
src/models/events.cairo)
See docs/CONTRACT-GUIDELINES-CHECKLIST.md for itemized evidence.
- Completed: data model, permissions, lifecycle, token, governor, treasury, revenue
- Completed: SDK productization and operator automation
- Stack integration pending: Graphite stack submit + merge
Vault coverage is tracked in docs/VAULT-COVERAGE.md.
- Release readiness:
docs/RELEASE-READINESS.md - SDK changelog:
sdk/CHANGELOG.md - Contract spec:
docs/SPEC.md
Weekly distribution of guild earnings:
- 50% to guild players (split by role)
- 30% retained in treasury
- 20% to shareholders
Player breakdown: Default allocations (modifiable via vote):
- CEO 25%
- Co‑Leaders 25%
- Officers 25%
- Members 25%
- Recruits 0%
Shareholder payouts are proportional to shareholdings. Master wallet can trigger ad-hoc distributions.
src/— core guild contracts (roles, governance, treasury, revenue, lifecycle)tests/— integration and edge-case suites (snforge)docs/— protocol and implementation notes.othala/— orchestration config (merge mode + auto-submit)
A lightweight playground app/CLI should allow any dev to:
- create guilds with realistic params
- simulate join/invite/blacklist/revoke lifecycle
- execute role-gated treasury actions
- run governance proposals/voting/execution
- simulate revenue epochs, claims, and redemptions
- inspect onchain state transitions and emitted events
Goal: reproduce full user journeys without hand-written scripts.
Provide an SDK that external games can integrate with minimal friction:
- typed client for guild read/write methods
- event/indexing helpers
- action builders for governance and treasury operations
- role/permission capability checks before tx submission
- canonical error mapping and retry semantics
First integrator: PonziLand, but API surface should remain generic.
QA should verify real behavior, not only compile success.
Required suites:
- Protocol invariants: role matrix, governor bypass constraints, dissolved-guild restrictions
- Lifecycle flows: create → invite/join → role changes → leave/kick/blacklist → dissolve
- Governance flows: propose, vote, quorum checks, execute/defeat timing windows
- Treasury flows: transfer/approve/plugin actions with spending limits and permissions
- Revenue flows: epoch finalization, split accounting, member vs shareholder claims
- Adversarial/edge cases: invalid callers, stale invites, duplicate actions, limit overflow, ordering races
Exit criteria for production readiness:
- green end-to-end flows via snforge suite
- no unresolved high-severity invariants
- deterministic SDK behavior on expected failure paths
Contributions welcome! Fork, branch, code, test, and submit a PR. Follow code standards and add tests for new logic.
MIT. See LICENSE for details.