-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add helper to set protocol fees by factory #897
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # pkg/interfaces/contracts/vault/IProtocolFeeController.sol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass done. I think it makes sense overall; thanks @EndymionJkb !
I can't think of a way to validate that the factory is actually the factory without any extra requirements to the pool themselves, so this is probably fine. I'll give it some more thought just in case before the second pass.
# Conflicts: # pkg/vault/contracts/ProtocolFeeController.sol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description
This adds a
ProtocolFeePercentagesProvider
helper contract that allows governance to set protocol fee percentages at the factory level, and then a permissionless function to propagate these fee percentages to individual pools. (Well, permissionless after governance grants the provider contract permission to set pool fees.)An important design constraint was building this on top of the existing infrastructure, with no new dependencies (e.g., not changing existing factories, or adding new requirements for factories, such as keeping an enumerable set of pools, or calling back into anything to register new pools, etc.)
There are no changes to existing contracts: except adding a getter for the maximum swap/yield fee constants to the ProtocolFeeController, which it arguably should have anyway. This avoids duplicating constants, and divergence from the current ProtocolFeeController.
It has two important functions:
setFactorySpecificProtocolFeePercentages
: a permissioned call to set fee percentages by factory. It does some validation that isn't strictly necessary: ensuring that the fees being set are <= max allowed values, and a "best effort" check that the factory is a real factory (i.e., that responds correctly toisPoolFromFactory
calls). Otherwise, you could set values that would fail when you tried to apply them.setProtocolFeePercentagesForPools
: a permissionless call to apply the fee percentages to a set of pools from a given factory. This was over-engineered at first (as I tend to do), taking just a set of pools, and having the contract figure out which factories they belonged to and fetch the corresponding fee percentages. But that required an enumerable set of factories, a "find" function, etc. Probably people are going to set the fees for one factory at a time, using the subgraph, so I think making it completely generic is overkill.It should cut down on governance calls, since they need only approve the factory-wide defaults, not the list of individual pools. No further governance action would be needed for new pools from that factory, as the "propagation" call is permissionless.
Type of change
Checklist:
main
, or there's a description of how to mergeIssue Resolution
Resolves #888