ETH Price: $2,054.48 (-1.53%)

Contract

0xEf9d01ac303092D3A8f47Dc4A94FC196Cb82681B
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Approval For...245925732026-03-05 16:50:1117 days ago1772729411IN
0xEf9d01ac...6Cb82681B
0 ETH0.000159052.16275193
Set Approval For...245445962026-02-27 0:11:3524 days ago1772151095IN
0xEf9d01ac...6Cb82681B
0 ETH0.000149942.0389059
Set Approval For...245407202026-02-26 11:13:4724 days ago1772104427IN
0xEf9d01ac...6Cb82681B
0 ETH0.000005880.0800837
Safe Transfer Fr...244344962026-02-11 15:42:2339 days ago1770824543IN
0xEf9d01ac...6Cb82681B
0 ETH0.000025390.43461024
Set Approval For...243438142026-01-29 23:31:3552 days ago1769729495IN
0xEf9d01ac...6Cb82681B
0 ETH0.000004230.05760734
Safe Transfer Fr...242408802026-01-15 15:02:5966 days ago1768489379IN
0xEf9d01ac...6Cb82681B
0 ETH0.000139992.61119236
Set Approval For...242295272026-01-14 1:01:3568 days ago1768352495IN
0xEf9d01ac...6Cb82681B
0 ETH0.000149562.03369772
Safe Transfer Fr...242074332026-01-10 22:57:5971 days ago1768085879IN
0xEf9d01ac...6Cb82681B
0 ETH0.00010952.0419579
Safe Transfer Fr...236834092025-10-29 13:40:47144 days ago1761745247IN
0xEf9d01ac...6Cb82681B
0 ETH0.000259672.50218033
Safe Transfer Fr...235919102025-10-16 18:08:11157 days ago1760638091IN
0xEf9d01ac...6Cb82681B
0 ETH0.000158762.24510961
Set Approval For...235636952025-10-12 19:20:59161 days ago1760296859IN
0xEf9d01ac...6Cb82681B
0 ETH0.000134521.82710902
Set Approval For...235462372025-10-10 8:47:47163 days ago1760086067IN
0xEf9d01ac...6Cb82681B
0 ETH0.000121561.65299324
Set Approval For...235118802025-10-05 13:30:47168 days ago1759671047IN
0xEf9d01ac...6Cb82681B
0 ETH0.000082551.12247359
Safe Transfer Fr...234576662025-09-27 23:37:11176 days ago1759016231IN
0xEf9d01ac...6Cb82681B
0 ETH0.000015350.21720055
Safe Transfer Fr...234513822025-09-27 2:32:23177 days ago1758940343IN
0xEf9d01ac...6Cb82681B
0 ETH0.000079321.12175414
Set Approval For...232735492025-09-02 6:11:47202 days ago1756793507IN
0xEf9d01ac...6Cb82681B
0 ETH0.000084381.14740195
Set Approval For...230930802025-08-08 1:32:23227 days ago1754616743IN
0xEf9d01ac...6Cb82681B
0 ETH0.000167582.27615577
Set Approval For...230878642025-08-07 8:03:11228 days ago1754553791IN
0xEf9d01ac...6Cb82681B
0 ETH0.000177352.41155493
Set Approval For...230780282025-08-05 23:04:11229 days ago1754435051IN
0xEf9d01ac...6Cb82681B
0 ETH0.000170212.31445358
Set Approval For...230304872025-07-30 7:35:35236 days ago1753860935IN
0xEf9d01ac...6Cb82681B
0 ETH0.000323014.39214317
Set Approval For...229826942025-07-23 15:15:23242 days ago1753283723IN
0xEf9d01ac...6Cb82681B
0 ETH0.000221013.00521644
Set Approval For...229801382025-07-23 6:38:59243 days ago1753252739IN
0xEf9d01ac...6Cb82681B
0 ETH0.000189832.58119896
Set Approval For...229593502025-07-20 8:55:59245 days ago1753001759IN
0xEf9d01ac...6Cb82681B
0 ETH0.000147091.99786121
Set Approval For...229254142025-07-15 15:15:47250 days ago1752592547IN
0xEf9d01ac...6Cb82681B
0 ETH0.000500526.80577324
Set Approval For...228508032025-07-05 5:03:11261 days ago1751691791IN
0xEf9d01ac...6Cb82681B
0 ETH0.000055530.75510246
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
From
To
Transfer213593632024-12-08 17:47:47469 days ago1733680067
0xEf9d01ac...6Cb82681B
0.00447216 ETH
Transfer213011762024-11-30 14:45:47477 days ago1732977947
0xEf9d01ac...6Cb82681B
0.00511104 ETH
Transfer211648072024-11-11 13:41:47496 days ago1731332507
0xEf9d01ac...6Cb82681B
0.00063888 ETH
Transfer208349122024-09-26 12:52:59542 days ago1727355179
0xEf9d01ac...6Cb82681B
0.00179283 ETH
Transfer208316492024-09-26 1:58:23543 days ago1727315903
0xEf9d01ac...6Cb82681B
0.00179283 ETH
Transfer205772832024-08-21 13:25:47578 days ago1724246747
0xEf9d01ac...6Cb82681B
0.0009407 ETH
Transfer205645122024-08-19 18:38:35580 days ago1724092715
0xEf9d01ac...6Cb82681B
0.00141105 ETH
Transfer204846622024-08-08 15:08:11591 days ago1723129691
0xEf9d01ac...6Cb82681B
0.0009407 ETH
Transfer204838112024-08-08 12:16:59591 days ago1723119419
0xEf9d01ac...6Cb82681B
0.00141105 ETH
Transfer204551912024-08-04 12:27:59595 days ago1722774479
0xEf9d01ac...6Cb82681B
0.0009407 ETH
Transfer204084822024-07-28 23:56:59602 days ago1722211019
0xEf9d01ac...6Cb82681B
0.00047035 ETH
Transfer204057942024-07-28 14:58:11602 days ago1722178691
0xEf9d01ac...6Cb82681B
0.0047035 ETH
Transfer203704712024-07-23 16:37:11607 days ago1721752631
0xEf9d01ac...6Cb82681B
0.0009407 ETH
Transfer203368292024-07-18 23:55:47612 days ago1721346947
0xEf9d01ac...6Cb82681B
0.00141105 ETH
Transfer202943152024-07-13 1:30:23618 days ago1720834223
0xEf9d01ac...6Cb82681B
0.00517385 ETH
Transfer202054262024-06-30 15:34:11630 days ago1719761651
0xEf9d01ac...6Cb82681B
0.0028221 ETH
Transfer201547442024-06-23 13:39:47637 days ago1719149987
0xEf9d01ac...6Cb82681B
0.0037628 ETH
Transfer201265102024-06-19 14:54:11641 days ago1718808851
0xEf9d01ac...6Cb82681B
0.00047035 ETH
Transfer200835552024-06-13 14:40:11647 days ago1718289611
0xEf9d01ac...6Cb82681B
0.0018814 ETH
Transfer200702882024-06-11 18:10:23649 days ago1718129423
0xEf9d01ac...6Cb82681B
0.0028221 ETH
Transfer200435982024-06-08 0:41:59653 days ago1717807319
0xEf9d01ac...6Cb82681B
0.00329245 ETH
Transfer200332012024-06-06 13:51:47654 days ago1717681907
0xEf9d01ac...6Cb82681B
0.0018814 ETH
Transfer200118932024-06-03 14:28:59657 days ago1717424939
0xEf9d01ac...6Cb82681B
0.00235175 ETH
Transfer199989992024-06-01 19:15:59659 days ago1717269359
0xEf9d01ac...6Cb82681B
0.00141105 ETH
Transfer199942012024-06-01 3:11:47660 days ago1717211507
0xEf9d01ac...6Cb82681B
0.0009407 ETH
View All Internal Transactions
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x24853F71...35f0C06E3
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
DiamondCollection

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {INiftyKitAppRegistry} from "../interfaces/INiftyKitAppRegistry.sol";
import {INiftyKitV3} from "../interfaces/INiftyKitV3.sol";
import {IDiamondCut} from "../interfaces/IDiamondCut.sol";
import {LibDiamond} from "../libraries/LibDiamond.sol";
import {BaseStorage} from "./BaseStorage.sol";

