AVAX Price: $38.85 (-6.10%)
Gas: 2.5 nAVAX
 
Transaction Hash
Method
Block
From
To
Withdraw All434624722024-03-28 2:04:50296 days ago1711591490IN
0x3b3E4b47...951c88524
0 AVAX0.0021918426.5
Withdraw All434624642024-03-28 2:04:35296 days ago1711591475IN
0x3b3E4b47...951c88524
0 AVAX0.0019651626.5
Withdraw All434624512024-03-28 2:04:09296 days ago1711591449IN
0x3b3E4b47...951c88524
0 AVAX0.0019370726.5
Withdraw All434624422024-03-28 2:03:51296 days ago1711591431IN
0x3b3E4b47...951c88524
0 AVAX0.0022188926.5
Withdraw All434624352024-03-28 2:03:35296 days ago1711591415IN
0x3b3E4b47...951c88524
0 AVAX0.0019617426.5
Withdraw428094042024-03-12 15:07:51312 days ago1710256071IN
0x3b3E4b47...951c88524
0 AVAX0.0023462632.24349432
Claim Fee425719182024-03-07 0:01:10317 days ago1709769670IN
0x3b3E4b47...951c88524
0 AVAX0.0015707130
Claim Fee425293412024-03-06 0:01:44318 days ago1709683304IN
0x3b3E4b47...951c88524
0 AVAX0.0023357130
Pause425144442024-03-05 15:57:36319 days ago1709654256IN
0x3b3E4b47...951c88524
0 AVAX0.0015017530.62129113
Claim Fee424857062024-03-05 0:01:15319 days ago1709596875IN
0x3b3E4b47...951c88524
0 AVAX0.0023357130
Repay Weekly Len...424525632024-03-04 5:29:35320 days ago1709530175IN
0x3b3E4b47...951c88524
0 AVAX0.0107364727.425
Repay Weekly Len...424525522024-03-04 5:29:13320 days ago1709530153IN
0x3b3E4b47...951c88524
0 AVAX0.0096695826.5
Claim Fee424428822024-03-04 0:01:56320 days ago1709510516IN
0x3b3E4b47...951c88524
0 AVAX0.0023357130
Claim Fee424005512024-03-03 0:01:39321 days ago1709424099IN
0x3b3E4b47...951c88524
0 AVAX0.0023357130
Claim Fee423583222024-03-02 0:01:25322 days ago1709337685IN
0x3b3E4b47...951c88524
0 AVAX0.0023357130
Claim Fee423158612024-03-01 0:01:25323 days ago1709251285IN
0x3b3E4b47...951c88524
0 AVAX0.0023357130
Claim Fee422734202024-02-29 0:02:07324 days ago1709164927IN
0x3b3E4b47...951c88524
0 AVAX0.0023357130
Claim Fee422309002024-02-28 0:01:51325 days ago1709078511IN
0x3b3E4b47...951c88524
0 AVAX0.0023357130
Claim Fee421884922024-02-27 0:01:25326 days ago1708992085IN
0x3b3E4b47...951c88524
0 AVAX0.0023357130
Claim Fee421461372024-02-26 0:01:35327 days ago1708905695IN
0x3b3E4b47...951c88524
0 AVAX0.0023357130
Claim Fee421032352024-02-25 0:01:33328 days ago1708819293IN
0x3b3E4b47...951c88524
0 AVAX0.0084715108.80854369
Claim Fee420603442024-02-24 0:02:12329 days ago1708732932IN
0x3b3E4b47...951c88524
0 AVAX0.0046738560.03132826
Claim Fee420269692024-02-23 0:01:54330 days ago1708646514IN
0x3b3E4b47...951c88524
0 AVAX0.0023357130
Claim Fee419842762024-02-22 0:01:29331 days ago1708560089IN
0x3b3E4b47...951c88524
0 AVAX0.0023357130
Claim Fee419416692024-02-21 0:01:34332 days ago1708473694IN
0x3b3E4b47...951c88524
0 AVAX0.0023357130
View all transactions

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
WooPPV2

Compiler Version
v0.8.14+commit.80d49f37

Optimization Enabled:
Yes with 20000 runs

Other Settings:
default evmVersion
File 1 of 15 : WooPPV2.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;

