Contract 0x38eBF16d656ca64157B503364D052313893eD5fc 3

 
Txn Hash Method
Index
From
To
Value
0xe018267b6f79345983dea2de9e77b9489fd8dd044f83799f089fc8bb735ccd7e0x60806040111453032022-06-10 12:30:56110 days 10 hrs ago0x3a893a7525c4263052c3c04f9c32d919c75cb8e0 IN  Create: Yolo0 Ether0.0207352742040.001
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x6cb04d7ee611ec07c960b68275e8a952b686eea7d856ba462689906da7ed7ee2259388462022-09-28 8:17:5214 hrs 41 mins ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0x38d28635f1aef2b8a6ed2adee760a9ab0c3eb4af13226f5226bfc67e3f0aba93259159062022-09-28 6:29:4116 hrs 29 mins ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0x56185e2af7562ea5d146dd77e77b36d4a053f8f8a8942ae6604bb2ad61e32953259056052022-09-28 5:28:5017 hrs 30 mins ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0xbe85c5c6279e3f8e9a886c04147b2c656878156133c124b74b54604818807f38259053362022-09-28 5:26:4917 hrs 32 mins ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0xebc87e67384fcaf4359f9a9f594f5ecf4615e6531b1d791e3e97720f2c9cc9a2258990442022-09-28 4:43:4918 hrs 15 mins ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0x5885d86ffaf6345541ee91f1ed7aa5ad31a9c2430ad18603da48d1ec0b7ff2a2258571642022-09-28 0:48:2122 hrs 10 mins ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0x4b3124b95e382ee5e868ae6e05767ca554519fd67cea7152ad1c11476dcae3e3258570682022-09-28 0:47:3622 hrs 11 mins ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0xf4ed28c9bce7e4a30089ae179cea68c37f07323cb4735305d4e4475311795543256427952022-09-26 23:38:101 day 23 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0xf82389cbca2d72aa3aad0e75b63cb5263d54e9b9032aa268cda3315e452a53c3256059502022-09-26 16:49:412 days 6 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0x55a5d22e055e7016fda0a940e77b6071476aa1b53d6715374f8d88033bf38515256031802022-09-26 16:28:222 days 6 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0xd09b1daead606e7bdfc72838db4680195b6404cd8a38cc3bf3553a462f553da4256030082022-09-26 16:27:372 days 6 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0xc9492b7822ea363591e5c3cb3658c3b1bd7f9b387656906b02b4a602b56d0669255302342022-09-26 10:28:082 days 12 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0x69acd575ff7cc13748e0d509aba3c933c4a1c400ab0e55426b2af432b22cfdf7255300262022-09-26 10:27:072 days 12 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0x83f778532f65dc578cfc635caab6be08ed0d90d9e02e1fb4c3ae79dec5da4351255299752022-09-26 10:26:372 days 12 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0x005dd721199db7a6fb4f52a6c163bd59c187f4a8eef90af5510164a14d614032254860302022-09-26 7:04:112 days 15 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0x6e1bcc404d9fd2ac7bf943f81bf8524c8ed0c3ab8d535202eebb0463abdc06ef254857512022-09-26 7:03:112 days 15 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0x922be52ef5c5b29435f2040add17d51db8cdc46608bf91009d26785e2b38f7a0254571552022-09-26 4:13:102 days 18 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0x243631e4c41079d7d4d9a3498ffb6e1ab57b0df100fa3de752aa70b5f571c078254570132022-09-26 4:12:082 days 18 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0xdf7e2d03da16980e6c4a1e7d88dbd4e523ed48925b8817b9fd10b93fde043f66254562762022-09-26 4:06:012 days 18 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0x9a501b1139d8eb9afb03781730586265619bd50632fe632fe4b9d09d1d2e3c3a254559262022-09-26 4:03:442 days 18 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0x83e52c826de502ee7a70ef23ae03a7c8e5d0ca68b317a8cb6bfa2f4442912beb254444682022-09-26 2:47:422 days 20 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0x70d011e2df47b4c3680942aa7ac8516ddd4fb7f865c6b28f790df594e41bc8d8254430442022-09-26 2:35:022 days 20 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0xb51225a06a7aa14983a60a154c7f3a32e8e87317b1087ccafcbc115b402b589c253295402022-09-25 13:30:083 days 9 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0x6ae31f4772c412ba62004df186abca08cd6d56155b29a1fab09182a8b84f8ef5253292772022-09-25 13:29:223 days 9 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
0xe576c317857bd67f49c1c2d5a330acb881ace44d85a4c0ac3eaa55a989399cbe253100732022-09-25 11:53:123 days 11 hrs ago 0x3ff61f4d7e1d912ca3cb342581b2e764ae24d017 0x38ebf16d656ca64157b503364d052313893ed5fc0 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Yolo

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 17 : Yolo.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.10;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";

import "./libraries/PercentageMath.sol";
import "./interfaces/IOracle.sol";
import "./interfaces/IHandler.sol";
import "./interfaces/IYieldAdapter.sol";
import "./interfaces/IOrderStructs.sol";
import {IWETH} from "./interfaces/IWETH.sol";

/**
 * @title Yolo contract
 * @author Symphony Finance
 **/
