ETH Price: $3,864.12 (+4.52%)

Contract

0x341e94069f53234fE6DabeF707aD424830525715
Transaction Hash
Method
Block
From
To
Start Bridge Tok...505418172024-12-05 7:48:5748 secs ago1733384937IN
LI.FI: LiFi Diamond
0.00190587 ETH0.000005910.04525
Start Bridge Tok...505417622024-12-05 7:47:571 min ago1733384877IN
LI.FI: LiFi Diamond
0.0625 ETH0.000006420.04525
0x4630a0d8505417192024-12-05 7:47:122 mins ago1733384832IN
LI.FI: LiFi Diamond
0.000018 ETH0.000009520.04525
0x4630a0d8505416542024-12-05 7:46:003 mins ago1733384760IN
LI.FI: LiFi Diamond
0 ETH0.000037210.046
0x4630a0d8505416062024-12-05 7:45:114 mins ago1733384711IN
LI.FI: LiFi Diamond
0.0026 ETH0.000029120.04525
Swap And Start B...505415252024-12-05 7:43:485 mins ago1733384628IN
LI.FI: LiFi Diamond
0 ETH0.000013960.047
Swap And Start B...505412492024-12-05 7:38:4511 mins ago1733384325IN
LI.FI: LiFi Diamond
0 ETH0.000012010.046
0x4630a0d8505409632024-12-05 7:33:3616 mins ago1733384016IN
LI.FI: LiFi Diamond
0.0118 ETH0.000022670.04525
Start Bridge Tok...505409602024-12-05 7:33:3316 mins ago1733384013IN
LI.FI: LiFi Diamond
0 ETH0.000006940.047
0x4630a0d8505409112024-12-05 7:32:3817 mins ago1733383958IN
LI.FI: LiFi Diamond
0 ETH0.000013320.047
Swap And Start B...505408652024-12-05 7:31:4717 mins ago1733383907IN
LI.FI: LiFi Diamond
0.0005 ETH0.000008680.047
Start Bridge Tok...505408502024-12-05 7:31:3118 mins ago1733383891IN
LI.FI: LiFi Diamond
0.0017 ETH0.000006050.047
0x4630a0d8505408382024-12-05 7:31:1918 mins ago1733383879IN
LI.FI: LiFi Diamond
0 ETH0.000021160.047
Start Bridge Tok...505408372024-12-05 7:31:1818 mins ago1733383878IN
LI.FI: LiFi Diamond
0 ETH0.000007960.052
Swap And Start B...505408172024-12-05 7:30:5818 mins ago1733383858IN
LI.FI: LiFi Diamond
0 ETH0.000023410.04525
0x4630a0d8505407812024-12-05 7:30:2019 mins ago1733383820IN
LI.FI: LiFi Diamond
0 ETH0.000025010.047
Swap And Start B...505406752024-12-05 7:28:3121 mins ago1733383711IN
LI.FI: LiFi Diamond
0 ETH0.000012540.04525
Swap And Start B...505406362024-12-05 7:27:5121 mins ago1733383671IN
LI.FI: LiFi Diamond
0 ETH0.000009660.047
Start Bridge Tok...505405262024-12-05 7:26:0023 mins ago1733383560IN
LI.FI: LiFi Diamond
0.0099304 ETH0.000006510.04525
0x4630a0d8505404832024-12-05 7:25:1124 mins ago1733383511IN
LI.FI: LiFi Diamond
0 ETH0.000087850.06334999
Swap And Start B...505404692024-12-05 7:24:5724 mins ago1733383497IN
LI.FI: LiFi Diamond
0.004 ETH0.000010520.047
Swap And Start B...505403472024-12-05 7:22:4726 mins ago1733383367IN
LI.FI: LiFi Diamond
0 ETH0.00003990.047
Start Bridge Tok...505403232024-12-05 7:22:2327 mins ago1733383343IN
LI.FI: LiFi Diamond
0.013 ETH0.000006060.046
Start Bridge Tok...505401432024-12-05 7:19:1130 mins ago1733383151IN
LI.FI: LiFi Diamond
0.0017 ETH0.000007420.047
Start Bridge Tok...505401292024-12-05 7:18:5630 mins ago1733383136IN
LI.FI: LiFi Diamond
0.15021563 ETH0.000007610.04525
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
505418172024-12-05 7:48:5748 secs ago1733384937
LI.FI: LiFi Diamond
0.00190587 ETH
505418172024-12-05 7:48:5748 secs ago1733384937
LI.FI: LiFi Diamond
0.00190587 ETH
505418172024-12-05 7:48:5748 secs ago1733384937
LI.FI: LiFi Diamond
0.00190587 ETH
505418172024-12-05 7:48:5748 secs ago1733384937
LI.FI: LiFi Diamond
0.00190587 ETH
505417622024-12-05 7:47:571 min ago1733384877
LI.FI: LiFi Diamond
0.0625 ETH
505417622024-12-05 7:47:571 min ago1733384877
LI.FI: LiFi Diamond
0.0625 ETH
505417622024-12-05 7:47:571 min ago1733384877
LI.FI: LiFi Diamond
0.0625 ETH
505417622024-12-05 7:47:571 min ago1733384877
LI.FI: LiFi Diamond
0.0625 ETH
505417192024-12-05 7:47:122 mins ago1733384832
LI.FI: LiFi Diamond
0.000018 ETH
505417192024-12-05 7:47:122 mins ago1733384832
LI.FI: LiFi Diamond
0.000018 ETH
505417192024-12-05 7:47:122 mins ago1733384832
LI.FI: LiFi Diamond
0.000018 ETH
505416062024-12-05 7:45:114 mins ago1733384711
LI.FI: LiFi Diamond
0.0026 ETH
505416062024-12-05 7:45:114 mins ago1733384711
LI.FI: LiFi Diamond
0.0026 ETH
505416062024-12-05 7:45:114 mins ago1733384711
LI.FI: LiFi Diamond
0.0026 ETH
505409632024-12-05 7:33:3616 mins ago1733384016
LI.FI: LiFi Diamond
0.0118 ETH
505409632024-12-05 7:33:3616 mins ago1733384016
LI.FI: LiFi Diamond
0.0118 ETH
505409632024-12-05 7:33:3616 mins ago1733384016
LI.FI: LiFi Diamond
0.0118 ETH
505408652024-12-05 7:31:4717 mins ago1733383907
LI.FI: LiFi Diamond
0.00049875 ETH
505408652024-12-05 7:31:4717 mins ago1733383907
LI.FI: LiFi Diamond
0.00049875 ETH
505408652024-12-05 7:31:4717 mins ago1733383907
LI.FI: LiFi Diamond
0.00049875 ETH
505408652024-12-05 7:31:4717 mins ago1733383907
LI.FI: LiFi Diamond
0.0005 ETH
505408652024-12-05 7:31:4717 mins ago1733383907
LI.FI: LiFi Diamond
0.0005 ETH
505408652024-12-05 7:31:4717 mins ago1733383907
LI.FI: LiFi Diamond
0.0005 ETH
505408502024-12-05 7:31:3118 mins ago1733383891
LI.FI: LiFi Diamond
0.0017 ETH
505408502024-12-05 7:31:3118 mins ago1733383891
LI.FI: LiFi Diamond
0.0017 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
LiFiDiamond

