ETH Price: $4,524.48 (+1.67%)

Contract

0xAc371D6E651b6450ea8c4cE346Ddd44B62d851B5

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

N/A
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
NftZapLib

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeTransferLib } from "solmate/utils/SafeTransferLib.sol";
import { INftZapLib } from "contracts/interfaces/libraries/INftZapLib.sol";
import { INftLiquidityConnector } from
    "contracts/interfaces/INftLiquidityConnector.sol";
import { ISwapLib } from "contracts/interfaces/libraries/ISwapLib.sol";
import { ConnectorRegistry } from "contracts/ConnectorRegistry.sol";
import { DelegateModule } from "contracts/modules/DelegateModule.sol";
import { NftZapIn, NftZapOut } from "contracts/structs/NftZapStructs.sol";
import { NftAddLiquidity } from "contracts/structs/NftLiquidityStructs.sol";

contract NftZapLib is DelegateModule, INftZapLib {
    error LiquidityAmountError(); // 0x4d0ab6b4

    ISwapLib public immutable swapLib;
    ConnectorRegistry public immutable connectorRegistry;

    constructor(ConnectorRegistry connectorRegistry_, ISwapLib swapLib_) {
        connectorRegistry = connectorRegistry_;
        swapLib = swapLib_;
    }

    function zapIn(
        NftZapIn memory zap
    ) external payable {
        uint256 swapDataLength = zap.swaps.length;
        for (uint256 i; i < swapDataLength;) {
            _delegateTo(
                address(swapLib), abi.encodeCall(ISwapLib.swap, (zap.swaps[i]))
            );
            unchecked {
                i++;
            }
        }

        bool atLeastOneNonZero = false;

        NftAddLiquidity memory addLiquidityParams = zap.addLiquidityParams;
        if (addLiquidityParams.amount0Desired == 0) {
            addLiquidityParams.amount0Desired = addLiquidityParams.pool.token0
                == address(0)
                ? address(this).balance
                : IERC20(addLiquidityParams.pool.token0).balanceOf(address(this));
        }
        if (addLiquidityParams.amount1Desired == 0) {
            addLiquidityParams.amount1Desired =
                IERC20(addLiquidityParams.pool.token1).balanceOf(address(this));
        }
        if (addLiquidityParams.amount0Desired > 0) {
            atLeastOneNonZero = true;
            if (addLiquidityParams.pool.token0 != address(0)) {
                SafeTransferLib.safeApprove(
                    addLiquidityParams.pool.token0,
                    address(addLiquidityParams.nft),
                    0
                );
                SafeTransferLib.safeApprove(
                    addLiquidityParams.pool.token0,
                    address(addLiquidityParams.nft),
                    addLiquidityParams.amount0Desired
                );
            }
        }
        if (addLiquidityParams.amount1Desired > 0) {
            atLeastOneNonZero = true;
            SafeTransferLib.safeApprove(
                addLiquidityParams.pool.token1,
                address(addLiquidityParams.nft),
                0
            );
            SafeTransferLib.safeApprove(
                addLiquidityParams.pool.token1,
                address(addLiquidityParams.nft),
                addLiquidityParams.amount1Desired
            );
        }

        if (!atLeastOneNonZero) {
            revert LiquidityAmountError();
        }

        address routerConnector =
            connectorRegistry.connectorOf(address(addLiquidityParams.nft));

        _delegateTo(
            routerConnector,
            abi.encodeCall(
                INftLiquidityConnector.addLiquidity, (addLiquidityParams)
            )
        );

        if (addLiquidityParams.pool.token0 != address(0)) {
            SafeTransferLib.safeApprove(
                addLiquidityParams.pool.token0,
                address(addLiquidityParams.nft),
                0
            );
        }
        SafeTransferLib.safeApprove(
            addLiquidityParams.pool.token1, address(addLiquidityParams.nft), 0
        );
    }

    function zapOut(
        NftZapOut memory zap
    ) external {
        address routerConnector = connectorRegistry.connectorOf(
            address(zap.removeLiquidityParams.nft)
        );

        _delegateTo(
            routerConnector,
            abi.encodeCall(
                INftLiquidityConnector.removeLiquidity,
                zap.removeLiquidityParams
            )
        );

        uint256 swapDataLength = zap.swaps.length;
        for (uint256 i; i < swapDataLength;) {
            _delegateTo(
                address(swapLib), abi.encodeCall(ISwapLib.swap, (zap.swaps[i]))
            );
            unchecked {
                i++;
            }
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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);
}

// 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 {
    /*//////////////////////////////////////////////////////////////
                                ERRORS
    //////////////////////////////////////////////////////////////*/

    error ETHTransferFailed();
    error TransferFromFailed();
    error TransferFailed();
    error ApproveFailed();

    /*//////////////////////////////////////////////////////////////
                             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)
        }

        if (!success) revert ETHTransferFailed();
    }

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

    function safeTransferFrom(
        address 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)
            )
        }

        if (!success) revert TransferFromFailed();
    }

    function safeTransfer(
        address 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)
            )
        }

        if (!success) revert TransferFailed();
    }

    function safeApprove(
        address 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)
            )
        }

        if (!success) revert ApproveFailed();
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { NftZapIn, NftZapOut } from "contracts/structs/NftZapStructs.sol";

interface INftZapLib {
    function zapIn(
        NftZapIn memory zap
    ) external payable;

    function zapOut(
        NftZapOut memory zap
    ) external;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {
    NftAddLiquidity,
    NftRemoveLiquidity,
    NftPoolKey,
    NftPoolInfo,
    NftPositionInfo
} from "contracts/structs/NftLiquidityStructs.sol";

interface INftLiquidityConnector {
    function addLiquidity(
        NftAddLiquidity memory addLiquidityParams
    ) external payable;

    function removeLiquidity(
        NftRemoveLiquidity memory removeLiquidityParams
    ) external;

    function fee(
        address pool,
        uint256 tokenId // Used by UniswapV4
    ) external view returns (uint24);

    function totalSupply(
        address nftManager
    ) external view returns (uint256);

    function getTokenId(
        address nftManager,
        address owner
    ) external view returns (uint256);

    function earnedFees(
        address nftManager,
        address pool,
        uint256 tokenId
    ) external view returns (uint256 fees0, uint256 fees1);

    function positionLiquidity(
        address nftManager,
        uint256 tokenId
    )
        external
        view
        returns (int24 tickLower, int24 tickUpper, uint128 liquidity);

    function positionPoolKey(
        address poolFactory,
        address nftManager,
        uint256 tokenId
    ) external view returns (NftPoolKey memory);

    function poolInfo(
        address pool,
        bytes32 poolId
    ) external view returns (NftPoolInfo memory);

    // Maintained for backwards compatibility with NftSettingsRegistry
    function positionInfo(
        address nftManager,
        uint256 tokenId
    ) external view returns (NftPositionInfo memory);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { SwapParams } from "contracts/structs/SwapStructs.sol";

interface ISwapLib {
    function swap(
        SwapParams memory swap
    ) external payable;

    function swapMultiple(
        SwapParams[] memory swaps
    ) external payable;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { Admin } from "contracts/base/Admin.sol";
import { TimelockAdmin } from "contracts/base/TimelockAdmin.sol";

error ConnectorNotRegistered(address target);
error CustomRegistryAlreadyRegistered();

interface ICustomConnectorRegistry {
    function connectorOf(
        address target
    ) external view returns (address);
}

contract ConnectorRegistry is Admin, TimelockAdmin {
    event ConnectorChanged(address target, address connector);
    event CustomRegistryAdded(address registry);
    event CustomRegistryRemoved(address registry);

    error ConnectorAlreadySet(address target);
    error ConnectorNotSet(address target);
    error ArrayLengthMismatch();

    ICustomConnectorRegistry[] public customRegistries;

    mapping(address target => address connector) private connectors_;

    constructor(
        address admin_,
        address timelockAdmin_
    ) Admin(admin_) TimelockAdmin(timelockAdmin_) { }

    /// Admin functions

    /// @notice Update connector addresses for a batch of targets.
    /// @dev Controls which connector contracts are used for the specified
    /// targets.
    /// @custom:access Restricted to protocol admin.
    function setConnectors(
        address[] calldata targets,
        address[] calldata connectors
    ) external onlyAdmin {
        if (targets.length != connectors.length) {
            revert ArrayLengthMismatch();
        }
        for (uint256 i; i != targets.length;) {
            if (connectors_[targets[i]] != address(0)) {
                revert ConnectorAlreadySet(targets[i]);
            }
            connectors_[targets[i]] = connectors[i];
            emit ConnectorChanged(targets[i], connectors[i]);

            unchecked {
                ++i;
            }
        }
    }

    function updateConnectors(
        address[] calldata targets,
        address[] calldata connectors
    ) external onlyTimelockAdmin {
        if (targets.length != connectors.length) {
            revert ArrayLengthMismatch();
        }
        for (uint256 i; i != targets.length;) {
            if (connectors_[targets[i]] == address(0)) {
                revert ConnectorNotSet(targets[i]);
            }
            connectors_[targets[i]] = connectors[i];
            emit ConnectorChanged(targets[i], connectors[i]);

            unchecked {
                ++i;
            }
        }
    }

    /// @notice Append an address to the custom registries list.
    /// @custom:access Restricted to protocol admin.
    function addCustomRegistry(
        ICustomConnectorRegistry registry
    ) external onlyAdmin {
        if (isCustomRegistry(registry)) {
            revert CustomRegistryAlreadyRegistered();
        }

        customRegistries.push(registry);
        emit CustomRegistryAdded(address(registry));
    }

    /// @notice Replace an address in the custom registries list.
    /// @custom:access Restricted to protocol admin.
    function updateCustomRegistry(
        uint256 index,
        ICustomConnectorRegistry newRegistry
    ) external onlyTimelockAdmin {
        ICustomConnectorRegistry oldRegistry = customRegistries[index];
        emit CustomRegistryRemoved(address(oldRegistry));
        customRegistries[index] = newRegistry;
        if (address(newRegistry) != address(0)) {
            emit CustomRegistryAdded(address(newRegistry));
        }
    }

    /// Public functions

    function connectorOf(
        address target
    ) external view returns (address) {
        address connector = _getConnector(target);

        if (connector != address(0)) {
            return connector;
        }

        revert ConnectorNotRegistered(target);
    }

    function hasConnector(
        address target
    ) external view returns (bool) {
        return _getConnector(target) != address(0);
    }

    function isCustomRegistry(
        ICustomConnectorRegistry registry
    ) public view returns (bool) {
        for (uint256 i; i != customRegistries.length;) {
            if (address(customRegistries[i]) == address(registry)) {
                return true;
            }
            unchecked {
                ++i;
            }
        }
        return false;
    }

    /// Internal functions

    function _getConnector(
        address target
    ) internal view returns (address) {
        address connector = connectors_[target];
        if (connector != address(0)) {
            return connector;
        }
        uint256 length = customRegistries.length;
        for (uint256 i; i != length;) {
            if (address(customRegistries[i]) != address(0)) {
                (bool success, bytes memory data) = address(customRegistries[i])
                    .staticcall(
                    abi.encodeWithSelector(
                        ICustomConnectorRegistry.connectorOf.selector, target
                    )
                );
                if (success && data.length == 32) {
                    address _connector = abi.decode(data, (address));
                    if (_connector != address(0)) {
                        return _connector;
                    }
                }
            }

            unchecked {
                ++i;
            }
        }

        return address(0);
    }
}

File 8 of 19 : DelegateModule.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

contract DelegateModule {
    function _delegateTo(
        address to,
        bytes memory data
    ) internal returns (bytes memory) {
        (bool success, bytes memory result) = to.delegatecall(data);

        if (!success) {
            if (result.length == 0) revert();
            assembly {
                revert(add(32, result), mload(result))
            }
        }

        return result;
    }
}

File 9 of 19 : NftZapStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { SwapParams } from "contracts/structs/SwapStructs.sol";
import {
    NftAddLiquidity,
    NftRemoveLiquidity
} from "contracts/structs/NftLiquidityStructs.sol";

struct NftZapIn {
    SwapParams[] swaps;
    NftAddLiquidity addLiquidityParams;
}

struct NftZapOut {
    NftRemoveLiquidity removeLiquidityParams;
    SwapParams[] swaps;
}

File 10 of 19 : NftLiquidityStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { INonfungiblePositionManager } from
    "contracts/interfaces/external/uniswap/INonfungiblePositionManager.sol";

struct Pool {
    address token0;
    address token1;
    uint24 fee;
}

struct NftPoolKey {
    address poolAddress;
    bytes32 poolId;
}

struct NftPoolInfo {
    address token0;
    address token1;
    uint24 fee;
    uint24 tickSpacing;
    uint160 sqrtPriceX96;
    int24 tick;
    uint128 liquidity;
    uint256 feeGrowthGlobal0X128;
    uint256 feeGrowthGlobal1X128;
}

// Maintained for backwards compatibility with NftSettingsRegistry
struct NftPositionInfo {
    uint128 liquidity;
    int24 tickLower;
    int24 tickUpper;
}

struct NftAddLiquidity {
    INonfungiblePositionManager nft;
    uint256 tokenId;
    Pool pool;
    int24 tickLower;
    int24 tickUpper;
    uint256 amount0Desired;
    uint256 amount1Desired;
    uint256 amount0Min;
    uint256 amount1Min;
    bytes extraData;
}

struct NftRemoveLiquidity {
    INonfungiblePositionManager nft;
    uint256 tokenId;
    uint128 liquidity;
    uint256 amount0Min; // For decreasing
    uint256 amount1Min;
    uint128 amount0Max; // For collecting
    uint128 amount1Max;
    bytes extraData;
}

// 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 12 of 19 : SwapStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

struct SwapParams {
    address tokenApproval;
    address router;
    uint256 amountIn;
    uint256 desiredAmountOut;
    uint256 minAmountOut;
    address tokenIn;
    address tokenOut;
    bytes extraData;
}

File 13 of 19 : Admin.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

/// @title Admin contract
/// @author vfat.tools
/// @notice Provides an administration mechanism allowing restricted functions
abstract contract Admin {
    /// ERRORS ///

    /// @notice Thrown when the caller is not the admin
    error NotAdminError(); //0xb5c42b3b

    /// EVENTS ///

    /// @notice Emitted when a new admin is set
    /// @param oldAdmin Address of the old admin
    /// @param newAdmin Address of the new admin
    event AdminSet(address oldAdmin, address newAdmin);

    /// STORAGE ///

    /// @notice Address of the current admin
    address public admin;

    /// MODIFIERS ///

    /// @dev Restricts a function to the admin
    modifier onlyAdmin() {
        if (msg.sender != admin) revert NotAdminError();
        _;
    }

    /// WRITE FUNCTIONS ///

    /// @param admin_ Address of the admin
    constructor(
        address admin_
    ) {
        emit AdminSet(address(0), admin_);
        admin = admin_;
    }

    /// @notice Sets a new admin
    /// @param newAdmin Address of the new admin
    /// @custom:access Restricted to protocol admin.
    function setAdmin(
        address newAdmin
    ) external onlyAdmin {
        emit AdminSet(admin, newAdmin);
        admin = newAdmin;
    }
}

File 14 of 19 : TimelockAdmin.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

/// @title TimelockAdmin contract
/// @author vfat.tools
/// @notice Provides an timelockAdministration mechanism allowing restricted
/// functions
abstract contract TimelockAdmin {
    /// ERRORS ///

    /// @notice Thrown when the caller is not the timelockAdmin
    error NotTimelockAdminError();

    /// EVENTS ///

    /// @notice Emitted when a new timelockAdmin is set
    /// @param oldTimelockAdmin Address of the old timelockAdmin
    /// @param newTimelockAdmin Address of the new timelockAdmin
    event TimelockAdminSet(address oldTimelockAdmin, address newTimelockAdmin);

    /// STORAGE ///

    /// @notice Address of the current timelockAdmin
    address public timelockAdmin;

    /// MODIFIERS ///

    /// @dev Restricts a function to the timelockAdmin
    modifier onlyTimelockAdmin() {
        if (msg.sender != timelockAdmin) revert NotTimelockAdminError();
        _;
    }

    /// WRITE FUNCTIONS ///

    /// @param timelockAdmin_ Address of the timelockAdmin
    constructor(
        address timelockAdmin_
    ) {
        emit TimelockAdminSet(timelockAdmin, timelockAdmin_);
        timelockAdmin = timelockAdmin_;
    }

    /// @notice Sets a new timelockAdmin
    /// @dev Can only be called by the current timelockAdmin
    /// @param newTimelockAdmin Address of the new timelockAdmin
    function setTimelockAdmin(
        address newTimelockAdmin
    ) external onlyTimelockAdmin {
        emit TimelockAdminSet(timelockAdmin, newTimelockAdmin);
        timelockAdmin = newTimelockAdmin;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { IERC721Enumerable } from
    "openzeppelin-contracts/contracts/interfaces/IERC721Enumerable.sol";

interface INonfungiblePositionManager is IERC721Enumerable {
    struct IncreaseLiquidityParams {
        uint256 tokenId;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 deadline;
    }

    struct MintParams {
        address token0;
        address token1;
        uint24 fee;
        int24 tickLower;
        int24 tickUpper;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        address recipient;
        uint256 deadline;
    }

    struct DecreaseLiquidityParams {
        uint256 tokenId;
        uint128 liquidity;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 deadline;
    }

    struct CollectParams {
        uint256 tokenId;
        address recipient;
        uint128 amount0Max;
        uint128 amount1Max;
    }

    function increaseLiquidity(
        IncreaseLiquidityParams memory params
    )
        external
        payable
        returns (uint256 amount0, uint256 amount1, uint256 liquidity);

    function decreaseLiquidity(
        DecreaseLiquidityParams calldata params
    ) external payable returns (uint256 amount0, uint256 amount1);

    function mint(
        MintParams memory params
    )
        external
        payable
        returns (uint256 tokenId, uint256 amount0, uint256 amount1);

    function collect(
        CollectParams calldata params
    ) external payable returns (uint256 amount0, uint256 amount1);

    function burn(
        uint256 tokenId
    ) external payable;

    function positions(
        uint256 tokenId
    )
        external
        view
        returns (
            uint96 nonce,
            address operator,
            address token0,
            address token1,
            uint24 fee,
            int24 tickLower,
            int24 tickUpper,
            uint128 liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

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

File 16 of 19 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../token/ERC721/extensions/IERC721Enumerable.sol";

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

Settings
{
  "remappings": [
    "solmate/=lib/solmate/src/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@morpho-blue/=lib/morpho-blue/src/",
    "ds-test/=lib/solmate/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "morpho-blue/=lib/morpho-blue/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": false
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"contract ConnectorRegistry","name":"connectorRegistry_","type":"address"},{"internalType":"contract ISwapLib","name":"swapLib_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApproveFailed","type":"error"},{"inputs":[],"name":"LiquidityAmountError","type":"error"},{"inputs":[],"name":"connectorRegistry","outputs":[{"internalType":"contract ConnectorRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapLib","outputs":[{"internalType":"contract ISwapLib","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"internalType":"struct Pool","name":"pool","type":"tuple"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftAddLiquidity","name":"addLiquidityParams","type":"tuple"}],"internalType":"struct NftZapIn","name":"zap","type":"tuple"}],"name":"zapIn","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftRemoveLiquidity","name":"removeLiquidityParams","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"}],"internalType":"struct NftZapOut","name":"zap","type":"tuple"}],"name":"zapOut","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c060405234801561001057600080fd5b50604051610fd2380380610fd283398101604081905261002f9161005e565b6001600160a01b0391821660a05216608052610098565b6001600160a01b038116811461005b57600080fd5b50565b6000806040838503121561007157600080fd5b825161007c81610046565b602084015190925061008d81610046565b809150509250929050565b60805160a051610efb6100d76000396000818160db0152818161012201526104c40152600081816078015281816101ee015261028c0152610efb6000f3fe60806040526004361061003f5760003560e01c80632bbb931b146100445780633faa6e3014610066578063ac98b563146100b6578063b53c86d2146100c9575b600080fd5b34801561005057600080fd5b5061006461005f36600461093e565b6100fd565b005b34801561007257600080fd5b5061009a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b6100646100c4366004610aee565b610279565b3480156100d557600080fd5b5061009a7f000000000000000000000000000000000000000000000000000000000000000081565b8051516040516363cd755760e11b81526001600160a01b0391821660048201526000917f0000000000000000000000000000000000000000000000000000000000000000169063c79aeaae90602401602060405180830381865afa158015610169573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018d9190610c2b565b90506101d78183600001516040516024016101a89190610c9f565b60408051601f198184030181529190526020810180516001600160e01b031663cce9480160e01b1790526105bd565b5060208201515160005b818110156102735761026a7f00000000000000000000000000000000000000000000000000000000000000008560200151838151811061022357610223610d30565b602002602001015160405160240161023b9190610d46565b60408051601f198184030181529190526020810180516001600160e01b031663c472d3e160e01b1790526105bd565b506001016101e1565b50505050565b80515160005b818110156102ca576102c17f00000000000000000000000000000000000000000000000000000000000000008460000151838151811061022357610223610d30565b5060010161027f565b50602082015160a081015160009190820361036f576040810151516001600160a01b031615610367576040818101515190516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801561033e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103629190610dbb565b610369565b475b60a08201525b8060c001516000036103f3576040808201516020015190516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156103c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ed9190610dbb565b60c08201525b60a08101511561044157604081015151600192506001600160a01b03161561044157604081015151815161042991906000610642565b604081015151815160a0830151610441929190610642565b60c081015115610482576001915061046781604001516020015182600001516000610642565b61048281604001516020015182600001518360c00151610642565b816104a057604051631342adad60e21b815260040160405180910390fd5b80516040516363cd755760e11b81526001600160a01b0391821660048201526000917f0000000000000000000000000000000000000000000000000000000000000000169063c79aeaae90602401602060405180830381865afa15801561050b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052f9190610c2b565b905061057581836040516024016105469190610dd4565b60408051601f198184030181529190526020810180516001600160e01b03166304caab4760e01b1790526105bd565b506040820151516001600160a01b03161561059e57604082015151825161059e91906000610642565b6105b682604001516020015183600001516000610642565b5050505050565b6060600080846001600160a01b0316846040516105da9190610ea9565b600060405180830381855af49150503d8060008114610615576040519150601f19603f3d011682016040523d82523d6000602084013e61061a565b606091505b50915091508161063a57805160000361063257600080fd5b805181602001fd5b949350505050565b600060405163095ea7b360e01b8152836004820152826024820152602060006044836000895af13d15601f3d116001600051141617169150508061027357604051633e3f8f7360e01b815260040160405180910390fd5b634e487b7160e01b600052604160045260246000fd5b604051610100810167ffffffffffffffff811182821017156106d3576106d3610699565b60405290565b6040805190810167ffffffffffffffff811182821017156106d3576106d3610699565b604051610140810167ffffffffffffffff811182821017156106d3576106d3610699565b604051601f8201601f1916810167ffffffffffffffff8111828210171561074957610749610699565b604052919050565b6001600160a01b038116811461076657600080fd5b50565b803561077481610751565b919050565b80356001600160801b038116811461077457600080fd5b600082601f8301126107a157600080fd5b813567ffffffffffffffff8111156107bb576107bb610699565b6107ce601f8201601f1916602001610720565b8181528460208386010111156107e357600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f83011261081157600080fd5b8135602067ffffffffffffffff8083111561082e5761082e610699565b8260051b61083d838201610720565b938452858101830193838101908886111561085757600080fd5b84880192505b85831015610932578235848111156108755760008081fd5b8801610100818b03601f190181131561088e5760008081fd5b6108966106af565b6108a1888401610769565b815260406108b0818501610769565b89830152606080850135828401526080915081850135818401525060a0808501358284015260c091506108e4828601610769565b9083015260e06108f5858201610769565b8383015292840135928884111561090e57600091508182fd5b61091c8e8b86880101610790565b908301525084525050918401919084019061085d565b98975050505050505050565b60006020828403121561095057600080fd5b813567ffffffffffffffff8082111561096857600080fd5b908301906040828603121561097c57600080fd5b6109846106d9565b82358281111561099357600080fd5b830161010081880312156109a657600080fd5b6109ae6106af565b6109b782610769565b8152602082013560208201526109cf60408301610779565b604082015260608201356060820152608082013560808201526109f460a08301610779565b60a0820152610a0560c08301610779565b60c082015260e082013584811115610a1c57600080fd5b610a2889828501610790565b60e083015250825250602083013582811115610a4357600080fd5b610a4f87828601610800565b60208301525095945050505050565b600060608284031215610a7057600080fd5b6040516060810181811067ffffffffffffffff82111715610a9357610a93610699565b6040529050808235610aa481610751565b81526020830135610ab481610751565b6020820152604083013562ffffff81168114610acf57600080fd5b6040919091015292915050565b8035600281900b811461077457600080fd5b600060208284031215610b0057600080fd5b813567ffffffffffffffff80821115610b1857600080fd5b9083019060408286031215610b2c57600080fd5b610b346106d9565b823582811115610b4357600080fd5b610b4f87828601610800565b825250602083013582811115610b6457600080fd5b92909201916101808387031215610b7a57600080fd5b610b826106fc565b610b8b84610769565b815260208401356020820152610ba48760408601610a5e565b6040820152610bb560a08501610adc565b6060820152610bc660c08501610adc565b608082015260e084013560a08201526101008085013560c08301526101208086013560e084015261014086013582840152610160860135915084821115610c0c57600080fd5b610c1889838801610790565b9083015250602082015295945050505050565b600060208284031215610c3d57600080fd5b8151610c4881610751565b9392505050565b60005b83811015610c6a578181015183820152602001610c52565b50506000910152565b60008151808452610c8b816020860160208601610c4f565b601f01601f19169290920160200192915050565b6020815260018060a01b038251166020820152602082015160408201526001600160801b03604083015116606082015260608201516080820152608082015160a0820152600060a0830151610cff60c08401826001600160801b03169052565b5060c08301516001600160801b03811660e08401525b5060e08301516101008381015261063a610120840182610c73565b634e487b7160e01b600052603260045260246000fd5b60208152600060018060a01b03808451166020840152806020850151166040840152506040830151606083015260608301516080830152608083015160a083015260a0830151610da160c08401826001600160a01b03169052565b5060c08301516001600160a01b03811660e0840152610d15565b600060208284031215610dcd57600080fd5b5051919050565b60208152610dee6020820183516001600160a01b03169052565b6020820151604082015260006040830151610e33606084018280516001600160a01b0390811683526020808301519091169083015260409081015162ffffff16910152565b506060830151610e4860c084018260020b9052565b506080830151610e5d60e084018260020b9052565b5060a08301516101008381019190915260c08401516101208085019190915260e0850151610140850152908401516101608401528301516101808084015261063a6101a0840182610c73565b60008251610ebb818460208701610c4f565b919091019291505056fea264697066735822122029f2f88d4d10ecef8f9975f24e58a95781551f0a5416ed2de98cdcc5e5a5d49664736f6c63430008130033000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c9900000000000000000000000023eb5ce64769b969b58f008154d396957a7ade3b

Deployed Bytecode

0x60806040526004361061003f5760003560e01c80632bbb931b146100445780633faa6e3014610066578063ac98b563146100b6578063b53c86d2146100c9575b600080fd5b34801561005057600080fd5b5061006461005f36600461093e565b6100fd565b005b34801561007257600080fd5b5061009a7f00000000000000000000000023eb5ce64769b969b58f008154d396957a7ade3b81565b6040516001600160a01b03909116815260200160405180910390f35b6100646100c4366004610aee565b610279565b3480156100d557600080fd5b5061009a7f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c9981565b8051516040516363cd755760e11b81526001600160a01b0391821660048201526000917f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c99169063c79aeaae90602401602060405180830381865afa158015610169573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018d9190610c2b565b90506101d78183600001516040516024016101a89190610c9f565b60408051601f198184030181529190526020810180516001600160e01b031663cce9480160e01b1790526105bd565b5060208201515160005b818110156102735761026a7f00000000000000000000000023eb5ce64769b969b58f008154d396957a7ade3b8560200151838151811061022357610223610d30565b602002602001015160405160240161023b9190610d46565b60408051601f198184030181529190526020810180516001600160e01b031663c472d3e160e01b1790526105bd565b506001016101e1565b50505050565b80515160005b818110156102ca576102c17f00000000000000000000000023eb5ce64769b969b58f008154d396957a7ade3b8460000151838151811061022357610223610d30565b5060010161027f565b50602082015160a081015160009190820361036f576040810151516001600160a01b031615610367576040818101515190516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801561033e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103629190610dbb565b610369565b475b60a08201525b8060c001516000036103f3576040808201516020015190516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156103c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ed9190610dbb565b60c08201525b60a08101511561044157604081015151600192506001600160a01b03161561044157604081015151815161042991906000610642565b604081015151815160a0830151610441929190610642565b60c081015115610482576001915061046781604001516020015182600001516000610642565b61048281604001516020015182600001518360c00151610642565b816104a057604051631342adad60e21b815260040160405180910390fd5b80516040516363cd755760e11b81526001600160a01b0391821660048201526000917f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c99169063c79aeaae90602401602060405180830381865afa15801561050b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052f9190610c2b565b905061057581836040516024016105469190610dd4565b60408051601f198184030181529190526020810180516001600160e01b03166304caab4760e01b1790526105bd565b506040820151516001600160a01b03161561059e57604082015151825161059e91906000610642565b6105b682604001516020015183600001516000610642565b5050505050565b6060600080846001600160a01b0316846040516105da9190610ea9565b600060405180830381855af49150503d8060008114610615576040519150601f19603f3d011682016040523d82523d6000602084013e61061a565b606091505b50915091508161063a57805160000361063257600080fd5b805181602001fd5b949350505050565b600060405163095ea7b360e01b8152836004820152826024820152602060006044836000895af13d15601f3d116001600051141617169150508061027357604051633e3f8f7360e01b815260040160405180910390fd5b634e487b7160e01b600052604160045260246000fd5b604051610100810167ffffffffffffffff811182821017156106d3576106d3610699565b60405290565b6040805190810167ffffffffffffffff811182821017156106d3576106d3610699565b604051610140810167ffffffffffffffff811182821017156106d3576106d3610699565b604051601f8201601f1916810167ffffffffffffffff8111828210171561074957610749610699565b604052919050565b6001600160a01b038116811461076657600080fd5b50565b803561077481610751565b919050565b80356001600160801b038116811461077457600080fd5b600082601f8301126107a157600080fd5b813567ffffffffffffffff8111156107bb576107bb610699565b6107ce601f8201601f1916602001610720565b8181528460208386010111156107e357600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f83011261081157600080fd5b8135602067ffffffffffffffff8083111561082e5761082e610699565b8260051b61083d838201610720565b938452858101830193838101908886111561085757600080fd5b84880192505b85831015610932578235848111156108755760008081fd5b8801610100818b03601f190181131561088e5760008081fd5b6108966106af565b6108a1888401610769565b815260406108b0818501610769565b89830152606080850135828401526080915081850135818401525060a0808501358284015260c091506108e4828601610769565b9083015260e06108f5858201610769565b8383015292840135928884111561090e57600091508182fd5b61091c8e8b86880101610790565b908301525084525050918401919084019061085d565b98975050505050505050565b60006020828403121561095057600080fd5b813567ffffffffffffffff8082111561096857600080fd5b908301906040828603121561097c57600080fd5b6109846106d9565b82358281111561099357600080fd5b830161010081880312156109a657600080fd5b6109ae6106af565b6109b782610769565b8152602082013560208201526109cf60408301610779565b604082015260608201356060820152608082013560808201526109f460a08301610779565b60a0820152610a0560c08301610779565b60c082015260e082013584811115610a1c57600080fd5b610a2889828501610790565b60e083015250825250602083013582811115610a4357600080fd5b610a4f87828601610800565b60208301525095945050505050565b600060608284031215610a7057600080fd5b6040516060810181811067ffffffffffffffff82111715610a9357610a93610699565b6040529050808235610aa481610751565b81526020830135610ab481610751565b6020820152604083013562ffffff81168114610acf57600080fd5b6040919091015292915050565b8035600281900b811461077457600080fd5b600060208284031215610b0057600080fd5b813567ffffffffffffffff80821115610b1857600080fd5b9083019060408286031215610b2c57600080fd5b610b346106d9565b823582811115610b4357600080fd5b610b4f87828601610800565b825250602083013582811115610b6457600080fd5b92909201916101808387031215610b7a57600080fd5b610b826106fc565b610b8b84610769565b815260208401356020820152610ba48760408601610a5e565b6040820152610bb560a08501610adc565b6060820152610bc660c08501610adc565b608082015260e084013560a08201526101008085013560c08301526101208086013560e084015261014086013582840152610160860135915084821115610c0c57600080fd5b610c1889838801610790565b9083015250602082015295945050505050565b600060208284031215610c3d57600080fd5b8151610c4881610751565b9392505050565b60005b83811015610c6a578181015183820152602001610c52565b50506000910152565b60008151808452610c8b816020860160208601610c4f565b601f01601f19169290920160200192915050565b6020815260018060a01b038251166020820152602082015160408201526001600160801b03604083015116606082015260608201516080820152608082015160a0820152600060a0830151610cff60c08401826001600160801b03169052565b5060c08301516001600160801b03811660e08401525b5060e08301516101008381015261063a610120840182610c73565b634e487b7160e01b600052603260045260246000fd5b60208152600060018060a01b03808451166020840152806020850151166040840152506040830151606083015260608301516080830152608083015160a083015260a0830151610da160c08401826001600160a01b03169052565b5060c08301516001600160a01b03811660e0840152610d15565b600060208284031215610dcd57600080fd5b5051919050565b60208152610dee6020820183516001600160a01b03169052565b6020820151604082015260006040830151610e33606084018280516001600160a01b0390811683526020808301519091169083015260409081015162ffffff16910152565b506060830151610e4860c084018260020b9052565b506080830151610e5d60e084018260020b9052565b5060a08301516101008381019190915260c08401516101208085019190915260e0850151610140850152908401516101608401528301516101808084015261063a6101a0840182610c73565b60008251610ebb818460208701610c4f565b919091019291505056fea264697066735822122029f2f88d4d10ecef8f9975f24e58a95781551f0a5416ed2de98cdcc5e5a5d49664736f6c63430008130033

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

000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c9900000000000000000000000023eb5ce64769b969b58f008154d396957a7ade3b

-----Decoded View---------------
Arg [0] : connectorRegistry_ (address): 0xc6013E57a0811C7111A8fB07ACd2E248D9489C99
Arg [1] : swapLib_ (address): 0x23eb5CE64769b969b58f008154d396957A7aDE3b

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c99
Arg [1] : 00000000000000000000000023eb5ce64769b969b58f008154d396957a7ade3b


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
0xAc371D6E651b6450ea8c4cE346Ddd44B62d851B5
Loading...
Loading
Loading...
Loading

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.