ETH Price: $3,465.74 (+3.96%)
Gas: 5 Gwei

Contract

0xbD96bca0d3A4fCC18Dc44D333A7851C513772289
 

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0xf76eca638a8bef84bcbe4cd4fb32a301fd369915feed427a37f209c2986a1083 Swap(pending)2024-07-14 5:05:5045 hrs ago1720933550IN
0xbD96bca0...513772289
0.0078 ETH(Pending)(Pending)
Swap203121272024-07-15 13:11:4713 hrs ago1721049107IN
0xbD96bca0...513772289
0.2 ETH0.001081386.72069624
Swap203113752024-07-15 10:40:4715 hrs ago1721040047IN
0xbD96bca0...513772289
0 ETH0.000518146.10994737
Swap203113482024-07-15 10:35:2315 hrs ago1721039723IN
0xbD96bca0...513772289
0 ETH0.000489745.77711764
Swap203038982024-07-14 9:38:3540 hrs ago1720949915IN
0xbD96bca0...513772289
0 ETH0.000797493.44509548
Swap203005642024-07-13 22:27:472 days ago1720909667IN
0xbD96bca0...513772289
0.062844 ETH0.000242591.7454496
Swap203004842024-07-13 22:11:472 days ago1720908707IN
0xbD96bca0...513772289
0.1049 ETH0.000197851.4231846
Swap203004392024-07-13 22:02:472 days ago1720908167IN
0xbD96bca0...513772289
0.037196 ETH0.000236331.70040178
Swap203004052024-07-13 21:55:472 days ago1720907747IN
0xbD96bca0...513772289
0.072123 ETH0.000184121.32474159
Swap203003792024-07-13 21:50:352 days ago1720907435IN
0xbD96bca0...513772289
0.165 ETH0.000187191.34650065
Swap203003202024-07-13 21:38:232 days ago1720906703IN
0xbD96bca0...513772289
0.061 ETH0.000247171.77838203
Swap203002712024-07-13 21:28:352 days ago1720906115IN
0xbD96bca0...513772289
0.072 ETH0.00019371.39390131
Swap203002512024-07-13 21:24:352 days ago1720905875IN
0xbD96bca0...513772289
0.14 ETH0.000211691.52296788
Swap202998432024-07-13 20:02:592 days ago1720900979IN
0xbD96bca0...513772289
1.031839 ETH0.000284072.07023037
Swap202995622024-07-13 19:06:472 days ago1720897607IN
0xbD96bca0...513772289
0.127201 ETH0.000209331.51183807
Swap202995012024-07-13 18:54:352 days ago1720896875IN
0xbD96bca0...513772289
0.0766 ETH0.000192781.3923429
Swap202994262024-07-13 18:39:352 days ago1720895975IN
0xbD96bca0...513772289
0 ETH0.000344332.25359072
Swap202993932024-07-13 18:32:592 days ago1720895579IN
0xbD96bca0...513772289
0.07 ETH0.000189941.3723385
Swap202993582024-07-13 18:25:592 days ago1720895159IN
0xbD96bca0...513772289
0.033 ETH0.000212541.53529074
Swap202985412024-07-13 15:41:472 days ago1720885307IN
0xbD96bca0...513772289
0 ETH0.000411462.44015124
Swap202983002024-07-13 14:53:112 days ago1720882391IN
0xbD96bca0...513772289
0 ETH0.000675012.71537168
Swap202965602024-07-13 9:02:232 days ago1720861343IN
0xbD96bca0...513772289
0.18 ETH0.000300211.94691822
Swap202960002024-07-13 7:09:592 days ago1720854599IN
0xbD96bca0...513772289
0 ETH0.000573452.62831626
Swap202910302024-07-12 14:30:353 days ago1720794635IN
0xbD96bca0...513772289
0 ETH0.001499895
Swap202909732024-07-12 14:19:113 days ago1720793951IN
0xbD96bca0...513772289
0 ETH0.000996125.88384294
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
203121272024-07-15 13:11:4713 hrs ago1721049107
0xbD96bca0...513772289
0.2 ETH
203113752024-07-15 10:40:4715 hrs ago1721040047
0xbD96bca0...513772289
0.211492 ETH
203113752024-07-15 10:40:4715 hrs ago1721040047
0xbD96bca0...513772289
0.211492 ETH
203113482024-07-15 10:35:2315 hrs ago1721039723
0xbD96bca0...513772289
0.04951 ETH
203113482024-07-15 10:35:2315 hrs ago1721039723
0xbD96bca0...513772289
0.04951 ETH
203038982024-07-14 9:38:3540 hrs ago1720949915
0xbD96bca0...513772289
0.1492333 ETH
203038982024-07-14 9:38:3540 hrs ago1720949915
0xbD96bca0...513772289
0.1492333 ETH
203005642024-07-13 22:27:472 days ago1720909667
0xbD96bca0...513772289
0.062844 ETH
203004842024-07-13 22:11:472 days ago1720908707
0xbD96bca0...513772289
0.1049 ETH
203004392024-07-13 22:02:472 days ago1720908167
0xbD96bca0...513772289
0.037196 ETH
203004052024-07-13 21:55:472 days ago1720907747
0xbD96bca0...513772289
0.072123 ETH
203003792024-07-13 21:50:352 days ago1720907435
0xbD96bca0...513772289
0.165 ETH
203003202024-07-13 21:38:232 days ago1720906703
0xbD96bca0...513772289
0.061 ETH
203002712024-07-13 21:28:352 days ago1720906115
0xbD96bca0...513772289
0.072 ETH
203002512024-07-13 21:24:352 days ago1720905875
0xbD96bca0...513772289
0.14 ETH
202998432024-07-13 20:02:592 days ago1720900979
0xbD96bca0...513772289
1.031839 ETH
202995622024-07-13 19:06:472 days ago1720897607
0xbD96bca0...513772289
0.127201 ETH
202995012024-07-13 18:54:352 days ago1720896875
0xbD96bca0...513772289
0.0766 ETH
202993932024-07-13 18:32:592 days ago1720895579
0xbD96bca0...513772289
0.07 ETH
202993582024-07-13 18:25:592 days ago1720895159
0xbD96bca0...513772289
0.033 ETH
202985412024-07-13 15:41:472 days ago1720885307
0xbD96bca0...513772289
0.22858129 ETH
202985412024-07-13 15:41:472 days ago1720885307
0xbD96bca0...513772289
0.22858129 ETH
202983002024-07-13 14:53:112 days ago1720882391
0xbD96bca0...513772289
0.17009299 ETH
202983002024-07-13 14:53:112 days ago1720882391
0xbD96bca0...513772289
0.17009299 ETH
202965602024-07-13 9:02:232 days ago1720861343
0xbD96bca0...513772289
0.18 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MagpieRouterV2

Compiler Version
v0.8.22+commit.4fc1097e

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion, MIT license
File 1 of 15 : MagpieRouterV2.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;

import {Ownable2Step} from "openzeppelin-solidity/contracts/access/Ownable2Step.sol";
import {Pausable} from "openzeppelin-solidity/contracts/security/Pausable.sol";
import {Multicall} from "openzeppelin-solidity/contracts/utils/Multicall.sol";
import {IMagpieRouterV2} from "./interfaces/IMagpieRouterV2.sol";
import {LibAsset} from "./libraries/LibAsset.sol";
import {AppStorage, LibMagpieRouterV2} from "./libraries/LibMagpieRouterV2.sol";
import {LibSwap, SwapData} from "./libraries/LibSwap.sol";
import {LibCommand, CommandAction, CommandData} from "./router/LibCommand.sol";
import {LibUniswapV3} from "./router/LibUniswapV3.sol";

error ExpiredTransaction();
error InsufficientAmountOut();
error InvalidCall();
error InvalidCommand();
error InvalidTransferFromCall();