contract Yolo is
    Initializable,
    OwnableUpgradeable,
    PausableUpgradeable,
    ReentrancyGuardUpgradeable
{
    using SafeERC20Upgradeable for IERC20Upgradeable;
    using PercentageMath for uint256;

    // Protocol treasury address
    address public treasury;

    // Emergency admin address
    address public emergencyAdmin;

    /// Protocol fee: x% of input amount
    uint256 public protocolFeePercent; // 1 for 0.01%

    /// Cancellation fee: x% of total yield
    uint256 public cancellationFeePercent; // 1 for 0.01%

    /// Oracle
    IOracle public oracle;

    // Wrapped ETH token address
    address internal constant WETH = 0x4200000000000000000000000000000000000006;

    mapping(address => address) public strategy;
    mapping(bytes32 => bytes32) public orderHash;
    mapping(address => uint256) public tokenBuffer;

    mapping(address => bool) public whitelistedTokens;
    mapping(address => uint256) public totalTokenShares;
    mapping(address => bool) public allowedHandlers;
    mapping(address => mapping(address => bool)) public allowedExecutors;

    // ************** //
    // *** EVENTS *** //
    // ************** //
    event OrderCreated(bytes32 orderId, bytes data);
    event OrderCancelled(bytes32 orderId, uint256 amountReceived);
    event OrderExecuted(
        bytes32 orderId,
        uint256 amountReceived,
        uint256 depositPlusYield
    );
    event OrderUpdated(bytes32 oldOrderId, bytes32 newOrderId, bytes data);
    event TokenStrategyUpdated(address token, address strategy);
    event HandlerAdded(address handler);
    event HandlerRemoved(address handler);
    event ProtocolFeeUpdated(uint256 feePercent);
    event CancellationFeeUpdated(uint256 feePercent);
    event TokenBufferUpdated(address token, uint256 bufferPercent);
    event AddedWhitelistToken(address token);
    event RemovedWhitelistToken(address token);
    event OracleAddressUpdated(address oracle);
    event EmergencyAdminUpdated(address admin);
    event TokensRebalanced(uint256 txCost);

    modifier onlyEmergencyAdminOrOwner() {
        require(
            _msgSender() == emergencyAdmin || _msgSender() == owner(),
            "Yolo: only emergency admin or owner can invoke this function"
        );
        _;
    }

    /**
     * @notice To initialize the global variables
     */
    function initialize(
        address _owner,
        address _emergencyAdmin,
        IOracle _oracle
    ) external initializer {
        __Ownable_init();
        __Pausable_init();
        __ReentrancyGuard_init();
        super.transferOwnership(_owner);
        oracle = _oracle;
        emergencyAdmin = _emergencyAdmin;
    }

    /**
     * @notice Create an order
     */
    function createOrder(
        address recipient,
        address inputToken,
        address outputToken,
        uint256 inputAmount,
        uint256 minReturnAmount,
        uint256 stoplossAmount,
        address executor,
        uint256 executionFee,
        address onBehalfOf
    )
        external
        nonReentrant
        whenNotPaused
        returns (bytes32 orderId, bytes memory orderData)
    {
        require(
            whitelistedTokens[inputToken],
            "Yolo::createOrder: unsupported input token"
        );
        require(
            recipient != address(0),
            "Yolo::createOrder: zero recipient address"
        );
        require(inputAmount > 0, "Yolo::createOrder: zero input amount");
        require(minReturnAmount > 0, "Yolo::createOrder: zero return amount");
        require(
            stoplossAmount < minReturnAmount,
            "Yolo::createOrder: stoploss amount greater than return amount"
        );
        require(
            executionFee > 0 && executionFee < inputAmount,
            "Yolo::createOrder: invalid or zero execution fee"
        );

        orderId = getOrderId(
            onBehalfOf,
            recipient,
            inputToken,
            outputToken,
            inputAmount,
            minReturnAmount,
            stoplossAmount,
            executor,
            executionFee,
            block.timestamp
        );

        require(
            orderHash[orderId] == bytes32(0),
            "Yolo::createOrder: order already exists with the same id"
        );

        uint256 prevTotalShares = totalTokenShares[inputToken];
        uint256 shares = inputAmount;

        if (prevTotalShares > 0) {
            address tokenStrategy = strategy[inputToken];
            uint256 prevTotalTokens = IERC20(inputToken).balanceOf(
                address(this)
            );

            if (tokenStrategy != address(0)) {
                prevTotalTokens = getTotalTokens(
                    inputToken,
                    prevTotalTokens,
                    tokenStrategy
                );
            }

            shares = (inputAmount * prevTotalShares) / prevTotalTokens;
            require(shares > 0, "Yolo::createOrder: shares can't be zero");
        }

        // caution: trusting user input
        IERC20Upgradeable(inputToken).safeTransferFrom(
            msg.sender,
            address(this),
            inputAmount
        );

        totalTokenShares[inputToken] = prevTotalShares + shares;

        IOrderStructs.Order memory myOrder = IOrderStructs.Order({
            creator: onBehalfOf,
            recipient: recipient,
            inputToken: inputToken,
            outputToken: outputToken,
            inputAmount: inputAmount,
            minReturnAmount: minReturnAmount,
            stoplossAmount: stoplossAmount,
            shares: shares,
            executor: executor,
            executionFee: executionFee
        });
        orderData = getOrderData(myOrder);

        orderHash[orderId] = keccak256(orderData);

        emit OrderCreated(orderId, orderData);
    }

    /**
     * @notice Create ETH order
     */
    function createNativeOrder(
        address recipient,
        address outputToken,
        uint256 minReturnAmount,
        uint256 stoplossAmount,
        address executor,
        uint256 executionFee,
        address onBehalfOf
    )
        external
        payable
        nonReentrant
        whenNotPaused
        returns (bytes32 orderId, bytes memory orderData)
    {
        uint256 inputAmount = msg.value;
        address inputToken = WETH;

        require(
            recipient != address(0),
            "Yolo::createNativeOrder: zero recipient address"
        );
        require(inputAmount > 0, "Yolo::createNativeOrder: zero input amount");
        require(
            minReturnAmount > 0,
            "Yolo::createNativeOrder: zero return amount"
        );
        require(
            stoplossAmount < minReturnAmount,
            "Yolo::createNativeOrder: stoploss amount greater than return amount"
        );
        require(
            executionFee > 0 && executionFee < inputAmount,
            "Yolo::createNativeOrder: invalid or zero execution fee"
        );

        orderId = getOrderId(
            onBehalfOf,
            recipient,
            inputToken,
            outputToken,
            inputAmount,
            minReturnAmount,
            stoplossAmount,
            executor,
            executionFee,
            block.timestamp
        );

        require(
            orderHash[orderId] == bytes32(0),
            "Yolo::createNativeOrder: order already exists with the same id"
        );

        uint256 prevTotalShares = totalTokenShares[inputToken];
        uint256 shares = inputAmount;

        if (prevTotalShares > 0) {
            address tokenStrategy = strategy[inputToken];
            uint256 prevTotalTokens = IERC20(inputToken).balanceOf(
                address(this)
            );

            if (tokenStrategy != address(0)) {
                prevTotalTokens = getTotalTokens(
                    inputToken,
                    prevTotalTokens,
                    tokenStrategy
                );
            }

            shares = (inputAmount * prevTotalShares) / prevTotalTokens;
            require(
                shares > 0,
                "Yolo::createNativeOrder: shares can't be zero"
            );
        }

        IWETH(inputToken).deposit{value: inputAmount}();

        totalTokenShares[inputToken] = prevTotalShares + shares;

        IOrderStructs.Order memory myOrder = IOrderStructs.Order({
            creator: onBehalfOf,
            recipient: recipient,
            inputToken: inputToken,
            outputToken: outputToken,
            inputAmount: inputAmount,
            minReturnAmount: minReturnAmount,
            stoplossAmount: stoplossAmount,
            shares: shares,
            executor: executor,
            executionFee: executionFee
        });
        orderData = getOrderData(myOrder);

        orderHash[orderId] = keccak256(orderData);

        emit OrderCreated(orderId, orderData);
    }

    /**
     * @notice Update an existing order
     */
    function updateOrder(
        bytes32 orderId,
        bytes calldata orderData,
        address recipient,
        address outputToken,
        uint256 minReturnAmount,
        uint256 stoplossAmount,
        address executor,
        uint256 executionFee
    )
        external
        nonReentrant
        whenNotPaused
        returns (bytes32 newOrderId, bytes memory newOrderData)
    {
        require(
            recipient != address(0),
            "Yolo::updateOrder: zero recipient address"
        );
        require(
            orderHash[orderId] == keccak256(orderData),
            "Yolo::updateOrder: order doesn't match"
        );

        IOrderStructs.Order memory myOrder = decodeOrder(orderData);

        require(
            msg.sender == myOrder.creator,
            "Yolo::updateOrder: only creator can update the order"
        );
        require(minReturnAmount > 0, "Yolo::updateOrder: zero return amount");
        require(
            stoplossAmount < minReturnAmount,
            "Yolo::updateOrder: stoploss amount greater than return amount"
        );
        require(
            executionFee > 0 && executionFee < myOrder.inputAmount,
            "Yolo::updateOrder: invalid or zero execution fee"
        );

        delete orderHash[orderId];

        newOrderId = getOrderId(
            msg.sender,
            recipient,
            myOrder.inputToken,
            outputToken,
            myOrder.inputAmount,
            minReturnAmount,
            stoplossAmount,
            executor,
            executionFee,
            block.timestamp
        );

        require(
            orderHash[newOrderId] == bytes32(0),
            "Yolo::updateOrder: order already exists with the same id"
        );

        newOrderData = abi.encode(
            msg.sender,
            recipient,
            myOrder.inputToken,
            outputToken,
            myOrder.inputAmount,
            minReturnAmount,
            stoplossAmount,
            myOrder.shares,
            executor,
            executionFee
        );

        orderHash[newOrderId] = keccak256(newOrderData);

        emit OrderUpdated(orderId, newOrderId, newOrderData);
    }

    /**
     * @notice Cancel an existing order
     */
    function cancelOrder(bytes32 orderId, bytes calldata orderData)
        external
        nonReentrant
        returns (uint256 depositPlusYield)
    {
        require(
            orderHash[orderId] == keccak256(orderData),
            "Yolo::cancelOrder: order doesn't match"
        );

        IOrderStructs.Order memory myOrder = decodeOrder(orderData);

        require(
            msg.sender == myOrder.creator,
            "Yolo::cancelOrder: only creator can cancel the order"
        );

        depositPlusYield = _removeOrder(
            orderId,
            myOrder.inputToken,
            myOrder.shares
        );

        uint256 cancellationFee = 0;
        uint256 feePercent = cancellationFeePercent;
        if (depositPlusYield > myOrder.inputAmount && feePercent > 0) {
            uint256 yieldEarned = depositPlusYield - myOrder.inputAmount;
            cancellationFee = yieldEarned.percentMul(feePercent);
            if (cancellationFee > 0) {
                IERC20Upgradeable(myOrder.inputToken).safeTransfer(
                    treasury,
                    cancellationFee
                );
            }
        }

        uint256 transferAmount = depositPlusYield - cancellationFee;
        IERC20Upgradeable(myOrder.inputToken).safeTransfer(
            msg.sender,
            transferAmount
        );
        emit OrderCancelled(orderId, transferAmount);
    }

    /**
     * @notice Execute the order using external DEX
     */
    function executeOrder(
        bytes32 orderId,
        bytes calldata orderData,
        address payable handler,
        bytes calldata handlerData
    ) external nonReentrant whenNotPaused {
        require(
            orderHash[orderId] == keccak256(orderData),
            "Yolo::executeOrder: order doesn't match"
        );

        IOrderStructs.Order memory myOrder = decodeOrder(orderData);

        if (myOrder.executor != address(0) && myOrder.executor != msg.sender) {
            require(
                allowedExecutors[myOrder.executor][msg.sender],
                "Yolo::executeOrder: order executor mismatch"
            );
        }
        require(
            allowedHandlers[handler],
            "Yolo::executeOrder: unregistered handler"
        );

        uint256 depositPlusYield = _removeOrder(
            orderId,
            myOrder.inputToken,
            myOrder.shares
        );
        if (depositPlusYield < myOrder.inputAmount) {
            myOrder.inputAmount = depositPlusYield;
        }

        uint256 protocolFee = 0;
        uint256 _protocolFeePercent = protocolFeePercent;
        if (_protocolFeePercent > 0) {
            protocolFee = myOrder.inputAmount.percentMul(_protocolFeePercent);
        }

        _transferFee(
            myOrder.inputToken,
            myOrder.executionFee,
            protocolFee,
            msg.sender
        );
        uint256 totalFee = protocolFee + myOrder.executionFee;
        myOrder.inputAmount = myOrder.inputAmount - totalFee;

        (, uint256 oracleAmount) = oracle.get(
            myOrder.inputToken,
            myOrder.outputToken,
            myOrder.inputAmount
        );

        IERC20Upgradeable(myOrder.inputToken).safeTransfer(
            handler,
            myOrder.inputAmount
        );

        uint256 totalAmountOut = IHandler(handler).handle(
            myOrder,
            oracleAmount,
            handlerData
        );

        emit OrderExecuted(orderId, totalAmountOut, depositPlusYield);

        depositPlusYield = depositPlusYield - totalFee;
        if (depositPlusYield > myOrder.inputAmount) {
            uint256 yieldEarned = depositPlusYield - myOrder.inputAmount;
            IERC20Upgradeable(myOrder.inputToken).safeTransfer(
                myOrder.recipient,
                yieldEarned
            );
        }
    }

    /**
     * @notice Fill an order with own liquidity
     */
    function fillOrder(
        bytes32 orderId,
        bytes calldata orderData,
        uint256 quoteAmount
    ) external nonReentrant whenNotPaused {
        require(
            orderHash[orderId] == keccak256(orderData),
            "Yolo::fillOrder: order doesn't match"
        );

        IOrderStructs.Order memory myOrder = decodeOrder(orderData);

        if (myOrder.executor != address(0) && myOrder.executor != msg.sender) {
            require(
                allowedExecutors[myOrder.executor][msg.sender],
                "Yolo::fillOrder: order executor mismatch"
            );
        }

        uint256 depositPlusYield = _removeOrder(
            orderId,
            myOrder.inputToken,
            myOrder.shares
        );
        if (depositPlusYield < myOrder.inputAmount) {
            myOrder.inputAmount = depositPlusYield;
        }

        uint256 protocolFee = 0;
        uint256 _protocolFeePercent = protocolFeePercent;
        if (_protocolFeePercent > 0) {
            protocolFee = myOrder.inputAmount.percentMul(_protocolFeePercent);
        }
        uint256 totalFee = protocolFee + myOrder.executionFee;

        (uint256 oracleAmount, ) = oracle.get(
            myOrder.inputToken,
            myOrder.outputToken,
            myOrder.inputAmount - totalFee
        );

        bool success = ((quoteAmount >= myOrder.minReturnAmount ||
            quoteAmount <= myOrder.stoplossAmount) &&
            quoteAmount >= oracleAmount);

        require(success, "Yolo::fillOrder: fill condition doesn't satisfy");

        emit OrderExecuted(orderId, quoteAmount, depositPlusYield);

        _transferFee(
            myOrder.inputToken,
            myOrder.executionFee,
            protocolFee,
            address(0)
        );

        // caution: external calls to unknown address
        IERC20Upgradeable(myOrder.outputToken).safeTransferFrom(
            msg.sender,
            myOrder.recipient,
            quoteAmount
        );

        IERC20Upgradeable(myOrder.inputToken).safeTransfer(
            msg.sender,
            myOrder.inputAmount - protocolFee
        );

        if (depositPlusYield > myOrder.inputAmount) {
            uint256 yieldEarned = depositPlusYield - myOrder.inputAmount;
            IERC20Upgradeable(myOrder.inputToken).safeTransfer(
                myOrder.recipient,
                yieldEarned
            );
        }
    }

    /**
     * @notice rebalance token according to buffer
     */
    function rebalanceTokens(address[] memory tokens) public {
        uint256 totalGas = gasleft();
        for (uint256 i = 0; i < tokens.length; i++) {
            address tokenStrategy = strategy[tokens[i]];
            require(
                tokenStrategy != address(0),
                "Yolo::rebalanceTokens: strategy doesn't exist"
            );

            uint256 balanceInContract = IERC20Upgradeable(tokens[i]).balanceOf(
                address(this)
            );

            uint256 balanceInStrategy = IYieldAdapter(tokenStrategy)
                .getTotalUnderlying(tokens[i]);

            uint256 totalBalance = balanceInContract + balanceInStrategy;

            uint256 bufferBalanceNeeded = totalBalance.percentMul(
                tokenBuffer[tokens[i]]
            );

            if (balanceInContract > bufferBalanceNeeded) {
                uint256 depositAmount = balanceInContract - bufferBalanceNeeded;
                IERC20Upgradeable(tokens[i]).safeTransfer(
                    tokenStrategy,
                    depositAmount
                );
                IYieldAdapter(tokenStrategy).deposit(tokens[i], depositAmount);
            } else if (balanceInContract < bufferBalanceNeeded) {
                IYieldAdapter(tokenStrategy).withdraw(
                    tokens[i],
                    bufferBalanceNeeded - balanceInContract
                );
            }
            if (i == tokens.length - 1) {
                emit TokensRebalanced((totalGas - gasleft()) * tx.gasprice);
            }
        }
    }

    // *************** //
    // *** GETTERS *** //
    // *************** //

    function getOrderId(
        address creator,
        address recipient,
        address inputToken,
        address outputToken,
        uint256 amount,
        uint256 minReturnAmount,
        uint256 stoplossAmount,
        address executor,
        uint256 executionFee,
        uint256 blockTimestamp
    ) public view returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    creator,
                    recipient,
                    inputToken,
                    outputToken,
                    amount,
                    minReturnAmount,
                    stoplossAmount,
                    executor,
                    executionFee,
                    blockTimestamp
                )
            );
    }

    function getTotalTokens(
        address token,
        uint256 contractBalance,
        address tokenStrategy
    ) public returns (uint256 totalTokens) {
        totalTokens = contractBalance;
        if (tokenStrategy != address(0)) {
            totalTokens =
                totalTokens +
                IYieldAdapter(tokenStrategy).getTotalUnderlying(token);
        }
    }

    function decodeOrder(bytes memory orderData)
        public
        view
        returns (IOrderStructs.Order memory order)
    {
        (
            address creator,
            address recipient,
            address inputToken,
            address outputToken,
            uint256 inputAmount,
            uint256 minReturnAmount,
            uint256 stoplossAmount,
            uint256 shares,
            address executor,
            uint256 executionFee
        ) = abi.decode(
                orderData,
                (
                    address,
                    address,
                    address,
                    address,
                    uint256,
                    uint256,
                    uint256,
                    uint256,
                    address,
                    uint256
                )
            );

        order = IOrderStructs.Order(
            creator,
            recipient,
            inputToken,
            outputToken,
            inputAmount,
            minReturnAmount,
            stoplossAmount,
            shares,
            executor,
            executionFee
        );
    }

    // ************************** //
    // *** GOVERNANCE METHODS *** //
    // ************************** //

    /**
     * @notice Update the treasury address
     */
    function updateTreasury(address _treasury) external onlyOwner {
        treasury = _treasury;
    }

    /**
     * @notice Add an order handler
     */
    function addHandler(address _handler) external onlyOwner {
        allowedHandlers[_handler] = true;
        emit HandlerAdded(_handler);
    }

    /**
     * @notice Remove an order handler
     */
    function removeHandler(address _handler) external onlyOwner {
        allowedHandlers[_handler] = false;
        emit HandlerRemoved(_handler);
    }

    /**
     * @notice Update protocol fee percent
     */
    function updateProtocolFee(uint256 _feePercent) external onlyOwner {
        require(
            _feePercent <= 10000,
            "Yolo::updateProtocolFee: fee percent exceeds max threshold"
        );
        require(
            treasury != address(0),
            "Yolo::updateProtocolFee: treasury addresss not set"
        );
        protocolFeePercent = _feePercent;
        emit ProtocolFeeUpdated(_feePercent);
    }

    /**
     * @notice Update cancellation fee percent
     */
    function updateCancellationFee(uint256 _feePercent) external onlyOwner {
        require(
            _feePercent <= 10000,
            "Yolo::updateCancellationFee: fee percent exceeds max threshold"
        );
        require(
            treasury != address(0),
            "Yolo::updateCancellationFee: treasury addresss not set"
        );
        cancellationFeePercent = _feePercent;
        emit CancellationFeeUpdated(_feePercent);
    }

    /**
     * @notice Update the oracle
     */
    function updateOracle(IOracle _oracle) external onlyOwner {
        require(
            IOracle(_oracle).isOracle(),
            "Yolo::updateOracle: invalid oracle address"
        );
        oracle = _oracle;
        emit OracleAddressUpdated(address(_oracle));
    }

    /**
     * @notice Add an token into whitelist
     */
    function addWhitelistTokens(address[] memory _tokens) external onlyOwner {
        for (uint256 i = 0; i < _tokens.length; i++) {
            address token = _tokens[i];
            whitelistedTokens[token] = true;
            emit AddedWhitelistToken(token);
        }
    }

    /**
     * @notice Remove a whitelisted token
     */
    function removeWhitelistToken(address _token) external onlyOwner {
        whitelistedTokens[_token] = false;
        emit RemovedWhitelistToken(_token);
    }

    /**
     * @notice Set strategy of a token
     */
    function setStrategy(address _token, address _strategy) external onlyOwner {
        require(
            strategy[_token] == address(0),
            "Yolo::setStrategy: strategy already exists"
        );
        _updateTokenStrategy(_token, _strategy);
    }

    /**
     * @notice Migrate to new strategy
     */
    function migrateStrategy(address _token, address _newStrategy)
        external
        onlyOwner
    {
        address previousStrategy = strategy[_token];
        require(
            previousStrategy != address(0),
            "Yolo::migrateStrategy: no previous strategy exists"
        );
        require(
            previousStrategy != _newStrategy,
            "Yolo::migrateStrategy: new strategy same as previous"
        );

        IYieldAdapter(previousStrategy).withdrawAll(_token);

        require(
            IYieldAdapter(previousStrategy).getTotalUnderlying(_token) == 0,
            "Yolo::migrateStrategy: withdraw from strategy failed"
        );

        if (_newStrategy != address(0)) {
            _updateTokenStrategy(_token, _newStrategy);
        } else {
            strategy[_token] = _newStrategy;
        }
    }

    // *************************** //
    // **** EMERGENCY METHODS **** //
    // *************************** //

    /**
     * @notice Pause the contract
     */
    function pause() external onlyEmergencyAdminOrOwner {
        _pause();
    }

    /*Yolo*
     * @notice Unpause the contract
     */
    function unpause() external onlyEmergencyAdminOrOwner {
        _unpause();
    }

    /**
     * @notice Withdraw all tokens from strategies including rewards
     * @dev Only in emergency case. Transfer rewards to Yolo contract
     */
    function emergencyWithdrawFromStrategy(address[] calldata _tokens)
        external
        onlyEmergencyAdminOrOwner
    {
        for (uint256 i = 0; i < _tokens.length; i++) {
            address token = _tokens[i];
            address tokenStrategy = strategy[token];

            IYieldAdapter(tokenStrategy).withdrawAll(token);
        }
    }

    /**
     * @notice Update token buffer percent
     */
    function updateTokensBuffer(
        address[] memory _tokens,
        uint256[] memory _bufferPercents
    ) external onlyEmergencyAdminOrOwner {
        for (uint256 i = 0; i < _tokens.length; i++) {
            address token = _tokens[i];
            uint256 bufferPercent = _bufferPercents[i];
            require(
                bufferPercent <= 10000,
                "Yolo::updateTokensBuffer: buffer percent exceeds max threshold"
            );
            if (bufferPercent > 0) {
                tokenBuffer[token] = bufferPercent;
                emit TokenBufferUpdated(token, bufferPercent);
            }
        }
    }

    /**
     * @notice Update emergency admin address
     */
    function updateEmergencyAdmin(address _emergencyAdmin)
        external
        onlyEmergencyAdminOrOwner
    {
        emergencyAdmin = _emergencyAdmin;
        emit EmergencyAdminUpdated(_emergencyAdmin);
    }

    // ************************** //
    // *** EXECUTOR FUNCTIONS *** //
    // ************************** //
    function approveExecutor(address executor) external {
        allowedExecutors[msg.sender][executor] = true;
    }

    function revokeExecutor(address executor) external {
        allowedExecutors[msg.sender][executor] = false;
    }

    // ************************** //
    // *** INTERNAL FUNCTIONS *** //
    // ************************** //

    /**
     * @notice Update Strategy of an token
     */
    function _updateTokenStrategy(address _token, address _strategy) internal {
        if (_strategy != address(0)) {
            emit TokenStrategyUpdated(_token, _strategy);
            strategy[_token] = _strategy;
            address[] memory tokens = new address[](1);
            tokens[0] = _token;
            rebalanceTokens(tokens);
        }
    }

    function _transferFee(
        address _token,
        uint256 _executionFee,
        uint256 _protocolFee,
        address _executor
    ) internal returns (uint256 protocolFee) {
        address treasuryAddress = treasury;
        if (_protocolFee > 0) {
            IERC20Upgradeable(_token).safeTransfer(
                treasuryAddress,
                _protocolFee
            );
        }
        if (_executor != address(0) && _executionFee > 0) {
            IERC20Upgradeable(_token).safeTransfer(
                _executor,
                _executionFee - protocolFee
            );
        }
    }

    function _removeOrder(
        bytes32 _orderId,
        address _token,
        uint256 _shares
    ) internal returns (uint256 depositPlusYield) {
        delete orderHash[_orderId];
        address tokenStrategy = strategy[_token];
        uint256 contractBal = IERC20Upgradeable(_token).balanceOf(
            address(this)
        );
        uint256 totalTokens = getTotalTokens(
            _token,
            contractBal,
            tokenStrategy
        );
        uint256 totalShares = totalTokenShares[_token];
        totalTokenShares[_token] = totalShares - _shares;
        depositPlusYield = (_shares * totalTokens) / (totalShares);

        if (contractBal < depositPlusYield && tokenStrategy != address(0)) {
            uint256 neededAmountInBuffer = (totalTokens - depositPlusYield)
                .percentMul(tokenBuffer[_token]);

            IYieldAdapter(tokenStrategy).withdraw(
                _token,
                depositPlusYield + neededAmountInBuffer - contractBal
            );
        }
    }

    function getOrderData(IOrderStructs.Order memory order)
        internal
        pure
        returns (bytes memory)
    {
        return
            abi.encode(
                order.creator,
                order.recipient,
                order.inputToken,
                order.outputToken,
                order.inputAmount,
                order.minReturnAmount,
                order.stoplossAmount,
                order.shares,
                order.executor,
                order.executionFee
            );
    }
}

