Fix: stop offering reward withdrawals that move no tokens - #115
Merged
Merged
Conversation
Every split contract keeps 1 wei of the reward token after it distributes. A user who has already withdrawn everything therefore still reads a non-zero warehouse balance, and the dashboard treated that residue as a claimable reward: the summary showed a "ready to withdraw" row, the claim button stayed enabled, and the queued transaction spent gas to move an amount too small to see. The claim cart already has a shared dust threshold (half a token) for exactly this case, but the warehouse checks used a bare "greater than zero" test instead. Apply the same threshold to them. A distribute queued in the same batch still schedules its withdrawal, so freshly distributed rewards are unaffected. The delegation breakdown keeps showing the true on-chain balance and only drops the highlight that made the residue look claimable. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
koenmtb1
approved these changes
Sep 15, 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 user with no rewards left can still see a claimable balance and a working "withdraw" button. They click it, pay gas, and nothing arrives in their wallet. Repeating it does not help.
This came from a support ticket. The user had already claimed their rewards months earlier. The dashboard still showed a pending withdrawal, so they kept trying.
Why it happens
Every split contract permanently keeps 1 wei of the reward token after it distributes. So a warehouse that has been fully withdrawn still reports a balance that is greater than zero — but far too small to be worth anything.
The claim cart already has a shared dust threshold (half a token) for exactly this situation. The warehouse checks did not use it. They tested only "greater than zero", so the 1 wei residue counted as a real reward.
The change
Four places now use the existing dust threshold instead of a bare "greater than zero" test:
What does not change
getRecoveryDustThreshold.Testing
Type-check and lint pass.