ETH Price: $2,303.64 (+0.93%)

Contract

0xe145976Cba0383A44D8B46caEb36ab28fe0A9cC2
 

Overview

ETH Balance

0.368735821047468689 ETH

Eth Value

$849.43 (@ $2,303.64/ETH)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Execute206966342024-09-07 5:29:1129 hrs ago1725686951IN
MEV Bot: 0xe14...cc2
0 ETH0.00078361.18539998
Execute206966192024-09-07 5:26:1129 hrs ago1725686771IN
MEV Bot: 0xe14...cc2
0 ETH0.000901081.36312637
Execute206940942024-09-06 20:59:1137 hrs ago1725656351IN
MEV Bot: 0xe14...cc2
0 ETH0.0169865611.58167842
Execute206940802024-09-06 20:56:2337 hrs ago1725656183IN
MEV Bot: 0xe14...cc2
0 ETH0.0182892912.62571336
Execute206940672024-09-06 20:53:4737 hrs ago1725656027IN
MEV Bot: 0xe14...cc2
0 ETH0.013282867.24543877
Execute206939942024-09-06 20:39:1138 hrs ago1725655151IN
MEV Bot: 0xe14...cc2
0 ETH0.011619677.46729535
Execute206939302024-09-06 20:26:2338 hrs ago1725654383IN
MEV Bot: 0xe14...cc2
0 ETH0.010672534.99538352
Execute206934072024-09-06 18:41:3539 hrs ago1725648095IN
MEV Bot: 0xe14...cc2
0 ETH0.012078066.68604329
Execute206930932024-09-06 17:38:2341 hrs ago1725644303IN
MEV Bot: 0xe14...cc2
0 ETH0.0197694713.65487795
Execute206924102024-09-06 15:20:5943 hrs ago1725636059IN
MEV Bot: 0xe14...cc2
0 ETH0.0280626518.83370615
Execute206863372024-09-05 19:00:112 days ago1725562811IN
MEV Bot: 0xe14...cc2
0 ETH0.000231632.79584654
Execute206863372024-09-05 19:00:112 days ago1725562811IN
MEV Bot: 0xe14...cc2
0 ETH0.005271732.79584654
Execute206863332024-09-05 18:59:232 days ago1725562763IN
MEV Bot: 0xe14...cc2
0 ETH0.00480872.81610608
Execute206863332024-09-05 18:59:232 days ago1725562763IN
MEV Bot: 0xe14...cc2
0 ETH0.005324192.81610608
Execute206738212024-09-04 1:05:234 days ago1725411923IN
MEV Bot: 0xe14...cc2
0 ETH0.022588568.87439637
Execute206587652024-09-01 22:41:236 days ago1725230483IN
MEV Bot: 0xe14...cc2
0 ETH0.002613651.30093581
Execute206562612024-09-01 14:17:116 days ago1725200231IN
MEV Bot: 0xe14...cc2
0 ETH0.002777861.40352111
Execute206275542024-08-28 14:02:2310 days ago1724853743IN
MEV Bot: 0xe14...cc2
0 ETH0.005516072.99484747
Execute206229942024-08-27 22:45:1111 days ago1724798711IN
MEV Bot: 0xe14...cc2
0 ETH0.0012835.83896633
Execute206228712024-08-27 22:20:3511 days ago1724797235IN
MEV Bot: 0xe14...cc2
0 ETH0.0275663918.67010625
Execute206228552024-08-27 22:17:2311 days ago1724797043IN
MEV Bot: 0xe14...cc2
0 ETH0.0235522715.76262519
Execute206228552024-08-27 22:17:2311 days ago1724797043IN
MEV Bot: 0xe14...cc2
0 ETH0.0343629615.76262519
Execute206227202024-08-27 21:50:1111 days ago1724795411IN
MEV Bot: 0xe14...cc2
0 ETH0.009587335.02833005
Execute206204652024-08-27 14:17:2311 days ago1724768243IN
MEV Bot: 0xe14...cc2
0 ETH0.00800524.59127537
Execute206193722024-08-27 10:38:1112 days ago1724755091IN
MEV Bot: 0xe14...cc2
0 ETH0.003077871.31756284
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
206966342024-09-07 5:29:1129 hrs ago1725686951
MEV Bot: 0xe14...cc2
0.00071219 ETH
206966192024-09-07 5:26:1129 hrs ago1725686771
MEV Bot: 0xe14...cc2
0.00081897 ETH
206940942024-09-06 20:59:1137 hrs ago1725656351
MEV Bot: 0xe14...cc2
0.01843824 ETH
206940802024-09-06 20:56:2337 hrs ago1725656183
MEV Bot: 0xe14...cc2
0.01984736 ETH
206940672024-09-06 20:53:4737 hrs ago1725656027
MEV Bot: 0xe14...cc2
0.01475795 ETH
206939942024-09-06 20:39:1138 hrs ago1725655151
MEV Bot: 0xe14...cc2
0.01269169 ETH
206939302024-09-06 20:26:2338 hrs ago1725654383
MEV Bot: 0xe14...cc2
0.01208056 ETH
206934072024-09-06 18:41:3539 hrs ago1725648095
MEV Bot: 0xe14...cc2
0.01346488 ETH
206930932024-09-06 17:38:2341 hrs ago1725644303
MEV Bot: 0xe14...cc2
0.02145174 ETH
206924102024-09-06 15:20:5943 hrs ago1725636059
MEV Bot: 0xe14...cc2
0.03058107 ETH
206863372024-09-05 19:00:112 days ago1725562811
MEV Bot: 0xe14...cc2
0.005895 ETH
206863332024-09-05 18:59:232 days ago1725562763
MEV Bot: 0xe14...cc2
0.00531905 ETH
206863332024-09-05 18:59:232 days ago1725562763
MEV Bot: 0xe14...cc2
0.00594953 ETH
206738212024-09-04 1:05:234 days ago1725411923
MEV Bot: 0xe14...cc2
0.02575663 ETH
206587652024-09-01 22:41:236 days ago1725230483
MEV Bot: 0xe14...cc2
0.00294154 ETH
206562612024-09-01 14:17:116 days ago1725200231
MEV Bot: 0xe14...cc2
0.00311346 ETH
206275542024-08-28 14:02:2310 days ago1724853743
MEV Bot: 0xe14...cc2
0.00614675 ETH
206228712024-08-27 22:20:3511 days ago1724797235
MEV Bot: 0xe14...cc2
0.03000048 ETH
206228552024-08-27 22:17:2311 days ago1724797043
MEV Bot: 0xe14...cc2
0.03897901 ETH
206227202024-08-27 21:50:1111 days ago1724795411
MEV Bot: 0xe14...cc2
0.01071629 ETH
206204652024-08-27 14:17:2311 days ago1724768243
MEV Bot: 0xe14...cc2
0.00887111 ETH
206193722024-08-27 10:38:1112 days ago1724755091
MEV Bot: 0xe14...cc2
0.0035104 ETH
206132032024-08-26 13:56:1112 days ago1724680571
MEV Bot: 0xe14...cc2
0.00659401 ETH
206088322024-08-25 23:17:1113 days ago1724627831
MEV Bot: 0xe14...cc2
0.00048762 ETH
206012942024-08-24 21:59:1114 days ago1724536751
MEV Bot: 0xe14...cc2
0.00334115 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AutomationExecutor

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 23 : AutomationExecutor.sol
// SPDX-License-Identifier: AGPL-3.0-or-later

/// AutomationExecutor.sol

// Copyright (C) 2023 Oazo Apps Limited

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.

pragma solidity ^0.8.0;

import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IWETH } from "./interfaces/IWETH.sol";
import { IAutomationBot } from "./interfaces/IAutomationBot.sol";
import { IServiceRegistry } from "./interfaces/IServiceRegistry.sol";

import { TickMath } from "@uniswap/v3-core/contracts/libraries/TickMath.sol";
import { IUniswapV3Factory } from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
import { IUniswapV3Pool } from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import {
    IV3SwapRouter
} from "@uniswap/swap-router-contracts/contracts/interfaces/IV3SwapRouter.sol";