contract MagpieRouterV2 is IMagpieRouterV2, Ownable2Step, Multicall, Pausable {
    using LibAsset for address;

    /// @dev See {IMagpieRouterV2-router}
    function pause() external onlyOwner {
        _pause();
    }

    /// @dev See {IMagpieRouterV2-unpause}
    function unpause() external onlyOwner {
        _unpause();
    }

    /// @dev See {IMagpieRouterV2-updateSelector}
    function updateSelector(uint16 commandType, bytes4 selector) external onlyOwner {
        AppStorage storage s = LibMagpieRouterV2.getStorage();

        s.selectors[commandType] = selector;
    }

    /// @dev See {IMagpieRouterV2-getSelector}
    function getSelector(uint16 commandType) external view returns (bytes4) {
        AppStorage storage s = LibMagpieRouterV2.getStorage();

        return s.selectors[commandType];
    }

    /// @dev Enforces time constraints on certain operations within a smart contract.
    /// @param deadline The timestamp in epochs beyond which the transaction will get expired.
    function enforceDeadline(uint256 deadline) private view {
        if (deadline < block.timestamp) {
            revert ExpiredTransaction();
        }
    }

    /// @dev Handle uniswapV3SwapCallback requests from any protocol that is based on UniswapV3. We dont check for factory since this contract is not supposed to store tokens. We protect the user by handling amountOutMin check at the end of execution by comparing starting and final balance at the destination address.
    fallback() external {
        int256 amount0Delta;
        int256 amount1Delta;
        address assetIn;
        uint256 callDataSize;
        assembly {
            amount0Delta := calldataload(4)
            amount1Delta := calldataload(36)
            assetIn := shr(96, calldataload(132))
            callDataSize := calldatasize()
        }

        if (callDataSize != 164) {
            revert InvalidCall();
        }

        LibUniswapV3.uniswapV3SwapCallback(amount0Delta, amount1Delta, assetIn);
    }

    /// @dev Determinines whether a specific command action within a swap sequence involves moving tokens.
    function isTokenMovement(CommandAction commandAction) private pure returns (bool) {
        return
            commandAction == CommandAction.Approval ||
            commandAction == CommandAction.TransferFrom ||
            commandAction == CommandAction.Transfer ||
            commandAction == CommandAction.Wrap ||
            commandAction == CommandAction.Unwrap;
    }

    /// @dev See {IMagpieRouterV2-estimateSwapGas}
    function estimateSwapGas(bytes calldata) external payable returns (uint256 amountOut, uint256 gasUsed) {
        (amountOut, gasUsed) = execute(true);
    }

    /// @dev See {IMagpieRouterV2-swap}
    function swap(bytes calldata) external payable whenNotPaused returns (uint256 amountOut) {
        (amountOut, ) = execute(true);
    }

    /// @dev See {IMagpieRouterV2-silentSwap}
    function silentSwap(bytes calldata) external payable whenNotPaused returns (uint256 amountOut) {
        (amountOut, ) = execute(false);
    }

    /// @dev Handles the execution of a sequence of commands for the swap operation.
    /// @param triggerEvent An indicator if the function needs to trigger the swap event.
    /// @return amountOut The amount received after swapping.
    /// @return gasUsed The gas utilised during swapping.
    function execute(bool triggerEvent) private returns (uint256 amountOut, uint256 gasUsed) {
        SwapData memory swapData = LibSwap.getData(LibSwap.SWAP_ARGS_OFFSET);

        enforceDeadline(swapData.deadline);

        amountOut = swapData.toAssetAddress.getBalanceOf(swapData.toAddress);

        bytes memory commandOutput = new bytes(swapData.outputsLength);
        uint16 i;
        CommandData memory commandData;
        uint256 nativeAmount;
        uint256 tmpAmount;
        bytes memory input;

        uint256 commandOutputOffset;
        assembly {
            commandOutputOffset := add(commandOutput, 32)
        }

        for (i = swapData.commandsOffset; i < swapData.commandsOffsetEnd; ) {
            commandData = LibCommand.getData(i);

            (nativeAmount, input) = LibCommand.getInput(commandOutput, commandData);

            if (commandData.commandAction == CommandAction.Call) {
                bytes4 selector;

                assembly {
                    selector := mload(add(input, 32))
                }

                if (selector == 0x23b872dd || selector == 0) {
                    // Blacklist transferFrom in custom calls
                    revert InvalidTransferFromCall();
                }

                assembly {
                    let outputLength := mload(add(commandData, 64))
                    if iszero(
                        call(
                            gas(),
                            mload(add(commandData, 160)),
                            nativeAmount,
                            add(input, 32),
                            mload(input),
                            commandOutputOffset,
                            outputLength
                        )
                    ) {
                        returndatacopy(0, 0, returndatasize())
                        revert(0, returndatasize())
                    }
                    commandOutputOffset := add(commandOutputOffset, outputLength)
                }
            } else if (commandData.commandAction == CommandAction.Approval) {
                LibCommand.approve(input);
            } else if (commandData.commandAction == CommandAction.TransferFrom) {
                LibCommand.transferFrom(input);
            } else if (commandData.commandAction == CommandAction.Transfer) {
                LibCommand.transfer(input);
            } else if (commandData.commandAction == CommandAction.Wrap) {
                LibCommand.wrap(input);
            } else if (commandData.commandAction == CommandAction.Unwrap) {
                LibCommand.unwrap(input);
            } else if (commandData.commandAction == CommandAction.Balance) {
                tmpAmount = LibCommand.balance(input);
                assembly {
                    mstore(commandOutputOffset, tmpAmount)
                    commandOutputOffset := add(commandOutputOffset, 32)
                }
            } else if (commandData.commandAction == CommandAction.Math) {
                tmpAmount = LibCommand.math(input);
                assembly {
                    mstore(commandOutputOffset, tmpAmount)
                    commandOutputOffset := add(commandOutputOffset, 32)
                }
            } else if (commandData.commandAction == CommandAction.Comparison) {
                tmpAmount = LibCommand.comparison(input);
                assembly {
                    mstore(commandOutputOffset, tmpAmount)
                    commandOutputOffset := add(commandOutputOffset, 32)
                }
            } else if (commandData.commandAction == CommandAction.EstimateGasStart) {
                gasUsed = gasleft();
            } else if (commandData.commandAction == CommandAction.EstimateGasEnd) {
                gasUsed -= gasleft();
            } else {
                revert InvalidCommand();
            }

            assembly {
                if gt(commandOutputOffset, add(add(commandOutput, 32), mload(commandOutput))) {
                    revert(0, 0)
                }
            }

            unchecked {
                i += 11;
            }
        }

        amountOut = swapData.toAssetAddress.getBalanceOf(swapData.toAddress) - amountOut;

        if (amountOut < swapData.amountOutMin) {
            revert InsufficientAmountOut();
        }

        if (triggerEvent) {
            emit Swap(
                msg.sender,
                swapData.toAddress,
                swapData.fromAssetAddress,
                swapData.toAssetAddress,
                swapData.amountIn,
                amountOut
            );
        }
    }

    /// @dev Used to receive ethers
    receive() external payable {}
}

File 2 of 15 : IMagpieRouterV2.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;

interface IMagpieRouterV2 {
    /// @dev Allows the owner to pause the contract.
    function pause() external;

    /// @dev Allows the owner to unpause the contract.
    function unpause() external;

    /// @dev Allows the owner to update the mapping of command types to function selectors.
    /// @param commandType Identifier for each command. We have one selector / command.
    /// @param selector The function selector for each of these commands.
    function updateSelector(uint16 commandType, bytes4 selector) external;

    /// @dev Gets the selector at the specific commandType.
    /// @param commandType Identifier for each command. We have one selector / command.
    /// @return selector The function selector for the specified command.
    function getSelector(uint16 commandType) external view returns (bytes4);

    event Swap(
        address indexed fromAddress,
        address indexed toAddress,
        address fromAssetAddress,
        address toAssetAddress,
        uint256 amountIn,
        uint256 amountOut
    );

    /// @dev Provides an external interface to estimate the gas cost of the last hop in a route.
    /// @return amountOut The amount received after swapping.
    /// @return gasUsed The cost of gas while performing the swap.
    function estimateSwapGas(bytes calldata swapArgs) external payable returns (uint256 amountOut, uint256 gasUsed);

    /// @dev Performs token swap.
    /// @return amountOut The amount received after swapping.
    function swap(bytes calldata swapArgs) external payable returns (uint256 amountOut);

    /// @dev Performs token swap without triggering event.
    /// @return amountOut The amount received after swapping.
    function silentSwap(bytes calldata swapArgs) external payable returns (uint256 amountOut);
}

File 3 of 15 : IWETH.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;

interface IWETH {
    function deposit() external payable;

    function transfer(address to, uint256 value) external returns (bool);

    function withdraw(uint256) external;
}

File 4 of 15 : LibAsset.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;

import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "../interfaces/IWETH.sol";

error AssetNotReceived();
error ApprovalFailed();
error TransferFromFailed();
error TransferFailed();