Compiler Version
v0.8.17+commit.8df45f5f

ZkSolc Version
v1.3.5

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
File 1 of 6 : LiFiDiamond.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import { LibDiamond } from "./Libraries/LibDiamond.sol";
import { IDiamondCut } from "./Interfaces/IDiamondCut.sol";
import { LibUtil } from "./Libraries/LibUtil.sol";

/// @title LIFI Diamond
/// @author LI.FI (https://li.fi)
/// @notice Base EIP-2535 Diamond Proxy Contract.
/// @custom:version 1.0.0
contract LiFiDiamond {
    constructor(address _contractOwner, address _diamondCutFacet) payable {
        LibDiamond.setContractOwner(_contractOwner);

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

    // Find facet for function that is called and execute the
    // function if a facet is found and return any value.
    // solhint-disable-next-line no-complex-fallback
    fallback() external payable {
        LibDiamond.DiamondStorage storage ds;
        bytes32 position = LibDiamond.DIAMOND_STORAGE_POSITION;

        // get diamond storage
        // solhint-disable-next-line no-inline-assembly
        assembly {
            ds.slot := position
        }

        // get facet from function selector
        address facet = ds.selectorToFacetAndPosition[msg.sig].facetAddress;

        if (facet == address(0)) {
            revert LibDiamond.FunctionDoesNotExist();
        }

        // Execute external function from facet using delegatecall and return any value.
        // solhint-disable-next-line no-inline-assembly
        assembly {
            // copy function selector and any arguments
            calldatacopy(0, 0, calldatasize())
            // execute function call using the facet
            let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0)
            // get any return value
            returndatacopy(0, 0, returndatasize())
            // return any return value or error back to the caller
            switch result
            case 0 {
                revert(0, returndatasize())
            }
            default {
                return(0, returndatasize())
            }
        }
    }

    // Able to receive ether
    // solhint-disable-next-line no-empty-blocks
    receive() external payable {}
}

File 2 of 6 : GenericErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

error AlreadyInitialized();
error CannotAuthoriseSelf();
error CannotBridgeToSameNetwork();
error ContractCallNotAllowed();
error CumulativeSlippageTooHigh(uint256 minAmount, uint256 receivedAmount);
error ExternalCallFailed();
error InformationMismatch();
error InsufficientBalance(uint256 required, uint256 balance);
error InvalidAmount();
error InvalidCallData();
error InvalidConfig();
error InvalidContract();
error InvalidDestinationChain();
error InvalidFallbackAddress();
error InvalidReceiver();
error InvalidSendingToken();
error NativeAssetNotSupported();
error NativeAssetTransferFailed();
error NoSwapDataProvided();
error NoSwapFromZeroBalance();
error NotAContract();
error NotInitialized();
error NoTransferToNullAddress();
error NullAddrIsNotAnERC20Token();
error NullAddrIsNotAValidSpender();
error OnlyContractOwner();
error RecoveryAddressCannotBeZero();
error ReentrancyError();
error TokenNotSupported();
error UnAuthorized();
error UnsupportedChainId(uint256 chainId);
error WithdrawFailed();
error ZeroAmount();

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

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 : LibBytes.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