contract AutomationExecutor {
    using SafeERC20 for ERC20;

    event CallerAdded(address indexed caller);
    event CallerRemoved(address indexed caller);
    string private constant UNISWAP_ROUTER_KEY = "UNISWAP_ROUTER";
    string private constant UNISWAP_FACTORY_KEY = "UNISWAP_FACTORY";

    IV3SwapRouter public immutable uniswapRouter;
    IUniswapV3Factory public immutable uniswapFactory;
    IAutomationBot public immutable bot;
    IWETH public immutable weth;
    address public owner;

    mapping(address => bool) public callers;

    constructor(IAutomationBot _bot, IWETH _weth, IServiceRegistry _serviceRegistry) {
        bot = _bot;
        weth = _weth;
        owner = msg.sender;
        callers[owner] = true;
        uniswapRouter = IV3SwapRouter(_serviceRegistry.getRegisteredService(UNISWAP_ROUTER_KEY));
        uniswapFactory = IUniswapV3Factory(
            _serviceRegistry.getRegisteredService(UNISWAP_FACTORY_KEY)
        );
        require(address(_bot) != address(0), "automation-executor/invalid-initialisation");
        require(address(_weth) != address(0), "automation-executor/invalid-initialisation");
        require(address(uniswapRouter) != address(0), "automation-executor/invalid-initialisation");
        require(
            address(uniswapFactory) != address(0),
            "automation-executor/invalid-initialisation"
        );
    }

    modifier onlyOwner() {
        require(msg.sender == owner, "executor/only-owner");
        _;
    }

    modifier auth(address caller) {
        require(callers[caller], "executor/not-authorized");
        _;
    }

    function transferOwnership(address newOwner) external onlyOwner {
        require(newOwner != address(0), "executor/invalid-new-owner");
        owner = newOwner;
    }

    function addCallers(address[] calldata _callers) external onlyOwner {
        uint256 length = _callers.length;
        for (uint256 i = 0; i < length; ++i) {
            address caller = _callers[i];
            require(!callers[caller], "executor/duplicate-whitelist");
            callers[caller] = true;
            emit CallerAdded(caller);
        }
    }

    function removeCallers(address[] calldata _callers) external onlyOwner {
        uint256 length = _callers.length;
        for (uint256 i = 0; i < length; ++i) {
            address caller = _callers[i];
            require(callers[caller], "executor/absent-caller");
            callers[caller] = false;
            emit CallerRemoved(caller);
        }
    }

    function execute(
        bytes calldata executionData,
        bytes calldata triggerData,
        address commandAddress,
        uint256 triggerId,
        uint256 txCoverage,
        uint256 minerBribe,
        int256 gasRefund,
        address coverageToken
    ) external auth(msg.sender) {
        require(gasRefund < 10 ** 12, "executor/gas-refund-too-high");

        uint256 initialGasAvailable = gasleft();
        bot.execute(
            executionData,
            triggerData,
            commandAddress,
            triggerId,
            txCoverage,
            coverageToken
        );

        if (minerBribe > 0) {
            block.coinbase.transfer(minerBribe);
        }
        uint256 finalGasAvailable = gasleft();
        uint256 etherUsed = tx.gasprice *
            uint256(int256(initialGasAvailable - finalGasAvailable) - gasRefund);

        payable(msg.sender).transfer(
            address(this).balance > etherUsed ? etherUsed : address(this).balance
        );
    }

    // token 1 / token0
    function getTick(
        address uniswapV3Pool,
        uint32 twapInterval
    ) private view returns (uint160 sqrtPriceX96) {
        if (twapInterval == 0) {
            // return the current price if twapInterval == 0
            (sqrtPriceX96, , , , , , ) = IUniswapV3Pool(uniswapV3Pool).slot0();
        } else {
            uint32[] memory secondsAgos = new uint32[](2);
            // past ---secondsAgo---> present
            secondsAgos[0] = 1 + twapInterval; // secondsAgo
            secondsAgos[1] = 1; // now

            (int56[] memory tickCumulatives, ) = IUniswapV3Pool(uniswapV3Pool).observe(secondsAgos);

            sqrtPriceX96 = TickMath.getSqrtRatioAtTick(
                int24((tickCumulatives[1] - tickCumulatives[0]) / int56(uint56(twapInterval)))
            );
        }
        return sqrtPriceX96;
    }

    function getPrice(
        address tokenIn,
        uint24[] memory fees
    ) public view returns (uint256 price, uint24 fee) {
        uint24 biggestPoolFee;
        IUniswapV3Pool biggestPool;
        uint256 highestPoolBalance;
        uint256 currentPoolBalance;
        for (uint8 i; i < fees.length; i++) {
            IUniswapV3Pool pool = IUniswapV3Pool(
                uniswapFactory.getPool(tokenIn, address(weth), fees[i])
            );
            currentPoolBalance = weth.balanceOf(address(pool));
            if (currentPoolBalance > highestPoolBalance) {
                biggestPoolFee = fees[i];
                biggestPool = pool;
                highestPoolBalance = currentPoolBalance;
            }
        }

        uint160 sqrtPriceX96 = getTick(address(biggestPool), 60);
        address token0 = biggestPool.token0();
        uint256 decimals = ERC20(tokenIn).decimals();

        if (token0 == tokenIn) {
            return (
                (uint256(sqrtPriceX96) * (uint256(sqrtPriceX96)) * (10 ** decimals)) / 2 ** 192,
                biggestPoolFee
            );
        } else {
            return (
                (((2 ** 192) * (10 ** decimals)) /
                    ((uint256(sqrtPriceX96) * (uint256(sqrtPriceX96))))),
                biggestPoolFee
            );
        }
    }

    function swapToEth(
        address tokenIn,
        uint256 amountIn,
        uint256 amountOutMin,
        uint24 fee
    ) external auth(msg.sender) returns (uint256) {
        require(
            amountIn > 0 && amountIn <= ERC20(tokenIn).balanceOf(address(this)),
            "executor/invalid-amount"
        );
        if (tokenIn == address(weth)) {
            weth.withdraw(amountIn);
            return amountIn;
        }
        ERC20(tokenIn).safeApprove(address(uniswapRouter), amountIn);

        bytes memory path = abi.encodePacked(tokenIn, uint24(fee), address(weth));

        IV3SwapRouter.ExactInputParams memory params = IV3SwapRouter.ExactInputParams({
            path: path,
            recipient: address(this),
            amountIn: amountIn,
            amountOutMinimum: amountOutMin
        });

        uint256 amount = uniswapRouter.exactInput(params);
        weth.withdraw(amount);
        return amount;
    }

    function withdraw(address asset, uint256 amount) external onlyOwner {
        if (asset == address(0)) {
            require(amount <= address(this).balance, "executor/invalid-amount");
            (bool sent, ) = payable(owner).call{ value: amount }("");
            require(sent, "executor/withdrawal-failed");
        } else {
            ERC20(asset).safeTransfer(owner, amount);
        }
    }

    function revokeAllowance(ERC20 token, address target) external onlyOwner {
        token.safeApprove(target, 0);
    }

    receive() external payable {}
}

File 2 of 23 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

File 3 of 23 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

File 4 of 23 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 5 of 23 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 6 of 23 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

    function safeIncreaseAllowance(
        IERC20 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(
        IERC20 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));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

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

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [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 functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

File 9 of 23 : IV3SwapRouter.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;

import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';

/// @title Router token swapping functionality
/// @notice Functions for swapping tokens via Uniswap V3
interface IV3SwapRouter is IUniswapV3SwapCallback {
    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another token
    /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,
    /// and swap the entire amount, enabling contracts to send tokens before calling this function.
    /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);

    struct ExactInputParams {
        bytes path;
        address recipient;
        uint256 amountIn;
        uint256 amountOutMinimum;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
    /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,
    /// and swap the entire amount, enabling contracts to send tokens before calling this function.
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);

    struct ExactOutputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 amountOut;
        uint256 amountInMaximum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another token
    /// that may remain in the router after the swap.
    /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);

    struct ExactOutputParams {
        bytes path;
        address recipient;
        uint256 amountOut;
        uint256 amountInMaximum;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
    /// that may remain in the router after the swap.
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}

File 10 of 23 : IUniswapV3SwapCallback.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Callback for IUniswapV3PoolActions#swap
/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface
interface IUniswapV3SwapCallback {
    /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
    /// @dev In the implementation you must pay the pool tokens owed for the swap.
    /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.
    /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.
    /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
    /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
    /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call
    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata data
    ) external;
}

File 11 of 23 : IUniswapV3Factory.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title The interface for the Uniswap V3 Factory
/// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees
interface IUniswapV3Factory {
    /// @notice Emitted when the owner of the factory is changed
    /// @param oldOwner The owner before the owner was changed
    /// @param newOwner The owner after the owner was changed
    event OwnerChanged(address indexed oldOwner, address indexed newOwner);

    /// @notice Emitted when a pool is created
    /// @param token0 The first token of the pool by address sort order
    /// @param token1 The second token of the pool by address sort order
    /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
    /// @param tickSpacing The minimum number of ticks between initialized ticks
    /// @param pool The address of the created pool
    event PoolCreated(
        address indexed token0,
        address indexed token1,
        uint24 indexed fee,
        int24 tickSpacing,
        address pool
    );

    /// @notice Emitted when a new fee amount is enabled for pool creation via the factory
    /// @param fee The enabled fee, denominated in hundredths of a bip
    /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee
    event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);

    /// @notice Returns the current owner of the factory
    /// @dev Can be changed by the current owner via setOwner
    /// @return The address of the factory owner
    function owner() external view returns (address);

    /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled
    /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context
    /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee
    /// @return The tick spacing
    function feeAmountTickSpacing(uint24 fee) external view returns (int24);

    /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist
    /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order
    /// @param tokenA The contract address of either token0 or token1
    /// @param tokenB The contract address of the other token
    /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
    /// @return pool The pool address
    function getPool(
        address tokenA,
        address tokenB,
        uint24 fee
    ) external view returns (address pool);

    /// @notice Creates a pool for the given two tokens and fee
    /// @param tokenA One of the two tokens in the desired pool
    /// @param tokenB The other of the two tokens in the desired pool
    /// @param fee The desired fee for the pool
    /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved
    /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments
    /// are invalid.
    /// @return pool The address of the newly created pool
    function createPool(
        address tokenA,
        address tokenB,
        uint24 fee
    ) external returns (address pool);

    /// @notice Updates the owner of the factory
    /// @dev Must be called by the current owner
    /// @param _owner The new owner of the factory
    function setOwner(address _owner) external;

    /// @notice Enables a fee amount with the given tickSpacing
    /// @dev Fee amounts may never be removed once enabled
    /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)
    /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount
    function enableFeeAmount(uint24 fee, int24 tickSpacing) external;
}