library LibAsset {
    using LibAsset for address;

    address constant NATIVE_ASSETID = address(0);

    /// @dev Checks if the given address (self) represents a native asset (Ether).
    /// @param self The asset that will be checked for a native token.
    /// @return Flag to identify if the asset is native or not.
    function isNative(address self) internal pure returns (bool) {
        return self == NATIVE_ASSETID;
    }

    /// @dev Retrieves the balance of the current contract for a given asset (self).
    /// @param self Asset whose balance needs to be found.
    /// @return Balance of the specific asset.
    function getBalance(address self) internal view returns (uint256) {
        return self.isNative() ? address(this).balance : IERC20(self).balanceOf(address(this));
    }

    /// @dev Retrieves the balance of the target address for a given asset (self).
    /// @param self Asset whose balance needs to be found.
    /// @param targetAddress The address where the balance is checked from.
    /// @return Balance of the specific asset.
    function getBalanceOf(address self, address targetAddress) internal view returns (uint256) {
        return self.isNative() ? targetAddress.balance : IERC20(self).balanceOf(targetAddress);
    }

    /// @dev Performs a safe transferFrom operation for a given asset (self) from one address (from) to another address (to).
    /// @param self Asset that will be transferred.
    /// @param from Address that will send the asset.
    /// @param to Address that will receive the asset.
    /// @param amount Transferred amount.
    function transferFrom(address self, address from, address to, uint256 amount) internal {
        IERC20 token = IERC20(self);

        bool success = execute(self, abi.encodeWithSelector(token.transferFrom.selector, from, to, amount));

        if (!success) revert TransferFromFailed();
    }

    /// @dev Transfers a given amount of an asset (self) to a recipient address (recipient).
    /// @param self Asset that will be transferred.
    /// @param recipient Address that will receive the transferred asset.
    /// @param amount Transferred amount.
    function transfer(address self, address recipient, uint256 amount) internal {
        IERC20 token = IERC20(self);
        bool success;

        if (self.isNative()) {
            (success, ) = payable(recipient).call{value: amount}("");
        } else {
            success = execute(self, abi.encodeWithSelector(token.transfer.selector, recipient, amount));
        }

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

    /// @dev Approves a spender address (spender) to spend a specified amount of an asset (self).
    /// @param self The asset that will be approved.
    /// @param spender Address of a contract that will spend the owners asset.
    /// @param amount Asset amount that can be spent.
    function approve(address self, address spender, uint256 amount) internal {
        IERC20 token = IERC20(self);

        if (!execute(self, abi.encodeWithSelector(token.approve.selector, spender, amount))) {
            if (
                !execute(self, abi.encodeWithSelector(token.approve.selector, spender, 0)) ||
                !(execute(self, abi.encodeWithSelector(token.approve.selector, spender, amount)))
            ) {
                revert ApprovalFailed();
            }
        }
    }

    /// @dev Determines if a call was successful.
    /// @param target Address of the target contract.
    /// @param success To check if the call to the contract was successful or not.
    /// @param data The data was sent while calling the target contract.
    /// @return result The success of the call.
    function isSuccessful(address target, bool success, bytes memory data) private view returns (bool result) {
        if (success) {
            if (data.length == 0) {
                // isContract
                if (target.code.length > 0) {
                    result = true;
                }
            } else {
                assembly {
                    result := mload(add(data, 32))
                }
            }
        }
    }

    /// @dev Executes a low level call.
    /// @param self The address of the contract to which the call is being made.
    /// @param params The parameters or data to be sent in the call.
    /// @return result The success of the call.
    function execute(address self, bytes memory params) private returns (bool) {
        (bool success, bytes memory data) = self.call(params);

        return isSuccessful(self, success, data);
    }

    /// @dev Deposit of a specified amount of an asset (self).
    /// @param self Address of the asset that will be deposited.
    /// @param weth Address of the Wrapped Ether (WETH) contract.
    /// @param amount Amount that needs to be deposited.
    function deposit(address self, address weth, uint256 amount) internal {
        if (self.isNative()) {
            if (msg.value < amount) {
                revert AssetNotReceived();
            }
            IWETH(weth).deposit{value: amount}();
        } else {
            self.transferFrom(msg.sender, address(this), amount);
        }
    }

    /// @dev Withdrawal of a specified amount of an asset (self) to a designated address (to).
    /// @param self The asset that will be withdrawn.
    /// @param weth Address of the Wrapped Ether (WETH) contract.
    /// @param to Address that will receive withdrawn token.
    /// @param amount Amount that needs to be withdrawn
    function withdraw(address self, address weth, address to, uint256 amount) internal {
        if (self.isNative()) {
            IWETH(weth).withdraw(amount);
        }
        self.transfer(payable(to), amount);
    }

    /// @dev Retrieves the decimal precision of an ERC20 token.
    /// @param self The asset address whose decimals we are retrieving.
    /// @return tokenDecimals The decimals of the asset.
    function getDecimals(address self) internal view returns (uint8 tokenDecimals) {
        tokenDecimals = 18;

        if (!self.isNative()) {
            (, bytes memory queriedDecimals) = self.staticcall(abi.encodeWithSignature("decimals()"));
            tokenDecimals = abi.decode(queriedDecimals, (uint8));
        }
    }
}

File 5 of 15 : LibMagpieRouterV2.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;

struct AppStorage {
    mapping(uint16 => bytes4) selectors; // Mapping of command to its corresponding function selector.
}

library LibMagpieRouterV2 {
    function getStorage() internal pure returns (AppStorage storage s) {
        assembly {
            s.slot := 0
        }
    }
}

File 6 of 15 : LibSwap.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;

import {LibAsset} from "../libraries/LibAsset.sol";

struct SwapData {
    uint16 amountsOffset; // Represents the offset for the amounts section in the transaction calldata
    uint16 dataOffset; // Represents the offset for reusable data section in the calldata.
    uint16 commandsOffset; // Represents the starting point of the commands section in the calldata.
    uint16 commandsOffsetEnd; // Represents the end of the commands section in the calldata.
    uint16 outputsLength; // Represents the length of all of the commands
    uint256 amountIn; // Representing the amount of the asset being provided in the swap.
    address toAddress; // This is the address to which the output of the swap (the swapped asset) will be sent.
    address fromAssetAddress; // The address of the source asset being swapped from.
    address toAssetAddress; // The address of the final asset being swapped to.
    uint256 deadline; // Represents the deadline by which the swap must be completed.
    uint256 amountOutMin; // The minimum amount of the output asset that must be received for the swap to be considered successful.
}

library LibSwap {
    using LibAsset for address;

    uint16 constant SWAP_ARGS_OFFSET = 68;

    /// @dev Extracts and sums up the amounts of the source asset.
    /// @param startOffset Relative starting position.
    /// @param endOffset Ending position.
    /// @param positionOffset Absolute starting position.
    /// @return amountIn Sum of amounts.
    function getAmountIn(
        uint16 startOffset,
        uint16 endOffset,
        uint16 positionOffset
    ) internal pure returns (uint256 amountIn) {
        for (uint16 i = startOffset; i < endOffset; ) {
            uint256 currentAmountIn;
            assembly {
                let p := shr(240, calldataload(i))
                currentAmountIn := calldataload(add(p, positionOffset))
            }
            amountIn += currentAmountIn;

            unchecked {
                i += 2;
            }
        }
    }

    /// @dev Extract the first amount.
    /// @param swapArgsOffset Starting position of swapArgs in calldata.
    /// @return amountIn First amount in.
    function getFirstAmountIn(uint16 swapArgsOffset) internal pure returns (uint256 amountIn) {
        uint16 position = swapArgsOffset + 4;
        assembly {
            amountIn := calldataload(position)
        }
    }

    /// @dev Extracts SwapData from calldata.
    /// @param swapArgsOffset Starting position of swapArgs in calldata.
    /// @return swapData Essential data for the swap.
    function getData(uint16 swapArgsOffset) internal pure returns (SwapData memory swapData) {
        uint16 dataLength;
        uint16 amountsLength;
        uint16 dataOffset;
        uint16 swapArgsLength;
        assembly {
            dataLength := shr(240, calldataload(swapArgsOffset))
            amountsLength := shr(240, calldataload(add(swapArgsOffset, 2)))
            swapArgsLength := calldataload(sub(swapArgsOffset, 32))
        }
        dataOffset = swapArgsOffset + 4;
        swapData.dataOffset = dataOffset;
        swapData.amountsOffset = swapData.dataOffset + dataLength;
        swapData.commandsOffset = swapData.amountsOffset + amountsLength;
        swapData.commandsOffsetEnd = swapArgsLength + swapArgsOffset;
        // Depends on the context we have shift the position addSelector
        // By default the position is adjusted to the router's offset
        uint256 amountIn = getAmountIn(
            swapData.amountsOffset,
            swapData.commandsOffset,
            swapArgsOffset - SWAP_ARGS_OFFSET
        );

        assembly {
            mstore(add(swapData, 128), shr(240, calldataload(add(dataOffset, 32))))
            mstore(add(swapData, 160), amountIn)
            mstore(add(swapData, 192), shr(96, calldataload(add(dataOffset, 34))))
            mstore(add(swapData, 224), shr(96, calldataload(add(dataOffset, 54))))
            mstore(add(swapData, 256), shr(96, calldataload(add(dataOffset, 74))))
            mstore(add(swapData, 288), calldataload(add(dataOffset, 94)))
            mstore(add(swapData, 320), calldataload(add(dataOffset, 126)))
        }
    }
}

File 7 of 15 : LibCommand.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;

import "../interfaces/IWETH.sol";
import {LibAsset} from "../libraries/LibAsset.sol";
import {AppStorage, LibMagpieRouterV2} from "../libraries/LibMagpieRouterV2.sol";
import {LibSwap, SwapData} from "../libraries/LibSwap.sol";

enum MathOperator {
    None,
    Add,
    Sub,
    Mul,
    Div,
    Pow,
    Abs128,
    Abs256,
    Shr,
    Shl
}

enum ComparisonOperator {
    None,
    Lt,
    Lte,
    Gt,
    Gte,
    Eq,
    Ne
}

enum CommandAction {
    Call, // Represents a generic call to a function within a contract.
    Approval, // Represents an approval operation.
    TransferFrom, // Indicates a transfer-from operation.
    Transfer, // Represents a direct transfer operation.
    Wrap, // This action is used for wrapping native tokens.
    Unwrap, // This action is used for unwrapping native tokens.
    Balance, // Checks the balance of an account or contract for a specific asset.
    Math,
    Comparison,
    EstimateGasStart,
    EstimateGasEnd
}

enum SequenceType {
    NativeAmount,
    Selector,
    Address,
    Amount,
    Data, // Parameter represented in bytes.
    CommandOutput, // Parameter using the output of an other command.
    RouterAddress, // The address of this contract.
    SenderAddress // The address of the caller.
}

struct CommandData {
    CommandAction commandAction;
    uint16 inputLength; // Specifies the length of the input data for this command.
    uint16 outputLength; // Specifies the length of the output data for this command.
    uint16 sequencesPosition; // Specifies the starting position of a sequence of data related to this command.
    uint16 sequencesPositionEnd; // Marks the end position of the sequence of data.
    address targetAddress; // The address of the contract that is the target of this command.
}

error CommandFailed(bytes data);
error InvalidAmountOut();
error InvalidSequenceType();
error InvalidSelector();
error InvalidSelectorPosition();
error InvalidSequencesLength();
error InvalidTransferFrom();

library LibCommand {
    using LibAsset for address;

    /// @dev Extracts and assembles a CommandData structure from transaction calldata.
    /// @param i The starting position in the calldata from where data extraction should begin.
    /// @return commandData Describes the specific command.
    function getData(uint16 i) internal pure returns (CommandData memory commandData) {
        assembly {
            mstore(commandData, shr(248, calldataload(i)))
            mstore(add(commandData, 32), shr(240, calldataload(add(i, 1))))
            mstore(add(commandData, 64), shr(240, calldataload(add(i, 3))))
            mstore(add(commandData, 96), shr(240, calldataload(add(i, 5))))
            mstore(add(commandData, 128), shr(240, calldataload(add(i, 7))))
            let targetPosition := shr(240, calldataload(add(i, 9)))
            mstore(add(commandData, 160), shr(96, calldataload(targetPosition)))
        }
    }

    /// @dev Extracts data that is required for the next command's execution.
    /// @param commandOutput Summarized byte code received / calculated after each command execution.
    /// @param commandData Describes the specific command.
    /// @return nativeAmount Amount in native tokens.
    /// @return input The calldata that has to be executed by the next command.
    function getInput(
        bytes memory commandOutput,
        CommandData memory commandData
    ) internal view returns (uint256 nativeAmount, bytes memory input) {
        AppStorage storage s = LibMagpieRouterV2.getStorage();
        input = new bytes(commandData.inputLength);

        SequenceType sequenceType;
        uint16 p;
        uint16 l;
        uint16 inputOffset = 32;
        bytes4 selector;
        for (uint16 i = commandData.sequencesPosition; i < commandData.sequencesPositionEnd; ) {
            assembly {
                sequenceType := shr(248, calldataload(i))
            }

            if (sequenceType == SequenceType.NativeAmount) {
                assembly {
                    p := shr(240, calldataload(add(i, 1)))
                    l := shr(240, calldataload(add(i, 3)))
                    switch l
                    case 1 {
                        nativeAmount := mload(add(add(commandOutput, 32), p))
                    }
                    default {
                        nativeAmount := calldataload(p)
                    }
                }
                unchecked {
                    i += 5;
                }
            } else if (sequenceType == SequenceType.Selector) {
                assembly {
                    p := shr(240, calldataload(add(i, 1)))
                }
                if (inputOffset != 32) {
                    revert InvalidSelectorPosition();
                }
                selector = s.selectors[p];
                assembly {
                    mstore(add(input, inputOffset), selector)
                }
                inputOffset += 4;
                unchecked {
                    i += 3;
                }
            } else if (sequenceType == SequenceType.Address) {
                assembly {
                    p := shr(240, calldataload(add(i, 1)))
                    mstore(add(input, inputOffset), shr(96, calldataload(p)))
                }
                inputOffset += 32;
                unchecked {
                    i += 3;
                }
            } else if (sequenceType == SequenceType.Amount) {
                assembly {
                    p := shr(240, calldataload(add(i, 1)))
                    mstore(add(input, inputOffset), calldataload(p))
                }
                inputOffset += 32;
                unchecked {
                    i += 3;
                }
            } else if (sequenceType == SequenceType.Data) {
                assembly {
                    p := shr(240, calldataload(add(i, 1)))
                    l := shr(240, calldataload(add(i, 3)))
                    calldatacopy(add(input, inputOffset), p, l)
                }
                inputOffset += l;
                unchecked {
                    i += 5;
                }
            } else if (sequenceType == SequenceType.CommandOutput) {
                assembly {
                    p := shr(240, calldataload(add(i, 1)))
                    mstore(add(input, inputOffset), mload(add(add(commandOutput, 32), p)))
                }
                inputOffset += 32;
                unchecked {
                    i += 3;
                }
            } else if (sequenceType == SequenceType.RouterAddress) {
                assembly {
                    mstore(add(input, inputOffset), address())
                }
                inputOffset += 32;
                unchecked {
                    i += 1;
                }
            } else if (sequenceType == SequenceType.SenderAddress) {
                assembly {
                    mstore(add(input, inputOffset), caller())
                }
                inputOffset += 32;
                unchecked {
                    i += 1;
                }
            } else {
                revert InvalidSequenceType();
            }
        }

        if (inputOffset - 32 != commandData.inputLength) {
            revert InvalidSequencesLength();
        }

        if (commandData.commandAction == CommandAction.Call) {
            if (selector == 0) {
                revert InvalidSelector();
            }
        }
    }

    /// @dev Math operations.
    function math(bytes memory input) internal pure returns (uint256) {
        uint256[] memory localOutputs = new uint256[](10);
        bytes32 amount0;
        bytes32 amount1;
        MathOperator operator;

        for (uint8 i = 0; i <= 9; ) {
            assembly {
                let pos := add(add(input, 32), mul(i, 3))
                let amount0Index := shr(248, mload(add(pos, 1)))
                if lt(amount0Index, 10) {
                    amount0 := mload(add(add(localOutputs, 32), mul(amount0Index, 32)))
                }
                if gt(amount0Index, 9) {
                    amount0Index := sub(amount0Index, 10)
                    amount0 := mload(add(add(input, 64), mul(amount0Index, 32)))
                }
                let amount1Index := shr(248, mload(add(pos, 2)))
                if lt(amount1Index, 10) {
                    amount1 := mload(add(add(localOutputs, 32), mul(amount1Index, 32)))
                }
                if gt(amount1Index, 9) {
                    amount1Index := sub(amount1Index, 10)
                    amount1 := mload(add(add(input, 64), mul(amount1Index, 32)))
                }
                operator := shr(248, mload(pos))
            }

            if (operator == MathOperator.None) {
                return localOutputs[i - 1];
            } else if (operator == MathOperator.Add) {
                localOutputs[i] = uint256(amount0) + uint256(amount1);
            } else if (operator == MathOperator.Sub) {
                localOutputs[i] = uint256(amount0) - uint256(amount1);
            } else if (operator == MathOperator.Mul) {
                localOutputs[i] = uint256(amount0) * uint256(amount1);
            } else if (operator == MathOperator.Div) {
                localOutputs[i] = uint256(amount0) / uint256(amount1);
            } else if (operator == MathOperator.Pow) {
                localOutputs[i] = uint256(amount0) ** uint256(amount1);
            } else if (operator == MathOperator.Abs128) {
                int128 amount;
                assembly {
                    amount := amount0
                }

                if (amount < 0) {
                    localOutputs[i] = uint256(uint128(-(amount)));
                } else {
                    localOutputs[i] = uint256(uint128(amount));
                }
            } else if (operator == MathOperator.Abs256) {
                int256 amount;
                assembly {
                    amount := amount0
                }

                if (amount < 0) {
                    localOutputs[i] = uint256(-(amount));
                } else {
                    localOutputs[i] = uint256(amount);
                }
            } else if (operator == MathOperator.Shr) {
                assembly {
                    mstore(add(add(localOutputs, 32), mul(i, 32)), shr(amount0, amount1))
                }
            } else if (operator == MathOperator.Shl) {
                assembly {
                    mstore(add(add(localOutputs, 32), mul(i, 32)), shl(amount0, amount1))
                }
            }

            unchecked {
                i++;
            }
        }

        return localOutputs[9];
    }

    /// @dev Comparison operations.
    function comparison(bytes memory input) internal pure returns (uint256) {
        uint256[] memory localOutputs = new uint256[](6);
        bytes32 amount0;
        bytes32 amount1;
        bytes32 amount2;
        bytes32 amount3;
        ComparisonOperator operator;

        for (uint8 i = 0; i <= 5; ) {
            assembly {
                let pos := add(add(input, 32), mul(i, 5))
                let amount0Index := shr(248, mload(add(pos, 1)))
                if lt(amount0Index, 6) {
                    amount0 := mload(add(add(localOutputs, 32), mul(amount0Index, 32)))
                }
                if gt(amount0Index, 5) {
                    amount0Index := sub(amount0Index, 6)
                    amount0 := mload(add(add(input, 64), mul(amount0Index, 32)))
                }
                let amount1Index := shr(248, mload(add(pos, 2)))
                if lt(amount1Index, 6) {
                    amount1 := mload(add(add(localOutputs, 32), mul(amount1Index, 32)))
                }
                if gt(amount1Index, 5) {
                    amount1Index := sub(amount1Index, 6)
                    amount1 := mload(add(add(input, 64), mul(amount1Index, 32)))
                }
                let amount2Index := shr(248, mload(add(pos, 3)))
                if lt(amount2Index, 6) {
                    amount2 := mload(add(add(localOutputs, 32), mul(amount2Index, 32)))
                }
                if gt(amount2Index, 5) {
                    amount2Index := sub(amount2Index, 6)
                    amount2 := mload(add(add(input, 64), mul(amount2Index, 32)))
                }
                let amount3Index := shr(248, mload(add(pos, 4)))
                if lt(amount3Index, 6) {
                    amount3 := mload(add(add(localOutputs, 32), mul(amount3Index, 32)))
                }
                if gt(amount3Index, 5) {
                    amount3Index := sub(amount3Index, 6)
                    amount3 := mload(add(add(input, 64), mul(amount3Index, 32)))
                }
                operator := shr(248, mload(pos))
            }

            if (operator == ComparisonOperator.None) {
                return localOutputs[i - 1];
            } else if (operator == ComparisonOperator.Lt) {
                localOutputs[i] = uint256(amount0) < uint256(amount1) ? uint256(amount2) : uint256(amount3);
            } else if (operator == ComparisonOperator.Lte) {
                localOutputs[i] = uint256(amount0) <= uint256(amount1) ? uint256(amount2) : uint256(amount3);
            } else if (operator == ComparisonOperator.Gt) {
                localOutputs[i] = uint256(amount0) > uint256(amount1) ? uint256(amount2) : uint256(amount3);
            } else if (operator == ComparisonOperator.Gte) {
                localOutputs[i] = uint256(amount0) >= uint256(amount1) ? uint256(amount2) : uint256(amount3);
            } else if (operator == ComparisonOperator.Eq) {
                localOutputs[i] = uint256(amount0) == uint256(amount1) ? uint256(amount2) : uint256(amount3);
            } else if (operator == ComparisonOperator.Ne) {
                localOutputs[i] = uint256(amount0) != uint256(amount1) ? uint256(amount2) : uint256(amount3);
            }

            unchecked {
                i++;
            }
        }

        return localOutputs[5];
    }

    /// @dev Perform an ERC-20 token approval operation.
    /// @param input Parameters required by approve.
    function approve(bytes memory input) internal {
        address assetAddress;
        address spenderAddress;
        uint256 amount;
        assembly {
            assetAddress := mload(add(input, 32))
            spenderAddress := mload(add(input, 64))
            amount := mload(add(input, 96))
        }

        if (amount == 0) {
            return;
        }

        assetAddress.approve(spenderAddress, amount);
    }

    /// @dev Perform an ERC-20 token transfer from one address to another.
    /// @param input Parameters required by transferFrom.
    function transferFrom(bytes memory input) internal {
        address assetAddress;
        address fromAddress;
        address toAddress;
        uint256 amount;
        assembly {
            assetAddress := mload(add(input, 32))
            fromAddress := mload(add(input, 64))
            toAddress := mload(add(input, 96))
            amount := mload(add(input, 128))
        }

        if (fromAddress != msg.sender) {
            revert InvalidTransferFrom();
        }

        if (amount == 0) {
            return;
        }

        assetAddress.transferFrom(fromAddress, toAddress, amount);
    }

    /// @dev Perform an ERC-20 token transfer to a specified address.
    /// @param input Parameters required by transfer.
    function transfer(bytes memory input) internal {
        address assetAddress;
        address toAddress;
        uint256 amount;
        assembly {
            assetAddress := mload(add(input, 32))
            toAddress := mload(add(input, 64))
            amount := mload(add(input, 96))
        }

        if (amount == 0) {
            return;
        }

        assetAddress.transfer(toAddress, amount);
    }

    /// @dev Convert native token into wrapped native token.
    /// @param input Parameters required by wrap.
    function wrap(bytes memory input) internal {
        address assetAddress;
        uint256 amount;
        assembly {
            assetAddress := mload(add(input, 32))
            amount := mload(add(input, 64))
        }

        IWETH(assetAddress).deposit{value: amount}();
    }

    /// @dev Convert wrapped native token into native token.
    /// @param input Parameters required by unwrap.
    function unwrap(bytes memory input) internal {
        address assetAddress;
        uint256 amount;
        assembly {
            assetAddress := mload(add(input, 32))
            amount := mload(add(input, 64))
        }

        IWETH(assetAddress).withdraw(amount);
    }

    /// @dev Query the balance of a specific asset.
    /// @param input Parameters required by balance.
    /// @return Balance of the specific asset
    function balance(bytes memory input) internal view returns (uint256) {
        address assetAddress;
        assembly {
            assetAddress := mload(add(input, 32))
        }

        return assetAddress.getBalanceOf(address(this));
    }
}

File 8 of 15 : LibUniswapV3.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;

import {LibAsset} from "../libraries/LibAsset.sol";

error UniswapV3InvalidAmount();

library LibUniswapV3 {
    using LibAsset for address;

    /// @dev Callback function used in Uniswap V3 swaps, typically called by the Uniswap V3 pool contract during a swap operation.
    /// @param amount0Delta Changes in the amount of the first token involved in the swap.
    /// @param amount1Delta Changes in the amount of the second token involved in the swap.
    /// @param assetIn Asset that has to be transfered to the UniswapV3 pool.
    function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, address assetIn) internal {
        if (amount0Delta <= 0 && amount1Delta <= 0) {
            revert UniswapV3InvalidAmount();
        }

        assetIn.transfer(msg.sender, amount0Delta > 0 ? uint256(amount0Delta) : uint256(amount1Delta));
    }
}

