ETH Price: $3,305.34 (+3.27%)

Contract

0x669AAF4217B9fe296ee91FD80E537234d9989029
Transaction Hash
Method
Block
From
To
Withdraw Token179643782024-11-29 15:50:4751 days ago1732895447IN
0x669AAF42...4d9989029
0 ETH0.000021210.318
Withdraw Token179603882024-11-29 11:56:1152 days ago1732881371IN
0x669AAF42...4d9989029
0 ETH0.000006010.156
Withdraw Token179603652024-11-29 11:54:5252 days ago1732881292IN
0x669AAF42...4d9989029
0 ETH0.000010940.164
Withdraw Token179603512024-11-29 11:54:0552 days ago1732881245IN
0x669AAF42...4d9989029
0 ETH0.000010610.159
Withdraw Token179603302024-11-29 11:52:5352 days ago1732881173IN
0x669AAF42...4d9989029
0 ETH0.000011410.171
Withdraw Token179603182024-11-29 11:52:1252 days ago1732881132IN
0x669AAF42...4d9989029
0 ETH0.000011740.176
Withdraw Token179603092024-11-29 11:51:4252 days ago1732881102IN
0x669AAF42...4d9989029
0 ETH0.000012080.181
Withdraw Token179602652024-11-29 11:49:1252 days ago1732880952IN
0x669AAF42...4d9989029
0 ETH0.000012940.194
Withdraw Token179602142024-11-29 11:46:1452 days ago1732880774IN
0x669AAF42...4d9989029
0 ETH0.000014150.212
Withdraw Token179601772024-11-29 11:43:5352 days ago1732880633IN
0x669AAF42...4d9989029
0 ETH0.000011880.178
Withdraw Token179601412024-11-29 11:41:4552 days ago1732880505IN
0x669AAF42...4d9989029
0 ETH0.000012210.183
Withdraw Token179601322024-11-29 11:41:1552 days ago1732880475IN
0x669AAF42...4d9989029
0 ETH0.000011410.171
Withdraw Token179600902024-11-29 11:38:5052 days ago1732880330IN
0x669AAF42...4d9989029
0 ETH0.000006670.173
Withdraw Token179600822024-11-29 11:38:2252 days ago1732880302IN
0x669AAF42...4d9989029
0 ETH0.000009230.186
Withdraw Token179600732024-11-29 11:37:5052 days ago1732880270IN
0x669AAF42...4d9989029
0 ETH0.000011210.168
Withdraw Token179600642024-11-29 11:37:1852 days ago1732880238IN
0x669AAF42...4d9989029
0 ETH0.000009280.187
Withdraw Token179600192024-11-29 11:34:3852 days ago1732880078IN
0x669AAF42...4d9989029
0 ETH0.000011280.169
Withdraw Token179599312024-11-29 11:29:1652 days ago1732879756IN
0x669AAF42...4d9989029
0 ETH0.000008810.132
Withdraw Token179599222024-11-29 11:28:4652 days ago1732879726IN
0x669AAF42...4d9989029
0 ETH0.000009270.139
Withdraw Token179599142024-11-29 11:28:1852 days ago1732879698IN
0x669AAF42...4d9989029
0 ETH0.000009410.141
Withdraw Token179598342024-11-29 11:23:3952 days ago1732879419IN
0x669AAF42...4d9989029
0 ETH0.000007840.158
Withdraw Token179598102024-11-29 11:22:1752 days ago1732879337IN
0x669AAF42...4d9989029
0 ETH0.000005860.152
Withdraw Token179585912024-11-29 10:10:4152 days ago1732875041IN
0x669AAF42...4d9989029
0 ETH0.000009140.137
Withdraw Token179585702024-11-29 10:09:2152 days ago1732874961IN
0x669AAF42...4d9989029
0 ETH0.00000630.127
Withdraw Token179570622024-11-29 8:41:0252 days ago1732869662IN
0x669AAF42...4d9989029
0 ETH0.000006160.0923

Latest 14 internal transactions

