{"id":50966807,"url":"https://github.com/blockful/delegation-incentives-system","last_synced_at":"2026-06-18T21:02:29.944Z","repository":{"id":363905040,"uuid":"1175052955","full_name":"blockful/delegation-incentives-system","owner":"blockful","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-10T20:38:15.000Z","size":2217,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-10T22:15:54.873Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://delegation-incentives-system-fronte.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blockful.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-07T06:48:44.000Z","updated_at":"2026-06-10T20:39:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/blockful/delegation-incentives-system","commit_stats":null,"previous_names":["blockful/delegation-incentives-system"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/blockful/delegation-incentives-system","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockful%2Fdelegation-incentives-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockful%2Fdelegation-incentives-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockful%2Fdelegation-incentives-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockful%2Fdelegation-incentives-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blockful","download_url":"https://codeload.github.com/blockful/delegation-incentives-system/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockful%2Fdelegation-incentives-system/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34507160,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-18T21:02:26.327Z","updated_at":"2026-06-18T21:02:29.927Z","avatar_url":"https://github.com/blockful.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ENS Delegation Incentives System\n\nMonorepo for computing and distributing monthly ENS delegation incentive rewards. Active voters and their token holders earn pro-rata shares of a tier-based reward pool determined by month-over-month growth in the total voting power held by active voters.\n\n## Architecture\n\nSingle-service: Ponder indexes on-chain events and serves REST API endpoints from the same process.\n\n```\npackages/\n└── domain/          — Pure incentives logic (no framework deps, fully tested)\n\napps/\n├── backend/         — Ponder indexer + Hono REST API\n└── frontend/        — Web dashboard (placeholder)\n```\n\n## Quick Start\n\n```bash\n# 1. Copy env and fill in values\ncp .env.example .env\n\n# 2. Install dependencies\npnpm install\n\n# 3. Run tests\npnpm --filter @ens-dis/domain test\npnpm --filter @ens-dis/backend test\n\n# 4. Start the backend (requires RPC_URL and DATABASE_URL)\npnpm --filter @ens-dis/backend dev\n```\n\n## Environment Variables\n\n| Variable | Description |\n|---|---|\n| `RPC_URL` | Ethereum mainnet RPC (required) |\n| `DATABASE_URL` | PostgreSQL connection string (required) |\n| `BACKEND_PORT` | API port (default: 42069) |\n| `ROUND_MONTHS` | Comma-separated configured round months, e.g. `2026-03,2026-04,2026-05` |\n| `BLOCKFUL_API_TOKEN` | Bearer token forwarded by the backend to the Gateful relayer (required when relayer is enabled) |\n| `GATEFUL_UPSTREAM_URL` | Upstream Gateful relayer base URL (required when relayer is enabled) |\n| `ALLOWED_ORIGINS` | Comma-separated frontend origins permitted to call this backend cross-origin (required in production when the SPA hits the backend on a different origin) |\n\n## API Endpoints\n\nRoutes are served at the root (no `/api` prefix on the backend). Frontends configure a base via `VITE_API_BASE_URL` if they want one.\n\nScalar API reference at `GET /docs`. OpenAPI 3.0 spec at `GET /openapi.json`.\n\n| Method | Path | Description |\n|--------|------|-------------|\n| `GET` | `/health` | Ponder's built-in liveness check (use this for Railway/uptime probes) |\n| `GET` | `/voters/active` | Addresses that voted on ≥ 7 of the last 10 proposals |\n| `GET` | `/eligibility/{address}` | Is this address an active voter or a token holder of one? |\n| `GET` | `/tiers/progression` | Current tier, VP needed for next tier, all tier thresholds |\n| `GET` | `/apy/{address}` | Estimated monthly reward and annualized APY |\n| `GET` | `/distributions/{month}` | Fetch a stored distribution (JSON) |\n| `GET` | `/distributions/{month}/csv` | Download distribution as CSV |\n\nThe backend also starts an automatic distribution scheduler in normal runs. It waits for Ponder readiness, then scans every minute and computes any configured `ROUND_MONTHS` that ended at least one minute ago and are not already cached.\n\n## Documentation\n\n| Document | Contents |\n|---|---|\n| [docs/algorithm.md](./docs/algorithm.md) | Full pipeline spec: each step, all formulas, pool tiers, TWB, cap redistribution, lottery |\n| [docs/integrations.md](./docs/integrations.md) | Protocol integrations: contracts indexed, events handled, how data feeds the pipeline |\n| [OPERATOR.md](./OPERATOR.md) | Operator guide: running a distribution round, CSV export, monitoring |\n\n## Tech Stack\n\n- **Indexer \u0026 API**: Ponder 0.16, Hono, Zod OpenAPI, Drizzle ORM\n- **Domain logic**: Pure TypeScript, zero framework dependencies\n- **Arithmetic**: BigInt throughout — no floating point\n- **Testing**: Vitest, fast-check (property-based)\n- **Package manager**: pnpm workspaces\n\n## Gasless Delegation (Relayer)\n\nThe frontend delegates voting power via a gasless relayer (when eligible) or falls back to a direct on-chain `delegate(address)` call. Backend routes at `/api/gateful/:dao/relay/*` proxy the upstream Gateful relayer with the bearer token injected server-side.\n\nEligibility is the only gate: if the relayer's `/balance` reports `hasEnoughBalance: false`, the upstream is unreachable, or the user is over their rate limit / under `minVotingPower`, the modal switches to direct-tx automatically. To take gasless offline cluster-wide without a redeploy, make `/balance` return `hasEnoughBalance: false`.\n\n## Resources\n\n- [ENS Forum — Delegation Incentives Temp Check](https://discuss.ens.domains/t/temp-check-delegation-incentives-program/21824) — original spec\n- [ERC20MultiDelegate contract](https://etherscan.io/address/0x3CA5CCC96648d016D41c5aF40eED82202BD019cc)\n- [Hedgey TokenVestingPlans contract](https://etherscan.io/address/0x2CDE9919e81b20B4B33DD562a48a84b54C48F00C)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblockful%2Fdelegation-incentives-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblockful%2Fdelegation-incentives-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblockful%2Fdelegation-incentives-system/lists"}