/*

░██╗░░░░░░░██╗░█████╗░░█████╗░░░░░░░███████╗██╗
░██║░░██╗░░██║██╔══██╗██╔══██╗░░░░░░██╔════╝██║
░╚██╗████╗██╔╝██║░░██║██║░░██║█████╗█████╗░░██║
░░████╔═████║░██║░░██║██║░░██║╚════╝██╔══╝░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝╚█████╔╝░░░░░░██║░░░░░██║
░░░╚═╝░░░╚═╝░░░╚════╝░░╚════╝░░░░░░░╚═╝░░░░░╚═╝

*
* MIT License
* ===========
*
* Copyright (c) 2020 WooTrade
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

import "./interfaces/IWooracleV2.sol";
import "./interfaces/IWooPPV2.sol";
import "./interfaces/AggregatorV3Interface.sol";
import "./interfaces/IWooLendingManager.sol";

import "./libraries/TransferHelper.sol";

// OpenZeppelin contracts
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";

// REMOVE IT IN PROD
// import "hardhat/console.sol";

/// @title Woo pool for token swap, version 2.
/// @notice the implementation class for interface IWooPPV2, mainly for query and swap tokens.
contract WooPPV2 is Ownable, ReentrancyGuard, Pausable, IWooPPV2 {
    /* ----- Type declarations ----- */
    struct DecimalInfo {
        uint64 priceDec; // 10**(price_decimal)
        uint64 quoteDec; // 10**(quote_decimal)
        uint64 baseDec; // 10**(base_decimal)
    }

    struct TokenInfo {
        uint192 reserve; // balance reserve
        uint16 feeRate; // 1 in 100000; 10 = 1bp = 0.01%; max = 65535
    }

    /* ----- State variables ----- */
    address constant ETH_PLACEHOLDER_ADDR = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    uint256 public unclaimedFee; // NOTE: in quote token

    // wallet address --> is admin
    mapping(address => bool) public isAdmin;

    // token address --> fee rate
    mapping(address => TokenInfo) public tokenInfos;

    /// @inheritdoc IWooPPV2
    address public immutable override quoteToken;

    IWooracleV2 public wooracle;

    address public feeAddr;

    mapping(address => IWooLendingManager) public lendManagers;

    /* ----- Modifiers ----- */

    modifier onlyAdmin() {
        require(msg.sender == owner() || isAdmin[msg.sender], "WooPPV2: !admin");
        _;
    }

    constructor(address _quoteToken) {
        quoteToken = _quoteToken;
    }

    function init(address _wooracle, address _feeAddr) external onlyOwner {
        require(address(wooracle) == address(0), "WooPPV2: INIT_INVALID");
        wooracle = IWooracleV2(_wooracle);
        feeAddr = _feeAddr;
    }

    /* ----- External Functions ----- */

    /// @inheritdoc IWooPPV2
    function tryQuery(
        address fromToken,
        address toToken,
        uint256 fromAmount
    ) external view override returns (uint256 toAmount) {
        if (fromToken == quoteToken) {
            toAmount = _tryQuerySellQuote(toToken, fromAmount);
        } else if (toToken == quoteToken) {
            toAmount = _tryQuerySellBase(fromToken, fromAmount);
        } else {
            (toAmount, ) = _tryQueryBaseToBase(fromToken, toToken, fromAmount);
        }
    }

    /// @inheritdoc IWooPPV2
    function query(
        address fromToken,
        address toToken,
        uint256 fromAmount
    ) external view override returns (uint256 toAmount) {
        if (fromToken == quoteToken) {
            toAmount = _tryQuerySellQuote(toToken, fromAmount);
        } else if (toToken == quoteToken) {
            toAmount = _tryQuerySellBase(fromToken, fromAmount);
        } else {
            uint256 swapFee;
            (toAmount, swapFee) = _tryQueryBaseToBase(fromToken, toToken, fromAmount);
            require(swapFee <= tokenInfos[quoteToken].reserve, "WooPPV2: INSUFF_QUOTE_FOR_SWAPFEE");
        }
        require(toAmount <= tokenInfos[toToken].reserve, "WooPPV2: INSUFF_BALANCE");
    }

    /// @inheritdoc IWooPPV2
    function swap(
        address fromToken,
        address toToken,
        uint256 fromAmount,
        uint256 minToAmount,
        address to,
        address rebateTo
    ) external override returns (uint256 realToAmount) {
        if (fromToken == quoteToken) {
            // case 1: quoteToken --> baseToken
            realToAmount = _sellQuote(toToken, fromAmount, minToAmount, to, rebateTo);
        } else if (toToken == quoteToken) {
            // case 2: fromToken --> quoteToken
            realToAmount = _sellBase(fromToken, fromAmount, minToAmount, to, rebateTo);
        } else {
            // case 3: fromToken --> toToken (base to base)
            realToAmount = _swapBaseToBase(fromToken, toToken, fromAmount, minToAmount, to, rebateTo);
        }
    }

    /// @dev OKAY to be public method
    function claimFee() external nonReentrant {
        require(feeAddr != address(0), "WooPPV2: !feeAddr");
        uint256 amountToTransfer = unclaimedFee;
        unclaimedFee = 0;
        TransferHelper.safeTransfer(quoteToken, feeAddr, amountToTransfer);
    }

    /// @inheritdoc IWooPPV2
    /// @dev pool size = tokenInfo.reserve
    function poolSize(address token) public view override returns (uint256) {
        return tokenInfos[token].reserve;
    }

    /// @dev User pool balance (substracted unclaimed fee)
    function balance(address token) public view returns (uint256) {
        return token == quoteToken ? _rawBalance(token) - unclaimedFee : _rawBalance(token);
    }

    function decimalInfo(address baseToken) public view returns (DecimalInfo memory) {
        return
            DecimalInfo({
                priceDec: uint64(10)**(IWooracleV2(wooracle).decimals(baseToken)), // 8
                quoteDec: uint64(10)**(IERC20Metadata(quoteToken).decimals()), // 18 or 6
                baseDec: uint64(10)**(IERC20Metadata(baseToken).decimals()) // 18 or 8
            });
    }

    /* ----- Admin Functions ----- */

    function setWooracle(address _wooracle) external onlyAdmin {
        wooracle = IWooracleV2(_wooracle);
        emit WooracleUpdated(_wooracle);
    }

    function setFeeAddr(address _feeAddr) external onlyAdmin {
        feeAddr = _feeAddr;
        emit FeeAddrUpdated(_feeAddr);
    }

    function setFeeRate(address token, uint16 rate) external onlyAdmin {
        require(rate <= 1e5, "!rate");
        tokenInfos[token].feeRate = rate;
    }

    function pause() external onlyAdmin {
        super._pause();
    }

    function unpause() external onlyAdmin {
        super._unpause();
    }

    function setAdmin(address addr, bool flag) external onlyAdmin {
        require(addr != address(0), "WooPPV2: !admin");
        isAdmin[addr] = flag;
        emit AdminUpdated(addr, flag);
    }

    function deposit(address token, uint256 amount) public override nonReentrant onlyAdmin {
        uint256 balanceBefore = balance(token);
        TransferHelper.safeTransferFrom(token, msg.sender, address(this), amount);
        uint256 amountReceived = balance(token) - balanceBefore;
        require(amountReceived >= amount, "AMOUNT_INSUFF");

        tokenInfos[token].reserve = uint192(tokenInfos[token].reserve + amount);

        emit Deposit(token, msg.sender, amount);
    }

    function depositAll(address token) external onlyAdmin {
        deposit(token, IERC20(token).balanceOf(msg.sender));
    }

    function repayWeeklyLending(address wantToken) external nonReentrant onlyAdmin {
        IWooLendingManager lendManager = lendManagers[wantToken];
        lendManager.accureInterest();
        uint256 amount = lendManager.weeklyRepayment();
        address repaidToken = lendManager.want();
        if (amount > 0) {
            tokenInfos[repaidToken].reserve = uint192(tokenInfos[repaidToken].reserve - amount);
            TransferHelper.safeApprove(repaidToken, address(lendManager), amount);
            lendManager.repayWeekly();
        }
        emit Withdraw(repaidToken, address(lendManager), amount);
    }

    function withdraw(address token, uint256 amount) public nonReentrant onlyAdmin {
        require(tokenInfos[token].reserve >= amount, "WooPPV2: !amount");
        tokenInfos[token].reserve = uint192(tokenInfos[token].reserve - amount);
        TransferHelper.safeTransfer(token, owner(), amount);
        emit Withdraw(token, owner(), amount);
    }

    function withdrawAll(address token) external onlyAdmin {
        withdraw(token, poolSize(token));
    }

    function skim(address token) public nonReentrant onlyAdmin {
        TransferHelper.safeTransfer(token, owner(), balance(token) - tokenInfos[token].reserve);
    }

    function skimMulTokens(address[] memory tokens) external nonReentrant onlyAdmin {
        unchecked {
            uint256 len = tokens.length;
            for (uint256 i = 0; i < len; i++) {
                skim(tokens[i]);
            }
        }
    }

    function sync(address token) external nonReentrant onlyAdmin {
        tokenInfos[token].reserve = uint192(balance(token));
    }

    /* ----- Owner Functions ----- */

    function setLendManager(IWooLendingManager _lendManager) external onlyOwner {
        lendManagers[_lendManager.want()] = _lendManager;
        isAdmin[address(_lendManager)] = true;
        emit AdminUpdated(address(_lendManager), true);
    }

    function migrateToNewPool(address token, address newPool) external onlyOwner {
        require(token != address(0), "WooPPV2: !token");
        require(newPool != address(0), "WooPPV2: !newPool");

        tokenInfos[token].reserve = 0;

        uint256 bal = balance(token);
        TransferHelper.safeApprove(token, newPool, bal);
        WooPPV2(newPool).depositAll(token);

        emit Migrate(token, newPool, bal);
    }

    function inCaseTokenGotStuck(address stuckToken) external onlyOwner {
        if (stuckToken == ETH_PLACEHOLDER_ADDR) {
            TransferHelper.safeTransferETH(msg.sender, address(this).balance);
        } else {
            uint256 amount = IERC20(stuckToken).balanceOf(address(this));
            TransferHelper.safeTransfer(stuckToken, msg.sender, amount);
        }
    }

    /* ----- Private Functions ----- */

    function _tryQuerySellBase(address baseToken, uint256 baseAmount)
        private
        view
        whenNotPaused
        returns (uint256 quoteAmount)
    {
        IWooracleV2.State memory state = IWooracleV2(wooracle).state(baseToken);
        (quoteAmount, ) = _calcQuoteAmountSellBase(baseToken, baseAmount, state);
        uint256 fee = (quoteAmount * tokenInfos[baseToken].feeRate) / 1e5;
        quoteAmount = quoteAmount - fee;
    }

    function _tryQuerySellQuote(address baseToken, uint256 quoteAmount)
        private
        view
        whenNotPaused
        returns (uint256 baseAmount)
    {
        uint256 swapFee = (quoteAmount * tokenInfos[baseToken].feeRate) / 1e5;
        quoteAmount = quoteAmount - swapFee;
        IWooracleV2.State memory state = IWooracleV2(wooracle).state(baseToken);
        (baseAmount, ) = _calcBaseAmountSellQuote(baseToken, quoteAmount, state);
    }

    function _tryQueryBaseToBase(
        address baseToken1,
        address baseToken2,
        uint256 base1Amount
    ) private view whenNotPaused returns (uint256 base2Amount, uint256 swapFee) {
        if (
            baseToken1 == address(0) || baseToken2 == address(0) || baseToken1 == quoteToken || baseToken2 == quoteToken
        ) {
            return (0, 0);
        }

        IWooracleV2.State memory state1 = IWooracleV2(wooracle).state(baseToken1);
        IWooracleV2.State memory state2 = IWooracleV2(wooracle).state(baseToken2);

        uint64 spread = _maxUInt64(state1.spread, state2.spread) / 2;
        uint16 feeRate = _maxUInt16(tokenInfos[baseToken1].feeRate, tokenInfos[baseToken2].feeRate);

        state1.spread = spread;
        state2.spread = spread;

        (uint256 quoteAmount, ) = _calcQuoteAmountSellBase(baseToken1, base1Amount, state1);

        swapFee = (quoteAmount * feeRate) / 1e5;
        quoteAmount = quoteAmount - swapFee;

        (base2Amount, ) = _calcBaseAmountSellQuote(baseToken2, quoteAmount, state2);
    }

    function _sellBase(
        address baseToken,
        uint256 baseAmount,
        uint256 minQuoteAmount,
        address to,
        address rebateTo
    ) private nonReentrant whenNotPaused returns (uint256 quoteAmount) {
        require(baseToken != address(0), "WooPPV2: !baseToken");
        require(to != address(0), "WooPPV2: !to");
        require(baseToken != quoteToken, "WooPPV2: baseToken==quoteToken");

        require(balance(baseToken) - tokenInfos[baseToken].reserve >= baseAmount, "WooPPV2: BASE_BALANCE_NOT_ENOUGH");

        {
            uint256 newPrice;
            IWooracleV2.State memory state = IWooracleV2(wooracle).state(baseToken);
            (quoteAmount, newPrice) = _calcQuoteAmountSellBase(baseToken, baseAmount, state);
            IWooracleV2(wooracle).postPrice(baseToken, uint128(newPrice));
            // console.log('Post new price:', newPrice, newPrice/1e8);
        }

        uint256 swapFee = (quoteAmount * tokenInfos[baseToken].feeRate) / 1e5;
        quoteAmount = quoteAmount - swapFee;
        require(quoteAmount >= minQuoteAmount, "WooPPV2: quoteAmount_LT_minQuoteAmount");

        unclaimedFee = unclaimedFee + swapFee;

        tokenInfos[baseToken].reserve = uint192(tokenInfos[baseToken].reserve + baseAmount);
        tokenInfos[quoteToken].reserve = uint192(tokenInfos[quoteToken].reserve - quoteAmount - swapFee);

        if (to != address(this)) {
            TransferHelper.safeTransfer(quoteToken, to, quoteAmount);
        }

        emit WooSwap(
            baseToken,
            quoteToken,
            baseAmount,
            quoteAmount,
            msg.sender,
            to,
            rebateTo,
            quoteAmount + swapFee,
            swapFee
        );
    }

    function _sellQuote(
        address baseToken,
        uint256 quoteAmount,
        uint256 minBaseAmount,
        address to,
        address rebateTo
    ) private nonReentrant whenNotPaused returns (uint256 baseAmount) {
        require(baseToken != address(0), "WooPPV2: !baseToken");
        require(to != address(0), "WooPPV2: !to");
        require(baseToken != quoteToken, "WooPPV2: baseToken==quoteToken");

        require(
            balance(quoteToken) - tokenInfos[quoteToken].reserve >= quoteAmount,
            "WooPPV2: QUOTE_BALANCE_NOT_ENOUGH"
        );

        uint256 swapFee = (quoteAmount * tokenInfos[baseToken].feeRate) / 1e5;
        quoteAmount = quoteAmount - swapFee;
        unclaimedFee = unclaimedFee + swapFee;

        {
            uint256 newPrice;
            IWooracleV2.State memory state = IWooracleV2(wooracle).state(baseToken);
            (baseAmount, newPrice) = _calcBaseAmountSellQuote(baseToken, quoteAmount, state);
            IWooracleV2(wooracle).postPrice(baseToken, uint128(newPrice));
            // console.log('Post new price:', newPrice, newPrice/1e8);
            require(baseAmount >= minBaseAmount, "WooPPV2: baseAmount_LT_minBaseAmount");
        }

        tokenInfos[baseToken].reserve = uint192(tokenInfos[baseToken].reserve - baseAmount);
        tokenInfos[quoteToken].reserve = uint192(tokenInfos[quoteToken].reserve + quoteAmount);

        if (to != address(this)) {
            TransferHelper.safeTransfer(baseToken, to, baseAmount);
        }

        emit WooSwap(
            quoteToken,
            baseToken,
            quoteAmount + swapFee,
            baseAmount,
            msg.sender,
            to,
            rebateTo,
            quoteAmount + swapFee,
            swapFee
        );
    }

    function _swapBaseToBase(
        address baseToken1,
        address baseToken2,
        uint256 base1Amount,
        uint256 minBase2Amount,
        address to,
        address rebateTo
    ) private nonReentrant whenNotPaused returns (uint256 base2Amount) {
        require(baseToken1 != address(0) && baseToken1 != quoteToken, "WooPPV2: !baseToken1");
        require(baseToken2 != address(0) && baseToken2 != quoteToken, "WooPPV2: !baseToken2");
        require(to != address(0), "WooPPV2: !to");

        require(balance(baseToken1) - tokenInfos[baseToken1].reserve >= base1Amount, "WooPPV2: !BASE1_BALANCE");

        IWooracleV2.State memory state1 = IWooracleV2(wooracle).state(baseToken1);
        IWooracleV2.State memory state2 = IWooracleV2(wooracle).state(baseToken2);

        uint256 swapFee;
        uint256 quoteAmount;
        {
            uint64 spread = _maxUInt64(state1.spread, state2.spread) / 2;
            uint16 feeRate = _maxUInt16(tokenInfos[baseToken1].feeRate, tokenInfos[baseToken2].feeRate);

            state1.spread = spread;
            state2.spread = spread;

            uint256 newBase1Price;
            (quoteAmount, newBase1Price) = _calcQuoteAmountSellBase(baseToken1, base1Amount, state1);
            IWooracleV2(wooracle).postPrice(baseToken1, uint128(newBase1Price));
            // console.log('Post new base1 price:', newBase1Price, newBase1Price/1e8);

            swapFee = (quoteAmount * feeRate) / 1e5;
        }

        quoteAmount = quoteAmount - swapFee;
        unclaimedFee = unclaimedFee + swapFee;

        tokenInfos[quoteToken].reserve = uint192(tokenInfos[quoteToken].reserve - swapFee);
        tokenInfos[baseToken1].reserve = uint192(tokenInfos[baseToken1].reserve + base1Amount);

        {
            uint256 newBase2Price;
            (base2Amount, newBase2Price) = _calcBaseAmountSellQuote(baseToken2, quoteAmount, state2);
            IWooracleV2(wooracle).postPrice(baseToken2, uint128(newBase2Price));
            // console.log('Post new base2 price:', newBase2Price, newBase2Price/1e8);
            require(base2Amount >= minBase2Amount, "WooPPV2: base2Amount_LT_minBase2Amount");
        }

        tokenInfos[baseToken2].reserve = uint192(tokenInfos[baseToken2].reserve - base2Amount);

        if (to != address(this)) {
            TransferHelper.safeTransfer(baseToken2, to, base2Amount);
        }

        emit WooSwap(
            baseToken1,
            baseToken2,
            base1Amount,
            base2Amount,
            msg.sender,
            to,
            rebateTo,
            quoteAmount + swapFee,
            swapFee
        );
    }

    /// @dev Get the pool's balance of the specified token
    /// @dev This function is gas optimized to avoid a redundant extcodesize check in addition to the returndatasize
    /// @dev forked and curtesy by Uniswap v3 core
    function _rawBalance(address token) private view returns (uint256) {
        (bool success, bytes memory data) = token.staticcall(
            abi.encodeWithSelector(IERC20.balanceOf.selector, address(this))
        );
        require(success && data.length >= 32, "WooPPV2: !BALANCE");
        return abi.decode(data, (uint256));
    }

    function _calcQuoteAmountSellBase(
        address baseToken,
        uint256 baseAmount,
        IWooracleV2.State memory state
    ) private view returns (uint256 quoteAmount, uint256 newPrice) {
        require(state.woFeasible, "WooPPV2: !ORACLE_FEASIBLE");

        DecimalInfo memory decs = decimalInfo(baseToken);

        // quoteAmount = baseAmount * oracle.price * (1 - oracle.k * baseAmount * oracle.price - oracle.spread)
        {
            uint256 coef = uint256(1e18) -
                ((uint256(state.coeff) * baseAmount * state.price) / decs.baseDec / decs.priceDec) -
                state.spread;
            quoteAmount = (((baseAmount * decs.quoteDec * state.price) / decs.priceDec) * coef) / 1e18 / decs.baseDec;
        }

        // newPrice = oracle.price * (1 - 2 * k * oracle.price * baseAmount)
        newPrice =
            ((uint256(1e18) - (uint256(2) * state.coeff * state.price * baseAmount) / decs.priceDec / decs.baseDec) *
                state.price) /
            1e18;
    }

    function _calcBaseAmountSellQuote(
        address baseToken,
        uint256 quoteAmount,
        IWooracleV2.State memory state
    ) private view returns (uint256 baseAmount, uint256 newPrice) {
        require(state.woFeasible, "WooPPV2: !ORACLE_FEASIBLE");

        DecimalInfo memory decs = decimalInfo(baseToken);

        // baseAmount = quoteAmount / oracle.price * (1 - oracle.k * quoteAmount - oracle.spread)
        {
            uint256 coef = uint256(1e18) - (quoteAmount * state.coeff) / decs.quoteDec - state.spread;
            baseAmount = (((quoteAmount * decs.baseDec * decs.priceDec) / state.price) * coef) / 1e18 / decs.quoteDec;
        }

        // new_price = oracle.price * (1 + 2 * k * quoteAmount)
        newPrice =
            ((uint256(1e18) * decs.quoteDec + uint256(2) * state.coeff * quoteAmount) * state.price) /
            decs.quoteDec /
            1e18;
    }

    function _maxUInt16(uint16 a, uint16 b) private pure returns (uint16) {
        return a > b ? a : b;
    }

    function _maxUInt64(uint64 a, uint64 b) private pure returns (uint64) {
        return a > b ? a : b;
    }
}