Parent Transaction Hash Block From To
179603882024-11-29 11:56:1152 days ago1732881371
0x669AAF42...4d9989029
0.06425899 ETH
179600902024-11-29 11:38:5052 days ago1732880330
0x669AAF42...4d9989029
0.005287 ETH
179598102024-11-29 11:22:1752 days ago1732879337
0x669AAF42...4d9989029
0.0155 ETH
166566782024-10-08 12:01:52104 days ago1728388912
0x669AAF42...4d9989029
0.00264 ETH
166564722024-10-08 11:50:20104 days ago1728388220
0x669AAF42...4d9989029
0.0002 ETH
102763952024-02-27 6:06:32328 days ago1709013992
0x669AAF42...4d9989029
0.002948 ETH
92697422024-01-16 15:09:53369 days ago1705417793
0x669AAF42...4d9989029
0.001 ETH
92356632024-01-14 15:31:24371 days ago1705246284
0x669AAF42...4d9989029
0.0145 ETH
90183932024-01-05 7:16:31381 days ago1704438991
0x669AAF42...4d9989029
0.002 ETH
89826632024-01-03 7:30:20383 days ago1704267020
0x669AAF42...4d9989029
0.002102 ETH
89815512024-01-03 6:25:15383 days ago1704263115
0x669AAF42...4d9989029
0.00051 ETH
86778682023-12-21 15:18:15395 days ago1703171895
0x669AAF42...4d9989029
0.0025 ETH
86006302023-12-16 10:12:19401 days ago1702721539
0x669AAF42...4d9989029
0.001 ETH
85998372023-12-16 9:04:59401 days ago1702717499
0x669AAF42...4d9989029
0.001 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
NumeP2P

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 20000 runs

Other Settings:
default evmVersion
File 1 of 4 : NumeP2P.sol
// SPDX-License-Identifier: GNU GPLv3
pragma solidity 0.8.20;

/******************************************************************************\
* This file is a modification of the diamond-2 implementation by Nick Mudge.
* https://github.com/mudgen/diamond-2-hardhat/blob/main/contracts/Diamond.sol
* Implementation of a diamond. Referred from Nick Mudge's diamond-2 implementation.
/******************************************************************************/

import {LibDiamond} from "./libraries/LibDiamond.sol";
import {AppStorage} from "./libraries/AppStorage.sol";
import {IDiamondCut} from "./interfaces/IDiamondCut.sol";

contract NumeP2P {
    constructor(
        address _contractOwner,
        address _numeOwner,
        address _governorContract,
        address _diamondCutFacet,
        bytes memory _data
    ) payable {
        LibDiamond.setDiamondOwner(_contractOwner);
        AppStorage.configStorage().numeOwner = _numeOwner;
        AppStorage.configStorage().governorContract = _governorContract;

        // Add the diamondCut external function from the diamondCutFacet
        IDiamondCut.FacetCut[] memory cut = new IDiamondCut.FacetCut[](1);
        bytes4[] memory functionSelectors = new bytes4[](1);
        functionSelectors[0] = IDiamondCut.diamondCut.selector;
        cut[0] = IDiamondCut.FacetCut({
            facetAddress: _diamondCutFacet,
            action: IDiamondCut.FacetCutAction.Add,
            functionSelectors: functionSelectors
        });
        LibDiamond.diamondCut(cut, address(0), "");

        (bytes32 _initSettlementsRoot, bytes32 _initNFTCollectionsRoot) = abi
            .decode(_data, (bytes32, bytes32));

        AppStorage.ConfigStorage storage cs = AppStorage.configStorage();

        ++cs.totalTokens;
        cs.supportedTokens[0x1111111111111111111111111111111111111111] = true;
        cs.settlementsRoot = _initSettlementsRoot;
        cs.nftCollectionsRoot = _initNFTCollectionsRoot;
        cs.WITHDRAWAL_STAKE = 0.01 ether;
        cs.WITHDRAWAL_REQUEST_TIMEOUT = 14 days;
        cs.SETTLEMENT_TIMEOUT = 10 minutes;
    }

    // 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]));
        if (facet == address(0)) {
            revert AppStorage.FacetNotExist();
        }
        // 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())
            }
        }
    }
}

File 2 of 4 : IDiamondCut.sol
// SPDX-License-Identifier: GNU GPLv3
pragma solidity 0.8.20;

/******************************************************************************\
* https://github.com/mudgen/diamond-2-hardhat/blob/main/contracts/interfaces/IDiamondCut.sol
* 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 3 of 4 : AppStorage.sol
// SPDX-License-Identifier: GNU GPLv3
pragma solidity 0.8.20;

library AppStorage {
    bytes32 constant CONFIG_STORAGE_POSITION =
        keccak256("nume.protocol.config.storage");

    bytes32 constant USER_STORAGE_POSITION =
        keccak256("nume.protocol.user.storage");

    bytes32 constant QUEUE_STORAGE_POSITION =
        keccak256("nume.protocol.queue.storage");

    bytes32 constant NUME_STORAGE_POSITION =
        keccak256("nume.protocol.request.storage");

    struct ConfigStorage {
        bool isInExodusMode;
        uint256 totalTokens;
        uint256 numeBlockNumber;
        address verificationAddress;
        address numeOwner;
        address governorContract;
        uint256 depositsLimit;
        uint256 nftDepositsLimit;
        uint256 currDepositsQueueIndex;
        uint256 currNFTDepositsQueueIndex;
        uint256 currWithdrawalsQueueIndex;
        uint256 currNFTWithdrawalsQueueIndex;
        uint256 currCancelSubsciptionsQueueIndex;
        uint256 lastFinalizedDepositsQueueIndex;
        uint256 lastFinalizedNFTDepositsQueueIndex;
        uint256 lastFinalizedWithdrawalsQueueIndex;
        uint256 lastFinalizedNFTWithdrawalsQueueIndex;
        uint256 lastFinalizedCancelSubsciptionsQueueIndex;
        uint256 WITHDRAWAL_STAKE;
        uint256 WITHDRAWAL_REQUEST_TIMEOUT;
        uint256 SETTLEMENT_TIMEOUT;
        uint256 LAST_SETTLEMENT_TIMESTAMP;
        bytes32 settlementsRoot;
        bytes32 nftCollectionsRoot;
        mapping(address => bool) supportedTokens;
        mapping(address => uint256) tokenDepositLimit;
        bytes32[] SettlementsRootQueue;
        bytes32[] NftCollectionsRootQueue;
    }

    struct UserStorage {
        mapping(uint256 => address) depositSenderAddress;
        mapping(uint256 => address) nftDepositSenderAddress;
        mapping(uint256 => address) contractWithdrawalSenderAddress;
        mapping(uint256 => address) contractNftWithdrawalSenderAddress;
        mapping(address => uint256) userDepositCount; // userAddress => depositCount
        mapping(address => uint256) userDepositTimestamp; // userAddress => depositTimestamp
        mapping(address => uint256) userNftDepositCount; // userAddress => nft depositCount
        mapping(address => uint256) userNftDepositTimestamp; // userAddress => nft depositTimestamp
        mapping(address => mapping(address => bool)) userExodusWithdrawals; // userAddress => tokenAddress => isWithdrawn
        mapping(address => mapping(bytes32 => bool)) userExodusNFTWithdrawals; // userAddress => keccak256(NFTContractAddress, tokenID) => isWithdrawn
        mapping(address => bool) isAddressBlacklisted; // userAddress => isBlacklisted
        mapping(address => mapping(address => uint256)) userWithdrawalBalance; // userAddress => tokenAddress => withdrawal amount
        mapping(address => bytes[]) userBackendNftWithdrawalRequests; // userAddress => nftWithdrawalRequestHashes
    }

    struct QueueStorage {
        bytes32[] depositsQueue;
        bytes32[] NFTDepositsQueue;
        bytes32[] withdrawalsQueue;
        bytes32[] NFTWithdrawalsQueue;
        bytes32[] cancelSubsciptionsQueue;
    }

    struct NumeStorage {
        mapping(address => mapping(address => bool)) withdrawalRequests; // user adddress => tokenID => isWithdrawalRequested
        mapping(address => mapping(bytes32 => bool)) NFTWithdrawalRequests; // user adddress => keccak256(NFTContractAddress, tokenID) => isWithdrawalRequested
        mapping(uint256 => uint256) withdrawalRequestTimestamps; // withdrawalQueueIndex => timestamp
        mapping(uint256 => uint256) NFTWithdrawalRequestTimestamps; // nft withdrawalQueueIndex => timestamp
        mapping(address => bool) cancelSubscriptionRequests; // userAddress => isCancelRequested
        mapping(uint256 => uint256) cancelSubscriptionRequestTimestamps; // cancel subscription queue index => timestamp
    }

    function configStorage() internal pure returns (ConfigStorage storage cs) {
        bytes32 position = CONFIG_STORAGE_POSITION;
        assembly {
            cs.slot := position
        }
    }

    function queueStorage() internal pure returns (QueueStorage storage qs) {
        bytes32 position = QUEUE_STORAGE_POSITION;
        assembly {
            qs.slot := position
        }
    }

    function userStorage() internal pure returns (UserStorage storage us) {
        bytes32 position = USER_STORAGE_POSITION;
        assembly {
            us.slot := position
        }
    }

    function numeStorage() internal pure returns (NumeStorage storage ns) {
        bytes32 position = NUME_STORAGE_POSITION;
        assembly {
            ns.slot := position
        }
    }

    function enforceIsNumeOwner() internal view {
        require(
            msg.sender == configStorage().numeOwner,
            "Nume: Only Nume owner can call this function"
        );
    }

    function enforceIsGovernor() internal view {
        require(
            msg.sender == configStorage().governorContract,
            "Nume: Only governor contract can call this function"
        );
    }

    function notBlacklisted(address user) internal view {
        require(
            !userStorage().isAddressBlacklisted[user],
            "Nume: User is blacklisted"
        );
    }

    function enforceNotExodusMode() internal view {
        require(
            !configStorage().isInExodusMode,
            "Nume: Protocol is in exodus mode"
        );
    }

    error FacetNotExist();
    error ExceededMaximumDailyCalls(address user);
    error InvalidTokenAddress(address tokenAddress);
    error InvalidAmount();
    error TransactionFailed();
    error NotInExodusMode();
    error AddressBlacklisted(address user);
    error InvalidAddress();
}

File 4 of 4 : LibDiamond.sol
// SPDX-License-Identifier: GNU GPLv3
pragma solidity 0.8.20;

/******************************************************************************\
* 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 diamondOwner;
    }

    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 setDiamondOwner(address _newOwner) internal {
        DiamondStorage storage ds = diamondStorage();
        address previousOwner = ds.diamondOwner;
        ds.diamondOwner = _newOwner;
        emit OwnershipTransferred(previousOwner, _newOwner);
    }

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

    function enforceIsDiamondOwner() internal view {
        require(
            msg.sender == diamondStorage().diamondOwner,
            "LibDiamond: Must be diamond 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
{
  "evmVersion": "paris",
  "viaIR": true,
  "optimizer": {
    "enabled": true,
    "runs": 20000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_contractOwner","type":"address"},{"internalType":"address","name":"_numeOwner","type":"address"},{"internalType":"address","name":"_governorContract","type":"address"},{"internalType":"address","name":"_diamondCutFacet","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"}],"stateMutability":"payable","type":"constructor"},{"inputs":[],"name":"FacetNotExist","type":"error"},{"inputs":[{"internalType":"address","name":"_initializationContractAddress","type":"address"},{"internalType":"bytes","name":"_calldata","type":"bytes"}],"name":"InitializationFunctionReverted","type":"error"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"facetAddress","type":"address"},{"internalType":"enum IDiamondCut.FacetCutAction","name":"action","type":"uint8"},{"internalType":"bytes4[]","name":"functionSelectors","type":"bytes4[]"}],"indexed":false,"internalType":"struct IDiamondCut.FacetCut[]","name":"_diamondCut","type":"tuple[]"},{"indexed":false,"internalType":"address","name":"_init","type":"address"},{"indexed":false,"internalType":"bytes","name":"_calldata","type":"bytes"}],"name":"DiamondCut","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"stateMutability":"payable","type":"fallback"}]

60806040526110558038038061001481610df6565b92833981019060a081830312610c5c5761002d81610e1b565b9161003a60208301610e1b565b9261004760408401610e1b565b9061005460608501610e1b565b94608085015160018060401b0395868211610c5c570184601f82011215610c5c578051868111610d7a57610091601f8201601f1916602001610df6565b9581875260208284010111610c5c576100b09160208088019101610e2f565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c132080546001600160a01b03198082166001600160a01b0395861690811790935593167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a37f98c199a2a06c19b820e4574aca672bc64a3ad70882a41ede5eb53cf6ea310e3b805483166001600160a01b039283161790557f98c199a2a06c19b820e4574aca672bc64a3ad70882a41ede5eb53cf6ea310e3c80549092169216919091179055610180610dd7565b926001845260005b60208110610d905750610199610dd7565b60018152602036818301376307e4c70760e21b6101b582610e52565b526101be610db8565b6001600160a01b0390921682526000602083015260408201526101e084610e52565b526101ea83610e52565b50604051916020830190811183821017610d7a57604052600082526000805160206110158339815191525461ffff811691829360009260078116610d4e575b509160009594939195945b8051861015610a64576102478682610e75565b51519460206102568884610e75565b510151976003891015610a4e57604061026f8985610e75565b510151948094998651156109f5578061042a5750506102d561028f610db8565b602481527f4c69624469616d6f6e644375743a2041646420666163657420686173206e6f20602082015263636f646560e01b60408201526001600160a01b038916610eca565b6000935b855185101561040e576001600160e01b03196102f58688610e75565b5116998a600052600080516020610ff583398151915260205260406000205460601c6103a3578a600052600080516020610ff58339815191526020528160018060601b03198a60601b161760406000205560e090818360051b169b8c1c9063ffffffff60e01b8d1c1916179a1461037a575b610372600191610e89565b9401936102d9565b600381901c6000908152600080516020611035833981519152602052604081209a909a55610367565b60405162461bcd60e51b815260206004820152603560248201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60448201527f6e207468617420616c72656164792065786973747300000000000000000000006064820152608490fd5b9593509350959450956001905b93940194939195929092610234565b6001819b9a989697999b14600014610653575050610493610449610db8565b602881527f4c69624469616d6f6e644375743a205265706c61636520666163657420686173602082015267206e6f20636f646560c01b60408201526001600160a01b038b16610eca565b60005b8751811015610643576001600160e01b03196104b2828a610e75565b51169081600052600080516020610ff58339815191526020526040600020548060601c3081146105e6576001600160a01b038d16811461058d5715610534576000928352600080516020610ff583398151915260205260409092206001600160601b039290921660608c901b6001600160601b03191617909155600101610496565b60405162461bcd60e51b81526020600482015260386024820152600080516020610fd583398151915260448201527f6374696f6e207468617420646f65736e277420657869737400000000000000006064820152608490fd5b60405162461bcd60e51b81526020600482015260386024820152600080516020610fd583398151915260448201527f6374696f6e20776974682073616d652066756e6374696f6e00000000000000006064820152608490fd5b60405162461bcd60e51b815260206004820152602f60248201527f4c69624469616d6f6e644375743a2043616e2774207265706c61636520696d6d60448201526e3aba30b1363290333ab731ba34b7b760891b6064820152608490fd5b509394955095600191975061041b565b600291979996509991949799146000146109a0576001600160a01b0316610935579360078160039594951c9116926000935b89518510156108f057816108db57505061069e90610ebd565b9384600052600080516020611035833981519152602052604060002054936007935b6001600160e01b03196106d3828c610e75565b511680600052600080516020610ff5833981519152602052604060002054908160601c80156108705730146108145763ffffffff60e01b888860051b1b16908082036107db575b6000908152600080516020610ff58339815191526020526040812055600382901c611fff168981146107b95760005260008051602061103583398151915260205260406000209160e083549160051b1691821c9163ffffffff60e01b901c19161790555b8415610794575b60010193959195949094610685565b6000878152600080516020611035833981519152602052604081208190559550610785565b5091969060e09060051b1691821c9163ffffffff60e01b901c1916179461077e565b6000828152600080516020610ff58339815191526020526040902080546001600160601b0319166001600160601b03851617905561071a565b60405162461bcd60e51b815260206004820152602e60248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560448201526d3a30b1363290333ab731ba34b7b760911b6064820152608490fd5b60405162461bcd60e51b815260206004820152603760248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360448201527f74696f6e207468617420646f65736e27742065786973740000000000000000006064820152608490fd5b6108ea90969296959195610ebd565b936106c0565b9192985094969592508160031b918083046008149015171561091f57808201821161091f57600191019361041b565b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b815260206004820152603660248201527f4c69624469616d6f6e644375743a2052656d6f7665206661636574206164647260448201527f657373206d7573742062652061646472657373283029000000000000000000006064820152608490fd5b60405162461bcd60e51b815260206004820152602760248201527f4c69624469616d6f6e644375743a20496e636f727265637420466163657443756044820152663a20b1ba34b7b760c91b6064820152608490fd5b60405162461bcd60e51b815260206004820152602b60248201527f4c69624469616d6f6e644375743a204e6f2073656c6563746f727320696e206660448201526a1858d95d081d1bc818dd5d60aa1b6064820152608490fd5b634e487b7160e01b600052602160045260246000fd5b9186948103610d1e575b60078116610cf9575b505060405191606083016060845282518091526080840190602060808260051b8701019401916000905b828210610c6157877f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb6738880610ae58a8a600060208501528382036040850152610e98565b0390a1604081805181010312610c5c5760406020820151910151907f98c199a2a06c19b820e4574aca672bc64a3ad70882a41ede5eb53cf6ea310e38610b2b8154610e89565b90557311111111111111111111111111111111111111116000527f98c199a2a06c19b820e4574aca672bc64a3ad70882a41ede5eb53cf6ea310e4f6020527fc4fea77a7258efe10f4e56442dbafa2c1778a817d0fc72dd6aa361bd2bdc7ada805460ff191660011790557f98c199a2a06c19b820e4574aca672bc64a3ad70882a41ede5eb53cf6ea310e4d557f98c199a2a06c19b820e4574aca672bc64a3ad70882a41ede5eb53cf6ea310e4e55662386f26fc100007f98c199a2a06c19b820e4574aca672bc64a3ad70882a41ede5eb53cf6ea310e4955621275007f98c199a2a06c19b820e4574aca672bc64a3ad70882a41ede5eb53cf6ea310e4a556102587f98c199a2a06c19b820e4574aca672bc64a3ad70882a41ede5eb53cf6ea310e4b5560405160d99081610efc8239f35b600080fd5b868603607f19018152835180516001600160a01b0316875260208101519496939492939192906003821015610a4e576040916020840152015190606060408201526020608060608301928451809452019201906000905b808210610cd657505050602080600192970192019201909291610aa1565b82516001600160e01b031916845260209384019390920191600190910190610cb8565b60031c6000526000805160206110358339815191526020526040600020558380610a77565b61ffff811661ffff1960008051602061101583398151915254161760008051602061101583398151915255610a6e565b611fff91935060031c166000526000805160206110358339815191526020526040600020549138610229565b634e487b7160e01b600052604160045260246000fd5b602090610d9b610db8565b600081526000838201526060604082015282828801015201610188565b60405190606082016001600160401b03811183821017610d7a57604052565b60408051919082016001600160401b03811183821017610d7a57604052565b6040519190601f01601f191682016001600160401b03811183821017610d7a57604052565b51906001600160a01b0382168203610c5c57565b60005b838110610e425750506000910152565b8181015183820152602001610e32565b805115610e5f5760200190565b634e487b7160e01b600052603260045260246000fd5b8051821015610e5f5760209160051b010190565b600019811461091f5760010190565b90602091610eb181518092818552858086019101610e2f565b601f01601f1916010190565b801561091f576000190190565b3b15610ed35750565b60405162461bcd60e51b815260206004820152908190610ef7906024830190610e98565b0390fdfe608060405260007fffffffff0000000000000000000000000000000000000000000000000000000081351681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c602052604081205460601c8015607957818091368280378136915af43d82803e156075573d90f35b3d90fd5b7fff7b85370000000000000000000000000000000000000000000000000000000060805260046080fdfea264697066735822122013cb652abd98dc6aa5c7a3d1b9c91896eba9df6e8fef013251ee09991fa0130664736f6c634300081400334c69624469616d6f6e644375743a2043616e2774207265706c6163652066756ec8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131cc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131ec8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131d000000000000000000000000a26ba4d73e7809e6167e9d3ffdc713221f12bc6f00000000000000000000000022d5c943d338b9353686c7be33a09a7ce1f7b1d200000000000000000000000022d5c943d338b9353686c7be33a09a7ce1f7b1d2000000000000000000000000f141905bf28b1adff1591ca87df526fec87aaf0300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000404c19df7c7afbbe449e64888580fbe5ef93861f37bd462dc562bb8647795d0588ab27ecb3aa6a96df19effeabd11f846fdf56d54b61e42fe1eff847b2fa88764e

Deployed Bytecode

0x608060405260007fffffffff0000000000000000000000000000000000000000000000000000000081351681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c602052604081205460601c8015607957818091368280378136915af43d82803e156075573d90f35b3d90fd5b7fff7b85370000000000000000000000000000000000000000000000000000000060805260046080fdfea264697066735822122013cb652abd98dc6aa5c7a3d1b9c91896eba9df6e8fef013251ee09991fa0130664736f6c63430008140033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000a26ba4d73e7809e6167e9d3ffdc713221f12bc6f00000000000000000000000022d5c943d338b9353686c7be33a09a7ce1f7b1d200000000000000000000000022d5c943d338b9353686c7be33a09a7ce1f7b1d2000000000000000000000000f141905bf28b1adff1591ca87df526fec87aaf0300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000404c19df7c7afbbe449e64888580fbe5ef93861f37bd462dc562bb8647795d0588ab27ecb3aa6a96df19effeabd11f846fdf56d54b61e42fe1eff847b2fa88764e

-----Decoded View---------------
Arg [0] : _contractOwner (address): 0xA26ba4d73e7809E6167e9D3FfDC713221F12Bc6F
Arg [1] : _numeOwner (address): 0x22d5C943D338B9353686c7BE33a09A7CE1F7b1D2
Arg [2] : _governorContract (address): 0x22d5C943D338B9353686c7BE33a09A7CE1F7b1D2
Arg [3] : _diamondCutFacet (address): 0xF141905bF28b1AdFF1591CA87df526fec87AAf03
Arg [4] : _data (bytes): 0x4c19df7c7afbbe449e64888580fbe5ef93861f37bd462dc562bb8647795d0588ab27ecb3aa6a96df19effeabd11f846fdf56d54b61e42fe1eff847b2fa88764e

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 000000000000000000000000a26ba4d73e7809e6167e9d3ffdc713221f12bc6f
Arg [1] : 00000000000000000000000022d5c943d338b9353686c7be33a09a7ce1f7b1d2
Arg [2] : 00000000000000000000000022d5c943d338b9353686c7be33a09a7ce1f7b1d2
Arg [3] : 000000000000000000000000f141905bf28b1adff1591ca87df526fec87aaf03
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [6] : 4c19df7c7afbbe449e64888580fbe5ef93861f37bd462dc562bb8647795d0588
Arg [7] : ab27ecb3aa6a96df19effeabd11f846fdf56d54b61e42fe1eff847b2fa88764e


Block Transaction Gas Used Reward
view all blocks sequenced

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