File 12 of 23 : IUniswapV3Pool.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import {IUniswapV3PoolImmutables} from './pool/IUniswapV3PoolImmutables.sol';
import {IUniswapV3PoolState} from './pool/IUniswapV3PoolState.sol';
import {IUniswapV3PoolDerivedState} from './pool/IUniswapV3PoolDerivedState.sol';
import {IUniswapV3PoolActions} from './pool/IUniswapV3PoolActions.sol';
import {IUniswapV3PoolOwnerActions} from './pool/IUniswapV3PoolOwnerActions.sol';
import {IUniswapV3PoolErrors} from './pool/IUniswapV3PoolErrors.sol';
import {IUniswapV3PoolEvents} from './pool/IUniswapV3PoolEvents.sol';

/// @title The interface for a Uniswap V3 Pool
/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform
/// to the ERC20 specification
/// @dev The pool interface is broken up into many smaller pieces
interface IUniswapV3Pool is
    IUniswapV3PoolImmutables,
    IUniswapV3PoolState,
    IUniswapV3PoolDerivedState,
    IUniswapV3PoolActions,
    IUniswapV3PoolOwnerActions,
    IUniswapV3PoolErrors,
    IUniswapV3PoolEvents
{

}

File 13 of 23 : IUniswapV3PoolActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissionless pool actions
/// @notice Contains pool methods that can be called by anyone
interface IUniswapV3PoolActions {
    /// @notice Sets the initial price for the pool
    /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
    /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
    function initialize(uint160 sqrtPriceX96) external;

    /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
    /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback
    /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
    /// on tickLower, tickUpper, the amount of liquidity, and the current price.
    /// @param recipient The address for which the liquidity will be created
    /// @param tickLower The lower tick of the position in which to add liquidity
    /// @param tickUpper The upper tick of the position in which to add liquidity
    /// @param amount The amount of liquidity to mint
    /// @param data Any data that should be passed through to the callback
    /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
    /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
    function mint(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount,
        bytes calldata data
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Collects tokens owed to a position
    /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.
    /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or
    /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the
    /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
    /// @param recipient The address which should receive the fees collected
    /// @param tickLower The lower tick of the position for which to collect fees
    /// @param tickUpper The upper tick of the position for which to collect fees
    /// @param amount0Requested How much token0 should be withdrawn from the fees owed
    /// @param amount1Requested How much token1 should be withdrawn from the fees owed
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);

    /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position
    /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0
    /// @dev Fees must be collected separately via a call to #collect
    /// @param tickLower The lower tick of the position for which to burn liquidity
    /// @param tickUpper The upper tick of the position for which to burn liquidity
    /// @param amount How much liquidity to burn
    /// @return amount0 The amount of token0 sent to the recipient
    /// @return amount1 The amount of token1 sent to the recipient
    function burn(
        int24 tickLower,
        int24 tickUpper,
        uint128 amount
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Swap token0 for token1, or token1 for token0
    /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
    /// @param recipient The address to receive the output of the swap
    /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
    /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
    /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
    /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
    /// @param data Any data to be passed through to the callback
    /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
    /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
    function swap(
        address recipient,
        bool zeroForOne,
        int256 amountSpecified,
        uint160 sqrtPriceLimitX96,
        bytes calldata data
    ) external returns (int256 amount0, int256 amount1);

    /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback
    /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback
    /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
    /// with 0 amount{0,1} and sending the donation amount(s) from the callback
    /// @param recipient The address which will receive the token0 and token1 amounts
    /// @param amount0 The amount of token0 to send
    /// @param amount1 The amount of token1 to send
    /// @param data Any data to be passed through to the callback
    function flash(
        address recipient,
        uint256 amount0,
        uint256 amount1,
        bytes calldata data
    ) external;

    /// @notice Increase the maximum number of price and liquidity observations that this pool will store
    /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
    /// the input observationCardinalityNext.
    /// @param observationCardinalityNext The desired minimum number of observations for the pool to store
    function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
}

File 14 of 23 : IUniswapV3PoolDerivedState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that is not stored
/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the
/// blockchain. The functions here may have variable gas costs.
interface IUniswapV3PoolDerivedState {
    /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
    /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
    /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
    /// you must call it with secondsAgos = [3600, 0].
    /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
    /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
    /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
    /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
    /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
    /// timestamp
    function observe(uint32[] calldata secondsAgos)
        external
        view
        returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);

    /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
    /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
    /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
    /// snapshot is taken and the second snapshot is taken.
    /// @param tickLower The lower tick of the range
    /// @param tickUpper The upper tick of the range
    /// @return tickCumulativeInside The snapshot of the tick accumulator for the range
    /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
    /// @return secondsInside The snapshot of seconds per liquidity for the range
    function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
        external
        view
        returns (
            int56 tickCumulativeInside,
            uint160 secondsPerLiquidityInsideX128,
            uint32 secondsInside
        );
}

File 15 of 23 : IUniswapV3PoolErrors.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Errors emitted by a pool
/// @notice Contains all events emitted by the pool
interface IUniswapV3PoolErrors {
    error LOK();
    error TLU();
    error TLM();
    error TUM();
    error AI();
    error M0();
    error M1();
    error AS();
    error IIA();
    error L();
    error F0();
    error F1();
}

File 16 of 23 : IUniswapV3PoolEvents.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Events emitted by a pool
/// @notice Contains all events emitted by the pool
interface IUniswapV3PoolEvents {
    /// @notice Emitted exactly once by a pool when #initialize is first called on the pool
    /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
    /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
    /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
    event Initialize(uint160 sqrtPriceX96, int24 tick);

    /// @notice Emitted when liquidity is minted for a given position
    /// @param sender The address that minted the liquidity
    /// @param owner The owner of the position and recipient of any minted liquidity
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity minted to the position range
    /// @param amount0 How much token0 was required for the minted liquidity
    /// @param amount1 How much token1 was required for the minted liquidity
    event Mint(
        address sender,
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted when fees are collected by the owner of a position
    /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees
    /// @param owner The owner of the position for which fees are collected
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount0 The amount of token0 fees collected
    /// @param amount1 The amount of token1 fees collected
    event Collect(
        address indexed owner,
        address recipient,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount0,
        uint128 amount1
    );

    /// @notice Emitted when a position's liquidity is removed
    /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect
    /// @param owner The owner of the position for which liquidity is removed
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity to remove
    /// @param amount0 The amount of token0 withdrawn
    /// @param amount1 The amount of token1 withdrawn
    event Burn(
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted by the pool for any swaps between token0 and token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the output of the swap
    /// @param amount0 The delta of the token0 balance of the pool
    /// @param amount1 The delta of the token1 balance of the pool
    /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
    /// @param liquidity The liquidity of the pool after the swap
    /// @param tick The log base 1.0001 of price of the pool after the swap
    event Swap(
        address indexed sender,
        address indexed recipient,
        int256 amount0,
        int256 amount1,
        uint160 sqrtPriceX96,
        uint128 liquidity,
        int24 tick
    );

    /// @notice Emitted by the pool for any flashes of token0/token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the tokens from flash
    /// @param amount0 The amount of token0 that was flashed
    /// @param amount1 The amount of token1 that was flashed
    /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee
    /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee
    event Flash(
        address indexed sender,
        address indexed recipient,
        uint256 amount0,
        uint256 amount1,
        uint256 paid0,
        uint256 paid1
    );

    /// @notice Emitted by the pool for increases to the number of observations that can be stored
    /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index
    /// just before a mint/swap/burn.
    /// @param observationCardinalityNextOld The previous value of the next observation cardinality
    /// @param observationCardinalityNextNew The updated value of the next observation cardinality
    event IncreaseObservationCardinalityNext(
        uint16 observationCardinalityNextOld,
        uint16 observationCardinalityNextNew
    );

    /// @notice Emitted when the protocol fee is changed by the pool
    /// @param feeProtocol0Old The previous value of the token0 protocol fee
    /// @param feeProtocol1Old The previous value of the token1 protocol fee
    /// @param feeProtocol0New The updated value of the token0 protocol fee
    /// @param feeProtocol1New The updated value of the token1 protocol fee
    event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);

    /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner
    /// @param sender The address that collects the protocol fees
    /// @param recipient The address that receives the collected protocol fees
    /// @param amount0 The amount of token0 protocol fees that is withdrawn
    /// @param amount0 The amount of token1 protocol fees that is withdrawn
    event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
}

File 17 of 23 : IUniswapV3PoolImmutables.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that never changes
/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
interface IUniswapV3PoolImmutables {
    /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
    /// @return The contract address
    function factory() external view returns (address);