File 2 of 15 : AggregatorV3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;

interface AggregatorV3Interface {
    function decimals() external view returns (uint8);

    function description() external view returns (string memory);

    function version() external view returns (uint256);

    /// getRoundData and latestRoundData should both raise "No data present"
    /// if they do not have data to report, instead of returning unset values
    /// which could be misinterpreted as actual reported values.
    function getRoundData(uint80 _roundId)
        external
        view
        returns (
            uint80 roundId,
            int256 answer,
            uint256 startedAt,
            uint256 updatedAt,
            uint80 answeredInRound
        );

    function latestRoundData()
        external
        view
        returns (
            uint80 roundId,
            int256 answer,
            uint256 startedAt,
            uint256 updatedAt,
            uint80 answeredInRound
        );
}

File 3 of 15 : IWooracleV2.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;

/*

░██╗░░░░░░░██╗░█████╗░░█████╗░░░░░░░███████╗██╗
░██║░░██╗░░██║██╔══██╗██╔══██╗░░░░░░██╔════╝██║
░╚██╗████╗██╔╝██║░░██║██║░░██║█████╗█████╗░░██║
░░████╔═████║░██║░░██║██║░░██║╚════╝██╔══╝░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝╚█████╔╝░░░░░░██║░░░░░██║
░░░╚═╝░░░╚═╝░░░╚════╝░░╚════╝░░░░░░░╚═╝░░░░░╚═╝

*
* MIT License
* ===========
*
* Copyright (c) 2020 WooTrade
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/// @title The oracle V2 interface by Woo.Network.
/// @notice update and posted the latest price info by Woo.
interface IWooracleV2 {
    struct State {
        uint128 price;
        uint64 spread;
        uint64 coeff;
        bool woFeasible;
    }

    /// @notice Wooracle spread value
    function woSpread(address base) external view returns (uint64);

    /// @notice Wooracle coeff value
    function woCoeff(address base) external view returns (uint64);

    /// @notice Wooracle state for the specified base token
    function woState(address base) external view returns (State memory);

    /// @notice Chainlink oracle address for the specified base token
    function cloAddress(address base) external view returns (address clo);

    /// @notice ChainLink price of the base token / quote token
    function cloPrice(address base) external view returns (uint256 price, uint256 timestamp);

    /// @notice Wooracle price of the base token
    function woPrice(address base) external view returns (uint128 price, uint256 timestamp);

    /// @notice Returns Woooracle price if available, otherwise fallback to ChainLink
    function price(address base) external view returns (uint256 priceNow, bool feasible);

    /// @notice Updates the Wooracle price for the specified base token
    function postPrice(address base, uint128 newPrice) external;

    /// @notice State of the specified base token.
    function state(address base) external view returns (State memory);

    /// @notice The price decimal for the specified base token (e.g. 8)
    function decimals(address base) external view returns (uint8);

    /// @notice The quote token for calculating WooPP query price
    function quoteToken() external view returns (address);

    /// @notice last updated timestamp
    function timestamp() external view returns (uint256);

    /// @notice Flag for Wooracle price feasible
    function isWoFeasible(address base) external view returns (bool);
}

File 4 of 15 : IWooPPV2.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;

/*

░██╗░░░░░░░██╗░█████╗░░█████╗░░░░░░░███████╗██╗
░██║░░██╗░░██║██╔══██╗██╔══██╗░░░░░░██╔════╝██║
░╚██╗████╗██╔╝██║░░██║██║░░██║█████╗█████╗░░██║
░░████╔═████║░██║░░██║██║░░██║╚════╝██╔══╝░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝╚█████╔╝░░░░░░██║░░░░░██║
░░░╚═╝░░░╚═╝░░░╚════╝░░╚════╝░░░░░░░╚═╝░░░░░╚═╝

*
* MIT License
* ===========
*
* Copyright (c) 2020 WooTrade
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/// @title Woo private pool for swap.
/// @notice Use this contract to directly interfact with woo's synthetic proactive
///         marketing making pool.
/// @author woo.network
interface IWooPPV2 {
    /* ----- Events ----- */

    event Deposit(address indexed token, address indexed sender, uint256 amount);
    event Withdraw(address indexed token, address indexed receiver, uint256 amount);
    event Migrate(address indexed token, address indexed receiver, uint256 amount);
    event AdminUpdated(address indexed addr, bool flag);
    event FeeAddrUpdated(address indexed newFeeAddr);
    event WooracleUpdated(address indexed newWooracle);
    event WooSwap(
        address indexed fromToken,
        address indexed toToken,
        uint256 fromAmount,
        uint256 toAmount,
        address from,
        address indexed to,
        address rebateTo,
        uint256 swapVol,
        uint256 swapFee
    );

    /* ----- External Functions ----- */

    /// @notice The quote token address (immutable).
    /// @return address of quote token
    function quoteToken() external view returns (address);

    /// @notice Gets the pool size of the specified token (swap liquidity).
    /// @param token the token address
    /// @return the pool size
    function poolSize(address token) external view returns (uint256);

    /// @notice Query the amount to swap `fromToken` to `toToken`, without checking the pool reserve balance.
    /// @param fromToken the from token
    /// @param toToken the to token
    /// @param fromAmount the amount of `fromToken` to swap
    /// @return toAmount the swapped amount of `toToken`
    function tryQuery(
        address fromToken,
        address toToken,
        uint256 fromAmount
    ) external view returns (uint256 toAmount);

    /// @notice Query the amount to swap `fromToken` to `toToken`, with checking the pool reserve balance.
    /// @dev tx reverts when 'toToken' balance is insufficient.
    /// @param fromToken the from token
    /// @param toToken the to token
    /// @param fromAmount the amount of `fromToken` to swap
    /// @return toAmount the swapped amount of `toToken`
    function query(
        address fromToken,
        address toToken,
        uint256 fromAmount
    ) external view returns (uint256 toAmount);

    /// @notice Swap `fromToken` to `toToken`.
    /// @param fromToken the from token
    /// @param toToken the to token
    /// @param fromAmount the amount of `fromToken` to swap
    /// @param minToAmount the minimum amount of `toToken` to receive
    /// @param to the destination address
    /// @param rebateTo the rebate address (optional, can be address ZERO)
    /// @return realToAmount the amount of toToken to receive
    function swap(
        address fromToken,
        address toToken,
        uint256 fromAmount,
        uint256 minToAmount,
        address to,
        address rebateTo
    ) external returns (uint256 realToAmount);

    /// @notice Deposit the specified token into the liquidity pool of WooPPV2.
    /// @param token the token to deposit
    /// @param amount the deposit amount
    function deposit(address token, uint256 amount) external;
}

File 5 of 15 : IWooLendingManager.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;