File 2 of 17 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing 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);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 3 of 17 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @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.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

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

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

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        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());
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 4 of 17 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 5 of 17 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)

pragma solidity ^0.8.0;

import "../token/ERC20/IERC20Upgradeable.sol";

File 6 of 17 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../../../utils/AddressUpgradeable.sol";

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

    function safeTransfer(
        IERC20Upgradeable token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20Upgradeable token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    function safeIncreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

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

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

File 7 of 17 : PercentageMath.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.10;

/**
 * @title PercentageMath library
 * @author Aave
 * @notice Provides functions to perform percentage calculations
 * @dev Percentages are defined by default with 2 decimals of precision (100.00). The precision is indicated by PERCENTAGE_FACTOR
 * @dev Operations are rounded half up
 **/

library PercentageMath {
    uint256 constant PERCENTAGE_FACTOR = 1e4; //percentage plus two decimals
    uint256 constant HALF_PERCENT = PERCENTAGE_FACTOR / 2;

    /**
     * @dev Executes a percentage multiplication
     * @param value The value of which the percentage needs to be calculated
     * @param percentage The percentage of the value to be calculated
     * @return The percentage of value
     **/
    function percentMul(uint256 value, uint256 percentage)
        internal
        pure
        returns (uint256)
    {
        if (value == 0 || percentage == 0) {
            return 0;
        }

        require(
            value <= (type(uint256).max - HALF_PERCENT) / percentage,
            "PercentageMath: MATH_MULTIPLICATION_OVERFLOW"
        );

        return (value * percentage + HALF_PERCENT) / PERCENTAGE_FACTOR;
    }

    /**
     * @dev Executes a percentage division
     * @param value The value of which the percentage needs to be calculated
     * @param percentage The percentage of the value to be calculated
     * @return The value divided the percentage
     **/
    function percentDiv(uint256 value, uint256 percentage)
        internal
        pure
        returns (uint256)
    {
        require(percentage != 0, "PercentageMath: MATH_DIVISION_BY_ZERO");
        uint256 halfPercentage = percentage / 2;

        require(
            value <= (type(uint256).max - halfPercentage) / PERCENTAGE_FACTOR,
            "PercentageMath: MATH_MULTIPLICATION_OVERFLOW"
        );

        return (value * PERCENTAGE_FACTOR + halfPercentage) / percentage;
    }
}

File 8 of 17 : IOracle.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.10;

interface IOracle {
    function get(
        address inputToken,
        address outputToken,
        uint256 inputAmount
    ) external view returns (uint256 amountOut, uint256 amountOutWithSlippage);

    function isOracle() external view returns (bool);
}

File 9 of 17 : IHandler.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.10;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./IOrderStructs.sol";

interface IHandler {
    /**
     * @notice Handle an order execution
     * @param _order - Order structure
     * @param _oracleAmount - Current out amount from oracle
     * @param _data - Bytes of arbitrary data
     */
    function handle(
        IOrderStructs.Order memory _order,
        uint256 _oracleAmount,
        bytes calldata _data
    ) external returns (uint256 returnAmount);
}

File 10 of 17 : IYieldAdapter.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.10;

interface IYieldAdapter {
    /**
     * @dev Used to deposit token
     * @param token the address of token to invest
     * @param amount the amount of token
     **/
    function deposit(address token, uint256 amount) external;

    /**
     * @dev Used to withdraw from available protocol
     * @param token the address of underlying token
     * @param amount the amount of liquidity shares to unlock
     **/
    function withdraw(address token, uint256 amount) external;

    /**
     * @dev Withdraw all tokens from the strategy
     * @param token the address of token
     **/
    function withdrawAll(address token) external;

    /**
     * @dev Used to get amount of underlying tokens
     * @param token the address of token
     * @return tokensAmount amount of underlying tokens
     **/
    function getTotalUnderlying(address token)
        external
        returns (uint256 tokensAmount);
}

File 11 of 17 : IOrderStructs.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.10;

interface IOrderStructs {
    // This is not really an interface - it just defines common structs.

    struct Order {
        address creator;
        address recipient;
        address inputToken;
        address outputToken;
        uint256 inputAmount;
        uint256 minReturnAmount;
        uint256 stoplossAmount;
        uint256 shares;
        address executor;
        uint256 executionFee;
    }
}

File 12 of 17 : IWETH.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.10;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IWETH is IERC20 {
    function deposit() external payable;

    function withdraw(uint256 wad) external;
}

File 13 of 17 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 14 of 17 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
     */
    modifier initializer() {
        bool isTopLevelCall = _setInitializedVersion(1);
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
     * initialization step. This is essential to configure modules that are added through upgrades and that require
     * initialization.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     */
    modifier reinitializer(uint8 version) {
        bool isTopLevelCall = _setInitializedVersion(version);
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(version);
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     */
    function _disableInitializers() internal virtual {
        _setInitializedVersion(type(uint8).max);
    }

    function _setInitializedVersion(uint8 version) private returns (bool) {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, and for the lowest level
        // of initializers, because in other contexts the contract may have been reentered.
        if (_initializing) {
            require(
                version == 1 && !AddressUpgradeable.isContract(address(this)),
                "Initializable: contract is already initialized"
            );
            return false;
        } else {
            require(_initialized < version, "Initializable: contract is already initialized");
            _initialized = version;
            return true;
        }
    }
}

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

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @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
     * ====
     *
     * [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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 16 of 17 : IERC20Upgradeable.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 IERC20Upgradeable {
    /**
     * @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 17 of 17 : 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);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200,
    "details": {
      "yul": false
    }
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"AddedWhitelistToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"feePercent","type":"uint256"}],"name":"CancellationFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"EmergencyAdminUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"handler","type":"address"}],"name":"HandlerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"handler","type":"address"}],"name":"HandlerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oracle","type":"address"}],"name":"OracleAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"orderId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amountReceived","type":"uint256"}],"name":"OrderCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"orderId","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"OrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"orderId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amountReceived","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"depositPlusYield","type":"uint256"}],"name":"OrderExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"oldOrderId","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"newOrderId","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"OrderUpdated","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":false,"internalType":"uint256","name":"feePercent","type":"uint256"}],"name":"ProtocolFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"RemovedWhitelistToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"bufferPercent","type":"uint256"}],"name":"TokenBufferUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"strategy","type":"address"}],"name":"TokenStrategyUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"txCost","type":"uint256"}],"name":"TokensRebalanced","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"_handler","type":"address"}],"name":"addHandler","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"addWhitelistTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowedExecutors","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowedHandlers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"executor","type":"address"}],"name":"approveExecutor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"orderId","type":"bytes32"},{"internalType":"bytes","name":"orderData","type":"bytes"}],"name":"cancelOrder","outputs":[{"internalType":"uint256","name":"depositPlusYield","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancellationFeePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"outputToken","type":"address"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"stoplossAmount","type":"uint256"},{"internalType":"address","name":"executor","type":"address"},{"internalType":"uint256","name":"executionFee","type":"uint256"},{"internalType":"address","name":"onBehalfOf","type":"address"}],"name":"createNativeOrder","outputs":[{"internalType":"bytes32","name":"orderId","type":"bytes32"},{"internalType":"bytes","name":"orderData","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"address","name":"outputToken","type":"address"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"stoplossAmount","type":"uint256"},{"internalType":"address","name":"executor","type":"address"},{"internalType":"uint256","name":"executionFee","type":"uint256"},{"internalType":"address","name":"onBehalfOf","type":"address"}],"name":"createOrder","outputs":[{"internalType":"bytes32","name":"orderId","type":"bytes32"},{"internalType":"bytes","name":"orderData","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"orderData","type":"bytes"}],"name":"decodeOrder","outputs":[{"components":[{"internalType":"address","name":"creator","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"address","name":"outputToken","type":"address"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"stoplossAmount","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"executor","type":"address"},{"internalType":"uint256","name":"executionFee","type":"uint256"}],"internalType":"struct IOrderStructs.Order","name":"order","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"emergencyWithdrawFromStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"orderId","type":"bytes32"},{"internalType":"bytes","name":"orderData","type":"bytes"},{"internalType":"address payable","name":"handler","type":"address"},{"internalType":"bytes","name":"handlerData","type":"bytes"}],"name":"executeOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"orderId","type":"bytes32"},{"internalType":"bytes","name":"orderData","type":"bytes"},{"internalType":"uint256","name":"quoteAmount","type":"uint256"}],"name":"fillOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creator","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"address","name":"outputToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"stoplossAmount","type":"uint256"},{"internalType":"address","name":"executor","type":"address"},{"internalType":"uint256","name":"executionFee","type":"uint256"},{"internalType":"uint256","name":"blockTimestamp","type":"uint256"}],"name":"getOrderId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"contractBalance","type":"uint256"},{"internalType":"address","name":"tokenStrategy","type":"address"}],"name":"getTotalTokens","outputs":[{"internalType":"uint256","name":"totalTokens","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_emergencyAdmin","type":"address"},{"internalType":"contract IOracle","name":"_oracle","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_newStrategy","type":"address"}],"name":"migrateStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"contract IOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"orderHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","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":"protocolFeePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"rebalanceTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_handler","type":"address"}],"name":"removeHandler","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"removeWhitelistToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"executor","type":"address"}],"name":"revokeExecutor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_strategy","type":"address"}],"name":"setStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"strategy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenBuffer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"totalTokenShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feePercent","type":"uint256"}],"name":"updateCancellationFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_emergencyAdmin","type":"address"}],"name":"updateEmergencyAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOracle","name":"_oracle","type":"address"}],"name":"updateOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"orderId","type":"bytes32"},{"internalType":"bytes","name":"orderData","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"outputToken","type":"address"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"stoplossAmount","type":"uint256"},{"internalType":"address","name":"executor","type":"address"},{"internalType":"uint256","name":"executionFee","type":"uint256"}],"name":"updateOrder","outputs":[{"internalType":"bytes32","name":"newOrderId","type":"bytes32"},{"internalType":"bytes","name":"newOrderData","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feePercent","type":"uint256"}],"name":"updateProtocolFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_bufferPercents","type":"uint256[]"}],"name":"updateTokensBuffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"updateTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b5061589f80620000216000396000f3fe6080604052600436106102675760003560e01c806378334fac11610144578063b4c07547116100b6578063d6e6eb9f1161007a578063d6e6eb9f146107fd578063daf9c21014610813578063e3113df914610843578063e9ee910714610863578063f2fde38b14610883578063fb7d8a1e146108a357600080fd5b8063b4c0754714610731578063c0c53b8b1461075e578063c24f988b1461077e578063cbbaae7a14610794578063d5101251146107b457600080fd5b80638456cb59116101085780638456cb59146106635780638da5cb5b14610678578063943bc21414610696578063ab266c6d146106d1578063b07c462c146106f1578063b4576c9a1461071157600080fd5b806378334fac146105c35780637ae4a97b146105d65780637dc0d1d0146105f65780637f51bb1f146106235780637f5a8ffc1461064357600080fd5b80635c975abb116101dd5780636d297854116101a15780636d2978541461050157806370905dce1461052e578063715018a61461054e57806372cb5d971461056357806372edf627146105835780637713fb18146105a357600080fd5b80635c975abb1461042457806361d027b31461044557806366573d38146104655780636aedcf28146104955780636cb56d19146104e157600080fd5b80631cb44dfc1161022f5780631cb44dfc14610331578063228bfd9f146103515780633f4ba83a146103945780634256dd78146103a957806351d09e04146103c9578063544dcb2b146103f657600080fd5b806310f485f51461026c57806314c57e93146102af5780631662a489146102d157806316d3ffc3146102f15780631aefa2d114610311575b600080fd5b34801561027857600080fd5b50610299610287366004613611565b60d26020526000908152604090205481565b6040516102a6919061363a565b60405180910390f35b3480156102bb57600080fd5b506102cf6102ca366004613611565b6108c3565b005b3480156102dd57600080fd5b506102cf6102ec3660046136aa565b61096a565b3480156102fd57600080fd5b506102cf61030c366004613611565b610ce8565b34801561031d57600080fd5b506102cf61032c366004613719565b610d62565b34801561033d57600080fd5b506102cf61034c366004613759565b610e0b565b34801561035d57600080fd5b5061038761036c366004613611565b60ce602052600090815260409020546001600160a01b031681565b6040516102a69190613783565b3480156103a057600080fd5b506102cf610efe565b3480156103b557600080fd5b506102cf6103c4366004613719565b610f50565b3480156103d557600080fd5b506102996103e4366004613611565b60d06020526000908152604090205481565b34801561040257600080fd5b50610416610411366004613791565b610ff9565b6040516102a69291906138b8565b34801561043057600080fd5b5060655460ff165b6040516102a691906138e0565b34801561045157600080fd5b5060c954610387906001600160a01b031681565b34801561047157600080fd5b50610438610480366004613611565b60d36020526000908152604090205460ff1681565b3480156104a157600080fd5b506102cf6104b0366004613611565b33600090815260d4602090815260408083206001600160a01b0394909416835292905220805460ff19166001179055565b3480156104ed57600080fd5b506102cf6104fc3660046138ee565b6113a6565b34801561050d57600080fd5b5061029961051c366004613719565b60cf6020526000908152604090205481565b34801561053a57600080fd5b5060ca54610387906001600160a01b031681565b34801561055a57600080fd5b506102cf611571565b34801561056f57600080fd5b506102cf61057e3660046138ee565b6115a5565b34801561058f57600080fd5b5061041661059e36600461392b565b611615565b3480156105af57600080fd5b506102996105be3660046139ec565b6118be565b6104166105d1366004613a47565b611a8b565b3480156105e257600080fd5b506102cf6105f1366004613ae6565b611e4b565b34801561060257600080fd5b5060cd54610616906001600160a01b031681565b6040516102a69190613b9a565b34801561062f57600080fd5b506102cf61063e366004613611565b61221c565b34801561064f57600080fd5b506102cf61065e366004613d1d565b612268565b34801561066f57600080fd5b506102cf61238b565b34801561068457600080fd5b506033546001600160a01b0316610387565b3480156106a257600080fd5b506104386106b13660046138ee565b60d460209081526000928352604080842090915290825290205460ff1681565b3480156106dd57600080fd5b506102cf6106ec366004613d83565b6123db565b3480156106fd57600080fd5b5061029961070c366004613dbd565b612797565b34801561071d57600080fd5b5061029961072c366004613e0d565b61282a565b34801561073d57600080fd5b5061075161074c366004613f7f565b612875565b6040516102a6919061407a565b34801561076a57600080fd5b506102cf610779366004614089565b612957565b34801561078a57600080fd5b5061029960cc5481565b3480156107a057600080fd5b506102cf6107af366004614119565b612a1d565b3480156107c057600080fd5b506102cf6107cf366004613611565b33600090815260d4602090815260408083206001600160a01b0394909416835292905220805460ff19169055565b34801561080957600080fd5b5061029960cb5481565b34801561081f57600080fd5b5061043861082e366004613611565b60d16020526000908152604090205460ff1681565b34801561084f57600080fd5b506102cf61085e366004613d83565b612b23565b34801561086f57600080fd5b506102cf61087e366004613611565b612beb565b34801561088f57600080fd5b506102cf61089e366004613611565b612c65565b3480156108af57600080fd5b506102cf6108be366004613611565b612cc1565b60ca546001600160a01b0316336001600160a01b031614806108ef57506033546001600160a01b031633145b6109145760405162461bcd60e51b815260040161090b906141bd565b60405180910390fd5b60ca80546001600160a01b0319166001600160a01b0383161790556040517fe19673fc861bfeb894cf2d6b7662505497ef31c0f489b742db24ee33108269169061095f908390613783565b60405180910390a150565b6002609754141561098d5760405162461bcd60e51b815260040161090b90614204565b600260975560655460ff16156109b55760405162461bcd60e51b815260040161090b9061423b565b82826040516109c592919061425e565b604051809103902060cf600086815260200190815260200160002054146109fe5760405162461bcd60e51b815260040161090b906142ac565b6000610a3f84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061287592505050565b6101008101519091506001600160a01b031615801590610a6d57506101008101516001600160a01b03163314155b15610aba576101008101516001600160a01b0316600090815260d46020908152604080832033845290915290205460ff16610aba5760405162461bcd60e51b815260040161090b90614301565b6000610acf8683604001518460e00151612d3e565b90508160800151811015610ae557608082018190525b60cb546000908015610b03576080840151610b009082612f00565b91505b600084610120015183610b169190614327565b60cd546040870151606088015160808901519394506000936001600160a01b0390931692637373e4eb929190610b4d90879061433f565b6040518463ffffffff1660e01b8152600401610b6b93929190614356565b6040805180830381865afa158015610b87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bab9190614389565b50905060008660a0015188101580610bc757508660c001518811155b8015610bd35750818810155b905080610bf25760405162461bcd60e51b815260040161090b90614408565b7f1a035b9ed3ef4a7f5fbc048118e4386d340ef6a32afa06f66ada70da99801a088b8988604051610c2593929190614418565b60405180910390a1610c438760400151886101200151876000612f92565b50610c6c3388602001518a8a606001516001600160a01b0316613000909392919063ffffffff16565b610c9533868960800151610c80919061433f565b60408a01516001600160a01b03169190613058565b8660800151861115610cd6576000876080015187610cb3919061433f565b602089015160408a0151919250610cd4916001600160a01b03169083613058565b505b50506001609755505050505050505050565b6033546001600160a01b03163314610d125760405162461bcd60e51b815260040161090b90614465565b6001600160a01b038116600090815260d3602052604090819020805460ff19169055517f2e292e1956a6d69cacb1198906fdf4ddb2c596f388732e251ff7c530a3e8310f9061095f908390613783565b6033546001600160a01b03163314610d8c5760405162461bcd60e51b815260040161090b90614465565b612710811115610dae5760405162461bcd60e51b815260040161090b906144cf565b60c9546001600160a01b0316610dd65760405162461bcd60e51b815260040161090b90614532565b60cc8190556040517f5b81b8e66a81fbba6ded220cf668cb5da777acaa83cafe789c2699cad0efd8089061095f90839061363a565b6033546001600160a01b03163314610e355760405162461bcd60e51b815260040161090b90614465565b806001600160a01b0316639a82f8906040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e979190614555565b610eb35760405162461bcd60e51b815260040161090b906145bd565b60cd80546001600160a01b0319166001600160a01b0383161790556040517f107a9fafffb7ac890f780879e423760c9ffea8dcee8045681f40f542aede2cb89061095f908390613783565b60ca546001600160a01b0316336001600160a01b03161480610f2a57506033546001600160a01b031633145b610f465760405162461bcd60e51b815260040161090b906141bd565b610f4e613077565b565b6033546001600160a01b03163314610f7a5760405162461bcd60e51b815260040161090b90614465565b612710811115610f9c5760405162461bcd60e51b815260040161090b90614627565b60c9546001600160a01b0316610fc45760405162461bcd60e51b815260040161090b90614686565b60cb8190556040517fd10d75876659a287a59a6ccfa2e3fff42f84d94b542837acd30bc184d562de409061095f90839061363a565b60006060600260975414156110205760405162461bcd60e51b815260040161090b90614204565b600260975560655460ff16156110485760405162461bcd60e51b815260040161090b9061423b565b6001600160a01b038a16600090815260d1602052604090205460ff166110805760405162461bcd60e51b815260040161090b906146dd565b6001600160a01b038b166110a65760405162461bcd60e51b815260040161090b90614733565b600088116110c65760405162461bcd60e51b815260040161090b90614784565b600087116110e65760405162461bcd60e51b815260040161090b906147d6565b8686106111055760405162461bcd60e51b815260040161090b90614840565b60008411801561111457508784105b6111305760405162461bcd60e51b815260040161090b9061489d565b611142838c8c8c8c8c8c8c8c4261282a565b600081815260cf6020526040902054909250156111715760405162461bcd60e51b815260040161090b90614902565b6001600160a01b038a16600090815260d2602052604090205488811561126c576001600160a01b03808d16600081815260ce60205260408082205490516370a0823160e01b81529316929091906370a08231906111d2903090600401613783565b602060405180830381865afa1580156111ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112139190614912565b90506001600160a01b038216156112325761122f8e8284612797565b90505b8061123d858e614933565b6112479190614968565b9250600083116112695760405162461bcd60e51b815260040161090b906149c0565b50505b6112816001600160a01b038d1633308d613000565b61128b8183614327565b60d260008e6001600160a01b03166001600160a01b03168152602001908152602001600020819055506000604051806101400160405280876001600160a01b031681526020018f6001600160a01b031681526020018e6001600160a01b031681526020018d6001600160a01b031681526020018c81526020018b81526020018a8152602001838152602001896001600160a01b03168152602001888152509050611334816130dd565b9350838051906020012060cf6000878152602001908152602001600020819055507f13f12b10a159693872c07be52dbd27eab9b9805b52c4211f52475afde1fd909985856040516113869291906138b8565b60405180910390a15050600160975550909a909950975050505050505050565b6033546001600160a01b031633146113d05760405162461bcd60e51b815260040161090b90614465565b6001600160a01b03808316600090815260ce602052604090205416806114085760405162461bcd60e51b815260040161090b90614a1f565b816001600160a01b0316816001600160a01b0316141561143a5760405162461bcd60e51b815260040161090b90614a80565b604051630fa09e6360e41b81526001600160a01b0382169063fa09e63090611466908690600401613783565b600060405180830381600087803b15801561148057600080fd5b505af1158015611494573d6000803e3d6000fd5b505060405163adef453360e01b81526001600160a01b038416925063adef453391506114c4908690600401613783565b6020604051808303816000875af11580156114e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115079190614912565b156115245760405162461bcd60e51b815260040161090b90614ae1565b6001600160a01b038216156115425761153d8383613142565b505050565b506001600160a01b03918216600090815260ce6020526040902080546001600160a01b03191691909216179055565b6033546001600160a01b0316331461159b5760405162461bcd60e51b815260040161090b90614465565b610f4e6000613217565b6033546001600160a01b031633146115cf5760405162461bcd60e51b815260040161090b90614465565b6001600160a01b03828116600090815260ce602052604090205416156116075760405162461bcd60e51b815260040161090b90614b38565b6116118282613142565b5050565b600060606002609754141561163c5760405162461bcd60e51b815260040161090b90614204565b600260975560655460ff16156116645760405162461bcd60e51b815260040161090b9061423b565b6001600160a01b03881661168a5760405162461bcd60e51b815260040161090b90614b8e565b898960405161169a92919061425e565b604051809103902060cf60008d815260200190815260200160002054146116d35760405162461bcd60e51b815260040161090b90614be1565b60006117148b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061287592505050565b80519091506001600160a01b031633146117405760405162461bcd60e51b815260040161090b90614c42565b600087116117605760405162461bcd60e51b815260040161090b90614c94565b86861061177f5760405162461bcd60e51b815260040161090b90614cfe565b6000841180156117925750806080015184105b6117ae5760405162461bcd60e51b815260040161090b90614d5b565b60cf60008d8152602001908152602001600020600090556117df338a83604001518b85608001518c8c8c8c4261282a565b600081815260cf60205260409020549093501561180e5760405162461bcd60e51b815260040161090b90614dc0565b338982604001518a84608001518b8b8760e001518c8c60405160200161183d9a99989796959493929190614dd0565b6040516020818303038152906040529150818051906020012060cf6000858152602001908152602001600020819055507fab0fcc1ed5509956dd55f5d00b92857c733f16b17603dad60357f16f99900cf88c84846040516118a093929190614e65565b60405180910390a1506001609755909a909950975050505050505050565b6000600260975414156118e35760405162461bcd60e51b815260040161090b90614204565b60026097556040516118f8908490849061425e565b604051809103902060cf600086815260200190815260200160002054146119315760405162461bcd60e51b815260040161090b90614ede565b600061197284848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061287592505050565b80519091506001600160a01b0316331461199e5760405162461bcd60e51b815260040161090b90614f3f565b6119b18582604001518360e00151612d3e565b60cc546080830151919350600091841180156119cd5750600081115b15611a195760008360800151856119e4919061433f565b90506119f08183612f00565b92508215611a175760c9546040850151611a17916001600160a01b03918216911685613058565b505b6000611a25838661433f565b6040850151909150611a41906001600160a01b03163383613058565b7f3e1003227205ab9eb9b1652e25b2f6fc548ff55e94bf76a42aca90501c6c4e358882604051611a72929190614f4f565b60405180910390a1505060016097555090949350505050565b6000606060026097541415611ab25760405162461bcd60e51b815260040161090b90614204565b600260975560655460ff1615611ada5760405162461bcd60e51b815260040161090b9061423b565b346006602160991b016001600160a01b038b16611b095760405162461bcd60e51b815260040161090b90614fb6565b60008211611b295760405162461bcd60e51b815260040161090b9061500d565b60008911611b495760405162461bcd60e51b815260040161090b90615065565b888810611b685760405162461bcd60e51b815260040161090b90615075565b600086118015611b7757508186105b611b935760405162461bcd60e51b815260040161090b90615135565b611ba5858c838d868e8e8e8e4261282a565b600081815260cf602052604090205490945015611bd45760405162461bcd60e51b815260040161090b9061519f565b6001600160a01b038116600090815260d26020526040902054828115611ccf576001600160a01b03808416600081815260ce60205260408082205490516370a0823160e01b81529316929091906370a0823190611c35903090600401613783565b602060405180830381865afa158015611c52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c769190614912565b90506001600160a01b03821615611c9557611c92858284612797565b90505b80611ca08588614933565b611caa9190614968565b925060008311611ccc5760405162461bcd60e51b815260040161090b906151f9565b50505b826001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b158015611d0a57600080fd5b505af1158015611d1e573d6000803e3d6000fd5b50505050508082611d2f9190614327565b60d26000856001600160a01b03166001600160a01b03168152602001908152602001600020819055506000604051806101400160405280896001600160a01b031681526020018f6001600160a01b03168152602001856001600160a01b031681526020018e6001600160a01b031681526020018681526020018d81526020018c81526020018381526020018b6001600160a01b031681526020018a8152509050611dd8816130dd565b9550858051906020012060cf6000898152602001908152602001600020819055507f13f12b10a159693872c07be52dbd27eab9b9805b52c4211f52475afde1fd90998787604051611e2a9291906138b8565b60405180910390a15050505050600160978190555097509795505050505050565b60026097541415611e6e5760405162461bcd60e51b815260040161090b90614204565b600260975560655460ff1615611e965760405162461bcd60e51b815260040161090b9061423b565b8484604051611ea692919061425e565b604051809103902060cf60008881526020019081526020016000205414611edf5760405162461bcd60e51b815260040161090b9061524d565b6000611f2086868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061287592505050565b6101008101519091506001600160a01b031615801590611f4e57506101008101516001600160a01b03163314155b15611f9b576101008101516001600160a01b0316600090815260d46020908152604080832033845290915290205460ff16611f9b5760405162461bcd60e51b815260040161090b906152a5565b6001600160a01b038416600090815260d3602052604090205460ff16611fd35760405162461bcd60e51b815260040161090b906152fa565b6000611fe88883604001518460e00151612d3e565b90508160800151811015611ffe57608082018190525b60cb54600090801561201c5760808401516120199082612f00565b91505b61203184604001518561012001518433612f92565b506000846101200151836120459190614327565b9050808560800151612057919061433f565b6080860181905260cd5460408088015160608901519151637373e4eb60e01b81526000946001600160a01b0390941693637373e4eb9361209d9392909190600401614356565b6040805180830381865afa1580156120b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120dd9190614389565b91505061210689876080015188604001516001600160a01b03166130589092919063ffffffff16565b60405163d14c0a2b60e01b81526000906001600160a01b038b169063d14c0a2b9061213b908a9086908e908e9060040161532d565b6020604051808303816000875af115801561215a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061217e9190614912565b90507f1a035b9ed3ef4a7f5fbc048118e4386d340ef6a32afa06f66ada70da99801a088d82886040516121b393929190614418565b60405180910390a16121c5838761433f565b955086608001518611156122085760008760800151876121e5919061433f565b602089015160408a0151919250612206916001600160a01b03169083613058565b505b505060016097555050505050505050505050565b6033546001600160a01b031633146122465760405162461bcd60e51b815260040161090b90614465565b60c980546001600160a01b0319166001600160a01b0392909216919091179055565b60ca546001600160a01b0316336001600160a01b0316148061229457506033546001600160a01b031633145b6122b05760405162461bcd60e51b815260040161090b906141bd565b60005b825181101561153d5760008382815181106122d0576122d0615368565b6020026020010151905060008383815181106122ee576122ee615368565b6020026020010151905061271081111561231a5760405162461bcd60e51b815260040161090b906153d8565b8015612376576001600160a01b038216600090815260d0602052604090819020829055517ff9628d924e8979ddcc16d8bf48442abfa72efa17170d000ed9eae953c7a54fe09061236d90849084906153e8565b60405180910390a15b50508080612383906153f6565b9150506122b3565b60ca546001600160a01b0316336001600160a01b031614806123b757506033546001600160a01b031633145b6123d35760405162461bcd60e51b815260040161090b906141bd565b610f4e613269565b60005a905060005b825181101561153d57600060ce600085848151811061240457612404615368565b6020908102919091018101516001600160a01b03908116835290820192909252604001600020541690508061244b5760405162461bcd60e51b815260040161090b9061545b565b600084838151811061245f5761245f615368565b60200260200101516001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016124929190613783565b602060405180830381865afa1580156124af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124d39190614912565b90506000826001600160a01b031663adef45338786815181106124f8576124f8615368565b60200260200101516040518263ffffffff1660e01b815260040161251c9190613783565b6020604051808303816000875af115801561253b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061255f9190614912565b9050600061256d8284614327565b905060006125c260d060008a898151811061258a5761258a615368565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205483612f0090919063ffffffff16565b9050808411156126905760006125d8828661433f565b905061261186828b8a815181106125f1576125f1615368565b60200260200101516001600160a01b03166130589092919063ffffffff16565b856001600160a01b03166347e7ef248a898151811061263257612632615368565b6020026020010151836040518363ffffffff1660e01b81526004016126589291906153e8565b600060405180830381600087803b15801561267257600080fd5b505af1158015612686573d6000803e3d6000fd5b505050505061271d565b8084101561271d57846001600160a01b031663f3fef3a38988815181106126b9576126b9615368565b602002602001015186846126cd919061433f565b6040518363ffffffff1660e01b81526004016126ea9291906153e8565b600060405180830381600087803b15801561270457600080fd5b505af1158015612718573d6000803e3d6000fd5b505050505b6001885161272b919061433f565b86141561277f577fdf7bdec6b3f6adf3cbe6ddcf1a6b817121aa439b6ffc79a3a28a6cfc06b58c3a3a5a61275f908a61433f565b6127699190614933565b604051612776919061363a565b60405180910390a15b5050505050808061278f906153f6565b9150506123e3565b816001600160a01b038216156128235760405163adef453360e01b81526001600160a01b0383169063adef4533906127d3908790600401613783565b6020604051808303816000875af11580156127f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128169190614912565b6128209082614327565b90505b9392505050565b60008a8a8a8a8a8a8a8a8a8a60405160200161284f9a9998979695949392919061546b565b6040516020818303038152906040528051906020012090509a9950505050505050505050565b6040805161014081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101919091526000806000806000806000806000808b8060200190518101906128e991906154ee565b60408051610140810182526001600160a01b039b8c168152998b1660208b0152978a16978901979097529488166060880152608087019390935260a086019190915260c085015260e08401529092166101008201526101208101919091529c9b505050505050505050505050565b600061296360016132c1565b9050801561297b576000805461ff0019166101001790555b61298361334e565b61298b61337d565b6129936133ac565b61299c84612c65565b60cd80546001600160a01b038085166001600160a01b03199283161790925560ca8054928616929091169190911790558015612a17576000805461ff00191690556040517f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890612a0e906001906155cc565b60405180910390a15b50505050565b60ca546001600160a01b0316336001600160a01b03161480612a4957506033546001600160a01b031633145b612a655760405162461bcd60e51b815260040161090b906141bd565b60005b8181101561153d576000838383818110612a8457612a84615368565b9050602002016020810190612a999190613611565b6001600160a01b03808216600090815260ce602052604090819020549051630fa09e6360e41b81529293501690819063fa09e63090612adc908590600401613783565b600060405180830381600087803b158015612af657600080fd5b505af1158015612b0a573d6000803e3d6000fd5b5050505050508080612b1b906153f6565b915050612a68565b6033546001600160a01b03163314612b4d5760405162461bcd60e51b815260040161090b90614465565b60005b8151811015611611576000828281518110612b6d57612b6d615368565b6020908102919091018101516001600160a01b038116600090815260d1909252604091829020805460ff1916600117905590519091507f2d415a7e8d172bc033826156341b9a4633fe87027f34e48381cead444d49191090612bd0908390613783565b60405180910390a15080612be3816153f6565b915050612b50565b6033546001600160a01b03163314612c155760405162461bcd60e51b815260040161090b90614465565b6001600160a01b038116600090815260d1602052604090819020805460ff19169055517f7a6cf3400c5d1f077f31c360836032ed93c649078c80a84bbdc5692b272908629061095f908390613783565b6033546001600160a01b03163314612c8f5760405162461bcd60e51b815260040161090b90614465565b6001600160a01b038116612cb55760405162461bcd60e51b815260040161090b9061561d565b612cbe81613217565b50565b6033546001600160a01b03163314612ceb5760405162461bcd60e51b815260040161090b90614465565b6001600160a01b038116600090815260d3602052604090819020805460ff19166001179055517f6fc05cb1b190570df287d4733e17270ce74deac5ea19e713e2d8146321371dac9061095f908390613783565b600083815260cf602090815260408083208390556001600160a01b0380861680855260ce9093528184205491516370a0823160e01b815291169183916370a0823190612d8e903090600401613783565b602060405180830381865afa158015612dab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dcf9190614912565b90506000612dde868385612797565b6001600160a01b038716600090815260d26020526040902054909150612e04868261433f565b6001600160a01b038816600090815260d2602052604090205580612e288388614933565b612e329190614968565b94508483108015612e4b57506001600160a01b03841615155b15612ef5576001600160a01b038716600090815260d06020526040812054612e7d90612e77888661433f565b90612f00565b90506001600160a01b03851663f3fef3a38986612e9a858b614327565b612ea4919061433f565b6040518363ffffffff1660e01b8152600401612ec19291906153e8565b600060405180830381600087803b158015612edb57600080fd5b505af1158015612eef573d6000803e3d6000fd5b50505050505b505050509392505050565b6000821580612f0d575081155b15612f1a57506000612f8c565b81612f286002612710614968565b612f349060001961433f565b612f3e9190614968565b831115612f5d5760405162461bcd60e51b815260040161090b90615676565b612710612f6b600282614968565b612f758486614933565b612f7f9190614327565b612f899190614968565b90505b92915050565b60c9546000906001600160a01b03168315612fbb57612fbb6001600160a01b0387168286613058565b6001600160a01b03831615801590612fd35750600085115b15612ff757612ff783612fe6848861433f565b6001600160a01b0389169190613058565b50949350505050565b612a17846323b872dd60e01b85858560405160240161302193929190614356565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526133db565b61153d8363a9059cbb60e01b84846040516024016130219291906153e8565b60655460ff166130995760405162461bcd60e51b815260040161090b906156b1565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516130d39190613783565b60405180910390a1565b6060816000015182602001518360400151846060015185608001518660a001518760c001518860e001518961010001518a610120015160405160200161312c9a99989796959493929190614dd0565b6040516020818303038152906040529050919050565b6001600160a01b03811615611611577f1a654dbe468f1cff27ced5a916efd4120a4155caf290688ab42aebe90554683e82826040516131829291906156c1565b60405180910390a16001600160a01b03828116600090815260ce6020908152604080832080546001600160a01b0319169486169490941790935582516001808252818501909452919290828101908036833701905050905082816000815181106131ee576131ee615368565b60200260200101906001600160a01b031690816001600160a01b03168152505061153d816123db565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60655460ff161561328c5760405162461bcd60e51b815260040161090b9061423b565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586130c63390565b60008054610100900460ff1615613308578160ff1660011480156132e45750303b155b6133005760405162461bcd60e51b815260040161090b90615727565b506000919050565b60005460ff80841691161061332f5760405162461bcd60e51b815260040161090b90615727565b506000805460ff191660ff92909216919091179055600190565b919050565b600054610100900460ff166133755760405162461bcd60e51b815260040161090b9061577f565b610f4e61346a565b600054610100900460ff166133a45760405162461bcd60e51b815260040161090b9061577f565b610f4e61349a565b600054610100900460ff166133d35760405162461bcd60e51b815260040161090b9061577f565b610f4e6134cd565b6000613430826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166134fb9092919063ffffffff16565b80519091501561153d578080602001905181019061344e9190614555565b61153d5760405162461bcd60e51b815260040161090b906157d6565b600054610100900460ff166134915760405162461bcd60e51b815260040161090b9061577f565b610f4e33613217565b600054610100900460ff166134c15760405162461bcd60e51b815260040161090b9061577f565b6065805460ff19169055565b600054610100900460ff166134f45760405162461bcd60e51b815260040161090b9061577f565b6001609755565b60606128208484600085856001600160a01b0385163b61352d5760405162461bcd60e51b815260040161090b9061581a565b600080866001600160a01b03168587604051613549919061584c565b60006040518083038185875af1925050503d8060008114613586576040519150601f19603f3d011682016040523d82523d6000602084013e61358b565b606091505b509150915061359b8282866135a8565b925050505b949350505050565b606083156135b7575081612823565b8251156135c75782518084602001fd5b8160405162461bcd60e51b815260040161090b9190615858565b60006001600160a01b038216612f8c565b6135fb816135e1565b8114612cbe57600080fd5b8035612f8c816135f2565b60006020828403121561362657613626600080fd5b60006135a08484613606565b805b82525050565b60208101612f8c8284613632565b806135fb565b8035612f8c81613648565b60008083601f84011261366e5761366e600080fd5b5081356001600160401b0381111561368857613688600080fd5b6020830191508360018202830111156136a3576136a3600080fd5b9250929050565b600080600080606085870312156136c3576136c3600080fd5b60006136cf878761364e565b94505060208501356001600160401b038111156136ee576136ee600080fd5b6136fa87828801613659565b9350935050604061370d8782880161364e565b91505092959194509250565b60006020828403121561372e5761372e600080fd5b60006135a0848461364e565b6000612f8c826135e1565b6135fb8161373a565b8035612f8c81613745565b60006020828403121561376e5761376e600080fd5b60006135a0848461374e565b613634816135e1565b60208101612f8c828461377a565b60008060008060008060008060006101208a8c0312156137b3576137b3600080fd5b60006137bf8c8c613606565b99505060206137d08c828d01613606565b98505060406137e18c828d01613606565b97505060606137f28c828d0161364e565b96505060806138038c828d0161364e565b95505060a06138148c828d0161364e565b94505060c06138258c828d01613606565b93505060e06138368c828d0161364e565b9250506101006138488c828d01613606565b9150509295985092959850929598565b60005b8381101561387357818101518382015260200161385b565b83811115612a175750506000910152565b600061388e825190565b8084526020840193506138a5818560208601613858565b601f19601f8201165b9093019392505050565b604081016138c68285613632565b81810360208301526128208184613884565b801515613634565b60208101612f8c82846138d8565b6000806040838503121561390457613904600080fd5b60006139108585613606565b925050602061392185828601613606565b9150509250929050565b60008060008060008060008060006101008a8c03121561394d5761394d600080fd5b60006139598c8c61364e565b99505060208a01356001600160401b0381111561397857613978600080fd5b6139848c828d01613659565b985098505060406139978c828d01613606565b96505060606139a88c828d01613606565b95505060806139b98c828d0161364e565b94505060a06139ca8c828d0161364e565b93505060c06139db8c828d01613606565b92505060e06138488c828d0161364e565b600080600060408486031215613a0457613a04600080fd5b6000613a10868661364e565b93505060208401356001600160401b03811115613a2f57613a2f600080fd5b613a3b86828701613659565b92509250509250925092565b600080600080600080600060e0888a031215613a6557613a65600080fd5b6000613a718a8a613606565b9750506020613a828a828b01613606565b9650506040613a938a828b0161364e565b9550506060613aa48a828b0161364e565b9450506080613ab58a828b01613606565b93505060a0613ac68a828b0161364e565b92505060c0613ad78a828b01613606565b91505092959891949750929550565b60008060008060008060808789031215613b0257613b02600080fd5b6000613b0e898961364e565b96505060208701356001600160401b03811115613b2d57613b2d600080fd5b613b3989828a01613659565b95509550506040613b4c89828a01613606565b93505060608701356001600160401b03811115613b6b57613b6b600080fd5b613b7789828a01613659565b92509250509295509295509295565b6000612f8c8261373a565b61363481613b86565b60208101612f8c8284613b91565b634e487b7160e01b600052604160045260246000fd5b601f19601f83011681018181106001600160401b0382111715613be357613be3613ba8565b6040525050565b6000613bf560405190565b90506133498282613bbe565b60006001600160401b03821115613c1a57613c1a613ba8565b5060209081020190565b6000613c37613c3284613c01565b613bea565b83815290506020808201908402830185811115613c5657613c56600080fd5b835b81811015613c7a5780613c6b8882613606565b84525060209283019201613c58565b5050509392505050565b600082601f830112613c9857613c98600080fd5b81356135a0848260208601613c24565b6000613cb6613c3284613c01565b83815290506020808201908402830185811115613cd557613cd5600080fd5b835b81811015613c7a5780613cea888261364e565b84525060209283019201613cd7565b600082601f830112613d0d57613d0d600080fd5b81356135a0848260208601613ca8565b60008060408385031215613d3357613d33600080fd5b82356001600160401b03811115613d4c57613d4c600080fd5b613d5885828601613c84565b92505060208301356001600160401b03811115613d7757613d77600080fd5b61392185828601613cf9565b600060208284031215613d9857613d98600080fd5b81356001600160401b03811115613db157613db1600080fd5b6135a084828501613c84565b600080600060608486031215613dd557613dd5600080fd5b6000613de18686613606565b9350506020613df28682870161364e565b9250506040613e0386828701613606565b9150509250925092565b6000806000806000806000806000806101408b8d031215613e3057613e30600080fd5b6000613e3c8d8d613606565b9a50506020613e4d8d828e01613606565b9950506040613e5e8d828e01613606565b9850506060613e6f8d828e01613606565b9750506080613e808d828e0161364e565b96505060a0613e918d828e0161364e565b95505060c0613ea28d828e0161364e565b94505060e0613eb38d828e01613606565b935050610100613ec58d828e0161364e565b925050610120613ed78d828e0161364e565b9150509295989b9194979a5092959850565b60006001600160401b03821115613f0257613f02613ba8565b601f19601f83011660200192915050565b82818337506000910152565b6000613f2d613c3284613ee9565b905082815260208101848484011115613f4857613f48600080fd5b613f53848285613f13565b509392505050565b600082601f830112613f6f57613f6f600080fd5b81356135a0848260208601613f1f565b600060208284031215613f9457613f94600080fd5b81356001600160401b03811115613fad57613fad600080fd5b6135a084828501613f5b565b8051610140830190613fcb848261377a565b506020820151613fde602085018261377a565b506040820151613ff1604085018261377a565b506060820151614004606085018261377a565b5060808201516140176080850182613632565b5060a082015161402a60a0850182613632565b5060c082015161403d60c0850182613632565b5060e082015161405060e0850182613632565b5061010082015161406561010085018261377a565b50610120820151612a17610120850182613632565b6101408101612f8c8284613fb9565b6000806000606084860312156140a1576140a1600080fd5b60006140ad8686613606565b93505060206140be86828701613606565b9250506040613e038682870161374e565b60008083601f8401126140e4576140e4600080fd5b5081356001600160401b038111156140fe576140fe600080fd5b6020830191508360208202830111156136a3576136a3600080fd5b6000806020838503121561412f5761412f600080fd5b82356001600160401b0381111561414857614148600080fd5b614154858286016140cf565b92509250509250929050565b603c81526000602082017f596f6c6f3a206f6e6c7920656d657267656e63792061646d696e206f72206f7781527f6e65722063616e20696e766f6b6520746869732066756e6374696f6e00000000602082015291505b5060400190565b60208082528101612f8c81614160565b601f81526000602082017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00815291505b5060200190565b60208082528101612f8c816141cd565b601081526000602082016f14185d5cd8589b194e881c185d5cd95960821b815291506141fd565b60208082528101612f8c81614214565b6000614258838584613f13565b50500190565b60006135a082848661424b565b602481526000602082017f596f6c6f3a3a66696c6c4f726465723a206f7264657220646f65736e2774206d8152630c2e8c6d60e31b602082015291506141b6565b60208082528101612f8c8161426b565b602881526000602082017f596f6c6f3a3a66696c6c4f726465723a206f72646572206578656375746f72208152670dad2e6dac2e8c6d60c31b602082015291506141b6565b60208082528101612f8c816142bc565b634e487b7160e01b600052601160045260246000fd5b6000821982111561433a5761433a614311565b500190565b60008282101561435157614351614311565b500390565b60608101614364828661377a565b614371602083018561377a565b6135a06040830184613632565b8051612f8c81613648565b6000806040838503121561439f5761439f600080fd5b60006143ab858561437e565b92505060206139218582860161437e565b602f81526000602082017f596f6c6f3a3a66696c6c4f726465723a2066696c6c20636f6e646974696f6e2081526e646f65736e2774207361746973667960881b602082015291506141b6565b60208082528101612f8c816143bc565b606081016144268286613632565b6143716020830185613632565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572910190815260006141fd565b60208082528101612f8c81614433565b603e81526000602082017f596f6c6f3a3a75706461746543616e63656c6c6174696f6e4665653a2066656581527f2070657263656e742065786365656473206d6178207468726573686f6c640000602082015291506141b6565b60208082528101612f8c81614475565b603681526000602082017f596f6c6f3a3a75706461746543616e63656c6c6174696f6e4665653a20747265815275185cdd5c9e481859191c995cdcdcc81b9bdd081cd95d60521b602082015291506141b6565b60208082528101612f8c816144df565b8015156135fb565b8051612f8c81614542565b60006020828403121561456a5761456a600080fd5b60006135a0848461454a565b602a81526000602082017f596f6c6f3a3a7570646174654f7261636c653a20696e76616c6964206f7261638152696c65206164647265737360b01b602082015291506141b6565b60208082528101612f8c81614576565b603a81526000602082017f596f6c6f3a3a75706461746550726f746f636f6c4665653a206665652070657281527f63656e742065786365656473206d6178207468726573686f6c64000000000000602082015291506141b6565b60208082528101612f8c816145cd565b603281526000602082017f596f6c6f3a3a75706461746550726f746f636f6c4665653a20747265617375728152711e481859191c995cdcdcc81b9bdd081cd95d60721b602082015291506141b6565b60208082528101612f8c81614637565b602a81526000602082017f596f6c6f3a3a6372656174654f726465723a20756e737570706f72746564206981526937383aba103a37b5b2b760b11b602082015291506141b6565b60208082528101612f8c81614696565b602981526000602082017f596f6c6f3a3a6372656174654f726465723a207a65726f20726563697069656e81526874206164647265737360b81b602082015291506141b6565b60208082528101612f8c816146ed565b602481526000602082017f596f6c6f3a3a6372656174654f726465723a207a65726f20696e70757420616d8152631bdd5b9d60e21b602082015291506141b6565b60208082528101612f8c81614743565b602581526000602082017f596f6c6f3a3a6372656174654f726465723a207a65726f2072657475726e20618152641b5bdd5b9d60da1b602082015291506141b6565b60208082528101612f8c81614794565b603d81526000602082017f596f6c6f3a3a6372656174654f726465723a2073746f706c6f737320616d6f7581527f6e742067726561746572207468616e2072657475726e20616d6f756e74000000602082015291506141b6565b60208082528101612f8c816147e6565b603081526000602082017f596f6c6f3a3a6372656174654f726465723a20696e76616c6964206f72207a6581526f726f20657865637574696f6e2066656560801b602082015291506141b6565b60208082528101612f8c81614850565b603881526000602082017f596f6c6f3a3a6372656174654f726465723a206f7264657220616c726561647981527708195e1a5cdd1cc81dda5d1a081d1a19481cd85b59481a5960421b602082015291506141b6565b60208082528101612f8c816148ad565b60006020828403121561492757614927600080fd5b60006135a0848461437e565b600081600019048311821515161561494d5761494d614311565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261497757614977614952565b500490565b602781526000602082017f596f6c6f3a3a6372656174654f726465723a207368617265732063616e2774208152666265207a65726f60c81b602082015291506141b6565b60208082528101612f8c8161497c565b603281526000602082017f596f6c6f3a3a6d69677261746553747261746567793a206e6f2070726576696f81527175732073747261746567792065786973747360701b602082015291506141b6565b60208082528101612f8c816149d0565b603481526000602082017f596f6c6f3a3a6d69677261746553747261746567793a206e65772073747261748152736567792073616d652061732070726576696f757360601b602082015291506141b6565b60208082528101612f8c81614a2f565b603481526000602082017f596f6c6f3a3a6d69677261746553747261746567793a20776974686472617720815273199c9bdb481cdd1c985d1959de4819985a5b195960621b602082015291506141b6565b60208082528101612f8c81614a90565b602a81526000602082017f596f6c6f3a3a73657453747261746567793a20737472617465677920616c72658152696164792065786973747360b01b602082015291506141b6565b60208082528101612f8c81614af1565b602981526000602082017f596f6c6f3a3a7570646174654f726465723a207a65726f20726563697069656e81526874206164647265737360b81b602082015291506141b6565b60208082528101612f8c81614b48565b602681526000602082017f596f6c6f3a3a7570646174654f726465723a206f7264657220646f65736e2774815265040dac2e8c6d60d31b602082015291506141b6565b60208082528101612f8c81614b9e565b603481526000602082017f596f6c6f3a3a7570646174654f726465723a206f6e6c792063726561746f722081527331b0b7103ab83230ba32903a34329037b93232b960611b602082015291506141b6565b60208082528101612f8c81614bf1565b602581526000602082017f596f6c6f3a3a7570646174654f726465723a207a65726f2072657475726e20618152641b5bdd5b9d60da1b602082015291506141b6565b60208082528101612f8c81614c52565b603d81526000602082017f596f6c6f3a3a7570646174654f726465723a2073746f706c6f737320616d6f7581527f6e742067726561746572207468616e2072657475726e20616d6f756e74000000602082015291506141b6565b60208082528101612f8c81614ca4565b603081526000602082017f596f6c6f3a3a7570646174654f726465723a20696e76616c6964206f72207a6581526f726f20657865637574696f6e2066656560801b602082015291506141b6565b60208082528101612f8c81614d0e565b603881526000602082017f596f6c6f3a3a7570646174654f726465723a206f7264657220616c726561647981527708195e1a5cdd1cc81dda5d1a081d1a19481cd85b59481a5960421b602082015291506141b6565b60208082528101612f8c81614d6b565b6101408101614ddf828d61377a565b614dec602083018c61377a565b614df9604083018b61377a565b614e06606083018a61377a565b614e136080830189613632565b614e2060a0830188613632565b614e2d60c0830187613632565b614e3a60e0830186613632565b614e4861010083018561377a565b614e56610120830184613632565b9b9a5050505050505050505050565b60608101614e738286613632565b614e806020830185613632565b8181036040830152614e928184613884565b95945050505050565b602681526000602082017f596f6c6f3a3a63616e63656c4f726465723a206f7264657220646f65736e2774815265040dac2e8c6d60d31b602082015291506141b6565b60208082528101612f8c81614e9b565b603481526000602082017f596f6c6f3a3a63616e63656c4f726465723a206f6e6c792063726561746f722081527331b0b71031b0b731b2b6103a34329037b93232b960611b602082015291506141b6565b60208082528101612f8c81614eee565b60408101614f5d8285613632565b6128236020830184613632565b602f81526000602082017f596f6c6f3a3a6372656174654e61746976654f726465723a207a65726f20726581526e63697069656e74206164647265737360881b602082015291506141b6565b60208082528101612f8c81614f6a565b602a81526000602082017f596f6c6f3a3a6372656174654e61746976654f726465723a207a65726f20696e8152691c1d5d08185b5bdd5b9d60b21b602082015291506141b6565b60208082528101612f8c81614fc6565b602b81526000602082017f596f6c6f3a3a6372656174654e61746976654f726465723a207a65726f20726581526a1d1d5c9b88185b5bdd5b9d60aa1b602082015291506141b6565b60208082528101612f8c8161501d565b60208082528101612f8c81604381527f596f6c6f3a3a6372656174654e61746976654f726465723a2073746f706c6f7360208201527f7320616d6f756e742067726561746572207468616e2072657475726e20616d6f6040820152621d5b9d60ea1b606082015260800190565b603681526000602082017f596f6c6f3a3a6372656174654e61746976654f726465723a20696e76616c6964815275206f72207a65726f20657865637574696f6e2066656560501b602082015291506141b6565b60208082528101612f8c816150e2565b603e81526000602082017f596f6c6f3a3a6372656174654e61746976654f726465723a206f72646572206181527f6c7265616479206578697374732077697468207468652073616d652069640000602082015291506141b6565b60208082528101612f8c81615145565b602d81526000602082017f596f6c6f3a3a6372656174654e61746976654f726465723a207368617265732081526c63616e2774206265207a65726f60981b602082015291506141b6565b60208082528101612f8c816151af565b602781526000602082017f596f6c6f3a3a657865637574654f726465723a206f7264657220646f65736e278152660e840dac2e8c6d60cb1b602082015291506141b6565b60208082528101612f8c81615209565b602b81526000602082017f596f6c6f3a3a657865637574654f726465723a206f726465722065786563757481526a0dee440dad2e6dac2e8c6d60ab1b602082015291506141b6565b60208082528101612f8c8161525d565b602881526000602082017f596f6c6f3a3a657865637574654f726465723a20756e72656769737465726564815267103430b7323632b960c11b602082015291506141b6565b60208082528101612f8c816152b5565b8183526000602084019350615320838584613f13565b601f19601f8401166138ae565b610180810161533c8287613fb9565b61534a610140830186613632565b81810361016083015261535e81848661530a565b9695505050505050565b634e487b7160e01b600052603260045260246000fd5b603e81526000602082017f596f6c6f3a3a757064617465546f6b656e734275666665723a2062756666657281527f2070657263656e742065786365656473206d6178207468726573686f6c640000602082015291506141b6565b60208082528101612f8c8161537e565b60408101614f5d828561377a565b600060001982141561540a5761540a614311565b5060010190565b602d81526000602082017f596f6c6f3a3a726562616c616e6365546f6b656e733a2073747261746567792081526c191bd95cdb89dd08195e1a5cdd609a1b602082015291506141b6565b60208082528101612f8c81615411565b610140810161547a828d61377a565b615487602083018c61377a565b615494604083018b61377a565b6154a1606083018a61377a565b6154ae6080830189613632565b6154bb60a0830188613632565b6154c860c0830187613632565b6154d560e083018661377a565b614e48610100830185613632565b8051612f8c816135f2565b6000806000806000806000806000806101408b8d03121561551157615511600080fd5b600061551d8d8d6154e3565b9a5050602061552e8d828e016154e3565b995050604061553f8d828e016154e3565b98505060606155508d828e016154e3565b97505060806155618d828e0161437e565b96505060a06155728d828e0161437e565b95505060c06155838d828e0161437e565b94505060e06155948d828e0161437e565b9350506101006155a68d828e016154e3565b925050610120613ed78d828e0161437e565b600060ff8216612f8c565b613634816155b8565b60208101612f8c82846155c3565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b602082015291506141b6565b60208082528101612f8c816155da565b602c81526000602082017f50657263656e746167654d6174683a204d4154485f4d554c5449504c4943415481526b494f4e5f4f564552464c4f5760a01b602082015291506141b6565b60208082528101612f8c8161562d565b601481526000602082017314185d5cd8589b194e881b9bdd081c185d5cd95960621b815291506141fd565b60208082528101612f8c81615686565b604081016156cf828561377a565b612823602083018461377a565b602e81526000602082017f496e697469616c697a61626c653a20636f6e747261637420697320616c72656181526d191e481a5b9a5d1a585b1a5e995960921b602082015291506141b6565b60208082528101612f8c816156dc565b602b81526000602082017f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206981526a6e697469616c697a696e6760a81b602082015291506141b6565b60208082528101612f8c81615737565b602a81526000602082017f5361666545524332303a204552433230206f7065726174696f6e20646964206e8152691bdd081cdd58d8d9595960b21b602082015291506141b6565b60208082528101612f8c8161578f565b601d81526000602082017f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000815291506141fd565b60208082528101612f8c816157e6565b6000615834825190565b615842818560208601613858565b9290920192915050565b6000612823828461582a565b60208082528101612f89818461388456fea2646970667358221220d8234c6fa4252dc648b19ff9d61b552bb9d0eb02862d1bce56fdac9ede47336c64736f6c634300080a0033

Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.