Skip to content

Leave dust for ETH/WETH in contract drip()#82

Open
kaze-cow wants to merge 3 commits into
cowdao-grants:mainfrom
kaze-cow:leave-dust-contract
Open

Leave dust for ETH/WETH in contract drip()#82
kaze-cow wants to merge 3 commits into
cowdao-grants:mainfrom
kaze-cow:leave-dust-contract

Conversation

@kaze-cow
Copy link
Copy Markdown
Contributor

Summary

  • Adds _leaveDust parameter to COWFeeModule.drip() — the keeper passes the configured dust amount so the contract retains that many wei of ETH (unwrapped) and WETH after each drip
  • Threads config.leaveDust through DripParams into both drip() call sites (swapTokens.ts and dripItAll.ts)
  • Adds testDripWethLeaveDust and testDripEthLeaveDust test cases; updates all existing tests to pass leaveDust=0 preserving prior behaviour

Depends on

#81 — this branch is based on leave-dust and requires the leaveDust config field introduced there

Test plan

  • forge test --fork-url $RPC_URL_1 — all 15 tests pass
  • Run keeper with --leave-dust 10 and confirm settlement retains ~10 wei ETH and ~10 wei WETH after drip fills

🤖 Generated with Claude Code

kaze-cow and others added 3 commits April 28, 2026 16:19
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>
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.

1 participant