ETH Price: $3,351.91 (+0.42%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Swap Exact Eth F...173683002023-05-30 0:48:59582 days ago1685407739IN
0x7B68636A...91ffEFAb9
0.006 ETH0.0037789325.12807959
Swap173682902023-05-30 0:46:35582 days ago1685407595IN
0x7B68636A...91ffEFAb9
0 ETH0.003536523.07038521
Swap Exact Eth F...172604122023-05-14 20:18:23597 days ago1684095503IN
0x7B68636A...91ffEFAb9
0.1 ETH0.0055923337.82539195
Swap Exact Eth F...171448512023-04-28 13:14:11613 days ago1682687651IN
0x7B68636A...91ffEFAb9
0.05 ETH0.0055032138.10113836
Swap Exact Eth F...171448232023-04-28 13:08:35613 days ago1682687315IN
0x7B68636A...91ffEFAb9
0.05 ETH0.0058470138.19033951
Swap Exact Eth F...171426112023-04-28 5:40:35613 days ago1682660435IN
0x7B68636A...91ffEFAb9
0.27 ETH0.0048242835.7
Swap Exact Token...169706392023-04-03 19:43:23638 days ago1680551003IN
0x7B68636A...91ffEFAb9
0 ETH0.0103157368.77154945
Swap Exact Token...169706252023-04-03 19:40:35638 days ago1680550835IN
0x7B68636A...91ffEFAb9
0 ETH0.0043111669.60336203
Swap Exact Eth F...168572132023-03-18 21:07:47654 days ago1679173667IN
0x7B68636A...91ffEFAb9
4.30577602 ETH0.0060816444.45384097
Swap Exact Eth F...168433542023-03-16 22:24:47656 days ago1679005487IN
0x7B68636A...91ffEFAb9
1.01 ETH0.0030691620.06881681
Swap168419662023-03-16 17:43:23656 days ago1678988603IN
0x7B68636A...91ffEFAb9
0 ETH0.0035091126.10948228
Swap Exact Token...168374402023-03-16 2:27:47657 days ago1678933667IN
0x7B68636A...91ffEFAb9
0 ETH0.0029140921.54773496
Swap Exact Token...168370382023-03-16 1:06:11657 days ago1678928771IN
0x7B68636A...91ffEFAb9
0 ETH0.0026378221.73931756
Swap Exact Token...168369772023-03-16 0:53:47657 days ago1678928027IN
0x7B68636A...91ffEFAb9
0 ETH0.0026504420.15485574
Swap168369722023-03-16 0:52:47657 days ago1678927967IN
0x7B68636A...91ffEFAb9
0 ETH0.0024955919.23567325
Swap168369692023-03-16 0:52:11657 days ago1678927931IN
0x7B68636A...91ffEFAb9
0 ETH0.0026442920.38184256
Swap168369642023-03-16 0:51:11657 days ago1678927871IN
0x7B68636A...91ffEFAb9
0 ETH0.0025883420.56447249
Swap Exact Eth F...168369462023-03-16 0:47:35657 days ago1678927655IN
0x7B68636A...91ffEFAb9
0.1 ETH0.0025686919.39182939
Swap Exact Token...168368802023-03-16 0:34:11657 days ago1678926851IN
0x7B68636A...91ffEFAb9
0 ETH0.0027190919.84744068
Swap Exact Token...168358692023-03-15 21:09:35657 days ago1678914575IN
0x7B68636A...91ffEFAb9
0 ETH0.0056826534.02219648
Swap168354842023-03-15 19:50:47657 days ago1678909847IN
0x7B68636A...91ffEFAb9
0 ETH0.0039937229.26492479
Swap168352462023-03-15 19:02:47657 days ago1678906967IN
0x7B68636A...91ffEFAb9
0 ETH0.0034718926.2233501

Latest 19 internal transactions

Advanced mode:
Parent Transaction Hash Block
From
To
173683002023-05-30 0:48:59582 days ago1685407739
0x7B68636A...91ffEFAb9
0.006 ETH
172604122023-05-14 20:18:23597 days ago1684095503
0x7B68636A...91ffEFAb9
0.1 ETH
171448512023-04-28 13:14:11613 days ago1682687651
0x7B68636A...91ffEFAb9
0.05 ETH
171448232023-04-28 13:08:35613 days ago1682687315
0x7B68636A...91ffEFAb9
0.05 ETH
171426112023-04-28 5:40:35613 days ago1682660435
0x7B68636A...91ffEFAb9
0.27 ETH
169706392023-04-03 19:43:23638 days ago1680551003
0x7B68636A...91ffEFAb9
0.03716238 ETH
168572132023-03-18 21:07:47654 days ago1679173667
0x7B68636A...91ffEFAb9
4.30577602 ETH
168433542023-03-16 22:24:47656 days ago1679005487
0x7B68636A...91ffEFAb9
1.01 ETH
168374402023-03-16 2:27:47657 days ago1678933667
0x7B68636A...91ffEFAb9
0.00060229 ETH
168374402023-03-16 2:27:47657 days ago1678933667
0x7B68636A...91ffEFAb9
0.00060229 ETH
168370382023-03-16 1:06:11657 days ago1678928771
0x7B68636A...91ffEFAb9
0.00060328 ETH
168370382023-03-16 1:06:11657 days ago1678928771
0x7B68636A...91ffEFAb9
0.00060328 ETH
168369772023-03-16 0:53:47657 days ago1678928027
0x7B68636A...91ffEFAb9
0.00300669 ETH
168369772023-03-16 0:53:47657 days ago1678928027
0x7B68636A...91ffEFAb9
0.00300669 ETH
168369462023-03-16 0:47:35657 days ago1678927655
0x7B68636A...91ffEFAb9
0.1 ETH
168368802023-03-16 0:34:11657 days ago1678926851
0x7B68636A...91ffEFAb9
0.00060086 ETH
168358692023-03-15 21:09:35657 days ago1678914575
0x7B68636A...91ffEFAb9
0.00121171 ETH
168358692023-03-15 21:09:35657 days ago1678914575
0x7B68636A...91ffEFAb9
0.00121171 ETH
168171442023-03-13 5:59:47659 days ago1678687187
0x7B68636A...91ffEFAb9
 Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ConveyorSwapAggregator

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 4 : ConveyorSwapAggregator.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.16;

import "../lib/interfaces/token/IERC20.sol";
import "./ConveyorErrors.sol";
import "../lib/interfaces/uniswap-v2/IUniswapV2Pair.sol";

interface IConveyorSwapExecutor {
    function executeMulticall(
        ConveyorSwapAggregator.SwapAggregatorMulticall
            calldata swapAggregatorMulticall,
        uint256 amountIn,
        address receiver
    ) external;
}

/// @title ConveyorSwapAggregator
/// @author 0xKitsune, 0xOsiris, Conveyor Labs
/// @notice Multicall contract for token Swaps.
contract ConveyorSwapAggregator {
    address public immutable CONVEYOR_SWAP_EXECUTOR;
    address public immutable WETH;
    /**@notice Event that is emitted when a token to token swap has filled successfully.
     **/
    event Swap(
        address indexed tokenIn,
        uint256 amountIn,
        address indexed tokenOut,
        uint256 amountOut,
        address indexed receiver
    );

    /**@notice Event that is emitted when a token to ETH swap has filled successfully.
     **/
    event SwapExactTokenForEth(
        address indexed tokenIn,
        uint256 amountIn,
        uint256 amountOut,
        address indexed receiver
    );

    /**@notice Event that is emitted when a ETH to token swap has filled successfully.
     **/
    event SwapExactEthForToken(
        uint256 amountIn,
        address indexed tokenOut,
        uint256 amountOut,
        address indexed receiver
    );

    ///@dev Deploys the ConveyorSwapExecutor contract.
    ///@param _weth Address of Wrapped Native Asset.
    constructor(address _weth) {
        require(_weth != address(0), "WETH address is zero");
        CONVEYOR_SWAP_EXECUTOR = address(
            new ConveyorSwapExecutor(address(this))
        );
        WETH = _weth;
    }

    /// @notice SwapAggregatorMulticall struct for token Swaps.
    /// @param zeroForOneBitmap for zeroForOne bool along the swap calls.
    /// @param isUniV2Bitmap for isUniV2 bool along the swap calls.
    /// @param toAddressBitmap for toAddress address along the swap calls.
    /// @param feeBitmap for uniV2 custom fee's along the swap calls.
    /// @param tokenInDestination Address to send tokenIn to.
    /// @param calls Array of calls to be executed.
    struct SwapAggregatorMulticall {
        uint32 zeroForOneBitmap;
        uint32 isUniV2Bitmap;
        uint64 toAddressBitmap;
        uint128 feeBitmap;
        address tokenInDestination;
        Call[] calls;
    }

    /// @notice Call struct for token Swaps.
    /// @param target Address to call.
    /// @param callData Data to call.
    struct Call {
        address target;
        bytes callData;
    }

    /// @notice Swap tokens for tokens.
    /// @param tokenIn Address of token to swap.
    /// @param amountIn Amount of tokenIn to swap.
    /// @param tokenOut Address of token to receive.
    /// @param amountOutMin Minimum amount of tokenOut to receive.
    /// @param swapAggregatorMulticall Multicall to be executed.
    function swap(
        address tokenIn,
        uint256 amountIn,
        address tokenOut,
        uint256 amountOutMin,
        SwapAggregatorMulticall calldata swapAggregatorMulticall
    ) external {
        ///@notice Transfer tokenIn from msg.sender to tokenInDestination address.
        IERC20(tokenIn).transferFrom(
            msg.sender,
            swapAggregatorMulticall.tokenInDestination,
            amountIn
        );

        ///@notice Get tokenOut balance of msg.sender.
        uint256 balanceBefore = IERC20(tokenOut).balanceOf(msg.sender);
        ///@notice Calculate tokenOut amount required.
        uint256 tokenOutAmountRequired = balanceBefore + amountOutMin;

        ///@notice Execute Multicall.
        IConveyorSwapExecutor(CONVEYOR_SWAP_EXECUTOR).executeMulticall(
            swapAggregatorMulticall,
            amountIn,
            msg.sender
        );

        uint256 balanceAfter = IERC20(tokenOut).balanceOf(msg.sender);

        ///@notice Check if tokenOut balance of msg.sender is sufficient.
        if (balanceAfter < tokenOutAmountRequired) {
            revert InsufficientOutputAmount(
                tokenOutAmountRequired - balanceAfter,
                amountOutMin
            );
        }

        ///@notice Emit Swap event.
        emit Swap(
            tokenIn,
            amountIn,
            tokenOut,
            balanceAfter - balanceBefore,
            msg.sender
        );
    }

    /// @notice Swap ETH for tokens.
    /// @param tokenOut Address of token to receive.
    /// @param amountOutMin Minimum amount of tokenOut to receive.
    /// @param swapAggregatorMulticall Multicall to be executed.
    function swapExactEthForToken(
        address tokenOut,
        uint256 amountOutMin,
        SwapAggregatorMulticall calldata swapAggregatorMulticall
    ) external payable {
        ///@notice Deposit the msg.value into WETH.
        _depositEth(msg.value, WETH);

        ///@notice Transfer WETH from WETH to tokenInDestination address.
        IERC20(WETH).transfer(
            swapAggregatorMulticall.tokenInDestination,
            msg.value
        );
        ///@notice Get tokenOut balance of msg.sender.
        uint256 balanceBefore = IERC20(tokenOut).balanceOf(msg.sender);

        ///@notice Calculate tokenOut amount required.
        uint256 tokenOutAmountRequired = balanceBefore + amountOutMin;

        ///@notice Execute Multicall.
        IConveyorSwapExecutor(CONVEYOR_SWAP_EXECUTOR).executeMulticall(
            swapAggregatorMulticall,
            msg.value,
            msg.sender
        );

        ///@notice Get tokenOut balance of msg.sender after multicall execution.
        uint256 balanceAfter = IERC20(tokenOut).balanceOf(msg.sender);

        ///@notice Revert if tokenOut balance of msg.sender is insufficient.
        if (balanceAfter < tokenOutAmountRequired) {
            revert InsufficientOutputAmount(
                tokenOutAmountRequired - balanceAfter,
                amountOutMin
            );
        }

        ///@notice Emit SwapExactEthForToken event.
        emit SwapExactEthForToken(
            msg.value,
            tokenOut,
            balanceAfter - balanceBefore,
            msg.sender
        );
    }

    /// @notice Swap tokens for ETH.
    /// @param tokenIn Address of token to swap.
    /// @param amountIn Amount of tokenIn to swap.
    /// @param amountOutMin Minimum amount of ETH to receive.
    /// @param swapAggregatorMulticall Multicall to be executed.
    function swapExactTokenForEth(
        address tokenIn,
        uint256 amountIn,
        uint256 amountOutMin,
        SwapAggregatorMulticall calldata swapAggregatorMulticall
    ) external {
        ///@dev Ignore if the tokenInDestination is address(0).
        if (swapAggregatorMulticall.tokenInDestination != address(0)) {
            ///@notice Transfer tokenIn from msg.sender to tokenInDestination address.
            IERC20(tokenIn).transferFrom(
                msg.sender,
                swapAggregatorMulticall.tokenInDestination,
                amountIn
            );
        }
        ///@notice Get ETH balance of msg.sender.
        uint256 balanceBefore = msg.sender.balance;

        ///@notice Calculate amountOutRequired.
        uint256 amountOutRequired = balanceBefore + amountOutMin;

        ///@notice Execute Multicall.
        IConveyorSwapExecutor(CONVEYOR_SWAP_EXECUTOR).executeMulticall(
            swapAggregatorMulticall,
            amountIn,
            msg.sender
        );

        ///@notice Get WETH balance of this contract.
        uint256 balanceWeth = IERC20(WETH).balanceOf(address(this));

        ///@notice Withdraw WETH from this contract.
        _withdrawEth(balanceWeth, WETH);

        ///@notice Transfer ETH to msg.sender.
        _safeTransferETH(msg.sender, address(this).balance);

        ///@notice Revert if Eth balance of the caller is insufficient.
        if (msg.sender.balance < amountOutRequired) {
            revert InsufficientOutputAmount(
                amountOutRequired - msg.sender.balance,
                amountOutMin
            );
        }

        ///@notice Emit SwapExactTokenForEth event.
        emit SwapExactTokenForEth(
            tokenIn,
            amountIn,
            msg.sender.balance - balanceBefore,
            msg.sender
        );
    }

    ///@notice Helper function to transfer ETH.
    function _safeTransferETH(address to, uint256 amount) internal {
        bool success;
        assembly {
            // Transfer the ETH and store if it succeeded or not.
            success := call(gas(), to, amount, 0, 0, 0, 0)
        }

        if (!success) {
            revert ETHTransferFailed();
        }
    }

    /// @notice Helper function to Withdraw ETH from WETH.
    function _withdrawEth(uint256 amount, address weth) internal {
        assembly {
            mstore(
                0x0,
                shl(224, 0x2e1a7d4d) /* keccak256("withdraw(uint256)") */
            )
            mstore(4, amount)
            if iszero(
                call(
                    gas() /* gas */,
                    weth /* to */,
                    0 /* value */,
                    0 /* in */,
                    68 /* in size */,
                    0 /* out */,
                    0 /* out size */
                )
            ) {
                revert("Native Token Withdraw failed", amount)
            }
        }
    }

    /// @notice Helper function to Deposit ETH into WETH.
    function _depositEth(uint256 amount, address weth) internal {
        assembly {
            mstore(0x0, shl(224, 0xd0e30db0)) /* keccak256("deposit()") */
            if iszero(
                call(
                    gas() /* gas */,
                    weth /* to */,
                    amount /* value */,
                    0 /* in */,
                    0 /* in size */,
                    0 /* out */,
                    0 /* out size */
                )
            ) {
                revert("Native token deposit failed", amount)
            }
        }
    }

    /// @notice Fallback receiver function.
    receive() external payable {}
}

/// @title ConveyorSwapExecutor
/// @author 0xOsiris, 0xKitsune, Conveyor Labs
/// @notice Optimized multicall execution contract.
contract ConveyorSwapExecutor {
    address immutable CONVEYOR_SWAP_AGGREGATOR;

    ///@param conveyorSwapAggregator Address of the ConveyorSwapAggregator contract.
    constructor(address conveyorSwapAggregator) {
        CONVEYOR_SWAP_AGGREGATOR = conveyorSwapAggregator;
    }

    ///@notice Executes a multicall.
    ///@param swapAggregatorMulticall Multicall to be executed.
    ///@param amountIn Amount of tokenIn to swap.
    ///@param recipient Recipient of the output tokens.
    function executeMulticall(
        ConveyorSwapAggregator.SwapAggregatorMulticall
            calldata swapAggregatorMulticall,
        uint256 amountIn,
        address payable recipient
    ) public {
        ///@notice Get the length of the calls array.
        uint256 callsLength = swapAggregatorMulticall.calls.length;

        ///@notice Create a bytes array to store the calldata for v2 swaps.
        bytes memory callData;

        ///@notice Cache the feeBitmap in memory.
        uint128 feeBitmap = swapAggregatorMulticall.feeBitmap;
        ///@notice Iterate through the calls array.
        for (uint256 i = 0; i < callsLength; ) {
            ///@notice Get the call from the calls array.
            ConveyorSwapAggregator.Call memory call = swapAggregatorMulticall
                .calls[i];

            ///@notice Get the zeroForOne value from the zeroForOneBitmap.
            bool zeroForOne = deriveBoolFromBitmap(
                swapAggregatorMulticall.zeroForOneBitmap,
                i
            );
            ///@notice Check if the call is a v2 swap.
            if (
                deriveBoolFromBitmap(swapAggregatorMulticall.isUniV2Bitmap, i)
            ) {
                ///@notice Instantiate the receiver address for the v2 swap.
                address receiver;
                {
                    ///@notice Get the toAddressBitPattern from the toAddressBitmap.
                    uint256 toAddressBitPattern = deriveToAddressFromBitmap(
                        swapAggregatorMulticall.toAddressBitmap,
                        i
                    );
                    ///@notice Set the receiver address based on the toAddressBitPattern.
                    if (toAddressBitPattern == 0x3) {
                        if (i == callsLength - 1) {
                            revert InvalidToAddressBits();
                        }
                        receiver = swapAggregatorMulticall.calls[i + 1].target;
                    } else if (toAddressBitPattern == 0x2) {
                        receiver = address(this);
                    } else if (toAddressBitPattern == 0x1) {
                        receiver = recipient;
                    } else {
                        receiver = CONVEYOR_SWAP_AGGREGATOR;
                    }
                }

                ///@notice Construct the calldata for the v2 swap.
                (callData, amountIn, feeBitmap) = constructV2SwapCalldata(
                    amountIn,
                    zeroForOne,
                    receiver,
                    call.target,
                    feeBitmap
                );

                ///@notice Execute the v2 swap.
                (bool success, ) = call.target.call(callData);

                if (!success) {
                    revert V2SwapFailed();
                }
            } else {
                ///@notice Execute the v3 swap.
                (bool success, bytes memory data) = call.target.call(
                    call.callData
                );
                if (!success) {
                    revert V3SwapFailed();
                }
                ///@notice Decode the amountIn from the v3 swap.
                (int256 amount0, int256 amount1) = abi.decode(
                    data,
                    (int256, int256)
                );

                amountIn = zeroForOne ? uint256(-amount1) : uint256(-amount0);
            }

            unchecked {
                ++i;
            }
        }
    }

    ///@notice Uniswap V3 callback function called during a swap on a v3 liqudity pool.
    ///@param amount0Delta - The change in token0 reserves from the swap.
    ///@param amount1Delta - The change in token1 reserves from the swap.
    ///@param data - The data packed into the swap.
    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata data
    ) external {
        ///@notice Decode all of the swap data.
        (bool _zeroForOne, address tokenIn, address _sender) = abi.decode(
            data,
            (bool, address, address)
        );

        ///@notice Set amountIn to the amountInDelta depending on boolean zeroForOne.
        uint256 amountIn = _zeroForOne
            ? uint256(amount0Delta)
            : uint256(amount1Delta);

        if (!(_sender == address(this))) {
            ///@notice Transfer the amountIn of tokenIn to the liquidity pool from the sender.
            IERC20(tokenIn).transferFrom(_sender, msg.sender, amountIn);
        } else {
            IERC20(tokenIn).transfer(msg.sender, amountIn);
        }
    }

    ///@notice Constructs the calldata for a v2 swap.
    ///@param amountIn - The amount of tokenIn to swap.
    ///@param zeroForOne - The direction of the swap.
    ///@param to - The address to send the swapped tokens to.
    ///@param pool - The address of the v2 liquidity pool.
    ///@param feeBitmap - The bitmap of fees to use for the swap.
    ///@return callData - The calldata for the v2 swap.
    ///@return amountOut - The amount of tokenOut received from the swap.
    ///@return updatedFeeBitmap - The updated feeBitmap.
    function constructV2SwapCalldata(
        uint256 amountIn,
        bool zeroForOne,
        address to,
        address pool,
        uint128 feeBitmap
    )
        internal
        view
        returns (
            bytes memory callData,
            uint256 amountOut,
            uint128 updatedFeeBitmap
        )
    {
        ///@notice Get the reserves for the pool.
        (uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(pool)
            .getReserves();
        uint24 fee;

        (fee, updatedFeeBitmap) = deriveFeeFromBitmap(feeBitmap);

        ///@notice Get the amountOut from the reserves.
        amountOut = getAmountOut(
            amountIn,
            zeroForOne ? reserve0 : reserve1,
            zeroForOne ? reserve1 : reserve0,
            fee
        );
        ///@notice Encode the swap calldata.
        callData = abi.encodeWithSignature(
            "swap(uint256,uint256,address,bytes)",
            zeroForOne ? 0 : amountOut,
            zeroForOne ? amountOut : 0,
            to,
            new bytes(0)
        );
    }

    //Note: In human readable format, this is read from right to left, with the right most binary digit being the first representation
    //of tokenIsToken0 for the first pool in the route
    ///@notice Derives a boolean at a specific bit position from a bitmap.
    ///@param bitmap - The bitmap to derive the boolean from.
    ///@param position - The bit position.
    function deriveBoolFromBitmap(
        uint64 bitmap,
        uint256 position
    ) internal pure returns (bool) {
        if ((2 ** position) & bitmap == 0) {
            return false;
        } else {
            return true;
        }
    }

    //Note: In human readable format, this is read from right to left, with the right most binary digit being the first bit of the next fee to derive.
    ///@dev Each non standard fee is represented within exactly 10 bits (0-1024), if the fee is 300 then a single 0 bit is used.
    ///@notice Derives the fee from the feeBitmap.
    ///@param feeBitmap - The bitmap of fees to use for the swap.
    ///@return fee - The fee to use for the swap.
    ///@return updatedFeeBitmap - The updated feeBitmap.
    function deriveFeeFromBitmap(
        uint128 feeBitmap
    ) internal pure returns (uint24 fee, uint128 updatedFeeBitmap) {
        /**@dev Retrieve the first 10 bits from the feeBitmap to get the fee, shift right to set the next
            fee in the first bit position.**/
        fee = uint24(feeBitmap & 0x3FF);
        updatedFeeBitmap = feeBitmap >> 10;
    }

    ///@dev Bit Patterns: 01 => msg.sender, 10 => ConveyorSwapExecutor, 11 = next pool, 00 = ConveyorSwapAggregator
    ///@notice Derives the toAddress from the toAddressBitmap.
    ///@param toAddressBitmap - The bitmap of toAddresses to use for the swap.
    ///@param i - The index of the toAddress to derive.
    ///@return unsigned - 2 bit pattern representing the receiver of the current swap.
    function deriveToAddressFromBitmap(
        uint128 toAddressBitmap,
        uint256 i
    ) internal pure returns (uint256) {
        if ((3 << (2 * i)) & toAddressBitmap == 3 << (2 * i)) {
            return 0x3;
        } else if ((2 << (2 * i)) & toAddressBitmap == 2 << (2 * i)) {
            return 0x2;
        } else if ((1 << (2 * i)) & toAddressBitmap == 1 << (2 * i)) {
            return 0x1;
        } else {
            return 0x0;
        }
    }

    ///@notice Function to get the amountOut from a UniV2 lp.
    ///@param amountIn - AmountIn for the swap.
    ///@param reserveIn - tokenIn reserve for the swap.
    ///@param reserveOut - tokenOut reserve for the swap.
    ///@return amountOut - AmountOut from the given parameters.
    function getAmountOut(
        uint256 amountIn,
        uint256 reserveIn,
        uint256 reserveOut,
        uint24 fee
    ) internal pure returns (uint256 amountOut) {
        if (amountIn == 0) {
            revert InsufficientInputAmount(0, 1);
        }

        if (reserveIn == 0) {
            revert InsufficientLiquidity();
        }

        if (reserveOut == 0) {
            revert InsufficientLiquidity();
        }
        /**Note: fee is specified in the callData as per the UniswapV2 variants specification.
            If this fee is not specified correctly the swap will likely fail, or yield unoptimal 
            trade values.**/
        uint256 amountInWithFee = amountIn * (100000 - fee);
        uint256 numerator = amountInWithFee * reserveOut;
        uint256 denominator = reserveIn * 100000 + (amountInWithFee);
        amountOut = numerator / denominator;
    }
}

File 2 of 4 : IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

/**
 * @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);

    function decimals() external view returns (uint8);
}

File 3 of 4 : IUniswapV2Pair.sol
// SPDX-License-Identifier: PLACEHOLDER
pragma solidity >=0.5.0;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

File 4 of 4 : ConveyorErrors.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.16;

error InsufficientWalletBalance(
    address account,
    uint256 balance,
    uint256 balanceNeeded
);
error OrderDoesNotExist(bytes32 orderId);
error OrderQuantityIsZero();
error InsufficientOrderInputValue();
error IncongruentInputTokenInOrderGroup(address token, address expectedToken);
error TokenInIsTokenOut();
error IncongruentOutputTokenInOrderGroup(address token, address expectedToken);
error InsufficientOutputAmount(uint256 amountOut, uint256 expectedAmountOut);
error InsufficientInputAmount(uint256 amountIn, uint256 expectedAmountIn);
error InsufficientLiquidity();
error InsufficientAllowanceForOrderPlacement(
    address token,
    uint256 approvedQuantity,
    uint256 approvedQuantityNeeded
);
error InsufficientAllowanceForOrderUpdate(
    address token,
    uint256 approvedQuantity,
    uint256 approvedQuantityNeeded
);
error InvalidOrderGroupSequence();
error IncongruentFeeInInOrderGroup();
error IncongruentFeeOutInOrderGroup();
error IncongruentTaxedTokenInOrderGroup();
error IncongruentStoplossStatusInOrderGroup();
error IncongruentBuySellStatusInOrderGroup();
error NonEOAStoplossExecution();
error MsgSenderIsNotTxOrigin();
error MsgSenderIsNotLimitOrderRouter();
error MsgSenderIsNotLimitOrderExecutor();
error MsgSenderIsNotSandboxRouter();
error MsgSenderIsNotOwner();
error MsgSenderIsNotOrderOwner();
error MsgSenderIsNotOrderBook();
error MsgSenderIsNotLimitOrderBook();
error MsgSenderIsNotTempOwner();
error Reentrancy();
error ETHTransferFailed();
error InvalidAddress();
error UnauthorizedUniswapV3CallbackCaller();
error DuplicateOrderIdsInOrderGroup();
error InvalidCalldata();
error InsufficientMsgValue();
error UnauthorizedCaller();
error AmountInIsZero();
///@notice Returns the index of the call that failed within the SandboxRouter.Call[] array
error SandboxCallFailed(uint256 callIndex);
error InvalidTransferAddressArray();
error AddressIsZero();
error IdenticalTokenAddresses();
error InvalidInputTokenForOrderPlacement();
error SandboxFillAmountNotSatisfied(
    bytes32 orderId,
    uint256 amountFilled,
    uint256 fillAmountRequired
);
error OrderNotEligibleForRefresh(bytes32 orderId);

error SandboxAmountOutRequiredNotSatisfied(
    bytes32 orderId,
    uint256 amountOut,
    uint256 amountOutRequired
);

error AmountOutRequiredIsZero(bytes32 orderId);

error FillAmountSpecifiedGreaterThanAmountRemaining(
    uint256 fillAmountSpecified,
    uint256 amountInRemaining,
    bytes32 orderId
);
error ConveyorFeesNotPaid(
    uint256 expectedFees,
    uint256 feesPaid,
    uint256 unpaidFeesRemaining
);
error InsufficientFillAmountSpecified(
    uint128 fillAmountSpecified,
    uint128 amountInRemaining
);
error InsufficientExecutionCredit(uint256 msgValue, uint256 minExecutionCredit);
error WithdrawAmountExceedsExecutionCredit(
    uint256 amount,
    uint256 executionCredit
);
error MsgValueIsNotCumulativeExecutionCredit(
    uint256 msgValue,
    uint256 cumulativeExecutionCredit
);

error ExecutorNotCheckedIn();
error InvalidToAddressBits();
error V2SwapFailed();
error V3SwapFailed();

Settings
{
  "remappings": [
    "ds-test/=lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "interfaces/=lib/interfaces/",
    "libraries/=lib/libraries/",
    "utils/=lib/utils/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_weth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ETHTransferFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"expectedAmountOut","type":"uint256"}],"name":"InsufficientOutputAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":true,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":true,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"}],"name":"SwapExactEthForToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"}],"name":"SwapExactTokenForEth","type":"event"},{"inputs":[],"name":"CONVEYOR_SWAP_EXECUTOR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"components":[{"internalType":"uint32","name":"zeroForOneBitmap","type":"uint32"},{"internalType":"uint32","name":"isUniV2Bitmap","type":"uint32"},{"internalType":"uint64","name":"toAddressBitmap","type":"uint64"},{"internalType":"uint128","name":"feeBitmap","type":"uint128"},{"internalType":"address","name":"tokenInDestination","type":"address"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct ConveyorSwapAggregator.Call[]","name":"calls","type":"tuple[]"}],"internalType":"struct ConveyorSwapAggregator.SwapAggregatorMulticall","name":"swapAggregatorMulticall","type":"tuple"}],"name":"swap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"components":[{"internalType":"uint32","name":"zeroForOneBitmap","type":"uint32"},{"internalType":"uint32","name":"isUniV2Bitmap","type":"uint32"},{"internalType":"uint64","name":"toAddressBitmap","type":"uint64"},{"internalType":"uint128","name":"feeBitmap","type":"uint128"},{"internalType":"address","name":"tokenInDestination","type":"address"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct ConveyorSwapAggregator.Call[]","name":"calls","type":"tuple[]"}],"internalType":"struct ConveyorSwapAggregator.SwapAggregatorMulticall","name":"swapAggregatorMulticall","type":"tuple"}],"name":"swapExactEthForToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"components":[{"internalType":"uint32","name":"zeroForOneBitmap","type":"uint32"},{"internalType":"uint32","name":"isUniV2Bitmap","type":"uint32"},{"internalType":"uint64","name":"toAddressBitmap","type":"uint64"},{"internalType":"uint128","name":"feeBitmap","type":"uint128"},{"internalType":"address","name":"tokenInDestination","type":"address"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct ConveyorSwapAggregator.Call[]","name":"calls","type":"tuple[]"}],"internalType":"struct ConveyorSwapAggregator.SwapAggregatorMulticall","name":"swapAggregatorMulticall","type":"tuple"}],"name":"swapExactTokenForEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60c060405234801561001057600080fd5b50604051611e21380380611e2183398101604081905261002f916100e7565b6001600160a01b0381166100895760405162461bcd60e51b815260206004820152601460248201527f574554482061646472657373206973207a65726f000000000000000000000000604482015260640160405180910390fd5b30604051610096906100da565b6001600160a01b039091168152602001604051809103906000f0801580156100c2573d6000803e3d6000fd5b506001600160a01b039081166080521660a052610117565b610eaa80610f7783390190565b6000602082840312156100f957600080fd5b81516001600160a01b038116811461011057600080fd5b9392505050565b60805160a051610e0b61016c6000396000818160c101528181610532015281816105ae0152818161064f015261067d0152600081816101110152818161025f015281816104b001526107b60152610e0b6000f3fe60806040526004361061004e5760003560e01c8063423170c11461005a5780634b93f48e1461007c578063a7ca11e61461009c578063ad5c4648146100af578063dba3df9c146100ff57600080fd5b3661005557005b600080fd5b34801561006657600080fd5b5061007a6100753660046109de565b610133565b005b34801561008857600080fd5b5061007a610097366004610a50565b6103ce565b61007a6100aa366004610ab1565b610649565b3480156100bb57600080fd5b506100e37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b34801561010b57600080fd5b506100e37f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b0385166323b872dd3361015360a0850160808601610b08565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604481018790526064016020604051808303816000875af11580156101a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cb9190610b2a565b506040516370a0823160e01b81523360048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015610213573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102379190610b4c565b905060006102458483610b7b565b604051633e55b15160e11b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690637cab62a2906102989086908a903390600401610cea565b600060405180830381600087803b1580156102b257600080fd5b505af11580156102c6573d6000803e3d6000fd5b50506040516370a0823160e01b8152336004820152600092506001600160a01b03881691506370a0823190602401602060405180830381865afa158015610311573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103359190610b4c565b905081811015610371576103498183610dc2565b60405163d28d3eb560e01b815260048101919091526024810186905260440160405180910390fd5b336001600160a01b03878116908a167f24043855bfbfea0ccea141e5a73d7116bf0bfe083ea900a791f4b407ff03e5258a6103ac8887610dc2565b6040805192835260208301919091520160405180910390a45050505050505050565b60006103e060a0830160808401610b08565b6001600160a01b031614610488576001600160a01b0384166323b872dd3361040e60a0850160808601610b08565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604481018690526064016020604051808303816000875af1158015610462573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104869190610b2a565b505b333160006104968483610b7b565b604051633e55b15160e11b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690637cab62a2906104e990869089903390600401610cea565b600060405180830381600087803b15801561050357600080fd5b505af1158015610517573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691506370a0823190602401602060405180830381865afa158015610582573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a69190610b4c565b90506105d2817f00000000000000000000000000000000000000000000000000000000000000006108f7565b6105dc334761093d565b33318211156105f057610349333183610dc2565b336001600160a01b0388167f71730b2743fef3aec2afda1b916ed3a684003215db164629f8257707ae97f1bb88610628878531610dc2565b6040805192835260208301919091520160405180910390a350505050505050565b610673347f000000000000000000000000000000000000000000000000000000000000000061096e565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663a9059cbb6106b260a0840160808501610b08565b6040516001600160e01b031960e084901b1681526001600160a01b0390911660048201523460248201526044016020604051808303816000875af11580156106fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107229190610b2a565b506040516370a0823160e01b81523360048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa15801561076a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078e9190610b4c565b9050600061079c8483610b7b565b604051633e55b15160e11b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690637cab62a2906107ef90869034903390600401610cea565b600060405180830381600087803b15801561080957600080fd5b505af115801561081d573d6000803e3d6000fd5b50506040516370a0823160e01b8152336004820152600092506001600160a01b03881691506370a0823190602401602060405180830381865afa158015610868573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088c9190610b4c565b9050818110156108a0576103498183610dc2565b336001600160a01b0387167fa4da7be9ebab4a91bef4bdc0d01c99c13eddfc84b00799c038e1004ab464d716346108d78786610dc2565b6040805192835260208301919091520160405180910390a3505050505050565b632e1a7d4d60e01b600052816004526000806044600080855af161093957817f4e617469766520546f6b656e205769746864726177206661696c656400000000fd5b5050565b600080600080600085875af19050806109695760405163b12d13eb60e01b815260040160405180910390fd5b505050565b630d0e30db60e41b600090815280808085855af161093957817f4e617469766520746f6b656e206465706f736974206661696c65640000000000fd5b80356001600160a01b03811681146109c157600080fd5b919050565b600060c082840312156109d857600080fd5b50919050565b600080600080600060a086880312156109f657600080fd5b6109ff866109aa565b945060208601359350610a14604087016109aa565b925060608601359150608086013567ffffffffffffffff811115610a3757600080fd5b610a43888289016109c6565b9150509295509295909350565b60008060008060808587031215610a6657600080fd5b610a6f856109aa565b93506020850135925060408501359150606085013567ffffffffffffffff811115610a9957600080fd5b610aa5878288016109c6565b91505092959194509250565b600080600060608486031215610ac657600080fd5b610acf846109aa565b925060208401359150604084013567ffffffffffffffff811115610af257600080fd5b610afe868287016109c6565b9150509250925092565b600060208284031215610b1a57600080fd5b610b23826109aa565b9392505050565b600060208284031215610b3c57600080fd5b81518015158114610b2357600080fd5b600060208284031215610b5e57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610b8e57610b8e610b65565b92915050565b803563ffffffff811681146109c157600080fd5b80356001600160801b03811681146109c157600080fd5b6000808335601e19843603018112610bd657600080fd5b830160208101925035905067ffffffffffffffff811115610bf657600080fd5b8060051b3603821315610c0857600080fd5b9250929050565b818352600060208085019450848460051b86018460005b87811015610cdd5783830389528135603e19883603018112610c4757600080fd5b870160406001600160a01b03610c5c836109aa565b16855286820135601e19833603018112610c7557600080fd5b90910186810191903567ffffffffffffffff811115610c9357600080fd5b803603831315610ca257600080fd5b818887015280828701526060915080838388013760008682018301529a87019a601f01601f1916909401909301925090840190600101610c26565b5090979650505050505050565b60608152600063ffffffff80610cff87610b94565b16606084015280610d1260208801610b94565b16608084015250604085013567ffffffffffffffff81168114610d3457600080fd5b67ffffffffffffffff1660a0830152610d4f60608601610ba8565b6001600160801b031660c0830152610d69608086016109aa565b6001600160a01b031660e0830152610d8460a0860186610bbf565b60c0610100850152610d9b61012085018284610c0f565b92505050836020830152610dba60408301846001600160a01b03169052565b949350505050565b81810381811115610b8e57610b8e610b6556fea264697066735822122009d84e52d9098f9a7c232948cc51ce85d60deaa6b3fce6e20854afcd6645085a64736f6c6343000810003360a060405234801561001057600080fd5b50604051610eaa380380610eaa83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610e1f61008b60003960006101d40152610e1f6000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80637cab62a21461003b578063fa461e3314610050575b600080fd5b61004e6100493660046107a5565b610063565b005b61004e61005e366004610805565b610371565b600061007260a0850185610885565b9150606090506000610089608087018784016108d6565b905060005b838110156103685760006100a560a0890189610885565b838181106100b5576100b5610906565b90506020028101906100c7919061091c565b6100d0906109ac565b905060006100f06100e460208b018b610a6c565b63ffffffff16846104a4565b90506101056100e460408b0160208c01610a6c565b156102985760008061013061012060608d0160408e01610a89565b67ffffffffffffffff16866104d6565b9050806003036101b257610145600189610ac9565b8503610164576040516337ca2c4360e11b815260040160405180910390fd5b61017160a08c018c610885565b61017c876001610adc565b81811061018b5761018b610906565b905060200281019061019d919061091c565b6101ab906020810190610aef565b91506101f6565b806002036101c2573091506101f6565b806001036101d2578891506101f6565b7f000000000000000000000000000000000000000000000000000000000000000091505b50610208898383866000015189610584565b8551604051929c5092985096506000916001600160a01b03169061022d908990610b30565b6000604051808303816000865af19150503d806000811461026a576040519150601f19603f3d011682016040523d82523d6000602084013e61026f565b606091505b50509050806102915760405163109b57e560e01b815260040160405180910390fd5b505061035e565b60008083600001516001600160a01b031684602001516040516102bb9190610b30565b6000604051808303816000865af19150503d80600081146102f8576040519150601f19603f3d011682016040523d82523d6000602084013e6102fd565b606091505b5091509150816103205760405163e898561560e01b815260040160405180910390fd5b600080828060200190518101906103379190610b42565b915091508461034e5761034982610b66565b610357565b61035781610b66565b9b50505050505b505060010161008e565b50505050505050565b6000808061038184860186610b90565b9250925092506000836103945786610396565b875b90506001600160a01b0382163014610427576040516323b872dd60e01b81526001600160a01b038381166004830152336024830152604482018390528416906323b872dd906064016020604051808303816000875af11580156103fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104219190610bd0565b5061049a565b60405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0384169063a9059cbb906044016020604051808303816000875af1158015610474573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104989190610bd0565b505b5050505050505050565b600067ffffffffffffffff83166104bc836002610cd1565b166000036104cc575060006104d0565b5060015b92915050565b60006104e3826002610cdd565b6003901b6001600160801b0384166104fc846002610cdd565b6003901b160361050e575060036104d0565b610519826002610cdd565b6002901b836001600160801b03168360026105349190610cdd565b6002901b1603610546575060026104d0565b610551826002610cdd565b6001901b6001600160801b03841661056a846002610cdd565b6001901b160361057c575060016104d0565b5060006104d0565b6060600080600080866001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156105ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ee9190610d18565b506e3fffffffffffffffffffffffffffff600a89901c1694506001600160701b0391821693501690506103ff86166106408b8b61062b578361062d565b845b8c610638578561063a565b845b846106ba565b94508961064d5784610650565b60005b8a61065c57600061065e565b855b60408051600081526020810190915261067e9291908c9060448101610d54565b60408051601f198184030181529190526020810180516001600160e01b031663022c0d9f60e01b1790529b949a50929850929650505050505050565b6000846000036106eb5760405163ec3e79fb60e01b8152600060048201526001602482015260440160405180910390fd5b8360000361070c5760405163bb55fd2760e01b815260040160405180910390fd5b8260000361072d5760405163bb55fd2760e01b815260040160405180910390fd5b600061073c83620186a0610da4565b61074b9062ffffff1687610cdd565b905060006107598583610cdd565b905060008261076b88620186a0610cdd565b6107759190610adc565b90506107818183610dc7565b98975050505050505050565b6001600160a01b03811681146107a257600080fd5b50565b6000806000606084860312156107ba57600080fd5b833567ffffffffffffffff8111156107d157600080fd5b840160c081870312156107e357600080fd5b92506020840135915060408401356107fa8161078d565b809150509250925092565b6000806000806060858703121561081b57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561084157600080fd5b818701915087601f83011261085557600080fd5b81358181111561086457600080fd5b88602082850101111561087657600080fd5b95989497505060200194505050565b6000808335601e1984360301811261089c57600080fd5b83018035915067ffffffffffffffff8211156108b757600080fd5b6020019150600581901b36038213156108cf57600080fd5b9250929050565b6000602082840312156108e857600080fd5b81356001600160801b03811681146108ff57600080fd5b9392505050565b634e487b7160e01b600052603260045260246000fd5b60008235603e1983360301811261093257600080fd5b9190910192915050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156109755761097561093c565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156109a4576109a461093c565b604052919050565b6000604082360312156109be57600080fd5b6109c6610952565b82356109d18161078d565b815260208381013567ffffffffffffffff808211156109ef57600080fd5b9085019036601f830112610a0257600080fd5b813581811115610a1457610a1461093c565b610a26601f8201601f1916850161097b565b91508082523684828501011115610a3c57600080fd5b80848401858401376000908201840152918301919091525092915050565b63ffffffff811681146107a257600080fd5b600060208284031215610a7e57600080fd5b81356108ff81610a5a565b600060208284031215610a9b57600080fd5b813567ffffffffffffffff811681146108ff57600080fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156104d0576104d0610ab3565b808201808211156104d0576104d0610ab3565b600060208284031215610b0157600080fd5b81356108ff8161078d565b60005b83811015610b27578181015183820152602001610b0f565b50506000910152565b60008251610932818460208701610b0c565b60008060408385031215610b5557600080fd5b505080516020909101519092909150565b6000600160ff1b8201610b7b57610b7b610ab3565b5060000390565b80151581146107a257600080fd5b600080600060608486031215610ba557600080fd5b8335610bb081610b82565b92506020840135610bc08161078d565b915060408401356107fa8161078d565b600060208284031215610be257600080fd5b81516108ff81610b82565b600181815b80851115610c28578160001904821115610c0e57610c0e610ab3565b80851615610c1b57918102915b93841c9390800290610bf2565b509250929050565b600082610c3f575060016104d0565b81610c4c575060006104d0565b8160018114610c625760028114610c6c57610c88565b60019150506104d0565b60ff841115610c7d57610c7d610ab3565b50506001821b6104d0565b5060208310610133831016604e8410600b8410161715610cab575081810a6104d0565b610cb58383610bed565b8060001904821115610cc957610cc9610ab3565b029392505050565b60006108ff8383610c30565b6000816000190483118215151615610cf757610cf7610ab3565b500290565b80516001600160701b0381168114610d1357600080fd5b919050565b600080600060608486031215610d2d57600080fd5b610d3684610cfc565b9250610d4460208501610cfc565b915060408401516107fa81610a5a565b84815283602082015260018060a01b03831660408201526080606082015260008251806080840152610d8d8160a0850160208701610b0c565b601f01601f19169190910160a00195945050505050565b62ffffff828116828216039080821115610dc057610dc0610ab3565b5092915050565b600082610de457634e487b7160e01b600052601260045260246000fd5b50049056fea2646970667358221220568effb7c2e8958f62cebbd4ab799c751b105cb5660391178d4e1a43e2b49b1364736f6c63430008100033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

Deployed Bytecode

0x60806040526004361061004e5760003560e01c8063423170c11461005a5780634b93f48e1461007c578063a7ca11e61461009c578063ad5c4648146100af578063dba3df9c146100ff57600080fd5b3661005557005b600080fd5b34801561006657600080fd5b5061007a6100753660046109de565b610133565b005b34801561008857600080fd5b5061007a610097366004610a50565b6103ce565b61007a6100aa366004610ab1565b610649565b3480156100bb57600080fd5b506100e37f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6040516001600160a01b03909116815260200160405180910390f35b34801561010b57600080fd5b506100e37f0000000000000000000000002da0e7531541e5b8448782aaf46ea3388b04d3fc81565b6001600160a01b0385166323b872dd3361015360a0850160808601610b08565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604481018790526064016020604051808303816000875af11580156101a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cb9190610b2a565b506040516370a0823160e01b81523360048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015610213573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102379190610b4c565b905060006102458483610b7b565b604051633e55b15160e11b81529091506001600160a01b037f0000000000000000000000002da0e7531541e5b8448782aaf46ea3388b04d3fc1690637cab62a2906102989086908a903390600401610cea565b600060405180830381600087803b1580156102b257600080fd5b505af11580156102c6573d6000803e3d6000fd5b50506040516370a0823160e01b8152336004820152600092506001600160a01b03881691506370a0823190602401602060405180830381865afa158015610311573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103359190610b4c565b905081811015610371576103498183610dc2565b60405163d28d3eb560e01b815260048101919091526024810186905260440160405180910390fd5b336001600160a01b03878116908a167f24043855bfbfea0ccea141e5a73d7116bf0bfe083ea900a791f4b407ff03e5258a6103ac8887610dc2565b6040805192835260208301919091520160405180910390a45050505050505050565b60006103e060a0830160808401610b08565b6001600160a01b031614610488576001600160a01b0384166323b872dd3361040e60a0850160808601610b08565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604481018690526064016020604051808303816000875af1158015610462573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104869190610b2a565b505b333160006104968483610b7b565b604051633e55b15160e11b81529091506001600160a01b037f0000000000000000000000002da0e7531541e5b8448782aaf46ea3388b04d3fc1690637cab62a2906104e990869089903390600401610cea565b600060405180830381600087803b15801561050357600080fd5b505af1158015610517573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600092507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031691506370a0823190602401602060405180830381865afa158015610582573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a69190610b4c565b90506105d2817f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26108f7565b6105dc334761093d565b33318211156105f057610349333183610dc2565b336001600160a01b0388167f71730b2743fef3aec2afda1b916ed3a684003215db164629f8257707ae97f1bb88610628878531610dc2565b6040805192835260208301919091520160405180910390a350505050505050565b610673347f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc261096e565b6001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21663a9059cbb6106b260a0840160808501610b08565b6040516001600160e01b031960e084901b1681526001600160a01b0390911660048201523460248201526044016020604051808303816000875af11580156106fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107229190610b2a565b506040516370a0823160e01b81523360048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa15801561076a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078e9190610b4c565b9050600061079c8483610b7b565b604051633e55b15160e11b81529091506001600160a01b037f0000000000000000000000002da0e7531541e5b8448782aaf46ea3388b04d3fc1690637cab62a2906107ef90869034903390600401610cea565b600060405180830381600087803b15801561080957600080fd5b505af115801561081d573d6000803e3d6000fd5b50506040516370a0823160e01b8152336004820152600092506001600160a01b03881691506370a0823190602401602060405180830381865afa158015610868573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088c9190610b4c565b9050818110156108a0576103498183610dc2565b336001600160a01b0387167fa4da7be9ebab4a91bef4bdc0d01c99c13eddfc84b00799c038e1004ab464d716346108d78786610dc2565b6040805192835260208301919091520160405180910390a3505050505050565b632e1a7d4d60e01b600052816004526000806044600080855af161093957817f4e617469766520546f6b656e205769746864726177206661696c656400000000fd5b5050565b600080600080600085875af19050806109695760405163b12d13eb60e01b815260040160405180910390fd5b505050565b630d0e30db60e41b600090815280808085855af161093957817f4e617469766520746f6b656e206465706f736974206661696c65640000000000fd5b80356001600160a01b03811681146109c157600080fd5b919050565b600060c082840312156109d857600080fd5b50919050565b600080600080600060a086880312156109f657600080fd5b6109ff866109aa565b945060208601359350610a14604087016109aa565b925060608601359150608086013567ffffffffffffffff811115610a3757600080fd5b610a43888289016109c6565b9150509295509295909350565b60008060008060808587031215610a6657600080fd5b610a6f856109aa565b93506020850135925060408501359150606085013567ffffffffffffffff811115610a9957600080fd5b610aa5878288016109c6565b91505092959194509250565b600080600060608486031215610ac657600080fd5b610acf846109aa565b925060208401359150604084013567ffffffffffffffff811115610af257600080fd5b610afe868287016109c6565b9150509250925092565b600060208284031215610b1a57600080fd5b610b23826109aa565b9392505050565b600060208284031215610b3c57600080fd5b81518015158114610b2357600080fd5b600060208284031215610b5e57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610b8e57610b8e610b65565b92915050565b803563ffffffff811681146109c157600080fd5b80356001600160801b03811681146109c157600080fd5b6000808335601e19843603018112610bd657600080fd5b830160208101925035905067ffffffffffffffff811115610bf657600080fd5b8060051b3603821315610c0857600080fd5b9250929050565b818352600060208085019450848460051b86018460005b87811015610cdd5783830389528135603e19883603018112610c4757600080fd5b870160406001600160a01b03610c5c836109aa565b16855286820135601e19833603018112610c7557600080fd5b90910186810191903567ffffffffffffffff811115610c9357600080fd5b803603831315610ca257600080fd5b818887015280828701526060915080838388013760008682018301529a87019a601f01601f1916909401909301925090840190600101610c26565b5090979650505050505050565b60608152600063ffffffff80610cff87610b94565b16606084015280610d1260208801610b94565b16608084015250604085013567ffffffffffffffff81168114610d3457600080fd5b67ffffffffffffffff1660a0830152610d4f60608601610ba8565b6001600160801b031660c0830152610d69608086016109aa565b6001600160a01b031660e0830152610d8460a0860186610bbf565b60c0610100850152610d9b61012085018284610c0f565b92505050836020830152610dba60408301846001600160a01b03169052565b949350505050565b81810381811115610b8e57610b8e610b6556fea264697066735822122009d84e52d9098f9a7c232948cc51ce85d60deaa6b3fce6e20854afcd6645085a64736f6c63430008100033

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

000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

-----Decoded View---------------
Arg [0] : _weth (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2


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