library LibBytes {
    // solhint-disable no-inline-assembly

    // LibBytes specific errors
    error SliceOverflow();
    error SliceOutOfBounds();
    error AddressOutOfBounds();

    bytes16 private constant _SYMBOLS = "0123456789abcdef";

    // -------------------------

    function slice(
        bytes memory _bytes,
        uint256 _start,
        uint256 _length
    ) internal pure returns (bytes memory) {
        if (_length + 31 < _length) revert SliceOverflow();
        if (_bytes.length < _start + _length) revert SliceOutOfBounds();

        bytes memory tempBytes;

        assembly {
            switch iszero(_length)
            case 0 {
                // Get a location of some free memory and store it in tempBytes as
                // Solidity does for memory variables.
                tempBytes := mload(0x40)

                // The first word of the slice result is potentially a partial
                // word read from the original array. To read it, we calculate
                // the length of that partial word and start copying that many
                // bytes into the array. The first word we copy will start with
                // data we don't care about, but the last `lengthmod` bytes will
                // land at the beginning of the contents of the new array. When
                // we're done copying, we overwrite the full first word with
                // the actual length of the slice.
                let lengthmod := and(_length, 31)

                // The multiplication in the next line is necessary
                // because when slicing multiples of 32 bytes (lengthmod == 0)
                // the following copy loop was copying the origin's length
                // and then ending prematurely not copying everything it should.
                let mc := add(
                    add(tempBytes, lengthmod),
                    mul(0x20, iszero(lengthmod))
                )
                let end := add(mc, _length)

                for {
                    // The multiplication in the next line has the same exact purpose
                    // as the one above.
                    let cc := add(
                        add(
                            add(_bytes, lengthmod),
                            mul(0x20, iszero(lengthmod))
                        ),
                        _start
                    )
                } lt(mc, end) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    mstore(mc, mload(cc))
                }

                mstore(tempBytes, _length)

                //update free-memory pointer
                //allocating the array padded to 32 bytes like the compiler does now
                mstore(0x40, and(add(mc, 31), not(31)))
            }
            //if we want a zero-length slice let's just return a zero-length array
            default {
                tempBytes := mload(0x40)
                //zero out the 32 bytes slice we are about to return
                //we need to do it because Solidity does not garbage collect
                mstore(tempBytes, 0)

                mstore(0x40, add(tempBytes, 0x20))
            }
        }

        return tempBytes;
    }

    function toAddress(
        bytes memory _bytes,
        uint256 _start
    ) internal pure returns (address) {
        if (_bytes.length < _start + 20) {
            revert AddressOutOfBounds();
        }
        address tempAddress;

        assembly {
            tempAddress := div(
                mload(add(add(_bytes, 0x20), _start)),
                0x1000000000000000000000000
            )
        }

        return tempAddress;
    }

    /// Copied from OpenZeppelin's `Strings.sol` utility library.
    /// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/8335676b0e99944eef6a742e16dcd9ff6e68e609/contracts/utils/Strings.sol
    function toHexString(
        uint256 value,
        uint256 length
    ) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

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

import { IDiamondCut } from "../Interfaces/IDiamondCut.sol";
import { LibUtil } from "../Libraries/LibUtil.sol";
import { OnlyContractOwner } from "../Errors/GenericErrors.sol";

/// Implementation of EIP-2535 Diamond Standard
/// https://eips.ethereum.org/EIPS/eip-2535
library LibDiamond {
    bytes32 internal constant DIAMOND_STORAGE_POSITION =
        keccak256("diamond.standard.diamond.storage");

    // Diamond specific errors
    error IncorrectFacetCutAction();
    error NoSelectorsInFace();
    error FunctionAlreadyExists();
    error FacetAddressIsZero();
    error FacetAddressIsNotZero();
    error FacetContainsNoCode();
    error FunctionDoesNotExist();
    error FunctionIsImmutable();
    error InitZeroButCalldataNotEmpty();
    error CalldataEmptyButInitNotZero();
    error InitReverted();
    // ----------------

    struct FacetAddressAndPosition {
        address facetAddress;
        uint96 functionSelectorPosition; // position in facetFunctionSelectors.functionSelectors array
    }

    struct FacetFunctionSelectors {
        bytes4[] functionSelectors;
        uint256 facetAddressPosition; // position of facetAddress in facetAddresses array
    }

    struct DiamondStorage {
        // maps function selector to the facet address and
        // the position of the selector in the facetFunctionSelectors.selectors array
        mapping(bytes4 => FacetAddressAndPosition) selectorToFacetAndPosition;
        // maps facet addresses to function selectors
        mapping(address => FacetFunctionSelectors) facetFunctionSelectors;
        // facet addresses
        address[] facetAddresses;
        // 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;
        // solhint-disable-next-line no-inline-assembly
        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 {
        if (msg.sender != diamondStorage().contractOwner)
            revert OnlyContractOwner();
    }

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

    // Internal function version of diamondCut
    function diamondCut(
        IDiamondCut.FacetCut[] memory _diamondCut,
        address _init,
        bytes memory _calldata
    ) internal {
        for (uint256 facetIndex; facetIndex < _diamondCut.length; ) {
            IDiamondCut.FacetCutAction action = _diamondCut[facetIndex].action;
            if (action == IDiamondCut.FacetCutAction.Add) {
                addFunctions(
                    _diamondCut[facetIndex].facetAddress,
                    _diamondCut[facetIndex].functionSelectors
                );
            } else if (action == IDiamondCut.FacetCutAction.Replace) {
                replaceFunctions(
                    _diamondCut[facetIndex].facetAddress,
                    _diamondCut[facetIndex].functionSelectors
                );
            } else if (action == IDiamondCut.FacetCutAction.Remove) {
                removeFunctions(
                    _diamondCut[facetIndex].facetAddress,
                    _diamondCut[facetIndex].functionSelectors
                );
            } else {
                revert IncorrectFacetCutAction();
            }
            unchecked {
                ++facetIndex;
            }
        }
        emit DiamondCut(_diamondCut, _init, _calldata);
        initializeDiamondCut(_init, _calldata);
    }

    function addFunctions(
        address _facetAddress,
        bytes4[] memory _functionSelectors
    ) internal {
        if (_functionSelectors.length == 0) {
            revert NoSelectorsInFace();
        }
        DiamondStorage storage ds = diamondStorage();
        if (LibUtil.isZeroAddress(_facetAddress)) {
            revert FacetAddressIsZero();
        }
        uint96 selectorPosition = uint96(
            ds.facetFunctionSelectors[_facetAddress].functionSelectors.length
        );
        // add new facet address if it does not exist
        if (selectorPosition == 0) {
            addFacet(ds, _facetAddress);
        }
        for (
            uint256 selectorIndex;
            selectorIndex < _functionSelectors.length;

        ) {
            bytes4 selector = _functionSelectors[selectorIndex];
            address oldFacetAddress = ds
                .selectorToFacetAndPosition[selector]
                .facetAddress;
            if (!LibUtil.isZeroAddress(oldFacetAddress)) {
                revert FunctionAlreadyExists();
            }
            addFunction(ds, selector, selectorPosition, _facetAddress);
            unchecked {
                ++selectorPosition;
                ++selectorIndex;
            }
        }
    }

    function replaceFunctions(
        address _facetAddress,
        bytes4[] memory _functionSelectors
    ) internal {
        if (_functionSelectors.length == 0) {
            revert NoSelectorsInFace();
        }
        DiamondStorage storage ds = diamondStorage();
        if (LibUtil.isZeroAddress(_facetAddress)) {
            revert FacetAddressIsZero();
        }
        uint96 selectorPosition = uint96(
            ds.facetFunctionSelectors[_facetAddress].functionSelectors.length
        );
        // add new facet address if it does not exist
        if (selectorPosition == 0) {
            addFacet(ds, _facetAddress);
        }
        for (
            uint256 selectorIndex;
            selectorIndex < _functionSelectors.length;

        ) {
            bytes4 selector = _functionSelectors[selectorIndex];
            address oldFacetAddress = ds
                .selectorToFacetAndPosition[selector]
                .facetAddress;
            if (oldFacetAddress == _facetAddress) {
                revert FunctionAlreadyExists();
            }
            removeFunction(ds, oldFacetAddress, selector);
            addFunction(ds, selector, selectorPosition, _facetAddress);
            unchecked {
                ++selectorPosition;
                ++selectorIndex;
            }
        }
    }

    function removeFunctions(
        address _facetAddress,
        bytes4[] memory _functionSelectors
    ) internal {
        if (_functionSelectors.length == 0) {
            revert NoSelectorsInFace();
        }
        DiamondStorage storage ds = diamondStorage();
        // if function does not exist then do nothing and return
        if (!LibUtil.isZeroAddress(_facetAddress)) {
            revert FacetAddressIsNotZero();
        }
        for (
            uint256 selectorIndex;
            selectorIndex < _functionSelectors.length;

        ) {
            bytes4 selector = _functionSelectors[selectorIndex];
            address oldFacetAddress = ds
                .selectorToFacetAndPosition[selector]
                .facetAddress;
            removeFunction(ds, oldFacetAddress, selector);
            unchecked {
                ++selectorIndex;
            }
        }
    }

    function addFacet(
        DiamondStorage storage ds,
        address _facetAddress
    ) internal {
        enforceHasContractCode(_facetAddress);
        ds.facetFunctionSelectors[_facetAddress].facetAddressPosition = ds
            .facetAddresses
            .length;
        ds.facetAddresses.push(_facetAddress);
    }

    function addFunction(
        DiamondStorage storage ds,
        bytes4 _selector,
        uint96 _selectorPosition,
        address _facetAddress
    ) internal {
        ds
            .selectorToFacetAndPosition[_selector]
            .functionSelectorPosition = _selectorPosition;
        ds.facetFunctionSelectors[_facetAddress].functionSelectors.push(
            _selector
        );
        ds.selectorToFacetAndPosition[_selector].facetAddress = _facetAddress;
    }

    function removeFunction(
        DiamondStorage storage ds,
        address _facetAddress,
        bytes4 _selector
    ) internal {
        if (LibUtil.isZeroAddress(_facetAddress)) {
            revert FunctionDoesNotExist();
        }
        // an immutable function is a function defined directly in a diamond
        if (_facetAddress == address(this)) {
            revert FunctionIsImmutable();
        }
        // replace selector with last selector, then delete last selector
        uint256 selectorPosition = ds
            .selectorToFacetAndPosition[_selector]
            .functionSelectorPosition;
        uint256 lastSelectorPosition = ds
            .facetFunctionSelectors[_facetAddress]
            .functionSelectors
            .length - 1;
        // if not the same then replace _selector with lastSelector
        if (selectorPosition != lastSelectorPosition) {
            bytes4 lastSelector = ds
                .facetFunctionSelectors[_facetAddress]
                .functionSelectors[lastSelectorPosition];
            ds.facetFunctionSelectors[_facetAddress].functionSelectors[
                selectorPosition
            ] = lastSelector;
            ds
                .selectorToFacetAndPosition[lastSelector]
                .functionSelectorPosition = uint96(selectorPosition);
        }
        // delete the last selector
        ds.facetFunctionSelectors[_facetAddress].functionSelectors.pop();
        delete ds.selectorToFacetAndPosition[_selector];

        // if no more selectors for facet address then delete the facet address
        if (lastSelectorPosition == 0) {
            // replace facet address with last facet address and delete last facet address
            uint256 lastFacetAddressPosition = ds.facetAddresses.length - 1;
            uint256 facetAddressPosition = ds
                .facetFunctionSelectors[_facetAddress]
                .facetAddressPosition;
            if (facetAddressPosition != lastFacetAddressPosition) {
                address lastFacetAddress = ds.facetAddresses[
                    lastFacetAddressPosition
                ];
                ds.facetAddresses[facetAddressPosition] = lastFacetAddress;
                ds
                    .facetFunctionSelectors[lastFacetAddress]
                    .facetAddressPosition = facetAddressPosition;
            }
            ds.facetAddresses.pop();
            delete ds
                .facetFunctionSelectors[_facetAddress]
                .facetAddressPosition;
        }
    }

    function initializeDiamondCut(
        address _init,
        bytes memory _calldata
    ) internal {
        if (LibUtil.isZeroAddress(_init)) {
            if (_calldata.length != 0) {
                revert InitZeroButCalldataNotEmpty();
            }
        } else {
            if (_calldata.length == 0) {
                revert CalldataEmptyButInitNotZero();
            }
            if (_init != address(this)) {
                enforceHasContractCode(_init);
            }
            // solhint-disable-next-line avoid-low-level-calls
            (bool success, bytes memory error) = _init.delegatecall(_calldata);
            if (!success) {
                if (error.length > 0) {
                    // bubble up the error
                    revert(string(error));
                } else {
                    revert InitReverted();
                }
            }
        }
    }

    function enforceHasContractCode(address _contract) internal view {
        uint256 contractSize;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            contractSize := extcodesize(_contract)
        }
        if (contractSize == 0) {
            revert FacetContainsNoCode();
        }
    }
}

File 6 of 6 : LibUtil.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "./LibBytes.sol";

library LibUtil {
    using LibBytes for bytes;

    function getRevertMsg(
        bytes memory _res
    ) internal pure returns (string memory) {
        // If the _res length is less than 68, then the transaction failed silently (without a revert message)
        if (_res.length < 68) return "Transaction reverted silently";
        bytes memory revertData = _res.slice(4, _res.length - 4); // Remove the selector which is the first 4 bytes
        return abi.decode(revertData, (string)); // All that remains is the revert string
    }

    /// @notice Determines whether the given address is the zero address
    /// @param addr The address to verify
    /// @return Boolean indicating if the address is the zero address
    function isZeroAddress(address addr) internal pure returns (bool) {
        return addr == address(0);
    }
}

Settings
{
  "compilerPath": "",
  "experimental": {},
  "optimizer": {
    "enabled": true,
    "mode": "3"
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_contractOwner","type":"address"},{"internalType":"address","name":"_diamondCutFacet","type":"address"}],"stateMutability":"payable","type":"constructor"},{"inputs":[],"name":"CalldataEmptyButInitNotZero","type":"error"},{"inputs":[],"name":"FacetAddressIsNotZero","type":"error"},{"inputs":[],"name":"FacetAddressIsZero","type":"error"},{"inputs":[],"name":"FacetContainsNoCode","type":"error"},{"inputs":[],"name":"FunctionAlreadyExists","type":"error"},{"inputs":[],"name":"FunctionDoesNotExist","type":"error"},{"inputs":[],"name":"FunctionIsImmutable","type":"error"},{"inputs":[],"name":"IncorrectFacetCutAction","type":"error"},{"inputs":[],"name":"InitReverted","type":"error"},{"inputs":[],"name":"InitZeroButCalldataNotEmpty","type":"error"},{"inputs":[],"name":"NoSelectorsInFace","type":"error"},{"stateMutability":"payable","type":"fallback"},{"stateMutability":"payable","type":"receive"}]

9c4d535b00000000000000000000000000000000000000000000000000000000000000000100013df2ddab209bd985a3b2f09e94599018f581c6d9c0f6bd89dae0c58d6e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004000000000000000000000000011f11121df7256c40339393b0fb045321022ce44000000000000000000000000dc954dab5dbd1ac8d0d6e2dc600632dc84b1a840

Deployed Bytecode

0x0004000000000002000c000000000002000000000301001900000060043002700000011d03400197000300000031035500020000000103550000011d0040019d000100000000001f0000000101200190000000130000c13d0000008001000039000000400010043f0000000001000032000000860000c13d000000000100001900000000020000190000000003000019046e02b30000040f0000009f013000390000011e01100197000000400010043f0000001f0130018f00000002020003670000000504300272000000230000613d00000000050000190000000506500210000000000762034f000000000707043b000000800660003900000000007604350000000105500039000000000645004b0000001b0000413d000000000510004c000000320000613d0000000504400210000000000242034f00000003011002100000008004400039000000000504043300000000051501cf000000000515022f000000000202043b0000010001100089000000000212022f00000000011201cf000000000151019f00000000001404350000003f0130008c0000024b0000a13d000000800600043d0000011f0160009c0000024b0000213d000000a00700043d0000011f0170009c0000024b0000213d0000012001000041000000000201041a0000012103200197000000000363019f000000000031041b0000011d0100004100000000030004140000011d0430009c0000000001034019000000c00110021000000122011001c70000011f052001970000800d0200003900000003030000390000012304000041000c00000007001d046e045f0000040f0000000c0800002900000001012001900000024b0000613d000000400700043d000001240170009c0000007f0000813d0000004001700039000000400010043f00000001020000390000000000270435000000400100043d000001250310009c0000007f0000213d000000200b7000390000006003100039000000400030043f00000040031000390000006004000039000300000004001d000000000043043500000020031000390000000000030435000000000001043500000000001b0435000000400100043d000001260310009c0000007f0000213d0000004003100039000000400030043f0000000000210435000000200210003900000000030000310000000203300367000000000400001900000005054002100000000006520019000000000553034f000000000505043b0000000000560435000000010440003a0000000005000019000000010500603900000001055001900000006d0000c13d0000000003010433000000000330004c000001080000613d00000127030000410000000000320435000000400200043d000001250320009c000000fa0000a13d000001340100004100000000001004350000004101000039000000040010043f00000024020000390000000001000019046e02bb0000040f0000000201000367000000000101043b0000012c0110019700000000001004350000012e01000041000000200010043f00000040020000390000000001000019046e028d0000040f000000000101041a0000011f02100198000000970000c13d0000013501000041000000800010043f00000080010000390000000402000039046e02bb0000040f000000020100036700000000030000310000001f0430018f0000000503300272000000a40000613d00000000050000190000000506500210000000000761034f000000000707043b00000000007604350000000105500039000000000635004b0000009d0000413d000000000540004c000000b20000613d00000003044002100000000503300210000000000503043300000000054501cf000000000545022f000000000131034f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f00000000001304350000000001000414000000040320008c000000d10000c13d000000030100036700000001020000310000001f0320018f0000000502200272000000c20000613d00000000040000190000000505400210000000000651034f000000000606043b00000000006504350000000104400039000000000524004b000000bb0000413d000000000430004c000000f60000613d00000003033002100000000502200210000000000402043300000000043401cf000000000434022f000000000121034f000000000101043b0000010003300089000000000131022f00000000013101cf000000000141019f0000000000120435000000f60000013d0000000004000031000000000300001900000000050000190000000006000019046e02580000040f000000030200036700000001030000310000001f0430018f0000000503300272000000e30000613d00000000050000190000000506500210000000000762034f000000000707043b00000000007604350000000105500039000000000635004b000000dc0000413d000000000540004c000000f10000613d00000003044002100000000503300210000000000503043300000000054501cf000000000545022f000000000232034f000000000202043b0000010004400089000000000242022f00000000024201cf000000000252019f0000000000230435000000000110004c000000f60000c13d00000001020000310000000001000019046e02bb0000040f000000010200003100000000010000190000000003000019046e02b30000040f0000006003200039000000400030043f000000400320003900000000001304350000000000820435000000200120003900000000000104350000000001070433000000000110004c000001080000613d00000000002b04350000000001070433000000000110004c0000010f0000c13d000001340100004100000000001004350000003201000039000000040010043f00000024020000390000000001000019046e02bb0000040f000000400200043d000001280120009c0000007f0000213d0000002001200039000000400010043f000100000002001d00000000000204350000004001000039000200000001001d000000000400001900050000000b001d000400000007001d0000000001070433000000000114004b000001d10000813d00000005014002100000000001b10019000000000101043300000020021000390000000003020433000000030230008c000002020000813d000000000230004c0000004002100039000600000004001d000001690000613d000000010330008c000001a30000c13d00000000010104330000011f031001970000000001020433000800000001001d0000000001010433000000000110004c000002090000613d000000000130004c0000020e0000613d000a00000003001d00000000003004350000012f01000041000000200010043f00000040020000390000000001000019046e028d0000040f000000000101041a0000013002100198000001420000c13d0000000a01000029000c00000002001d046e02d80000040f0000000c0200002900000008010000290000002001100039000700000001001d000000000300001900000008010000290000000001010433000000000113004b000001c70000813d000c00000002001d000900000003001d00000005013002100000000702000029000000000112001900000000010104330000012c01100197000b00000001001d00000000001004350000012e01000041000000200010043f00000040020000390000000001000019046e028d0000040f000000000101041a0000011f011001970000000a02000029000000000221004b000001cc0000613d0000000b02000029046e036e0000040f0000000b010000290000000c020000290000000a03000029046e03280000040f000000090300002900000001033000390000000c0100002900000001011000390000013002100197000001460000013d00000000010104330000011f031001970000000001020433000900000001001d0000000001010433000000000110004c000002090000613d000000000130004c0000020e0000613d000800000003001d00000000003004350000012f01000041000000200010043f00000000010000190000000202000029046e028d0000040f000000000101041a0000013001100198000c00000001001d0000017f0000c13d0000000801000029046e02d80000040f00000009010000290000002001100039000700000001001d000000000200001900000009010000290000000001010433000000000112004b000001c70000813d000b00000002001d00000005012002100000000702000029000000000112001900000000010104330000012c01100197000a00000001001d00000000001004350000012e01000041000000200010043f00000040020000390000000001000019046e028d0000040f000000000101041a0000011f01100198000001cc0000c13d0000000a010000290000000c02000029000c00000002001d0000000803000029046e03280000040f0000000b0200002900000001022000390000000c0100002900000001011000390000013001100197000c00000001001d000001830000013d0000000002020433000a00000002001d0000000002020433000000000320004c000002090000613d00000000010104330000011f011001980000024e0000c13d0000000a010000290000002001100039000900000001001d0000000003000019000000000123004b000001c70000813d00000005013002100000000902000029000000000112001900000000010104330000012c01100197000b00000001001d00000000001004350000012e01000041000000200010043f00000040020000390000000001000019000c00000003001d046e028d0000040f000000000101041a0000011f011001970000000b02000029046e036e0000040f0000000c0300002900000001033000390000000a010000290000000002010433000001af0000013d00000006040000290000000104400039000000050b00002900000004070000290000011b0000013d000000400100043d000001310200004100000000002104350000000402000039046e02bb0000040f000000400100043d00000003020000290000000000210435000000000307043300000060021000390000000000320435000000800200008a00000000041200490000008005100039000000050230021000000000025200190000000006000019000000000736004b0000002007200039000002130000813d0000000008240019000000000085043500000000080b043300000000090804330000011f09900197000000000092043500000020098000390000000009090433000000020a90008c000002020000213d00000000009704350000004007800039000000000707043300000040082000390000000309000029000000000098043500000060092000390000000008070433000000000089043500000080022000390000000009000019000000000a89004b000001fe0000813d0000002007700039000000000a0704330000012c0aa001970000000000a2043500000001099000390000002002200039000001f50000013d00000001066000390000002005500039000000200bb00039000001dd0000013d000001340100004100000000001004350000002101000039000000040010043f00000024020000390000000001000019046e02bb0000040f000000400100043d000001330200004100000000002104350000000402000039046e02bb0000040f000000400100043d000001320200004100000000002104350000000402000039046e02bb0000040f00000000031200490000004004100039000000000034043500000020031000390000000000030435000000010800002900000000030804330000000005020019000000000603001900000000040000190000000000650435000000000534004b000002250000813d00000020044000390000000005240019000000000684001900000000060604330000021d0000013d0000001f02300039000000200400008a000000000242016f00000000037300190000000000030435000000000317004900000000022300190000011d030000410000011d0420009c000000000203801900000060022002100000011d0410009c00000000010380190000004001100210000000000112019f00000000020004140000011d0420009c0000000002038019000000c002200210000000000112019f00000122011001c70000800d0200003900000001030000390000012904000041046e045f0000040f00000001012001900000024b0000613d00000001010000290000000001010433000000000110004c000002530000c13d000000200100003900000100001004430000012000000443000001000100003900000040020000390000012b03000041046e02b30000040f00000000010000190000000002000019046e02bb0000040f000000400100043d0000012d0200004100000000002104350000000402000039046e02bb0000040f000000400100043d0000012a0200004100000000002104350000000402000039046e02bb0000040f0002000000000002000200000006001d000100000005001d0000011d050000410000011d0610009c0000000001058019000000c001100210000000600440021000000000011400190000011d0430009c00000000030580190000004003300210000000000131019f046e04690000040f0000000109000029000000000301001900000060033002700000011d033001970000000205000029000000000453004b00000000050340190000001f0450018f0000000505500272000002790000613d000000000600001900000005076002100000000008790019000000000771034f000000000707043b00000000007804350000000106600039000000000756004b000002710000413d000000010220018f000000000640004c000002890000613d0000000505500210000000000651034f00000000055900190000000304400210000000000705043300000000074701cf000000000747022f000000000606043b0000010004400089000000000646022f00000000044601cf000000000474019f0000000000450435000100000003001f00030000000103550000000001020019000000000001042d0000011d030000410000011d0410009c000000000103801900000040011002100000011d0420009c00000000020380190000006002200210000000000112019f00000000020004140000011d0420009c0000000002038019000000c002200210000000000112019f00000122011001c70000801002000039046e04640000040f0000000102200190000002a10000613d000000000101043b000000000001042d00000000010000190000000002000019046e02bb0000040f0000011d0100004100000000020004140000011d0320009c0000000001024019000000c00110021000000136011001c70000800202000039046e04640000040f0000000102200190000002b00000613d000000000101043b000000000001042d00000000010000190000000002000019046e02bb0000040f0000011d040000410000011d0510009c000000000104801900000040011002100000006002200210000000000121019f00000000013100190000046f0001042e0000011d030000410000011d0410009c000000000103801900000040011002100000006002200210000000000121019f000004700001043000010000000000020000013702000041000000000202041a000100000001001d000000000112004b000002d10000a13d0000013701000041000000000010043500000020020000390000000001000019046e028d0000040f000000010200002900000000012100190000000002000019000000000001042d000001340100004100000000001004350000003201000039000000040010043f00000024020000390000000001000019046e02bb0000040f000200000000000200000138020000410000000000200439000200000001001d0000000400100443046e02a40000040f000000000110004c000003060000613d0000013701000041000000000101041a000100000001001d00000002010000290000011f01100197000200000001001d00000000001004350000012f01000041000000200010043f00000040020000390000000001000019046e028d0000040f00000001030000290000000101100039000000000031041b000001390130009c0000030b0000813d00000001013000390000013702000041000000000012041b0000000001030019046e02c20000040f00000003022002100000011f0300004100000000032301cf000000ff0420008c0000000003002019000000020400002900000000022401cf0000000002002019000000000232016f000000010400008a000000000343013f000000000401041a000000000334016f000000000223019f000000000021041b000000000001042d000000400100043d0000013a0200004100000000002104350000000402000039046e02bb0000040f000001340100004100000000001004350000004101000039000000040010043f00000024020000390000000001000019046e02bb0000040f0001000000000002000000000301041a000100000002001d000000000223004b000003210000a13d000000000010043500000020020000390000000001000019046e028d0000040f00000001030000290000000302300270000000000121001900000002023002100000001c0220018f000000000001042d000001340100004100000000001004350000003201000039000000040010043f00000024020000390000000001000019046e02bb0000040f0005000000000002000500000003001d000300000002001d000100000001001d0000012c01100197000200000001001d00000000001004350000012e01000041000000200010043f0000004002000039000400000002001d0000000001000019046e028d0000040f0000000302000029000000a002200210000000000301041a0000011f03300197000000000223019f000000000021041b00000005010000290000011f01100197000500000001001d00000000001004350000012f01000041000000200010043f00000000010000190000000402000029046e028d0000040f000000000201041a000001390320009c000003670000813d0000000103200039000000000031041b046e03120000040f00000003022002100000011d0300004100000000032301cf0000000104000029000000e004400270000000ff0520008c000000000300201900000000022401cf0000000002002019000000000232016f000000010400008a000000000343013f000000000401041a000000000334016f000000000223019f000000000021041b000000020100002900000000001004350000012e01000041000000200010043f00000040020000390000000001000019046e028d0000040f000000000201041a00000121022001970000000503000029000000000232019f000000000021041b000000000001042d000001340100004100000000001004350000004101000039000000040010043f00000024020000390000000001000019046e02bb0000040f00070000000000020000011f03100198000004550000613d0000000001000410000000000113004b000700000003001d0000045a0000613d0000012c01200197000400000001001d00000000001004350000012e01000041000000200010043f0000004002000039000500000002001d0000000001000019046e028d0000040f000000000101041a000600000001001d000000070100002900000000001004350000012f01000041000000200010043f00000000010000190000000502000029046e028d0000040f000000000101041a000000000210004c000004470000613d0000000603000029000000a002300270000000010110008a000500000001001d000000000112004b000003c80000613d000300000002001d000000070100002900000000001004350000012f01000041000000200010043f00000040020000390000000001000019046e028d0000040f0000000502000029046e03120000040f0000000302200210000000ff0320008c0000000003000019000003a10000213d000000000101041a000000000121022f000000e003100210000100000003001d000000070100002900000000001004350000012f01000041000000200010043f0000004002000039000200000002001d0000000001000019046e028d0000040f0000000302000029046e03120000040f0000011d03000041000000030220021000000000032301cf000000ff0420008c00000000030020190000000105000029000000e00450027000000000022401cf0000000002002019000000000232016f000000010400008a000000000343013f000000000401041a000000000334016f000000000223019f000000000021041b00000000005004350000012e01000041000000200010043f00000000010000190000000202000029046e028d0000040f00000006020000290000012102200197000000000301041a0000011f03300197000000000223019f000000000021041b000000070100002900000000001004350000012f01000041000000200010043f00000040020000390000000001000019046e028d0000040f000000000301041a000000000230004c0000044e0000613d000000010230008a000600000002001d000300000001001d046e03120000040f00000003022002100000011d0300004100000000032301cf000000010400008a000000000343013f000000ff0220008c000200000004001d00000000020300190000000002042019000000000301041a000000000232016f000000000021041b00000006010000290000000302000029000000000012041b000000040100002900000000001004350000012e01000041000000200010043f00000040020000390000000001000019046e028d0000040f000000000001041b0000000501000029000000000110004c000004460000c13d00000002010000290000013701000041000000000101041a000000000210004c000004470000613d000000010110008a000500000001001d000000070100002900000000001004350000012f01000041000000200010043f00000040020000390000000001000019046e028d0000040f00000005020000290000000101100039000000000101041a000600000001001d000000000121004b000004280000613d0000000001020019046e02c20000040f0000000302200210000000ff0320008c00000000030000190000040d0000213d000000000101041a000000000121022f0000011f03100197000500000003001d0000000601000029046e02c20000040f00000003022002100000011f0300004100000000032301cf000000ff0420008c0000000003002019000000050500002900000000022501cf0000000002002019000000000232016f0000000204000029000000000343013f000000000401041a000000000334016f000000000223019f000000000021041b00000000005004350000012f01000041000000200010043f00000040020000390000000001000019046e028d0000040f00000001011000390000000602000029000000000021041b0000013701000041000000000101041a000000000210004c0000044e0000613d000000010110008a000600000001001d046e02c20000040f00000003022002100000011f0300004100000000032301cf0000000204000029000000000343013f000000ff0220008c00000000020300190000000002042019000000000301041a000000000232016f000000000021041b00000137010000410000000602000029000000000021041b000000070100002900000000001004350000012f01000041000000200010043f00000040020000390000000001000019046e028d0000040f0000000101100039000000000001041b000000000001042d000001340100004100000000001004350000001101000039000000040010043f00000024020000390000000001000019046e02bb0000040f000001340100004100000000001004350000003101000039000000040010043f00000024020000390000000001000019046e02bb0000040f000000400100043d000001350200004100000000002104350000000402000039046e02bb0000040f000000400100043d0000013b0200004100000000002104350000000402000039046e02bb0000040f00000462002104210000000102000039000000000001042d0000000002000019000004610000013d00000467002104230000000102000039000000000001042d0000000002000019000004660000013d0000046c002104250000000102000039000000000001042d00000000020000190000046b0000013d0000046e000004320000046f0001042e000004700001043000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff00000000000000000000000000000000000000000000000000000001ffffffe0000000000000000000000000ffffffffffffffffffffffffffffffffffffffffc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c1320ffffffffffffffffffffffff000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000008be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0000000000000000000000000000000000000000000000000ffffffffffffffc0000000000000000000000000000000000000000000000000ffffffffffffff9f000000000000000000000000000000000000000000000000ffffffffffffffbf1f931c1c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffdf8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb67398116860000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000ffffffff0000000000000000000000000000000000000000000000000000000079c9df2200000000000000000000000000000000000000000000000000000000c8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131cc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131d0000000000000000000000000000000000000000ffffffffffffffffffffffffa023275d00000000000000000000000000000000000000000000000000000000c68ec83a000000000000000000000000000000000000000000000000000000007bc55950000000000000000000000000000000000000000000000000000000004e487b7100000000000000000000000000000000000000000000000000000000a9ad62f8000000000000000000000000000000000000000000000000000000000200000200000000000000000000000000000024000000000000000000000000c8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131e1806aa1896bbf26568e884a7374b41e002500962caba6a15023a8d90e8508b830000000000000000000000000000000000000000000000010000000000000000e350060000000000000000000000000000000000000000000000000000000000c3c5ec37000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

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

0x00000000000000000000000011f11121df7256c40339393b0fb045321022ce44000000000000000000000000dc954dab5dbd1ac8d0d6e2dc600632dc84b1a840

-----Decoded View---------------
Arg [0] : _contractOwner (address): 0x11F11121DF7256C40339393b0FB045321022ce44
Arg [1] : _diamondCutFacet (address): 0xDC954dab5dBD1Ac8d0D6e2DC600632dc84B1a840

-----Encoded View---------------


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