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

Extendable diamond cut #96

Merged
merged 11 commits into from
Aug 26, 2024
Merged

Extendable diamond cut #96

merged 11 commits into from
Aug 26, 2024

Conversation

amarinkovic
Copy link
Member

@amarinkovic amarinkovic commented Dec 28, 2023

Builds up on the upstream implementation of DiamondCutFacet, extending it with custom code for governance. The idea here is that we only add in custom code before calling the super implementation.

@amarinkovic amarinkovic force-pushed the dev branch 2 times, most recently from 13976e5 to 5323fb7 Compare January 19, 2024 10:05
@amarinkovic amarinkovic force-pushed the dev branch 4 times, most recently from 0bdf481 to 782a3b3 Compare May 20, 2024 11:14
@amarinkovic amarinkovic changed the title Extendable Diamond Cut Extendable diamond cut Jun 10, 2024
@amarinkovic
Copy link
Member Author

amarinkovic commented Jun 26, 2024

This change is currently constrained by the gemforge DiamondProxy generation code. There is no way to specify a custom DiamondCutFacet implementation, in our case that would be the PhasedDiamondCutFacet.

Current version generates a constructor call like this:

constructor(address _contractOwner) payable Diamond(_contractOwner, address(new DiamondCutFacet())) {

Ideally, it would be possible to generate the DiamondProxy such that it passes in a custom facet to the Diamond constructor:

constructor(address _contractOwner) payable Diamond(_contractOwner, address(new PhasedDiamondCutFacet()))

@hiddentao do you think this might be a feature worth including? I guess there could be a config property one could set to override the default implementation.

@amarinkovic amarinkovic force-pushed the extendable_diamond_cut branch 2 times, most recently from 1d2edf2 to 3a30f1b Compare June 26, 2024 12:41
@hiddentao
Copy link
Contributor

Yeah, this is something that could be investigated for Gemforge > gemstation/gemforge#38

@amarinkovic amarinkovic force-pushed the extendable_diamond_cut branch from 3a30f1b to 1331b83 Compare August 20, 2024 12:03
Copy link
Contributor

@kevin-fruitful kevin-fruitful left a comment

Choose a reason for hiding this comment

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

Left one minor comment. Looks fine otherwise ~

src/facets/PhasedDiamondCutFacet.sol Outdated Show resolved Hide resolved
@hiddentao
Copy link
Contributor

LGTM

@amarinkovic amarinkovic merged commit 2351888 into dev Aug 26, 2024
4 checks passed
@amarinkovic amarinkovic deleted the extendable_diamond_cut branch August 26, 2024 10:48
@amarinkovic amarinkovic mentioned this pull request Aug 26, 2024
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