contract DiamondCollection {
    constructor(INiftyKitV3.DiamondArgs memory args) {
        BaseStorage.Layout storage layout = BaseStorage.layout();
        layout._niftyKit = INiftyKitV3(msg.sender);
        INiftyKitAppRegistry registry = INiftyKitAppRegistry(
            layout._niftyKit.appRegistry()
        );
        INiftyKitAppRegistry.Base memory base = registry.getBase();
        IDiamondCut.FacetCut[] memory facetCuts = new IDiamondCut.FacetCut[](
            args.apps.length + 1
        );

        layout._treasury = args.treasury;
        layout._baseVersion = base.version;
        layout._baseURI = args.baseURI;
        layout._trustedForwarder = args.trustedForwarder;
        facetCuts = _appFacets(facetCuts, layout, registry, args.apps);
        facetCuts = _baseFacet(facetCuts, base);

        LibDiamond.diamondCut(
            facetCuts,
            base.implementation,
            abi.encodeWithSignature(
                "_initialize(address,address,string,string,address,uint16)",
                args.owner,
                args.admin,
                args.name,
                args.symbol,
                args.royalty,
                args.royaltyBps
            )
        );
    }

    function _appFacets(
        IDiamondCut.FacetCut[] memory facetCuts,
        BaseStorage.Layout storage layout,
        INiftyKitAppRegistry registry,
        bytes32[] memory apps
    ) internal returns (IDiamondCut.FacetCut[] memory) {
        LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
        uint256 appsLength = apps.length;
        for (uint256 i = 0; i < appsLength; ) {
            INiftyKitAppRegistry.App memory app = registry.getApp(apps[i]);
            if (app.version == 0) revert("App does not exist");

            facetCuts[i] = IDiamondCut.FacetCut({
                facetAddress: app.implementation,
                action: IDiamondCut.FacetCutAction.Add,
                functionSelectors: app.selectors
            });

            ds.supportedInterfaces[app.interfaceId] = true;
            layout._apps[apps[i]] = app;

            unchecked {
                i++;
            }
        }

        return facetCuts;
    }

    function _baseFacet(
        IDiamondCut.FacetCut[] memory facetCuts,
        INiftyKitAppRegistry.Base memory base
    ) internal returns (IDiamondCut.FacetCut[] memory) {
        LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
        facetCuts[facetCuts.length - 1] = IDiamondCut.FacetCut({
            facetAddress: base.implementation,
            action: IDiamondCut.FacetCutAction.Add,
            functionSelectors: base.selectors
        });

        uint256 idsLength = base.interfaceIds.length;
        for (uint256 i = 0; i < idsLength; ) {
            ds.supportedInterfaces[base.interfaceIds[i]] = true;

            unchecked {
                i++;
            }
        }

        return facetCuts;
    }

    // Find facet for function that is called and execute the
    // function if a facet is found and return any value.
    fallback() external payable {
        LibDiamond.DiamondStorage storage ds;
        bytes32 position = LibDiamond.DIAMOND_STORAGE_POSITION;
        // get diamond storage
        assembly {
            ds.slot := position
        }
        // get facet from function selector
        address facet = address(bytes20(ds.facets[msg.sig]));
        require(facet != address(0), "Diamond: Function does not exist");
        // Execute external function from facet using delegatecall and return any value.
        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())
            }
        }
    }

    receive() external payable {}
}

File 2 of 6 : BaseStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {INiftyKitAppRegistry} from "../interfaces/INiftyKitAppRegistry.sol";
import {INiftyKitV3} from "../interfaces/INiftyKitV3.sol";

library BaseStorage {
    enum Transfer {
        AllowAll,
        AllowedOperatorsOnly,
        BlockAll
    }

    struct URIEntry {
        bool isValue;
        string tokenURI;
    }

    bytes32 private constant STORAGE_SLOT = keccak256("niftykit.base.storage");

    uint256 public constant ADMIN_ROLE = 1 << 0;
    uint256 public constant MANAGER_ROLE = 1 << 1;
    uint256 public constant API_ROLE = 1 << 2;

    struct Layout {
        mapping(bytes32 => INiftyKitAppRegistry.App) _apps;
        mapping(address => bool) _allowedOperators;
        mapping(uint256 => bool) _blockedTokenIds;
        mapping(uint256 => URIEntry) _tokenURIs;
        bool _operatorFilteringEnabled;
        Transfer _transferStatus;
        INiftyKitV3 _niftyKit;
        uint8 _baseVersion;
        address _treasury;
        string _baseURI;
        address _mintSigner;
        address _trustedForwarder;
    }

    function layout() internal pure returns (Layout storage ds) {
        bytes32 position = STORAGE_SLOT;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            ds.slot := position
        }
    }
}

File 3 of 6 : IDiamondCut.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/******************************************************************************\
* Author: Nick Mudge <nick@perfectabstractions.com> (https://twitter.com/mudgen)
* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535
/******************************************************************************/

interface IDiamondCut {
    enum FacetCutAction {Add, Replace, Remove}
    // Add=0, Replace=1, Remove=2

    struct FacetCut {
        address facetAddress;
        FacetCutAction action;
        bytes4[] functionSelectors;
    }

    /// @notice Add/replace/remove any number of functions and optionally execute
    ///         a function with delegatecall
    /// @param _diamondCut Contains the facet addresses and function selectors
    /// @param _init The address of the contract or facet to execute _calldata
    /// @param _calldata A function call, including function selector and arguments
    ///                  _calldata is executed with delegatecall on _init
    function diamondCut(
        FacetCut[] calldata _diamondCut,
        address _init,
        bytes calldata _calldata
    ) external;

    event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

interface INiftyKitAppRegistry {
    struct App {
        address implementation;
        bytes4 interfaceId;
        bytes4[] selectors;
        uint8 version;
    }

    struct Base {
        address implementation;
        bytes4[] interfaceIds;
        bytes4[] selectors;
        uint8 version;
    }

    /**
     * Get App Facet by app name
     * @param name app name
     */
    function getApp(bytes32 name) external view returns (App memory);

    /**
     * Get base Facet
     */
    function getBase() external view returns (Base memory);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

interface INiftyKitV3 {
    struct DiamondArgs {
        address owner;
        address admin;
        address treasury;
        address royalty;
        address trustedForwarder;
        uint16 royaltyBps;
        string name;
        string symbol;
        string baseURI;
        bytes32[] apps;
    }

    /**
     * @dev Returns app registry address.
     */
    function appRegistry() external returns (address);

    /**
     * @dev Returns the commission amount (sellerFee, buyerFee).
     * @dev Deprecated: use commissionByQuantity instead.
     */
    function commission(
        address collection,
        uint256 amount
    ) external view returns (uint256, uint256);

    /**
     * @dev Returns the commission amount (mintFee, ownerPerks).
     */
    function commissionByQuantity(
        address collection,
        uint256 quantity
    ) external view returns (uint256, uint256);

    /**
     * @dev Get fees by amount (called from collection)
     * @dev Deprecated: use getFeesByQuantity instead.
     */
    function getFees(uint256 amount) external view returns (uint256, uint256);

    /**
     * @dev Get fees by quantity (called from collection)
     */
    function getFeesByQuantity(
        uint256 quantity
    ) external view returns (uint256, uint256);

    /**
     * @dev Returns the perks rate for a given owner.
     */
    function getOwnerPerksRate(address owner) external view returns (uint96);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/******************************************************************************\
* Author: Nick Mudge <nick@perfectabstractions.com> (https://twitter.com/mudgen)
* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535
/******************************************************************************/
import { IDiamondCut } from "../interfaces/IDiamondCut.sol";

// Remember to add the loupe functions from DiamondLoupeFacet to the diamond.
// The loupe functions are required by the EIP2535 Diamonds standard

error InitializationFunctionReverted(address _initializationContractAddress, bytes _calldata);

library LibDiamond {
    bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage");

    struct DiamondStorage {
        // maps function selectors to the facets that execute the functions.
        // and maps the selectors to their position in the selectorSlots array.
        // func selector => address facet, selector position
        mapping(bytes4 => bytes32) facets;
        // array of slots of function selectors.
        // each slot holds 8 function selectors.
        mapping(uint256 => bytes32) selectorSlots;
        // The number of function selectors in selectorSlots
        uint16 selectorCount;
        // Used to query if a contract implements an interface.
        // Used to implement ERC-165.
        mapping(bytes4 => bool) supportedInterfaces;
        // owner of the contract
        address contractOwner;
    }

    function diamondStorage() internal pure returns (DiamondStorage storage ds) {
        bytes32 position = DIAMOND_STORAGE_POSITION;
        assembly {
            ds.slot := position
        }
    }

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    function setContractOwner(address _newOwner) internal {
        DiamondStorage storage ds = diamondStorage();
        address previousOwner = ds.contractOwner;
        ds.contractOwner = _newOwner;
        emit OwnershipTransferred(previousOwner, _newOwner);
    }

    function contractOwner() internal view returns (address contractOwner_) {
        contractOwner_ = diamondStorage().contractOwner;
    }

    function enforceIsContractOwner() internal view {
        require(msg.sender == diamondStorage().contractOwner, "LibDiamond: Must be contract owner");
    }

    event DiamondCut(IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata);

    bytes32 constant CLEAR_ADDRESS_MASK = bytes32(uint256(0xffffffffffffffffffffffff));
    bytes32 constant CLEAR_SELECTOR_MASK = bytes32(uint256(0xffffffff << 224));

    // Internal function version of diamondCut
    // This code is almost the same as the external diamondCut,
    // except it is using 'Facet[] memory _diamondCut' instead of
    // 'Facet[] calldata _diamondCut'.
    // The code is duplicated to prevent copying calldata to memory which
    // causes an error for a two dimensional array.
    function diamondCut(
        IDiamondCut.FacetCut[] memory _diamondCut,
        address _init,
        bytes memory _calldata
    ) internal {
        DiamondStorage storage ds = diamondStorage();
        uint256 originalSelectorCount = ds.selectorCount;
        uint256 selectorCount = originalSelectorCount;
        bytes32 selectorSlot;
        // Check if last selector slot is not full
        // "selectorCount & 7" is a gas efficient modulo by eight "selectorCount % 8" 
        if (selectorCount & 7 > 0) {
            // get last selectorSlot
            // "selectorSlot >> 3" is a gas efficient division by 8 "selectorSlot / 8"
            selectorSlot = ds.selectorSlots[selectorCount >> 3];
        }
        // loop through diamond cut
        for (uint256 facetIndex; facetIndex < _diamondCut.length; ) {
            (selectorCount, selectorSlot) = addReplaceRemoveFacetSelectors(
                selectorCount,
                selectorSlot,
                _diamondCut[facetIndex].facetAddress,
                _diamondCut[facetIndex].action,
                _diamondCut[facetIndex].functionSelectors
            );

            unchecked {
                facetIndex++;
            }
        }
        if (selectorCount != originalSelectorCount) {
            ds.selectorCount = uint16(selectorCount);
        }
        // If last selector slot is not full
        // "selectorCount & 7" is a gas efficient modulo by eight "selectorCount % 8" 
        if (selectorCount & 7 > 0) {
            // "selectorSlot >> 3" is a gas efficient division by 8 "selectorSlot / 8"
            ds.selectorSlots[selectorCount >> 3] = selectorSlot;
        }
        emit DiamondCut(_diamondCut, _init, _calldata);
        initializeDiamondCut(_init, _calldata);
    }

    function addReplaceRemoveFacetSelectors(
        uint256 _selectorCount,
        bytes32 _selectorSlot,
        address _newFacetAddress,
        IDiamondCut.FacetCutAction _action,
        bytes4[] memory _selectors
    ) internal returns (uint256, bytes32) {
        DiamondStorage storage ds = diamondStorage();
        require(_selectors.length > 0, "LibDiamondCut: No selectors in facet to cut");
        if (_action == IDiamondCut.FacetCutAction.Add) {
            enforceHasContractCode(_newFacetAddress, "LibDiamondCut: Add facet has no code");
            for (uint256 selectorIndex; selectorIndex < _selectors.length; ) {
                bytes4 selector = _selectors[selectorIndex];
                bytes32 oldFacet = ds.facets[selector];
                require(address(bytes20(oldFacet)) == address(0), "LibDiamondCut: Can't add function that already exists");
                // add facet for selector
                ds.facets[selector] = bytes20(_newFacetAddress) | bytes32(_selectorCount);
                // "_selectorCount & 7" is a gas efficient modulo by eight "_selectorCount % 8" 
                // " << 5 is the same as multiplying by 32 ( * 32)
                uint256 selectorInSlotPosition = (_selectorCount & 7) << 5;
                // clear selector position in slot and add selector
                _selectorSlot = (_selectorSlot & ~(CLEAR_SELECTOR_MASK >> selectorInSlotPosition)) | (bytes32(selector) >> selectorInSlotPosition);
                // if slot is full then write it to storage
                if (selectorInSlotPosition == 224) {
                    // "_selectorSlot >> 3" is a gas efficient division by 8 "_selectorSlot / 8"
                    ds.selectorSlots[_selectorCount >> 3] = _selectorSlot;
                    _selectorSlot = 0;
                }
                _selectorCount++;

                unchecked {
                    selectorIndex++;
                }
            }
        } else if (_action == IDiamondCut.FacetCutAction.Replace) {
            enforceHasContractCode(_newFacetAddress, "LibDiamondCut: Replace facet has no code");
            for (uint256 selectorIndex; selectorIndex < _selectors.length; ) {
                bytes4 selector = _selectors[selectorIndex];
                bytes32 oldFacet = ds.facets[selector];
                address oldFacetAddress = address(bytes20(oldFacet));
                // only useful if immutable functions exist
                require(oldFacetAddress != address(this), "LibDiamondCut: Can't replace immutable function");
                require(oldFacetAddress != _newFacetAddress, "LibDiamondCut: Can't replace function with same function");
                require(oldFacetAddress != address(0), "LibDiamondCut: Can't replace function that doesn't exist");
                // replace old facet address
                ds.facets[selector] = (oldFacet & CLEAR_ADDRESS_MASK) | bytes20(_newFacetAddress);

                unchecked {
                    selectorIndex++;
                }
            }
        } else if (_action == IDiamondCut.FacetCutAction.Remove) {
            require(_newFacetAddress == address(0), "LibDiamondCut: Remove facet address must be address(0)");
            // "_selectorCount >> 3" is a gas efficient division by 8 "_selectorCount / 8"
            uint256 selectorSlotCount = _selectorCount >> 3;
            // "_selectorCount & 7" is a gas efficient modulo by eight "_selectorCount % 8" 
            uint256 selectorInSlotIndex = _selectorCount & 7;
            for (uint256 selectorIndex; selectorIndex < _selectors.length; ) {
                if (_selectorSlot == 0) {
                    // get last selectorSlot
                    selectorSlotCount--;
                    _selectorSlot = ds.selectorSlots[selectorSlotCount];
                    selectorInSlotIndex = 7;
                } else {
                    selectorInSlotIndex--;
                }
                bytes4 lastSelector;
                uint256 oldSelectorsSlotCount;
                uint256 oldSelectorInSlotPosition;
                // adding a block here prevents stack too deep error
                {
                    bytes4 selector = _selectors[selectorIndex];
                    bytes32 oldFacet = ds.facets[selector];
                    require(address(bytes20(oldFacet)) != address(0), "LibDiamondCut: Can't remove function that doesn't exist");
                    // only useful if immutable functions exist
                    require(address(bytes20(oldFacet)) != address(this), "LibDiamondCut: Can't remove immutable function");
                    // replace selector with last selector in ds.facets
                    // gets the last selector
                    // " << 5 is the same as multiplying by 32 ( * 32)
                    lastSelector = bytes4(_selectorSlot << (selectorInSlotIndex << 5));
                    if (lastSelector != selector) {
                        // update last selector slot position info
                        ds.facets[lastSelector] = (oldFacet & CLEAR_ADDRESS_MASK) | bytes20(ds.facets[lastSelector]);
                    }
                    delete ds.facets[selector];
                    uint256 oldSelectorCount = uint16(uint256(oldFacet));
                    // "oldSelectorCount >> 3" is a gas efficient division by 8 "oldSelectorCount / 8"
                    oldSelectorsSlotCount = oldSelectorCount >> 3;
                    // "oldSelectorCount & 7" is a gas efficient modulo by eight "oldSelectorCount % 8" 
                    // " << 5 is the same as multiplying by 32 ( * 32)
                    oldSelectorInSlotPosition = (oldSelectorCount & 7) << 5;
                }
                if (oldSelectorsSlotCount != selectorSlotCount) {
                    bytes32 oldSelectorSlot = ds.selectorSlots[oldSelectorsSlotCount];
                    // clears the selector we are deleting and puts the last selector in its place.
                    oldSelectorSlot =
                        (oldSelectorSlot & ~(CLEAR_SELECTOR_MASK >> oldSelectorInSlotPosition)) |
                        (bytes32(lastSelector) >> oldSelectorInSlotPosition);
                    // update storage with the modified slot
                    ds.selectorSlots[oldSelectorsSlotCount] = oldSelectorSlot;
                } else {
                    // clears the selector we are deleting and puts the last selector in its place.
                    _selectorSlot =
                        (_selectorSlot & ~(CLEAR_SELECTOR_MASK >> oldSelectorInSlotPosition)) |
                        (bytes32(lastSelector) >> oldSelectorInSlotPosition);
                }
                if (selectorInSlotIndex == 0) {
                    delete ds.selectorSlots[selectorSlotCount];
                    _selectorSlot = 0;
                }

                unchecked {
                    selectorIndex++;
                }
            }
            _selectorCount = selectorSlotCount * 8 + selectorInSlotIndex;
        } else {
            revert("LibDiamondCut: Incorrect FacetCutAction");
        }
        return (_selectorCount, _selectorSlot);
    }

    function initializeDiamondCut(address _init, bytes memory _calldata) internal {
        if (_init == address(0)) {
            return;
        }
        enforceHasContractCode(_init, "LibDiamondCut: _init address has no code");        
        (bool success, bytes memory error) = _init.delegatecall(_calldata);
        if (!success) {
            if (error.length > 0) {
                // bubble up error
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(error)
                    revert(add(32, error), returndata_size)
                }
            } else {
                revert InitializationFunctionReverted(_init, _calldata);
            }
        }
    }

    function enforceHasContractCode(address _contract, string memory _errorMessage) internal view {
        uint256 contractSize;
        assembly {
            contractSize := extcodesize(_contract)
        }
        require(contractSize > 0, _errorMessage);
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"treasury","type":"address"},{"internalType":"address","name":"royalty","type":"address"},{"internalType":"address","name":"trustedForwarder","type":"address"},{"internalType":"uint16","name":"royaltyBps","type":"uint16"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"bytes32[]","name":"apps","type":"bytes32[]"}],"internalType":"struct INiftyKitV3.DiamondArgs","name":"args","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"_initializationContractAddress","type":"address"},{"internalType":"bytes","name":"_calldata","type":"bytes"}],"name":"InitializationFunctionReverted","type":"error"},{"stateMutability":"payable","type":"fallback"},{"stateMutability":"payable","type":"receive"}]

0x60806040523480156200001157600080fd5b5060405162001c9438038062001c9483398101604081905262000034916200137b565b7f45f38af8fd646bf817698fe2be76218d850d401ba88ffd7c9cd1b4f5c9a1db5a805462010000600160b01b031916336201000090810291909117918290556040805163bb4fceb960e01b815290517f45f38af8fd646bf817698fe2be76218d850d401ba88ffd7c9cd1b4f5c9a1db56936000936001600160a01b039104169163bb4fceb9916004828101926020929190829003018187875af1158015620000e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001069190620014dd565b90506000816001600160a01b031663d104a1366040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000149573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000173919081019062001598565b905060008461012001515160016200018c91906200166f565b6001600160401b03811115620001a657620001a66200117e565b604051908082528060200260200182016040528015620001f557816020015b60408051606080820183526000808352602083015291810191909152815260200190600190039081620001c55790505b5060408601516005860180546001600160a01b0319166001600160a01b03909216919091179055606083015160048601805460ff60b01b1916600160b01b60ff9093169290920291909117905561010086015190915060068501906200025c908262001714565b5060808501516008850180546001600160a01b0319166001600160a01b039092169190911790556101208501516200029a9082908690869062000328565b9050620002a8818362000562565b90506200031d818360000151876000015188602001518960c001518a60e001518b606001518c60a00151604051602401620002e9969594939291906200180e565b60408051601f198184030181529190526020810180516001600160e01b0390811663c00cf3ab60e01b179091526200064e16565b505050505062001add565b805160609060008051602062001c008339815191529060005b8181101562000556576000866001600160a01b03166342c71f1d8784815181106200037057620003706200186e565b60200260200101516040518263ffffffff1660e01b81526004016200039791815260200190565b600060405180830381865afa158015620003b5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620003df919081019062001884565b9050806060015160ff16600003620004335760405162461bcd60e51b8152602060048201526012602482015271105c1c08191bd95cc81b9bdd08195e1a5cdd60721b60448201526064015b60405180910390fd5b604080516060810190915281516001600160a01b03168152602081016000815260200182604001518152508983815181106200047357620004736200186e565b602090810291909101810191909152818101516001600160e01b03191660009081526003860190915260408120805460ff19166001179055865182918a91899086908110620004c657620004c66200186e565b6020908102919091018101518252818101929092526040908101600020835181548585015160e01c600160a01b026001600160c01b03199091166001600160a01b039092169190911717815590830151805191926200052e92600185019290910190620010b4565b50606091909101516002909101805460ff191660ff9092169190911790555060010162000341565b50959695505050505050565b604080516060818101835283516001600160a01b03168252600060208301528383015192820192909252835160008051602062001c0083398151915291908590620005b09060019062001917565b81518110620005c357620005c36200186e565b60200260200101819052506000836020015151905060005b8181101562000641576001836003016000876020015184815181106200060557620006056200186e565b6020908102919091018101516001600160e01b0319168252810191909152604001600020805460ff1916911515919091179055600101620005db565b5084925050505b92915050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131e5460008051602062001c008339815191529061ffff811690819060009060071615620006ad5750600381901c60009081526001840160205260409020545b60005b87518110156200073d576200072f83838a8481518110620006d557620006d56200186e565b6020026020010151600001518b8581518110620006f657620006f66200186e565b6020026020010151602001518c86815181106200071757620007176200186e565b602002602001015160400151620007cf60201b60201c565b9093509150600101620006b0565b508282146200075a5760028401805461ffff191661ffff84161790555b60078216156200077d57600382901c600090815260018501602052604090208190555b7f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb673878787604051620007b2939291906200192d565b60405180910390a1620007c6868662000fb8565b50505050505050565b6000808060008051602062001c00833981519152905060008451116200084c5760405162461bcd60e51b815260206004820152602b60248201527f4c69624469616d6f6e644375743a204e6f2073656c6563746f727320696e206660448201526a1858d95d081d1bc818dd5d60aa1b60648201526084016200042a565b600085600281111562000863576200086362001901565b03620009e0576200088e8660405180606001604052806024815260200162001c206024913962001090565b60005b8451811015620009d9576000858281518110620008b257620008b26200186e565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c15620009555760405162461bcd60e51b815260206004820152603560248201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60448201527f6e207468617420616c726561647920657869737473000000000000000000000060648201526084016200042a565b6001600160e01b031980831660008181526020879052604090206001600160601b031960608d901b168e17905560e060058e901b811692831c199c909c1690821c179a819003620009ba5760038c901c600090815260018601602052604081209b909b555b8b620009c68162001a34565b9c50506001909301925062000891915050565b5062000fac565b6001856002811115620009f757620009f762001901565b0362000c045762000a228660405180606001604052806028815260200162001c6c6028913962001090565b60005b8451811015620009d957600085828151811062000a465762000a466200186e565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c30810362000add5760405162461bcd60e51b815260206004820152602f60248201527f4c69624469616d6f6e644375743a2043616e2774207265706c61636520696d6d60448201526e3aba30b1363290333ab731ba34b7b760891b60648201526084016200042a565b896001600160a01b0316816001600160a01b03160362000b555760405162461bcd60e51b8152602060048201526038602482015260008051602062001be083398151915260448201527f6374696f6e20776974682073616d652066756e6374696f6e000000000000000060648201526084016200042a565b6001600160a01b03811662000bc25760405162461bcd60e51b8152602060048201526038602482015260008051602062001be083398151915260448201527f6374696f6e207468617420646f65736e2774206578697374000000000000000060648201526084016200042a565b506001600160e01b031990911660009081526020849052604090206001600160601b03919091166001600160601b031960608a901b1617905560010162000a25565b600285600281111562000c1b5762000c1b62001901565b0362000f53576001600160a01b0386161562000ca05760405162461bcd60e51b815260206004820152603660248201527f4c69624469616d6f6e644375743a2052656d6f7665206661636574206164647260448201527f657373206d75737420626520616464726573732830290000000000000000000060648201526084016200042a565b600388901c6007891660005b865181101562000f2e5760008a900362000ced578262000ccc8162001a50565b60008181526001870160205260409020549b5093506007925062000cfd9050565b8162000cf98162001a50565b9250505b6000806000808a858151811062000d185762000d186200186e565b6020908102919091018101516001600160e01b031981166000908152918a9052604090912054909150606081901c62000dba5760405162461bcd60e51b815260206004820152603760248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360448201527f74696f6e207468617420646f65736e277420657869737400000000000000000060648201526084016200042a565b30606082901c0362000e265760405162461bcd60e51b815260206004820152602e60248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560448201526d3a30b1363290333ab731ba34b7b760911b60648201526084016200042a565b600587901b8f901b94506001600160e01b03198086169083161462000e78576001600160e01b03198516600090815260208a90526040902080546001600160601b0319166001600160601b0383161790555b6001600160e01b031991909116600090815260208990526040812055600381901c611fff16925060051b60e016905085821462000edf576000828152600188016020526040902080546001600160e01b031980841c19909116908516831c17905562000f03565b80836001600160e01b031916901c816001600160e01b031960001b901c198e16179c505b8460000362000f2257600086815260018801602052604081208190559c505b50505060010162000cac565b508062000f3d83600862001a6a565b62000f4991906200166f565b9950505062000fac565b60405162461bcd60e51b815260206004820152602760248201527f4c69624469616d6f6e644375743a20496e636f727265637420466163657443756044820152663a20b1ba34b7b760c91b60648201526084016200042a565b50959694955050505050565b6001600160a01b03821662000fcb575050565b62000ff08260405180606001604052806028815260200162001c446028913962001090565b600080836001600160a01b0316836040516200100d919062001a84565b600060405180830381855af49150503d80600081146200104a576040519150601f19603f3d011682016040523d82523d6000602084013e6200104f565b606091505b5091509150816200108a578051156200106b5780518082602001fd5b838360405163192105d760e01b81526004016200042a92919062001aa2565b50505050565b813b81816200108a5760405162461bcd60e51b81526004016200042a919062001ac8565b82805482825590600052602060002090600701600890048101928215620011555791602002820160005b838211156200112157835183826101000a81548163ffffffff021916908360e01c02179055509260200192600401602081600301049283019260010302620010de565b8015620011535782816101000a81549063ffffffff021916905560040160208160030104928301926001030262001121565b505b506200116392915062001167565b5090565b5b8082111562001163576000815560010162001168565b634e487b7160e01b600052604160045260246000fd5b60405161014081016001600160401b0381118282101715620011ba57620011ba6200117e565b60405290565b604051608081016001600160401b0381118282101715620011ba57620011ba6200117e565b604051601f8201601f191681016001600160401b03811182821017156200121057620012106200117e565b604052919050565b80516001600160a01b03811681146200123057600080fd5b919050565b805161ffff811681146200123057600080fd5b60005b83811015620012655781810151838201526020016200124b565b50506000910152565b600082601f8301126200128057600080fd5b81516001600160401b038111156200129c576200129c6200117e565b620012b1601f8201601f1916602001620011e5565b818152846020838601011115620012c757600080fd5b620012da82602083016020870162001248565b949350505050565b60006001600160401b03821115620012fe57620012fe6200117e565b5060051b60200190565b600082601f8301126200131a57600080fd5b81516020620013336200132d83620012e2565b620011e5565b82815260059290921b840181019181810190868411156200135357600080fd5b8286015b8481101562001370578051835291830191830162001357565b509695505050505050565b6000602082840312156200138e57600080fd5b81516001600160401b0380821115620013a657600080fd5b908301906101408286031215620013bc57600080fd5b620013c662001194565b620013d18362001218565b8152620013e16020840162001218565b6020820152620013f46040840162001218565b6040820152620014076060840162001218565b60608201526200141a6080840162001218565b60808201526200142d60a0840162001235565b60a082015260c0830151828111156200144557600080fd5b62001453878286016200126e565b60c08301525060e0830151828111156200146c57600080fd5b6200147a878286016200126e565b60e08301525061010080840151838111156200149557600080fd5b620014a3888287016200126e565b8284015250506101208084015183811115620014be57600080fd5b620014cc8882870162001308565b918301919091525095945050505050565b600060208284031215620014f057600080fd5b620014fb8262001218565b9392505050565b80516001600160e01b0319811681146200123057600080fd5b600082601f8301126200152d57600080fd5b81516020620015406200132d83620012e2565b82815260059290921b840181019181810190868411156200156057600080fd5b8286015b848110156200137057620015788162001502565b835291830191830162001564565b805160ff811681146200123057600080fd5b600060208284031215620015ab57600080fd5b81516001600160401b0380821115620015c357600080fd5b9083019060808286031215620015d857600080fd5b620015e2620011c0565b620015ed8362001218565b81526020830151828111156200160257600080fd5b62001610878286016200151b565b6020830152506040830151828111156200162957600080fd5b62001637878286016200151b565b6040830152506200164b6060840162001586565b606082015295945050505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111562000648576200064862001659565b600181811c908216806200169a57607f821691505b602082108103620016bb57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200170f57600081815260208120601f850160051c81016020861015620016ea5750805b601f850160051c820191505b818110156200170b57828155600101620016f6565b5050505b505050565b81516001600160401b038111156200173057620017306200117e565b620017488162001741845462001685565b84620016c1565b602080601f831160018114620017805760008415620017675750858301515b600019600386901b1c1916600185901b1785556200170b565b600085815260208120601f198616915b82811015620017b15788860151825594840194600190910190840162001790565b5085821015620017d05787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008151808452620017fa81602086016020860162001248565b601f01601f19169290920160200192915050565b600060018060a01b038089168352808816602084015260c060408401526200183a60c0840188620017e0565b83810360608501526200184e8188620017e0565b959091166080840152505061ffff9190911660a090910152949350505050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156200189757600080fd5b81516001600160401b0380821115620018af57600080fd5b9083019060808286031215620018c457600080fd5b620018ce620011c0565b620018d98362001218565b8152620018e96020840162001502565b60208201526040830151828111156200162957600080fd5b634e487b7160e01b600052602160045260246000fd5b8181038181111562000648576200064862001659565b60006060808301818452808751808352608092508286019150828160051b8701016020808b0160005b8481101562001a0257898403607f19018652815180516001600160a01b031685528381015189860190600381106200199e57634e487b7160e01b600052602160045260246000fd5b868601526040918201519186018a905281519081905290840190600090898701905b80831015620019ec5783516001600160e01b0319168252928601926001929092019190860190620019c0565b5097850197955050509082019060010162001956565b50506001600160a01b038a1690880152868103604088015262001a268189620017e0565b9a9950505050505050505050565b60006001820162001a495762001a4962001659565b5060010190565b60008162001a625762001a6262001659565b506000190190565b808202811582820484141762000648576200064862001659565b6000825162001a9881846020870162001248565b9190910192915050565b6001600160a01b0383168152604060208201819052600090620012da90830184620017e0565b602081526000620014fb6020830184620017e0565b60f48062001aec6000396000f3fe608060405236600a57005b600080356001600160e01b03191681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c6020819052604090912054819060601c80609b5760405162461bcd60e51b815260206004820181905260248201527f4469616d6f6e643a2046756e6374696f6e20646f6573206e6f74206578697374604482015260640160405180910390fd5b3660008037600080366000845af43d6000803e80801560b9573d6000f35b3d6000fdfea26469706673582212204b2e85355e1937888a78adb1bf744ba88839710c17cc2e5676456a66b46bb8ab64736f6c634300081300334c69624469616d6f6e644375743a2043616e2774207265706c6163652066756ec8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c4c69624469616d6f6e644375743a2041646420666163657420686173206e6f20636f64654c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f64654c69624469616d6f6e644375743a205265706c61636520666163657420686173206e6f20636f6465000000000000000000000000000000000000000000000000000000000000002000000000000000000000000088619ff0cf0985eaceeb27aee829b11801de17b2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000088619ff0cf0985eaceeb27aee829b11801de17b200000000000000000000000088619ff0cf0985eaceeb27aee829b11801de17b2000000000000000000000000ab2648e957f699ad9fd5f3e9c0734d7a03bd7a3600000000000000000000000000000000000000000000000000000000000001f40000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000000f54686520457465726e616c204b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d544845455445524e414c4b455900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003e68747470733a2f2f63646e2d6170692e6e696674796b69742e636f6d2f72657665616c2f636c766d6e7a69337a30303031336b7778786472376a346b6d2f000000000000000000000000000000000000000000000000000000000000000000016f297c61b5c92ef107ffd30cd56affe5a273e841d202d87dff9baf0090116b99

Deployed Bytecode

0x608060405236600a57005b600080356001600160e01b03191681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c6020819052604090912054819060601c80609b5760405162461bcd60e51b815260206004820181905260248201527f4469616d6f6e643a2046756e6374696f6e20646f6573206e6f74206578697374604482015260640160405180910390fd5b3660008037600080366000845af43d6000803e80801560b9573d6000f35b3d6000fdfea26469706673582212204b2e85355e1937888a78adb1bf744ba88839710c17cc2e5676456a66b46bb8ab64736f6c63430008130033

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.