-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Diamond refactor * Diamond init example * Diamond minor fixes, add natspec, delete unnecessary * Delete recieve * Minor fixes * Add virtual + move require to the upper function * Diamond light customization, add tests, add/update dummy contracts * Delete unncessary revert * Delete only * dimond test js -> ts, add ownableDiamondMock * Minor fixes * Delete only * Add Virtual, delete imports, rename param --------- Co-authored-by: Artjom Galaktionov <[email protected]>
- Loading branch information
Showing
13 changed files
with
563 additions
and
135 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.4; | ||
|
||
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol"; | ||
|
||
/** | ||
* @notice DiamondERC165 - Contract implementing ERC165 interface for Diamonds | ||
*/ | ||
contract DiamondERC165 is ERC165 { | ||
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { | ||
// This section of code provides support for the Diamond Loupe and Diamond Cut interfaces. | ||
// Diamond Loupe interface is defined as: 0x48e2b093 | ||
// Diamond Cut interface is defined as: 0x1f931c1c | ||
return | ||
interfaceId == 0x1f931c1c || | ||
interfaceId == 0x48e2b093 || | ||
super.supportsInterface(interfaceId); | ||
} | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.4; | ||
|
||
import {DummyFacet} from "./DummyFacet.sol"; | ||
|
||
contract DummyInit is DummyFacet { | ||
event Initialized(); | ||
|
||
function init() external { | ||
setDummyString("dummy facet initialized"); | ||
emit Initialized(); | ||
} | ||
|
||
function initWithError() external pure { | ||
revert(); | ||
} | ||
|
||
function initWithErrorMsg() external pure { | ||
revert("DiamondInit: init error"); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.4; | ||
|
||
import {OwnableDiamond} from "../../diamond/presets/OwnableDiamond/OwnableDiamond.sol"; | ||
|
||
contract OwnableDiamondMock is OwnableDiamond { | ||
function diamondCutShort(Facet[] memory facets_) public { | ||
diamondCut(facets_); | ||
} | ||
|
||
function diamondCutLong(Facet[] memory facets_, address init_, bytes memory calldata_) public { | ||
diamondCut(facets_, init_, calldata_); | ||
} | ||
} |
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
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
Oops, something went wrong.