    /// @notice The first of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token0() external view returns (address);

    /// @notice The second of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token1() external view returns (address);

    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
    /// @return The fee
    function fee() external view returns (uint24);

    /// @notice The pool tick spacing
    /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
    /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
    /// This value is an int24 to avoid casting even though it is always positive.
    /// @return The tick spacing
    function tickSpacing() external view returns (int24);

    /// @notice The maximum amount of position liquidity that can use any tick in the range
    /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
    /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
    /// @return The max amount of liquidity per tick
    function maxLiquidityPerTick() external view returns (uint128);
}

File 18 of 23 : IUniswapV3PoolOwnerActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissioned pool actions
/// @notice Contains pool methods that may only be called by the factory owner
interface IUniswapV3PoolOwnerActions {
    /// @notice Set the denominator of the protocol's % share of the fees
    /// @param feeProtocol0 new protocol fee for token0 of the pool
    /// @param feeProtocol1 new protocol fee for token1 of the pool
    function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;

    /// @notice Collect the protocol fee accrued to the pool
    /// @param recipient The address to which collected protocol fees should be sent
    /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1
    /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0
    /// @return amount0 The protocol fee collected in token0
    /// @return amount1 The protocol fee collected in token1
    function collectProtocol(
        address recipient,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);
}

File 19 of 23 : IUniswapV3PoolState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that can change
/// @notice These methods compose the pool's state, and can change with any frequency including multiple times
/// per transaction
interface IUniswapV3PoolState {
    /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
    /// when accessed externally.
    /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
    /// @return tick The current tick of the pool, i.e. according to the last tick transition that was run.
    /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
    /// boundary.
    /// @return observationIndex The index of the last oracle observation that was written,
    /// @return observationCardinality The current maximum number of observations stored in the pool,
    /// @return observationCardinalityNext The next maximum number of observations, to be updated when the observation.
    /// @return feeProtocol The protocol fee for both tokens of the pool.
    /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
    /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
    /// unlocked Whether the pool is currently locked to reentrancy
    function slot0()
        external
        view
        returns (
            uint160 sqrtPriceX96,
            int24 tick,
            uint16 observationIndex,
            uint16 observationCardinality,
            uint16 observationCardinalityNext,
            uint8 feeProtocol,
            bool unlocked
        );

    /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal0X128() external view returns (uint256);

    /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal1X128() external view returns (uint256);

    /// @notice The amounts of token0 and token1 that are owed to the protocol
    /// @dev Protocol fees will never exceed uint128 max in either token
    function protocolFees() external view returns (uint128 token0, uint128 token1);

    /// @notice The currently in range liquidity available to the pool
    /// @dev This value has no relationship to the total liquidity across all ticks
    /// @return The liquidity at the current price of the pool
    function liquidity() external view returns (uint128);

    /// @notice Look up information about a specific tick in the pool
    /// @param tick The tick to look up
    /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or
    /// tick upper
    /// @return liquidityNet how much liquidity changes when the pool price crosses the tick,
    /// @return feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
    /// @return feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
    /// @return tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
    /// @return secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
    /// @return secondsOutside the seconds spent on the other side of the tick from the current tick,
    /// @return initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.
    /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.
    /// In addition, these values are only relative and must be used only in comparison to previous snapshots for
    /// a specific position.
    function ticks(int24 tick)
        external
        view
        returns (
            uint128 liquidityGross,
            int128 liquidityNet,
            uint256 feeGrowthOutside0X128,
            uint256 feeGrowthOutside1X128,
            int56 tickCumulativeOutside,
            uint160 secondsPerLiquidityOutsideX128,
            uint32 secondsOutside,
            bool initialized
        );

    /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information
    function tickBitmap(int16 wordPosition) external view returns (uint256);

    /// @notice Returns the information about a position by the position's key
    /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper
    /// @return liquidity The amount of liquidity in the position,
    /// @return feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
    /// @return feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
    /// @return tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
    /// @return tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke
    function positions(bytes32 key)
        external
        view
        returns (
            uint128 liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    /// @notice Returns data about a specific observation index
    /// @param index The element of the observations array to fetch
    /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time
    /// ago, rather than at a specific index in the array.
    /// @return blockTimestamp The timestamp of the observation,
    /// @return tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
    /// @return secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
    /// @return initialized whether the observation has been initialized and the values are safe to use
    function observations(uint256 index)
        external
        view
        returns (
            uint32 blockTimestamp,
            int56 tickCumulative,
            uint160 secondsPerLiquidityCumulativeX128,
            bool initialized
        );
}

File 20 of 23 : TickMath.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

/// @title Math library for computing sqrt prices from ticks and vice versa
/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports
/// prices between 2**-128 and 2**128
library TickMath {
    error T();
    error R();

    /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
    int24 internal constant MIN_TICK = -887272;
    /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128
    int24 internal constant MAX_TICK = -MIN_TICK;

    /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
    uint160 internal constant MIN_SQRT_RATIO = 4295128739;
    /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
    uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;

    /// @notice Calculates sqrt(1.0001^tick) * 2^96
    /// @dev Throws if |tick| > max tick
    /// @param tick The input tick for the above formula
    /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)
    /// at the given tick
    function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
        unchecked {
            uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
            if (absTick > uint256(int256(MAX_TICK))) revert T();

            uint256 ratio = absTick & 0x1 != 0
                ? 0xfffcb933bd6fad37aa2d162d1a594001
                : 0x100000000000000000000000000000000;
            if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
            if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
            if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
            if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;
            if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
            if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
            if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
            if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
            if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
            if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
            if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
            if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
            if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
            if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
            if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;
            if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
            if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;
            if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;
            if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;

            if (tick > 0) ratio = type(uint256).max / ratio;

            // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.
            // we then downcast because we know the result always fits within 160 bits due to our tick input constraint
            // we round up in the division so getTickAtSqrtRatio of the output price is always consistent
            sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
        }
    }

