Leave dust for ETH/WETH in contract drip()#82
Open
kaze-cow wants to merge 3 commits into
Open
Conversation
Subtracts a small amount (default 10 wei, configurable via --leave-dust) from each token's balance before quoting and submitting swap orders, so the settlement contract is never fully drained of any token. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a `_leaveDust` parameter to the contract's `drip()` function so the keeper can specify how much native token (ETH) and wrapped native token (WETH) to retain in the settlement contract after each drip. Updates the TypeScript keeper to pass `config.leaveDust` through to the contract call, and adds tests covering both the WETH-only and ETH-only dust cases. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
_leaveDustparameter toCOWFeeModule.drip()— the keeper passes the configured dust amount so the contract retains that many wei of ETH (unwrapped) and WETH after each dripconfig.leaveDustthroughDripParamsinto bothdrip()call sites (swapTokens.tsanddripItAll.ts)testDripWethLeaveDustandtestDripEthLeaveDusttest cases; updates all existing tests to passleaveDust=0preserving prior behaviourDepends on
#81 — this branch is based on
leave-dustand requires theleaveDustconfig field introduced thereTest plan
forge test --fork-url $RPC_URL_1— all 15 tests pass--leave-dust 10and confirm settlement retains ~10 wei ETH and ~10 wei WETH after drip fills🤖 Generated with Claude Code