Address
0xb3926def2e0989b0700a57034c9a211bfbcf858bCurrent Holdings
$0.00
TXs sent
not counted
First Active
2025-04-12
block 23,191,595
Last Active
117 days ago
block 26,593,208
Net worth historyi
23 snapshots · to block 26,229,199
exact matchDZapDiamondsolc 0.8.19+commit.7dd6d404runtime exact · creation not verified
proxy·0xb26E…f9360xB76a…b27D0x90A5…bE5E0x37ac…a3560xBf91…5ED10xDFFD…7B270x8AB2…702D0x3CaF…cabc0x2d69…E0d20xc358…e8960x8972…79490x8191…BAE2
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import { LibDiamond } from "./Shared/Libraries/LibDiamond.sol";
import { IDiamondCut } from "./Shared/Interfaces/IDiamondCut.sol";
import { ZeroAddress } from "./Shared/Errors.sol";
/*
---------------------------------------------------------
---------------------------------------------------------
/$$$$$$$ /$$$$$$$$ /$$$$$$ /$$$$$$$
| $$__ $$|_____ $$ /$$__ $$| $$__ $$
| $$ \ $$ /$$/ | $$ \ $$| $$ \ $$
| $$ | $$ /$$/ | $$$$$$$$| $$$$$$$/
| $$ | $$ /$$/ | $$__ $$| $$____/
| $$ | $$ /$$/ | $$ | $$| $$
| $$$$$$$/ /$$$$$$$$| $$ | $$| $$
|_______/ |________/|__/ |__/|__/
Author: DZap <https://dzap.io> (https://x.com/dzap_io)
---------------------------------------------------------
---------------------------------------------------------
*/
contract DZapDiamond {
constructor(address _contractOwner, address _diamondCutFacet) payable {
if (_contractOwner == address(0)) {
revert ZeroAddress();
}
LibDiamond.setContractOwner(_contractOwner);
// Add the diamondCut external function from the diamondCutFacet
IDiamondCut.FacetCut[] memory cut = new IDiamondCut.FacetCut[](1);
bytes4[] memory functionSelectors = new bytes4[](1);
functionSelectors[0] = IDiamondCut.diamondCut.selector;
cut[0] = IDiamondCut.FacetCut({ facetAddress: _diamondCutFacet, action: IDiamondCut.FacetCutAction.Add, functionSelectors: functionSelectors });
LibDiamond.diamondCut(cut, address(0), "");
}
// Find facet for function that is called and execute the
// function if a facet is found and return any value.
// solhint-disable-next-line no-complex-fallback
fallback() external payable {
LibDiamond.DiamondStorage storage ds;
bytes32 position = LibDiamond.DIAMOND_STORAGE_POSITION;
// get diamond storage
// solhint-disable-next-line no-inline-assembly
assembly {
ds.slot := position
}
// get facet from function selector
address facet = ds.selectorToFacetAndPosition[msg.sig].facetAddress;
if (facet == address(0)) {
revert LibDiamond.FunctionDoesNotExist();
}
// Execute external function from facet using delegatecall and return any value.
// solhint-disable-next-line no-inline-assembly
assembly {
// copy function selector and any arguments
calldatacopy(0, 0, calldatasize())
// execute function call using the facet
let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0)
// get any return value
returndatacopy(0, 0, returndatasize())
// return any return value or error back to the caller
switch result
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
// Able to receive ether
// solhint-disable-next-line no-empty-blocks
receive() external payable {}
}