Skip to content

Update FeeSharingCollector to withhold part of fees to the protocol#572

Merged
tjcloa merged 4 commits intodevelopmentfrom
feat/feesharingcollector-pay-to-protocol
Feb 25, 2026
Merged

Update FeeSharingCollector to withhold part of fees to the protocol#572
tjcloa merged 4 commits intodevelopmentfrom
feat/feesharingcollector-pay-to-protocol

Conversation

@tjcloa
Copy link
Contributor

@tjcloa tjcloa commented Feb 19, 2026

FeeSharingCollector should withhold a portion of fees for the protocol in certain tokens

@tjcloa tjcloa marked this pull request as ready for review February 19, 2026 00:20
@tjcloa tjcloa requested review from Copilot and cwsnt February 19, 2026 00:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds a token-specific fee withholding feature to the FeeSharingCollector contract, allowing the protocol to withhold 100% of fees for specific tokens instead of distributing them to stakers. The implementation includes list management functions, withdrawal capabilities, and comprehensive test coverage.

Changes:

  • Added token withhold list functionality with add/remove operations restricted to the contract owner
  • Modified fee distribution logic to check if a token is in the withhold list before creating staker checkpoints
  • Implemented withdrawal functions (single and batch) for accumulated protocol withheld fees with proper reentrancy protection
  • Updated deployment script to automatically configure RBTC, ZUSD, and WRBTC as withheld tokens via multisig transactions

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/FeeSharingCollectorTokenWithholdingTest.js Comprehensive test suite covering list management, withholding behavior, withdrawal functions, and edge cases for the new feature
deployment/deploy/1020-deploy-FeeSharingCollector.js Updated deployment script to generate multisig transactions for adding RBTC, ZUSD, and WRBTC to the withhold list
contracts/mockup/FeeSharingCollectorMockup.sol Updated mockup to use the new _addCheckpointOrWithholdProtocolFee function name
contracts/governance/IFeeSharingCollector.sol Added interface definitions for new functions and moved event declarations from implementation to interface
contracts/governance/FeeSharingCollector/FeeSharingCollectorStorage.sol Added storage for protocol withhold token list (EnumerableAddressSet) and accumulated fees mapping
contracts/governance/FeeSharingCollector/FeeSharingCollector.sol Renamed _addCheckpoint to _addCheckpointOrWithholdProtocolFee with logic to either withhold fees or distribute to stakers; added list management and withdrawal functions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

);

/// @notice An event emitted when revenue is accumulated.
event ProtocolRevenueAccumulated(address indexed token, uint256 amount);
Copy link
Contributor

Choose a reason for hiding this comment

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

should we add the sender param here?
event ProtocolRevenueAccumulated(address indexed sender, address indexed token, uint256 amount);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why do you think it matters who executed the function?

Copy link
Contributor

Choose a reason for hiding this comment

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

Was thinking it's for consistency, since other event is also storing this sender as well,
FeeWithdrawnInRBTC for example

But i will leave it to u as optional

@tjcloa tjcloa requested a review from cwsnt February 19, 2026 08:54
@tjcloa tjcloa merged commit 5429b56 into development Feb 25, 2026
1 check 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.

3 participants