The Graph subgraph for the Perpetual Organization Protocol (POP) — the indexing layer that powers every list, dashboard, profile, and agent heartbeat across the Poa ecosystem.
If you've never heard of Poa, start with the organization README — it explains why contribution-based, on-chain organizations exist and what POP does for them. This README is for people who want to query, run, or contribute to the subgraph itself.
poa.box · Discord · @PoaPerpetual
POP is split across a small number of repositories. Each one is independently useful; together they're the platform.
| Repo | Role |
|---|---|
| poa-box/POP | Solidity contracts: orgs, voting, vouching, tasks, education, treasury, agent identity. The source of truth for events this subgraph indexes. |
| poa-box/subgraph-pop (you are here) | The Graph subgraph that turns POP's events into a queryable GraphQL API. |
| poa-box/Poa-frontend | The Next.js app at poa.box. Reads from this subgraph, writes to POP contracts. |
| poa-box/poa-cli | Terminal-native interface and autonomous-agent framework. Also reads from this subgraph. |
When you change an event signature in POP, you'll change the ABI and handler here. When you add a new field to the schema here, the frontend and CLI gain a new thing to render. The three repos move together.
POP is deployed on Arbitrum One (the identity home chain) and Gnosis. The subgraph follows, published to The Graph Studio under:
| Source directory | Network | Subgraph slug |
|---|---|---|
pop-subgraph/ |
Arbitrum One | poa-arb-v-1 |
pop-subgraph/ |
Gnosis | poa-gnosis-v-1 |
peer-cashoutrelay-base/ |
Base | peer-cashoutrelay-base |
peer-cashoutrelay-base is a separate, much smaller subgraph in this repo covering the CashOutRelay contract on Base. It shares the toolchain and CI but not the schema.
Live query URLs are listed on each subgraph's page in The Graph Studio. Deployments are continuous: a merge to main touching pop-subgraph/**, peer-cashoutrelay-base/**, scripts/**, or .github/workflows/** runs .github/workflows/ci.yml. All three deploy jobs are started, but the reusable workflow they call filters by its own working-directory, so each one only builds, tests and deploys when that subgraph actually changed. A pop-subgraph/** change therefore does not redeploy the Base subgraph, and a scripts/** or workflow-only change deploys nothing — it just runs the wasm-start-guard.
Hardcoded entry-point addresses live in pop-subgraph/networks.json: GovernanceFactory, PoaManager, ImplementationRegistry, PoaManagerHub, PoaManagerSatellite, Hats, and PoaDKIMRegistry. Everything else (per-org TaskManager, HybridVoting, EligibilityModule, etc.) is discovered dynamically via templates as orgs deploy.
The Ethereum RPC endpoint behind your graph-node must serve archive state and support EIP-1898 block parameters. This matters most for self-hosted graph-node deployments — Studio and Graph Network indexers generally provision archive nodes already, but if you point graph-node at your own RPC, it's on you.
Why: graph-node attaches the hash of the block currently being indexed to every eth_call a mapping makes, as an EIP-1898 block parameter. There is no "just read current state" call available from a handler — a call made while indexing block N is resolved against the state at block N, even when N is far behind the chain head. Pruned and full nodes keep only a short window of recent state (commonly ~128 blocks), so any call made while the subgraph is backfilling — which is every call during the initial sync — has no state to execute against and fails.
This subgraph does make such calls: nine .bind() sites across eight files in pop-subgraph/src (participation-token.ts, hybrid-voting.ts, direct-democracy-voting.ts, eligibility-module.ts, org-registry.ts, poa-manager.ts ×2, paymaster-hub.ts, zk-email-invites.ts), plus one in peer-cashoutrelay-base/src/cash-out-relay.ts. Run grep -rn '\.bind(' pop-subgraph/src for the current list.
The failure mode is silent. Every one of those calls is try_-guarded, so a revert is not an error — the guard skips the assignment, the handler returns normally, and indexing stays green. You do not get a failed subgraph; you get permanently missing fields. Concretely, on a non-archive endpoint:
ParticipationTokenContract.name/.symbolstay as the empty strings seeded at deploy time, and the UI falls back to a placeholder forever.ParticipationTokenContract.hatsContractstays at the zero address. It is set only insideinitialize(), is carried on no log and has no setter, so theeth_callis the only source for it. (.executoris safe:OrgDeployedcarries it andorg-deployer.tsseeds it directly — which is why no call is made for it.)- Deploy-time
HatPermissionrows go missing:Creatorfor bothHybridVotingandDirectDemocracyVoting, plusVoterforDirectDemocracyVoting. (HybridVoting voters are class-based, so there is no voting-hat array to read.) - An EducationHub registered after its org was deployed gets no
HatPermissionrows at all: its initializer events are in an earlier block, outside the template's range, sowirePostDeployModulereadscreatorHatIds()/memberHatIds()instead (org-registry.ts). Roledata hydrated fromHats.viewHat()and thePaymasterHubconfig read inhandleInfrastructureDeployedstay unpopulated.
If those fields are blank in a deployment, suspect the RPC before suspecting the mappings.
The subgraph reads 27 ABIs and writes ~157 entity types into a single GraphQL schema rooted on Organization. The major domains:
- Organizations & membership.
Organization,User,Account(universal username registry),RoleWearer, plus the per-orgOrgMetadatafrom IPFS. - Roles & permissions. Roles are Hats; the subgraph indexes the Hats v1 contract directly and joins it to per-org
RoleandHatPermissionentities. Vouching is captured asVouchandRoleApplicationentities underEligibilityModule. - Voting.
ProposalandVotefor hybrid voting;DDVProposalandDDVVotefor direct democracy.VotingClassrecords the per-class weighting (democracy, PT, ERC-20, optionally quadratic). - Tasks & projects.
Project,Task,TaskApplicationwith the IPFSTaskMetadata/ProjectMetadatapayloads attached. - Participation Tokens.
TokenBalanceandTokenRequestfor the contribution-based governance currency. - Education.
EducationModuleandModuleCompletionfor the learn-to-earn flow. - Payments & treasury.
Distribution,Claim,Paymentfor merkle-distribution payouts. - Gas sponsorship.
PaymasterOrgConfig,PaymasterRule,PaymasterBudget,UsageEventfor the ERC-4337 paymaster. - Identity & passkeys.
Account,PasskeyAccount,PasskeyCredential,RecoveryRequest. - Email-based invites.
ZkEmailInvites,ZkEmailClaim,ZkEmailRegisteredEmail,ZkEmailAllowlist, plusDkimRegistry/DkimKeyfor the DKIM keys those proofs verify against. - Protocol upgrades.
Beacon,BeaconUpgrade,ImplementationRegistryContract,ImplementationType,ImplementationVersion— which implementation each org's proxies point at, and when it changed. - Cross-chain plumbing.
PoaManagerHubContract,SatelliteRegistration, and the cross-chain dispatch/receive event entities for hub-and-spoke deployment. - Access v2 (
MembershipAuthority). The per-org authority that supersedesEligibilityModule+ToggleModulefor migrated orgs:Subject(roles and groups),SubjectMembership(with the eligibility fold mirror, so membership needs noeth_call),AccessRule,SubjectVouchConfig/SubjectVouchRecord,PermRow,PendingAction, and theAuthorityRouterbindings that mark each org's cutover. Seepop-subgraph/docs/WAVE-E-ACCESS-V2.md.
The full schema is in pop-subgraph/schema.graphql.
{
organizations(first: 10, orderBy: deployedAt, orderDirection: desc) {
id
name
metadata { description logo }
roles {
name
wearers { wearer wearerUsername }
}
hybridVoting {
proposals(first: 5, orderBy: createdAtBlock, orderDirection: desc) {
title
status
winningOption
wasExecuted
votes { voter optionIndexes optionWeights }
}
}
}
}All commands run from a subgraph directory (pop-subgraph/ or peer-cashoutrelay-base/).
- Node 20.18.1 or newer.
@graphprotocol/graph-clideclaresengines: { node: ">=20.18.1" }, and CI runs Node 20. Older majors will fail on install or at runtime. - yarn (1.x classic). If you don't have yarn:
npm i -g yarn. This repo is yarn-only —package-lock.jsonis gitignored and CI keys its cache offyarn.lock. - The Graph CLI is installed as a project dependency — no global install needed.
- Docker (only if you want to run a local Graph node).
- An archive RPC endpoint for whichever chain you index — see RPC requirement above.
git clone https://github.com/poa-box/subgraph-pop.git
cd subgraph-pop/pop-subgraph # or peer-cashoutrelay-base
yarn installRun these in order — each step depends on the previous one. The CI runs the same sequence.
yarn codegen # regenerate AssemblyScript types from schema.graphql + ABIs
yarn build # compile to WASM
yarn test # Matchstick unit tests
subgraph-lint # repo-wide lint checks (shell function from the Poa toolchain, run inside the subgraph dir)If any of these fail on main, that's a release blocker; fix it before opening a PR. CI reproduces this sequence on every PR, and adds one gate you can't reproduce with the four commands above:
node ../scripts/check-wasm-start.mjs build # run from the subgraph dir, after yarn buildThat guard rejects a module-level global initialised by a host call, which makes graph-node's allocator hand out an arena on top of the static data segment — string literals read back empty and indexing dies on the first trigger. It compiles, it passes matchstick, and it passes subgraph-lint, so it needs its own check. See scripts/check-wasm-start.mjs.
pop-subgraph/docker-compose.yml spins up a graph-node + IPFS + Postgres stack pointed at host.docker.internal:8545. With a local node (Anvil, Hardhat) running on :8545:
cd pop-subgraph
docker compose up -d
yarn create-local
yarn deploy-localQuery the local subgraph at http://localhost:8000/subgraphs/name/poa-arb-v-1.
Three things worth knowing:
- The chain name must match the manifest.
docker-compose.ymlregisters the chain asarbitrum-one(ethereum: "arbitrum-one:http://host.docker.internal:8545"), which is what every dataSource inpop-subgraph/subgraph.yamldeclares, andyarn deploy-localpasses no--network. graph-node rejects a manifest for a chain it has no configured provider for, so if you change one side you must change the other. Note thatgraph build --network <x>rewritessubgraph.yamlin place — thebuild:*anddeploy:*scripts rungit checkout -- subgraph.yamlafterwards to put it back, so don't be surprised if a network-specific build leaves the manifest looking untouched. - Addresses and start blocks are live-network values.
networks.jsonpoints at the real Arbitrum One / Gnosis deployments (start blocks in the tens to hundreds of millions — ~447M/489M on Arbitrum One, ~45M on Gnosis). Against a local chain you need your own local addresses and near-zero start blocks. The procedure is inCLAUDE.mdunder Updating the Subgraph for a New Deployment. - Your
:8545node still has to serve archive state for every block indexed. A locally-mined Anvil/Hardhat chain does by default. If you fork a live chain instead, fork from an archive upstream — otherwise thetry_-guardedeth_calls silently no-op and you'll debug missing fields that are really an RPC problem.
The stack bind-mounts its state into pop-subgraph/data/ (gitignored). Delete that directory to reset IPFS and Postgres between runs.
When POP redeploys, only the hardcoded entry points in networks.json need new addresses — currently seven per network (GovernanceFactory, PoaManager, ImplementationRegistry, PoaManagerHub, PoaManagerSatellite, Hats, PoaDKIMRegistry). Everything else is discovered dynamically. The procedure — including the binary-search script for finding startBlock — is documented in CLAUDE.md under Updating the Subgraph for a New Deployment.
Poa is built by its members. The fastest path in is a working diff.
- Pick an open issue in this repo or any of the active repos.
- Add a missing event handler. Compare
pop-subgraph/abis/*.jsonagainstpop-subgraph/subgraph.yaml— if POP emits an event we don't index, that's a contribution-shaped hole. The walkthrough is inCLAUDE.mdunder Adding a New Event Handler. - Improve test coverage. Each handler should have a sibling
tests/<name>.test.tsandtests/<name>-utils.ts. Gaps are easy to find and welcome. - Tighten the schema. Helpful additions: derived fields, computed counts, indexes that speed up frontend queries.
- Fork or branch off
main. - Make the change. From the subgraph dir you touched, run
yarn codegen && yarn build && yarn test && subgraph-lint— all four must pass. - Open a PR against
main. CI will redeploy to Studio if it merges. - For protocol-level discussion, ABI changes, or larger refactors, open a thread in Discord first — it's faster.
- Once you're a Poa member, you'll vote on the org's roadmap and earn Participation Tokens for merged work. Apply on-chain.
These trip everyone up at least once:
src/*.tsfiles are AssemblyScript, not TypeScript. No closures, noArray.map, no template literals, noascasting (usechangetype<T>()),BigIntarithmetic uses.plus()/.minus()methods. Full list of gotchas inCLAUDE.md.- Users are only created in join handlers. Other handlers must use
loadExistingUser(), which returnsnullfor non-members. Creating users elsewhere produces "phantom users" for contract addresses. Details inCLAUDE.mdunder User Creation Rules. - Entity ID conventions are exact. Mismatched IDs cause silent data loss —
entity.load()returnsnulland writes go to a new entity. The canonical patterns are inCLAUDE.mdunder Entity ID Conventions.
CLAUDE.md is the deep-dive contributor reference. Read it before your first non-trivial change; it'll save you a debugging session.
AGPL-3.0, matching the rest of the Poa stack. A LICENSE file will land here shortly; in the meantime see poa-box/POP for the exact text.