feat(plugins): per-cycle yield-distribution Sankey auto-report - #88
Open
BreadrichEngels wants to merge 3 commits into
Open
feat(plugins): per-cycle yield-distribution Sankey auto-report#88BreadrichEngels wants to merge 3 commits into
BreadrichEngels wants to merge 3 commits into
Conversation
Adds a distribution-sankey profile plugin (sibling to sd-kickoff / weekly-agenda) that, after each new on-chain yield distribution, posts a Mermaid sankey-beta of THAT cycle (per-cycle, not cumulative) to a channel. Derives each cycle straight from events, no subgraph dependency: - polls YieldDistributed logs on the YieldDistributor - for each new cycle block, reads the BREAD Transfer logs FROM the distributor (authoritative recipient + amount — avoids the positional project-array mapping that keeps breaking the subgraph) - renders 'Yield Distributor, <recipient>, <BREAD>' Plain fetch JSON-RPC + minimal hex decoding, so it adds NO dependency. First run anchors to the chain head (no history backfill). Config + state live in the KB (context/distribution-sankey/config.md); no-op until that file exists. Ships the plugin, unit tests for the pure decode/aggregate/render helpers, and a config README. Verified end-to-end against live Gnosis data while building it (22 historical cycles, 59.6k BREAD).
… link) Per review (Ron/Marv's marketing workflow), the per-cycle report is now newsletter-ready: - human cycle DATE (from the block timestamp) - total BREAD + ~USD value (usd_per_bread config, default 1 — BREAD is 1:1 DAI) - gnosisscan tx link for the distribution (explorer_tx_base config) - per-project breakdown with % Adds usd_per_bread + explorer_tx_base config knobs and a formatCycleDate helper; poll() now fetches the block timestamp + tx hash per cycle. Tests cover the new config fields, the date formatter, and the enriched render. Full suite green.
…nth) Adds a container skill so the distribution report can be generated outside the scheduled plugin routine — the call-it-anytime path Ron asked for (and the basis for Marv's monthly post). report.mjs is self-contained (plain fetch JSON-RPC, no deps): derives cycles from YieldDistributed + the BREAD Transfers from the distributor, names from the KB config layered over built-ins, and prints a ready-to-post caption + Mermaid sankey-beta + per-project % breakdown. Modes: latest (default), all (cumulative), month YYYY-MM. Verified live against Gnosis (latest cycle, all-time 22 cycles / 59.6k BREAD, and a month aggregate).
RonTuretzky
force-pushed
the
feat/distribution-sankey-plugin
branch
from
July 31, 2026 20:21
a65598a to
5b2c40b
Compare
RonTuretzky
pushed a commit
that referenced
this pull request
Jul 31, 2026
fix: move getPlatformId patch to whatsapp-auth.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
What — After each new on-chain yield distribution, posts a Mermaid Sankey of that cycle (per-cycle, not cumulative) to a channel.
Why — Gives the team an automatic, visual, trustless record of where each cycle's BREAD went — derived from chain events, independent of the subgraph (which had drifted; see the companion fix in
BreadchainCoop/subgraph#5).How it works
YieldDistributedlogs on the YieldDistributor (0xeE95…024b, Gnosis).Transferlogs emitted from the distributor in that block — authoritative recipient + amount, with no positional project-array mapping (that mapping is exactly what keeps breaking the subgraph).sankey-beta(Yield Distributor, <recipient>, <BREAD>) + a one-line caption, and posts it.Uses plain
fetchJSON-RPC + minimal hex decoding, so it adds no new dependency (event topic hashes are hardcoded). First run anchors to the chain head and doesn't backfill history. Config + state live in the KB; no-op untilconfig.mdexists.Example output (real, from live Gnosis data while building this — the all-time view; the plugin posts the single newest cycle each time):
Files
profiles/example/plugins/distribution-sankey.mjs— the flowprofiles/example/plugins/__tests__/distribution-sankey.test.mjs— unit testsprofiles/example/groups/slack_main/context/distribution-sankey/README.md— config formatHow it was tested
node --checkclean; 5 unit tests for the pure helpers (config parse incl. the quoted-address YAML footgun, topic→address decode, unit formatting, per-cycle aggregation/sort/label, Sankey render).prettier --check "src/**/*.ts"unaffected (new files are.mjs/.md, outside thesrc/**CI globs).Notes
.mjsneeds to land inprofiles/breadchain/plugins/on the droplet (deploy/admin step), and aconfig.mddropped in the KB — I can prep the config (channel + the recipient name map) once we pick the target channel.For Skills