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, uint 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