Skip to content

Fix: show and claim distributed rewards for delegators who stake from a wallet - #126

Merged
koenmtb1 merged 3 commits into
AztecProtocol:mainfrom
y3v63n:fix/warehouse-address-wallet-delegations
Oct 26, 2026
Merged

koenmtb1 merged 3 commits into
AztecProtocol:mainfrom
y3v63n:fix/warehouse-address-wallet-delegations

Conversation

@y3v63n

@y3v63n y3v63n commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

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:

const firstSplitContract = delegations[0]?.splitContract

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.ts

Fall 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 threading

The 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 — resolveWarehouseSplit in claimCart.ts

The 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

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]>
@y3v63n
y3v63n requested a review from a team as a code owner October 26, 2026 18:00
y3v63n and others added 2 commits October 26, 2026 19:08
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]>
@y3v63n y3v63n changed the title Fix: show distributed rewards to delegators who stake from a wallet Fix: show and claim distributed rewards for delegators who stake from a wallet Oct 26, 2026
@koenmtb1
koenmtb1 merged commit 6bbd9eb into AztecProtocol:main Oct 26, 2026
2 checks passed
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