Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregated fee sweeper #1254

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open

Aggregated fee sweeper #1254

wants to merge 32 commits into from

Conversation

EndymionJkb
Copy link
Collaborator

@EndymionJkb EndymionJkb commented Jan 23, 2025

Description

Built on #1251 (base fee sweeper), this version "aggregates" collection from multiple pools. Instead of taking a pool argument and doing the withdrawal in the sweeper (requiring permission), it assumes the off-chain process has both collected and withdrawn the protocol fees to the sweeper (i.e, called withdrawal functions with the fee sweeper as the recipient), so that the token balances are in the sweeper.

Pending Cow Router release (the point at which other contracts start sending fees to the sweeper; until then, it's fine to assume that the only source of tokens is the internal withdrawals in the sweeper).

It can then check these balances against a threshold, and sweep all (or optionally only some) of the token balance through a burner to a final recipient. This is more efficient if there are many pools with the same fee tokens (especially low liquidity pools), since the burns can be done less frequently, and with higher balances.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Dependency changes
  • Code refactor / cleanup
  • Optimization: [ ] gas / [ ] bytecode
  • Documentation or wording changes
  • Other

Checklist:

  • The diff is legible and has no extraneous changes
  • Complex code has been commented, including external interfaces
  • Tests have 100% code coverage
  • The base branch is either main, or there's a description of how to merge

Issue Resolution

…r validation; and pass a burner address on sweep
# Conflicts:
#	pkg/interfaces/contracts/standalone-utils/IProtocolFeeSweeper.sol
#	pkg/standalone-utils/contracts/ProtocolFeeSweeper.sol
# Conflicts:
#	pkg/interfaces/contracts/standalone-utils/IProtocolFeeSweeper.sol
#	pkg/standalone-utils/contracts/ProtocolFeeSweeper.sol
EndymionJkb and others added 2 commits January 28, 2025 19:31
# Conflicts:
#	pkg/standalone-utils/contracts/ProtocolFeeSweeper.sol
#	pkg/standalone-utils/test/foundry/ProtocolFeeSweeper.t.sol
Base automatically changed from multi-burner to sweeper-refactor January 29, 2025 01:12
# Conflicts:
#	pkg/interfaces/contracts/standalone-utils/IProtocolFeeSweeper.sol
#	pkg/standalone-utils/contracts/ProtocolFeeSweeper.sol
#	pkg/standalone-utils/contracts/test/ProtocolFeeBurnerMock.sol
#	pkg/standalone-utils/test/foundry/ProtocolFeeSweeper.t.sol
Copy link
Contributor

@joaobrunoah joaobrunoah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Base automatically changed from sweeper-refactor to main January 29, 2025 22:35
# Conflicts:
#	pkg/interfaces/contracts/standalone-utils/IProtocolFeeBurner.sol
#	pkg/interfaces/contracts/standalone-utils/IProtocolFeeSweeper.sol
#	pkg/standalone-utils/contracts/ProtocolFeeSweeper.sol
#	pkg/standalone-utils/contracts/test/ProtocolFeeBurnerMock.sol
#	pkg/standalone-utils/test/foundry/ProtocolFeeSweeper.t.sol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants