ETH Price: $3,265.12 (-0.51%)
Gas: 3 Gwei

Contract

0x6eF81a18E1E432C289DC0d1a670B78E8bbF9AA35
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Start Bridge Tok...185715312023-11-14 17:07:23256 days ago1699981643IN
0x6eF81a18...8bbF9AA35
0.001 ETH0.0054760551.40486402
Set Approval For...177844702023-07-27 12:42:47367 days ago1690461767IN
0x6eF81a18...8bbF9AA35
0 ETH0.0103906825.36391648

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
204056522024-07-28 14:29:471 hr ago1722176987
0x6eF81a18...8bbF9AA35
0 ETH
204056522024-07-28 14:29:471 hr ago1722176987
0x6eF81a18...8bbF9AA35
0 ETH
204056522024-07-28 14:29:471 hr ago1722176987
0x6eF81a18...8bbF9AA35
0 ETH
204054232024-07-28 13:43:591 hr ago1722174239
0x6eF81a18...8bbF9AA35
0.63539125 ETH
204054232024-07-28 13:43:591 hr ago1722174239
0x6eF81a18...8bbF9AA35
0.63539125 ETH
204036252024-07-28 7:42:597 hrs ago1722152579
0x6eF81a18...8bbF9AA35
0.03965 ETH
204036252024-07-28 7:42:597 hrs ago1722152579
0x6eF81a18...8bbF9AA35
0.03965 ETH
204009962024-07-27 22:53:5916 hrs ago1722120839
0x6eF81a18...8bbF9AA35
0.02676375 ETH
204009962024-07-27 22:53:5916 hrs ago1722120839
0x6eF81a18...8bbF9AA35
0.02676375 ETH
203999892024-07-27 19:31:3520 hrs ago1722108695
0x6eF81a18...8bbF9AA35
0.1685125 ETH
203999892024-07-27 19:31:3520 hrs ago1722108695
0x6eF81a18...8bbF9AA35
0.1685125 ETH
203998182024-07-27 18:57:2320 hrs ago1722106643
0x6eF81a18...8bbF9AA35
0 ETH
203998182024-07-27 18:57:2320 hrs ago1722106643
0x6eF81a18...8bbF9AA35
0 ETH
203998182024-07-27 18:57:2320 hrs ago1722106643
0x6eF81a18...8bbF9AA35
0 ETH
203971132024-07-27 9:53:5929 hrs ago1722074039
0x6eF81a18...8bbF9AA35
0 ETH
203971132024-07-27 9:53:5929 hrs ago1722074039
0x6eF81a18...8bbF9AA35
0 ETH
203971132024-07-27 9:53:5929 hrs ago1722074039
0x6eF81a18...8bbF9AA35
0 ETH
203959172024-07-27 5:53:3533 hrs ago1722059615
0x6eF81a18...8bbF9AA35
5.9475 ETH
203959172024-07-27 5:53:3533 hrs ago1722059615
0x6eF81a18...8bbF9AA35
5.9475 ETH
203953182024-07-27 3:52:2335 hrs ago1722052343
0x6eF81a18...8bbF9AA35
0 ETH
203953182024-07-27 3:52:2335 hrs ago1722052343
0x6eF81a18...8bbF9AA35
0 ETH
203953182024-07-27 3:52:2335 hrs ago1722052343
0x6eF81a18...8bbF9AA35
0 ETH
203939882024-07-26 23:24:5940 hrs ago1722036299
0x6eF81a18...8bbF9AA35
0.99125 ETH
203939882024-07-26 23:24:5940 hrs ago1722036299
0x6eF81a18...8bbF9AA35
0.99125 ETH
203939062024-07-26 23:08:1140 hrs ago1722035291
0x6eF81a18...8bbF9AA35
0 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
HopFacetPacked

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion
File 1 of 22 : HopFacetPacked.sol
// // SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import { IHopBridge, IL2AmmWrapper, ISwap } from "../Interfaces/IHopBridge.sol";
import { ILiFi } from "../Interfaces/ILiFi.sol";
import { ERC20, SafeTransferLib } from "solmate/utils/SafeTransferLib.sol";
import { LibAsset, IERC20 } from "../Libraries/LibAsset.sol";
import { TransferrableOwnership } from "../Helpers/TransferrableOwnership.sol";
import { HopFacetOptimized } from "lifi/Facets/HopFacetOptimized.sol";
import { WETH } from "solmate/tokens/WETH.sol";

/// @title Hop Facet (Optimized for Rollups)
/// @author LI.FI (https://li.fi)
/// @notice Provides functionality for bridging through Hop
/// @custom:version 1.0.6
contract HopFacetPacked is ILiFi, TransferrableOwnership {
    using SafeTransferLib for ERC20;

    /// Storage ///

    address public immutable nativeBridge;
    address public immutable nativeL2CanonicalToken;
    address public immutable nativeHToken;
    address public immutable nativeExchangeAddress;

    /// Errors ///

    error Invalid();

    /// Events ///

    event LiFiHopTransfer(bytes8 _transactionId);

    /// Constructor ///

    /// @notice Initialize the contract.
    /// @param _owner The contract owner to approve tokens.
    /// @param _wrapper The address of Hop L2_AmmWrapper for native asset.
    constructor(
        address _owner,
        address _wrapper
    ) TransferrableOwnership(_owner) {
        bool wrapperIsSet = _wrapper != address(0);

        if (block.chainid == 1 && wrapperIsSet) {
            revert Invalid();
        }

        nativeL2CanonicalToken = wrapperIsSet
            ? IL2AmmWrapper(_wrapper).l2CanonicalToken()
            : address(0);
        nativeHToken = wrapperIsSet
            ? IL2AmmWrapper(_wrapper).hToken()
            : address(0);
        nativeExchangeAddress = wrapperIsSet
            ? IL2AmmWrapper(_wrapper).exchangeAddress()
            : address(0);
        nativeBridge = wrapperIsSet
            ? IL2AmmWrapper(_wrapper).bridge()
            : address(0);
    }

    /// External Methods ///

    /// @dev Only meant to be called outside of the context of the diamond
    /// @notice Sets approval for the Hop Bridge to spend the specified token
    /// @param bridges The Hop Bridges to approve
    /// @param tokensToApprove The tokens to approve to approve to the Hop Bridges
    function setApprovalForHopBridges(
        address[] calldata bridges,
        address[] calldata tokensToApprove
    ) external onlyOwner {
        uint256 numBridges = bridges.length;

        for (uint256 i; i < numBridges; i++) {
            // Give Hop approval to bridge tokens
            LibAsset.maxApproveERC20(
                IERC20(tokensToApprove[i]),
                address(bridges[i]),
                type(uint256).max
            );
        }
    }

    /// @notice Bridges Native tokens via Hop Protocol from L2
    /// No params, all data will be extracted from manually encoded callData
    function startBridgeTokensViaHopL2NativePacked() external payable {
        // first 4 bytes are function signature
        // transactionId: bytes8(msg.data[4:12]),
        // receiver: address(bytes20(msg.data[12:32])),
        // destinationChainId: uint256(uint32(bytes4(msg.data[32:36]))),
        // bonderFee: uint256(uint128(bytes16(msg.data[36:52]))),
        // amountOutMin: uint256(uint128(bytes16(msg.data[52:68])))
        // => total calldata length required: 68

        uint256 destinationChainId = uint256(uint32(bytes4(msg.data[32:36])));
        uint256 amountOutMin = uint256(uint128(bytes16(msg.data[52:68])));
        bool toL1 = destinationChainId == 1;

        // Wrap ETH
        WETH(payable(nativeL2CanonicalToken)).deposit{ value: msg.value }();

        // Exchange WETH for hToken
        uint256 swapAmount = ISwap(nativeExchangeAddress).swap(
            0,
            1,
            msg.value,
            amountOutMin,
            block.timestamp
        );

        // Bridge assets
        // solhint-disable-next-line check-send-result
        IHopBridge(nativeBridge).send(
            destinationChainId,
            address(bytes20(msg.data[12:32])), // receiver
            swapAmount,
            uint256(uint128(bytes16(msg.data[36:52]))), // bonderFee
            toL1 ? 0 : amountOutMin,
            toL1 ? 0 : block.timestamp + 7 * 24 * 60 * 60
        );

        emit LiFiHopTransfer(
            bytes8(msg.data[4:12]) // transactionId
        );
    }

    /// @notice Bridges Native tokens via Hop Protocol from L2
    /// @param transactionId Custom transaction ID for tracking
    /// @param receiver Receiving wallet address
    /// @param destinationChainId Receiving chain
    /// @param bonderFee Fees payed to hop bonder
    /// @param amountOutMin Source swap minimal accepted amount
    /// @param destinationAmountOutMin Destination swap minimal accepted amount
    /// @param destinationDeadline Destination swap maximal time
    /// @param hopBridge Address of the Hop L2_AmmWrapper
    function startBridgeTokensViaHopL2NativeMin(
        bytes8 transactionId,
        address receiver,
        uint256 destinationChainId,
        uint256 bonderFee,
        uint256 amountOutMin,
        uint256 destinationAmountOutMin,
        uint256 destinationDeadline,
        address hopBridge
    ) external payable {
        // Bridge assets
        IHopBridge(hopBridge).swapAndSend{ value: msg.value }(
            destinationChainId,
            receiver,
            msg.value,
            bonderFee,
            amountOutMin,
            block.timestamp,
            destinationAmountOutMin,
            destinationDeadline
        );

        emit LiFiHopTransfer(transactionId);
    }

    /// @notice Bridges Native tokens via Hop Protocol from L2
    /// @param transactionId Custom transaction ID for tracking
    /// @param receiver Receiving wallet address
    /// @param destinationChainId Receiving chain
    /// @param bonderFee Fees payed to hop bonder
    /// @param amountOutMin Source swap minimal accepted amount
    function encode_startBridgeTokensViaHopL2NativePacked(
        bytes8 transactionId,
        address receiver,
        uint256 destinationChainId,
        uint256 bonderFee,
        uint256 amountOutMin
    ) external pure returns (bytes memory) {
        require(
            destinationChainId <= type(uint32).max,
            "destinationChainId value passed too big to fit in uint32"
        );
        require(
            bonderFee <= type(uint128).max,
            "bonderFee value passed too big to fit in uint128"
        );
        require(
            amountOutMin <= type(uint128).max,
            "amountOutMin value passed too big to fit in uint128"
        );

        return
            bytes.concat(
                HopFacetPacked.startBridgeTokensViaHopL2NativePacked.selector,
                bytes8(transactionId),
                bytes20(receiver),
                bytes4(uint32(destinationChainId)),
                bytes16(uint128(bonderFee)),
                bytes16(uint128(amountOutMin))
            );
    }

    /// @notice Decodes calldata for startBridgeTokensViaHopL2NativePacked
    /// @param _data the calldata to decode
    function decode_startBridgeTokensViaHopL2NativePacked(
        bytes calldata _data
    )
        external
        pure
        returns (BridgeData memory, HopFacetOptimized.HopData memory)
    {
        require(
            _data.length >= 68,
            "data passed in is not the correct length"
        );

        BridgeData memory bridgeData;
        HopFacetOptimized.HopData memory hopData;

        bridgeData.transactionId = bytes32(bytes8(_data[4:12]));
        bridgeData.receiver = address(bytes20(_data[12:32]));
        bridgeData.destinationChainId = uint256(uint32(bytes4(_data[32:36])));
        hopData.bonderFee = uint256(uint128(bytes16(_data[36:52])));
        hopData.amountOutMin = uint256(uint128(bytes16(_data[52:68])));

        return (bridgeData, hopData);
    }

    /// @notice Bridges ERC20 tokens via Hop Protocol from L2
    /// No params, all data will be extracted from manually encoded callData
    function startBridgeTokensViaHopL2ERC20Packed() external {
        // first 4 bytes are function signature
        // transactionId: bytes8(msg.data[4:12]),
        // receiver: address(bytes20(msg.data[12:32])),
        // destinationChainId: uint256(uint32(bytes4(msg.data[32:36]))),
        // sendingAssetId: address(bytes20(msg.data[36:56])),
        // amount: uint256(uint128(bytes16(msg.data[56:72]))),
        // bonderFee: uint256(uint128(bytes16(msg.data[72:88]))),
        // amountOutMin: uint256(uint128(bytes16(msg.data[88:104]))),
        // destinationAmountOutMin: uint256(uint128(bytes16(msg.data[104:120]))),
        // destinationDeadline: uint256(uint32(bytes4(msg.data[120:124]))),
        // wrapper: address(bytes20(msg.data[124:144]))
        // => total calldata length required: 144

        uint256 destinationChainId = uint256(uint32(bytes4(msg.data[32:36])));
        uint256 amount = uint256(uint128(bytes16(msg.data[56:72])));
        uint256 amountOutMin = uint256(uint128(bytes16(msg.data[88:104])));
        bool toL1 = destinationChainId == 1;

        IL2AmmWrapper wrapper = IL2AmmWrapper(
            address(bytes20(msg.data[124:144]))
        );

        // Deposit assets
        ERC20(address(bytes20(msg.data[36:56]))).safeTransferFrom(
            msg.sender,
            address(this),
            amount
        );

        // Exchange sending asset to hToken
        uint256 swapAmount = ISwap(wrapper.exchangeAddress()).swap(
            0,
            1,
            amount,
            amountOutMin,
            block.timestamp
        );

        // Bridge assets
        // solhint-disable-next-line check-send-result
        IHopBridge(wrapper.bridge()).send(
            destinationChainId,
            address(bytes20(msg.data[12:32])),
            swapAmount,
            uint256(uint128(bytes16(msg.data[72:88]))),
            toL1 ? 0 : uint256(uint128(bytes16(msg.data[104:120]))),
            toL1 ? 0 : uint256(uint32(bytes4(msg.data[120:124])))
        );

        emit LiFiHopTransfer(bytes8(msg.data[4:12]));
    }

    /// @notice Bridges ERC20 tokens via Hop Protocol from L2
    /// @param transactionId Custom transaction ID for tracking
    /// @param receiver Receiving wallet address
    /// @param destinationChainId Receiving chain
    /// @param sendingAssetId Address of the source asset to bridge
    /// @param minAmount Amount of the source asset to bridge
    /// @param bonderFee Fees payed to hop bonder
    /// @param amountOutMin Source swap minimal accepted amount
    /// @param destinationAmountOutMin Destination swap minimal accepted amount
    /// @param destinationDeadline Destination swap maximal time
    /// @param hopBridge Address of the Hop L2_AmmWrapper
    function startBridgeTokensViaHopL2ERC20Min(
        bytes8 transactionId,
        address receiver,
        uint256 destinationChainId,
        address sendingAssetId,
        uint256 minAmount,
        uint256 bonderFee,
        uint256 amountOutMin,
        uint256 destinationAmountOutMin,
        uint256 destinationDeadline,
        address hopBridge
    ) external {
        // Deposit assets
        ERC20(sendingAssetId).safeTransferFrom(
            msg.sender,
            address(this),
            minAmount
        );

        // Bridge assets
        IHopBridge(hopBridge).swapAndSend(
            destinationChainId,
            receiver,
            minAmount,
            bonderFee,
            amountOutMin,
            block.timestamp,
            destinationAmountOutMin,
            destinationDeadline
        );

        emit LiFiHopTransfer(transactionId);
    }

    /// @notice Bridges ERC20 tokens via Hop Protocol from L2
    /// @param transactionId Custom transaction ID for tracking
    /// @param receiver Receiving wallet address
    /// @param destinationChainId Receiving chain
    /// @param sendingAssetId Address of the source asset to bridge
    /// @param minAmount Amount of the source asset to bridge
    /// @param bonderFee Fees payed to hop bonder
    /// @param amountOutMin Source swap minimal accepted amount
    /// @param destinationAmountOutMin Destination swap minimal accepted amount
    /// @param destinationDeadline Destination swap maximal time
    /// @param wrapper Address of the Hop L2_AmmWrapper
    function encode_startBridgeTokensViaHopL2ERC20Packed(
        bytes32 transactionId,
        address receiver,
        uint256 destinationChainId,
        address sendingAssetId,
        uint256 minAmount,
        uint256 bonderFee,
        uint256 amountOutMin,
        uint256 destinationAmountOutMin,
        uint256 destinationDeadline,
        address wrapper
    ) external pure returns (bytes memory) {
        require(
            destinationChainId <= type(uint32).max,
            "destinationChainId value passed too big to fit in uint32"
        );
        require(
            minAmount <= type(uint128).max,
            "amount value passed too big to fit in uint128"
        );
        require(
            bonderFee <= type(uint128).max,
            "bonderFee value passed too big to fit in uint128"
        );
        require(
            amountOutMin <= type(uint128).max,
            "amountOutMin value passed too big to fit in uint128"
        );
        require(
            destinationAmountOutMin <= type(uint128).max,
            "destinationAmountOutMin value passed too big to fit in uint128"
        );
        require(
            destinationDeadline <= type(uint32).max,
            "destinationDeadline value passed too big to fit in uint32"
        );

        return
            bytes.concat(
                HopFacetPacked.startBridgeTokensViaHopL2ERC20Packed.selector,
                bytes8(transactionId),
                bytes20(receiver),
                bytes4(uint32(destinationChainId)),
                bytes20(sendingAssetId),
                bytes16(uint128(minAmount)),
                bytes16(uint128(bonderFee)),
                bytes16(uint128(amountOutMin)),
                bytes16(uint128(destinationAmountOutMin)),
                bytes4(uint32(destinationDeadline)),
                bytes20(wrapper)
            );
    }

    /// @notice Decodes calldata for startBridgeTokensViaHopL2ERC20Packed
    /// @param _data the calldata to decode
    function decode_startBridgeTokensViaHopL2ERC20Packed(
        bytes calldata _data
    )
        external
        pure
        returns (BridgeData memory, HopFacetOptimized.HopData memory)
    {
        require(
            _data.length >= 144,
            "data passed in is not the correct length"
        );

        BridgeData memory bridgeData;
        HopFacetOptimized.HopData memory hopData;

        bridgeData.transactionId = bytes32(bytes8(_data[4:12]));
        bridgeData.receiver = address(bytes20(_data[12:32]));
        bridgeData.destinationChainId = uint256(uint32(bytes4(_data[32:36])));
        bridgeData.sendingAssetId = address(bytes20(_data[36:56]));
        bridgeData.minAmount = uint256(uint128(bytes16(_data[56:72])));
        hopData.bonderFee = uint256(uint128(bytes16(_data[72:88])));
        hopData.amountOutMin = uint256(uint128(bytes16(_data[88:104])));
        hopData.destinationAmountOutMin = uint256(
            uint128(bytes16(_data[104:120]))
        );
        hopData.destinationDeadline = uint256(uint32(bytes4(_data[120:124])));
        hopData.hopBridge = IHopBridge(address(bytes20(_data[124:144])));

        return (bridgeData, hopData);
    }

    /// @notice Bridges Native tokens via Hop Protocol from L1
    /// No params, all data will be extracted from manually encoded callData
    function startBridgeTokensViaHopL1NativePacked() external payable {
        // first 4 bytes are function signature
        // transactionId: bytes8(msg.data[4:12]),
        // receiver: address(bytes20(msg.data[12:32])),
        // destinationChainId: uint256(uint32(bytes4(msg.data[32:36]))),
        // destinationAmountOutMin: uint256(uint128(bytes16(msg.data[36:52]))),
        // relayer: address(bytes20(msg.data[52:72])),
        // relayerFee: uint256(uint128(bytes16(msg.data[72:88]))),
        // hopBridge: address(bytes20(msg.data[88:108]))
        // => total calldata length required: 108

        // Bridge assets
        IHopBridge(address(bytes20(msg.data[88:108]))).sendToL2{
            value: msg.value
        }(
            uint256(uint32(bytes4(msg.data[32:36]))),
            address(bytes20(msg.data[12:32])),
            msg.value,
            uint256(uint128(bytes16(msg.data[36:52]))),
            block.timestamp + 7 * 24 * 60 * 60,
            address(bytes20(msg.data[52:72])),
            uint256(uint128(bytes16(msg.data[72:88])))
        );

        emit LiFiHopTransfer(bytes8(msg.data[4:12]));
    }

    /// @notice Bridges Native tokens via Hop Protocol from L1
    /// @param transactionId Custom transaction ID for tracking
    /// @param receiver Receiving wallet address
    /// @param destinationChainId Receiving chain
    /// @param destinationAmountOutMin Destination swap minimal accepted amount
    /// @param relayer needed for gas spikes
    /// @param relayerFee needed for gas spikes
    /// @param hopBridge Address of the Hop Bridge
    function startBridgeTokensViaHopL1NativeMin(
        bytes8 transactionId,
        address receiver,
        uint256 destinationChainId,
        uint256 destinationAmountOutMin,
        address relayer,
        uint256 relayerFee,
        address hopBridge
    ) external payable {
        // Bridge assets
        IHopBridge(hopBridge).sendToL2{ value: msg.value }(
            destinationChainId,
            receiver,
            msg.value,
            destinationAmountOutMin,
            block.timestamp + 7 * 24 * 60 * 60,
            relayer,
            relayerFee
        );

        emit LiFiHopTransfer(transactionId);
    }

    /// @notice Bridges Native tokens via Hop Protocol from L1
    /// @param transactionId Custom transaction ID for tracking
    /// @param receiver Receiving wallet address
    /// @param destinationChainId Receiving chain
    /// @param destinationAmountOutMin Destination swap minimal accepted amount
    /// @param relayer needed for gas spikes
    /// @param relayerFee needed for gas spikes
    /// @param hopBridge Address of the Hop Bridge
    function encode_startBridgeTokensViaHopL1NativePacked(
        bytes8 transactionId,
        address receiver,
        uint256 destinationChainId,
        uint256 destinationAmountOutMin,
        address relayer,
        uint256 relayerFee,
        address hopBridge
    ) external pure returns (bytes memory) {
        require(
            destinationChainId <= type(uint32).max,
            "destinationChainId value passed too big to fit in uint32"
        );
        require(
            destinationAmountOutMin <= type(uint128).max,
            "destinationAmountOutMin value passed too big to fit in uint128"
        );
        require(
            relayerFee <= type(uint128).max,
            "relayerFee value passed too big to fit in uint128"
        );

        return
            bytes.concat(
                HopFacetPacked.startBridgeTokensViaHopL1NativePacked.selector,
                bytes8(transactionId),
                bytes20(receiver),
                bytes4(uint32(destinationChainId)),
                bytes16(uint128(destinationAmountOutMin)),
                bytes20(relayer),
                bytes16(uint128(relayerFee)),
                bytes20(hopBridge)
            );
    }

    /// @notice Decodes calldata for startBridgeTokensViaHopL1NativePacked
    /// @param _data the calldata to decode
    function decode_startBridgeTokensViaHopL1NativePacked(
        bytes calldata _data
    )
        external
        pure
        returns (BridgeData memory, HopFacetOptimized.HopData memory)
    {
        require(
            _data.length >= 108,
            "data passed in is not the correct length"
        );

        BridgeData memory bridgeData;
        HopFacetOptimized.HopData memory hopData;

        bridgeData.transactionId = bytes32(bytes8(_data[4:12]));
        bridgeData.receiver = address(bytes20(_data[12:32]));
        bridgeData.destinationChainId = uint256(uint32(bytes4(_data[32:36])));
        hopData.destinationAmountOutMin = uint256(
            uint128(bytes16(_data[36:52]))
        );
        // relayer = address(bytes20(_data[52:72]));
        // relayerFee = uint256(uint128(bytes16(_data[72:88])));
        hopData.hopBridge = IHopBridge(address(bytes20(_data[88:108])));

        return (bridgeData, hopData);
    }

    /// @notice Bridges Native tokens via Hop Protocol from L1
    /// No params, all data will be extracted from manually encoded callData
    function startBridgeTokensViaHopL1ERC20Packed() external payable {
        // first 4 bytes are function signature
        // transactionId: bytes8(msg.data[4:12]),
        // receiver: address(bytes20(msg.data[12:32])),
        // destinationChainId: uint256(uint32(bytes4(msg.data[32:36]))),
        // sendingAssetId: address(bytes20(msg.data[36:56])),
        // amount: uint256(uint128(bytes16(msg.data[56:72]))),
        // destinationAmountOutMin: uint256(uint128(bytes16(msg.data[72:88]))),
        // relayer: address(bytes20(msg.data[88:108])),
        // relayerFee: uint256(uint128(bytes16(msg.data[108:124]))),
        // hopBridge: address(bytes20(msg.data[124:144]))
        // => total calldata length required: 144

        uint256 amount = uint256(uint128(bytes16(msg.data[56:72])));

        // Deposit assets
        ERC20(address(bytes20(msg.data[36:56]))).safeTransferFrom(
            msg.sender,
            address(this),
            amount
        );

        // Bridge assets
        IHopBridge(address(bytes20(msg.data[124:144]))).sendToL2(
            uint256(uint32(bytes4(msg.data[32:36]))),
            address(bytes20(msg.data[12:32])),
            amount,
            uint256(uint128(bytes16(msg.data[72:88]))),
            block.timestamp + 7 * 24 * 60 * 60,
            address(bytes20(msg.data[88:108])),
            uint256(uint128(bytes16(msg.data[108:124])))
        );

        emit LiFiHopTransfer(bytes8(msg.data[4:12]));
    }

    /// @notice Bridges ERC20 tokens via Hop Protocol from L1
    /// @param transactionId Custom transaction ID for tracking
    /// @param receiver Receiving wallet address
    /// @param destinationChainId Receiving chain
    /// @param sendingAssetId Address of the source asset to bridge
    /// @param minAmount Amount of the source asset to bridge
    /// @param destinationAmountOutMin Destination swap minimal accepted amount
    /// @param relayer needed for gas spikes
    /// @param relayerFee needed for gas spikes
    /// @param hopBridge Address of the Hop Bridge
    function startBridgeTokensViaHopL1ERC20Min(
        bytes8 transactionId,
        address receiver,
        uint256 destinationChainId,
        address sendingAssetId,
        uint256 minAmount,
        uint256 destinationAmountOutMin,
        address relayer,
        uint256 relayerFee,
        address hopBridge
    ) external {
        // Deposit assets
        ERC20(sendingAssetId).safeTransferFrom(
            msg.sender,
            address(this),
            minAmount
        );

        // Bridge assets
        IHopBridge(hopBridge).sendToL2(
            destinationChainId,
            receiver,
            minAmount,
            destinationAmountOutMin,
            block.timestamp + 7 * 24 * 60 * 60,
            relayer,
            relayerFee
        );

        emit LiFiHopTransfer(transactionId);
    }

    /// @notice Bridges ERC20 tokens via Hop Protocol from L1
    /// @param transactionId Custom transaction ID for tracking
    /// @param receiver Receiving wallet address
    /// @param destinationChainId Receiving chain
    /// @param sendingAssetId Address of the source asset to bridge
    /// @param minAmount Amount of the source asset to bridge
    /// @param destinationAmountOutMin Destination swap minimal accepted amount
    /// @param relayer needed for gas spikes
    /// @param relayerFee needed for gas spikes
    /// @param hopBridge Address of the Hop Bridge
    function encode_startBridgeTokensViaHopL1ERC20Packed(
        bytes8 transactionId,
        address receiver,
        uint256 destinationChainId,
        address sendingAssetId,
        uint256 minAmount,
        uint256 destinationAmountOutMin,
        address relayer,
        uint256 relayerFee,
        address hopBridge
    ) external pure returns (bytes memory) {
        require(
            destinationChainId <= type(uint32).max,
            "destinationChainId value passed too big to fit in uint32"
        );
        require(
            minAmount <= type(uint128).max,
            "amount value passed too big to fit in uint128"
        );
        require(
            destinationAmountOutMin <= type(uint128).max,
            "destinationAmountOutMin value passed too big to fit in uint128"
        );
        require(
            relayerFee <= type(uint128).max,
            "relayerFee value passed too big to fit in uint128"
        );

        return
            bytes.concat(
                HopFacetPacked.startBridgeTokensViaHopL1ERC20Packed.selector,
                bytes8(transactionId),
                bytes20(receiver),
                bytes4(uint32(destinationChainId)),
                bytes20(sendingAssetId),
                bytes16(uint128(minAmount)),
                bytes16(uint128(destinationAmountOutMin)),
                bytes20(relayer),
                bytes16(uint128(relayerFee)),
                bytes20(hopBridge)
            );
    }

    /// @notice Decodes calldata for startBridgeTokensViaHopL1ERC20Packed
    /// @param _data the calldata to decode
    function decode_startBridgeTokensViaHopL1ERC20Packed(
        bytes calldata _data
    )
        external
        pure
        returns (BridgeData memory, HopFacetOptimized.HopData memory)
    {
        require(
            _data.length >= 144,
            "data passed in is not the correct length"
        );

        BridgeData memory bridgeData;
        HopFacetOptimized.HopData memory hopData;

        bridgeData.transactionId = bytes32(bytes8(_data[4:12]));
        bridgeData.receiver = address(bytes20(_data[12:32]));
        bridgeData.destinationChainId = uint256(uint32(bytes4(_data[32:36])));
        bridgeData.sendingAssetId = address(bytes20(_data[36:56]));
        bridgeData.minAmount = uint256(uint128(bytes16(_data[56:72])));
        hopData.destinationAmountOutMin = uint256(
            uint128(bytes16(_data[72:88]))
        );
        // relayer = address(bytes20(_data[88:108]));
        // relayerFee = uint256(uint128(bytes16(_data[108:124])));
        hopData.hopBridge = IHopBridge(address(bytes20(_data[124:144])));

        return (bridgeData, hopData);
    }
}

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

interface IHopBridge {
    function sendToL2(
        uint256 chainId,
        address recipient,
        uint256 amount,
        uint256 amountOutMin,
        uint256 deadline,
        address relayer,
        uint256 relayerFee
    ) external payable;

    function swapAndSend(
        uint256 chainId,
        address recipient,
        uint256 amount,
        uint256 bonderFee,
        uint256 amountOutMin,
        uint256 deadline,
        uint256 destinationAmountOutMin,
        uint256 destinationDeadline
    ) external payable;

    function send(
        uint256 chainId,
        address recipient,
        uint256 amount,
        uint256 bonderFee,
        uint256 amountOutMin,
        uint256 deadline
    ) external;
}

interface IL2AmmWrapper {
    function bridge() external view returns (address);

    function l2CanonicalToken() external view returns (address);

    function hToken() external view returns (address);

    function exchangeAddress() external view returns (address);
}

interface ISwap {
    function swap(
        uint8 tokenIndexFrom,
        uint8 tokenIndexTo,
        uint256 dx,
        uint256 minDy,
        uint256 deadline
    ) external returns (uint256);
}

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

interface ILiFi {
    /// Structs ///

    struct BridgeData {
        bytes32 transactionId;
        string bridge;
        string integrator;
        address referrer;
        address sendingAssetId;
        address receiver;
        uint256 minAmount;
        uint256 destinationChainId;
        bool hasSourceSwaps;
        bool hasDestinationCall;
    }

    /// Events ///

    event LiFiTransferStarted(ILiFi.BridgeData bridgeData);

    event LiFiTransferCompleted(
        bytes32 indexed transactionId,
        address receivingAssetId,
        address receiver,
        uint256 amount,
        uint256 timestamp
    );

    event LiFiTransferRecovered(
        bytes32 indexed transactionId,
        address receivingAssetId,
        address receiver,
        uint256 amount,
        uint256 timestamp
    );

    event LiFiGenericSwapCompleted(
        bytes32 indexed transactionId,
        string integrator,
        string referrer,
        address receiver,
        address fromAssetId,
        address toAssetId,
        uint256 fromAmount,
        uint256 toAmount
    );

    // Deprecated but kept here to include in ABI to parse historic events
    event LiFiSwappedGeneric(
        bytes32 indexed transactionId,
        string integrator,
        string referrer,
        address fromAssetId,
        address toAssetId,
        uint256 fromAmount,
        uint256 toAmount
    );
}

File 4 of 22 : SafeTransferLib.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import {ERC20} from "../tokens/ERC20.sol";

/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.
/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.
library SafeTransferLib {
    /*//////////////////////////////////////////////////////////////
                             ETH OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferETH(address to, uint256 amount) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Transfer the ETH and store if it succeeded or not.
            success := call(gas(), to, amount, 0, 0, 0, 0)
        }

        require(success, "ETH_TRANSFER_FAILED");
    }

    /*//////////////////////////////////////////////////////////////
                            ERC20 OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferFrom(
        ERC20 token,
        address from,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), from) // Append the "from" argument.
            mstore(add(freeMemoryPointer, 36), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)
            )
        }

        require(success, "TRANSFER_FROM_FAILED");
    }

    function safeTransfer(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
            )
        }

        require(success, "TRANSFER_FAILED");
    }

    function safeApprove(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
            )
        }

        require(success, "APPROVE_FAILED");
    }
}

File 5 of 22 : LibAsset.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.17;
import { InsufficientBalance, NullAddrIsNotAnERC20Token, NullAddrIsNotAValidSpender, NoTransferToNullAddress, InvalidAmount, NativeAssetTransferFailed } from "../Errors/GenericErrors.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { LibSwap } from "./LibSwap.sol";

/// @title LibAsset
/// @notice This library contains helpers for dealing with onchain transfers
///         of assets, including accounting for the native asset `assetId`
///         conventions and any noncompliant ERC20 transfers
library LibAsset {
    uint256 private constant MAX_UINT = type(uint256).max;

    address internal constant NULL_ADDRESS = address(0);

    /// @dev All native assets use the empty address for their asset id
    ///      by convention

    address internal constant NATIVE_ASSETID = NULL_ADDRESS; //address(0)

    /// @notice Gets the balance of the inheriting contract for the given asset
    /// @param assetId The asset identifier to get the balance of
    /// @return Balance held by contracts using this library
    function getOwnBalance(address assetId) internal view returns (uint256) {
        return
            isNativeAsset(assetId)
                ? address(this).balance
                : IERC20(assetId).balanceOf(address(this));
    }

    /// @notice Transfers ether from the inheriting contract to a given
    ///         recipient
    /// @param recipient Address to send ether to
    /// @param amount Amount to send to given recipient
    function transferNativeAsset(
        address payable recipient,
        uint256 amount
    ) private {
        if (recipient == NULL_ADDRESS) revert NoTransferToNullAddress();
        if (amount > address(this).balance)
            revert InsufficientBalance(amount, address(this).balance);
        // solhint-disable-next-line avoid-low-level-calls
        (bool success, ) = recipient.call{ value: amount }("");
        if (!success) revert NativeAssetTransferFailed();
    }

    /// @notice If the current allowance is insufficient, the allowance for a given spender
    /// is set to MAX_UINT.
    /// @param assetId Token address to transfer
    /// @param spender Address to give spend approval to
    /// @param amount Amount to approve for spending
    function maxApproveERC20(
        IERC20 assetId,
        address spender,
        uint256 amount
    ) internal {
        if (isNativeAsset(address(assetId))) {
            return;
        }
        if (spender == NULL_ADDRESS) {
            revert NullAddrIsNotAValidSpender();
        }

        if (assetId.allowance(address(this), spender) < amount) {
            SafeERC20.safeApprove(IERC20(assetId), spender, 0);
            SafeERC20.safeApprove(IERC20(assetId), spender, MAX_UINT);
        }
    }

    /// @notice Transfers tokens from the inheriting contract to a given
    ///         recipient
    /// @param assetId Token address to transfer
    /// @param recipient Address to send token to
    /// @param amount Amount to send to given recipient
    function transferERC20(
        address assetId,
        address recipient,
        uint256 amount
    ) private {
        if (isNativeAsset(assetId)) {
            revert NullAddrIsNotAnERC20Token();
        }
        if (recipient == NULL_ADDRESS) {
            revert NoTransferToNullAddress();
        }

        uint256 assetBalance = IERC20(assetId).balanceOf(address(this));
        if (amount > assetBalance) {
            revert InsufficientBalance(amount, assetBalance);
        }
        SafeERC20.safeTransfer(IERC20(assetId), recipient, amount);
    }

    /// @notice Transfers tokens from a sender to a given recipient
    /// @param assetId Token address to transfer
    /// @param from Address of sender/owner
    /// @param to Address of recipient/spender
    /// @param amount Amount to transfer from owner to spender
    function transferFromERC20(
        address assetId,
        address from,
        address to,
        uint256 amount
    ) internal {
        if (isNativeAsset(assetId)) {
            revert NullAddrIsNotAnERC20Token();
        }
        if (to == NULL_ADDRESS) {
            revert NoTransferToNullAddress();
        }

        IERC20 asset = IERC20(assetId);
        uint256 prevBalance = asset.balanceOf(to);
        SafeERC20.safeTransferFrom(asset, from, to, amount);
        if (asset.balanceOf(to) - prevBalance != amount) {
            revert InvalidAmount();
        }
    }

    function depositAsset(address assetId, uint256 amount) internal {
        if (amount == 0) revert InvalidAmount();
        if (isNativeAsset(assetId)) {
            if (msg.value < amount) revert InvalidAmount();
        } else {
            uint256 balance = IERC20(assetId).balanceOf(msg.sender);
            if (balance < amount) revert InsufficientBalance(amount, balance);
            transferFromERC20(assetId, msg.sender, address(this), amount);
        }
    }

    function depositAssets(LibSwap.SwapData[] calldata swaps) internal {
        for (uint256 i = 0; i < swaps.length; ) {
            LibSwap.SwapData calldata swap = swaps[i];
            if (swap.requiresDeposit) {
                depositAsset(swap.sendingAssetId, swap.fromAmount);
            }
            unchecked {
                i++;
            }
        }
    }

    /// @notice Determines whether the given assetId is the native asset
    /// @param assetId The asset identifier to evaluate
    /// @return Boolean indicating if the asset is the native asset
    function isNativeAsset(address assetId) internal pure returns (bool) {
        return assetId == NATIVE_ASSETID;
    }

    /// @notice Wrapper function to transfer a given asset (native or erc20) to
    ///         some recipient. Should handle all non-compliant return value
    ///         tokens as well by using the SafeERC20 contract by open zeppelin.
    /// @param assetId Asset id for transfer (address(0) for native asset,
    ///                token address for erc20s)
    /// @param recipient Address to send asset to
    /// @param amount Amount to send to given recipient
    function transferAsset(
        address assetId,
        address payable recipient,
        uint256 amount
    ) internal {
        isNativeAsset(assetId)
            ? transferNativeAsset(recipient, amount)
            : transferERC20(assetId, recipient, amount);
    }

    /// @dev Checks whether the given address is a contract and contains code
    function isContract(address _contractAddr) internal view returns (bool) {
        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            size := extcodesize(_contractAddr)
        }
        return size > 0;
    }
}

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

import { IERC173 } from "../Interfaces/IERC173.sol";
import { LibAsset } from "../Libraries/LibAsset.sol";

contract TransferrableOwnership is IERC173 {
    address public owner;
    address public pendingOwner;

    /// Errors ///
    error UnAuthorized();
    error NoNullOwner();
    error NewOwnerMustNotBeSelf();
    error NoPendingOwnershipTransfer();
    error NotPendingOwner();

    /// Events ///
    event OwnershipTransferRequested(
        address indexed _from,
        address indexed _to
    );

    constructor(address initialOwner) {
        owner = initialOwner;
    }

    modifier onlyOwner() {
        if (msg.sender != owner) revert UnAuthorized();
        _;
    }

    /// @notice Initiates transfer of ownership to a new address
    /// @param _newOwner the address to transfer ownership to
    function transferOwnership(address _newOwner) external onlyOwner {
        if (_newOwner == LibAsset.NULL_ADDRESS) revert NoNullOwner();
        if (_newOwner == msg.sender) revert NewOwnerMustNotBeSelf();
        pendingOwner = _newOwner;
        emit OwnershipTransferRequested(msg.sender, pendingOwner);
    }

    /// @notice Cancel transfer of ownership
    function cancelOwnershipTransfer() external onlyOwner {
        if (pendingOwner == LibAsset.NULL_ADDRESS)
            revert NoPendingOwnershipTransfer();
        pendingOwner = LibAsset.NULL_ADDRESS;
    }

    /// @notice Confirms transfer of ownership to the calling address (msg.sender)
    function confirmOwnershipTransfer() external {
        address _pendingOwner = pendingOwner;
        if (msg.sender != _pendingOwner) revert NotPendingOwner();
        emit OwnershipTransferred(owner, _pendingOwner);
        owner = _pendingOwner;
        pendingOwner = LibAsset.NULL_ADDRESS;
    }
}

File 7 of 22 : HopFacetOptimized.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import { ILiFi } from "../Interfaces/ILiFi.sol";
import { IHopBridge } from "../Interfaces/IHopBridge.sol";
import { LibAsset, IERC20 } from "../Libraries/LibAsset.sol";
import { SwapperV2, LibSwap } from "../Helpers/SwapperV2.sol";
import { LibDiamond } from "../Libraries/LibDiamond.sol";

/// @title Hop Facet (Optimized)
/// @author LI.FI (https://li.fi)
/// @notice Provides functionality for bridging through Hop
/// @custom:version 2.0.0
contract HopFacetOptimized is ILiFi, SwapperV2 {
    /// Types ///

    struct HopData {
        uint256 bonderFee;
        uint256 amountOutMin;
        uint256 deadline;
        uint256 destinationAmountOutMin;
        uint256 destinationDeadline;
        IHopBridge hopBridge;
        address relayer;
        uint256 relayerFee;
        uint256 nativeFee;
    }

    /// External Methods ///

    /// @notice Sets approval for the Hop Bridge to spend the specified token
    /// @param bridges The Hop Bridges to approve
    /// @param tokensToApprove The tokens to approve to approve to the Hop Bridges
    function setApprovalForBridges(
        address[] calldata bridges,
        address[] calldata tokensToApprove
    ) external {
        LibDiamond.enforceIsContractOwner();
        for (uint256 i; i < bridges.length; i++) {
            // Give Hop approval to bridge tokens
            LibAsset.maxApproveERC20(
                IERC20(tokensToApprove[i]),
                address(bridges[i]),
                type(uint256).max
            );
        }
    }

    /// @notice Bridges ERC20 tokens via Hop Protocol from L1
    /// @param _bridgeData the core information needed for bridging
    /// @param _hopData data specific to Hop Protocol
    function startBridgeTokensViaHopL1ERC20(
        ILiFi.BridgeData calldata _bridgeData,
        HopData calldata _hopData
    ) external payable {
        // Deposit assets
        LibAsset.transferFromERC20(
            _bridgeData.sendingAssetId,
            msg.sender,
            address(this),
            _bridgeData.minAmount
        );
        // Bridge assets
        _hopData.hopBridge.sendToL2{ value: _hopData.nativeFee }(
            _bridgeData.destinationChainId,
            _bridgeData.receiver,
            _bridgeData.minAmount,
            _hopData.destinationAmountOutMin,
            _hopData.destinationDeadline,
            _hopData.relayer,
            _hopData.relayerFee
        );
        emit LiFiTransferStarted(_bridgeData);
    }

    /// @notice Bridges Native tokens via Hop Protocol from L1
    /// @param _bridgeData the core information needed for bridging
    /// @param _hopData data specific to Hop Protocol
    function startBridgeTokensViaHopL1Native(
        ILiFi.BridgeData calldata _bridgeData,
        HopData calldata _hopData
    ) external payable {
        // Bridge assets
        _hopData.hopBridge.sendToL2{
            value: _bridgeData.minAmount + _hopData.nativeFee
        }(
            _bridgeData.destinationChainId,
            _bridgeData.receiver,
            _bridgeData.minAmount,
            _hopData.destinationAmountOutMin,
            _hopData.destinationDeadline,
            _hopData.relayer,
            _hopData.relayerFee
        );
        emit LiFiTransferStarted(_bridgeData);
    }

    /// @notice Performs a swap before bridging ERC20 tokens via Hop Protocol from L1
    /// @param _bridgeData the core information needed for bridging
    /// @param _swapData an array of swap related data for performing swaps before bridging
    /// @param _hopData data specific to Hop Protocol
    function swapAndStartBridgeTokensViaHopL1ERC20(
        ILiFi.BridgeData memory _bridgeData,
        LibSwap.SwapData[] calldata _swapData,
        HopData calldata _hopData
    ) external payable {
        // Deposit and swap assets
        _bridgeData.minAmount = _depositAndSwap(
            _bridgeData.transactionId,
            _bridgeData.minAmount,
            _swapData,
            payable(msg.sender),
            _hopData.nativeFee
        );

        // Bridge assets
        _hopData.hopBridge.sendToL2{ value: _hopData.nativeFee }(
            _bridgeData.destinationChainId,
            _bridgeData.receiver,
            _bridgeData.minAmount,
            _hopData.destinationAmountOutMin,
            _hopData.destinationDeadline,
            _hopData.relayer,
            _hopData.relayerFee
        );
        emit LiFiTransferStarted(_bridgeData);
    }

    /// @notice Performs a swap before bridging Native tokens via Hop Protocol from L1
    /// @param _bridgeData the core information needed for bridging
    /// @param _swapData an array of swap related data for performing swaps before bridging
    /// @param _hopData data specific to Hop Protocol
    function swapAndStartBridgeTokensViaHopL1Native(
        ILiFi.BridgeData memory _bridgeData,
        LibSwap.SwapData[] calldata _swapData,
        HopData calldata _hopData
    ) external payable {
        // Deposit and swap assets
        _bridgeData.minAmount = _depositAndSwap(
            _bridgeData.transactionId,
            _bridgeData.minAmount,
            _swapData,
            payable(msg.sender),
            _hopData.nativeFee
        );

        // Bridge assets
        _hopData.hopBridge.sendToL2{
            value: _bridgeData.minAmount + _hopData.nativeFee
        }(
            _bridgeData.destinationChainId,
            _bridgeData.receiver,
            _bridgeData.minAmount,
            _hopData.destinationAmountOutMin,
            _hopData.destinationDeadline,
            _hopData.relayer,
            _hopData.relayerFee
        );

        emit LiFiTransferStarted(_bridgeData);
    }

    /// @notice Bridges ERC20 tokens via Hop Protocol from L2
    /// @param _bridgeData the core information needed for bridging
    /// @param _hopData data specific to Hop Protocol
    function startBridgeTokensViaHopL2ERC20(
        ILiFi.BridgeData calldata _bridgeData,
        HopData calldata _hopData
    ) external {
        // Deposit assets
        LibAsset.transferFromERC20(
            _bridgeData.sendingAssetId,
            msg.sender,
            address(this),
            _bridgeData.minAmount
        );
        // Bridge assets
        _hopData.hopBridge.swapAndSend(
            _bridgeData.destinationChainId,
            _bridgeData.receiver,
            _bridgeData.minAmount,
            _hopData.bonderFee,
            _hopData.amountOutMin,
            _hopData.deadline,
            _hopData.destinationAmountOutMin,
            _hopData.destinationDeadline
        );
        emit LiFiTransferStarted(_bridgeData);
    }

    /// @notice Bridges Native tokens via Hop Protocol from L2
    /// @param _bridgeData the core information needed for bridging
    /// @param _hopData data specific to Hop Protocol
    function startBridgeTokensViaHopL2Native(
        ILiFi.BridgeData calldata _bridgeData,
        HopData calldata _hopData
    ) external payable {
        // Bridge assets
        _hopData.hopBridge.swapAndSend{ value: _bridgeData.minAmount }(
            _bridgeData.destinationChainId,
            _bridgeData.receiver,
            _bridgeData.minAmount,
            _hopData.bonderFee,
            _hopData.amountOutMin,
            _hopData.deadline,
            _hopData.destinationAmountOutMin,
            _hopData.destinationDeadline
        );
        emit LiFiTransferStarted(_bridgeData);
    }

    /// @notice Performs a swap before bridging ERC20 tokens via Hop Protocol from L2
    /// @param _bridgeData the core information needed for bridging
    /// @param _swapData an array of swap related data for performing swaps before bridging
    /// @param _hopData data specific to Hop Protocol
    function swapAndStartBridgeTokensViaHopL2ERC20(
        ILiFi.BridgeData memory _bridgeData,
        LibSwap.SwapData[] calldata _swapData,
        HopData calldata _hopData
    ) external payable {
        // Deposit and swap assets
        _bridgeData.minAmount = _depositAndSwap(
            _bridgeData.transactionId,
            _bridgeData.minAmount,
            _swapData,
            payable(msg.sender)
        );
        // Bridge assets
        _hopData.hopBridge.swapAndSend(
            _bridgeData.destinationChainId,
            _bridgeData.receiver,
            _bridgeData.minAmount,
            _hopData.bonderFee,
            _hopData.amountOutMin,
            _hopData.deadline,
            _hopData.destinationAmountOutMin,
            _hopData.destinationDeadline
        );
        emit LiFiTransferStarted(_bridgeData);
    }

    /// @notice Performs a swap before bridging Native tokens via Hop Protocol from L2
    /// @param _bridgeData the core information needed for bridging
    /// @param _swapData an array of swap related data for performing swaps before bridging
    /// @param _hopData data specific to Hop Protocol
    function swapAndStartBridgeTokensViaHopL2Native(
        ILiFi.BridgeData memory _bridgeData,
        LibSwap.SwapData[] calldata _swapData,
        HopData calldata _hopData
    ) external payable {
        // Deposit and swap assets
        _bridgeData.minAmount = _depositAndSwap(
            _bridgeData.transactionId,
            _bridgeData.minAmount,
            _swapData,
            payable(msg.sender)
        );
        // Bridge assets
        _hopData.hopBridge.swapAndSend{ value: _bridgeData.minAmount }(
            _bridgeData.destinationChainId,
            _bridgeData.receiver,
            _bridgeData.minAmount,
            _hopData.bonderFee,
            _hopData.amountOutMin,
            _hopData.deadline,
            _hopData.destinationAmountOutMin,
            _hopData.destinationDeadline
        );
        emit LiFiTransferStarted(_bridgeData);
    }
}

File 8 of 22 : WETH.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import {ERC20} from "./ERC20.sol";

import {SafeTransferLib} from "../utils/SafeTransferLib.sol";

/// @notice Minimalist and modern Wrapped Ether implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/WETH.sol)
/// @author Inspired by WETH9 (https://github.com/dapphub/ds-weth/blob/master/src/weth9.sol)
contract WETH is ERC20("Wrapped Ether", "WETH", 18) {
    using SafeTransferLib for address;

    event Deposit(address indexed from, uint256 amount);

    event Withdrawal(address indexed to, uint256 amount);

    function deposit() public payable virtual {
        _mint(msg.sender, msg.value);

        emit Deposit(msg.sender, msg.value);
    }

    function withdraw(uint256 amount) public virtual {
        _burn(msg.sender, amount);

        emit Withdrawal(msg.sender, amount);

        msg.sender.safeTransferETH(amount);
    }

    receive() external payable virtual {
        deposit();
    }
}

File 9 of 22 : ERC20.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event Transfer(address indexed from, address indexed to, uint256 amount);

    event Approval(address indexed owner, address indexed spender, uint256 amount);

    /*//////////////////////////////////////////////////////////////
                            METADATA STORAGE
    //////////////////////////////////////////////////////////////*/

    string public name;

    string public symbol;

    uint8 public immutable decimals;

    /*//////////////////////////////////////////////////////////////
                              ERC20 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    mapping(address => mapping(address => uint256)) public allowance;

    /*//////////////////////////////////////////////////////////////
                            EIP-2612 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 internal immutable INITIAL_CHAIN_ID;

    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;

    mapping(address => uint256) public nonces;

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(
        string memory _name,
        string memory _symbol,
        uint8 _decimals
    ) {
        name = _name;
        symbol = _symbol;
        decimals = _decimals;

        INITIAL_CHAIN_ID = block.chainid;
        INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
    }

    /*//////////////////////////////////////////////////////////////
                               ERC20 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 amount) public virtual returns (bool) {
        allowance[msg.sender][spender] = amount;

        emit Approval(msg.sender, spender, amount);

        return true;
    }

    function transfer(address to, uint256 amount) public virtual returns (bool) {
        balanceOf[msg.sender] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(msg.sender, to, amount);

        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual returns (bool) {
        uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.

        if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;

        balanceOf[from] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(from, to, amount);

        return true;
    }

    /*//////////////////////////////////////////////////////////////
                             EIP-2612 LOGIC
    //////////////////////////////////////////////////////////////*/

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");

        // Unchecked because the only math done is incrementing
        // the owner's nonce which cannot realistically overflow.
        unchecked {
            address recoveredAddress = ecrecover(
                keccak256(
                    abi.encodePacked(
                        "\x19\x01",
                        DOMAIN_SEPARATOR(),
                        keccak256(
                            abi.encode(
                                keccak256(
                                    "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
                                ),
                                owner,
                                spender,
                                value,
                                nonces[owner]++,
                                deadline
                            )
                        )
                    )
                ),
                v,
                r,
                s
            );

            require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");

            allowance[recoveredAddress][spender] = value;
        }

        emit Approval(owner, spender, value);
    }

    function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
        return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
    }

    function computeDomainSeparator() internal view virtual returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                    keccak256(bytes(name)),
                    keccak256("1"),
                    block.chainid,
                    address(this)
                )
            );
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address to, uint256 amount) internal virtual {
        totalSupply += amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(address(0), to, amount);
    }

    function _burn(address from, uint256 amount) internal virtual {
        balanceOf[from] -= amount;

        // Cannot underflow because a user's balance
        // will never be larger than the total supply.
        unchecked {
            totalSupply -= amount;
        }

        emit Transfer(from, address(0), amount);
    }
}

File 10 of 22 : 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 11 of 22 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
     * 0 before setting it to a non-zero value.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

File 12 of 22 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

File 13 of 22 : LibSwap.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import { LibAsset } from "./LibAsset.sol";
import { LibUtil } from "./LibUtil.sol";
import { InvalidContract, NoSwapFromZeroBalance, InsufficientBalance } from "../Errors/GenericErrors.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

library LibSwap {
    struct SwapData {
        address callTo;
        address approveTo;
        address sendingAssetId;
        address receivingAssetId;
        uint256 fromAmount;
        bytes callData;
        bool requiresDeposit;
    }

    event AssetSwapped(
        bytes32 transactionId,
        address dex,
        address fromAssetId,
        address toAssetId,
        uint256 fromAmount,
        uint256 toAmount,
        uint256 timestamp
    );

    function swap(bytes32 transactionId, SwapData calldata _swap) internal {
        if (!LibAsset.isContract(_swap.callTo)) revert InvalidContract();
        uint256 fromAmount = _swap.fromAmount;
        if (fromAmount == 0) revert NoSwapFromZeroBalance();
        uint256 nativeValue = LibAsset.isNativeAsset(_swap.sendingAssetId)
            ? _swap.fromAmount
            : 0;
        uint256 initialSendingAssetBalance = LibAsset.getOwnBalance(
            _swap.sendingAssetId
        );
        uint256 initialReceivingAssetBalance = LibAsset.getOwnBalance(
            _swap.receivingAssetId
        );

        if (nativeValue == 0) {
            LibAsset.maxApproveERC20(
                IERC20(_swap.sendingAssetId),
                _swap.approveTo,
                _swap.fromAmount
            );
        }

        if (initialSendingAssetBalance < _swap.fromAmount) {
            revert InsufficientBalance(
                _swap.fromAmount,
                initialSendingAssetBalance
            );
        }

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory res) = _swap.callTo.call{
            value: nativeValue
        }(_swap.callData);
        if (!success) {
            string memory reason = LibUtil.getRevertMsg(res);
            revert(reason);
        }

        uint256 newBalance = LibAsset.getOwnBalance(_swap.receivingAssetId);

        emit AssetSwapped(
            transactionId,
            _swap.callTo,
            _swap.sendingAssetId,
            _swap.receivingAssetId,
            _swap.fromAmount,
            newBalance > initialReceivingAssetBalance
                ? newBalance - initialReceivingAssetBalance
                : newBalance,
            block.timestamp
        );
    }
}

File 14 of 22 : IERC173.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

/// @title ERC-173 Contract Ownership Standard
///  Note: the ERC-165 identifier for this interface is 0x7f5828d0
/* is ERC165 */
interface IERC173 {
    /// @dev This emits when ownership of a contract changes.
    event OwnershipTransferred(
        address indexed previousOwner,
        address indexed newOwner
    );

    /// @notice Get the address of the owner
    /// @return owner_ The address of the owner.
    function owner() external view returns (address owner_);

    /// @notice Set the address of the new owner of the contract
    /// @dev Set _newOwner to address(0) to renounce any ownership.
    /// @param _newOwner The address of the new owner of the contract
    function transferOwnership(address _newOwner) external;
}

File 15 of 22 : SwapperV2.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import { ILiFi } from "../Interfaces/ILiFi.sol";
import { LibSwap } from "../Libraries/LibSwap.sol";
import { LibAsset } from "../Libraries/LibAsset.sol";
import { LibAllowList } from "../Libraries/LibAllowList.sol";
import { ContractCallNotAllowed, NoSwapDataProvided, CumulativeSlippageTooHigh } from "../Errors/GenericErrors.sol";

/// @title Swapper
/// @author LI.FI (https://li.fi)
/// @notice Abstract contract to provide swap functionality
contract SwapperV2 is ILiFi {
    /// Types ///

    /// @dev only used to get around "Stack Too Deep" errors
    struct ReserveData {
        bytes32 transactionId;
        address payable leftoverReceiver;
        uint256 nativeReserve;
    }

    /// Modifiers ///

    /// @dev Sends any leftover balances back to the user
    /// @notice Sends any leftover balances to the user
    /// @param _swaps Swap data array
    /// @param _leftoverReceiver Address to send leftover tokens to
    /// @param _initialBalances Array of initial token balances
    modifier noLeftovers(
        LibSwap.SwapData[] calldata _swaps,
        address payable _leftoverReceiver,
        uint256[] memory _initialBalances
    ) {
        uint256 numSwaps = _swaps.length;
        if (numSwaps != 1) {
            address finalAsset = _swaps[numSwaps - 1].receivingAssetId;
            uint256 curBalance;

            _;

            for (uint256 i = 0; i < numSwaps - 1; ) {
                address curAsset = _swaps[i].receivingAssetId;
                // Handle multi-to-one swaps
                if (curAsset != finalAsset) {
                    curBalance =
                        LibAsset.getOwnBalance(curAsset) -
                        _initialBalances[i];
                    if (curBalance > 0) {
                        LibAsset.transferAsset(
                            curAsset,
                            _leftoverReceiver,
                            curBalance
                        );
                    }
                }
                unchecked {
                    ++i;
                }
            }
        } else {
            _;
        }
    }

    /// @dev Sends any leftover balances back to the user reserving native tokens
    /// @notice Sends any leftover balances to the user
    /// @param _swaps Swap data array
    /// @param _leftoverReceiver Address to send leftover tokens to
    /// @param _initialBalances Array of initial token balances
    modifier noLeftoversReserve(
        LibSwap.SwapData[] calldata _swaps,
        address payable _leftoverReceiver,
        uint256[] memory _initialBalances,
        uint256 _nativeReserve
    ) {
        uint256 numSwaps = _swaps.length;
        if (numSwaps != 1) {
            address finalAsset = _swaps[numSwaps - 1].receivingAssetId;
            uint256 curBalance;

            _;

            for (uint256 i = 0; i < numSwaps - 1; ) {
                address curAsset = _swaps[i].receivingAssetId;
                // Handle multi-to-one swaps
                if (curAsset != finalAsset) {
                    curBalance =
                        LibAsset.getOwnBalance(curAsset) -
                        _initialBalances[i];
                    uint256 reserve = LibAsset.isNativeAsset(curAsset)
                        ? _nativeReserve
                        : 0;
                    if (curBalance > 0) {
                        LibAsset.transferAsset(
                            curAsset,
                            _leftoverReceiver,
                            curBalance - reserve
                        );
                    }
                }
                unchecked {
                    ++i;
                }
            }
        } else {
            _;
        }
    }

    /// @dev Refunds any excess native asset sent to the contract after the main function
    /// @notice Refunds any excess native asset sent to the contract after the main function
    /// @param _refundReceiver Address to send refunds to
    modifier refundExcessNative(address payable _refundReceiver) {
        uint256 initialBalance = address(this).balance - msg.value;
        _;
        uint256 finalBalance = address(this).balance;

        if (finalBalance > initialBalance) {
            LibAsset.transferAsset(
                LibAsset.NATIVE_ASSETID,
                _refundReceiver,
                finalBalance - initialBalance
            );
        }
    }

    /// Internal Methods ///

    /// @dev Deposits value, executes swaps, and performs minimum amount check
    /// @param _transactionId the transaction id associated with the operation
    /// @param _minAmount the minimum amount of the final asset to receive
    /// @param _swaps Array of data used to execute swaps
    /// @param _leftoverReceiver The address to send leftover funds to
    /// @return uint256 result of the swap
    function _depositAndSwap(
        bytes32 _transactionId,
        uint256 _minAmount,
        LibSwap.SwapData[] calldata _swaps,
        address payable _leftoverReceiver
    ) internal returns (uint256) {
        uint256 numSwaps = _swaps.length;

        if (numSwaps == 0) {
            revert NoSwapDataProvided();
        }

        address finalTokenId = _swaps[numSwaps - 1].receivingAssetId;
        uint256 initialBalance = LibAsset.getOwnBalance(finalTokenId);

        if (LibAsset.isNativeAsset(finalTokenId)) {
            initialBalance -= msg.value;
        }

        uint256[] memory initialBalances = _fetchBalances(_swaps);

        LibAsset.depositAssets(_swaps);
        _executeSwaps(
            _transactionId,
            _swaps,
            _leftoverReceiver,
            initialBalances
        );

        uint256 newBalance = LibAsset.getOwnBalance(finalTokenId) -
            initialBalance;

        if (newBalance < _minAmount) {
            revert CumulativeSlippageTooHigh(_minAmount, newBalance);
        }

        return newBalance;
    }

    /// @dev Deposits value, executes swaps, and performs minimum amount check and reserves native token for fees
    /// @param _transactionId the transaction id associated with the operation
    /// @param _minAmount the minimum amount of the final asset to receive
    /// @param _swaps Array of data used to execute swaps
    /// @param _leftoverReceiver The address to send leftover funds to
    /// @param _nativeReserve Amount of native token to prevent from being swept back to the caller
    function _depositAndSwap(
        bytes32 _transactionId,
        uint256 _minAmount,
        LibSwap.SwapData[] calldata _swaps,
        address payable _leftoverReceiver,
        uint256 _nativeReserve
    ) internal returns (uint256) {
        uint256 numSwaps = _swaps.length;

        if (numSwaps == 0) {
            revert NoSwapDataProvided();
        }

        address finalTokenId = _swaps[numSwaps - 1].receivingAssetId;
        uint256 initialBalance = LibAsset.getOwnBalance(finalTokenId);

        if (LibAsset.isNativeAsset(finalTokenId)) {
            initialBalance -= msg.value;
        }

        uint256[] memory initialBalances = _fetchBalances(_swaps);

        LibAsset.depositAssets(_swaps);
        ReserveData memory rd = ReserveData(
            _transactionId,
            _leftoverReceiver,
            _nativeReserve
        );
        _executeSwaps(rd, _swaps, initialBalances);

        uint256 newBalance = LibAsset.getOwnBalance(finalTokenId) -
            initialBalance;

        if (LibAsset.isNativeAsset(finalTokenId)) {
            newBalance -= _nativeReserve;
        }

        if (newBalance < _minAmount) {
            revert CumulativeSlippageTooHigh(_minAmount, newBalance);
        }

        return newBalance;
    }

    /// Private Methods ///

    /// @dev Executes swaps and checks that DEXs used are in the allowList
    /// @param _transactionId the transaction id associated with the operation
    /// @param _swaps Array of data used to execute swaps
    /// @param _leftoverReceiver Address to send leftover tokens to
    /// @param _initialBalances Array of initial balances
    function _executeSwaps(
        bytes32 _transactionId,
        LibSwap.SwapData[] calldata _swaps,
        address payable _leftoverReceiver,
        uint256[] memory _initialBalances
    ) internal noLeftovers(_swaps, _leftoverReceiver, _initialBalances) {
        uint256 numSwaps = _swaps.length;
        for (uint256 i = 0; i < numSwaps; ) {
            LibSwap.SwapData calldata currentSwap = _swaps[i];

            if (
                !((LibAsset.isNativeAsset(currentSwap.sendingAssetId) ||
                    LibAllowList.contractIsAllowed(currentSwap.approveTo)) &&
                    LibAllowList.contractIsAllowed(currentSwap.callTo) &&
                    LibAllowList.selectorIsAllowed(
                        bytes4(currentSwap.callData[:4])
                    ))
            ) revert ContractCallNotAllowed();

            LibSwap.swap(_transactionId, currentSwap);

            unchecked {
                ++i;
            }
        }
    }

    /// @dev Executes swaps and checks that DEXs used are in the allowList
    /// @param _reserveData Data passed used to reserve native tokens
    /// @param _swaps Array of data used to execute swaps
    function _executeSwaps(
        ReserveData memory _reserveData,
        LibSwap.SwapData[] calldata _swaps,
        uint256[] memory _initialBalances
    )
        internal
        noLeftoversReserve(
            _swaps,
            _reserveData.leftoverReceiver,
            _initialBalances,
            _reserveData.nativeReserve
        )
    {
        uint256 numSwaps = _swaps.length;
        for (uint256 i = 0; i < numSwaps; ) {
            LibSwap.SwapData calldata currentSwap = _swaps[i];

            if (
                !((LibAsset.isNativeAsset(currentSwap.sendingAssetId) ||
                    LibAllowList.contractIsAllowed(currentSwap.approveTo)) &&
                    LibAllowList.contractIsAllowed(currentSwap.callTo) &&
                    LibAllowList.selectorIsAllowed(
                        bytes4(currentSwap.callData[:4])
                    ))
            ) revert ContractCallNotAllowed();

            LibSwap.swap(_reserveData.transactionId, currentSwap);

            unchecked {
                ++i;
            }
        }
    }

    /// @dev Fetches balances of tokens to be swapped before swapping.
    /// @param _swaps Array of data used to execute swaps
    /// @return uint256[] Array of token balances.
    function _fetchBalances(
        LibSwap.SwapData[] calldata _swaps
    ) private view returns (uint256[] memory) {
        uint256 numSwaps = _swaps.length;
        uint256[] memory balances = new uint256[](numSwaps);
        address asset;
        for (uint256 i = 0; i < numSwaps; ) {
            asset = _swaps[i].receivingAssetId;
            balances[i] = LibAsset.getOwnBalance(asset);

            if (LibAsset.isNativeAsset(asset)) {
                balances[i] -= msg.value;
            }

            unchecked {
                ++i;
            }
        }

        return balances;
    }
}

File 16 of 22 : 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 17 of 22 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 18 of 22 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 19 of 22 : 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);
    }
}

File 20 of 22 : LibAllowList.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import { InvalidContract } from "../Errors/GenericErrors.sol";

/// @title Lib Allow List
/// @author LI.FI (https://li.fi)
/// @notice Library for managing and accessing the conract address allow list
library LibAllowList {
    /// Storage ///
    bytes32 internal constant NAMESPACE =
        keccak256("com.lifi.library.allow.list");

    struct AllowListStorage {
        mapping(address => bool) allowlist;
        mapping(bytes4 => bool) selectorAllowList;
        address[] contracts;
    }

    /// @dev Adds a contract address to the allow list
    /// @param _contract the contract address to add
    function addAllowedContract(address _contract) internal {
        _checkAddress(_contract);

        AllowListStorage storage als = _getStorage();

        if (als.allowlist[_contract]) return;

        als.allowlist[_contract] = true;
        als.contracts.push(_contract);
    }

    /// @dev Checks whether a contract address has been added to the allow list
    /// @param _contract the contract address to check
    function contractIsAllowed(
        address _contract
    ) internal view returns (bool) {
        return _getStorage().allowlist[_contract];
    }

    /// @dev Remove a contract address from the allow list
    /// @param _contract the contract address to remove
    function removeAllowedContract(address _contract) internal {
        AllowListStorage storage als = _getStorage();

        if (!als.allowlist[_contract]) {
            return;
        }

        als.allowlist[_contract] = false;

        uint256 length = als.contracts.length;
        // Find the contract in the list
        for (uint256 i = 0; i < length; i++) {
            if (als.contracts[i] == _contract) {
                // Move the last element into the place to delete
                als.contracts[i] = als.contracts[length - 1];
                // Remove the last element
                als.contracts.pop();
                break;
            }
        }
    }

    /// @dev Fetch contract addresses from the allow list
    function getAllowedContracts() internal view returns (address[] memory) {
        return _getStorage().contracts;
    }

    /// @dev Add a selector to the allow list
    /// @param _selector the selector to add
    function addAllowedSelector(bytes4 _selector) internal {
        _getStorage().selectorAllowList[_selector] = true;
    }

    /// @dev Removes a selector from the allow list
    /// @param _selector the selector to remove
    function removeAllowedSelector(bytes4 _selector) internal {
        _getStorage().selectorAllowList[_selector] = false;
    }

    /// @dev Returns if selector has been added to the allow list
    /// @param _selector the selector to check
    function selectorIsAllowed(bytes4 _selector) internal view returns (bool) {
        return _getStorage().selectorAllowList[_selector];
    }

    /// @dev Fetch local storage struct
    function _getStorage()
        internal
        pure
        returns (AllowListStorage storage als)
    {
        bytes32 position = NAMESPACE;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            als.slot := position
        }
    }

    /// @dev Contains business logic for validating a contract address.
    /// @param _contract address of the dex to check
    function _checkAddress(address _contract) private view {
        if (_contract == address(0)) revert InvalidContract();

        if (_contract.code.length == 0) revert InvalidContract();
    }
}

File 21 of 22 : 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 22 of 22 : 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);
    }
}

Settings
{
  "remappings": [
    "@eth-optimism/=node_modules/@hop-protocol/sdk/node_modules/@eth-optimism/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@uniswap/=node_modules/@uniswap/",
    "celer-network/=lib/sgn-v2-contracts/",
    "create3-factory/=lib/create3-factory/src/",
    "ds-test/=lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "eth-gas-reporter/=node_modules/eth-gas-reporter/",
    "forge-std/=lib/forge-std/src/",
    "hardhat-deploy/=node_modules/hardhat-deploy/",
    "hardhat/=node_modules/hardhat/",
    "lifi/=src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "sgn-v2-contracts/=lib/sgn-v2-contracts/contracts/",
    "solmate/=lib/solmate/src/",
    "test/=test/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_wrapper","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"Invalid","type":"error"},{"inputs":[],"name":"NewOwnerMustNotBeSelf","type":"error"},{"inputs":[],"name":"NoNullOwner","type":"error"},{"inputs":[],"name":"NoPendingOwnershipTransfer","type":"error"},{"inputs":[],"name":"NotPendingOwner","type":"error"},{"inputs":[],"name":"NullAddrIsNotAValidSpender","type":"error"},{"inputs":[],"name":"UnAuthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":false,"internalType":"string","name":"integrator","type":"string"},{"indexed":false,"internalType":"string","name":"referrer","type":"string"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"address","name":"fromAssetId","type":"address"},{"indexed":false,"internalType":"address","name":"toAssetId","type":"address"},{"indexed":false,"internalType":"uint256","name":"fromAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toAmount","type":"uint256"}],"name":"LiFiGenericSwapCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes8","name":"_transactionId","type":"bytes8"}],"name":"LiFiHopTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":false,"internalType":"string","name":"integrator","type":"string"},{"indexed":false,"internalType":"string","name":"referrer","type":"string"},{"indexed":false,"internalType":"address","name":"fromAssetId","type":"address"},{"indexed":false,"internalType":"address","name":"toAssetId","type":"address"},{"indexed":false,"internalType":"uint256","name":"fromAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toAmount","type":"uint256"}],"name":"LiFiSwappedGeneric","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":false,"internalType":"address","name":"receivingAssetId","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"LiFiTransferCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":false,"internalType":"address","name":"receivingAssetId","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"LiFiTransferRecovered","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"string","name":"bridge","type":"string"},{"internalType":"string","name":"integrator","type":"string"},{"internalType":"address","name":"referrer","type":"address"},{"internalType":"address","name":"sendingAssetId","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bool","name":"hasSourceSwaps","type":"bool"},{"internalType":"bool","name":"hasDestinationCall","type":"bool"}],"indexed":false,"internalType":"struct ILiFi.BridgeData","name":"bridgeData","type":"tuple"}],"name":"LiFiTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"}],"name":"OwnershipTransferRequested","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"},{"inputs":[],"name":"cancelOwnershipTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"confirmOwnershipTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"decode_startBridgeTokensViaHopL1ERC20Packed","outputs":[{"components":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"string","name":"bridge","type":"string"},{"internalType":"string","name":"integrator","type":"string"},{"internalType":"address","name":"referrer","type":"address"},{"internalType":"address","name":"sendingAssetId","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bool","name":"hasSourceSwaps","type":"bool"},{"internalType":"bool","name":"hasDestinationCall","type":"bool"}],"internalType":"struct ILiFi.BridgeData","name":"","type":"tuple"},{"components":[{"internalType":"uint256","name":"bonderFee","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"destinationAmountOutMin","type":"uint256"},{"internalType":"uint256","name":"destinationDeadline","type":"uint256"},{"internalType":"contract IHopBridge","name":"hopBridge","type":"address"},{"internalType":"address","name":"relayer","type":"address"},{"internalType":"uint256","name":"relayerFee","type":"uint256"},{"internalType":"uint256","name":"nativeFee","type":"uint256"}],"internalType":"struct HopFacetOptimized.HopData","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"decode_startBridgeTokensViaHopL1NativePacked","outputs":[{"components":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"string","name":"bridge","type":"string"},{"internalType":"string","name":"integrator","type":"string"},{"internalType":"address","name":"referrer","type":"address"},{"internalType":"address","name":"sendingAssetId","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bool","name":"hasSourceSwaps","type":"bool"},{"internalType":"bool","name":"hasDestinationCall","type":"bool"}],"internalType":"struct ILiFi.BridgeData","name":"","type":"tuple"},{"components":[{"internalType":"uint256","name":"bonderFee","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"destinationAmountOutMin","type":"uint256"},{"internalType":"uint256","name":"destinationDeadline","type":"uint256"},{"internalType":"contract IHopBridge","name":"hopBridge","type":"address"},{"internalType":"address","name":"relayer","type":"address"},{"internalType":"uint256","name":"relayerFee","type":"uint256"},{"internalType":"uint256","name":"nativeFee","type":"uint256"}],"internalType":"struct HopFacetOptimized.HopData","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"decode_startBridgeTokensViaHopL2ERC20Packed","outputs":[{"components":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"string","name":"bridge","type":"string"},{"internalType":"string","name":"integrator","type":"string"},{"internalType":"address","name":"referrer","type":"address"},{"internalType":"address","name":"sendingAssetId","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bool","name":"hasSourceSwaps","type":"bool"},{"internalType":"bool","name":"hasDestinationCall","type":"bool"}],"internalType":"struct ILiFi.BridgeData","name":"","type":"tuple"},{"components":[{"internalType":"uint256","name":"bonderFee","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"destinationAmountOutMin","type":"uint256"},{"internalType":"uint256","name":"destinationDeadline","type":"uint256"},{"internalType":"contract IHopBridge","name":"hopBridge","type":"address"},{"internalType":"address","name":"relayer","type":"address"},{"internalType":"uint256","name":"relayerFee","type":"uint256"},{"internalType":"uint256","name":"nativeFee","type":"uint256"}],"internalType":"struct HopFacetOptimized.HopData","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"decode_startBridgeTokensViaHopL2NativePacked","outputs":[{"components":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"string","name":"bridge","type":"string"},{"internalType":"string","name":"integrator","type":"string"},{"internalType":"address","name":"referrer","type":"address"},{"internalType":"address","name":"sendingAssetId","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bool","name":"hasSourceSwaps","type":"bool"},{"internalType":"bool","name":"hasDestinationCall","type":"bool"}],"internalType":"struct ILiFi.BridgeData","name":"","type":"tuple"},{"components":[{"internalType":"uint256","name":"bonderFee","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"destinationAmountOutMin","type":"uint256"},{"internalType":"uint256","name":"destinationDeadline","type":"uint256"},{"internalType":"contract IHopBridge","name":"hopBridge","type":"address"},{"internalType":"address","name":"relayer","type":"address"},{"internalType":"uint256","name":"relayerFee","type":"uint256"},{"internalType":"uint256","name":"nativeFee","type":"uint256"}],"internalType":"struct HopFacetOptimized.HopData","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes8","name":"transactionId","type":"bytes8"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"address","name":"sendingAssetId","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"destinationAmountOutMin","type":"uint256"},{"internalType":"address","name":"relayer","type":"address"},{"internalType":"uint256","name":"relayerFee","type":"uint256"},{"internalType":"address","name":"hopBridge","type":"address"}],"name":"encode_startBridgeTokensViaHopL1ERC20Packed","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes8","name":"transactionId","type":"bytes8"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"uint256","name":"destinationAmountOutMin","type":"uint256"},{"internalType":"address","name":"relayer","type":"address"},{"internalType":"uint256","name":"relayerFee","type":"uint256"},{"internalType":"address","name":"hopBridge","type":"address"}],"name":"encode_startBridgeTokensViaHopL1NativePacked","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"address","name":"sendingAssetId","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"bonderFee","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint256","name":"destinationAmountOutMin","type":"uint256"},{"internalType":"uint256","name":"destinationDeadline","type":"uint256"},{"internalType":"address","name":"wrapper","type":"address"}],"name":"encode_startBridgeTokensViaHopL2ERC20Packed","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes8","name":"transactionId","type":"bytes8"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"uint256","name":"bonderFee","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"}],"name":"encode_startBridgeTokensViaHopL2NativePacked","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"nativeBridge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeExchangeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeHToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeL2CanonicalToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"bridges","type":"address[]"},{"internalType":"address[]","name":"tokensToApprove","type":"address[]"}],"name":"setApprovalForHopBridges","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes8","name":"transactionId","type":"bytes8"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"address","name":"sendingAssetId","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"destinationAmountOutMin","type":"uint256"},{"internalType":"address","name":"relayer","type":"address"},{"internalType":"uint256","name":"relayerFee","type":"uint256"},{"internalType":"address","name":"hopBridge","type":"address"}],"name":"startBridgeTokensViaHopL1ERC20Min","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startBridgeTokensViaHopL1ERC20Packed","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes8","name":"transactionId","type":"bytes8"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"uint256","name":"destinationAmountOutMin","type":"uint256"},{"internalType":"address","name":"relayer","type":"address"},{"internalType":"uint256","name":"relayerFee","type":"uint256"},{"internalType":"address","name":"hopBridge","type":"address"}],"name":"startBridgeTokensViaHopL1NativeMin","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"startBridgeTokensViaHopL1NativePacked","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes8","name":"transactionId","type":"bytes8"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"address","name":"sendingAssetId","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"bonderFee","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint256","name":"destinationAmountOutMin","type":"uint256"},{"internalType":"uint256","name":"destinationDeadline","type":"uint256"},{"internalType":"address","name":"hopBridge","type":"address"}],"name":"startBridgeTokensViaHopL2ERC20Min","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startBridgeTokensViaHopL2ERC20Packed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes8","name":"transactionId","type":"bytes8"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"uint256","name":"bonderFee","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint256","name":"destinationAmountOutMin","type":"uint256"},{"internalType":"uint256","name":"destinationDeadline","type":"uint256"},{"internalType":"address","name":"hopBridge","type":"address"}],"name":"startBridgeTokensViaHopL2NativeMin","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"startBridgeTokensViaHopL2NativePacked","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101006040523480156200001257600080fd5b5060405162004654380380620046548339810160408190526200003591620002a9565b600080546001600160a01b0319166001600160a01b038481169190911790915581161515466001148015620000675750805b156200008657604051636dac6a0960e01b815260040160405180910390fd5b8062000094576000620000f9565b816001600160a01b0316631ee1bf676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000d3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000f99190620002e1565b6001600160a01b031660a052806200011357600062000178565b816001600160a01b031663fc6e3b3b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000152573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001789190620002e1565b6001600160a01b031660c0528062000192576000620001f7565b816001600160a01b0316639cd016056040518163ffffffff1660e01b8152600401602060405180830381865afa158015620001d1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001f79190620002e1565b6001600160a01b031660e052806200021157600062000276565b816001600160a01b031663e78cea926040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000250573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002769190620002e1565b6001600160a01b03166080525062000306915050565b80516001600160a01b0381168114620002a457600080fd5b919050565b60008060408385031215620002bd57600080fd5b620002c8836200028c565b9150620002d8602084016200028c565b90509250929050565b600060208284031215620002f457600080fd5b620002ff826200028c565b9392505050565b60805160a05160c05160e0516142ff62000355600039600081816103900152610921015260006102c501526000818161032701526108580152600081816101dd01526109be01526142ff6000f3fe6080604052600436106101a15760003560e01c806376e04bbc116100e1578063c5ae0fe61161008a578063e30c397811610064578063e30c397814610487578063e8bd0564146104b4578063f2fde38b146104d4578063fc1ebe3e146104f457600080fd5b8063c5ae0fe61461043f578063c5e04e3014610454578063cda5f3241461046757600080fd5b8063ad6607ff116100bb578063ad6607ff146103df578063bd6d15ca146103ff578063c18fa2451461041f57600080fd5b806376e04bbc1461035e5780637cccba6d1461037e5780638da5cb5b146103b257600080fd5b806333619a2d1161014e5780634bd751a8116101285780634bd751a8146102b357806354de26d9146102e75780636c225efe146103155780637200b8291461034957600080fd5b806333619a2d1461026b5780633c580fed146102735780634b06e05f1461029357600080fd5b80631a0b79bf1161017f5780631a0b79bf146101cb57806323452b9c1461022957806326a931351461023e57600080fd5b806304c5aa34146101a65780631223354c146101bb578063161be542146101c3575b600080fd5b6101b96101b4366004613aa9565b610514565b005b6101b961062f565b6101b9610800565b3480156101d757600080fd5b506101ff7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561023557600080fd5b506101b9610b56565b34801561024a57600080fd5b5061025e610259366004613b23565b610c20565b6040516102209190613c0a565b6101b9610f0a565b34801561027f57600080fd5b506101b961028e366004613c62565b611121565b34801561029f57600080fd5b506101b96102ae366004613cce565b61120f565b3480156102bf57600080fd5b506101ff7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102f357600080fd5b50610307610302366004613d64565b611365565b604051610220929190613dd6565b34801561032157600080fd5b506101ff7f000000000000000000000000000000000000000000000000000000000000000081565b34801561035557600080fd5b506101b9611655565b34801561036a57600080fd5b506101b9610379366004613f2c565b61173b565b34801561038a57600080fd5b506101ff7f000000000000000000000000000000000000000000000000000000000000000081565b3480156103be57600080fd5b506000546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156103eb57600080fd5b5061025e6103fa366004613fc4565b611871565b34801561040b57600080fd5b5061030761041a366004613d64565b611d49565b34801561042b57600080fd5b5061030761043a366004613d64565b6120b3565b34801561044b57600080fd5b506101b96123c3565b6101b9610462366004613b23565b61279c565b34801561047357600080fd5b5061025e610482366004613ff6565b6128d5565b34801561049357600080fd5b506001546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156104c057600080fd5b5061025e6104cf366004613cce565b612baa565b3480156104e057600080fd5b506101b96104ef366004614045565b612f41565b34801561050057600080fd5b5061030761050f366004613d64565b61309f565b6040517feea0d7b20000000000000000000000000000000000000000000000000000000081526004810187905273ffffffffffffffffffffffffffffffffffffffff8881166024830152346044830181905260648301889052608483018790524260a484015260c4830186905260e483018590529083169163eea0d7b29190610104016000604051808303818588803b1580156105b057600080fd5b505af11580156105c4573d6000803e3d6000fd5b50506040517fffffffffffffffff0000000000000000000000000000000000000000000000008c1681527fad635460888489be07731050101b47548c6a3831f2dc51f2b3545696d0b8afd79350602001915061061d9050565b60405180910390a15050505050505050565b61063e606c6058366000614062565b6106479161408c565b60601c63deace8f53461065f60246020366000614062565b610668916140d4565b60e01c61067a6020600c366000614062565b6106839161408c565b60601c3461069660346024366000614062565b61069f9161411a565b60801c6106af4262093a8061418f565b6106be60486034366000614062565b6106c79161408c565b60601c6106d960586048366000614062565b6106e29161411a565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e08b901b168152600481019790975273ffffffffffffffffffffffffffffffffffffffff958616602488015260448701949094526064860192909252608485015290911660a483015260801c60c482015260e4016000604051808303818588803b15801561077457600080fd5b505af1158015610788573d6000803e3d6000fd5b507fad635460888489be07731050101b47548c6a3831f2dc51f2b3545696d0b8afd793506107c19250600c915060049050366000614062565b6107ca916141a8565b6040517fffffffffffffffff000000000000000000000000000000000000000000000000909116815260200160405180910390a1565b6000610810602460203684614062565b610819916140d4565b60e01c9050600061082e604460343684614062565b6108379161411a565b60801c6fffffffffffffffffffffffffffffffff16905060008260011490507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156108be57600080fd5b505af11580156108d2573d6000803e3d6000fd5b50506040517f91695586000000000000000000000000000000000000000000000000000000008152600060048201819052600160248301523460448301526064820187905242608483015293507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1692506391695586915060a4016020604051808303816000875af1158015610981573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a591906141ee565b905073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001663a6bd1b33856109f36020600c366000614062565b6109fc9161408c565b60601c84610a0f60346024366000614062565b610a189161411a565b60801c87610a265788610a29565b60005b88610a4057610a3b4262093a8061418f565b610a43565b60005b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b168152600481019690965273ffffffffffffffffffffffffffffffffffffffff909416602486015260448501929092526064840152608483015260a482015260c401600060405180830381600087803b158015610ac857600080fd5b505af1158015610adc573d6000803e3d6000fd5b507fad635460888489be07731050101b47548c6a3831f2dc51f2b3545696d0b8afd79250610b139150600c90506004366000614062565b610b1c916141a8565b6040517fffffffffffffffff000000000000000000000000000000000000000000000000909116815260200160405180910390a150505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ba7576040517fbe24598300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015473ffffffffffffffffffffffffffffffffffffffff16610bf6576040517f75cdea1200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b606063ffffffff861115610cbb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f64657374696e6174696f6e436861696e49642076616c7565207061737365642060448201527f746f6f2062696720746f2066697420696e2075696e743332000000000000000060648201526084015b60405180910390fd5b6fffffffffffffffffffffffffffffffff851115610d5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603e60248201527f64657374696e6174696f6e416d6f756e744f75744d696e2076616c756520706160448201527f7373656420746f6f2062696720746f2066697420696e2075696e7431323800006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff831115610dfb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f72656c617965724665652076616c75652070617373656420746f6f206269672060448201527f746f2066697420696e2075696e743132380000000000000000000000000000006064820152608401610cb2565b50604080517f1223354c0000000000000000000000000000000000000000000000000000000060208201527fffffffffffffffff000000000000000000000000000000000000000000000000989098166024890152606096871b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000908116602c8a015260e09690961b7fffffffff000000000000000000000000000000000000000000000000000000001688820152608094851b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000090811660448a015293871b861660548901529190931b9091166068860152921b1660788301528051606c818403018152608c909201905290565b6000610f1a604860383684614062565b610f239161411a565b60801c9050610f51333083610f3d60386024366000614062565b610f469161408c565b60601c92919061338a565b610f606090607c366000614062565b610f699161408c565b60601c63deace8f5610f8060246020366000614062565b610f89916140d4565b60e01c610f9b6020600c366000614062565b610fa49161408c565b60601c84610fb760586048366000614062565b610fc09161411a565b60801c610fd04262093a8061418f565b610fdf606c6058366000614062565b610fe89161408c565b60601c610ffa607c606c366000614062565b6110039161411a565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b168152600481019790975273ffffffffffffffffffffffffffffffffffffffff958616602488015260448701949094526064860192909252608485015290911660a483015260801c60c482015260e401600060405180830381600087803b15801561109657600080fd5b505af11580156110aa573d6000803e3d6000fd5b507fad635460888489be07731050101b47548c6a3831f2dc51f2b3545696d0b8afd792506110e19150600c90506004366000614062565b6110ea916141a8565b6040517fffffffffffffffff000000000000000000000000000000000000000000000000909116815260200160405180910390a150565b60005473ffffffffffffffffffffffffffffffffffffffff163314611172576040517fbe24598300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8260005b81811015611207576111f584848381811061119357611193614207565b90506020020160208101906111a89190614045565b8787848181106111ba576111ba614207565b90506020020160208101906111cf9190614045565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613450565b806111ff81614236565b915050611176565b505050505050565b61123173ffffffffffffffffffffffffffffffffffffffff871633308861338a565b73ffffffffffffffffffffffffffffffffffffffff811663deace8f5888a888861125e4262093a8061418f565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e088901b168152600481019590955273ffffffffffffffffffffffffffffffffffffffff9384166024860152604485019290925260648401526084830152861660a482015260c4810185905260e401600060405180830381600087803b1580156112ec57600080fd5b505af1158015611300573d6000803e3d6000fd5b50506040517fffffffffffffffff0000000000000000000000000000000000000000000000008c1681527fad635460888489be07731050101b47548c6a3831f2dc51f2b3545696d0b8afd79250602001905060405180910390a1505050505050505050565b604080516101408101825260008082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101919091526114326040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b606c8310156114c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f646174612070617373656420696e206973206e6f742074686520636f7272656360448201527f74206c656e6774680000000000000000000000000000000000000000000000006064820152608401610cb2565b604080516101408101825260008082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101919091526115906040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b61159e600c60048789614062565b6115a7916141a8565b7fffffffffffffffff0000000000000000000000000000000000000000000000001682526115d96020600c8789614062565b6115e29161408c565b60601c60a08301526115f8602460208789614062565b611601916140d4565b60e090811c90830152611618603460248789614062565b6116219161411a565b60801c6060820152611637606c60588789614062565b6116409161408c565b60601c60a082015290925090505b9250929050565b60015473ffffffffffffffffffffffffffffffffffffffff163381146116a7576040517f1853971c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff9092167fffffffffffffffffffffffff0000000000000000000000000000000000000000928316179055600180549091169055565b61175d73ffffffffffffffffffffffffffffffffffffffff881633308961338a565b6040517feea0d7b20000000000000000000000000000000000000000000000000000000081526004810189905273ffffffffffffffffffffffffffffffffffffffff8a811660248301526044820188905260648201879052608482018690524260a483015260c4820185905260e4820184905282169063eea0d7b29061010401600060405180830381600087803b1580156117f757600080fd5b505af115801561180b573d6000803e3d6000fd5b50506040517fffffffffffffffff0000000000000000000000000000000000000000000000008d1681527fad635460888489be07731050101b47548c6a3831f2dc51f2b3545696d0b8afd79250602001905060405180910390a150505050505050505050565b606063ffffffff891115611907576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f64657374696e6174696f6e436861696e49642076616c7565207061737365642060448201527f746f6f2062696720746f2066697420696e2075696e74333200000000000000006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff8711156119a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f616d6f756e742076616c75652070617373656420746f6f2062696720746f206660448201527f697420696e2075696e74313238000000000000000000000000000000000000006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff861115611a47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f626f6e6465724665652076616c75652070617373656420746f6f20626967207460448201527f6f2066697420696e2075696e74313238000000000000000000000000000000006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff851115611ae7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f616d6f756e744f75744d696e2076616c75652070617373656420746f6f20626960448201527f6720746f2066697420696e2075696e74313238000000000000000000000000006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff841115611b87576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603e60248201527f64657374696e6174696f6e416d6f756e744f75744d696e2076616c756520706160448201527f7373656420746f6f2062696720746f2066697420696e2075696e7431323800006064820152608401610cb2565b63ffffffff831115611c1b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f64657374696e6174696f6e446561646c696e652076616c75652070617373656460448201527f20746f6f2062696720746f2066697420696e2075696e743332000000000000006064820152608401610cb2565b50604080517fc5ae0fe60000000000000000000000000000000000000000000000000000000060208201527fffffffffffffffff0000000000000000000000000000000000000000000000009b909b1660248c01527fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060609a8b1b8116602c8d01527fffffffff0000000000000000000000000000000000000000000000000000000060e09a8b1b81168d840152988b1b811660448d01527fffffffffffffffffffffffffffffffff00000000000000000000000000000000608098891b811660588e015296881b871660688d015294871b861660788c01529290951b90931660888901529190941b909216609886015290921b16609c8301528051808303609001815260b0909201905290565b604080516101408101825260008082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810191909152611e166040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b6090831015611ea7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f646174612070617373656420696e206973206e6f742074686520636f7272656360448201527f74206c656e6774680000000000000000000000000000000000000000000000006064820152608401610cb2565b604080516101408101825260008082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810191909152611f746040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b611f82600c60048789614062565b611f8b916141a8565b7fffffffffffffffff000000000000000000000000000000000000000000000000168252611fbd6020600c8789614062565b611fc69161408c565b60601c60a0830152611fdc602460208789614062565b611fe5916140d4565b60e090811c90830152611ffc603860248789614062565b6120059161408c565b60601c608083015261201b604860388789614062565b6120249161411a565b60801c60c083015261203a605860488789614062565b6120439161411a565b60801c8152612056606860588789614062565b61205f9161411a565b60801c6020820152612075607860688789614062565b61207e9161411a565b60801c6060820152612094607c60788789614062565b61209d916140d4565b60e01c60808201526116376090607c8789614062565b604080516101408101825260008082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101919091526121806040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b6090831015612211576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f646174612070617373656420696e206973206e6f742074686520636f7272656360448201527f74206c656e6774680000000000000000000000000000000000000000000000006064820152608401610cb2565b604080516101408101825260008082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101919091526122de6040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b6122ec600c60048789614062565b6122f5916141a8565b7fffffffffffffffff0000000000000000000000000000000000000000000000001682526123276020600c8789614062565b6123309161408c565b60601c60a0830152612346602460208789614062565b61234f916140d4565b60e090811c90830152612366603860248789614062565b61236f9161408c565b60601c6080830152612385604860388789614062565b61238e9161411a565b60801c60c08301526123a4605860488789614062565b6123ad9161411a565b60801c60608201526116376090607c8789614062565b60006123d3602460203684614062565b6123dc916140d4565b60e01c905060006123f1604860383684614062565b6123fa9161411a565b60801c9050600061240f606860583684614062565b6124189161411a565b60801c90506001831460006124316090607c3684614062565b61243a9161408c565b60601c9050612454333086610f3d60386024366000614062565b60008173ffffffffffffffffffffffffffffffffffffffff16639cd016056040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124c5919061426e565b6040517f916955860000000000000000000000000000000000000000000000000000000081526000600482015260016024820152604481018790526064810186905242608482015273ffffffffffffffffffffffffffffffffffffffff919091169063916955869060a4016020604051808303816000875af115801561254f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257391906141ee565b90508173ffffffffffffffffffffffffffffffffffffffff1663e78cea926040518163ffffffff1660e01b8152600401602060405180830381865afa1580156125c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125e4919061426e565b73ffffffffffffffffffffffffffffffffffffffff1663a6bd1b338761260f6020600c366000614062565b6126189161408c565b60601c8461262b60586048366000614062565b6126349161411a565b60801c8861265c5761264b60786068366000614062565b6126549161411a565b60801c61265f565b60005b8961268457612673607c6078366000614062565b61267c916140d4565b60e01c612687565b60005b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b168152600481019690965273ffffffffffffffffffffffffffffffffffffffff909416602486015260448501929092526064840152608483015260a482015260c401600060405180830381600087803b15801561270c57600080fd5b505af1158015612720573d6000803e3d6000fd5b507fad635460888489be07731050101b47548c6a3831f2dc51f2b3545696d0b8afd792506127579150600c90506004366000614062565b612760916141a8565b6040517fffffffffffffffff000000000000000000000000000000000000000000000000909116815260200160405180910390a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff811663deace8f534878982896127ca4262093a8061418f565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b168152600481019590955273ffffffffffffffffffffffffffffffffffffffff9384166024860152604485019290925260648401526084830152871660a482015260c4810186905260e4016000604051808303818588803b15801561285757600080fd5b505af115801561286b573d6000803e3d6000fd5b50506040517fffffffffffffffff0000000000000000000000000000000000000000000000008b1681527fad635460888489be07731050101b47548c6a3831f2dc51f2b3545696d0b8afd7935060200191506128c49050565b60405180910390a150505050505050565b606063ffffffff84111561296b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f64657374696e6174696f6e436861696e49642076616c7565207061737365642060448201527f746f6f2062696720746f2066697420696e2075696e74333200000000000000006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff831115612a0b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f626f6e6465724665652076616c75652070617373656420746f6f20626967207460448201527f6f2066697420696e2075696e74313238000000000000000000000000000000006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff821115612aab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f616d6f756e744f75744d696e2076616c75652070617373656420746f6f20626960448201527f6720746f2066697420696e2075696e74313238000000000000000000000000006064820152608401610cb2565b604080517f161be5420000000000000000000000000000000000000000000000000000000060208201527fffffffffffffffff000000000000000000000000000000000000000000000000881660248201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b16602c8201527fffffffff0000000000000000000000000000000000000000000000000000000060e087901b16918101919091527fffffffffffffffffffffffffffffffff00000000000000000000000000000000608085811b8216604484015284901b166054820152606401604051602081830303815290604052905095945050505050565b606063ffffffff881115612c40576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f64657374696e6174696f6e436861696e49642076616c7565207061737365642060448201527f746f6f2062696720746f2066697420696e2075696e74333200000000000000006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff861115612ce0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f616d6f756e742076616c75652070617373656420746f6f2062696720746f206660448201527f697420696e2075696e74313238000000000000000000000000000000000000006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff851115612d80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603e60248201527f64657374696e6174696f6e416d6f756e744f75744d696e2076616c756520706160448201527f7373656420746f6f2062696720746f2066697420696e2075696e7431323800006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff831115612e20576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f72656c617965724665652076616c75652070617373656420746f6f206269672060448201527f746f2066697420696e2075696e743132380000000000000000000000000000006064820152608401610cb2565b50604080517f33619a2d0000000000000000000000000000000000000000000000000000000060208201527fffffffffffffffff0000000000000000000000000000000000000000000000009a909a1660248b0152606098891b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000908116602c8c015260e09890981b7fffffffff00000000000000000000000000000000000000000000000000000000168a82015295881b871660448a0152608094851b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000090811660588b015293851b841660688a015291871b8616607889015290921b16608c86015290921b16609c8301528051609081840301815260b0909201905290565b60005473ffffffffffffffffffffffffffffffffffffffff163314612f92576040517fbe24598300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116612fdf576040517f1beca37400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff82160361302e576040517fbf1ea9fb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831690811790915560405133907fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae127890600090a350565b604080516101408101825260008082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081019190915261316c6040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b60448310156131fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f646174612070617373656420696e206973206e6f742074686520636f7272656360448201527f74206c656e6774680000000000000000000000000000000000000000000000006064820152608401610cb2565b604080516101408101825260008082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101919091526132ca6040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b6132d8600c60048789614062565b6132e1916141a8565b7fffffffffffffffff0000000000000000000000000000000000000000000000001682526133136020600c8789614062565b61331c9161408c565b60601c60a0830152613332602460208789614062565b61333b916140d4565b60e090811c90830152613352603460248789614062565b61335b9161411a565b60801c815261336e604460348789614062565b6133779161411a565b60801c6020820152909590945092505050565b60006040517f23b872dd0000000000000000000000000000000000000000000000000000000081528460048201528360248201528260448201526020600060648360008a5af13d15601f3d1160016000511416171691505080613449576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610cb2565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff831661347057505050565b73ffffffffffffffffffffffffffffffffffffffff82166134bd576040517f63ba9bff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015282919085169063dd62ed3e90604401602060405180830381865afa158015613532573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061355691906141ee565b10156135935761356883836000613598565b61359383837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613598565b505050565b80158061363857506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e90604401602060405180830381865afa158015613612573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061363691906141ee565b155b6136c4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610cb2565b6040805173ffffffffffffffffffffffffffffffffffffffff848116602483015260448083018590528351808403909101815260649092018352602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908401526135939286929160009161378f91851690849061383c565b90508051600014806137b05750808060200190518101906137b0919061428b565b613593576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610cb2565b606061384b8484600085613855565b90505b9392505050565b6060824710156138e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610cb2565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161391091906142ad565b60006040518083038185875af1925050503d806000811461394d576040519150601f19603f3d011682016040523d82523d6000602084013e613952565b606091505b509150915061396387838387613970565b925050505b949350505050565b60608315613a065782516000036139ff5773ffffffffffffffffffffffffffffffffffffffff85163b6139ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610cb2565b5081613968565b6139688383815115613a1b5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb29190613c0a565b80357fffffffffffffffff00000000000000000000000000000000000000000000000081168114613a7f57600080fd5b919050565b73ffffffffffffffffffffffffffffffffffffffff81168114613aa657600080fd5b50565b600080600080600080600080610100898b031215613ac657600080fd5b613acf89613a4f565b97506020890135613adf81613a84565b965060408901359550606089013594506080890135935060a0890135925060c0890135915060e0890135613b1281613a84565b809150509295985092959890939650565b600080600080600080600060e0888a031215613b3e57600080fd5b613b4788613a4f565b96506020880135613b5781613a84565b955060408801359450606088013593506080880135613b7581613a84565b925060a0880135915060c0880135613b8c81613a84565b8091505092959891949750929550565b60005b83811015613bb7578181015183820152602001613b9f565b50506000910152565b60008151808452613bd8816020860160208601613b9c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061384e6020830184613bc0565b60008083601f840112613c2f57600080fd5b50813567ffffffffffffffff811115613c4757600080fd5b6020830191508360208260051b850101111561164e57600080fd5b60008060008060408587031215613c7857600080fd5b843567ffffffffffffffff80821115613c9057600080fd5b613c9c88838901613c1d565b90965094506020870135915080821115613cb557600080fd5b50613cc287828801613c1d565b95989497509550505050565b60008060008060008060008060006101208a8c031215613ced57600080fd5b613cf68a613a4f565b985060208a0135613d0681613a84565b975060408a0135965060608a0135613d1d81613a84565b955060808a0135945060a08a0135935060c08a0135613d3b81613a84565b925060e08a013591506101008a0135613d5381613a84565b809150509295985092959850929598565b60008060208385031215613d7757600080fd5b823567ffffffffffffffff80821115613d8f57600080fd5b818501915085601f830112613da357600080fd5b813581811115613db257600080fd5b866020828501011115613dc457600080fd5b60209290920196919550909350505050565b6000610140808352845181840152602085015181610160850152613dfe610280850182613bc0565b91505060408501517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec084830301610180850152613e3b8282613bc0565b9150506060850151613e666101a085018273ffffffffffffffffffffffffffffffffffffffff169052565b5060808581015173ffffffffffffffffffffffffffffffffffffffff9081166101c086015260a08088015182166101e087015260c08089015161020088015260e0808a0151610220890152610100808b015115156102408a0152610120808c015115156102608b01528a516020808c01919091528b01516040808c01919091528b01516060808c01919091528b01518a880152958a0151848a0152928901518416828901529088015190921682870152908601518186015285015190840152905061384e565b6000806000806000806000806000806101408b8d031215613f4c57600080fd5b613f558b613a4f565b995060208b0135613f6581613a84565b985060408b0135975060608b0135613f7c81613a84565b965060808b0135955060a08b0135945060c08b0135935060e08b013592506101008b013591506101208b0135613fb181613a84565b809150509295989b9194979a5092959850565b6000806000806000806000806000806101408b8d031215613fe457600080fd5b8a35995060208b0135613f6581613a84565b600080600080600060a0868803121561400e57600080fd5b61401786613a4f565b9450602086013561402781613a84565b94979496505050506040830135926060810135926080909101359150565b60006020828403121561405757600080fd5b813561384e81613a84565b6000808585111561407257600080fd5b8386111561407f57600080fd5b5050820193919092039150565b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000081358181169160148510156140cc5780818660140360031b1b83161692505b505092915050565b7fffffffff0000000000000000000000000000000000000000000000000000000081358181169160048510156140cc5760049490940360031b84901b1690921692915050565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000081358181169160108510156140cc5760109490940360031b84901b1690921692915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156141a2576141a2614160565b92915050565b7fffffffffffffffff00000000000000000000000000000000000000000000000081358181169160088510156140cc5760089490940360031b84901b1690921692915050565b60006020828403121561420057600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361426757614267614160565b5060010190565b60006020828403121561428057600080fd5b815161384e81613a84565b60006020828403121561429d57600080fd5b8151801515811461384e57600080fd5b600082516142bf818460208701613b9c565b919091019291505056fea264697066735822122089637cfe69860f8bf379a07a178fabdcc759ff28e08be269a1ed6e52ac52fd6764736f6c6343000811003300000000000000000000000011f11121df7256c40339393b0fb045321022ce440000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106101a15760003560e01c806376e04bbc116100e1578063c5ae0fe61161008a578063e30c397811610064578063e30c397814610487578063e8bd0564146104b4578063f2fde38b146104d4578063fc1ebe3e146104f457600080fd5b8063c5ae0fe61461043f578063c5e04e3014610454578063cda5f3241461046757600080fd5b8063ad6607ff116100bb578063ad6607ff146103df578063bd6d15ca146103ff578063c18fa2451461041f57600080fd5b806376e04bbc1461035e5780637cccba6d1461037e5780638da5cb5b146103b257600080fd5b806333619a2d1161014e5780634bd751a8116101285780634bd751a8146102b357806354de26d9146102e75780636c225efe146103155780637200b8291461034957600080fd5b806333619a2d1461026b5780633c580fed146102735780634b06e05f1461029357600080fd5b80631a0b79bf1161017f5780631a0b79bf146101cb57806323452b9c1461022957806326a931351461023e57600080fd5b806304c5aa34146101a65780631223354c146101bb578063161be542146101c3575b600080fd5b6101b96101b4366004613aa9565b610514565b005b6101b961062f565b6101b9610800565b3480156101d757600080fd5b506101ff7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561023557600080fd5b506101b9610b56565b34801561024a57600080fd5b5061025e610259366004613b23565b610c20565b6040516102209190613c0a565b6101b9610f0a565b34801561027f57600080fd5b506101b961028e366004613c62565b611121565b34801561029f57600080fd5b506101b96102ae366004613cce565b61120f565b3480156102bf57600080fd5b506101ff7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102f357600080fd5b50610307610302366004613d64565b611365565b604051610220929190613dd6565b34801561032157600080fd5b506101ff7f000000000000000000000000000000000000000000000000000000000000000081565b34801561035557600080fd5b506101b9611655565b34801561036a57600080fd5b506101b9610379366004613f2c565b61173b565b34801561038a57600080fd5b506101ff7f000000000000000000000000000000000000000000000000000000000000000081565b3480156103be57600080fd5b506000546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156103eb57600080fd5b5061025e6103fa366004613fc4565b611871565b34801561040b57600080fd5b5061030761041a366004613d64565b611d49565b34801561042b57600080fd5b5061030761043a366004613d64565b6120b3565b34801561044b57600080fd5b506101b96123c3565b6101b9610462366004613b23565b61279c565b34801561047357600080fd5b5061025e610482366004613ff6565b6128d5565b34801561049357600080fd5b506001546101ff9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156104c057600080fd5b5061025e6104cf366004613cce565b612baa565b3480156104e057600080fd5b506101b96104ef366004614045565b612f41565b34801561050057600080fd5b5061030761050f366004613d64565b61309f565b6040517feea0d7b20000000000000000000000000000000000000000000000000000000081526004810187905273ffffffffffffffffffffffffffffffffffffffff8881166024830152346044830181905260648301889052608483018790524260a484015260c4830186905260e483018590529083169163eea0d7b29190610104016000604051808303818588803b1580156105b057600080fd5b505af11580156105c4573d6000803e3d6000fd5b50506040517fffffffffffffffff0000000000000000000000000000000000000000000000008c1681527fad635460888489be07731050101b47548c6a3831f2dc51f2b3545696d0b8afd79350602001915061061d9050565b60405180910390a15050505050505050565b61063e606c6058366000614062565b6106479161408c565b60601c63deace8f53461065f60246020366000614062565b610668916140d4565b60e01c61067a6020600c366000614062565b6106839161408c565b60601c3461069660346024366000614062565b61069f9161411a565b60801c6106af4262093a8061418f565b6106be60486034366000614062565b6106c79161408c565b60601c6106d960586048366000614062565b6106e29161411a565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e08b901b168152600481019790975273ffffffffffffffffffffffffffffffffffffffff958616602488015260448701949094526064860192909252608485015290911660a483015260801c60c482015260e4016000604051808303818588803b15801561077457600080fd5b505af1158015610788573d6000803e3d6000fd5b507fad635460888489be07731050101b47548c6a3831f2dc51f2b3545696d0b8afd793506107c19250600c915060049050366000614062565b6107ca916141a8565b6040517fffffffffffffffff000000000000000000000000000000000000000000000000909116815260200160405180910390a1565b6000610810602460203684614062565b610819916140d4565b60e01c9050600061082e604460343684614062565b6108379161411a565b60801c6fffffffffffffffffffffffffffffffff16905060008260011490507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156108be57600080fd5b505af11580156108d2573d6000803e3d6000fd5b50506040517f91695586000000000000000000000000000000000000000000000000000000008152600060048201819052600160248301523460448301526064820187905242608483015293507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1692506391695586915060a4016020604051808303816000875af1158015610981573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a591906141ee565b905073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001663a6bd1b33856109f36020600c366000614062565b6109fc9161408c565b60601c84610a0f60346024366000614062565b610a189161411a565b60801c87610a265788610a29565b60005b88610a4057610a3b4262093a8061418f565b610a43565b60005b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b168152600481019690965273ffffffffffffffffffffffffffffffffffffffff909416602486015260448501929092526064840152608483015260a482015260c401600060405180830381600087803b158015610ac857600080fd5b505af1158015610adc573d6000803e3d6000fd5b507fad635460888489be07731050101b47548c6a3831f2dc51f2b3545696d0b8afd79250610b139150600c90506004366000614062565b610b1c916141a8565b6040517fffffffffffffffff000000000000000000000000000000000000000000000000909116815260200160405180910390a150505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ba7576040517fbe24598300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015473ffffffffffffffffffffffffffffffffffffffff16610bf6576040517f75cdea1200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b606063ffffffff861115610cbb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f64657374696e6174696f6e436861696e49642076616c7565207061737365642060448201527f746f6f2062696720746f2066697420696e2075696e743332000000000000000060648201526084015b60405180910390fd5b6fffffffffffffffffffffffffffffffff851115610d5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603e60248201527f64657374696e6174696f6e416d6f756e744f75744d696e2076616c756520706160448201527f7373656420746f6f2062696720746f2066697420696e2075696e7431323800006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff831115610dfb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f72656c617965724665652076616c75652070617373656420746f6f206269672060448201527f746f2066697420696e2075696e743132380000000000000000000000000000006064820152608401610cb2565b50604080517f1223354c0000000000000000000000000000000000000000000000000000000060208201527fffffffffffffffff000000000000000000000000000000000000000000000000989098166024890152606096871b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000908116602c8a015260e09690961b7fffffffff000000000000000000000000000000000000000000000000000000001688820152608094851b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000090811660448a015293871b861660548901529190931b9091166068860152921b1660788301528051606c818403018152608c909201905290565b6000610f1a604860383684614062565b610f239161411a565b60801c9050610f51333083610f3d60386024366000614062565b610f469161408c565b60601c92919061338a565b610f606090607c366000614062565b610f699161408c565b60601c63deace8f5610f8060246020366000614062565b610f89916140d4565b60e01c610f9b6020600c366000614062565b610fa49161408c565b60601c84610fb760586048366000614062565b610fc09161411a565b60801c610fd04262093a8061418f565b610fdf606c6058366000614062565b610fe89161408c565b60601c610ffa607c606c366000614062565b6110039161411a565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b168152600481019790975273ffffffffffffffffffffffffffffffffffffffff958616602488015260448701949094526064860192909252608485015290911660a483015260801c60c482015260e401600060405180830381600087803b15801561109657600080fd5b505af11580156110aa573d6000803e3d6000fd5b507fad635460888489be07731050101b47548c6a3831f2dc51f2b3545696d0b8afd792506110e19150600c90506004366000614062565b6110ea916141a8565b6040517fffffffffffffffff000000000000000000000000000000000000000000000000909116815260200160405180910390a150565b60005473ffffffffffffffffffffffffffffffffffffffff163314611172576040517fbe24598300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8260005b81811015611207576111f584848381811061119357611193614207565b90506020020160208101906111a89190614045565b8787848181106111ba576111ba614207565b90506020020160208101906111cf9190614045565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613450565b806111ff81614236565b915050611176565b505050505050565b61123173ffffffffffffffffffffffffffffffffffffffff871633308861338a565b73ffffffffffffffffffffffffffffffffffffffff811663deace8f5888a888861125e4262093a8061418f565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e088901b168152600481019590955273ffffffffffffffffffffffffffffffffffffffff9384166024860152604485019290925260648401526084830152861660a482015260c4810185905260e401600060405180830381600087803b1580156112ec57600080fd5b505af1158015611300573d6000803e3d6000fd5b50506040517fffffffffffffffff0000000000000000000000000000000000000000000000008c1681527fad635460888489be07731050101b47548c6a3831f2dc51f2b3545696d0b8afd79250602001905060405180910390a1505050505050505050565b604080516101408101825260008082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101919091526114326040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b606c8310156114c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f646174612070617373656420696e206973206e6f742074686520636f7272656360448201527f74206c656e6774680000000000000000000000000000000000000000000000006064820152608401610cb2565b604080516101408101825260008082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101919091526115906040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b61159e600c60048789614062565b6115a7916141a8565b7fffffffffffffffff0000000000000000000000000000000000000000000000001682526115d96020600c8789614062565b6115e29161408c565b60601c60a08301526115f8602460208789614062565b611601916140d4565b60e090811c90830152611618603460248789614062565b6116219161411a565b60801c6060820152611637606c60588789614062565b6116409161408c565b60601c60a082015290925090505b9250929050565b60015473ffffffffffffffffffffffffffffffffffffffff163381146116a7576040517f1853971c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff9092167fffffffffffffffffffffffff0000000000000000000000000000000000000000928316179055600180549091169055565b61175d73ffffffffffffffffffffffffffffffffffffffff881633308961338a565b6040517feea0d7b20000000000000000000000000000000000000000000000000000000081526004810189905273ffffffffffffffffffffffffffffffffffffffff8a811660248301526044820188905260648201879052608482018690524260a483015260c4820185905260e4820184905282169063eea0d7b29061010401600060405180830381600087803b1580156117f757600080fd5b505af115801561180b573d6000803e3d6000fd5b50506040517fffffffffffffffff0000000000000000000000000000000000000000000000008d1681527fad635460888489be07731050101b47548c6a3831f2dc51f2b3545696d0b8afd79250602001905060405180910390a150505050505050505050565b606063ffffffff891115611907576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f64657374696e6174696f6e436861696e49642076616c7565207061737365642060448201527f746f6f2062696720746f2066697420696e2075696e74333200000000000000006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff8711156119a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f616d6f756e742076616c75652070617373656420746f6f2062696720746f206660448201527f697420696e2075696e74313238000000000000000000000000000000000000006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff861115611a47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f626f6e6465724665652076616c75652070617373656420746f6f20626967207460448201527f6f2066697420696e2075696e74313238000000000000000000000000000000006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff851115611ae7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f616d6f756e744f75744d696e2076616c75652070617373656420746f6f20626960448201527f6720746f2066697420696e2075696e74313238000000000000000000000000006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff841115611b87576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603e60248201527f64657374696e6174696f6e416d6f756e744f75744d696e2076616c756520706160448201527f7373656420746f6f2062696720746f2066697420696e2075696e7431323800006064820152608401610cb2565b63ffffffff831115611c1b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f64657374696e6174696f6e446561646c696e652076616c75652070617373656460448201527f20746f6f2062696720746f2066697420696e2075696e743332000000000000006064820152608401610cb2565b50604080517fc5ae0fe60000000000000000000000000000000000000000000000000000000060208201527fffffffffffffffff0000000000000000000000000000000000000000000000009b909b1660248c01527fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060609a8b1b8116602c8d01527fffffffff0000000000000000000000000000000000000000000000000000000060e09a8b1b81168d840152988b1b811660448d01527fffffffffffffffffffffffffffffffff00000000000000000000000000000000608098891b811660588e015296881b871660688d015294871b861660788c01529290951b90931660888901529190941b909216609886015290921b16609c8301528051808303609001815260b0909201905290565b604080516101408101825260008082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810191909152611e166040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b6090831015611ea7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f646174612070617373656420696e206973206e6f742074686520636f7272656360448201527f74206c656e6774680000000000000000000000000000000000000000000000006064820152608401610cb2565b604080516101408101825260008082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810191909152611f746040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b611f82600c60048789614062565b611f8b916141a8565b7fffffffffffffffff000000000000000000000000000000000000000000000000168252611fbd6020600c8789614062565b611fc69161408c565b60601c60a0830152611fdc602460208789614062565b611fe5916140d4565b60e090811c90830152611ffc603860248789614062565b6120059161408c565b60601c608083015261201b604860388789614062565b6120249161411a565b60801c60c083015261203a605860488789614062565b6120439161411a565b60801c8152612056606860588789614062565b61205f9161411a565b60801c6020820152612075607860688789614062565b61207e9161411a565b60801c6060820152612094607c60788789614062565b61209d916140d4565b60e01c60808201526116376090607c8789614062565b604080516101408101825260008082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101919091526121806040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b6090831015612211576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f646174612070617373656420696e206973206e6f742074686520636f7272656360448201527f74206c656e6774680000000000000000000000000000000000000000000000006064820152608401610cb2565b604080516101408101825260008082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101919091526122de6040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b6122ec600c60048789614062565b6122f5916141a8565b7fffffffffffffffff0000000000000000000000000000000000000000000000001682526123276020600c8789614062565b6123309161408c565b60601c60a0830152612346602460208789614062565b61234f916140d4565b60e090811c90830152612366603860248789614062565b61236f9161408c565b60601c6080830152612385604860388789614062565b61238e9161411a565b60801c60c08301526123a4605860488789614062565b6123ad9161411a565b60801c60608201526116376090607c8789614062565b60006123d3602460203684614062565b6123dc916140d4565b60e01c905060006123f1604860383684614062565b6123fa9161411a565b60801c9050600061240f606860583684614062565b6124189161411a565b60801c90506001831460006124316090607c3684614062565b61243a9161408c565b60601c9050612454333086610f3d60386024366000614062565b60008173ffffffffffffffffffffffffffffffffffffffff16639cd016056040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124c5919061426e565b6040517f916955860000000000000000000000000000000000000000000000000000000081526000600482015260016024820152604481018790526064810186905242608482015273ffffffffffffffffffffffffffffffffffffffff919091169063916955869060a4016020604051808303816000875af115801561254f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257391906141ee565b90508173ffffffffffffffffffffffffffffffffffffffff1663e78cea926040518163ffffffff1660e01b8152600401602060405180830381865afa1580156125c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125e4919061426e565b73ffffffffffffffffffffffffffffffffffffffff1663a6bd1b338761260f6020600c366000614062565b6126189161408c565b60601c8461262b60586048366000614062565b6126349161411a565b60801c8861265c5761264b60786068366000614062565b6126549161411a565b60801c61265f565b60005b8961268457612673607c6078366000614062565b61267c916140d4565b60e01c612687565b60005b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b168152600481019690965273ffffffffffffffffffffffffffffffffffffffff909416602486015260448501929092526064840152608483015260a482015260c401600060405180830381600087803b15801561270c57600080fd5b505af1158015612720573d6000803e3d6000fd5b507fad635460888489be07731050101b47548c6a3831f2dc51f2b3545696d0b8afd792506127579150600c90506004366000614062565b612760916141a8565b6040517fffffffffffffffff000000000000000000000000000000000000000000000000909116815260200160405180910390a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff811663deace8f534878982896127ca4262093a8061418f565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b168152600481019590955273ffffffffffffffffffffffffffffffffffffffff9384166024860152604485019290925260648401526084830152871660a482015260c4810186905260e4016000604051808303818588803b15801561285757600080fd5b505af115801561286b573d6000803e3d6000fd5b50506040517fffffffffffffffff0000000000000000000000000000000000000000000000008b1681527fad635460888489be07731050101b47548c6a3831f2dc51f2b3545696d0b8afd7935060200191506128c49050565b60405180910390a150505050505050565b606063ffffffff84111561296b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f64657374696e6174696f6e436861696e49642076616c7565207061737365642060448201527f746f6f2062696720746f2066697420696e2075696e74333200000000000000006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff831115612a0b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f626f6e6465724665652076616c75652070617373656420746f6f20626967207460448201527f6f2066697420696e2075696e74313238000000000000000000000000000000006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff821115612aab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f616d6f756e744f75744d696e2076616c75652070617373656420746f6f20626960448201527f6720746f2066697420696e2075696e74313238000000000000000000000000006064820152608401610cb2565b604080517f161be5420000000000000000000000000000000000000000000000000000000060208201527fffffffffffffffff000000000000000000000000000000000000000000000000881660248201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b16602c8201527fffffffff0000000000000000000000000000000000000000000000000000000060e087901b16918101919091527fffffffffffffffffffffffffffffffff00000000000000000000000000000000608085811b8216604484015284901b166054820152606401604051602081830303815290604052905095945050505050565b606063ffffffff881115612c40576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f64657374696e6174696f6e436861696e49642076616c7565207061737365642060448201527f746f6f2062696720746f2066697420696e2075696e74333200000000000000006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff861115612ce0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f616d6f756e742076616c75652070617373656420746f6f2062696720746f206660448201527f697420696e2075696e74313238000000000000000000000000000000000000006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff851115612d80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603e60248201527f64657374696e6174696f6e416d6f756e744f75744d696e2076616c756520706160448201527f7373656420746f6f2062696720746f2066697420696e2075696e7431323800006064820152608401610cb2565b6fffffffffffffffffffffffffffffffff831115612e20576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f72656c617965724665652076616c75652070617373656420746f6f206269672060448201527f746f2066697420696e2075696e743132380000000000000000000000000000006064820152608401610cb2565b50604080517f33619a2d0000000000000000000000000000000000000000000000000000000060208201527fffffffffffffffff0000000000000000000000000000000000000000000000009a909a1660248b0152606098891b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000908116602c8c015260e09890981b7fffffffff00000000000000000000000000000000000000000000000000000000168a82015295881b871660448a0152608094851b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000090811660588b015293851b841660688a015291871b8616607889015290921b16608c86015290921b16609c8301528051609081840301815260b0909201905290565b60005473ffffffffffffffffffffffffffffffffffffffff163314612f92576040517fbe24598300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116612fdf576040517f1beca37400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff82160361302e576040517fbf1ea9fb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831690811790915560405133907fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae127890600090a350565b604080516101408101825260008082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081019190915261316c6040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b60448310156131fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f646174612070617373656420696e206973206e6f742074686520636f7272656360448201527f74206c656e6774680000000000000000000000000000000000000000000000006064820152608401610cb2565b604080516101408101825260008082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101919091526132ca6040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b6132d8600c60048789614062565b6132e1916141a8565b7fffffffffffffffff0000000000000000000000000000000000000000000000001682526133136020600c8789614062565b61331c9161408c565b60601c60a0830152613332602460208789614062565b61333b916140d4565b60e090811c90830152613352603460248789614062565b61335b9161411a565b60801c815261336e604460348789614062565b6133779161411a565b60801c6020820152909590945092505050565b60006040517f23b872dd0000000000000000000000000000000000000000000000000000000081528460048201528360248201528260448201526020600060648360008a5af13d15601f3d1160016000511416171691505080613449576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401610cb2565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff831661347057505050565b73ffffffffffffffffffffffffffffffffffffffff82166134bd576040517f63ba9bff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015282919085169063dd62ed3e90604401602060405180830381865afa158015613532573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061355691906141ee565b10156135935761356883836000613598565b61359383837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613598565b505050565b80158061363857506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e90604401602060405180830381865afa158015613612573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061363691906141ee565b155b6136c4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610cb2565b6040805173ffffffffffffffffffffffffffffffffffffffff848116602483015260448083018590528351808403909101815260649092018352602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908401526135939286929160009161378f91851690849061383c565b90508051600014806137b05750808060200190518101906137b0919061428b565b613593576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610cb2565b606061384b8484600085613855565b90505b9392505050565b6060824710156138e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610cb2565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161391091906142ad565b60006040518083038185875af1925050503d806000811461394d576040519150601f19603f3d011682016040523d82523d6000602084013e613952565b606091505b509150915061396387838387613970565b925050505b949350505050565b60608315613a065782516000036139ff5773ffffffffffffffffffffffffffffffffffffffff85163b6139ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610cb2565b5081613968565b6139688383815115613a1b5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb29190613c0a565b80357fffffffffffffffff00000000000000000000000000000000000000000000000081168114613a7f57600080fd5b919050565b73ffffffffffffffffffffffffffffffffffffffff81168114613aa657600080fd5b50565b600080600080600080600080610100898b031215613ac657600080fd5b613acf89613a4f565b97506020890135613adf81613a84565b965060408901359550606089013594506080890135935060a0890135925060c0890135915060e0890135613b1281613a84565b809150509295985092959890939650565b600080600080600080600060e0888a031215613b3e57600080fd5b613b4788613a4f565b96506020880135613b5781613a84565b955060408801359450606088013593506080880135613b7581613a84565b925060a0880135915060c0880135613b8c81613a84565b8091505092959891949750929550565b60005b83811015613bb7578181015183820152602001613b9f565b50506000910152565b60008151808452613bd8816020860160208601613b9c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061384e6020830184613bc0565b60008083601f840112613c2f57600080fd5b50813567ffffffffffffffff811115613c4757600080fd5b6020830191508360208260051b850101111561164e57600080fd5b60008060008060408587031215613c7857600080fd5b843567ffffffffffffffff80821115613c9057600080fd5b613c9c88838901613c1d565b90965094506020870135915080821115613cb557600080fd5b50613cc287828801613c1d565b95989497509550505050565b60008060008060008060008060006101208a8c031215613ced57600080fd5b613cf68a613a4f565b985060208a0135613d0681613a84565b975060408a0135965060608a0135613d1d81613a84565b955060808a0135945060a08a0135935060c08a0135613d3b81613a84565b925060e08a013591506101008a0135613d5381613a84565b809150509295985092959850929598565b60008060208385031215613d7757600080fd5b823567ffffffffffffffff80821115613d8f57600080fd5b818501915085601f830112613da357600080fd5b813581811115613db257600080fd5b866020828501011115613dc457600080fd5b60209290920196919550909350505050565b6000610140808352845181840152602085015181610160850152613dfe610280850182613bc0565b91505060408501517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec084830301610180850152613e3b8282613bc0565b9150506060850151613e666101a085018273ffffffffffffffffffffffffffffffffffffffff169052565b5060808581015173ffffffffffffffffffffffffffffffffffffffff9081166101c086015260a08088015182166101e087015260c08089015161020088015260e0808a0151610220890152610100808b015115156102408a0152610120808c015115156102608b01528a516020808c01919091528b01516040808c01919091528b01516060808c01919091528b01518a880152958a0151848a0152928901518416828901529088015190921682870152908601518186015285015190840152905061384e565b6000806000806000806000806000806101408b8d031215613f4c57600080fd5b613f558b613a4f565b995060208b0135613f6581613a84565b985060408b0135975060608b0135613f7c81613a84565b965060808b0135955060a08b0135945060c08b0135935060e08b013592506101008b013591506101208b0135613fb181613a84565b809150509295989b9194979a5092959850565b6000806000806000806000806000806101408b8d031215613fe457600080fd5b8a35995060208b0135613f6581613a84565b600080600080600060a0868803121561400e57600080fd5b61401786613a4f565b9450602086013561402781613a84565b94979496505050506040830135926060810135926080909101359150565b60006020828403121561405757600080fd5b813561384e81613a84565b6000808585111561407257600080fd5b8386111561407f57600080fd5b5050820193919092039150565b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000081358181169160148510156140cc5780818660140360031b1b83161692505b505092915050565b7fffffffff0000000000000000000000000000000000000000000000000000000081358181169160048510156140cc5760049490940360031b84901b1690921692915050565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000081358181169160108510156140cc5760109490940360031b84901b1690921692915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156141a2576141a2614160565b92915050565b7fffffffffffffffff00000000000000000000000000000000000000000000000081358181169160088510156140cc5760089490940360031b84901b1690921692915050565b60006020828403121561420057600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361426757614267614160565b5060010190565b60006020828403121561428057600080fd5b815161384e81613a84565b60006020828403121561429d57600080fd5b8151801515811461384e57600080fd5b600082516142bf818460208701613b9c565b919091019291505056fea264697066735822122089637cfe69860f8bf379a07a178fabdcc759ff28e08be269a1ed6e52ac52fd6764736f6c63430008110033

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

00000000000000000000000011f11121df7256c40339393b0fb045321022ce440000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _owner (address): 0x11F11121DF7256C40339393b0FB045321022ce44
Arg [1] : _wrapper (address): 0x0000000000000000000000000000000000000000

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000011f11121df7256c40339393b0fb045321022ce44
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

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.