introduce dynamic fee types#403
Open
malteish wants to merge 17 commits intofeat/TokenSwapCoinvestorfrom
Open
Conversation
added 5 commits
March 17, 2026 12:58
introduce dynamic fee types
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
added 12 commits
March 17, 2026 15:02
…easier mapping queries
This reverts commit 558575b.
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.
FeeSettings.sol rework
What changed
The fee system has been generalized from three hardcoded fee types to a
dynamic registry. Previously,
FeeSettingshad TOKEN, CROWDINVESTING, andPRIVATE_OFFER baked in as constants with fixed per-type caps (5%, 10%, 5%).
Now, fee types are registered at deployment (or later) with arbitrary names and
caps, and the contract can accommodate new product lines without an upgrade.
How fees work now:
bytes32key (e.g.keccak256("TOKEN"))and configured with a max cap and a default numerator at registration time.
before, but are now keyed by
(feeType, token)instead of living inseparate mappings per type.
independently.
— same role separation as before.
What stays compatible
All existing callers (Token, Crowdinvesting, PrivateOffer contracts) continue
to work unchanged. The V1 and V2 interface functions (
tokenFee,crowdinvestingFee,privateOfferFee, and the matchingfeeCollectorvariants) are retained as thin wrappers over the new generic logic. ERC-165
reports support for V1, V2, and the new V3 interface.
What breaks
Any tooling or scripts that call the old management functions by name will need
updating:
planFeeChange(Fees),executeFeeChange(),setFeeCollectors(...),setCustomFee(address, Fees), and the six per-type collector setters/removersare all replaced by generic equivalents that take a
bytes32 feeTypeas thefirst argument. Events have changed accordingly.