/*

░██╗░░░░░░░██╗░█████╗░░█████╗░░░░░░░███████╗██╗
░██║░░██╗░░██║██╔══██╗██╔══██╗░░░░░░██╔════╝██║
░╚██╗████╗██╔╝██║░░██║██║░░██║█████╗█████╗░░██║
░░████╔═████║░██║░░██║██║░░██║╚════╝██╔══╝░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝╚█████╔╝░░░░░░██║░░░░░██║
░░░╚═╝░░░╚═╝░░░╚════╝░░╚════╝░░░░░░░╚═╝░░░░░╚═╝

*
* MIT License
* ===========
*
* Copyright (c) 2022 WooTrade
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/// @title Interface for WooLendingManager
interface IWooLendingManager {
    function want() external returns (address);

    function repayWeekly() external returns (uint256 repaidAmount);

    function repayAll() external returns (uint256 repaidAmount);

    function repay(uint256 amount) external;

    /// @notice Borrow the fund from super charger and then deposit directly into WooPP.
    /// @param amount the borrowing amount
    function borrow(uint256 amount) external;

    function accureInterest() external;

    function weeklyRepayment() external view returns (uint256 repayAmount);
}

File 6 of 15 : TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            'TransferHelper::safeApprove: approve failed'
        );
    }

    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            'TransferHelper::safeTransfer: transfer failed'
        );
    }

    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            'TransferHelper::transferFrom: transferFrom failed'
        );
    }

    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

File 8 of 15 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

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

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

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

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

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

File 10 of 15 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 11 of 15 : 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 12 of 15 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 14 of 15 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 functionCall(target, data, "Address: low-level call failed");
    }

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

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

    /**
     * @dev 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) {
        require(isContract(target), "Address: delegate call to non-contract");

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 15 of 15 : 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);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_quoteToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"bool","name":"flag","type":"bool"}],"name":"AdminUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newFeeAddr","type":"address"}],"name":"FeeAddrUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Migrate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"fromToken","type":"address"},{"indexed":true,"internalType":"address","name":"toToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"fromAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"rebateTo","type":"address"},{"indexed":false,"internalType":"uint256","name":"swapVol","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"swapFee","type":"uint256"}],"name":"WooSwap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newWooracle","type":"address"}],"name":"WooracleUpdated","type":"event"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"baseToken","type":"address"}],"name":"decimalInfo","outputs":[{"components":[{"internalType":"uint64","name":"priceDec","type":"uint64"},{"internalType":"uint64","name":"quoteDec","type":"uint64"},{"internalType":"uint64","name":"baseDec","type":"uint64"}],"internalType":"struct WooPPV2.DecimalInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"depositAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"stuckToken","type":"address"}],"name":"inCaseTokenGotStuck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_wooracle","type":"address"},{"internalType":"address","name":"_feeAddr","type":"address"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lendManagers","outputs":[{"internalType":"contract IWooLendingManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"newPool","type":"address"}],"name":"migrateToNewPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"poolSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromAmount","type":"uint256"}],"name":"query","outputs":[{"internalType":"uint256","name":"toAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"quoteToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"wantToken","type":"address"}],"name":"repayWeeklyLending","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"bool","name":"flag","type":"bool"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeAddr","type":"address"}],"name":"setFeeAddr","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint16","name":"rate","type":"uint16"}],"name":"setFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IWooLendingManager","name":"_lendManager","type":"address"}],"name":"setLendManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_wooracle","type":"address"}],"name":"setWooracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"skim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"skimMulTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"minToAmount","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"rebateTo","type":"address"}],"name":"swap","outputs":[{"internalType":"uint256","name":"realToAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"sync","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenInfos","outputs":[{"internalType":"uint192","name":"reserve","type":"uint192"},{"internalType":"uint16","name":"feeRate","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromAmount","type":"uint256"}],"name":"tryQuery","outputs":[{"internalType":"uint256","name":"toAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unclaimedFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wooracle","outputs":[{"internalType":"contract IWooracleV2","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60a06040523480156200001157600080fd5b5060405162005442380380620054428339810160408190526200003491620000af565b6200003f336200005f565b600180556002805460ff191690556001600160a01b0316608052620000e1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215620000c257600080fd5b81516001600160a01b0381168114620000da57600080fd5b9392505050565b60805161528f620001b36000396000818161027b01528181610d2e01528181610d7b01528181611022015281816112f40152818161174d01528181611797015281816119f401528181612168015281816121b20152818161220a0152818161292a015281816129ab01528181612d3d01528181612d7901528181612e1b01528181612fd5015281816133a1015281816133e90152818161346f015281816134a10152818161357a0152818161361001528181613a2401528181613a7a015281816141dc0152614218015261528f6000f3fe608060405234801561001057600080fd5b506004361061025c5760003560e01c8063a584119411610145578063e3d670d7116100bd578063f2fde38b1161008c578063f58a435f11610071578063f58a435f146105ba578063fa09e630146105cd578063fa75d160146105e057600080fd5b8063f2fde38b14610594578063f3fef3a3146105a757600080fd5b8063e3d670d714610552578063e4d43ec114610565578063ebc80f131461056e578063f09a40161461058157600080fd5b8063bc25cf7711610114578063ce824f19116100f9578063ce824f1914610519578063d6285b7f1461052c578063e1a4e72a1461053f57600080fd5b8063bc25cf77146104f3578063bc8530f91461050657600080fd5b8063a584119414610415578063b2855b4f14610428578063b2e693d31461043b578063ba46ae721461046457600080fd5b8063715018a6116101d85780638da5cb5b116101a75780639f0d5f271161018c5780639f0d5f27146103a9578063a1ae8490146103bc578063a26db1a7146103cf57600080fd5b80638da5cb5b1461039057806399d32fc4146103a157600080fd5b8063715018a61461034c5780637dc20382146103545780637f0eec02146103755780638456cb591461038857600080fd5b80633f4ba83a1161022f5780634b0bddd2116102145780634b0bddd21461031b5780635c975abb1461032e57806368078eed1461033957600080fd5b80633f4ba83a1461030057806347e7ef241461030857600080fd5b80630426d97514610261578063217a4b701461027657806324d7806c146102ba57806339e7fddc146102ed575b600080fd5b61027461026f366004614bb8565b610623565b005b61029d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6102dd6102c8366004614bf1565b60046020526000908152604090205460ff1681565b60405190151581526020016102b1565b60075461029d906001600160a01b031681565b6102746107f6565b610274610316366004614c0e565b610874565b610274610329366004614c48565b610a9e565b60025460ff166102dd565b610274610347366004614c76565b610be5565b610274610d18565b610367610362366004614cab565b610d2a565b6040519081526020016102b1565b610274610383366004614d99565b610dda565b610274610ee5565b6000546001600160a01b031661029d565b610274610f61565b6102746103b7366004614bf1565b611058565b6102746103ca366004614bf1565b611156565b6103e26103dd366004614bf1565b61122c565b60408051825167ffffffffffffffff908116825260208085015182169083015292820151909216908201526060016102b1565b610274610423366004614bf1565b61140d565b610274610436366004614bf1565b611547565b61029d610449366004614bf1565b6008602052600090815260409020546001600160a01b031681565b6104c0610472366004614bf1565b60056020526000908152604090205477ffffffffffffffffffffffffffffffffffffffffffffffff8116907801000000000000000000000000000000000000000000000000900461ffff1682565b6040805177ffffffffffffffffffffffffffffffffffffffffffffffff909316835261ffff9091166020830152016102b1565b610274610501366004614bf1565b61161d565b60065461029d906001600160a01b031681565b610367610527366004614e4b565b611749565b61027461053a366004614bf1565b6117ee565b61027461054d366004614bf1565b611919565b610367610560366004614bf1565b6119f0565b61036760035481565b61027461057c366004614bf1565b611a55565b61027461058f366004614bb8565b611dc8565b6102746105a2366004614bf1565b611e6f565b6102746105b5366004614c0e565b611efc565b6103676105c8366004614e4b565b612164565b6102746105db366004614bf1565b612351565b6103676105ee366004614bf1565b6001600160a01b031660009081526005602052604090205477ffffffffffffffffffffffffffffffffffffffffffffffff1690565b61062b612402565b6001600160a01b0382166106865760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a2021746f6b656e000000000000000000000000000000000060448201526064015b60405180910390fd5b6001600160a01b0381166106dc5760405162461bcd60e51b815260206004820152601160248201527f576f6f505056323a20216e6577506f6f6c000000000000000000000000000000604482015260640161067d565b6001600160a01b038216600090815260056020526040812080547fffffffffffffffff000000000000000000000000000000000000000000000000169055610723836119f0565b905061073083838361245c565b6040517f9f0d5f270000000000000000000000000000000000000000000000000000000081526001600160a01b038481166004830152831690639f0d5f2790602401600060405180830381600087803b15801561078c57600080fd5b505af11580156107a0573d6000803e3d6000fd5b50505050816001600160a01b0316836001600160a01b03167f18df02dcc52b9c494f391df09661519c0069bd8540141946280399408205ca1a836040516107e991815260200190565b60405180910390a3505050565b6000546001600160a01b031633148061081e57503360009081526004602052604090205460ff165b61086a5760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b6108726125cb565b565b6002600154036108c65760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b60026001556000546001600160a01b03163314806108f357503360009081526004602052604090205460ff165b61093f5760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b600061094a836119f0565b90506109588333308561263b565b600081610964856119f0565b61096e9190614ebb565b9050828110156109c05760405162461bcd60e51b815260206004820152600d60248201527f414d4f554e545f494e5355464600000000000000000000000000000000000000604482015260640161067d565b6001600160a01b0384166000908152600560205260409020546109fe90849077ffffffffffffffffffffffffffffffffffffffffffffffff16614ed2565b6001600160a01b03851660008181526005602090815260409182902080547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff95909516949094179093555185815233927f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f6291015b60405180910390a35050600180555050565b6000546001600160a01b0316331480610ac657503360009081526004602052604090205460ff165b610b125760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b6001600160a01b038216610b685760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b6001600160a01b03821660008181526004602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527f235bc17e7930760029e9f4d860a2a8089976de5b381cf8380fc11c1d88a11133910160405180910390a25050565b6000546001600160a01b0316331480610c0d57503360009081526004602052604090205460ff165b610c595760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b620186a08161ffff161115610cb05760405162461bcd60e51b815260206004820152600560248201527f2172617465000000000000000000000000000000000000000000000000000000604482015260640161067d565b6001600160a01b039091166000908152600560205260409020805461ffff9092167801000000000000000000000000000000000000000000000000027fffffffffffff0000ffffffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b610d20612402565b61087260006127b3565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316876001600160a01b031603610d7957610d72868686868661281b565b9050610dd0565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316866001600160a01b031603610dbf57610d728786868686612ec6565b610dcd878787878787613504565b90505b9695505050505050565b600260015403610e2c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b60026001556000546001600160a01b0316331480610e5957503360009081526004602052604090205460ff165b610ea55760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b805160005b81811015610edc57610ed4838281518110610ec757610ec7614eea565b602002602001015161161d565b600101610eaa565b50506001805550565b6000546001600160a01b0316331480610f0d57503360009081526004602052604090205460ff165b610f595760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b610872613dd2565b600260015403610fb35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b60026001556007546001600160a01b03166110105760405162461bcd60e51b815260206004820152601160248201527f576f6f505056323a202166656541646472000000000000000000000000000000604482015260640161067d565b600380546000909155600754611051907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b031683613e2d565b5060018055565b6000546001600160a01b031633148061108057503360009081526004602052604090205460ff165b6110cc5760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523360048201526111539082906001600160a01b038216906370a0823190602401602060405180830381865afa15801561112f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103169190614f19565b50565b6000546001600160a01b031633148061117e57503360009081526004602052604090205460ff165b6111ca5760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b600680547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040517f59ddfdd1bf7e3ea08a07e8aaa1fe2ce9c840fab69fe5ede6ea727a45eb42fc6690600090a250565b6040805160608082018352600080835260208301819052828401528251908101928390526006547fd449a832000000000000000000000000000000000000000000000000000000009093526001600160a01b0384811660648301529192909182911663d449a83260848301602060405180830381865afa1580156112b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d89190614f32565b6112e390600a615071565b67ffffffffffffffff1681526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611350573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113749190614f32565b61137f90600a615071565b67ffffffffffffffff168152602001836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f09190614f32565b6113fb90600a615071565b67ffffffffffffffff16905292915050565b60026001540361145f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b60026001556000546001600160a01b031633148061148c57503360009081526004602052604090205460ff165b6114d85760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b6114e1816119f0565b6001600160a01b0391909116600090815260056020526040902080547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff90921691909117905560018055565b6000546001600160a01b031633148061156f57503360009081526004602052604090205460ff165b6115bb5760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040517f76f97b3f5ffcc8d8d9577d141751a7bed446b46d837fbc81b5c01c165bbfbbf490600090a250565b60026001540361166f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b60026001556000546001600160a01b031633148061169c57503360009081526004602052604090205460ff165b6116e85760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b611051816116fe6000546001600160a01b031690565b6001600160a01b03841660009081526005602052604090205477ffffffffffffffffffffffffffffffffffffffffffffffff1661173a856119f0565b6117449190614ebb565b613e2d565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316036117955761178e8383613f95565b90506117e7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316036117d85761178e84836140a1565b6117e38484846141ac565b5090505b9392505050565b6117f6612402565b8060086000836001600160a01b0316631f1fcd516040518163ffffffff1660e01b81526004016020604051808303816000875af115801561183b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061185f919061508a565b6001600160a01b0390811682526020808301939093526040918201600090812080547fffffffffffffffffffffffff000000000000000000000000000000000000000016958316959095179094558416808452600483529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915590519081527f235bc17e7930760029e9f4d860a2a8089976de5b381cf8380fc11c1d88a11133910160405180910390a250565b611921612402565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0382160161195b57611153334761445a565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156119bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119df9190614f19565b90506119ec823383613e2d565b5050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031614611a3957611a3482614542565b611a4f565b600354611a4583614542565b611a4f9190614ebb565b92915050565b600260015403611aa75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b60026001556000546001600160a01b0316331480611ad457503360009081526004602052604090205460ff165b611b205760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b6001600160a01b038082166000908152600860205260408082205481517fa373ed4e0000000000000000000000000000000000000000000000000000000081529151931692839263a373ed4e926004808201939182900301818387803b158015611b8957600080fd5b505af1158015611b9d573d6000803e3d6000fd5b505050506000816001600160a01b031663f077cbab6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611be1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c059190614f19565b90506000826001600160a01b0316631f1fcd516040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c6d919061508a565b90508115611d83576001600160a01b038116600090815260056020526040902054611cb390839077ffffffffffffffffffffffffffffffffffffffffffffffff16614ebb565b6001600160a01b038216600090815260056020526040902080547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff92909216919091179055611d1d81848461245c565b826001600160a01b031663c1ae359a6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611d5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d819190614f19565b505b826001600160a01b0316816001600160a01b03167f9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb84604051610a8c91815260200190565b611dd0612402565b6006546001600160a01b031615611e295760405162461bcd60e51b815260206004820152601560248201527f576f6f505056323a20494e49545f494e56414c49440000000000000000000000604482015260640161067d565b600680546001600160a01b039384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b611e77612402565b6001600160a01b038116611ef35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161067d565b611153816127b3565b600260015403611f4e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b60026001556000546001600160a01b0316331480611f7b57503360009081526004602052604090205460ff165b611fc75760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b6001600160a01b03821660009081526005602052604090205477ffffffffffffffffffffffffffffffffffffffffffffffff168111156120495760405162461bcd60e51b815260206004820152601060248201527f576f6f505056323a2021616d6f756e7400000000000000000000000000000000604482015260640161067d565b6001600160a01b03821660009081526005602052604090205461208790829077ffffffffffffffffffffffffffffffffffffffffffffffff16614ebb565b6001600160a01b0383166000908152600560205260409020805477ffffffffffffffffffffffffffffffffffffffffffffffff929092167fffffffffffffffff000000000000000000000000000000000000000000000000909216919091179055612104826120fe6000546001600160a01b031690565b83613e2d565b6000546001600160a01b03166001600160a01b0316826001600160a01b03167f9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb8360405161215491815260200190565b60405180910390a3505060018055565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316036121b0576121a98383613f95565b90506122cf565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316036121f3576121a984836140a1565b60006122008585856141ac565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016600090815260056020526040902054919350915077ffffffffffffffffffffffffffffffffffffffffffffffff168111156122cd5760405162461bcd60e51b815260206004820152602160248201527f576f6f505056323a20494e535546465f51554f54455f464f525f53574150464560448201527f4500000000000000000000000000000000000000000000000000000000000000606482015260840161067d565b505b6001600160a01b03831660009081526005602052604090205477ffffffffffffffffffffffffffffffffffffffffffffffff168111156117e75760405162461bcd60e51b815260206004820152601760248201527f576f6f505056323a20494e535546465f42414c414e4345000000000000000000604482015260640161067d565b6000546001600160a01b031633148061237957503360009081526004602052604090205460ff165b6123c55760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b611153816105b5836001600160a01b031660009081526005602052604090205477ffffffffffffffffffffffffffffffffffffffffffffffff1690565b6000546001600160a01b031633146108725760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161067d565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905291516000928392908716916124e691906150a7565b6000604051808303816000865af19150503d8060008114612523576040519150601f19603f3d011682016040523d82523d6000602084013e612528565b606091505b509150915081801561255257508051158061255257508080602001905181019061255291906150e2565b6125c45760405162461bcd60e51b815260206004820152602b60248201527f5472616e7366657248656c7065723a3a73616665417070726f76653a2061707060448201527f726f7665206661696c6564000000000000000000000000000000000000000000606482015260840161067d565b5050505050565b6125d3614683565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905291516000928392908816916126cd91906150a7565b6000604051808303816000865af19150503d806000811461270a576040519150601f19603f3d011682016040523d82523d6000602084013e61270f565b606091505b509150915081801561273957508051158061273957508080602001905181019061273991906150e2565b6127ab5760405162461bcd60e51b815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a20747260448201527f616e7366657246726f6d206661696c6564000000000000000000000000000000606482015260840161067d565b505050505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060026001540361286f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b600260015561287c6146d5565b6001600160a01b0386166128d25760405162461bcd60e51b815260206004820152601360248201527f576f6f505056323a202162617365546f6b656e00000000000000000000000000604482015260640161067d565b6001600160a01b0383166129285760405162461bcd60e51b815260206004820152600c60248201527f576f6f505056323a2021746f0000000000000000000000000000000000000000604482015260640161067d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316866001600160a01b0316036129a95760405162461bcd60e51b815260206004820152601e60248201527f576f6f505056323a2062617365546f6b656e3d3d71756f7465546f6b656e0000604482015260640161067d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b038116600090815260056020526040902054869177ffffffffffffffffffffffffffffffffffffffffffffffff90911690612a0b906119f0565b612a159190614ebb565b1015612a895760405162461bcd60e51b815260206004820152602160248201527f576f6f505056323a2051554f54455f42414c414e43455f4e4f545f454e4f554760448201527f4800000000000000000000000000000000000000000000000000000000000000606482015260840161067d565b6001600160a01b038616600090815260056020526040812054620186a090612ad1907801000000000000000000000000000000000000000000000000900461ffff16886150ff565b612adb919061516b565b9050612ae78187614ebb565b955080600354612af79190614ed2565b6003556006546040517f31e658a50000000000000000000000000000000000000000000000000000000081526001600160a01b03898116600483015260009283929116906331e658a590602401608060405180830381865afa158015612b61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b85919061519c565b9050612b92898983614728565b6006546040517fd5bade070000000000000000000000000000000000000000000000000000000081526001600160a01b038d811660048301526fffffffffffffffffffffffffffffffff84166024830152939750919450919091169063d5bade0790604401600060405180830381600087803b158015612c1157600080fd5b505af1158015612c25573d6000803e3d6000fd5b5050505086841015612c9e5760405162461bcd60e51b8152602060048201526024808201527f576f6f505056323a2062617365416d6f756e745f4c545f6d696e42617365416d60448201527f6f756e7400000000000000000000000000000000000000000000000000000000606482015260840161067d565b50506001600160a01b038716600090815260056020526040902054612cde90839077ffffffffffffffffffffffffffffffffffffffffffffffff16614ebb565b6001600160a01b0388811660009081526005602052604080822080547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff9586161790557f000000000000000000000000000000000000000000000000000000000000000090921681522054612d6f91889116614ed2565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166000908152600560205260409020805477ffffffffffffffffffffffffffffffffffffffffffffffff939093167fffffffffffffffff0000000000000000000000000000000000000000000000009093169290921790915584163014612e0557612e05878584613e2d565b836001600160a01b0316876001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f0e8e403c2d36126272b08c75823e988381d9dc47f2f0a9a080d95f891d95c469848a612e709190614ed2565b863389612e7d898f614ed2565b6040805195865260208601949094526001600160a01b039283168585015291166060840152608083015260a08201879052519081900360c00190a4506001805595945050505050565b6000600260015403612f1a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b6002600155612f276146d5565b6001600160a01b038616612f7d5760405162461bcd60e51b815260206004820152601360248201527f576f6f505056323a202162617365546f6b656e00000000000000000000000000604482015260640161067d565b6001600160a01b038316612fd35760405162461bcd60e51b815260206004820152600c60248201527f576f6f505056323a2021746f0000000000000000000000000000000000000000604482015260640161067d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316866001600160a01b0316036130545760405162461bcd60e51b815260206004820152601e60248201527f576f6f505056323a2062617365546f6b656e3d3d71756f7465546f6b656e0000604482015260640161067d565b6001600160a01b038616600090815260056020526040902054859077ffffffffffffffffffffffffffffffffffffffffffffffff16613092886119f0565b61309c9190614ebb565b10156130ea5760405162461bcd60e51b815260206004820181905260248201527f576f6f505056323a20424153455f42414c414e43455f4e4f545f454e4f554748604482015260640161067d565b6006546040517f31e658a50000000000000000000000000000000000000000000000000000000081526001600160a01b03888116600483015260009283929116906331e658a590602401608060405180830381865afa158015613151573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613175919061519c565b9050613182888883614922565b6006546040517fd5bade070000000000000000000000000000000000000000000000000000000081526001600160a01b038c811660048301526fffffffffffffffffffffffffffffffff84166024830152939650919450919091169063d5bade0790604401600060405180830381600087803b15801561320157600080fd5b505af1158015613215573d6000803e3d6000fd5b505050506001600160a01b038816600090815260056020526040812054909250620186a09150613265907801000000000000000000000000000000000000000000000000900461ffff16846150ff565b61326f919061516b565b905061327b8183614ebb565b9150848210156132f35760405162461bcd60e51b815260206004820152602660248201527f576f6f505056323a2071756f7465416d6f756e745f4c545f6d696e51756f746560448201527f416d6f756e740000000000000000000000000000000000000000000000000000606482015260840161067d565b806003546133019190614ed2565b6003556001600160a01b03871660009081526005602052604090205461334290879077ffffffffffffffffffffffffffffffffffffffffffffffff16614ed2565b6001600160a01b0388811660009081526005602052604080822080547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff9586161790557f00000000000000000000000000000000000000000000000000000000000000009092168152205482916133d591859116614ebb565b6133df9190614ebb565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166000908152600560205260409020805477ffffffffffffffffffffffffffffffffffffffffffffffff939093167fffffffffffffffff0000000000000000000000000000000000000000000000009093169290921790915584163014613495576134957f00000000000000000000000000000000000000000000000000000000000000008584613e2d565b836001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316886001600160a01b03167f0e8e403c2d36126272b08c75823e988381d9dc47f2f0a9a080d95f891d95c46989863389888a612e7d9190614ed2565b60006002600154036135585760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b60026001556135656146d5565b6001600160a01b038716158015906135af57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316876001600160a01b031614155b6135fb5760405162461bcd60e51b815260206004820152601460248201527f576f6f505056323a202162617365546f6b656e31000000000000000000000000604482015260640161067d565b6001600160a01b0386161580159061364557507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316866001600160a01b031614155b6136915760405162461bcd60e51b815260206004820152601460248201527f576f6f505056323a202162617365546f6b656e32000000000000000000000000604482015260640161067d565b6001600160a01b0383166136e75760405162461bcd60e51b815260206004820152600c60248201527f576f6f505056323a2021746f0000000000000000000000000000000000000000604482015260640161067d565b6001600160a01b038716600090815260056020526040902054859077ffffffffffffffffffffffffffffffffffffffffffffffff16613725896119f0565b61372f9190614ebb565b101561377d5760405162461bcd60e51b815260206004820152601760248201527f576f6f505056323a202142415345315f42414c414e4345000000000000000000604482015260640161067d565b6006546040517f31e658a50000000000000000000000000000000000000000000000000000000081526001600160a01b03898116600483015260009216906331e658a590602401608060405180830381865afa1580156137e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613805919061519c565b6006546040517f31e658a50000000000000000000000000000000000000000000000000000000081526001600160a01b038a81166004830152929350600092909116906331e658a590602401608060405180830381865afa15801561386e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613892919061519c565b9050600080600060026138ad86602001518660200151614b62565b6138b79190615232565b6001600160a01b03808e1660009081526005602052604080822054928f168252812054929350916139109161ffff7801000000000000000000000000000000000000000000000000918290048116929190910416614b8c565b67ffffffffffffffff83166020808901829052870152905060006139358e8d89614922565b8092508195505050600660009054906101000a90046001600160a01b03166001600160a01b031663d5bade078f836040518363ffffffff1660e01b81526004016139a69291906001600160a01b039290921682526fffffffffffffffffffffffffffffffff16602082015260400190565b600060405180830381600087803b1580156139c057600080fd5b505af11580156139d4573d6000803e3d6000fd5b50505050620186a08261ffff16856139ec91906150ff565b6139f6919061516b565b94505050508181613a079190614ebb565b905081600354613a179190614ed2565b6003556001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016600090815260056020526040902054613a7890839077ffffffffffffffffffffffffffffffffffffffffffffffff16614ebb565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811660009081526005602052604080822080547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff958616179055918e1681522054613b09918b9116614ed2565b6001600160a01b038c16600090815260056020526040812080547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff9390931692909217909155613b748b8386614728565b6006546040517fd5bade070000000000000000000000000000000000000000000000000000000081526001600160a01b038f811660048301526fffffffffffffffffffffffffffffffff84166024830152939950919350919091169063d5bade0790604401600060405180830381600087803b158015613bf357600080fd5b505af1158015613c07573d6000803e3d6000fd5b5050505088861015613c815760405162461bcd60e51b815260206004820152602660248201527f576f6f505056323a206261736532416d6f756e745f4c545f6d696e426173653260448201527f416d6f756e740000000000000000000000000000000000000000000000000000606482015260840161067d565b506001600160a01b038a16600090815260056020526040902054613cc090869077ffffffffffffffffffffffffffffffffffffffffffffffff16614ebb565b6001600160a01b038b8116600090815260056020526040902080547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff93909316929092179091553090881614613d3557613d358a8887613e2d565b866001600160a01b03168a6001600160a01b03168c6001600160a01b03167f0e8e403c2d36126272b08c75823e988381d9dc47f2f0a9a080d95f891d95c4698c89338c8989613d849190614ed2565b6040805195865260208601949094526001600160a01b039283168585015291166060840152608083015260a08201889052519081900360c00190a45050600180555090979650505050505050565b613dda6146d5565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861261e3390565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790529151600092839290871691613eb791906150a7565b6000604051808303816000865af19150503d8060008114613ef4576040519150601f19603f3d011682016040523d82523d6000602084013e613ef9565b606091505b5091509150818015613f23575080511580613f23575080806020019051810190613f2391906150e2565b6125c45760405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c656400000000000000000000000000000000000000606482015260840161067d565b6000613f9f6146d5565b6001600160a01b038316600090815260056020526040812054620186a090613fe7907801000000000000000000000000000000000000000000000000900461ffff16856150ff565b613ff1919061516b565b9050613ffd8184614ebb565b6006546040517f31e658a50000000000000000000000000000000000000000000000000000000081526001600160a01b038781166004830152929550600092909116906331e658a590602401608060405180830381865afa158015614066573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061408a919061519c565b9050614097858583614728565b5095945050505050565b60006140ab6146d5565b6006546040517f31e658a50000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015260009216906331e658a590602401608060405180830381865afa15801561410f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614133919061519c565b9050614140848483614922565b506001600160a01b03851660009081526005602052604081205491935090620186a09061418d907801000000000000000000000000000000000000000000000000900461ffff16856150ff565b614197919061516b565b90506141a38184614ebb565b95945050505050565b6000806141b76146d5565b6001600160a01b03851615806141d457506001600160a01b038416155b8061421057507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316856001600160a01b0316145b8061424c57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316145b1561425c57506000905080614452565b6006546040517f31e658a50000000000000000000000000000000000000000000000000000000081526001600160a01b03878116600483015260009216906331e658a590602401608060405180830381865afa1580156142c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142e4919061519c565b6006546040517f31e658a50000000000000000000000000000000000000000000000000000000081526001600160a01b038881166004830152929350600092909116906331e658a590602401608060405180830381865afa15801561434d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614371919061519c565b90506000600261438984602001518460200151614b62565b6143939190615232565b6001600160a01b03808a1660009081526005602052604080822054928b168252812054929350916143ec9161ffff7801000000000000000000000000000000000000000000000000918290048116929190910416614b8c565b67ffffffffffffffff83166020808701829052850152905060006144118a8987614922565b509050620186a061442661ffff8416836150ff565b614430919061516b565b955061443c8682614ebb565b9050614449898286614728565b50965050505050505b935093915050565b604080516000808252602082019092526001600160a01b03841690839060405161448491906150a7565b60006040518083038185875af1925050503d80600081146144c1576040519150601f19603f3d011682016040523d82523d6000602084013e6144c6565b606091505b505090508061453d5760405162461bcd60e51b815260206004820152603460248201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60448201527f20455448207472616e73666572206661696c6564000000000000000000000000606482015260840161067d565b505050565b604080513060248083019190915282518083039091018152604490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f70a08231000000000000000000000000000000000000000000000000000000001790529051600091829182916001600160a01b038616916145c791906150a7565b600060405180830381855afa9150503d8060008114614602576040519150601f19603f3d011682016040523d82523d6000602084013e614607565b606091505b509150915081801561461b57506020815110155b6146675760405162461bcd60e51b815260206004820152601160248201527f576f6f505056323a202142414c414e4345000000000000000000000000000000604482015260640161067d565b8080602001905181019061467b9190614f19565b949350505050565b60025460ff166108725760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161067d565b60025460ff16156108725760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161067d565b600080826060015161477c5760405162461bcd60e51b815260206004820152601960248201527f576f6f505056323a20214f5241434c455f4645415349424c4500000000000000604482015260640161067d565b60006147878661122c565b90506000846020015167ffffffffffffffff16826020015167ffffffffffffffff16866040015167ffffffffffffffff16886147c391906150ff565b6147cd919061516b565b6147df90670de0b6b3a7640000614ebb565b6147e99190614ebb565b9050816020015167ffffffffffffffff16670de0b6b3a76400008287600001516fffffffffffffffffffffffffffffffff16856000015167ffffffffffffffff16866040015167ffffffffffffffff168b61484491906150ff565b61484e91906150ff565b614858919061516b565b61486291906150ff565b61486c919061516b565b614876919061516b565b935050670de0b6b3a7640000816020015167ffffffffffffffff1685600001516fffffffffffffffffffffffffffffffff1687876040015167ffffffffffffffff1660026148c491906150ff565b6148ce91906150ff565b60208501516148ef9067ffffffffffffffff16670de0b6b3a76400006150ff565b6148f99190614ed2565b61490391906150ff565b61490d919061516b565b614917919061516b565b915050935093915050565b60008082606001516149765760405162461bcd60e51b815260206004820152601960248201527f576f6f505056323a20214f5241434c455f4645415349424c4500000000000000604482015260640161067d565b60006149818661122c565b90506000846020015167ffffffffffffffff16826000015167ffffffffffffffff16836040015167ffffffffffffffff1687600001516fffffffffffffffffffffffffffffffff1689896040015167ffffffffffffffff166149e391906150ff565b6149ed91906150ff565b6149f7919061516b565b614a01919061516b565b614a1390670de0b6b3a7640000614ebb565b614a1d9190614ebb565b9050816040015167ffffffffffffffff16670de0b6b3a764000082846000015167ffffffffffffffff1688600001516fffffffffffffffffffffffffffffffff16866020015167ffffffffffffffff168b614a7891906150ff565b614a8291906150ff565b614a8c919061516b565b614a9691906150ff565b614aa0919061516b565b614aaa919061516b565b935050670de0b6b3a764000084600001516fffffffffffffffffffffffffffffffff16826040015167ffffffffffffffff16836000015167ffffffffffffffff168888600001516fffffffffffffffffffffffffffffffff16896040015167ffffffffffffffff166002614b1e91906150ff565b614b2891906150ff565b614b3291906150ff565b614b3c919061516b565b614b46919061516b565b614b5890670de0b6b3a7640000614ebb565b61490d91906150ff565b60008167ffffffffffffffff168367ffffffffffffffff1611614b8557816117e7565b5090919050565b60008161ffff168361ffff1611614b8557816117e7565b6001600160a01b038116811461115357600080fd5b60008060408385031215614bcb57600080fd5b8235614bd681614ba3565b91506020830135614be681614ba3565b809150509250929050565b600060208284031215614c0357600080fd5b81356117e781614ba3565b60008060408385031215614c2157600080fd5b8235614c2c81614ba3565b946020939093013593505050565b801515811461115357600080fd5b60008060408385031215614c5b57600080fd5b8235614c6681614ba3565b91506020830135614be681614c3a565b60008060408385031215614c8957600080fd5b8235614c9481614ba3565b9150602083013561ffff81168114614be657600080fd5b60008060008060008060c08789031215614cc457600080fd5b8635614ccf81614ba3565b95506020870135614cdf81614ba3565b945060408701359350606087013592506080870135614cfd81614ba3565b915060a0870135614d0d81614ba3565b809150509295509295509295565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715614d9157614d91614d1b565b604052919050565b60006020808385031215614dac57600080fd5b823567ffffffffffffffff80821115614dc457600080fd5b818501915085601f830112614dd857600080fd5b813581811115614dea57614dea614d1b565b8060051b9150614dfb848301614d4a565b8181529183018401918481019088841115614e1557600080fd5b938501935b83851015614e3f5784359250614e2f83614ba3565b8282529385019390850190614e1a565b98975050505050505050565b600080600060608486031215614e6057600080fd5b8335614e6b81614ba3565b92506020840135614e7b81614ba3565b929592945050506040919091013590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015614ecd57614ecd614e8c565b500390565b60008219821115614ee557614ee5614e8c565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215614f2b57600080fd5b5051919050565b600060208284031215614f4457600080fd5b815160ff811681146117e757600080fd5b600181815b80851115614f96578167ffffffffffffffff04821115614f7c57614f7c614e8c565b80851615614f8957918102915b93841c9390800290614f5a565b509250929050565b600082614fad57506001611a4f565b81614fba57506000611a4f565b8160018114614fd05760028114614fda5761500f565b6001915050611a4f565b60ff841115614feb57614feb614e8c565b6001841b915067ffffffffffffffff82111561500957615009614e8c565b50611a4f565b5060208310610133831016604e8410600b8410161715615045575081810a67ffffffffffffffff811115611a3457611a34614e8c565b61504f8383614f55565b8067ffffffffffffffff0482111561506957615069614e8c565b029392505050565b60006117e760ff841667ffffffffffffffff8416614f9e565b60006020828403121561509c57600080fd5b81516117e781614ba3565b6000825160005b818110156150c857602081860181015185830152016150ae565b818111156150d7576000828501525b509190910192915050565b6000602082840312156150f457600080fd5b81516117e781614c3a565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561513757615137614e8c565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261517a5761517a61513c565b500490565b805167ffffffffffffffff8116811461519757600080fd5b919050565b6000608082840312156151ae57600080fd5b6040516080810181811067ffffffffffffffff821117156151d1576151d1614d1b565b60405282516fffffffffffffffffffffffffffffffff811681146151f457600080fd5b81526152026020840161517f565b60208201526152136040840161517f565b6040820152606083015161522681614c3a565b60608201529392505050565b600067ffffffffffffffff8084168061524d5761524d61513c565b9216919091049291505056fea2646970667358221220ca8442632d3c2ec726ce2fc52074782aef1ad1f8470960d5683e6cd0d09e638864736f6c634300080e0033000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061025c5760003560e01c8063a584119411610145578063e3d670d7116100bd578063f2fde38b1161008c578063f58a435f11610071578063f58a435f146105ba578063fa09e630146105cd578063fa75d160146105e057600080fd5b8063f2fde38b14610594578063f3fef3a3146105a757600080fd5b8063e3d670d714610552578063e4d43ec114610565578063ebc80f131461056e578063f09a40161461058157600080fd5b8063bc25cf7711610114578063ce824f19116100f9578063ce824f1914610519578063d6285b7f1461052c578063e1a4e72a1461053f57600080fd5b8063bc25cf77146104f3578063bc8530f91461050657600080fd5b8063a584119414610415578063b2855b4f14610428578063b2e693d31461043b578063ba46ae721461046457600080fd5b8063715018a6116101d85780638da5cb5b116101a75780639f0d5f271161018c5780639f0d5f27146103a9578063a1ae8490146103bc578063a26db1a7146103cf57600080fd5b80638da5cb5b1461039057806399d32fc4146103a157600080fd5b8063715018a61461034c5780637dc20382146103545780637f0eec02146103755780638456cb591461038857600080fd5b80633f4ba83a1161022f5780634b0bddd2116102145780634b0bddd21461031b5780635c975abb1461032e57806368078eed1461033957600080fd5b80633f4ba83a1461030057806347e7ef241461030857600080fd5b80630426d97514610261578063217a4b701461027657806324d7806c146102ba57806339e7fddc146102ed575b600080fd5b61027461026f366004614bb8565b610623565b005b61029d7f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e81565b6040516001600160a01b0390911681526020015b60405180910390f35b6102dd6102c8366004614bf1565b60046020526000908152604090205460ff1681565b60405190151581526020016102b1565b60075461029d906001600160a01b031681565b6102746107f6565b610274610316366004614c0e565b610874565b610274610329366004614c48565b610a9e565b60025460ff166102dd565b610274610347366004614c76565b610be5565b610274610d18565b610367610362366004614cab565b610d2a565b6040519081526020016102b1565b610274610383366004614d99565b610dda565b610274610ee5565b6000546001600160a01b031661029d565b610274610f61565b6102746103b7366004614bf1565b611058565b6102746103ca366004614bf1565b611156565b6103e26103dd366004614bf1565b61122c565b60408051825167ffffffffffffffff908116825260208085015182169083015292820151909216908201526060016102b1565b610274610423366004614bf1565b61140d565b610274610436366004614bf1565b611547565b61029d610449366004614bf1565b6008602052600090815260409020546001600160a01b031681565b6104c0610472366004614bf1565b60056020526000908152604090205477ffffffffffffffffffffffffffffffffffffffffffffffff8116907801000000000000000000000000000000000000000000000000900461ffff1682565b6040805177ffffffffffffffffffffffffffffffffffffffffffffffff909316835261ffff9091166020830152016102b1565b610274610501366004614bf1565b61161d565b60065461029d906001600160a01b031681565b610367610527366004614e4b565b611749565b61027461053a366004614bf1565b6117ee565b61027461054d366004614bf1565b611919565b610367610560366004614bf1565b6119f0565b61036760035481565b61027461057c366004614bf1565b611a55565b61027461058f366004614bb8565b611dc8565b6102746105a2366004614bf1565b611e6f565b6102746105b5366004614c0e565b611efc565b6103676105c8366004614e4b565b612164565b6102746105db366004614bf1565b612351565b6103676105ee366004614bf1565b6001600160a01b031660009081526005602052604090205477ffffffffffffffffffffffffffffffffffffffffffffffff1690565b61062b612402565b6001600160a01b0382166106865760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a2021746f6b656e000000000000000000000000000000000060448201526064015b60405180910390fd5b6001600160a01b0381166106dc5760405162461bcd60e51b815260206004820152601160248201527f576f6f505056323a20216e6577506f6f6c000000000000000000000000000000604482015260640161067d565b6001600160a01b038216600090815260056020526040812080547fffffffffffffffff000000000000000000000000000000000000000000000000169055610723836119f0565b905061073083838361245c565b6040517f9f0d5f270000000000000000000000000000000000000000000000000000000081526001600160a01b038481166004830152831690639f0d5f2790602401600060405180830381600087803b15801561078c57600080fd5b505af11580156107a0573d6000803e3d6000fd5b50505050816001600160a01b0316836001600160a01b03167f18df02dcc52b9c494f391df09661519c0069bd8540141946280399408205ca1a836040516107e991815260200190565b60405180910390a3505050565b6000546001600160a01b031633148061081e57503360009081526004602052604090205460ff165b61086a5760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b6108726125cb565b565b6002600154036108c65760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b60026001556000546001600160a01b03163314806108f357503360009081526004602052604090205460ff165b61093f5760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b600061094a836119f0565b90506109588333308561263b565b600081610964856119f0565b61096e9190614ebb565b9050828110156109c05760405162461bcd60e51b815260206004820152600d60248201527f414d4f554e545f494e5355464600000000000000000000000000000000000000604482015260640161067d565b6001600160a01b0384166000908152600560205260409020546109fe90849077ffffffffffffffffffffffffffffffffffffffffffffffff16614ed2565b6001600160a01b03851660008181526005602090815260409182902080547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff95909516949094179093555185815233927f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f6291015b60405180910390a35050600180555050565b6000546001600160a01b0316331480610ac657503360009081526004602052604090205460ff165b610b125760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b6001600160a01b038216610b685760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b6001600160a01b03821660008181526004602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527f235bc17e7930760029e9f4d860a2a8089976de5b381cf8380fc11c1d88a11133910160405180910390a25050565b6000546001600160a01b0316331480610c0d57503360009081526004602052604090205460ff165b610c595760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b620186a08161ffff161115610cb05760405162461bcd60e51b815260206004820152600560248201527f2172617465000000000000000000000000000000000000000000000000000000604482015260640161067d565b6001600160a01b039091166000908152600560205260409020805461ffff9092167801000000000000000000000000000000000000000000000000027fffffffffffff0000ffffffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b610d20612402565b61087260006127b3565b60007f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b0316876001600160a01b031603610d7957610d72868686868661281b565b9050610dd0565b7f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b0316866001600160a01b031603610dbf57610d728786868686612ec6565b610dcd878787878787613504565b90505b9695505050505050565b600260015403610e2c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b60026001556000546001600160a01b0316331480610e5957503360009081526004602052604090205460ff165b610ea55760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b805160005b81811015610edc57610ed4838281518110610ec757610ec7614eea565b602002602001015161161d565b600101610eaa565b50506001805550565b6000546001600160a01b0316331480610f0d57503360009081526004602052604090205460ff165b610f595760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b610872613dd2565b600260015403610fb35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b60026001556007546001600160a01b03166110105760405162461bcd60e51b815260206004820152601160248201527f576f6f505056323a202166656541646472000000000000000000000000000000604482015260640161067d565b600380546000909155600754611051907f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e906001600160a01b031683613e2d565b5060018055565b6000546001600160a01b031633148061108057503360009081526004602052604090205460ff165b6110cc5760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523360048201526111539082906001600160a01b038216906370a0823190602401602060405180830381865afa15801561112f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103169190614f19565b50565b6000546001600160a01b031633148061117e57503360009081526004602052604090205460ff165b6111ca5760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b600680547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040517f59ddfdd1bf7e3ea08a07e8aaa1fe2ce9c840fab69fe5ede6ea727a45eb42fc6690600090a250565b6040805160608082018352600080835260208301819052828401528251908101928390526006547fd449a832000000000000000000000000000000000000000000000000000000009093526001600160a01b0384811660648301529192909182911663d449a83260848301602060405180830381865afa1580156112b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d89190614f32565b6112e390600a615071565b67ffffffffffffffff1681526020017f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611350573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113749190614f32565b61137f90600a615071565b67ffffffffffffffff168152602001836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f09190614f32565b6113fb90600a615071565b67ffffffffffffffff16905292915050565b60026001540361145f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b60026001556000546001600160a01b031633148061148c57503360009081526004602052604090205460ff165b6114d85760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b6114e1816119f0565b6001600160a01b0391909116600090815260056020526040902080547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff90921691909117905560018055565b6000546001600160a01b031633148061156f57503360009081526004602052604090205460ff165b6115bb5760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040517f76f97b3f5ffcc8d8d9577d141751a7bed446b46d837fbc81b5c01c165bbfbbf490600090a250565b60026001540361166f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b60026001556000546001600160a01b031633148061169c57503360009081526004602052604090205460ff165b6116e85760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b611051816116fe6000546001600160a01b031690565b6001600160a01b03841660009081526005602052604090205477ffffffffffffffffffffffffffffffffffffffffffffffff1661173a856119f0565b6117449190614ebb565b613e2d565b60007f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b0316846001600160a01b0316036117955761178e8383613f95565b90506117e7565b7f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b0316836001600160a01b0316036117d85761178e84836140a1565b6117e38484846141ac565b5090505b9392505050565b6117f6612402565b8060086000836001600160a01b0316631f1fcd516040518163ffffffff1660e01b81526004016020604051808303816000875af115801561183b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061185f919061508a565b6001600160a01b0390811682526020808301939093526040918201600090812080547fffffffffffffffffffffffff000000000000000000000000000000000000000016958316959095179094558416808452600483529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915590519081527f235bc17e7930760029e9f4d860a2a8089976de5b381cf8380fc11c1d88a11133910160405180910390a250565b611921612402565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0382160161195b57611153334761445a565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156119bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119df9190614f19565b90506119ec823383613e2d565b5050565b60007f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b0316826001600160a01b031614611a3957611a3482614542565b611a4f565b600354611a4583614542565b611a4f9190614ebb565b92915050565b600260015403611aa75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b60026001556000546001600160a01b0316331480611ad457503360009081526004602052604090205460ff165b611b205760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b6001600160a01b038082166000908152600860205260408082205481517fa373ed4e0000000000000000000000000000000000000000000000000000000081529151931692839263a373ed4e926004808201939182900301818387803b158015611b8957600080fd5b505af1158015611b9d573d6000803e3d6000fd5b505050506000816001600160a01b031663f077cbab6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611be1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c059190614f19565b90506000826001600160a01b0316631f1fcd516040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c6d919061508a565b90508115611d83576001600160a01b038116600090815260056020526040902054611cb390839077ffffffffffffffffffffffffffffffffffffffffffffffff16614ebb565b6001600160a01b038216600090815260056020526040902080547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff92909216919091179055611d1d81848461245c565b826001600160a01b031663c1ae359a6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611d5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d819190614f19565b505b826001600160a01b0316816001600160a01b03167f9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb84604051610a8c91815260200190565b611dd0612402565b6006546001600160a01b031615611e295760405162461bcd60e51b815260206004820152601560248201527f576f6f505056323a20494e49545f494e56414c49440000000000000000000000604482015260640161067d565b600680546001600160a01b039384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b611e77612402565b6001600160a01b038116611ef35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161067d565b611153816127b3565b600260015403611f4e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b60026001556000546001600160a01b0316331480611f7b57503360009081526004602052604090205460ff165b611fc75760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b6001600160a01b03821660009081526005602052604090205477ffffffffffffffffffffffffffffffffffffffffffffffff168111156120495760405162461bcd60e51b815260206004820152601060248201527f576f6f505056323a2021616d6f756e7400000000000000000000000000000000604482015260640161067d565b6001600160a01b03821660009081526005602052604090205461208790829077ffffffffffffffffffffffffffffffffffffffffffffffff16614ebb565b6001600160a01b0383166000908152600560205260409020805477ffffffffffffffffffffffffffffffffffffffffffffffff929092167fffffffffffffffff000000000000000000000000000000000000000000000000909216919091179055612104826120fe6000546001600160a01b031690565b83613e2d565b6000546001600160a01b03166001600160a01b0316826001600160a01b03167f9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb8360405161215491815260200190565b60405180910390a3505060018055565b60007f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b0316846001600160a01b0316036121b0576121a98383613f95565b90506122cf565b7f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b0316836001600160a01b0316036121f3576121a984836140a1565b60006122008585856141ac565b6001600160a01b037f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e16600090815260056020526040902054919350915077ffffffffffffffffffffffffffffffffffffffffffffffff168111156122cd5760405162461bcd60e51b815260206004820152602160248201527f576f6f505056323a20494e535546465f51554f54455f464f525f53574150464560448201527f4500000000000000000000000000000000000000000000000000000000000000606482015260840161067d565b505b6001600160a01b03831660009081526005602052604090205477ffffffffffffffffffffffffffffffffffffffffffffffff168111156117e75760405162461bcd60e51b815260206004820152601760248201527f576f6f505056323a20494e535546465f42414c414e4345000000000000000000604482015260640161067d565b6000546001600160a01b031633148061237957503360009081526004602052604090205460ff165b6123c55760405162461bcd60e51b815260206004820152600f60248201527f576f6f505056323a202161646d696e0000000000000000000000000000000000604482015260640161067d565b611153816105b5836001600160a01b031660009081526005602052604090205477ffffffffffffffffffffffffffffffffffffffffffffffff1690565b6000546001600160a01b031633146108725760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161067d565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905291516000928392908716916124e691906150a7565b6000604051808303816000865af19150503d8060008114612523576040519150601f19603f3d011682016040523d82523d6000602084013e612528565b606091505b509150915081801561255257508051158061255257508080602001905181019061255291906150e2565b6125c45760405162461bcd60e51b815260206004820152602b60248201527f5472616e7366657248656c7065723a3a73616665417070726f76653a2061707060448201527f726f7665206661696c6564000000000000000000000000000000000000000000606482015260840161067d565b5050505050565b6125d3614683565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905291516000928392908816916126cd91906150a7565b6000604051808303816000865af19150503d806000811461270a576040519150601f19603f3d011682016040523d82523d6000602084013e61270f565b606091505b509150915081801561273957508051158061273957508080602001905181019061273991906150e2565b6127ab5760405162461bcd60e51b815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a20747260448201527f616e7366657246726f6d206661696c6564000000000000000000000000000000606482015260840161067d565b505050505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060026001540361286f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b600260015561287c6146d5565b6001600160a01b0386166128d25760405162461bcd60e51b815260206004820152601360248201527f576f6f505056323a202162617365546f6b656e00000000000000000000000000604482015260640161067d565b6001600160a01b0383166129285760405162461bcd60e51b815260206004820152600c60248201527f576f6f505056323a2021746f0000000000000000000000000000000000000000604482015260640161067d565b7f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b0316866001600160a01b0316036129a95760405162461bcd60e51b815260206004820152601e60248201527f576f6f505056323a2062617365546f6b656e3d3d71756f7465546f6b656e0000604482015260640161067d565b7f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b038116600090815260056020526040902054869177ffffffffffffffffffffffffffffffffffffffffffffffff90911690612a0b906119f0565b612a159190614ebb565b1015612a895760405162461bcd60e51b815260206004820152602160248201527f576f6f505056323a2051554f54455f42414c414e43455f4e4f545f454e4f554760448201527f4800000000000000000000000000000000000000000000000000000000000000606482015260840161067d565b6001600160a01b038616600090815260056020526040812054620186a090612ad1907801000000000000000000000000000000000000000000000000900461ffff16886150ff565b612adb919061516b565b9050612ae78187614ebb565b955080600354612af79190614ed2565b6003556006546040517f31e658a50000000000000000000000000000000000000000000000000000000081526001600160a01b03898116600483015260009283929116906331e658a590602401608060405180830381865afa158015612b61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b85919061519c565b9050612b92898983614728565b6006546040517fd5bade070000000000000000000000000000000000000000000000000000000081526001600160a01b038d811660048301526fffffffffffffffffffffffffffffffff84166024830152939750919450919091169063d5bade0790604401600060405180830381600087803b158015612c1157600080fd5b505af1158015612c25573d6000803e3d6000fd5b5050505086841015612c9e5760405162461bcd60e51b8152602060048201526024808201527f576f6f505056323a2062617365416d6f756e745f4c545f6d696e42617365416d60448201527f6f756e7400000000000000000000000000000000000000000000000000000000606482015260840161067d565b50506001600160a01b038716600090815260056020526040902054612cde90839077ffffffffffffffffffffffffffffffffffffffffffffffff16614ebb565b6001600160a01b0388811660009081526005602052604080822080547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff9586161790557f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e90921681522054612d6f91889116614ed2565b6001600160a01b037f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e81166000908152600560205260409020805477ffffffffffffffffffffffffffffffffffffffffffffffff939093167fffffffffffffffff0000000000000000000000000000000000000000000000009093169290921790915584163014612e0557612e05878584613e2d565b836001600160a01b0316876001600160a01b03167f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b03167f0e8e403c2d36126272b08c75823e988381d9dc47f2f0a9a080d95f891d95c469848a612e709190614ed2565b863389612e7d898f614ed2565b6040805195865260208601949094526001600160a01b039283168585015291166060840152608083015260a08201879052519081900360c00190a4506001805595945050505050565b6000600260015403612f1a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b6002600155612f276146d5565b6001600160a01b038616612f7d5760405162461bcd60e51b815260206004820152601360248201527f576f6f505056323a202162617365546f6b656e00000000000000000000000000604482015260640161067d565b6001600160a01b038316612fd35760405162461bcd60e51b815260206004820152600c60248201527f576f6f505056323a2021746f0000000000000000000000000000000000000000604482015260640161067d565b7f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b0316866001600160a01b0316036130545760405162461bcd60e51b815260206004820152601e60248201527f576f6f505056323a2062617365546f6b656e3d3d71756f7465546f6b656e0000604482015260640161067d565b6001600160a01b038616600090815260056020526040902054859077ffffffffffffffffffffffffffffffffffffffffffffffff16613092886119f0565b61309c9190614ebb565b10156130ea5760405162461bcd60e51b815260206004820181905260248201527f576f6f505056323a20424153455f42414c414e43455f4e4f545f454e4f554748604482015260640161067d565b6006546040517f31e658a50000000000000000000000000000000000000000000000000000000081526001600160a01b03888116600483015260009283929116906331e658a590602401608060405180830381865afa158015613151573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613175919061519c565b9050613182888883614922565b6006546040517fd5bade070000000000000000000000000000000000000000000000000000000081526001600160a01b038c811660048301526fffffffffffffffffffffffffffffffff84166024830152939650919450919091169063d5bade0790604401600060405180830381600087803b15801561320157600080fd5b505af1158015613215573d6000803e3d6000fd5b505050506001600160a01b038816600090815260056020526040812054909250620186a09150613265907801000000000000000000000000000000000000000000000000900461ffff16846150ff565b61326f919061516b565b905061327b8183614ebb565b9150848210156132f35760405162461bcd60e51b815260206004820152602660248201527f576f6f505056323a2071756f7465416d6f756e745f4c545f6d696e51756f746560448201527f416d6f756e740000000000000000000000000000000000000000000000000000606482015260840161067d565b806003546133019190614ed2565b6003556001600160a01b03871660009081526005602052604090205461334290879077ffffffffffffffffffffffffffffffffffffffffffffffff16614ed2565b6001600160a01b0388811660009081526005602052604080822080547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff9586161790557f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e9092168152205482916133d591859116614ebb565b6133df9190614ebb565b6001600160a01b037f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e81166000908152600560205260409020805477ffffffffffffffffffffffffffffffffffffffffffffffff939093167fffffffffffffffff0000000000000000000000000000000000000000000000009093169290921790915584163014613495576134957f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e8584613e2d565b836001600160a01b03167f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b0316886001600160a01b03167f0e8e403c2d36126272b08c75823e988381d9dc47f2f0a9a080d95f891d95c46989863389888a612e7d9190614ed2565b60006002600154036135585760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b60026001556135656146d5565b6001600160a01b038716158015906135af57507f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b0316876001600160a01b031614155b6135fb5760405162461bcd60e51b815260206004820152601460248201527f576f6f505056323a202162617365546f6b656e31000000000000000000000000604482015260640161067d565b6001600160a01b0386161580159061364557507f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b0316866001600160a01b031614155b6136915760405162461bcd60e51b815260206004820152601460248201527f576f6f505056323a202162617365546f6b656e32000000000000000000000000604482015260640161067d565b6001600160a01b0383166136e75760405162461bcd60e51b815260206004820152600c60248201527f576f6f505056323a2021746f0000000000000000000000000000000000000000604482015260640161067d565b6001600160a01b038716600090815260056020526040902054859077ffffffffffffffffffffffffffffffffffffffffffffffff16613725896119f0565b61372f9190614ebb565b101561377d5760405162461bcd60e51b815260206004820152601760248201527f576f6f505056323a202142415345315f42414c414e4345000000000000000000604482015260640161067d565b6006546040517f31e658a50000000000000000000000000000000000000000000000000000000081526001600160a01b03898116600483015260009216906331e658a590602401608060405180830381865afa1580156137e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613805919061519c565b6006546040517f31e658a50000000000000000000000000000000000000000000000000000000081526001600160a01b038a81166004830152929350600092909116906331e658a590602401608060405180830381865afa15801561386e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613892919061519c565b9050600080600060026138ad86602001518660200151614b62565b6138b79190615232565b6001600160a01b03808e1660009081526005602052604080822054928f168252812054929350916139109161ffff7801000000000000000000000000000000000000000000000000918290048116929190910416614b8c565b67ffffffffffffffff83166020808901829052870152905060006139358e8d89614922565b8092508195505050600660009054906101000a90046001600160a01b03166001600160a01b031663d5bade078f836040518363ffffffff1660e01b81526004016139a69291906001600160a01b039290921682526fffffffffffffffffffffffffffffffff16602082015260400190565b600060405180830381600087803b1580156139c057600080fd5b505af11580156139d4573d6000803e3d6000fd5b50505050620186a08261ffff16856139ec91906150ff565b6139f6919061516b565b94505050508181613a079190614ebb565b905081600354613a179190614ed2565b6003556001600160a01b037f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e16600090815260056020526040902054613a7890839077ffffffffffffffffffffffffffffffffffffffffffffffff16614ebb565b7f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b0390811660009081526005602052604080822080547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff958616179055918e1681522054613b09918b9116614ed2565b6001600160a01b038c16600090815260056020526040812080547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff9390931692909217909155613b748b8386614728565b6006546040517fd5bade070000000000000000000000000000000000000000000000000000000081526001600160a01b038f811660048301526fffffffffffffffffffffffffffffffff84166024830152939950919350919091169063d5bade0790604401600060405180830381600087803b158015613bf357600080fd5b505af1158015613c07573d6000803e3d6000fd5b5050505088861015613c815760405162461bcd60e51b815260206004820152602660248201527f576f6f505056323a206261736532416d6f756e745f4c545f6d696e426173653260448201527f416d6f756e740000000000000000000000000000000000000000000000000000606482015260840161067d565b506001600160a01b038a16600090815260056020526040902054613cc090869077ffffffffffffffffffffffffffffffffffffffffffffffff16614ebb565b6001600160a01b038b8116600090815260056020526040902080547fffffffffffffffff0000000000000000000000000000000000000000000000001677ffffffffffffffffffffffffffffffffffffffffffffffff93909316929092179091553090881614613d3557613d358a8887613e2d565b866001600160a01b03168a6001600160a01b03168c6001600160a01b03167f0e8e403c2d36126272b08c75823e988381d9dc47f2f0a9a080d95f891d95c4698c89338c8989613d849190614ed2565b6040805195865260208601949094526001600160a01b039283168585015291166060840152608083015260a08201889052519081900360c00190a45050600180555090979650505050505050565b613dda6146d5565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861261e3390565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790529151600092839290871691613eb791906150a7565b6000604051808303816000865af19150503d8060008114613ef4576040519150601f19603f3d011682016040523d82523d6000602084013e613ef9565b606091505b5091509150818015613f23575080511580613f23575080806020019051810190613f2391906150e2565b6125c45760405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c656400000000000000000000000000000000000000606482015260840161067d565b6000613f9f6146d5565b6001600160a01b038316600090815260056020526040812054620186a090613fe7907801000000000000000000000000000000000000000000000000900461ffff16856150ff565b613ff1919061516b565b9050613ffd8184614ebb565b6006546040517f31e658a50000000000000000000000000000000000000000000000000000000081526001600160a01b038781166004830152929550600092909116906331e658a590602401608060405180830381865afa158015614066573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061408a919061519c565b9050614097858583614728565b5095945050505050565b60006140ab6146d5565b6006546040517f31e658a50000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015260009216906331e658a590602401608060405180830381865afa15801561410f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614133919061519c565b9050614140848483614922565b506001600160a01b03851660009081526005602052604081205491935090620186a09061418d907801000000000000000000000000000000000000000000000000900461ffff16856150ff565b614197919061516b565b90506141a38184614ebb565b95945050505050565b6000806141b76146d5565b6001600160a01b03851615806141d457506001600160a01b038416155b8061421057507f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b0316856001600160a01b0316145b8061424c57507f000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001600160a01b0316846001600160a01b0316145b1561425c57506000905080614452565b6006546040517f31e658a50000000000000000000000000000000000000000000000000000000081526001600160a01b03878116600483015260009216906331e658a590602401608060405180830381865afa1580156142c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142e4919061519c565b6006546040517f31e658a50000000000000000000000000000000000000000000000000000000081526001600160a01b038881166004830152929350600092909116906331e658a590602401608060405180830381865afa15801561434d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614371919061519c565b90506000600261438984602001518460200151614b62565b6143939190615232565b6001600160a01b03808a1660009081526005602052604080822054928b168252812054929350916143ec9161ffff7801000000000000000000000000000000000000000000000000918290048116929190910416614b8c565b67ffffffffffffffff83166020808701829052850152905060006144118a8987614922565b509050620186a061442661ffff8416836150ff565b614430919061516b565b955061443c8682614ebb565b9050614449898286614728565b50965050505050505b935093915050565b604080516000808252602082019092526001600160a01b03841690839060405161448491906150a7565b60006040518083038185875af1925050503d80600081146144c1576040519150601f19603f3d011682016040523d82523d6000602084013e6144c6565b606091505b505090508061453d5760405162461bcd60e51b815260206004820152603460248201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60448201527f20455448207472616e73666572206661696c6564000000000000000000000000606482015260840161067d565b505050565b604080513060248083019190915282518083039091018152604490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f70a08231000000000000000000000000000000000000000000000000000000001790529051600091829182916001600160a01b038616916145c791906150a7565b600060405180830381855afa9150503d8060008114614602576040519150601f19603f3d011682016040523d82523d6000602084013e614607565b606091505b509150915081801561461b57506020815110155b6146675760405162461bcd60e51b815260206004820152601160248201527f576f6f505056323a202142414c414e4345000000000000000000000000000000604482015260640161067d565b8080602001905181019061467b9190614f19565b949350505050565b60025460ff166108725760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161067d565b60025460ff16156108725760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161067d565b600080826060015161477c5760405162461bcd60e51b815260206004820152601960248201527f576f6f505056323a20214f5241434c455f4645415349424c4500000000000000604482015260640161067d565b60006147878661122c565b90506000846020015167ffffffffffffffff16826020015167ffffffffffffffff16866040015167ffffffffffffffff16886147c391906150ff565b6147cd919061516b565b6147df90670de0b6b3a7640000614ebb565b6147e99190614ebb565b9050816020015167ffffffffffffffff16670de0b6b3a76400008287600001516fffffffffffffffffffffffffffffffff16856000015167ffffffffffffffff16866040015167ffffffffffffffff168b61484491906150ff565b61484e91906150ff565b614858919061516b565b61486291906150ff565b61486c919061516b565b614876919061516b565b935050670de0b6b3a7640000816020015167ffffffffffffffff1685600001516fffffffffffffffffffffffffffffffff1687876040015167ffffffffffffffff1660026148c491906150ff565b6148ce91906150ff565b60208501516148ef9067ffffffffffffffff16670de0b6b3a76400006150ff565b6148f99190614ed2565b61490391906150ff565b61490d919061516b565b614917919061516b565b915050935093915050565b60008082606001516149765760405162461bcd60e51b815260206004820152601960248201527f576f6f505056323a20214f5241434c455f4645415349424c4500000000000000604482015260640161067d565b60006149818661122c565b90506000846020015167ffffffffffffffff16826000015167ffffffffffffffff16836040015167ffffffffffffffff1687600001516fffffffffffffffffffffffffffffffff1689896040015167ffffffffffffffff166149e391906150ff565b6149ed91906150ff565b6149f7919061516b565b614a01919061516b565b614a1390670de0b6b3a7640000614ebb565b614a1d9190614ebb565b9050816040015167ffffffffffffffff16670de0b6b3a764000082846000015167ffffffffffffffff1688600001516fffffffffffffffffffffffffffffffff16866020015167ffffffffffffffff168b614a7891906150ff565b614a8291906150ff565b614a8c919061516b565b614a9691906150ff565b614aa0919061516b565b614aaa919061516b565b935050670de0b6b3a764000084600001516fffffffffffffffffffffffffffffffff16826040015167ffffffffffffffff16836000015167ffffffffffffffff168888600001516fffffffffffffffffffffffffffffffff16896040015167ffffffffffffffff166002614b1e91906150ff565b614b2891906150ff565b614b3291906150ff565b614b3c919061516b565b614b46919061516b565b614b5890670de0b6b3a7640000614ebb565b61490d91906150ff565b60008167ffffffffffffffff168367ffffffffffffffff1611614b8557816117e7565b5090919050565b60008161ffff168361ffff1611614b8557816117e7565b6001600160a01b038116811461115357600080fd5b60008060408385031215614bcb57600080fd5b8235614bd681614ba3565b91506020830135614be681614ba3565b809150509250929050565b600060208284031215614c0357600080fd5b81356117e781614ba3565b60008060408385031215614c2157600080fd5b8235614c2c81614ba3565b946020939093013593505050565b801515811461115357600080fd5b60008060408385031215614c5b57600080fd5b8235614c6681614ba3565b91506020830135614be681614c3a565b60008060408385031215614c8957600080fd5b8235614c9481614ba3565b9150602083013561ffff81168114614be657600080fd5b60008060008060008060c08789031215614cc457600080fd5b8635614ccf81614ba3565b95506020870135614cdf81614ba3565b945060408701359350606087013592506080870135614cfd81614ba3565b915060a0870135614d0d81614ba3565b809150509295509295509295565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715614d9157614d91614d1b565b604052919050565b60006020808385031215614dac57600080fd5b823567ffffffffffffffff80821115614dc457600080fd5b818501915085601f830112614dd857600080fd5b813581811115614dea57614dea614d1b565b8060051b9150614dfb848301614d4a565b8181529183018401918481019088841115614e1557600080fd5b938501935b83851015614e3f5784359250614e2f83614ba3565b8282529385019390850190614e1a565b98975050505050505050565b600080600060608486031215614e6057600080fd5b8335614e6b81614ba3565b92506020840135614e7b81614ba3565b929592945050506040919091013590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015614ecd57614ecd614e8c565b500390565b60008219821115614ee557614ee5614e8c565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215614f2b57600080fd5b5051919050565b600060208284031215614f4457600080fd5b815160ff811681146117e757600080fd5b600181815b80851115614f96578167ffffffffffffffff04821115614f7c57614f7c614e8c565b80851615614f8957918102915b93841c9390800290614f5a565b509250929050565b600082614fad57506001611a4f565b81614fba57506000611a4f565b8160018114614fd05760028114614fda5761500f565b6001915050611a4f565b60ff841115614feb57614feb614e8c565b6001841b915067ffffffffffffffff82111561500957615009614e8c565b50611a4f565b5060208310610133831016604e8410600b8410161715615045575081810a67ffffffffffffffff811115611a3457611a34614e8c565b61504f8383614f55565b8067ffffffffffffffff0482111561506957615069614e8c565b029392505050565b60006117e760ff841667ffffffffffffffff8416614f9e565b60006020828403121561509c57600080fd5b81516117e781614ba3565b6000825160005b818110156150c857602081860181015185830152016150ae565b818111156150d7576000828501525b509190910192915050565b6000602082840312156150f457600080fd5b81516117e781614c3a565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561513757615137614e8c565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261517a5761517a61513c565b500490565b805167ffffffffffffffff8116811461519757600080fd5b919050565b6000608082840312156151ae57600080fd5b6040516080810181811067ffffffffffffffff821117156151d1576151d1614d1b565b60405282516fffffffffffffffffffffffffffffffff811681146151f457600080fd5b81526152026020840161517f565b60208201526152136040840161517f565b6040820152606083015161522681614c3a565b60608201529392505050565b600067ffffffffffffffff8084168061524d5761524d61513c565b9216919091049291505056fea2646970667358221220ca8442632d3c2ec726ce2fc52074782aef1ad1f8470960d5683e6cd0d09e638864736f6c634300080e0033

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

000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e

-----Decoded View---------------
Arg [0] : _quoteToken (address): 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E

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


Block Transaction 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
[ 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.