ETH Price: $3,855.31 (-12.05%)

Contract

0xa50B1B1957aF772D561F62d003c6fe706De41A02
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Approval For...209566002024-10-13 12:18:23362 days ago1728821903IN
0xa50B1B19...06De41A02
0 ETH0.000679939.23478643
Set Approval For...209565982024-10-13 12:17:59362 days ago1728821879IN
0xa50B1B19...06De41A02
0 ETH0.0007754710.54096136
Transfer From209564812024-10-13 11:53:59362 days ago1728820439IN
0xa50B1B19...06De41A02
0 ETH0.000656099.84270366
Transfer From209562682024-10-13 11:11:11362 days ago1728817871IN
0xa50B1B19...06De41A02
0 ETH0.000622049.33187217
Set Approval For...207529032024-09-15 2:03:23390 days ago1726365803IN
0xa50B1B19...06De41A02
0 ETH0.000124471.69246677
Set Approval For...207529022024-09-15 2:03:11390 days ago1726365791IN
0xa50B1B19...06De41A02
0 ETH0.00011581.57277655
Set Approval For...207529002024-09-15 2:02:47390 days ago1726365767IN
0xa50B1B19...06De41A02
0 ETH0.000118411.60963225
Transfer From206392562024-08-30 5:18:59406 days ago1724995139IN
0xa50B1B19...06De41A02
0 ETH0.000091571.37385923
Transfer From201976082024-06-29 13:21:47468 days ago1719667307IN
0xa50B1B19...06De41A02
0 ETH0.000131312.65106825
Transfer Ownersh...199352542024-05-23 21:26:11505 days ago1716499571IN
0xa50B1B19...06De41A02
0 ETH0.001103132.92846445
Transfer From199127922024-05-20 18:03:47508 days ago1716228227IN
0xa50B1B19...06De41A02
0 ETH0.0008153715
Transfer From199123532024-05-20 16:33:11508 days ago1716222791IN
0xa50B1B19...06De41A02
0 ETH0.0010718715
Transfer From199123052024-05-20 16:23:23508 days ago1716222203IN
0xa50B1B19...06De41A02
0 ETH0.0011433216
Transfer From199122892024-05-20 16:20:11508 days ago1716222011IN
0xa50B1B19...06De41A02
0 ETH0.0009240817
Transfer From199122682024-05-20 16:15:59508 days ago1716221759IN
0xa50B1B19...06De41A02
0 ETH0.0009784418
Transfer From199122482024-05-20 16:11:59508 days ago1716221519IN
0xa50B1B19...06De41A02
0 ETH0.0011415121
Transfer From199122362024-05-20 16:09:35508 days ago1716221375IN
0xa50B1B19...06De41A02
0 ETH0.0011958722
Transfer From199122232024-05-20 16:06:59508 days ago1716221219IN
0xa50B1B19...06De41A02
0 ETH0.0013045924
Transfer From199119752024-05-20 15:16:59508 days ago1716218219IN
0xa50B1B19...06De41A02
0 ETH0.0007860311
Transfer From199119322024-05-20 15:08:23508 days ago1716217703IN
0xa50B1B19...06De41A02
0 ETH0.0007860311
Transfer From199118822024-05-20 14:58:11508 days ago1716217091IN
0xa50B1B19...06De41A02
0 ETH0.0009289513
Transfer From199118182024-05-20 14:45:11508 days ago1716216311IN
0xa50B1B19...06De41A02
0 ETH0.0007610114
Transfer From199067452024-05-19 21:43:59509 days ago1716155039IN
0xa50B1B19...06De41A02
0 ETH0.000217434
Transfer From199065292024-05-19 21:00:47509 days ago1716152447IN
0xa50B1B19...06De41A02
0 ETH0.000163073
Transfer From199065062024-05-19 20:56:11509 days ago1716152171IN
0xa50B1B19...06De41A02
0 ETH0.000163073
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
From
To
Transfer194557672024-03-17 16:31:47572 days ago1710693107
0xa50B1B19...06De41A02
0.25237482 ETH
Transfer193801372024-03-07 1:52:59582 days ago1709776379
0xa50B1B19...06De41A02
0.3144714 ETH
Transfer193451642024-03-02 4:41:23587 days ago1709354483
0xa50B1B19...06De41A02
0.2501477 ETH
Transfer193309262024-02-29 4:55:23589 days ago1709182523
0xa50B1B19...06De41A02
0.28302426 ETH
Transfer192944342024-02-24 2:22:47594 days ago1708741367
0xa50B1B19...06De41A02
0.42167756 ETH
Transfer192752222024-02-21 9:44:47597 days ago1708508687
0xa50B1B19...06De41A02
0.08576492 ETH
Transfer192591432024-02-19 3:33:23599 days ago1708313603
0xa50B1B19...06De41A02
0.07147077 ETH
Transfer192522422024-02-18 4:11:59600 days ago1708229519
0xa50B1B19...06De41A02
0.0557472 ETH
Transfer192520012024-02-18 3:22:47600 days ago1708226567
0xa50B1B19...06De41A02
0.06718252 ETH
Transfer192233572024-02-14 2:53:35604 days ago1707879215
0xa50B1B19...06De41A02
0.04431187 ETH
Transfer192233522024-02-14 2:52:35604 days ago1707879155
0xa50B1B19...06De41A02
0.01429415 ETH
Transfer192230512024-02-14 1:50:35604 days ago1707875435
0xa50B1B19...06De41A02
0.01429415 ETH
Transfer192228722024-02-14 1:14:23604 days ago1707873263
0xa50B1B19...06De41A02
0.01143532 ETH
Transfer192227522024-02-14 0:50:23605 days ago1707871823
0xa50B1B19...06De41A02
0.00857649 ETH
Transfer192118562024-02-12 12:10:23606 days ago1707739823
0xa50B1B19...06De41A02
0.0007147 ETH
Transfer192118522024-02-12 12:09:35606 days ago1707739775
0xa50B1B19...06De41A02
0.01786769 ETH
Transfer191164172024-01-30 2:43:11619 days ago1706582591
0xa50B1B19...06De41A02
0.05717661 ETH
Transfer191100092024-01-29 5:10:23620 days ago1706505023
0xa50B1B19...06De41A02
0.1572357 ETH
Transfer191078262024-01-28 21:50:59621 days ago1706478659
0xa50B1B19...06De41A02
0.03144714 ETH
Transfer190923592024-01-26 17:46:59623 days ago1706291219
0xa50B1B19...06De41A02
0.12578856 ETH
Transfer189298432024-01-03 22:37:23646 days ago1704321443
0xa50B1B19...06De41A02
0.1114944 ETH
Transfer188365322023-12-21 20:09:47659 days ago1703189387
0xa50B1B19...06De41A02
0.11506794 ETH
Transfer188364672023-12-21 19:56:47659 days ago1703188607
0xa50B1B19...06De41A02
0.01429415 ETH
Transfer188364592023-12-21 19:55:11659 days ago1703188511
0xa50B1B19...06De41A02
0.00786178 ETH
Transfer186071532023-11-19 16:49:59691 days ago1700412599
0xa50B1B19...06De41A02
0.09648554 ETH
View All Internal Transactions
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 <[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);
}

