Last active
December 15, 2025 17:10
-
-
Save mudgen/34aefd1abedfbf41ab8c4909530eacb5 to your computer and use it in GitHub Desktop.
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
| import "../DiamondMod.sol" as DiamondMod; | |
| contract ExampleDiamond { | |
| /** | |
| * @notice Struct to hold a facet address and its function selectors. | |
| * struct FacetFunctions { | |
| * address facet; | |
| * bytes4[] selectors; | |
| * } | |
| */ | |
| /** | |
| * @notice Initializes the diamond contract with facets. | |
| * @dev Adds all provided facet functions to the diamond's function/selector mapping. | |
| * @param _facetFunctions Array of facet addresses and their corresponding function selectors to add to the diamond. | |
| */ | |
| constructor(DiamondMod.FacetFunctions[] memory _facetFunctions) { | |
| /** | |
| * Here we add all the ERC20 functions from the ERC20Facet. | |
| * Here we add the diamondUpgrade function. | |
| */ | |
| DiamondMod.addFacetFunctions(facetFunctions); | |
| } | |
| fallback() external payable { | |
| DiamondMod.diamondFallback(); | |
| } | |
| receive() external payable {} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment