ETH Price: $3,506.34 (+2.35%)
Gas: 3 Gwei

Contract

0xAfbDb7d9f692820D2739D35F4356b307FF3d9d0a
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

TokenTracker

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Safe Transfer Fr...201289052024-06-19 22:55:4730 days ago1718837747IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.000588725.93241513
Safe Transfer Fr...195795822024-04-04 3:00:35106 days ago1712199635IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0021789521.46669205
Set Approval For...194239972024-03-13 5:14:59128 days ago1710306899IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0033479645.47871925
Set Approval For...194237542024-03-13 4:25:35128 days ago1710303935IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0031637342.97617792
Safe Transfer Fr...193661862024-03-05 3:09:35136 days ago1709608175IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0063839776.99881938
Set Approval For...191624182024-02-05 13:38:23165 days ago1707140303IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0014361319.52754075
Set Approval For...191488442024-02-03 15:53:23167 days ago1706975603IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0012967117.63184475
Set Approval For...190140282024-01-15 18:19:47186 days ago1705342787IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0019284926.21377373
Set Approval For...189355452024-01-04 17:47:35197 days ago1704390455IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0019305926.25089657
Safe Transfer Fr...188935832023-12-29 20:24:11203 days ago1703881451IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0018931118.94142782
Set Approval For...188892932023-12-29 5:54:59203 days ago1703829299IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.001543620.9888518
Set Approval For...188401272023-12-22 8:14:23210 days ago1703232863IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0023099531.40912701
Set Approval For...188390642023-12-22 4:39:47210 days ago1703219987IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0017453423.7319321
Set Approval For...188390522023-12-22 4:37:11210 days ago1703219831IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0016933223.02459944
Safe Transfer Fr...188388802023-12-22 4:02:35210 days ago1703217755IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0023988828.9336487
Safe Transfer Fr...188388712023-12-22 4:00:47210 days ago1703217647IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0022172426.74281476
Safe Transfer Fr...188386602023-12-22 3:18:11210 days ago1703215091IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0033691427.66878108
Safe Transfer Fr...188386502023-12-22 3:16:11210 days ago1703214971IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0022651629.13505684
Safe Transfer Fr...188386342023-12-22 3:12:47210 days ago1703214767IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0029032324.29221749
Safe Transfer Fr...188386172023-12-22 3:09:23210 days ago1703214563IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0020310626.89974779
Withdraw187854102023-12-14 15:56:47218 days ago1702569407IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0015316738.48324603
Stop Sale187830742023-12-14 8:04:47218 days ago1702541087IN
0xAfbDb7d9...7FF3d9d0a
0 ETH0.0011699637.99205376
Mint To187830472023-12-14 7:59:23218 days ago1702540763IN
0xAfbDb7d9...7FF3d9d0a
0.01474412 ETH0.0051189742.6247113
Mint To187830442023-12-14 7:58:47218 days ago1702540727IN
0xAfbDb7d9...7FF3d9d0a
0.01474412 ETH0.0053209838.76967561
Mint To187830242023-12-14 7:54:47218 days ago1702540487IN
0xAfbDb7d9...7FF3d9d0a
0.04423236 ETH0.0066195850.27254785
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
187854102023-12-14 15:56:47218 days ago1702569407
0xAfbDb7d9...7FF3d9d0a
0.3486 ETH
187830472023-12-14 7:59:23218 days ago1702540763
0xAfbDb7d9...7FF3d9d0a
0.00214412 ETH
187830442023-12-14 7:58:47218 days ago1702540727
0xAfbDb7d9...7FF3d9d0a
0.00214412 ETH
187830242023-12-14 7:54:47218 days ago1702540487
0xAfbDb7d9...7FF3d9d0a
0.00643236 ETH
187829472023-12-14 7:39:11218 days ago1702539551
0xAfbDb7d9...7FF3d9d0a
0.00357353 ETH
187828932023-12-14 7:28:23218 days ago1702538903
0xAfbDb7d9...7FF3d9d0a
0.00142941 ETH
187828472023-12-14 7:18:35218 days ago1702538315
0xAfbDb7d9...7FF3d9d0a
0.00214412 ETH
187824312023-12-14 5:54:47218 days ago1702533287
0xAfbDb7d9...7FF3d9d0a
0.00142941 ETH
187821722023-12-14 5:02:23218 days ago1702530143
0xAfbDb7d9...7FF3d9d0a
0.00142941 ETH
187821322023-12-14 4:53:59218 days ago1702529639
0xAfbDb7d9...7FF3d9d0a
0.00357353 ETH
187819632023-12-14 4:19:47218 days ago1702527587
0xAfbDb7d9...7FF3d9d0a
0.00142941 ETH
187818862023-12-14 4:04:11218 days ago1702526651
0xAfbDb7d9...7FF3d9d0a
0.00357353 ETH
187817742023-12-14 3:41:35218 days ago1702525295
0xAfbDb7d9...7FF3d9d0a
0.00142941 ETH
187814252023-12-14 2:31:23218 days ago1702521083
0xAfbDb7d9...7FF3d9d0a
0.00142941 ETH
187807872023-12-14 0:22:47218 days ago1702513367
0xAfbDb7d9...7FF3d9d0a
0.0007147 ETH
187806282023-12-13 23:50:35219 days ago1702511435
0xAfbDb7d9...7FF3d9d0a
0.00142941 ETH
187805092023-12-13 23:26:11219 days ago1702509971
0xAfbDb7d9...7FF3d9d0a
0.00142941 ETH
187766732023-12-13 10:31:35219 days ago1702463495
0xAfbDb7d9...7FF3d9d0a
0.00428824 ETH
187750442023-12-13 5:03:35219 days ago1702443815
0xAfbDb7d9...7FF3d9d0a
0.00142941 ETH
187745672023-12-13 3:26:59219 days ago1702438019
0xAfbDb7d9...7FF3d9d0a
0.00142941 ETH
187712022023-12-12 16:09:23220 days ago1702397363
0xAfbDb7d9...7FF3d9d0a
0.00428824 ETH
187702802023-12-12 13:03:23220 days ago1702386203
0xAfbDb7d9...7FF3d9d0a
0.00357353 ETH
187689722023-12-12 8:39:59220 days ago1702370399
0xAfbDb7d9...7FF3d9d0a
0.0007147 ETH
187641202023-12-11 16:21:11221 days ago1702311671
0xAfbDb7d9...7FF3d9d0a
0.0007147 ETH
187605832023-12-11 4:28:47221 days ago1702268927
0xAfbDb7d9...7FF3d9d0a
0.00142941 ETH
View All Internal Transactions
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
File 1 of 6 : DiamondCollection.sol
// 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 <[email protected]> (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);
}

File 4 of 6 : INiftyKitAppRegistry.sol
// 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);
}

File 5 of 6 : INiftyKitV3.sol
// 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);
}

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

/******************************************************************************\
* Author: Nick Mudge <[email protected]> (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

[{"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"}]

Deployed Bytecode

0x608060405236600a57005b600080356001600160e01b03191681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c6020819052604090912054819060601c80609b5760405162461bcd60e51b815260206004820181905260248201527f4469616d6f6e643a2046756e6374696f6e20646f6573206e6f74206578697374604482015260640160405180910390fd5b3660008037600080366000845af43d6000803e80801560b9573d6000f35b3d6000fdfea26469706673582212204b2e85355e1937888a78adb1bf744ba88839710c17cc2e5676456a66b46bb8ab64736f6c63430008130033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.