Last active
October 7, 2022 13:52
-
-
Save mudgen/c2be756d8252f2eae6fab09cd28f5c96 to your computer and use it in GitHub Desktop.
This file contains 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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
DiamondStorage storage ds = diamondStorage(); | |
bytes4 functionSelector = bytes4(keccak256("myFunction(uint256)")); | |
// get facet address of function | |
address facet = ds.selectorToFacet[functionSelector]; | |
bytes memory myFunctionCall = abi.encodeWithSelector(functionSelector, 4); | |
(bool success, bytes memory result) = address(facet).delegatecall(myFunctionCall); | |
require(success, "myFunction failed"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment