Skip to content

Commit

Permalink
added authorization to diamondCut
Browse files Browse the repository at this point in the history
  • Loading branch information
mudgen committed Sep 22, 2020
1 parent 3b14dc2 commit 5860761
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 2 additions & 0 deletions contracts/facets/DiamondCutFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ contract DiamondCutFacet is IDiamondCut {
address _init,
bytes calldata _calldata
) external override {
LibDiamondStorage.DiamondStorage storage ds = LibDiamondStorage.diamondStorage();
require(msg.sender == ds.contractOwner, "DiamondCutFacet: Must own the contract");
for (uint256 facetIndex; facetIndex < _diamondCut.length; facetIndex++) {
LibDiamondCut.addReplaceRemoveFacetSelectors(_diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors);
}
Expand Down
6 changes: 2 additions & 4 deletions contracts/facets/DiamondLoupeFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ import "../interfaces/IERC165.sol";
contract DiamondLoupeFacet is IDiamondLoupe, IERC165 {
// Diamond Loupe Functions
////////////////////////////////////////////////////////////////////
/// These functions are expected to be called frequently
/// by tools. Therefore the return values are tightly
/// packed for efficiency. That means no padding with zeros.

/// These functions are expected to be called frequently by tools.
//
// struct Facet {
// address facetAddress;
// bytes4[] functionSelectors;
Expand Down

0 comments on commit 5860761

Please sign in to comment.