Skip to content

fix(ethereum): add multiRewardDistributor for reward claims (MOO-413)#306

Merged
bprofiro merged 1 commit into
mainfrom
brenda/moo-413-add-multirewarddistributor-to-ethereum-sdk-config-before-mip
Jun 15, 2026
Merged

fix(ethereum): add multiRewardDistributor for reward claims (MOO-413)#306
bprofiro merged 1 commit into
mainfrom
brenda/moo-413-add-multirewarddistributor-to-ethereum-sdk-config-before-mip

Conversation

@bprofiro

Copy link
Copy Markdown
Collaborator

Summary

Adds the Ethereum multiRewardDistributor (MRD_PROXY = 0x60142B8d76FaC5b88cfB422Ba1aA905d2171851c) to src/environments/definitions/ethereum/contracts.ts, mirroring the Base and Optimism configs. Closes MOO-413.

Why (the real reason — not what the ticket says)

The ticket claimed the missing address would make reward APRs display as 0%. That's inaccurate — reward APRs come from the on-chain views contract / Lunar indexer, and the SDK never reads multiRewardDistributor directly.

The actual consumer is the frontend useUserRewardsData.tsx, which branches on this address to build the reward-claim transaction:

multiRewardDistributor defined? Claim routes to ABI / fn
Yes (Base, OP) comptroller.address claimReward(holders, mTokens, …)
No (Moonbeam/Moonriver) 0x…0808 precompile batchAll(…)

Ethereum, lacking it, fell into the Moonbeam precompile path — a claim tx to 0x…0808 on Ethereum mainnet reverts. So once MIP-X59 makes WELL accrue on the four Ethereum Core markets (ETH, USDC, USDT, cbBTC), users would see rewards but fail to claim them. No frontend change needed — the frontend already branches on the value; this just supplies it.

Verification

  • Address verified on-chain: Comptroller(0xdec80bb…21be).rewardDistributor() on Ethereum mainnet returns exactly 0x60142B8d76FaC5b88cfB422Ba1aA905d2171851c.
  • pnpm typecheck clean · pnpm lint clean.
  • Full suite green (33 files / 550 tests); getUserRewards live-RPC cases for Ethereum pass.
  • Quality gate: PASS (no regression).

Tests added

  • src/environments/definitions/ethereum/environment.test.ts — locks both env.config.contracts.multiRewardDistributor (raw config) and env.contracts.multiRewardDistributor.address (wired viem contract), so dropping or mis-wiring the address fails CI. This closes the coverage gap that let the omission ship originally.

Notes / follow-ups

  • Latent type gap (out of scope here): multiRewardDistributor is ?: Address (optional) in the config type but treated as required in the client contract type — which is why this could ship missing on Ethereum without a compile error. Worth tightening separately.
  • The Linear ticket's description should be updated to say this fixes reward claim routing, not APR display.

Add the on-chain-verified MRD_PROXY address
(0x60142B8d76FaC5b88cfB422Ba1aA905d2171851c, the comptroller's
rewardDistributor()) to Ethereum's contracts config, mirroring Base and
Optimism. The SDK reads reward APRs from the views contract, but the
frontend's reward-claim flow branches on this address: present => claim via
the comptroller's claimReward; absent => fall back to the Moonbeam 0x..0808
precompile batchAll path, which reverts on Ethereum. Required so the WELL
rewards MIP-X59 starts accruing on the four Ethereum Core markets are
claimable, not just displayed.

Locks the address with an environment invariant test.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Gate: ✅ PASS

Metric Baseline Current Δ Verdict
coverage.lines 82.7% 82.6% -0.07pp ✅ PASS
coverage.statements 82.7% 82.6% -0.07pp ✅ PASS
coverage.functions 56.9% 56.9% -0.04pp ✅ PASS
coverage.branches 84.5% 84.5% 0.00pp ✅ PASS
lint.errors 0 0 0.00 ✅ PASS
lint.warnings 0 0 0.00 ✅ PASS
audit.critical 0 0 0.00 ✅ PASS
audit.high 0 0 0.00 ✅ PASS
duplication.percentage 8.9% 8.9% 0.00pp ✅ PASS
duplication.clones 95 95 0.00 ✅ PASS

Informational (non-gating)

Metric Baseline Current Δ
audit.moderate 1 1 0.00
audit.low 0 0 0.00
duplication.duplicatedLines 1919 1919 0.00

Notes

All gated metrics held or improved. If this PR raised the floor (e.g., added tests), consider running pnpm gate:update-baseline after merge to lock the new floor in.

@bprofiro bprofiro self-assigned this Jun 15, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying moonwell-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5c709c5
Status: ✅  Deploy successful!
Preview URL: https://24be04f3.moonwell-sdk.pages.dev
Branch Preview URL: https://brenda-moo-413-add-multirewa.moonwell-sdk.pages.dev

View logs

@apokusin

Copy link
Copy Markdown
Contributor

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@bprofiro bprofiro merged commit 7ab1036 into main Jun 15, 2026
5 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 15, 2026
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.

2 participants