// 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 <[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

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

0x60806040523480156200001157600080fd5b5060405162001c9438038062001c9483398101604081905262000034916200137b565b7f45f38af8fd646bf817698fe2be76218d850d401ba88ffd7c9cd1b4f5c9a1db5a805462010000600160b01b031916336201000090810291909117918290556040805163bb4fceb960e01b815290517f45f38af8fd646bf817698fe2be76218d850d401ba88ffd7c9cd1b4f5c9a1db56936000936001600160a01b039104169163bb4fceb9916004828101926020929190829003018187875af1158015620000e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001069190620014dd565b90506000816001600160a01b031663d104a1366040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000149573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000173919081019062001598565b905060008461012001515160016200018c91906200166f565b6001600160401b03811115620001a657620001a66200117e565b604051908082528060200260200182016040528015620001f557816020015b60408051606080820183526000808352602083015291810191909152815260200190600190039081620001c55790505b5060408601516005860180546001600160a01b0319166001600160a01b03909216919091179055606083015160048601805460ff60b01b1916600160b01b60ff9093169290920291909117905561010086015190915060068501906200025c908262001714565b5060808501516008850180546001600160a01b0319166001600160a01b039092169190911790556101208501516200029a9082908690869062000328565b9050620002a8818362000562565b90506200031d818360000151876000015188602001518960c001518a60e001518b606001518c60a00151604051602401620002e9969594939291906200180e565b60408051601f198184030181529190526020810180516001600160e01b0390811663c00cf3ab60e01b179091526200064e16565b505050505062001add565b805160609060008051602062001c008339815191529060005b8181101562000556576000866001600160a01b03166342c71f1d8784815181106200037057620003706200186e565b60200260200101516040518263ffffffff1660e01b81526004016200039791815260200190565b600060405180830381865afa158015620003b5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620003df919081019062001884565b9050806060015160ff16600003620004335760405162461bcd60e51b8152602060048201526012602482015271105c1c08191bd95cc81b9bdd08195e1a5cdd60721b60448201526064015b60405180910390fd5b604080516060810190915281516001600160a01b03168152602081016000815260200182604001518152508983815181106200047357620004736200186e565b602090810291909101810191909152818101516001600160e01b03191660009081526003860190915260408120805460ff19166001179055865182918a91899086908110620004c657620004c66200186e565b6020908102919091018101518252818101929092526040908101600020835181548585015160e01c600160a01b026001600160c01b03199091166001600160a01b039092169190911717815590830151805191926200052e92600185019290910190620010b4565b50606091909101516002909101805460ff191660ff9092169190911790555060010162000341565b50959695505050505050565b604080516060818101835283516001600160a01b03168252600060208301528383015192820192909252835160008051602062001c0083398151915291908590620005b09060019062001917565b81518110620005c357620005c36200186e565b60200260200101819052506000836020015151905060005b8181101562000641576001836003016000876020015184815181106200060557620006056200186e565b6020908102919091018101516001600160e01b0319168252810191909152604001600020805460ff1916911515919091179055600101620005db565b5084925050505b92915050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131e5460008051602062001c008339815191529061ffff811690819060009060071615620006ad5750600381901c60009081526001840160205260409020545b60005b87518110156200073d576200072f83838a8481518110620006d557620006d56200186e565b6020026020010151600001518b8581518110620006f657620006f66200186e565b6020026020010151602001518c86815181106200071757620007176200186e565b602002602001015160400151620007cf60201b60201c565b9093509150600101620006b0565b508282146200075a5760028401805461ffff191661ffff84161790555b60078216156200077d57600382901c600090815260018501602052604090208190555b7f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb673878787604051620007b2939291906200192d565b60405180910390a1620007c6868662000fb8565b50505050505050565b6000808060008051602062001c00833981519152905060008451116200084c5760405162461bcd60e51b815260206004820152602b60248201527f4c69624469616d6f6e644375743a204e6f2073656c6563746f727320696e206660448201526a1858d95d081d1bc818dd5d60aa1b60648201526084016200042a565b600085600281111562000863576200086362001901565b03620009e0576200088e8660405180606001604052806024815260200162001c206024913962001090565b60005b8451811015620009d9576000858281518110620008b257620008b26200186e565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c15620009555760405162461bcd60e51b815260206004820152603560248201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60448201527f6e207468617420616c726561647920657869737473000000000000000000000060648201526084016200042a565b6001600160e01b031980831660008181526020879052604090206001600160601b031960608d901b168e17905560e060058e901b811692831c199c909c1690821c179a819003620009ba5760038c901c600090815260018601602052604081209b909b555b8b620009c68162001a34565b9c50506001909301925062000891915050565b5062000fac565b6001856002811115620009f757620009f762001901565b0362000c045762000a228660405180606001604052806028815260200162001c6c6028913962001090565b60005b8451811015620009d957600085828151811062000a465762000a466200186e565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c30810362000add5760405162461bcd60e51b815260206004820152602f60248201527f4c69624469616d6f6e644375743a2043616e2774207265706c61636520696d6d60448201526e3aba30b1363290333ab731ba34b7b760891b60648201526084016200042a565b896001600160a01b0316816001600160a01b03160362000b555760405162461bcd60e51b8152602060048201526038602482015260008051602062001be083398151915260448201527f6374696f6e20776974682073616d652066756e6374696f6e000000000000000060648201526084016200042a565b6001600160a01b03811662000bc25760405162461bcd60e51b8152602060048201526038602482015260008051602062001be083398151915260448201527f6374696f6e207468617420646f65736e2774206578697374000000000000000060648201526084016200042a565b506001600160e01b031990911660009081526020849052604090206001600160601b03919091166001600160601b031960608a901b1617905560010162000a25565b600285600281111562000c1b5762000c1b62001901565b0362000f53576001600160a01b0386161562000ca05760405162461bcd60e51b815260206004820152603660248201527f4c69624469616d6f6e644375743a2052656d6f7665206661636574206164647260448201527f657373206d75737420626520616464726573732830290000000000000000000060648201526084016200042a565b600388901c6007891660005b865181101562000f2e5760008a900362000ced578262000ccc8162001a50565b60008181526001870160205260409020549b5093506007925062000cfd9050565b8162000cf98162001a50565b9250505b6000806000808a858151811062000d185762000d186200186e565b6020908102919091018101516001600160e01b031981166000908152918a9052604090912054909150606081901c62000dba5760405162461bcd60e51b815260206004820152603760248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360448201527f74696f6e207468617420646f65736e277420657869737400000000000000000060648201526084016200042a565b30606082901c0362000e265760405162461bcd60e51b815260206004820152602e60248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560448201526d3a30b1363290333ab731ba34b7b760911b60648201526084016200042a565b600587901b8f901b94506001600160e01b03198086169083161462000e78576001600160e01b03198516600090815260208a90526040902080546001600160601b0319166001600160601b0383161790555b6001600160e01b031991909116600090815260208990526040812055600381901c611fff16925060051b60e016905085821462000edf576000828152600188016020526040902080546001600160e01b031980841c19909116908516831c17905562000f03565b80836001600160e01b031916901c816001600160e01b031960001b901c198e16179c505b8460000362000f2257600086815260018801602052604081208190559c505b50505060010162000cac565b508062000f3d83600862001a6a565b62000f4991906200166f565b9950505062000fac565b60405162461bcd60e51b815260206004820152602760248201527f4c69624469616d6f6e644375743a20496e636f727265637420466163657443756044820152663a20b1ba34b7b760c91b60648201526084016200042a565b50959694955050505050565b6001600160a01b03821662000fcb575050565b62000ff08260405180606001604052806028815260200162001c446028913962001090565b600080836001600160a01b0316836040516200100d919062001a84565b600060405180830381855af49150503d80600081146200104a576040519150601f19603f3d011682016040523d82523d6000602084013e6200104f565b606091505b5091509150816200108a578051156200106b5780518082602001fd5b838360405163192105d760e01b81526004016200042a92919062001aa2565b50505050565b813b81816200108a5760405162461bcd60e51b81526004016200042a919062001ac8565b82805482825590600052602060002090600701600890048101928215620011555791602002820160005b838211156200112157835183826101000a81548163ffffffff021916908360e01c02179055509260200192600401602081600301049283019260010302620010de565b8015620011535782816101000a81549063ffffffff021916905560040160208160030104928301926001030262001121565b505b506200116392915062001167565b5090565b5b8082111562001163576000815560010162001168565b634e487b7160e01b600052604160045260246000fd5b60405161014081016001600160401b0381118282101715620011ba57620011ba6200117e565b60405290565b604051608081016001600160401b0381118282101715620011ba57620011ba6200117e565b604051601f8201601f191681016001600160401b03811182821017156200121057620012106200117e565b604052919050565b80516001600160a01b03811681146200123057600080fd5b919050565b805161ffff811681146200123057600080fd5b60005b83811015620012655781810151838201526020016200124b565b50506000910152565b600082601f8301126200128057600080fd5b81516001600160401b038111156200129c576200129c6200117e565b620012b1601f8201601f1916602001620011e5565b818152846020838601011115620012c757600080fd5b620012da82602083016020870162001248565b949350505050565b60006001600160401b03821115620012fe57620012fe6200117e565b5060051b60200190565b600082601f8301126200131a57600080fd5b81516020620013336200132d83620012e2565b620011e5565b82815260059290921b840181019181810190868411156200135357600080fd5b8286015b8481101562001370578051835291830191830162001357565b509695505050505050565b6000602082840312156200138e57600080fd5b81516001600160401b0380821115620013a657600080fd5b908301906101408286031215620013bc57600080fd5b620013c662001194565b620013d18362001218565b8152620013e16020840162001218565b6020820152620013f46040840162001218565b6040820152620014076060840162001218565b60608201526200141a6080840162001218565b60808201526200142d60a0840162001235565b60a082015260c0830151828111156200144557600080fd5b62001453878286016200126e565b60c08301525060e0830151828111156200146c57600080fd5b6200147a878286016200126e565b60e08301525061010080840151838111156200149557600080fd5b620014a3888287016200126e565b8284015250506101208084015183811115620014be57600080fd5b620014cc8882870162001308565b918301919091525095945050505050565b600060208284031215620014f057600080fd5b620014fb8262001218565b9392505050565b80516001600160e01b0319811681146200123057600080fd5b600082601f8301126200152d57600080fd5b81516020620015406200132d83620012e2565b82815260059290921b840181019181810190868411156200156057600080fd5b8286015b848110156200137057620015788162001502565b835291830191830162001564565b805160ff811681146200123057600080fd5b600060208284031215620015ab57600080fd5b81516001600160401b0380821115620015c357600080fd5b9083019060808286031215620015d857600080fd5b620015e2620011c0565b620015ed8362001218565b81526020830151828111156200160257600080fd5b62001610878286016200151b565b6020830152506040830151828111156200162957600080fd5b62001637878286016200151b565b6040830152506200164b6060840162001586565b606082015295945050505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111562000648576200064862001659565b600181811c908216806200169a57607f821691505b602082108103620016bb57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200170f57600081815260208120601f850160051c81016020861015620016ea5750805b601f850160051c820191505b818110156200170b57828155600101620016f6565b5050505b505050565b81516001600160401b038111156200173057620017306200117e565b620017488162001741845462001685565b84620016c1565b602080601f831160018114620017805760008415620017675750858301515b600019600386901b1c1916600185901b1785556200170b565b600085815260208120601f198616915b82811015620017b15788860151825594840194600190910190840162001790565b5085821015620017d05787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008151808452620017fa81602086016020860162001248565b601f01601f19169290920160200192915050565b600060018060a01b038089168352808816602084015260c060408401526200183a60c0840188620017e0565b83810360608501526200184e8188620017e0565b959091166080840152505061ffff9190911660a090910152949350505050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156200189757600080fd5b81516001600160401b0380821115620018af57600080fd5b9083019060808286031215620018c457600080fd5b620018ce620011c0565b620018d98362001218565b8152620018e96020840162001502565b60208201526040830151828111156200162957600080fd5b634e487b7160e01b600052602160045260246000fd5b8181038181111562000648576200064862001659565b60006060808301818452808751808352608092508286019150828160051b8701016020808b0160005b8481101562001a0257898403607f19018652815180516001600160a01b031685528381015189860190600381106200199e57634e487b7160e01b600052602160045260246000fd5b868601526040918201519186018a905281519081905290840190600090898701905b80831015620019ec5783516001600160e01b0319168252928601926001929092019190860190620019c0565b5097850197955050509082019060010162001956565b50506001600160a01b038a1690880152868103604088015262001a268189620017e0565b9a9950505050505050505050565b60006001820162001a495762001a4962001659565b5060010190565b60008162001a625762001a6262001659565b506000190190565b808202811582820484141762000648576200064862001659565b6000825162001a9881846020870162001248565b9190910192915050565b6001600160a01b0383168152604060208201819052600090620012da90830184620017e0565b602081526000620014fb6020830184620017e0565b60f48062001aec6000396000f3fe608060405236600a57005b600080356001600160e01b03191681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c6020819052604090912054819060601c80609b5760405162461bcd60e51b815260206004820181905260248201527f4469616d6f6e643a2046756e6374696f6e20646f6573206e6f74206578697374604482015260640160405180910390fd5b3660008037600080366000845af43d6000803e80801560b9573d6000f35b3d6000fdfea26469706673582212204b2e85355e1937888a78adb1bf744ba88839710c17cc2e5676456a66b46bb8ab64736f6c634300081300334c69624469616d6f6e644375743a2043616e2774207265706c6163652066756ec8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c4c69624469616d6f6e644375743a2041646420666163657420686173206e6f20636f64654c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f64654c69624469616d6f6e644375743a205265706c61636520666163657420686173206e6f20636f64650000000000000000000000000000000000000000000000000000000000000020000000000000000000000000e74a7d49cd02d0f587bb1dba57c0b6114a7f5e960000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e74a7d49cd02d0f587bb1dba57c0b6114a7f5e96000000000000000000000000e74a7d49cd02d0f587bb1dba57c0b6114a7f5e96000000000000000000000000ab2648e957f699ad9fd5f3e9c0734d7a03bd7a3600000000000000000000000000000000000000000000000000000000000001f40000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000011506c6179204d65204d61726b6574696e67000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f504c41594d454d41524b4554494e470000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003e68747470733a2f2f63646e2d6170692e6e696674796b69742e636f6d2f72657665616c2f636c6f70316b736e75303030316a72306674726836756976332f000000000000000000000000000000000000000000000000000000000000000000016f297c61b5c92ef107ffd30cd56affe5a273e841d202d87dff9baf0090116b99

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.