    /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio
    /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may
    /// ever return.
    /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96
    /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio
    function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {
        unchecked {
            // second inequality must be < because the price can never reach the price at the max tick
            if (!(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO)) revert R();
            uint256 ratio = uint256(sqrtPriceX96) << 32;

            uint256 r = ratio;
            uint256 msb = 0;

            assembly {
                let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(5, gt(r, 0xFFFFFFFF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(4, gt(r, 0xFFFF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(3, gt(r, 0xFF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(2, gt(r, 0xF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(1, gt(r, 0x3))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := gt(r, 0x1)
                msb := or(msb, f)
            }

            if (msb >= 128) r = ratio >> (msb - 127);
            else r = ratio << (127 - msb);

            int256 log_2 = (int256(msb) - 128) << 64;

            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(63, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(62, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(61, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(60, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(59, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(58, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(57, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(56, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(55, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(54, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(53, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(52, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(51, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(50, f))
            }

            int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number

            int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);
            int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);

            tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;
        }
    }
}

File 21 of 23 : IAutomationBot.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.0;

interface IAutomationBot {
    function addRecord(
        uint256 triggerType,
        bool continuous,
        uint256 replacedTriggerId,
        bytes memory triggerData,
        bytes memory replacedTriggerData
    ) external;

    function removeRecord(
        // This function should be executed allways in a context of AutomationBot address not DsProxy,
        //msg.sender should be dsProxy
        bytes memory triggersData,
        uint256 triggerId
    ) external;

    function execute(
        bytes calldata executionData,
        bytes calldata triggerData,
        address commandAddress,
        uint256 triggerId,
        uint256 coverageAmount,
        address coverageToken
    ) external;
}

File 22 of 23 : IServiceRegistry.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.13;

interface IServiceRegistry {
    function getRegisteredService(string memory) external view returns (address);

    function getServiceAddress(bytes32 serviceNameHash) external view returns (address);
}

File 23 of 23 : IWETH.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.0;

interface IWETH {
    function withdraw(uint256 wad) external;

    function deposit() external payable;

    function balanceOf(address owner) external view returns (uint256);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IAutomationBot","name":"_bot","type":"address"},{"internalType":"contract IWETH","name":"_weth","type":"address"},{"internalType":"contract IServiceRegistry","name":"_serviceRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"T","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"CallerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"CallerRemoved","type":"event"},{"inputs":[{"internalType":"address[]","name":"_callers","type":"address[]"}],"name":"addCallers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bot","outputs":[{"internalType":"contract IAutomationBot","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"callers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"executionData","type":"bytes"},{"internalType":"bytes","name":"triggerData","type":"bytes"},{"internalType":"address","name":"commandAddress","type":"address"},{"internalType":"uint256","name":"triggerId","type":"uint256"},{"internalType":"uint256","name":"txCoverage","type":"uint256"},{"internalType":"uint256","name":"minerBribe","type":"uint256"},{"internalType":"int256","name":"gasRefund","type":"int256"},{"internalType":"address","name":"coverageToken","type":"address"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint24[]","name":"fees","type":"uint24[]"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint24","name":"fee","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_callers","type":"address[]"}],"name":"removeCallers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ERC20","name":"token","type":"address"},{"internalType":"address","name":"target","type":"address"}],"name":"revokeAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint24","name":"fee","type":"uint24"}],"name":"swapToEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniswapFactory","outputs":[{"internalType":"contract IUniswapV3Factory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapRouter","outputs":[{"internalType":"contract IV3SwapRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101006040523480156200001257600080fd5b5060405162002b3738038062002b37833981016040819052620000359162000337565b6001600160a01b0380841660c05282811660e052600080546001600160a01b031916339081178255815260016020818152604092839020805460ff191690921790915581518083018352600e81526d2aa724a9aba0a82fa927aaaa22a960911b918101919091529051630851f3bd60e01b815291831691630851f3bd91620000c0916004016200038b565b602060405180830381865afa158015620000de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001049190620003e3565b6001600160a01b03908116608052604080518082018252600f81526e554e49535741505f464143544f525960881b60208201529051630851f3bd60e01b815291831691630851f3bd916200015b916004016200038b565b602060405180830381865afa15801562000179573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200019f9190620003e3565b6001600160a01b0390811660a0528316620002035760405162461bcd60e51b815260206004820152602a602482015260008051602062002b1783398151915260448201526934b0b634b9b0ba34b7b760b11b60648201526084015b60405180910390fd5b6001600160a01b0382166200025d5760405162461bcd60e51b815260206004820152602a602482015260008051602062002b1783398151915260448201526934b0b634b9b0ba34b7b760b11b6064820152608401620001fa565b6080516001600160a01b0316620002b95760405162461bcd60e51b815260206004820152602a602482015260008051602062002b1783398151915260448201526934b0b634b9b0ba34b7b760b11b6064820152608401620001fa565b60a0516001600160a01b0316620003155760405162461bcd60e51b815260206004820152602a602482015260008051602062002b1783398151915260448201526934b0b634b9b0ba34b7b760b11b6064820152608401620001fa565b5050506200040a565b6001600160a01b03811681146200033457600080fd5b50565b6000806000606084860312156200034d57600080fd5b83516200035a816200031e565b60208501519093506200036d816200031e565b604085015190925062000380816200031e565b809150509250925092565b600060208083528351808285015260005b81811015620003ba578581018301518582016040015282016200039c565b81811115620003cd576000604083870101525b50601f01601f1916929092016040019392505050565b600060208284031215620003f657600080fd5b815162000403816200031e565b9392505050565b60805160a05160c05160e05161268d6200048a600039600081816101b7015281816103af015281816104a3015281816107f20152818161083f0152818161092b0152610a4101526000818161013d0152610d530152600081816102a1015261037f01526000818161020d015281816108ba01526109a8015261268d6000f3fe6080604052600436106100e15760003560e01c80637bbf4a3f1161007f578063eee8a3b111610059578063eee8a3b1146102e3578063f2fde38b14610303578063f3fef3a314610323578063fbe9e7511461034357600080fd5b80637bbf4a3f1461024f5780638bdb2afa1461028f5780638da5cb5b146102c357600080fd5b80633fc8cef3116100bb5780633fc8cef3146101a55780635e42f10e146101d9578063735de9f7146101fb5780637ae267731461022f57600080fd5b806305b80b07146100ed57806310814c371461012b5780633daab0111461017757600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b5061010d610108366004611c71565b610363565b6040805192835262ffffff9091166020830152015b60405180910390f35b34801561013757600080fd5b5061015f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610122565b34801561018357600080fd5b50610197610192366004611d23565b6106c6565b604051908152602001610122565b3480156101b157600080fd5b5061015f7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101e557600080fd5b506101f96101f4366004611d6b565b610ab4565b005b34801561020757600080fd5b5061015f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561023b57600080fd5b506101f961024a366004611de0565b610c01565b34801561025b57600080fd5b5061027f61026a366004611e19565b60016020526000908152604090205460ff1681565b6040519015158152602001610122565b34801561029b57600080fd5b5061015f7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102cf57600080fd5b5060005461015f906001600160a01b031681565b3480156102ef57600080fd5b506101f96102fe366004611e7f565b610c6a565b34801561030f57600080fd5b506101f961031e366004611e19565b610e74565b34801561032f57600080fd5b506101f961033e366004611f3c565b610f54565b34801561034f57600080fd5b506101f961035e366004611d6b565b6110c4565b60008060008060008060005b87518160ff1610156105535760007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631698ee828b7f00000000000000000000000000000000000000000000000000000000000000008c8660ff16815181106103e3576103e3611f68565b60209081029190910101516040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b03938416600482015292909116602483015262ffffff166044820152606401602060405180830381865afa15801561045d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104819190611f7e565b6040516370a0823160e01b81526001600160a01b0380831660048301529192507f0000000000000000000000000000000000000000000000000000000000000000909116906370a0823190602401602060405180830381865afa1580156104ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105109190611f9b565b92508383111561054057888260ff168151811061052f5761052f611f68565b602002602001015195508094508293505b508061054b81611fca565b91505061036f565b50600061056184603c611212565b90506000846001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c79190611f7e565b905060008a6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062d9190611ffa565b60ff1690508a6001600160a01b0316826001600160a01b03160361069357600160c01b61065b82600a6120f9565b61066e6001600160a01b03861680612105565b6106789190612105565b610682919061213a565b8798509850505050505050506106bf565b6106a66001600160a01b03841680612105565b6106b182600a6120f9565b61067890600160c01b612105565b9250929050565b3360008181526001602052604081205490919060ff1661072d5760405162461bcd60e51b815260206004820152601760248201527f6578656375746f722f6e6f742d617574686f72697a656400000000000000000060448201526064015b60405180910390fd5b6000851180156107a457506040516370a0823160e01b81523060048201526001600160a01b038716906370a0823190602401602060405180830381865afa15801561077c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a09190611f9b565b8511155b6107f05760405162461bcd60e51b815260206004820152601760248201527f6578656375746f722f696e76616c69642d616d6f756e740000000000000000006044820152606401610724565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316866001600160a01b0316036108ab57604051632e1a7d4d60e01b8152600481018690527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561088b57600080fd5b505af115801561089f573d6000803e3d6000fd5b50505050849150610aab565b6108df6001600160a01b0387167f00000000000000000000000000000000000000000000000000000000000000008761140a565b604080516bffffffffffffffffffffffff19606089811b821660208401527fffffff000000000000000000000000000000000000000000000000000000000060e888901b1660348401527f0000000000000000000000000000000000000000000000000000000000000000901b1660378201528151808203602b01815260cb82018352604b820181815230606b840152608b830189905260ab90920187905291517fb858183f0000000000000000000000000000000000000000000000000000000081526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063b858183f906109e59085906004016121a6565b6020604051808303816000875af1158015610a04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a289190611f9b565b604051632e1a7d4d60e01b8152600481018290529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015610a8d57600080fd5b505af1158015610aa1573d6000803e3d6000fd5b5092965050505050505b50949350505050565b6000546001600160a01b03163314610b045760405162461bcd60e51b815260206004820152601360248201527232bc32b1baba37b917b7b7363c96b7bbb732b960691b6044820152606401610724565b8060005b81811015610bfb576000848483818110610b2457610b24611f68565b9050602002016020810190610b399190611e19565b6001600160a01b03811660009081526001602052604090205490915060ff16610ba45760405162461bcd60e51b815260206004820152601660248201527f6578656375746f722f616273656e742d63616c6c6572000000000000000000006044820152606401610724565b6001600160a01b038116600081815260016020526040808220805460ff19169055517f50c35a67b454d38c20800d5b55e320f58f4c9c86a28d8ab20f03045d1a38d99a9190a250610bf4816121f5565b9050610b08565b50505050565b6000546001600160a01b03163314610c515760405162461bcd60e51b815260206004820152601360248201527232bc32b1baba37b917b7b7363c96b7bbb732b960691b6044820152606401610724565b610c666001600160a01b03831682600061140a565b5050565b3360008181526001602052604090205460ff16610cc95760405162461bcd60e51b815260206004820152601760248201527f6578656375746f722f6e6f742d617574686f72697a65640000000000000000006044820152606401610724565b64e8d4a510008312610d1d5760405162461bcd60e51b815260206004820152601c60248201527f6578656375746f722f6761732d726566756e642d746f6f2d68696768000000006044820152606401610724565b60005a6040517f083035340000000000000000000000000000000000000000000000000000000081529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630830353490610d96908f908f908f908f908f908f908f908d90600401612237565b600060405180830381600087803b158015610db057600080fd5b505af1158015610dc4573d6000803e3d6000fd5b505050506000851115610e0057604051419086156108fc029087906000818181858888f19350505050158015610dfe573d6000803e3d6000fd5b505b60005a9050600085610e128385612293565b610e1c91906122aa565b610e26903a612105565b9050336108fc478310610e395747610e3b565b825b6040518115909202916000818181858888f19350505050158015610e63573d6000803e3d6000fd5b505050505050505050505050505050565b6000546001600160a01b03163314610ec45760405162461bcd60e51b815260206004820152601360248201527232bc32b1baba37b917b7b7363c96b7bbb732b960691b6044820152606401610724565b6001600160a01b038116610f1a5760405162461bcd60e51b815260206004820152601a60248201527f6578656375746f722f696e76616c69642d6e65772d6f776e65720000000000006044820152606401610724565b600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610fa45760405162461bcd60e51b815260206004820152601360248201527232bc32b1baba37b917b7b7363c96b7bbb732b960691b6044820152606401610724565b6001600160a01b0382166110aa57478111156110025760405162461bcd60e51b815260206004820152601760248201527f6578656375746f722f696e76616c69642d616d6f756e740000000000000000006044820152606401610724565b600080546040516001600160a01b039091169083908381818185875af1925050503d806000811461104f576040519150601f19603f3d011682016040523d82523d6000602084013e611054565b606091505b50509050806110a55760405162461bcd60e51b815260206004820152601a60248201527f6578656375746f722f7769746864726177616c2d6661696c65640000000000006044820152606401610724565b505050565b600054610c66906001600160a01b038481169116836115b8565b6000546001600160a01b031633146111145760405162461bcd60e51b815260206004820152601360248201527232bc32b1baba37b917b7b7363c96b7bbb732b960691b6044820152606401610724565b8060005b81811015610bfb57600084848381811061113457611134611f68565b90506020020160208101906111499190611e19565b6001600160a01b03811660009081526001602052604090205490915060ff16156111b55760405162461bcd60e51b815260206004820152601c60248201527f6578656375746f722f6475706c69636174652d77686974656c697374000000006044820152606401610724565b6001600160a01b0381166000818152600160208190526040808320805460ff1916909217909155517ff7762e85af7b409451f9a76004c5f755642902434eb11351ae67eb9746888b699190a25061120b816121f5565b9050611118565b60008163ffffffff1660000361129357826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015611260573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112849190612340565b50949550611404945050505050565b6040805160028082526060820183526000926020830190803683370190505090506112bf8360016123d2565b816000815181106112d2576112d2611f68565b602002602001019063ffffffff16908163ffffffff168152505060018160018151811061130157611301611f68565b63ffffffff909216602092830291909101909101526040517f883bdbfd0000000000000000000000000000000000000000000000000000000081526000906001600160a01b0386169063883bdbfd9061135e9085906004016123fa565b600060405180830381865afa15801561137b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113a391908101906124b3565b5090506113ff8463ffffffff16826000815181106113c3576113c3611f68565b6020026020010151836001815181106113de576113de611f68565b60200260200101516113f0919061257f565b6113fa91906125cf565b611601565b925050505b92915050565b80158061149d57506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611477573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149b9190611f9b565b155b61150f5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610724565b6040516001600160a01b0383166024820152604481018290526110a59084907f095ea7b300000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261194a565b6040516001600160a01b0383166024820152604481018290526110a59084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611554565b60008060008360020b12611618578260020b611620565b8260020b6000035b9050620d89e881111561165f576040517f2bc80f3a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008160011660000361168357700100000000000000000000000000000000611695565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff16905060028216156116c9576ffff97272373d413259a46990580e213a0260801c5b60048216156116e8576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615611707576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615611726576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615611745576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615611764576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615611783576ffe5dee046a99a2a811c461f1969c30530260801c5b6101008216156117a3576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b6102008216156117c3576ff987a7253ac413176f2b074cf7815e540260801c5b6104008216156117e3576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615611803576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615611823576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615611843576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615611863576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615611883576f31be135f97d08fd981231505542fcfa60260801c5b620100008216156118a4576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b620200008216156118c4576e5d6af8dedb81196699c329225ee6040260801c5b620400008216156118e3576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615611900576b048a170391f7dc42444e8fa20260801c5b60008460020b131561192157806000198161191d5761191d612124565b0490505b640100000000810615611935576001611938565b60005b60ff16602082901c0192505050919050565b600061199f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611a2f9092919063ffffffff16565b8051909150156110a557808060200190518101906119bd919061260d565b6110a55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610724565b6060611a3e8484600085611a46565b949350505050565b606082471015611abe5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610724565b600080866001600160a01b03168587604051611ada9190612628565b60006040518083038185875af1925050503d8060008114611b17576040519150601f19603f3d011682016040523d82523d6000602084013e611b1c565b606091505b5091509150611b2d87838387611b38565b979650505050505050565b60608315611ba7578251600003611ba0576001600160a01b0385163b611ba05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610724565b5081611a3e565b611a3e8383815115611bbc5781518083602001fd5b8060405162461bcd60e51b81526004016107249190612644565b6001600160a01b0381168114611beb57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611c2d57611c2d611bee565b604052919050565b600067ffffffffffffffff821115611c4f57611c4f611bee565b5060051b60200190565b803562ffffff81168114611c6c57600080fd5b919050565b60008060408385031215611c8457600080fd5b8235611c8f81611bd6565b915060208381013567ffffffffffffffff811115611cac57600080fd5b8401601f81018613611cbd57600080fd5b8035611cd0611ccb82611c35565b611c04565b81815260059190911b82018301908381019088831115611cef57600080fd5b928401925b82841015611d1457611d0584611c59565b82529284019290840190611cf4565b80955050505050509250929050565b60008060008060808587031215611d3957600080fd5b8435611d4481611bd6565b93506020850135925060408501359150611d6060608601611c59565b905092959194509250565b60008060208385031215611d7e57600080fd5b823567ffffffffffffffff80821115611d9657600080fd5b818501915085601f830112611daa57600080fd5b813581811115611db957600080fd5b8660208260051b8501011115611dce57600080fd5b60209290920196919550909350505050565b60008060408385031215611df357600080fd5b8235611dfe81611bd6565b91506020830135611e0e81611bd6565b809150509250929050565b600060208284031215611e2b57600080fd5b8135611e3681611bd6565b9392505050565b60008083601f840112611e4f57600080fd5b50813567ffffffffffffffff811115611e6757600080fd5b6020830191508360208285010111156106bf57600080fd5b6000806000806000806000806000806101008b8d031215611e9f57600080fd5b8a3567ffffffffffffffff80821115611eb757600080fd5b611ec38e838f01611e3d565b909c509a5060208d0135915080821115611edc57600080fd5b50611ee98d828e01611e3d565b90995097505060408b0135611efd81611bd6565b955060608b0135945060808b0135935060a08b0135925060c08b0135915060e08b0135611f2981611bd6565b809150509295989b9194979a5092959850565b60008060408385031215611f4f57600080fd5b8235611f5a81611bd6565b946020939093013593505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611f9057600080fd5b8151611e3681611bd6565b600060208284031215611fad57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff8103611fe057611fe0611fb4565b60010192915050565b805160ff81168114611c6c57600080fd5b60006020828403121561200c57600080fd5b611e3682611fe9565b600181815b8085111561205057816000190482111561203657612036611fb4565b8085161561204357918102915b93841c939080029061201a565b509250929050565b60008261206757506001611404565b8161207457506000611404565b816001811461208a5760028114612094576120b0565b6001915050611404565b60ff8411156120a5576120a5611fb4565b50506001821b611404565b5060208310610133831016604e8410600b84101617156120d3575081810a611404565b6120dd8383612015565b80600019048211156120f1576120f1611fb4565b029392505050565b6000611e368383612058565b600081600019048311821515161561211f5761211f611fb4565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261214957612149612124565b500490565b60005b83811015612169578181015183820152602001612151565b83811115610bfb5750506000910152565b6000815180845261219281602086016020860161214e565b601f01601f19169290920160200192915050565b6020815260008251608060208401526121c260a084018261217a565b90506001600160a01b03602085015116604084015260408401516060840152606084015160808401528091505092915050565b60006001820161220757612207611fb4565b5060010190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60c08152600061224b60c083018a8c61220e565b828103602084015261225e81898b61220e565b9150506001600160a01b03808716604084015285606084015284608084015280841660a0840152509998505050505050505050565b6000828210156122a5576122a5611fb4565b500390565b6000808312837f8000000000000000000000000000000000000000000000000000000000000000018312811516156122e4576122e4611fb4565b837f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01831381161561231857612318611fb4565b50500390565b805161ffff81168114611c6c57600080fd5b80518015158114611c6c57600080fd5b600080600080600080600060e0888a03121561235b57600080fd5b875161236681611bd6565b8097505060208801518060020b811461237e57600080fd5b955061238c6040890161231e565b945061239a6060890161231e565b93506123a86080890161231e565b92506123b660a08901611fe9565b91506123c460c08901612330565b905092959891949750929550565b600063ffffffff8083168185168083038211156123f1576123f1611fb4565b01949350505050565b6020808252825182820181905260009190848201906040850190845b8181101561243857835163ffffffff1683529284019291840191600101612416565b50909695505050505050565b600082601f83011261245557600080fd5b81516020612465611ccb83611c35565b82815260059290921b8401810191818101908684111561248457600080fd5b8286015b848110156124a857805161249b81611bd6565b8352918301918301612488565b509695505050505050565b600080604083850312156124c657600080fd5b825167ffffffffffffffff808211156124de57600080fd5b818501915085601f8301126124f257600080fd5b81516020612502611ccb83611c35565b82815260059290921b8401810191818101908984111561252157600080fd5b948201945b8386101561254f5785518060060b81146125405760008081fd5b82529482019490820190612526565b9188015191965090935050508082111561256857600080fd5b5061257585828601612444565b9150509250929050565b60008160060b8360060b6000811281667fffffffffffff19018312811516156125aa576125aa611fb4565b81667fffffffffffff0183138116156125c5576125c5611fb4565b5090039392505050565b60008160060b8360060b806125e6576125e6612124565b667fffffffffffff1982146000198214161561260457612604611fb4565b90059392505050565b60006020828403121561261f57600080fd5b611e3682612330565b6000825161263a81846020870161214e565b9190910192915050565b602081526000611e36602083018461217a56fea2646970667358221220ef413727bf87e20cbf6029023ff0e679a3b468d7bbc627d69c5f02994d7da87664736f6c634300080d00336175746f6d6174696f6e2d6578656375746f722f696e76616c69642d696e69740000000000000000000000005743b5606e94fb534a31e1cefb3242c8a9422e5e000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000005e81a7515f956ab642eb698821a449fe8fe7498e

Deployed Bytecode

0x6080604052600436106100e15760003560e01c80637bbf4a3f1161007f578063eee8a3b111610059578063eee8a3b1146102e3578063f2fde38b14610303578063f3fef3a314610323578063fbe9e7511461034357600080fd5b80637bbf4a3f1461024f5780638bdb2afa1461028f5780638da5cb5b146102c357600080fd5b80633fc8cef3116100bb5780633fc8cef3146101a55780635e42f10e146101d9578063735de9f7146101fb5780637ae267731461022f57600080fd5b806305b80b07146100ed57806310814c371461012b5780633daab0111461017757600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b5061010d610108366004611c71565b610363565b6040805192835262ffffff9091166020830152015b60405180910390f35b34801561013757600080fd5b5061015f7f0000000000000000000000005743b5606e94fb534a31e1cefb3242c8a9422e5e81565b6040516001600160a01b039091168152602001610122565b34801561018357600080fd5b50610197610192366004611d23565b6106c6565b604051908152602001610122565b3480156101b157600080fd5b5061015f7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b3480156101e557600080fd5b506101f96101f4366004611d6b565b610ab4565b005b34801561020757600080fd5b5061015f7f00000000000000000000000068b3465833fb72a70ecdf485e0e4c7bd8665fc4581565b34801561023b57600080fd5b506101f961024a366004611de0565b610c01565b34801561025b57600080fd5b5061027f61026a366004611e19565b60016020526000908152604090205460ff1681565b6040519015158152602001610122565b34801561029b57600080fd5b5061015f7f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f98481565b3480156102cf57600080fd5b5060005461015f906001600160a01b031681565b3480156102ef57600080fd5b506101f96102fe366004611e7f565b610c6a565b34801561030f57600080fd5b506101f961031e366004611e19565b610e74565b34801561032f57600080fd5b506101f961033e366004611f3c565b610f54565b34801561034f57600080fd5b506101f961035e366004611d6b565b6110c4565b60008060008060008060005b87518160ff1610156105535760007f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f9846001600160a01b0316631698ee828b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28c8660ff16815181106103e3576103e3611f68565b60209081029190910101516040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b03938416600482015292909116602483015262ffffff166044820152606401602060405180830381865afa15801561045d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104819190611f7e565b6040516370a0823160e01b81526001600160a01b0380831660048301529192507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2909116906370a0823190602401602060405180830381865afa1580156104ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105109190611f9b565b92508383111561054057888260ff168151811061052f5761052f611f68565b602002602001015195508094508293505b508061054b81611fca565b91505061036f565b50600061056184603c611212565b90506000846001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c79190611f7e565b905060008a6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062d9190611ffa565b60ff1690508a6001600160a01b0316826001600160a01b03160361069357600160c01b61065b82600a6120f9565b61066e6001600160a01b03861680612105565b6106789190612105565b610682919061213a565b8798509850505050505050506106bf565b6106a66001600160a01b03841680612105565b6106b182600a6120f9565b61067890600160c01b612105565b9250929050565b3360008181526001602052604081205490919060ff1661072d5760405162461bcd60e51b815260206004820152601760248201527f6578656375746f722f6e6f742d617574686f72697a656400000000000000000060448201526064015b60405180910390fd5b6000851180156107a457506040516370a0823160e01b81523060048201526001600160a01b038716906370a0823190602401602060405180830381865afa15801561077c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a09190611f9b565b8511155b6107f05760405162461bcd60e51b815260206004820152601760248201527f6578656375746f722f696e76616c69642d616d6f756e740000000000000000006044820152606401610724565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316866001600160a01b0316036108ab57604051632e1a7d4d60e01b8152600481018690527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561088b57600080fd5b505af115801561089f573d6000803e3d6000fd5b50505050849150610aab565b6108df6001600160a01b0387167f00000000000000000000000068b3465833fb72a70ecdf485e0e4c7bd8665fc458761140a565b604080516bffffffffffffffffffffffff19606089811b821660208401527fffffff000000000000000000000000000000000000000000000000000000000060e888901b1660348401527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2901b1660378201528151808203602b01815260cb82018352604b820181815230606b840152608b830189905260ab90920187905291517fb858183f0000000000000000000000000000000000000000000000000000000081526000907f00000000000000000000000068b3465833fb72a70ecdf485e0e4c7bd8665fc456001600160a01b03169063b858183f906109e59085906004016121a6565b6020604051808303816000875af1158015610a04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a289190611f9b565b604051632e1a7d4d60e01b8152600481018290529091507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015610a8d57600080fd5b505af1158015610aa1573d6000803e3d6000fd5b5092965050505050505b50949350505050565b6000546001600160a01b03163314610b045760405162461bcd60e51b815260206004820152601360248201527232bc32b1baba37b917b7b7363c96b7bbb732b960691b6044820152606401610724565b8060005b81811015610bfb576000848483818110610b2457610b24611f68565b9050602002016020810190610b399190611e19565b6001600160a01b03811660009081526001602052604090205490915060ff16610ba45760405162461bcd60e51b815260206004820152601660248201527f6578656375746f722f616273656e742d63616c6c6572000000000000000000006044820152606401610724565b6001600160a01b038116600081815260016020526040808220805460ff19169055517f50c35a67b454d38c20800d5b55e320f58f4c9c86a28d8ab20f03045d1a38d99a9190a250610bf4816121f5565b9050610b08565b50505050565b6000546001600160a01b03163314610c515760405162461bcd60e51b815260206004820152601360248201527232bc32b1baba37b917b7b7363c96b7bbb732b960691b6044820152606401610724565b610c666001600160a01b03831682600061140a565b5050565b3360008181526001602052604090205460ff16610cc95760405162461bcd60e51b815260206004820152601760248201527f6578656375746f722f6e6f742d617574686f72697a65640000000000000000006044820152606401610724565b64e8d4a510008312610d1d5760405162461bcd60e51b815260206004820152601c60248201527f6578656375746f722f6761732d726566756e642d746f6f2d68696768000000006044820152606401610724565b60005a6040517f083035340000000000000000000000000000000000000000000000000000000081529091506001600160a01b037f0000000000000000000000005743b5606e94fb534a31e1cefb3242c8a9422e5e1690630830353490610d96908f908f908f908f908f908f908f908d90600401612237565b600060405180830381600087803b158015610db057600080fd5b505af1158015610dc4573d6000803e3d6000fd5b505050506000851115610e0057604051419086156108fc029087906000818181858888f19350505050158015610dfe573d6000803e3d6000fd5b505b60005a9050600085610e128385612293565b610e1c91906122aa565b610e26903a612105565b9050336108fc478310610e395747610e3b565b825b6040518115909202916000818181858888f19350505050158015610e63573d6000803e3d6000fd5b505050505050505050505050505050565b6000546001600160a01b03163314610ec45760405162461bcd60e51b815260206004820152601360248201527232bc32b1baba37b917b7b7363c96b7bbb732b960691b6044820152606401610724565b6001600160a01b038116610f1a5760405162461bcd60e51b815260206004820152601a60248201527f6578656375746f722f696e76616c69642d6e65772d6f776e65720000000000006044820152606401610724565b600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610fa45760405162461bcd60e51b815260206004820152601360248201527232bc32b1baba37b917b7b7363c96b7bbb732b960691b6044820152606401610724565b6001600160a01b0382166110aa57478111156110025760405162461bcd60e51b815260206004820152601760248201527f6578656375746f722f696e76616c69642d616d6f756e740000000000000000006044820152606401610724565b600080546040516001600160a01b039091169083908381818185875af1925050503d806000811461104f576040519150601f19603f3d011682016040523d82523d6000602084013e611054565b606091505b50509050806110a55760405162461bcd60e51b815260206004820152601a60248201527f6578656375746f722f7769746864726177616c2d6661696c65640000000000006044820152606401610724565b505050565b600054610c66906001600160a01b038481169116836115b8565b6000546001600160a01b031633146111145760405162461bcd60e51b815260206004820152601360248201527232bc32b1baba37b917b7b7363c96b7bbb732b960691b6044820152606401610724565b8060005b81811015610bfb57600084848381811061113457611134611f68565b90506020020160208101906111499190611e19565b6001600160a01b03811660009081526001602052604090205490915060ff16156111b55760405162461bcd60e51b815260206004820152601c60248201527f6578656375746f722f6475706c69636174652d77686974656c697374000000006044820152606401610724565b6001600160a01b0381166000818152600160208190526040808320805460ff1916909217909155517ff7762e85af7b409451f9a76004c5f755642902434eb11351ae67eb9746888b699190a25061120b816121f5565b9050611118565b60008163ffffffff1660000361129357826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015611260573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112849190612340565b50949550611404945050505050565b6040805160028082526060820183526000926020830190803683370190505090506112bf8360016123d2565b816000815181106112d2576112d2611f68565b602002602001019063ffffffff16908163ffffffff168152505060018160018151811061130157611301611f68565b63ffffffff909216602092830291909101909101526040517f883bdbfd0000000000000000000000000000000000000000000000000000000081526000906001600160a01b0386169063883bdbfd9061135e9085906004016123fa565b600060405180830381865afa15801561137b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113a391908101906124b3565b5090506113ff8463ffffffff16826000815181106113c3576113c3611f68565b6020026020010151836001815181106113de576113de611f68565b60200260200101516113f0919061257f565b6113fa91906125cf565b611601565b925050505b92915050565b80158061149d57506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611477573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149b9190611f9b565b155b61150f5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610724565b6040516001600160a01b0383166024820152604481018290526110a59084907f095ea7b300000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261194a565b6040516001600160a01b0383166024820152604481018290526110a59084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611554565b60008060008360020b12611618578260020b611620565b8260020b6000035b9050620d89e881111561165f576040517f2bc80f3a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008160011660000361168357700100000000000000000000000000000000611695565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff16905060028216156116c9576ffff97272373d413259a46990580e213a0260801c5b60048216156116e8576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615611707576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615611726576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615611745576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615611764576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615611783576ffe5dee046a99a2a811c461f1969c30530260801c5b6101008216156117a3576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b6102008216156117c3576ff987a7253ac413176f2b074cf7815e540260801c5b6104008216156117e3576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615611803576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615611823576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615611843576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615611863576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615611883576f31be135f97d08fd981231505542fcfa60260801c5b620100008216156118a4576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b620200008216156118c4576e5d6af8dedb81196699c329225ee6040260801c5b620400008216156118e3576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615611900576b048a170391f7dc42444e8fa20260801c5b60008460020b131561192157806000198161191d5761191d612124565b0490505b640100000000810615611935576001611938565b60005b60ff16602082901c0192505050919050565b600061199f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611a2f9092919063ffffffff16565b8051909150156110a557808060200190518101906119bd919061260d565b6110a55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610724565b6060611a3e8484600085611a46565b949350505050565b606082471015611abe5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610724565b600080866001600160a01b03168587604051611ada9190612628565b60006040518083038185875af1925050503d8060008114611b17576040519150601f19603f3d011682016040523d82523d6000602084013e611b1c565b606091505b5091509150611b2d87838387611b38565b979650505050505050565b60608315611ba7578251600003611ba0576001600160a01b0385163b611ba05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610724565b5081611a3e565b611a3e8383815115611bbc5781518083602001fd5b8060405162461bcd60e51b81526004016107249190612644565b6001600160a01b0381168114611beb57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611c2d57611c2d611bee565b604052919050565b600067ffffffffffffffff821115611c4f57611c4f611bee565b5060051b60200190565b803562ffffff81168114611c6c57600080fd5b919050565b60008060408385031215611c8457600080fd5b8235611c8f81611bd6565b915060208381013567ffffffffffffffff811115611cac57600080fd5b8401601f81018613611cbd57600080fd5b8035611cd0611ccb82611c35565b611c04565b81815260059190911b82018301908381019088831115611cef57600080fd5b928401925b82841015611d1457611d0584611c59565b82529284019290840190611cf4565b80955050505050509250929050565b60008060008060808587031215611d3957600080fd5b8435611d4481611bd6565b93506020850135925060408501359150611d6060608601611c59565b905092959194509250565b60008060208385031215611d7e57600080fd5b823567ffffffffffffffff80821115611d9657600080fd5b818501915085601f830112611daa57600080fd5b813581811115611db957600080fd5b8660208260051b8501011115611dce57600080fd5b60209290920196919550909350505050565b60008060408385031215611df357600080fd5b8235611dfe81611bd6565b91506020830135611e0e81611bd6565b809150509250929050565b600060208284031215611e2b57600080fd5b8135611e3681611bd6565b9392505050565b60008083601f840112611e4f57600080fd5b50813567ffffffffffffffff811115611e6757600080fd5b6020830191508360208285010111156106bf57600080fd5b6000806000806000806000806000806101008b8d031215611e9f57600080fd5b8a3567ffffffffffffffff80821115611eb757600080fd5b611ec38e838f01611e3d565b909c509a5060208d0135915080821115611edc57600080fd5b50611ee98d828e01611e3d565b90995097505060408b0135611efd81611bd6565b955060608b0135945060808b0135935060a08b0135925060c08b0135915060e08b0135611f2981611bd6565b809150509295989b9194979a5092959850565b60008060408385031215611f4f57600080fd5b8235611f5a81611bd6565b946020939093013593505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611f9057600080fd5b8151611e3681611bd6565b600060208284031215611fad57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff8103611fe057611fe0611fb4565b60010192915050565b805160ff81168114611c6c57600080fd5b60006020828403121561200c57600080fd5b611e3682611fe9565b600181815b8085111561205057816000190482111561203657612036611fb4565b8085161561204357918102915b93841c939080029061201a565b509250929050565b60008261206757506001611404565b8161207457506000611404565b816001811461208a5760028114612094576120b0565b6001915050611404565b60ff8411156120a5576120a5611fb4565b50506001821b611404565b5060208310610133831016604e8410600b84101617156120d3575081810a611404565b6120dd8383612015565b80600019048211156120f1576120f1611fb4565b029392505050565b6000611e368383612058565b600081600019048311821515161561211f5761211f611fb4565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261214957612149612124565b500490565b60005b83811015612169578181015183820152602001612151565b83811115610bfb5750506000910152565b6000815180845261219281602086016020860161214e565b601f01601f19169290920160200192915050565b6020815260008251608060208401526121c260a084018261217a565b90506001600160a01b03602085015116604084015260408401516060840152606084015160808401528091505092915050565b60006001820161220757612207611fb4565b5060010190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60c08152600061224b60c083018a8c61220e565b828103602084015261225e81898b61220e565b9150506001600160a01b03808716604084015285606084015284608084015280841660a0840152509998505050505050505050565b6000828210156122a5576122a5611fb4565b500390565b6000808312837f8000000000000000000000000000000000000000000000000000000000000000018312811516156122e4576122e4611fb4565b837f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01831381161561231857612318611fb4565b50500390565b805161ffff81168114611c6c57600080fd5b80518015158114611c6c57600080fd5b600080600080600080600060e0888a03121561235b57600080fd5b875161236681611bd6565b8097505060208801518060020b811461237e57600080fd5b955061238c6040890161231e565b945061239a6060890161231e565b93506123a86080890161231e565b92506123b660a08901611fe9565b91506123c460c08901612330565b905092959891949750929550565b600063ffffffff8083168185168083038211156123f1576123f1611fb4565b01949350505050565b6020808252825182820181905260009190848201906040850190845b8181101561243857835163ffffffff1683529284019291840191600101612416565b50909695505050505050565b600082601f83011261245557600080fd5b81516020612465611ccb83611c35565b82815260059290921b8401810191818101908684111561248457600080fd5b8286015b848110156124a857805161249b81611bd6565b8352918301918301612488565b509695505050505050565b600080604083850312156124c657600080fd5b825167ffffffffffffffff808211156124de57600080fd5b818501915085601f8301126124f257600080fd5b81516020612502611ccb83611c35565b82815260059290921b8401810191818101908984111561252157600080fd5b948201945b8386101561254f5785518060060b81146125405760008081fd5b82529482019490820190612526565b9188015191965090935050508082111561256857600080fd5b5061257585828601612444565b9150509250929050565b60008160060b8360060b6000811281667fffffffffffff19018312811516156125aa576125aa611fb4565b81667fffffffffffff0183138116156125c5576125c5611fb4565b5090039392505050565b60008160060b8360060b806125e6576125e6612124565b667fffffffffffff1982146000198214161561260457612604611fb4565b90059392505050565b60006020828403121561261f57600080fd5b611e3682612330565b6000825161263a81846020870161214e565b9190910192915050565b602081526000611e36602083018461217a56fea2646970667358221220ef413727bf87e20cbf6029023ff0e679a3b468d7bbc627d69c5f02994d7da87664736f6c634300080d0033

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

0000000000000000000000005743b5606e94fb534a31e1cefb3242c8a9422e5e000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000005e81a7515f956ab642eb698821a449fe8fe7498e

-----Decoded View---------------
Arg [0] : _bot (address): 0x5743b5606E94Fb534a31e1ceFB3242C8A9422e5E
Arg [1] : _weth (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [2] : _serviceRegistry (address): 0x5E81A7515F956ab642Eb698821a449FE8fE7498e

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000005743b5606e94fb534a31e1cefb3242c8a9422e5e
Arg [1] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [2] : 0000000000000000000000005e81a7515f956ab642eb698821a449fe8fe7498e


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.