Repository navigation
Fix: show and claim distributed rewards for delegators who stake from a wallet - #126
Merged
koenmtb1 merged 3 commits intoOct 26, 2026
Conversation
The dashboard reads the rewards warehouse address from the first delegation that has a split contract, but it only looked at token-vault delegations. A delegator who stakes directly from a wallet has none, so the address stayed undefined, the warehouse balance was never read, and already distributed rewards showed as zero. Fall back to an ERC20 delegation's split contract. Every split points at the same warehouse for a given token, so either source resolves the same address. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The previous commit made the distributed rewards balance visible to a delegator who stakes from a wallet. The claim path stayed shut. "Claim All Rewards" resolves the warehouse address from token-vault delegations only. For a wallet-only delegator that address is undefined, so the withdraw step is skipped while the cart still opens. The user sees the amount itemised, clicks, and gets an empty cart with no error. The per-delegation path does not cover it either. A fully distributed position has no rollup or split balance left, so the row reports zero rewards and its claim button is disabled. Apply the same fallback in the claim-all modal and pass the wallet delegations in from the overview. The withdraw leg is a per-user, per-token call, so either delegation kind resolves the same warehouse address. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The rule for picking a split contract to read the warehouse address from was written out at each call site, and the copies had drifted: two of them looked at token-vault delegations only, which is what hid the balance from wallet delegators in the first place. Move the rule into `resolveWarehouseSplit` and call it from the three sites that choose from a list. Each site keeps its own preference order, so behaviour is unchanged for a delegator who holds token-vault delegations. The helper also scans for the first entry that carries a split contract, rather than reading index zero. An entry without one no longer hides the warehouse from the entries behind it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
koenmtb1
approved these changes
Oct 26, 2026
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.
What this fixes
A delegator who stakes directly from a wallet sees 0 claimable rewards, even after their provider has distributed. The rewards are safe in the SplitsWarehouse, but the dashboard never reads the balance.
Why it happens
The dashboard resolves the warehouse address by calling
SPLITS_WAREHOUSE()on one of the user's split contracts. It picked that split from token-vault delegations only:A wallet delegator has no token-vault delegations, so the list is empty, the address is
undefined, and the warehouse read stays disabled.The change
Three commits, in order of what each one unblocks.
1. Show the balance —
useAggregatedStakingData.tsFall back to a wallet delegation's split contract. Every split points at the same warehouse for a given token, so either source resolves the same address.
2. Let the user claim it —
ClaimAllRewardsModal.tsx, plus prop threadingThe claim-all modal resolves the warehouse the same way, and its withdraw step is gated on that address. Without this, the fix would show the amount, itemise it in the modal as "just needs withdrawal from warehouse", then add nothing to the cart on click, with no error.
The per-delegation path does not cover these users either: a fully distributed position has no rollup or split balance left, so the row reports zero rewards and its claim button is disabled.
3. Remove the duplication —
resolveWarehouseSplitinclaimCart.tsThe selection rule was written out at each call site, and the copies had drifted. Two looked at token-vault delegations only, which is what caused this bug. The rule now lives in one helper, called from the three sites that choose from a list. Each site keeps its own preference order.
The helper also scans for the first entry that carries a split contract, instead of reading index zero, so an entry without one no longer hides the warehouse from the entries behind it.
Scope
This affects any delegator who stakes only from a wallet, for any provider, after a distribution.
Token-vault delegators are unaffected. The wallet list is consulted only when no token-vault delegation supplies a split, so a user holding either or both kinds resolves the same address as before. The new props are optional with empty defaults.
Verified
Confirmed against a live case: a wallet with two wallet delegations, zero token-vault delegations, and 6,825.15 AZTEC unclaimed in the warehouse while the dashboard reported no rewards.
Type-check and lint pass on the changed files.
Not included
Per-row reward figures for wallet delegations still exclude the warehouse balance, so a fully distributed row reads zero and its button stays disabled. That balance belongs to the user and the token, not to one delegation, so attributing it per row would double count it across rows. The account-level withdraw above is the correct path, and it works after this change. A separate CTA next to the warehouse figure is worth a follow-up.
"Claim All Rewards" still claims only the warehouse balance for wallet delegations. Wallet rewards that are not distributed yet stay on the rollup or the split, so the modal total can be lower than the overview total. The "Claim All" button in the breakdown section already claims both delegation kinds. Queueing wallet claim and distribute legs from the modal is a follow-up.
🤖 Generated with Claude Code