File 9 of 15 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 10 of 15 : Ownable2Step.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.0;

import "./Ownable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

    event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Returns the address of the pending owner.
     */
    function pendingOwner() public view virtual returns (address) {
        return _pendingOwner;
    }

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
        _transferOwnership(sender);
    }
}

File 11 of 15 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 12 of 15 : IERC20.sol
// 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);
}

File 13 of 15 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 14 of 15 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 15 of 15 : Multicall.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)

pragma solidity ^0.8.0;

import "./Address.sol";

/**
 * @dev Provides a function to batch together multiple calls in a single external call.
 *
 * _Available since v4.1._
 */
abstract contract Multicall {
    /**
     * @dev Receives and executes a batch of function calls on this contract.
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {
        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            results[i] = Address.functionDelegateCall(address(this), data[i]);
        }
        return results;
    }
}

Settings
{
  "evmVersion": "paris",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"name":"ApprovalFailed","type":"error"},{"inputs":[],"name":"ExpiredTransaction","type":"error"},{"inputs":[],"name":"InsufficientAmountOut","type":"error"},{"inputs":[],"name":"InvalidCall","type":"error"},{"inputs":[],"name":"InvalidCommand","type":"error"},{"inputs":[],"name":"InvalidSelector","type":"error"},{"inputs":[],"name":"InvalidSelectorPosition","type":"error"},{"inputs":[],"name":"InvalidSequenceType","type":"error"},{"inputs":[],"name":"InvalidSequencesLength","type":"error"},{"inputs":[],"name":"InvalidTransferFrom","type":"error"},{"inputs":[],"name":"InvalidTransferFromCall","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"TransferFromFailed","type":"error"},{"inputs":[],"name":"UniswapV3InvalidAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"fromAddress","type":"address"},{"indexed":true,"internalType":"address","name":"toAddress","type":"address"},{"indexed":false,"internalType":"address","name":"fromAssetAddress","type":"address"},{"indexed":false,"internalType":"address","name":"toAssetAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"estimateSwapGas","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"commandType","type":"uint16"}],"name":"getSelector","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"silentSwap","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"swap","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"commandType","type":"uint16"},{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"updateSelector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b5061001a3361002c565b6001805460ff60a01b19169055610098565b600180546001600160a01b031916905561004581610048565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61231580620000a86000396000f3fe6080604052600436106100e15760003560e01c80638456cb591161007f578063dc13bc7c11610059578063dc13bc7c146102a8578063e30c3978146102bb578063e423ad64146102d9578063f2fde38b146102f9576100e8565b80638456cb59146102345780638da5cb5b14610249578063ac9650d81461027b576100e8565b8063627dd56a116100bb578063627dd56a146101c1578063715018a6146101e257806379ba5097146101f757806383bf23211461020c576100e8565b806308447842146101305780633f4ba83a146101825780635c975abb14610197576100e8565b366100e857005b3480156100f457600080fd5b5060043560243560843560601c3660a481146101235760405163574b16a760e11b815260040160405180910390fd5b61012e848484610319565b005b34801561013c57600080fd5b5061016461014b366004611dd0565b61ffff1660009081526020819052604090205460e01b90565b6040516001600160e01b031990911681526020015b60405180910390f35b34801561018e57600080fd5b5061012e610373565b3480156101a357600080fd5b50600154600160a01b900460ff166040519015158152602001610179565b6101d46101cf366004611deb565b610385565b604051908152602001610179565b3480156101ee57600080fd5b5061012e6103a1565b34801561020357600080fd5b5061012e6103b3565b61021f61021a366004611deb565b610432565b60408051928352602083019190915201610179565b34801561024057600080fd5b5061012e61044a565b34801561025557600080fd5b506000546001600160a01b03165b6040516001600160a01b039091168152602001610179565b34801561028757600080fd5b5061029b610296366004611e5d565b61045a565b6040516101799190611f10565b6101d46102b6366004611deb565b610545565b3480156102c757600080fd5b506001546001600160a01b0316610263565b3480156102e557600080fd5b5061012e6102f4366004611f74565b610559565b34801561030557600080fd5b5061012e610314366004611fb8565b61058d565b6000831315801561032b575060008213155b1561034957604051637ed0826d60e11b815260040160405180910390fd5b61036e336000851361035b578361035d565b845b6001600160a01b03841691906105fe565b505050565b61037b6106f3565b61038361074d565b565b600061038f6107a2565b61039960016107ef565b509392505050565b6103a96106f3565b6103836000610c60565b60015433906001600160a01b031681146104265760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61042f81610c60565b50565b60008061043f60016107ef565b909590945092505050565b6104526106f3565b610383610c79565b60608167ffffffffffffffff81111561047557610475611fe1565b6040519080825280602002602001820160405280156104a857816020015b60608152602001906001900390816104935790505b50905060005b8281101561053d57610518308585848181106104cc576104cc611ff7565b90506020028101906104de919061200d565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610cbc92505050565b82828151811061052a5761052a611ff7565b60209081029190910101526001016104ae565b505b92915050565b600061054f6107a2565b61039960006107ef565b6105616106f3565b61ffff919091166000908152602081905260409020805463ffffffff191660e09290921c919091179055565b6105956106f3565b600180546001600160a01b0383166001600160a01b031990911681179091556105c66000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b8260006001600160a01b038216610668576040516001600160a01b038516908490600081818185875af1925050503d8060008114610658576040519150601f19603f3d011682016040523d82523d6000602084013e61065d565b606091505b5050809150506106ce565b6040516001600160a01b0385166024820152604481018490526106cb90869063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ce8565b90505b806106ec576040516312171d8360e31b815260040160405180910390fd5b5050505050565b6000546001600160a01b031633146103835760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041d565b610755610d60565b6001805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600154600160a01b900460ff16156103835760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161041d565b60008060006107fe6044610db0565b905061080e816101200151610eea565b6108338160c001518261010001516001600160a01b0316610f0b90919063ffffffff16565b92506000816080015161ffff1667ffffffffffffffff81111561085857610858611fe1565b6040519080825280601f01601f191660200182016040528015610882576020820181803683370190505b506040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905291925090604084015191506000806060602086015b876060015161ffff168661ffff161015610b8a576040805160c081018252873560f81c8152600188013560f090811c60208301526003890135811c928201929092526005880135821c6060808301919091526007890135831c6080830152600989013590921c3590911c60a082015294506109448786610f9b565b909450915060008551600a81111561095e5761095e61205b565b036109db5760208201516323b872dd60e01b6001600160e01b03198216148061098f57506001600160e01b03198116155b156109ad576040516305d46a3960e21b815260040160405180910390fd5b604086015180838551602087018960a08c01515af16109d0573d6000803e3d6000fd5b919091019050610b6c565b60018551600a8111156109f0576109f061205b565b03610a03576109fe826112d9565b610b6c565b60028551600a811115610a1857610a1861205b565b03610a26576109fe82611311565b60038551600a811115610a3b57610a3b61205b565b03610a49576109fe82611372565b60048551600a811115610a5e57610a5e61205b565b03610a6c576109fe826113a4565b60058551600a811115610a8157610a8161205b565b03610a8f576109fe8261140e565b60068551600a811115610aa457610aa461205b565b03610abf57610ab282611477565b8082529250602001610b6c565b60078551600a811115610ad457610ad461205b565b03610ae257610ab282611492565b60088551600a811115610af757610af761205b565b03610b0557610ab2826117da565b60098551600a811115610b1a57610b1a61205b565b03610b27575a9850610b6c565b600a8551600a811115610b3c57610b3c61205b565b03610b53575a610b4c908a612087565b9850610b6c565b6040516312f269e560e01b815260040160405180910390fd5b86516020880101811115610b7f57600080fd5b600b860195506108c9565b89610bb08960c001518a61010001516001600160a01b0316610f0b90919063ffffffff16565b610bba9190612087565b99508761014001518a1015610be257604051637294b85560e11b815260040160405180910390fd5b8a15610c535760c088015160e08901516101008a015160a08b0151604080516001600160a01b0394851681529284166020840152820152606081018d905291169033907f20efd6d5195b7b50273f01cd79a27989255356f9f13293edc53ee142accfdb759060800160405180910390a35b5050505050505050915091565b600180546001600160a01b031916905561042f81611abf565b610c816107a2565b6001805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586107853390565b6060610ce183836040518060600160405280602781526020016122b960279139611b0f565b9392505050565b6000806000846001600160a01b031684604051610d05919061209a565b6000604051808303816000865af19150503d8060008114610d42576040519150601f19603f3d011682016040523d82523d6000602084013e610d47565b606091505b5091509150610d57858383611b87565b95945050505050565b600154600160a01b900460ff166103835760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161041d565b6040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101829052610140810191909152813560f090811c906002840135901c6000601f19850135610e2b8660046120b6565b61ffff811660208701819052909250610e459085906120b6565b61ffff16808652610e579084906120b6565b61ffff166040860152610e6a86826120b6565b61ffff16606086015284516040860151600091610e9191610e8c60448b6120d1565b611bbb565b602084013560f01c608088015260a087015250506022810135606090811c60c08601526036820135811c60e0860152604a820135901c610100850152605e810135610120850152607e0135610140840152509092915050565b4281101561042f5760405163931997cf60e01b815260040160405180910390fd5b60006001600160a01b03831615610f8b576040516370a0823160e01b81526001600160a01b0383811660048301528416906370a0823190602401602060405180830381865afa158015610f62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8691906120ec565b610ce1565b506001600160a01b031631919050565b6000606081836020015161ffff1667ffffffffffffffff811115610fc157610fc1611fe1565b6040519080825280601f01601f191660200182016040528015610feb576020820181803683370190505b50915060008060008060209050600080896060015190505b896080015161ffff168161ffff16101561124e57803560f81c955060008660078111156110325761103261205b565b0361107057600181013560f01c9450600381013560f01c9350836001811461105d5785359950611067565b8560208d01015199505b50600501611003565b60018660078111156110845761108461205b565b036110ec57600181013560f01c94508261ffff166020146110b857604051635566551960e01b815260040160405180910390fd5b61ffff851660009081526020889052604090205460e01b88840181905291506110e26004846120b6565b9250600301611003565b60028660078111156111005761110061205b565b0361112357600181013560f01c803560601c8985015294506110e26020846120b6565b60038660078111156111375761113761205b565b0361115757600181013560f01c80358985015294506110e26020846120b6565b600486600781111561116b5761116b61205b565b0361119e57600181013560f01c9450600381013560f01c93508385848a013761119484846120b6565b9250600501611003565b60058660078111156111b2576111b261205b565b036111d957600181013560f01c94508460208c010151838901526020836110e291906120b6565b60068660078111156111ed576111ed61205b565b0361120c5730888401526112026020846120b6565b9250600101611003565b60078660078111156112205761122061205b565b036112355733888401526112026020846120b6565b604051635485b7ef60e11b815260040160405180910390fd5b50886020015161ffff1660208361126591906120d1565b61ffff161461128757604051632dbf5cd360e11b815260040160405180910390fd5b60008951600a81111561129c5761129c61205b565b036112cc576001600160e01b031981166000036112cc57604051631cd4b64760e21b815260040160405180910390fd5b5050505050509250929050565b60208101516040820151606083015160008190036112f75750505050565b61130b6001600160a01b0384168383611bec565b50505050565b60208101516040820151606083015160808401516001600160a01b038316331461134e576040516322fe1f0760e01b815260040160405180910390fd5b8060000361135d575050505050565b6106ec6001600160a01b038516848484611ca9565b60208101516040820151606083015160008190036113905750505050565b61130b6001600160a01b03841683836105fe565b6000806020830151915060408301519050816001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156113f057600080fd5b505af1158015611404573d6000803e3d6000fd5b5050505050505050565b60208101516040808301519051632e1a7d4d60e01b8152600481018290526001600160a01b03831690632e1a7d4d90602401600060405180830381600087803b15801561145a57600080fd5b505af115801561146e573d6000803e3d6000fd5b50505050505050565b6020810151600090610ce16001600160a01b03821630610f0b565b60408051600a8082526101608201909252600091829190602082016101408036833701905050905060008080805b60098160ff16116117b357600381026020880101600181015160f81c600a8110156114f2576020810260208801015195505b600981111561150e57600a810390506020810260408a01015195505b50600281015160f81c600a81101561152d576020810260208801015194505b600981111561154957600a810390506020810260408a01015194505b505160f81c915060008260098111156115645761156461205b565b0361159c5784611575600183612105565b60ff168151811061158857611588611ff7565b602002602001015195505050505050919050565b60018260098111156115b0576115b061205b565b036115e5576115bf838561211e565b858260ff16815181106115d4576115d4611ff7565b6020026020010181815250506117ab565b60028260098111156115f9576115f961205b565b03611608576115bf8385612087565b600382600981111561161c5761161c61205b565b0361162b576115bf8385612131565b600482600981111561163f5761163f61205b565b0361164e576115bf8385612148565b60058260098111156116625761166261205b565b03611671576115bf838561224e565b60068260098111156116855761168561205b565b0361170257836000600f82900b12156116d0576116a18161225a565b6001600160801b0316868360ff16815181106116bf576116bf611ff7565b6020026020010181815250506116fc565b806001600160801b0316868360ff16815181106116ef576116ef611ff7565b6020026020010181815250505b506117ab565b60078260098111156117165761171661205b565b03611759578360008112156117435761172e81612289565b868360ff16815181106116bf576116bf611ff7565b80868360ff16815181106116ef576116ef611ff7565b600882600981111561176d5761176d61205b565b036117845782841c602082026020870101526117ab565b60098260098111156117985761179861205b565b036117ab5782841b602082026020870101525b6001016114c0565b50836009815181106117c7576117c7611ff7565b6020026020010151945050505050919050565b60408051600680825260e082019092526000918291906020820160c080368337019050509050600080808080805b60058160ff1611611a96576005810260208a0101600181015160f81c600681101561183a576020810260208a01015197505b6005811115611856576006810390506020810260408c01015197505b50600281015160f81c6006811015611875576020810260208a01015196505b6005811115611891576006810390506020810260408c01015196505b50600381015160f81c60068110156118b0576020810260208a01015195505b60058111156118cc576006810390506020810260408c01015195505b50600481015160f81c60068110156118eb576020810260208a01015194505b6005811115611907576006810390506020810260408c01015194505b505160f81c915060008260068111156119225761192261205b565b0361195c5786611933600183612105565b60ff168151811061194657611946611ff7565b6020026020010151975050505050505050919050565b60018260068111156119705761197061205b565b036119aa578486106119825782611984565b835b878260ff168151811061199957611999611ff7565b602002602001018181525050611a8e565b60028260068111156119be576119be61205b565b036119d157848611156119825782611984565b60038260068111156119e5576119e561205b565b036119f7578486116119825782611984565b6004826006811115611a0b57611a0b61205b565b03611a1e57848610156119825782611984565b6005826006811115611a3257611a3261205b565b03611a44578585146119825782611984565b6006826006811115611a5857611a5861205b565b03611a8e57848603611a6a5782611a6c565b835b878260ff1681518110611a8157611a81611ff7565b6020026020010181815250505b600101611808565b5085600581518110611aaa57611aaa611ff7565b60200260200101519650505050505050919050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060600080856001600160a01b031685604051611b2c919061209a565b600060405180830381855af49150503d8060008114611b67576040519150601f19603f3d011682016040523d82523d6000602084013e611b6c565b606091505b5091509150611b7d86838387611d0e565b9695505050505050565b60008215610ce1578151600003611bb0576001600160a01b0384163b15610f8657506001610ce1565b506020015192915050565b6000835b8361ffff168161ffff16101561039957803560f01c830135611be1818461211e565b925050600201611bbf565b6040516001600160a01b0383166024820152604481018290528390611c1e90829063095ea7b360e01b90606401610694565b61130b576040516001600160a01b038416602482015260006044820152611c5290859063095ea7b360e01b90606401610694565b1580611c8b57506040516001600160a01b038416602482015260448101839052611c8990859063095ea7b360e01b90606401610694565b155b1561130b576040516340b27c2160e11b815260040160405180910390fd5b6040516001600160a01b03808516602483015283166044820152606481018290528490600090611ce69083906323b872dd60e01b90608401610694565b905080611d0657604051631e4e7d0960e21b815260040160405180910390fd5b505050505050565b60608315611d7d578251600003611d76576001600160a01b0385163b611d765760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161041d565b5081611d87565b611d878383611d8f565b949350505050565b815115611d9f5781518083602001fd5b8060405162461bcd60e51b815260040161041d91906122a5565b803561ffff81168114611dcb57600080fd5b919050565b600060208284031215611de257600080fd5b610ce182611db9565b60008060208385031215611dfe57600080fd5b823567ffffffffffffffff80821115611e1657600080fd5b818501915085601f830112611e2a57600080fd5b813581811115611e3957600080fd5b866020828501011115611e4b57600080fd5b60209290920196919550909350505050565b60008060208385031215611e7057600080fd5b823567ffffffffffffffff80821115611e8857600080fd5b818501915085601f830112611e9c57600080fd5b813581811115611eab57600080fd5b8660208260051b8501011115611e4b57600080fd5b60005b83811015611edb578181015183820152602001611ec3565b50506000910152565b60008151808452611efc816020860160208601611ec0565b601f01601f19169290920160200192915050565b600060208083016020845280855180835260408601915060408160051b87010192506020870160005b82811015611f6757603f19888603018452611f55858351611ee4565b94509285019290850190600101611f39565b5092979650505050505050565b60008060408385031215611f8757600080fd5b611f9083611db9565b915060208301356001600160e01b031981168114611fad57600080fd5b809150509250929050565b600060208284031215611fca57600080fd5b81356001600160a01b0381168114610ce157600080fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261202457600080fd5b83018035915067ffffffffffffffff82111561203f57600080fd5b60200191503681900382131561205457600080fd5b9250929050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8181038181111561053f5761053f612071565b600082516120ac818460208701611ec0565b9190910192915050565b61ffff81811683821601908082111561053d5761053d612071565b61ffff82811682821603908082111561053d5761053d612071565b6000602082840312156120fe57600080fd5b5051919050565b60ff828116828216039081111561053f5761053f612071565b8082018082111561053f5761053f612071565b808202811582820484141761053f5761053f612071565b60008261216557634e487b7160e01b600052601260045260246000fd5b500490565b600181815b808511156121a557816000190482111561218b5761218b612071565b8085161561219857918102915b93841c939080029061216f565b509250929050565b6000826121bc5750600161053f565b816121c95750600061053f565b81600181146121df57600281146121e957612205565b600191505061053f565b60ff8411156121fa576121fa612071565b50506001821b61053f565b5060208310610133831016604e8410600b8410161715612228575081810a61053f565b612232838361216a565b806000190482111561224657612246612071565b029392505050565b6000610ce183836121ad565b600081600f0b6f7fffffffffffffffffffffffffffffff19810361228057612280612071565b60000392915050565b6000600160ff1b820161229e5761229e612071565b5060000390565b602081526000610ce16020830184611ee456fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212204d60953d9c1dba7324547672955def95732cf0c22185bac77027ae41dd108e9b64736f6c63430008160033

Deployed Bytecode

0x6080604052600436106100e15760003560e01c80638456cb591161007f578063dc13bc7c11610059578063dc13bc7c146102a8578063e30c3978146102bb578063e423ad64146102d9578063f2fde38b146102f9576100e8565b80638456cb59146102345780638da5cb5b14610249578063ac9650d81461027b576100e8565b8063627dd56a116100bb578063627dd56a146101c1578063715018a6146101e257806379ba5097146101f757806383bf23211461020c576100e8565b806308447842146101305780633f4ba83a146101825780635c975abb14610197576100e8565b366100e857005b3480156100f457600080fd5b5060043560243560843560601c3660a481146101235760405163574b16a760e11b815260040160405180910390fd5b61012e848484610319565b005b34801561013c57600080fd5b5061016461014b366004611dd0565b61ffff1660009081526020819052604090205460e01b90565b6040516001600160e01b031990911681526020015b60405180910390f35b34801561018e57600080fd5b5061012e610373565b3480156101a357600080fd5b50600154600160a01b900460ff166040519015158152602001610179565b6101d46101cf366004611deb565b610385565b604051908152602001610179565b3480156101ee57600080fd5b5061012e6103a1565b34801561020357600080fd5b5061012e6103b3565b61021f61021a366004611deb565b610432565b60408051928352602083019190915201610179565b34801561024057600080fd5b5061012e61044a565b34801561025557600080fd5b506000546001600160a01b03165b6040516001600160a01b039091168152602001610179565b34801561028757600080fd5b5061029b610296366004611e5d565b61045a565b6040516101799190611f10565b6101d46102b6366004611deb565b610545565b3480156102c757600080fd5b506001546001600160a01b0316610263565b3480156102e557600080fd5b5061012e6102f4366004611f74565b610559565b34801561030557600080fd5b5061012e610314366004611fb8565b61058d565b6000831315801561032b575060008213155b1561034957604051637ed0826d60e11b815260040160405180910390fd5b61036e336000851361035b578361035d565b845b6001600160a01b03841691906105fe565b505050565b61037b6106f3565b61038361074d565b565b600061038f6107a2565b61039960016107ef565b509392505050565b6103a96106f3565b6103836000610c60565b60015433906001600160a01b031681146104265760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61042f81610c60565b50565b60008061043f60016107ef565b909590945092505050565b6104526106f3565b610383610c79565b60608167ffffffffffffffff81111561047557610475611fe1565b6040519080825280602002602001820160405280156104a857816020015b60608152602001906001900390816104935790505b50905060005b8281101561053d57610518308585848181106104cc576104cc611ff7565b90506020028101906104de919061200d565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610cbc92505050565b82828151811061052a5761052a611ff7565b60209081029190910101526001016104ae565b505b92915050565b600061054f6107a2565b61039960006107ef565b6105616106f3565b61ffff919091166000908152602081905260409020805463ffffffff191660e09290921c919091179055565b6105956106f3565b600180546001600160a01b0383166001600160a01b031990911681179091556105c66000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b8260006001600160a01b038216610668576040516001600160a01b038516908490600081818185875af1925050503d8060008114610658576040519150601f19603f3d011682016040523d82523d6000602084013e61065d565b606091505b5050809150506106ce565b6040516001600160a01b0385166024820152604481018490526106cb90869063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ce8565b90505b806106ec576040516312171d8360e31b815260040160405180910390fd5b5050505050565b6000546001600160a01b031633146103835760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161041d565b610755610d60565b6001805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600154600160a01b900460ff16156103835760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161041d565b60008060006107fe6044610db0565b905061080e816101200151610eea565b6108338160c001518261010001516001600160a01b0316610f0b90919063ffffffff16565b92506000816080015161ffff1667ffffffffffffffff81111561085857610858611fe1565b6040519080825280601f01601f191660200182016040528015610882576020820181803683370190505b506040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905291925090604084015191506000806060602086015b876060015161ffff168661ffff161015610b8a576040805160c081018252873560f81c8152600188013560f090811c60208301526003890135811c928201929092526005880135821c6060808301919091526007890135831c6080830152600989013590921c3590911c60a082015294506109448786610f9b565b909450915060008551600a81111561095e5761095e61205b565b036109db5760208201516323b872dd60e01b6001600160e01b03198216148061098f57506001600160e01b03198116155b156109ad576040516305d46a3960e21b815260040160405180910390fd5b604086015180838551602087018960a08c01515af16109d0573d6000803e3d6000fd5b919091019050610b6c565b60018551600a8111156109f0576109f061205b565b03610a03576109fe826112d9565b610b6c565b60028551600a811115610a1857610a1861205b565b03610a26576109fe82611311565b60038551600a811115610a3b57610a3b61205b565b03610a49576109fe82611372565b60048551600a811115610a5e57610a5e61205b565b03610a6c576109fe826113a4565b60058551600a811115610a8157610a8161205b565b03610a8f576109fe8261140e565b60068551600a811115610aa457610aa461205b565b03610abf57610ab282611477565b8082529250602001610b6c565b60078551600a811115610ad457610ad461205b565b03610ae257610ab282611492565b60088551600a811115610af757610af761205b565b03610b0557610ab2826117da565b60098551600a811115610b1a57610b1a61205b565b03610b27575a9850610b6c565b600a8551600a811115610b3c57610b3c61205b565b03610b53575a610b4c908a612087565b9850610b6c565b6040516312f269e560e01b815260040160405180910390fd5b86516020880101811115610b7f57600080fd5b600b860195506108c9565b89610bb08960c001518a61010001516001600160a01b0316610f0b90919063ffffffff16565b610bba9190612087565b99508761014001518a1015610be257604051637294b85560e11b815260040160405180910390fd5b8a15610c535760c088015160e08901516101008a015160a08b0151604080516001600160a01b0394851681529284166020840152820152606081018d905291169033907f20efd6d5195b7b50273f01cd79a27989255356f9f13293edc53ee142accfdb759060800160405180910390a35b5050505050505050915091565b600180546001600160a01b031916905561042f81611abf565b610c816107a2565b6001805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586107853390565b6060610ce183836040518060600160405280602781526020016122b960279139611b0f565b9392505050565b6000806000846001600160a01b031684604051610d05919061209a565b6000604051808303816000865af19150503d8060008114610d42576040519150601f19603f3d011682016040523d82523d6000602084013e610d47565b606091505b5091509150610d57858383611b87565b95945050505050565b600154600160a01b900460ff166103835760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161041d565b6040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101829052610140810191909152813560f090811c906002840135901c6000601f19850135610e2b8660046120b6565b61ffff811660208701819052909250610e459085906120b6565b61ffff16808652610e579084906120b6565b61ffff166040860152610e6a86826120b6565b61ffff16606086015284516040860151600091610e9191610e8c60448b6120d1565b611bbb565b602084013560f01c608088015260a087015250506022810135606090811c60c08601526036820135811c60e0860152604a820135901c610100850152605e810135610120850152607e0135610140840152509092915050565b4281101561042f5760405163931997cf60e01b815260040160405180910390fd5b60006001600160a01b03831615610f8b576040516370a0823160e01b81526001600160a01b0383811660048301528416906370a0823190602401602060405180830381865afa158015610f62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8691906120ec565b610ce1565b506001600160a01b031631919050565b6000606081836020015161ffff1667ffffffffffffffff811115610fc157610fc1611fe1565b6040519080825280601f01601f191660200182016040528015610feb576020820181803683370190505b50915060008060008060209050600080896060015190505b896080015161ffff168161ffff16101561124e57803560f81c955060008660078111156110325761103261205b565b0361107057600181013560f01c9450600381013560f01c9350836001811461105d5785359950611067565b8560208d01015199505b50600501611003565b60018660078111156110845761108461205b565b036110ec57600181013560f01c94508261ffff166020146110b857604051635566551960e01b815260040160405180910390fd5b61ffff851660009081526020889052604090205460e01b88840181905291506110e26004846120b6565b9250600301611003565b60028660078111156111005761110061205b565b0361112357600181013560f01c803560601c8985015294506110e26020846120b6565b60038660078111156111375761113761205b565b0361115757600181013560f01c80358985015294506110e26020846120b6565b600486600781111561116b5761116b61205b565b0361119e57600181013560f01c9450600381013560f01c93508385848a013761119484846120b6565b9250600501611003565b60058660078111156111b2576111b261205b565b036111d957600181013560f01c94508460208c010151838901526020836110e291906120b6565b60068660078111156111ed576111ed61205b565b0361120c5730888401526112026020846120b6565b9250600101611003565b60078660078111156112205761122061205b565b036112355733888401526112026020846120b6565b604051635485b7ef60e11b815260040160405180910390fd5b50886020015161ffff1660208361126591906120d1565b61ffff161461128757604051632dbf5cd360e11b815260040160405180910390fd5b60008951600a81111561129c5761129c61205b565b036112cc576001600160e01b031981166000036112cc57604051631cd4b64760e21b815260040160405180910390fd5b5050505050509250929050565b60208101516040820151606083015160008190036112f75750505050565b61130b6001600160a01b0384168383611bec565b50505050565b60208101516040820151606083015160808401516001600160a01b038316331461134e576040516322fe1f0760e01b815260040160405180910390fd5b8060000361135d575050505050565b6106ec6001600160a01b038516848484611ca9565b60208101516040820151606083015160008190036113905750505050565b61130b6001600160a01b03841683836105fe565b6000806020830151915060408301519050816001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156113f057600080fd5b505af1158015611404573d6000803e3d6000fd5b5050505050505050565b60208101516040808301519051632e1a7d4d60e01b8152600481018290526001600160a01b03831690632e1a7d4d90602401600060405180830381600087803b15801561145a57600080fd5b505af115801561146e573d6000803e3d6000fd5b50505050505050565b6020810151600090610ce16001600160a01b03821630610f0b565b60408051600a8082526101608201909252600091829190602082016101408036833701905050905060008080805b60098160ff16116117b357600381026020880101600181015160f81c600a8110156114f2576020810260208801015195505b600981111561150e57600a810390506020810260408a01015195505b50600281015160f81c600a81101561152d576020810260208801015194505b600981111561154957600a810390506020810260408a01015194505b505160f81c915060008260098111156115645761156461205b565b0361159c5784611575600183612105565b60ff168151811061158857611588611ff7565b602002602001015195505050505050919050565b60018260098111156115b0576115b061205b565b036115e5576115bf838561211e565b858260ff16815181106115d4576115d4611ff7565b6020026020010181815250506117ab565b60028260098111156115f9576115f961205b565b03611608576115bf8385612087565b600382600981111561161c5761161c61205b565b0361162b576115bf8385612131565b600482600981111561163f5761163f61205b565b0361164e576115bf8385612148565b60058260098111156116625761166261205b565b03611671576115bf838561224e565b60068260098111156116855761168561205b565b0361170257836000600f82900b12156116d0576116a18161225a565b6001600160801b0316868360ff16815181106116bf576116bf611ff7565b6020026020010181815250506116fc565b806001600160801b0316868360ff16815181106116ef576116ef611ff7565b6020026020010181815250505b506117ab565b60078260098111156117165761171661205b565b03611759578360008112156117435761172e81612289565b868360ff16815181106116bf576116bf611ff7565b80868360ff16815181106116ef576116ef611ff7565b600882600981111561176d5761176d61205b565b036117845782841c602082026020870101526117ab565b60098260098111156117985761179861205b565b036117ab5782841b602082026020870101525b6001016114c0565b50836009815181106117c7576117c7611ff7565b6020026020010151945050505050919050565b60408051600680825260e082019092526000918291906020820160c080368337019050509050600080808080805b60058160ff1611611a96576005810260208a0101600181015160f81c600681101561183a576020810260208a01015197505b6005811115611856576006810390506020810260408c01015197505b50600281015160f81c6006811015611875576020810260208a01015196505b6005811115611891576006810390506020810260408c01015196505b50600381015160f81c60068110156118b0576020810260208a01015195505b60058111156118cc576006810390506020810260408c01015195505b50600481015160f81c60068110156118eb576020810260208a01015194505b6005811115611907576006810390506020810260408c01015194505b505160f81c915060008260068111156119225761192261205b565b0361195c5786611933600183612105565b60ff168151811061194657611946611ff7565b6020026020010151975050505050505050919050565b60018260068111156119705761197061205b565b036119aa578486106119825782611984565b835b878260ff168151811061199957611999611ff7565b602002602001018181525050611a8e565b60028260068111156119be576119be61205b565b036119d157848611156119825782611984565b60038260068111156119e5576119e561205b565b036119f7578486116119825782611984565b6004826006811115611a0b57611a0b61205b565b03611a1e57848610156119825782611984565b6005826006811115611a3257611a3261205b565b03611a44578585146119825782611984565b6006826006811115611a5857611a5861205b565b03611a8e57848603611a6a5782611a6c565b835b878260ff1681518110611a8157611a81611ff7565b6020026020010181815250505b600101611808565b5085600581518110611aaa57611aaa611ff7565b60200260200101519650505050505050919050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060600080856001600160a01b031685604051611b2c919061209a565b600060405180830381855af49150503d8060008114611b67576040519150601f19603f3d011682016040523d82523d6000602084013e611b6c565b606091505b5091509150611b7d86838387611d0e565b9695505050505050565b60008215610ce1578151600003611bb0576001600160a01b0384163b15610f8657506001610ce1565b506020015192915050565b6000835b8361ffff168161ffff16101561039957803560f01c830135611be1818461211e565b925050600201611bbf565b6040516001600160a01b0383166024820152604481018290528390611c1e90829063095ea7b360e01b90606401610694565b61130b576040516001600160a01b038416602482015260006044820152611c5290859063095ea7b360e01b90606401610694565b1580611c8b57506040516001600160a01b038416602482015260448101839052611c8990859063095ea7b360e01b90606401610694565b155b1561130b576040516340b27c2160e11b815260040160405180910390fd5b6040516001600160a01b03808516602483015283166044820152606481018290528490600090611ce69083906323b872dd60e01b90608401610694565b905080611d0657604051631e4e7d0960e21b815260040160405180910390fd5b505050505050565b60608315611d7d578251600003611d76576001600160a01b0385163b611d765760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161041d565b5081611d87565b611d878383611d8f565b949350505050565b815115611d9f5781518083602001fd5b8060405162461bcd60e51b815260040161041d91906122a5565b803561ffff81168114611dcb57600080fd5b919050565b600060208284031215611de257600080fd5b610ce182611db9565b60008060208385031215611dfe57600080fd5b823567ffffffffffffffff80821115611e1657600080fd5b818501915085601f830112611e2a57600080fd5b813581811115611e3957600080fd5b866020828501011115611e4b57600080fd5b60209290920196919550909350505050565b60008060208385031215611e7057600080fd5b823567ffffffffffffffff80821115611e8857600080fd5b818501915085601f830112611e9c57600080fd5b813581811115611eab57600080fd5b8660208260051b8501011115611e4b57600080fd5b60005b83811015611edb578181015183820152602001611ec3565b50506000910152565b60008151808452611efc816020860160208601611ec0565b601f01601f19169290920160200192915050565b600060208083016020845280855180835260408601915060408160051b87010192506020870160005b82811015611f6757603f19888603018452611f55858351611ee4565b94509285019290850190600101611f39565b5092979650505050505050565b60008060408385031215611f8757600080fd5b611f9083611db9565b915060208301356001600160e01b031981168114611fad57600080fd5b809150509250929050565b600060208284031215611fca57600080fd5b81356001600160a01b0381168114610ce157600080fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261202457600080fd5b83018035915067ffffffffffffffff82111561203f57600080fd5b60200191503681900382131561205457600080fd5b9250929050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8181038181111561053f5761053f612071565b600082516120ac818460208701611ec0565b9190910192915050565b61ffff81811683821601908082111561053d5761053d612071565b61ffff82811682821603908082111561053d5761053d612071565b6000602082840312156120fe57600080fd5b5051919050565b60ff828116828216039081111561053f5761053f612071565b8082018082111561053f5761053f612071565b808202811582820484141761053f5761053f612071565b60008261216557634e487b7160e01b600052601260045260246000fd5b500490565b600181815b808511156121a557816000190482111561218b5761218b612071565b8085161561219857918102915b93841c939080029061216f565b509250929050565b6000826121bc5750600161053f565b816121c95750600061053f565b81600181146121df57600281146121e957612205565b600191505061053f565b60ff8411156121fa576121fa612071565b50506001821b61053f565b5060208310610133831016604e8410600b8410161715612228575081810a61053f565b612232838361216a565b806000190482111561224657612246612071565b029392505050565b6000610ce183836121ad565b600081600f0b6f7fffffffffffffffffffffffffffffff19810361228057612280612071565b60000392915050565b6000600160ff1b820161229e5761229e612071565b5060000390565b602081526000610ce16020830184611ee456fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212204d60953d9c1dba7324547672955def95732cf0c22185bac77027ae41dd108e9b64736f6c63430008160033

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.