FTM Price: $0.74 (-3.44%)
Gas: 27 GWei

Contract

0xf6bE9C2627B89d15FEFD7BAB69E627282E9Ad083
 

Overview

FTM Balance

Fantom LogoFantom LogoFantom Logo0 FTM

FTM Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
Value
End Weekly Settl...611810612023-05-01 2:10:16358 days ago1682907016IN
Woo Network: USDC Charger Vault
0 FTM0.44721438210.63542159
Start Weekly Set...611810522023-05-01 2:10:06358 days ago1682907006IN
Woo Network: USDC Charger Vault
0 FTM0.05880966210.02625701
Request Withdraw611143252023-04-30 4:35:36359 days ago1682829336IN
Woo Network: USDC Charger Vault
0 FTM0.07195965215.819619
Approve611142942023-04-30 4:35:03359 days ago1682829303IN
Woo Network: USDC Charger Vault
0 FTM0.01037267212.93882315
Approve611140742023-04-30 4:30:22359 days ago1682829022IN
Woo Network: USDC Charger Vault
0 FTM0.00663812215.74078113
End Weekly Settl...597697122023-04-13 2:10:14376 days ago1681351814IN
Woo Network: USDC Charger Vault
0 FTM0.94061753214.06740614
Start Weekly Set...597697022023-04-13 2:10:05376 days ago1681351805IN
Woo Network: USDC Charger Vault
0 FTM0.05991378213.96938928
Request Withdraw597235182023-04-12 13:15:20377 days ago1681305320IN
Woo Network: USDC Charger Vault
0 FTM0.06046185181.32862345
Approve597233922023-04-12 13:13:25377 days ago1681305205IN
Woo Network: USDC Charger Vault
0 FTM0.00892543183.18730044
Approve585901012023-03-28 19:42:21391 days ago1680032541IN
Woo Network: USDC Charger Vault
0 FTM0.000751230.79350097
Approve585900882023-03-28 19:42:07391 days ago1680032527IN
Woo Network: USDC Charger Vault
0 FTM0.0007515730.79350097
Transfer575303522023-03-13 19:55:13406 days ago1678737313IN
Woo Network: USDC Charger Vault
0 FTM0.00684214137.96042319
End Weekly Settl...573570902023-03-11 2:10:13409 days ago1678500613IN
Woo Network: USDC Charger Vault
0 FTM1.21548966576.76012447
Start Weekly Set...573570782023-03-11 2:10:03409 days ago1678500603IN
Woo Network: USDC Charger Vault
0 FTM0.20774538741.91866497
Request Withdraw572965492023-03-10 6:04:50410 days ago1678428290IN
Woo Network: USDC Charger Vault
0 FTM0.0276515982.6820206
Approve572965242023-03-10 6:04:19410 days ago1678428259IN
Woo Network: USDC Charger Vault
0 FTM0.0038375782.1909709
End Weekly Settl...553845362023-02-09 2:11:07439 days ago1675908667IN
Woo Network: USDC Charger Vault
0 FTM0.0386666585.73137673
Start Weekly Set...553845282023-02-09 2:10:50439 days ago1675908650IN
Woo Network: USDC Charger Vault
0 FTM0.0204263872.96231008
End Weekly Settl...553056142023-02-08 2:11:28440 days ago1675822288IN
Woo Network: USDC Charger Vault
0 FTM0.07199603159.62900964
Start Weekly Set...553056062023-02-08 2:11:19440 days ago1675822279IN
Woo Network: USDC Charger Vault
0 FTM0.06571204234.72109972
End Weekly Settl...553055652023-02-08 2:10:26440 days ago1675822226IN
Woo Network: USDC Charger Vault
0 FTM0.07187633159.36362128
Start Weekly Set...553055562023-02-08 2:10:16440 days ago1675822216IN
Woo Network: USDC Charger Vault
0 FTM0.04463473159.43367303
End Weekly Settl...552350382023-02-07 2:11:09441 days ago1675735869IN
Woo Network: USDC Charger Vault
0 FTM0.020647245.77881976
Start Weekly Set...552350322023-02-07 2:10:54441 days ago1675735854IN
Woo Network: USDC Charger Vault
0 FTM0.03806056135.95097462
End Weekly Settl...551758092023-02-06 2:11:35442 days ago1675649495IN
Woo Network: USDC Charger Vault
0 FTM0.0421323593.4155143
View all transactions

Latest 1 internal transaction

Parent Transaction Hash Block From To Value
489155922022-10-11 7:31:55560 days ago1665473515  Contract Creation0 FTM
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
WooSuperChargerVault

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 18 : WooSuperChargerVault.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.6.12;
pragma experimental ABIEncoderV2;

/*

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

*
* 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 '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@uniswap/lib/contracts/libraries/TransferHelper.sol';
import '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import '@openzeppelin/contracts/utils/EnumerableSet.sol';
import '@openzeppelin/contracts/utils/Pausable.sol';

import '../interfaces/IStrategy.sol';
import '../interfaces/IWETH.sol';
import '../interfaces/IWooAccessManager.sol';
import '../interfaces/IVaultV2.sol';

import './WooWithdrawManager.sol';
import './WooLendingManager.sol';

contract WooSuperChargerVault is ERC20, Ownable, Pausable, ReentrancyGuard {
    using SafeERC20 for IERC20;
    using SafeMath for uint256;
    using EnumerableSet for EnumerableSet.AddressSet;

    event Deposit(address indexed user, uint256 assets, uint256 shares);
    event RequestWithdraw(address indexed user, uint256 assets, uint256 shares);
    event InstantWithdraw(address indexed user, uint256 assets, uint256 shares, uint256 fees);
    event WeeklySettleStarted(address indexed caller, uint256 totalRequestedShares, uint256 weeklyRepayAmount);
    event WeeklySettleEnded(
        address indexed caller,
        uint256 totalBalance,
        uint256 lendingBalance,
        uint256 reserveBalance
    );
    event ReserveVaultMigrated(address indexed user, address indexed oldVault, address indexed newVault);

    event LendingManagerUpdated(address formerLendingManager, address newLendingManager);
    event WithdrawManagerUpdated(address formerWithdrawManager, address newWithdrawManager);
    event InstantWithdrawFeeRateUpdated(uint256 formerFeeRate, uint256 newFeeRate);

    /* ----- State Variables ----- */

    address constant ETH_PLACEHOLDER_ADDR = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    IVaultV2 public reserveVault;
    WooLendingManager public lendingManager;
    WooWithdrawManager public withdrawManager;

    address public immutable want;
    address public immutable weth;
    IWooAccessManager public immutable accessManager;

    mapping(address => uint256) public costSharePrice;
    mapping(address => uint256) public requestedWithdrawShares; // Requested withdrawn amount (in assets, NOT shares)
    uint256 public requestedTotalShares;
    EnumerableSet.AddressSet private requestUsers;

    uint256 public instantWithdrawCap; // Max instant withdraw amount (in assets, per week)
    uint256 public instantWithdrawnAmount; // Withdrawn amout already consumed (in assets, per week)

    bool public isSettling;

    address public treasury = 0x815D4517427Fc940A90A5653cdCEA1544c6283c9;
    uint256 public instantWithdrawFeeRate = 30; // 1 in 10000th. default: 30 -> 0.3%

    constructor(
        address _weth,
        address _want,
        address _accessManager
    )
        public
        ERC20(
            string(abi.encodePacked('WOOFi Super Charger ', ERC20(_want).name())),
            string(abi.encodePacked('we', ERC20(_want).symbol()))
        )
    {
        require(_weth != address(0), 'WooSuperChargerVault: !weth');
        require(_want != address(0), 'WooSuperChargerVault: !want');
        require(_accessManager != address(0), 'WooSuperChargerVault: !accessManager');

        weth = _weth;
        want = _want;
        accessManager = IWooAccessManager(_accessManager);
    }

    function init(
        address _reserveVault,
        address _lendingManager,
        address payable _withdrawManager
    ) external onlyOwner {
        require(_reserveVault != address(0), 'WooSuperChargerVault: !_reserveVault');
        require(_lendingManager != address(0), 'WooSuperChargerVault: !_lendingManager');
        require(_withdrawManager != address(0), 'WooSuperChargerVault: !_withdrawManager');

        reserveVault = IVaultV2(_reserveVault);
        require(reserveVault.want() == want);
        lendingManager = WooLendingManager(_lendingManager);
        withdrawManager = WooWithdrawManager(_withdrawManager);
    }

    modifier onlyAdmin() {
        require(owner() == msg.sender || accessManager.isVaultAdmin(msg.sender), 'WooSuperChargerVault: !ADMIN');
        _;
    }

    modifier onlyLendingManager() {
        require(msg.sender == address(lendingManager), 'WooSuperChargerVault: !lendingManager');
        _;
    }

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

    function deposit(uint256 amount) external payable whenNotPaused nonReentrant {
        // require(amount > 0, 'WooSuperChargerVault: !amount');
        if (amount == 0) {
            return;
        }

        lendingManager.accureInterest();
        uint256 shares = _shares(amount, getPricePerFullShare());
        require(shares > 0, '!shares');

        uint256 sharesBefore = balanceOf(msg.sender);
        uint256 costBefore = costSharePrice[msg.sender];
        uint256 costAfter = (sharesBefore.mul(costBefore).add(amount.mul(1e18))).div(sharesBefore.add(shares));
        costSharePrice[msg.sender] = costAfter;

        if (want == weth) {
            require(msg.value == amount, 'WooSuperChargerVault: msg.value_INSUFFICIENT');
            reserveVault.deposit{value: msg.value}(amount);
        } else {
            TransferHelper.safeTransferFrom(want, msg.sender, address(this), amount);
            TransferHelper.safeApprove(want, address(reserveVault), amount);
            reserveVault.deposit(amount);
        }
        _mint(msg.sender, shares);

        instantWithdrawCap = instantWithdrawCap.add(amount.div(10));

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

    function instantWithdraw(uint256 amount) external whenNotPaused nonReentrant {
        require(amount > 0, 'WooSuperChargerVault: !amount');
        require(!isSettling, 'WooSuperChargerVault: NOT_ALLOWED_IN_SETTLING');

        if (instantWithdrawnAmount >= instantWithdrawCap) {
            // NOTE: no more instant withdraw quota.
            return;
        }

        require(amount <= instantWithdrawCap.sub(instantWithdrawnAmount), 'WooSuperChargerVault: OUT_OF_CAP');
        lendingManager.accureInterest();
        uint256 shares = _sharesUp(amount, getPricePerFullShare());
        _burn(msg.sender, shares);

        uint256 reserveShares = _sharesUp(amount, reserveVault.getPricePerFullShare());
        reserveVault.withdraw(reserveShares);

        uint256 fee = accessManager.isZeroFeeVault(msg.sender) ? 0 : amount.mul(instantWithdrawFeeRate).div(10000);
        if (want == weth) {
            TransferHelper.safeTransferETH(treasury, fee);
            TransferHelper.safeTransferETH(msg.sender, amount.sub(fee));
        } else {
            TransferHelper.safeTransfer(want, treasury, fee);
            TransferHelper.safeTransfer(want, msg.sender, amount.sub(fee));
        }

        instantWithdrawnAmount = instantWithdrawnAmount.add(amount);

        emit InstantWithdraw(msg.sender, amount, reserveShares, fee);
    }

    function requestWithdraw(uint256 amount) external whenNotPaused nonReentrant {
        require(amount > 0, 'WooSuperChargerVault: !amount');
        require(!isSettling, 'WooSuperChargerVault: CANNOT_WITHDRAW_IN_SETTLING');

        lendingManager.accureInterest();
        uint256 shares = _sharesUp(amount, getPricePerFullShare());
        TransferHelper.safeTransferFrom(address(this), msg.sender, address(this), shares);

        requestedWithdrawShares[msg.sender] = requestedWithdrawShares[msg.sender].add(shares);
        requestedTotalShares = requestedTotalShares.add(shares);
        requestUsers.add(msg.sender);

        emit RequestWithdraw(msg.sender, amount, shares);
    }

    function requestedTotalAmount() public view returns (uint256) {
        return _assets(requestedTotalShares);
    }

    function requestedWithdrawAmount(address user) public view returns (uint256) {
        return _assets(requestedWithdrawShares[user]);
    }

    function available() public view returns (uint256) {
        return IERC20(want).balanceOf(address(this));
    }

    function reserveBalance() public view returns (uint256) {
        return _assets(IERC20(address(reserveVault)).balanceOf(address(this)), reserveVault.getPricePerFullShare());
    }

    function lendingBalance() public view returns (uint256) {
        return lendingManager.debtAfterPerfFee();
    }

    // Returns the total balance (assets), which is avaiable + reserve + lending.
    function balance() public view returns (uint256) {
        return available().add(reserveBalance()).add(lendingBalance());
    }

    function getPricePerFullShare() public view returns (uint256) {
        return totalSupply() == 0 ? 1e18 : balance().mul(1e18).div(totalSupply());
    }

    // --- For WooLendingManager --- //

    function maxBorrowableAmount() public view returns (uint256) {
        uint256 resBal = reserveBalance();
        uint256 instWithdrawBal = instantWithdrawCap.sub(instantWithdrawnAmount);
        return resBal > instWithdrawBal ? resBal.sub(instWithdrawBal) : 0;
    }

    function borrowFromLendingManager(uint256 amount, address fundAddr) external onlyLendingManager {
        require(!isSettling, 'IN SETTLING');
        require(amount <= maxBorrowableAmount(), 'INSUFF_AMOUNT_FOR_BORROW');
        uint256 sharesToWithdraw = _sharesUp(amount, reserveVault.getPricePerFullShare());
        reserveVault.withdraw(sharesToWithdraw);
        if (want == weth) {
            IWETH(weth).deposit{value: amount}();
        }
        TransferHelper.safeTransfer(want, fundAddr, amount);
    }

    function repayFromLendingManager(uint256 amount) external onlyLendingManager {
        TransferHelper.safeTransferFrom(want, msg.sender, address(this), amount);
        if (want == weth) {
            IWETH(weth).withdraw(amount);
            reserveVault.deposit{value: amount}(amount);
        } else {
            TransferHelper.safeApprove(want, address(reserveVault), amount);
            reserveVault.deposit(amount);
        }
    }

    // --- Admin operations --- //

    function weeklyNeededAmountForWithdraw() public view returns (uint256) {
        uint256 reserveBal = reserveBalance();
        uint256 requestedAmount = requestedTotalAmount();
        uint256 afterBal = balance().sub(requestedAmount);

        return
            reserveBal >= requestedAmount.add(afterBal.div(10))
                ? 0
                : requestedAmount.add(afterBal.div(10)).sub(reserveBal);
    }

    function startWeeklySettle() external onlyAdmin {
        require(!isSettling, 'IN_SETTLING');
        isSettling = true;
        lendingManager.accureInterest();
        emit WeeklySettleStarted(msg.sender, requestedTotalShares, weeklyNeededAmountForWithdraw());
    }

    function endWeeklySettle() public onlyAdmin {
        require(isSettling, '!SETTLING');
        require(weeklyNeededAmountForWithdraw() == 0, 'WEEKLY_REPAY_NOT_CLEARED');

        uint256 sharePrice = getPricePerFullShare();

        isSettling = false;
        uint256 amount = requestedTotalAmount();

        if (amount != 0) {
            uint256 shares = _sharesUp(amount, reserveVault.getPricePerFullShare());
            reserveVault.withdraw(shares);

            if (want == weth) {
                IWETH(weth).deposit{value: amount}();
            }
            require(available() >= amount);

            TransferHelper.safeApprove(want, address(withdrawManager), amount);
            uint256 length = requestUsers.length();
            for (uint256 i = 0; i < length; i++) {
                address user = requestUsers.at(0);

                withdrawManager.addWithdrawAmount(user, requestedWithdrawShares[user].mul(sharePrice).div(1e18));

                requestedWithdrawShares[user] = 0;
                requestUsers.remove(user);
            }

            _burn(address(this), requestedTotalShares);
            requestedTotalShares = 0;
        }

        instantWithdrawnAmount = 0;

        lendingManager.accureInterest();
        uint256 totalBalance = balance();
        instantWithdrawCap = totalBalance.div(10);

        emit WeeklySettleEnded(msg.sender, totalBalance, lendingBalance(), reserveBalance());
    }

    function migrateReserveVault(address _vault) external onlyOwner {
        require(_vault != address(0), '!_vault');

        uint256 preBal = (want == weth) ? address(this).balance : available();
        reserveVault.withdraw(IERC20(address(reserveVault)).balanceOf(address(this)));
        uint256 afterBal = (want == weth) ? address(this).balance : available();
        uint256 reserveAmount = afterBal.sub(preBal);

        address oldVault = address(reserveVault);
        reserveVault = IVaultV2(_vault);
        require(reserveVault.want() == want, 'INVALID_WANT');
        if (want == weth) {
            reserveVault.deposit{value: reserveAmount}(reserveAmount);
        } else {
            TransferHelper.safeApprove(want, address(reserveVault), reserveAmount);
            reserveVault.deposit(reserveAmount);
        }

        emit ReserveVaultMigrated(msg.sender, oldVault, _vault);
    }

    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);
        }
    }

    function setLendingManager(address _lendingManager) external onlyOwner {
        address formerManager = address(lendingManager);
        lendingManager = WooLendingManager(_lendingManager);
        emit LendingManagerUpdated(formerManager, _lendingManager);
    }

    function setWithdrawManager(address payable _withdrawManager) external onlyOwner {
        address formerManager = address(withdrawManager);
        withdrawManager = WooWithdrawManager(_withdrawManager);
        emit WithdrawManagerUpdated(formerManager, _withdrawManager);
    }

    function setTreasury(address _treasury) external onlyOwner {
        treasury = _treasury;
    }

    function setInstantWithdrawFeeRate(uint256 _feeRate) external onlyOwner {
        uint256 formerFeeRate = instantWithdrawFeeRate;
        instantWithdrawFeeRate = _feeRate;
        emit InstantWithdrawFeeRateUpdated(formerFeeRate, _feeRate);
    }

    function pause() public onlyAdmin {
        _pause();
    }

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

    receive() external payable {}

    function _assets(uint256 shares) private view returns (uint256) {
        return _assets(shares, getPricePerFullShare());
    }

    function _assets(uint256 shares, uint256 sharePrice) private pure returns (uint256) {
        return shares.mul(sharePrice).div(1e18);
    }

    function _shares(uint256 assets, uint256 sharePrice) private pure returns (uint256) {
        return assets.mul(1e18).div(sharePrice);
    }

    function _sharesUp(uint256 assets, uint256 sharePrice) private pure returns (uint256) {
        uint256 shares = assets.mul(1e18).div(sharePrice);
        return _assets(shares, sharePrice) == assets ? shares : shares.add(1);
    }
}

File 2 of 18 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool);

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

File 2 of 18 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../../utils/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";

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

    mapping (address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_) public {
        _name = name_;
        _symbol = symbol_;
        _decimals = 18;
    }

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

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

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

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

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        return true;
    }

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

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

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

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

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

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

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

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

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

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

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

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

    /**
     * @dev Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal virtual {
        _decimals = decimals_;
    }

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

File 2 of 18 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20.sol";
import "../../math/SafeMath.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 SafeMath for uint256;
    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'
        // solhint-disable-next-line max-line-length
        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).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(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
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 2 of 18 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

File 2 of 18 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

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

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 2 of 18 : TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.6.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 2 of 18 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 () internal {
        _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 make 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 2 of 18 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) { // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }


    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}

File 2 of 18 : Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./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 () internal {
        _paused = false;
    }

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

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

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

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

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

File 2 of 18 : IStrategy.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;

/*

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

*
* 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.
*/
interface IStrategy {
    function vault() external view returns (address);

    function want() external view returns (address);

    function beforeDeposit() external;

    function beforeWithdraw() external;

    function deposit() external;

    function withdraw(uint256) external;

    function balanceOf() external view returns (uint256);

    function balanceOfWant() external view returns (uint256);

    function balanceOfPool() external view returns (uint256);

    function harvest() external;

    function retireStrat() external;

    function emergencyExit() external;

    function paused() external view returns (bool);

    function inCaseTokensGetStuck(address stuckToken) external;
}

File 2 of 18 : IWETH.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.6.12;
pragma experimental ABIEncoderV2;

/// @title Wrapped ETH.
/// BSC: https://bscscan.com/address/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c#code
interface IWETH {
    /// @dev Deposit ETH into WETH
    function deposit() external payable;

    /// @dev Transfer WETH to receiver
    /// @param to address of WETH receiver
    /// @param value amount of WETH to transfer
    /// @return get true when succeed, else false
    function transfer(address to, uint256 value) external returns (bool);

    /// @dev Withdraw WETH to ETH
    function withdraw(uint256) external;
}

File 2 of 18 : IWooAccessManager.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.6.12;
pragma experimental ABIEncoderV2;

/*

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

*
* 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 Reward manager interface for WooFi Swap.
/// @notice this is for swap rebate or potential incentive program
interface IWooAccessManager {
    /* ----- Events ----- */

    event FeeAdminUpdated(address indexed feeAdmin, bool flag);

    event VaultAdminUpdated(address indexed vaultAdmin, bool flag);

    event RebateAdminUpdated(address indexed rebateAdmin, bool flag);

    event ZeroFeeVaultUpdated(address indexed vault, bool flag);

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

    function isFeeAdmin(address feeAdmin) external returns (bool);

    function isVaultAdmin(address vaultAdmin) external returns (bool);

    function isRebateAdmin(address rebateAdmin) external returns (bool);

    function isZeroFeeVault(address vault) external returns (bool);

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

    /// @notice Sets feeAdmin
    function setFeeAdmin(address feeAdmin, bool flag) external;

    /// @notice Batch sets feeAdmin
    function batchSetFeeAdmin(address[] calldata feeAdmins, bool[] calldata flags) external;

    /// @notice Sets vaultAdmin
    function setVaultAdmin(address vaultAdmin, bool flag) external;

    /// @notice Batch sets vaultAdmin
    function batchSetVaultAdmin(address[] calldata vaultAdmins, bool[] calldata flags) external;

    /// @notice Sets rebateAdmin
    function setRebateAdmin(address rebateAdmin, bool flag) external;

    /// @notice Batch sets rebateAdmin
    function batchSetRebateAdmin(address[] calldata rebateAdmins, bool[] calldata flags) external;

    /// @notice Sets zeroFeeVault
    function setZeroFeeVault(address vault, bool flag) external;

    /// @notice Batch sets zeroFeeVault
    function batchSetZeroFeeVault(address[] calldata vaults, bool[] calldata flags) external;
}

File 2 of 18 : IVaultV2.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;

interface IVaultV2 {
    function want() external view returns (address);

    function weth() external view returns (address);

    function deposit(uint256 amount) external payable;

    function withdraw(uint256 shares) external;

    function earn() external;

    function available() external view returns (uint256);

    function balance() external view returns (uint256);

    function getPricePerFullShare() external view returns (uint256);
}

File 2 of 18 : WooWithdrawManager.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;

/*

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

*
* 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 '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts/utils/EnumerableSet.sol';
import '@openzeppelin/contracts/utils/Pausable.sol';
import '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import '@uniswap/lib/contracts/libraries/TransferHelper.sol';

import '../interfaces/IWETH.sol';
import '../interfaces/IWooAccessManager.sol';

contract WooWithdrawManager is Ownable, ReentrancyGuard {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    // addedAmount: added withdrawal amount for this user
    // totalAmount: total withdrawal amount for this user
    event WithdrawAdded(address indexed user, uint256 addedAmount, uint256 totalAmount);

    event Withdraw(address indexed user, uint256 amount);

    address public want;
    address public weth;
    address public accessManager;
    address public superChargerVault;

    mapping(address => uint256) public withdrawAmount;

    address constant ETH_PLACEHOLDER_ADDR = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    constructor() public {}

    function init(
        address _weth,
        address _want,
        address _accessManager,
        address _superChargerVault
    ) external onlyOwner {
        weth = _weth;
        want = _want;
        accessManager = _accessManager;
        superChargerVault = _superChargerVault;
    }

    modifier onlyAdmin() {
        require(
            owner() == msg.sender || IWooAccessManager(accessManager).isVaultAdmin(msg.sender),
            'WooWithdrawManager: !owner'
        );
        _;
    }

    modifier onlySuperChargerVault() {
        require(superChargerVault == msg.sender, 'WooWithdrawManager: !superChargerVault');
        _;
    }

    function setSuperChargerVault(address _superChargerVault) external onlyAdmin {
        superChargerVault = _superChargerVault;
    }

    function addWithdrawAmount(address user, uint256 amount) external onlySuperChargerVault {
        TransferHelper.safeTransferFrom(want, msg.sender, address(this), amount);
        withdrawAmount[user] = withdrawAmount[user].add(amount);
        emit WithdrawAdded(user, amount, withdrawAmount[user]);
    }

    function withdraw() external nonReentrant {
        uint256 amount = withdrawAmount[msg.sender];
        if (amount == 0) {
            return;
        }
        withdrawAmount[msg.sender] = 0;
        if (want == weth) {
            IWETH(weth).withdraw(amount);
            TransferHelper.safeTransferETH(msg.sender, amount);
        } else {
            TransferHelper.safeTransfer(want, msg.sender, amount);
        }
        emit Withdraw(msg.sender, amount);
    }

    function inCaseTokenGotStuck(address stuckToken) external onlyOwner {
        require(stuckToken != want);
        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);
        }
    }

    receive() external payable {}
}

File 2 of 18 : WooLendingManager.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;

/*

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

*
* 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 '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts/utils/Pausable.sol';
import '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import '@uniswap/lib/contracts/libraries/TransferHelper.sol';

import './WooSuperChargerVault.sol';
import '../interfaces/IWETH.sol';
import '../interfaces/IWooAccessManager.sol';

contract WooLendingManager is Ownable, ReentrancyGuard {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    event Borrow(address indexed user, uint256 assets);
    event Repay(address indexed user, uint256 assets, uint256 perfFee);
    event InterestRateUpdated(address indexed user, uint256 oldInterest, uint256 newInterest);

    address public weth;
    address public want;
    address public accessManager;
    address public wooPP;
    WooSuperChargerVault public superChargerVault;

    uint256 public borrowedPrincipal;
    uint256 public borrowedInterest;

    uint256 public perfRate = 1000; // 1 in 10000th. 1000 = 10%
    address public treasury;

    uint256 public interestRate; // 1 in 10000th. 1 = 0.01% (1 bp), 10 = 0.1% (10 bps)
    uint256 public lastAccuredTs; // Timestamp of last accured interests

    mapping(address => bool) public isBorrower;

    address constant ETH_PLACEHOLDER_ADDR = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    constructor() public {}

    function init(
        address _weth,
        address _want,
        address _accessManager,
        address _wooPP,
        address payable _superChargerVault
    ) external onlyOwner {
        weth = _weth;
        want = _want;
        accessManager = _accessManager;
        wooPP = _wooPP;
        superChargerVault = WooSuperChargerVault(_superChargerVault);
        lastAccuredTs = block.timestamp;
        treasury = 0x4094D7A17a387795838c7aba4687387B0d32BCf3;
    }

    modifier onlyAdmin() {
        require(
            owner() == msg.sender || IWooAccessManager(accessManager).isVaultAdmin(msg.sender),
            'WooLendingManager: !ADMIN'
        );
        _;
    }

    modifier onlyBorrower() {
        require(isBorrower[msg.sender], 'WooLendingManager: !borrower');
        _;
    }

    modifier onlySuperChargerVault() {
        require(msg.sender == address(superChargerVault), 'WooLendingManager: !superChargerVault');
        _;
    }

    function setSuperChargerVault(address payable _wooSuperCharger) external onlyOwner {
        superChargerVault = WooSuperChargerVault(_wooSuperCharger);
    }

    function setWooPP(address _wooPP) external onlyOwner {
        wooPP = _wooPP;
    }

    function setBorrower(address _borrower, bool _isBorrower) external onlyOwner {
        isBorrower[_borrower] = _isBorrower;
    }

    function setPerfRate(uint256 _rate) external onlyAdmin {
        require(_rate < 10000);
        perfRate = _rate;
    }

    function debt() public view returns (uint256 assets) {
        return borrowedPrincipal.add(borrowedInterest);
    }

    function debtAfterPerfFee() public view returns (uint256 assets) {
        uint256 perfFee = borrowedInterest.mul(perfRate).div(10000);
        return borrowedPrincipal.add(borrowedInterest).sub(perfFee);
    }

    function borrowState()
        external
        view
        returns (
            uint256 total,
            uint256 principal,
            uint256 interest,
            uint256 borrowable
        )
    {
        total = debt();
        principal = borrowedPrincipal;
        interest = borrowedInterest;
        borrowable = superChargerVault.maxBorrowableAmount();
    }

    function accureInterest() public {
        uint256 currentTs = block.timestamp;

        // CAUTION: block.timestamp may be out of order
        if (currentTs <= lastAccuredTs) {
            return;
        }

        uint256 duration = currentTs.sub(lastAccuredTs);

        // interestRate is in 10000th.
        // 31536000 = 365 * 24 * 3600 (1 year of seconds)
        uint256 interest = borrowedPrincipal.mul(interestRate).mul(duration).div(31536000).div(10000);

        borrowedInterest = borrowedInterest.add(interest);
        lastAccuredTs = currentTs;
    }

    function setInterestRate(uint256 _rate) external onlyAdmin {
        require(_rate <= 50000, 'RATE_INVALID'); // NOTE: rate < 500%
        accureInterest();
        uint256 oldInterest = interestRate;
        interestRate = _rate;
        emit InterestRateUpdated(msg.sender, oldInterest, _rate);
    }

    function setTreasury(address _treasury) external onlyAdmin {
        require(_treasury != address(0), 'WooLendingManager: !_treasury');
        treasury = _treasury;
    }

    function maxBorrowableAmount() external view returns (uint256) {
        return superChargerVault.maxBorrowableAmount();
    }

    function borrow(uint256 amount) external onlyBorrower {
        require(amount > 0, '!AMOUNT');

        accureInterest();
        borrowedPrincipal = borrowedPrincipal.add(amount);

        uint256 preBalance = IERC20(want).balanceOf(wooPP);

        // NOTE: this method settles the fund and sends it to the wooPP address.
        superChargerVault.borrowFromLendingManager(amount, wooPP);

        uint256 afterBalance = IERC20(want).balanceOf(wooPP);
        require(afterBalance.sub(preBalance) == amount, 'WooLendingManager: BORROW_AMOUNT_ERROR');

        emit Borrow(msg.sender, amount);
    }

    // NOTE: this is the view functiono;
    // Remember to call the accureInterest to ensure the latest repayment state.
    function weeklyRepayment() public view returns (uint256 repayAmount) {
        uint256 neededAmount = superChargerVault.weeklyNeededAmountForWithdraw();
        if (neededAmount == 0) {
            return 0;
        }
        if (neededAmount <= borrowedInterest) {
            repayAmount = neededAmount.mul(10000).div(uint256(10000).sub(perfRate));
        } else {
            repayAmount = neededAmount.sub(borrowedInterest).add(
                borrowedInterest.mul(10000).div(uint256(10000).sub(perfRate))
            );
        }
        repayAmount = repayAmount.add(1);
    }

    function weeklyRepaymentBreakdown()
        public
        view
        returns (
            uint256 repayAmount,
            uint256 principal,
            uint256 interest,
            uint256 perfFee
        )
    {
        uint256 neededAmount = superChargerVault.weeklyNeededAmountForWithdraw();
        if (neededAmount == 0) {
            return (0, 0, 0, 0);
        }
        if (neededAmount <= borrowedInterest) {
            repayAmount = neededAmount.mul(10000).div(uint256(10000).sub(perfRate));
            principal = 0;
            interest = neededAmount;
        } else {
            repayAmount = neededAmount.sub(borrowedInterest).add(
                borrowedInterest.mul(10000).div(uint256(10000).sub(perfRate))
            );
            principal = neededAmount.sub(borrowedInterest);
            interest = borrowedInterest;
        }
        repayAmount = repayAmount.add(1);
        perfFee = repayAmount.sub(neededAmount);
    }

    function repayWeekly() external onlyBorrower returns (uint256 repaidAmount) {
        accureInterest();
        repaidAmount = weeklyRepayment();
        if (repaidAmount != 0) {
            repay(repaidAmount);
        } else {
            emit Repay(msg.sender, 0, 0);
        }
    }

    function repayAll() external onlyBorrower returns (uint256 repaidAmount) {
        accureInterest();
        repaidAmount = debt();
        if (repaidAmount != 0) {
            repay(repaidAmount);
        } else {
            emit Repay(msg.sender, 0, 0);
        }
    }

    function repay(uint256 amount) public onlyBorrower {
        require(amount > 0);

        accureInterest();

        TransferHelper.safeTransferFrom(want, msg.sender, address(this), amount);

        require(IERC20(want).balanceOf(address(this)) >= amount);

        uint256 perfFee;
        if (borrowedInterest >= amount) {
            borrowedInterest = borrowedInterest.sub(amount);
            perfFee = amount.mul(perfRate).div(10000);
        } else {
            perfFee = borrowedInterest.mul(perfRate).div(10000);
            borrowedPrincipal = borrowedPrincipal.sub(amount.sub(borrowedInterest));
            borrowedInterest = 0;
        }
        TransferHelper.safeTransfer(want, treasury, perfFee);
        uint256 amountRepaid = amount.sub(perfFee);

        TransferHelper.safeApprove(want, address(superChargerVault), amountRepaid);
        uint256 beforeBalance = IERC20(want).balanceOf(address(this));
        superChargerVault.repayFromLendingManager(amountRepaid);
        uint256 afterBalance = IERC20(want).balanceOf(address(this));
        require(beforeBalance.sub(afterBalance) == amountRepaid, 'WooLendingManager: REPAY_AMOUNT_ERROR');

        emit Repay(msg.sender, amount, perfFee);
    }

    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);
        }
    }
}

File 2 of 18 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 2 of 18 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_weth","type":"address"},{"internalType":"address","name":"_want","type":"address"},{"internalType":"address","name":"_accessManager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fees","type":"uint256"}],"name":"InstantWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"formerFeeRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFeeRate","type":"uint256"}],"name":"InstantWithdrawFeeRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"formerLendingManager","type":"address"},{"indexed":false,"internalType":"address","name":"newLendingManager","type":"address"}],"name":"LendingManagerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"RequestWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"oldVault","type":"address"},{"indexed":true,"internalType":"address","name":"newVault","type":"address"}],"name":"ReserveVaultMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","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":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lendingBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reserveBalance","type":"uint256"}],"name":"WeeklySettleEnded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalRequestedShares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weeklyRepayAmount","type":"uint256"}],"name":"WeeklySettleStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"formerWithdrawManager","type":"address"},{"indexed":false,"internalType":"address","name":"newWithdrawManager","type":"address"}],"name":"WithdrawManagerUpdated","type":"event"},{"inputs":[],"name":"accessManager","outputs":[{"internalType":"contract IWooAccessManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"available","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"fundAddr","type":"address"}],"name":"borrowFromLendingManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"costSharePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"endWeeklySettle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getPricePerFullShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"stuckToken","type":"address"}],"name":"inCaseTokenGotStuck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_reserveVault","type":"address"},{"internalType":"address","name":"_lendingManager","type":"address"},{"internalType":"address payable","name":"_withdrawManager","type":"address"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"instantWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"instantWithdrawCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"instantWithdrawFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"instantWithdrawnAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isSettling","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lendingBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lendingManager","outputs":[{"internalType":"contract WooLendingManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxBorrowableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"migrateReserveVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"repayFromLendingManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"requestWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestedTotalAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"requestedTotalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"requestedWithdrawAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"requestedWithdrawShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserveBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserveVault","outputs":[{"internalType":"contract IVaultV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feeRate","type":"uint256"}],"name":"setInstantWithdrawFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_lendingManager","type":"address"}],"name":"setLendingManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_withdrawManager","type":"address"}],"name":"setWithdrawManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startWeeklySettle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"want","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weeklyNeededAmountForWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawManager","outputs":[{"internalType":"contract WooWithdrawManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60e060405260118054610100600160a81b03191674815d4517427fc940a90a5653cdcea1544c6283c900179055601e6012553480156200003e57600080fd5b5060405162004ee338038062004ee3833981016040819052620000619162000391565b816001600160a01b03166306fdde036040518163ffffffff1660e01b815260040160006040518083038186803b1580156200009b57600080fd5b505afa158015620000b0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620000da9190810190620003e4565b604051602001620000ec9190620004b2565b604051602081830303815290604052826001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b1580156200013557600080fd5b505afa1580156200014a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620001749190810190620003e4565b60405160200162000186919062000486565b60408051601f198184030181529190528151620001ab906003906020850190620002f5565b508051620001c1906004906020840190620002f5565b50506005805460ff19166012179055506000620001dd620002f1565b60058054610100600160a81b0319166101006001600160a01b03841690810291909117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506005805460ff60a81b1916905560016006556001600160a01b038316620002775760405162461bcd60e51b81526004016200026e90620004f9565b60405180910390fd5b6001600160a01b038216620002a05760405162461bcd60e51b81526004016200026e9062000530565b6001600160a01b038116620002c95760405162461bcd60e51b81526004016200026e9062000567565b6001600160601b0319606093841b811660a05291831b821660805290911b1660c052620005f7565b3390565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200033857805160ff191683800117855562000368565b8280016001018555821562000368579182015b82811115620003685782518255916020019190600101906200034b565b50620003769291506200037a565b5090565b5b808211156200037657600081556001016200037b565b600080600060608486031215620003a6578283fd5b8351620003b381620005de565b6020850151909350620003c681620005de565b6040850151909250620003d981620005de565b809150509250925092565b600060208284031215620003f6578081fd5b81516001600160401b03808211156200040d578283fd5b818401915084601f83011262000421578283fd5b81518181111562000430578384fd5b604051601f8201601f19168101602001838111828210171562000451578586fd5b60405281815283820160200187101562000469578485fd5b6200047c826020830160208701620005ab565b9695505050505050565b600061776560f01b82528251620004a5816002850160208701620005ab565b9190910160020192915050565b60007f574f4f466920537570657220436861726765722000000000000000000000000082528251620004ec816014850160208701620005ab565b9190910160140192915050565b6020808252601b908201527f576f6f5375706572436861726765725661756c743a2021776574680000000000604082015260600190565b6020808252601b908201527f576f6f5375706572436861726765725661756c743a202177616e740000000000604082015260600190565b60208082526024908201527f576f6f5375706572436861726765725661756c743a20216163636573734d616e60408201526330b3b2b960e11b606082015260800190565b60005b83811015620005c8578181015183820152602001620005ae565b83811115620005d8576000848401525b50505050565b6001600160a01b0381168114620005f457600080fd5b50565b60805160601c60a05160601c60c05160601c614802620006e16000398061100c5280611a475280611b4e52806127ed5280612eb052806130ba525080610e0f5280610e6952806110bb5280611146528061128752806113de5280611f2c5280611f9b52806122af52806129b85280612a125280612f63525080610b345280610bfc5280610e395280610ee1528061117052806112b15280611333528061140852806114a852806115965280611f035280611f56528061207452806122835280612364528061239452806129e25280612aa25280612f8d5280612ff7528061303052506148026000f3fe6080604052600436106103395760003560e01c80638456cb59116101ab578063b6b55f25116100f7578063e1a4e72a11610095578063f2fde38b1161006f578063f2fde38b14610885578063fac6182f146108a5578063fd92bff2146108ba578063fdcb6068146108da57610340565b8063e1a4e72a14610830578063ec3e9da514610850578063f0f442601461086557610340565b8063cef062fc116100d1578063cef062fc146107d1578063dadb6c1d146107e6578063dd62ed3e146107fb578063e14224f31461081b57610340565b8063b6b55f2514610789578063c869d0ed1461079c578063cecdb961146107bc57610340565b806396f25d4211610164578063a457c2d71161013e578063a457c2d714610714578063a9059cbb14610734578063b5589fad14610754578063b69ef8a81461077457610340565b806396f25d42146106d55780639e3b77af146106ea578063a10954fe146106ff57610340565b80638456cb591461064c578063864a897f14610661578063882c127e146106765780638da5cb5b146106965780638e400570146106ab57806395d89b41146106c057610340565b80634069ab6811610285578063622639911161022357806370a08231116101fd57806370a08231146105e2578063715018a614610602578063745400c91461061757806377c7b8fc1461063757610340565b806362263991146105985780636a7855fd146105b85780636aa9eda2146105cd57610340565b80634d9b48941161025f5780634d9b4894146105395780635c975abb1461054e57806360773a2c1461056357806361d027b31461058357610340565b80634069ab68146104ef57806348a0d7541461050f5780634bb2dcea1461052457610340565b806323b872dd116102f257806339509351116102cc57806339509351146104855780633bfb5c14146104a55780633f4ba83a146104c55780633fc8cef3146104da57610340565b806323b872dd146104235780632ea9239e14610443578063313ce5671461046357610340565b806306fdde0314610345578063095ea7b31461037057806317e3e2e81461039d57806318160ddd146103bf578063184b9559146103e15780631f1fcd511461040157610340565b3661034057005b600080fd5b34801561035157600080fd5b5061035a6108ef565b6040516103679190613da9565b60405180910390f35b34801561037c57600080fd5b5061039061038b366004613c78565b610985565b6040516103679190613d9e565b3480156103a957600080fd5b506103bd6103b8366004613b7e565b6109a3565b005b3480156103cb57600080fd5b506103d4610a4a565b60405161036791906146b7565b3480156103ed57600080fd5b506103bd6103fc366004613bee565b610a50565b34801561040d57600080fd5b50610416610bfa565b6040516103679190613d33565b34801561042f57600080fd5b5061039061043e366004613c38565b610c1e565b34801561044f57600080fd5b506103bd61045e366004613cf3565b610ca5565b34801561046f57600080fd5b50610478610f0c565b60405161036791906146e4565b34801561049157600080fd5b506103906104a0366004613c78565b610f15565b3480156104b157600080fd5b506103bd6104c0366004613cc3565b610f63565b3480156104d157600080fd5b506103bd610fdc565b3480156104e657600080fd5b506104166110b9565b3480156104fb57600080fd5b506103bd61050a366004613b7e565b6110dd565b34801561051b57600080fd5b506103d461157c565b34801561053057600080fd5b506103d4611620565b34801561054557600080fd5b506103d4611667565b34801561055a57600080fd5b506103906116ac565b34801561056f57600080fd5b506103d461057e366004613b7e565b6116bc565b34801561058f57600080fd5b506104166116de565b3480156105a457600080fd5b506103d46105b3366004613b7e565b6116f2565b3480156105c457600080fd5b506103d4611704565b3480156105d957600080fd5b506103d461170a565b3480156105ee57600080fd5b506103d46105fd366004613b7e565b61177e565b34801561060e57600080fd5b506103bd611799565b34801561062357600080fd5b506103bd610632366004613cc3565b611828565b34801561064357600080fd5b506103d46119cb565b34801561065857600080fd5b506103bd611a17565b34801561066d57600080fd5b506103d4611af2565b34801561068257600080fd5b506103d4610691366004613b7e565b611af8565b3480156106a257600080fd5b50610416611b0a565b3480156106b757600080fd5b506103bd611b1e565b3480156106cc57600080fd5b5061035a611ccd565b3480156106e157600080fd5b50610390611d2e565b3480156106f657600080fd5b50610416611d37565b34801561070b57600080fd5b506103d4611d46565b34801561072057600080fd5b5061039061072f366004613c78565b611e58565b34801561074057600080fd5b5061039061074f366004613c78565b611ec0565b34801561076057600080fd5b506103bd61076f366004613cc3565b611ed4565b34801561078057600080fd5b506103d4612109565b6103bd610797366004613cc3565b61212f565b3480156107a857600080fd5b506103bd6107b7366004613b7e565b612493565b3480156107c857600080fd5b506103d4612525565b3480156107dd57600080fd5b5061041661252b565b3480156107f257600080fd5b506103d461253a565b34801561080757600080fd5b506103d4610816366004613bb6565b612547565b34801561082757600080fd5b506103d4612572565b34801561083c57600080fd5b506103bd61084b366004613b7e565b612578565b34801561085c57600080fd5b5061041661267b565b34801561087157600080fd5b506103bd610880366004613b7e565b61268a565b34801561089157600080fd5b506103bd6108a0366004613b7e565b6126f1565b3480156108b157600080fd5b506103bd6127bd565b3480156108c657600080fd5b506103bd6108d5366004613cc3565b612c93565b3480156108e657600080fd5b506104166130b8565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561097b5780601f106109505761010080835404028352916020019161097b565b820191906000526020600020905b81548152906001019060200180831161095e57829003601f168201915b5050505050905090565b60006109996109926130dc565b84846130e0565b5060015b92915050565b6109ab6130dc565b6001600160a01b03166109bc611b0a565b6001600160a01b0316146109eb5760405162461bcd60e51b81526004016109e2906142f5565b60405180910390fd5b600980546001600160a01b038381166001600160a01b03198316179092556040519116907f68b42fcf63f2d28ae477b4539c3101ade5142acdcc91191a106d867f3554f28a90610a3e9083908590613d47565b60405180910390a15050565b60025490565b610a586130dc565b6001600160a01b0316610a69611b0a565b6001600160a01b031614610a8f5760405162461bcd60e51b81526004016109e2906142f5565b6001600160a01b038316610ab55760405162461bcd60e51b81526004016109e2906143b9565b6001600160a01b038216610adb5760405162461bcd60e51b81526004016109e29061456a565b6001600160a01b038116610b015760405162461bcd60e51b81526004016109e290614128565b600780546001600160a01b0319166001600160a01b03858116919091179182905560408051631f1fcd5160e01b815290517f000000000000000000000000000000000000000000000000000000000000000083169390921691631f1fcd5191600480820192602092909190829003018186803b158015610b8057600080fd5b505afa158015610b94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb89190613b9a565b6001600160a01b031614610bcb57600080fd5b600880546001600160a01b039384166001600160a01b0319918216179091556009805492909316911617905550565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000610c2b848484613194565b610c9b84610c376130dc565b610c9685604051806060016040528060288152602001614780602891396001600160a01b038a16600090815260016020526040812090610c756130dc565b6001600160a01b0316815260208101919091526040016000205491906132a9565b6130e0565b5060019392505050565b6008546001600160a01b03163314610ccf5760405162461bcd60e51b81526004016109e290613f74565b60115460ff1615610cf25760405162461bcd60e51b81526004016109e29061425a565b610cfa611620565b821115610d195760405162461bcd60e51b81526004016109e29061405e565b6000610daa83600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d6d57600080fd5b505afa158015610d81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da59190613cdb565b6132d5565b600754604051632e1a7d4d60e01b81529192506001600160a01b031690632e1a7d4d90610ddb9084906004016146b7565b600060405180830381600087803b158015610df557600080fd5b505af1158015610e09573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161415610edc577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b158015610ec257600080fd5b505af1158015610ed6573d6000803e3d6000fd5b50505050505b610f077f0000000000000000000000000000000000000000000000000000000000000000838561331a565b505050565b60055460ff1690565b6000610999610f226130dc565b84610c968560016000610f336130dc565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490613401565b610f6b6130dc565b6001600160a01b0316610f7c611b0a565b6001600160a01b031614610fa25760405162461bcd60e51b81526004016109e2906142f5565b60128054908290556040517f2f0bfd95e6bf57fab22ace02a57c77bdabde00f81ccf61034ae4a915d3a47f4d90610a3e90839085906146c0565b33610fe5611b0a565b6001600160a01b03161480611093575060405163af5b052b60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063af5b052b90611041903390600401613d33565b602060405180830381600087803b15801561105b57600080fd5b505af115801561106f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110939190613ca3565b6110af5760405162461bcd60e51b81526004016109e290614382565b6110b7613426565b565b7f000000000000000000000000000000000000000000000000000000000000000081565b6110e56130dc565b6001600160a01b03166110f6611b0a565b6001600160a01b03161461111c5760405162461bcd60e51b81526004016109e2906142f5565b6001600160a01b0381166111425760405162461bcd60e51b81526004016109e2906143fd565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146111aa576111a561157c565b6111ac565b475b6007546040516370a0823160e01b81529192506001600160a01b031690632e1a7d4d9082906370a08231906111e5903090600401613d33565b60206040518083038186803b1580156111fd57600080fd5b505afa158015611211573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112359190613cdb565b6040518263ffffffff1660e01b815260040161125191906146b7565b600060405180830381600087803b15801561126b57600080fd5b505af115801561127f573d6000803e3d6000fd5b5050505060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146112eb576112e661157c565b6112ed565b475b905060006112fb8284613497565b600780546001600160a01b038781166001600160a01b03198316179283905560408051631f1fcd5160e01b81529051949550918116937f000000000000000000000000000000000000000000000000000000000000000082169390911691631f1fcd51916004808301926020929190829003018186803b15801561137e57600080fd5b505afa158015611392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b69190613b9a565b6001600160a01b0316146113dc5760405162461bcd60e51b81526004016109e290613e8f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316141561149f5760075460405163b6b55f2560e01b81526001600160a01b039091169063b6b55f259084906114689082906004016146b7565b6000604051808303818588803b15801561148157600080fd5b505af1158015611495573d6000803e3d6000fd5b505050505061153a565b6007546114d7907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b0316846134bf565b60075460405163b6b55f2560e01b81526001600160a01b039091169063b6b55f25906115079085906004016146b7565b600060405180830381600087803b15801561152157600080fd5b505af1158015611535573d6000803e3d6000fd5b505050505b6040516001600160a01b03808716919083169033907f548fe255eb14d86b43af1c165d3a356a85be79136670fa5ff20aa3e0284afde790600090a45050505050565b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906115cb903090600401613d33565b60206040518083038186803b1580156115e357600080fd5b505afa1580156115f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161b9190613cdb565b905090565b60008061162b611d46565b90506000611646601054600f5461349790919063ffffffff16565b9050808211611656576000611660565b6116608282613497565b9250505090565b60085460408051631b07cd6760e31b815290516000926001600160a01b03169163d83e6b38916004808301926020929190829003018186803b1580156115e357600080fd5b600554600160a81b900460ff1690565b6001600160a01b0381166000908152600b602052604081205461099d906135a6565b60115461010090046001600160a01b031681565b600a6020526000908152604090205481565b60105481565b600080611715611d46565b9050600061172161253a565b9050600061173782611731612109565b90613497565b905061174e61174782600a6135b4565b8390613401565b8310156117735761176e8361173161176784600a6135b4565b8590613401565b611776565b60005b935050505090565b6001600160a01b031660009081526020819052604090205490565b6117a16130dc565b6001600160a01b03166117b2611b0a565b6001600160a01b0316146117d85760405162461bcd60e51b81526004016109e2906142f5565b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b6118306116ac565b1561184d5760405162461bcd60e51b81526004016109e29061416f565b600260065414156118705760405162461bcd60e51b81526004016109e290614649565b6002600655806118925760405162461bcd60e51b81526004016109e290614533565b60115460ff16156118b55760405162461bcd60e51b81526004016109e290614209565b600860009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561190557600080fd5b505af1158015611919573d6000803e3d6000fd5b50505050600061192b82610da56119cb565b9050611939303330846135e6565b336000908152600b60205260409020546119539082613401565b336000908152600b6020526040902055600c546119709082613401565b600c5561197e600d336136d7565b50336001600160a01b03167febeaa8785285a4f7c37a305351997dceebabc3c357dab98023dc37514a1b6ed683836040516119ba9291906146c0565b60405180910390a250506001600655565b60006119d5610a4a565b15611a0a57611a056119e5610a4a565b6119ff670de0b6b3a76400006119f9612109565b906136f3565b906135b4565b61161b565b50670de0b6b3a764000090565b33611a20611b0a565b6001600160a01b03161480611ace575060405163af5b052b60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063af5b052b90611a7c903390600401613d33565b602060405180830381600087803b158015611a9657600080fd5b505af1158015611aaa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ace9190613ca3565b611aea5760405162461bcd60e51b81526004016109e290614382565b6110b761372d565b600f5481565b600b6020526000908152604090205481565b60055461010090046001600160a01b031690565b33611b27611b0a565b6001600160a01b03161480611bd5575060405163af5b052b60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063af5b052b90611b83903390600401613d33565b602060405180830381600087803b158015611b9d57600080fd5b505af1158015611bb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bd59190613ca3565b611bf15760405162461bcd60e51b81526004016109e290614382565b60115460ff1615611c145760405162461bcd60e51b81526004016109e2906140cc565b6011805460ff19166001179055600854604080516351b9f6a760e11b815290516001600160a01b039092169163a373ed4e9160048082019260009290919082900301818387803b158015611c6757600080fd5b505af1158015611c7b573d6000803e3d6000fd5b50505050336001600160a01b03167ffce7d682dc90b7cc945fb8cfff947668bcf6d304aa58823b24d2c06dec38df6e600c54611cb561170a565b604051611cc39291906146c0565b60405180910390a2565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561097b5780601f106109505761010080835404028352916020019161097b565b60115460ff1681565b6008546001600160a01b031681565b6007546040516370a0823160e01b815260009161161b916001600160a01b03909116906370a0823190611d7d903090600401613d33565b60206040518083038186803b158015611d9557600080fd5b505afa158015611da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dcd9190613cdb565b600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015611e1b57600080fd5b505afa158015611e2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e539190613cdb565b61378e565b6000610999611e656130dc565b84610c96856040518060600160405280602581526020016147a86025913960016000611e8f6130dc565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906132a9565b6000610999611ecd6130dc565b8484613194565b6008546001600160a01b03163314611efe5760405162461bcd60e51b81526004016109e290613f74565b611f2a7f00000000000000000000000000000000000000000000000000000000000000003330846135e6565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316141561206b57604051632e1a7d4d60e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690632e1a7d4d90611fd09084906004016146b7565b600060405180830381600087803b158015611fea57600080fd5b505af1158015611ffe573d6000803e3d6000fd5b505060075460405163b6b55f2560e01b81526001600160a01b03909116925063b6b55f25915083906120349082906004016146b7565b6000604051808303818588803b15801561204d57600080fd5b505af1158015612061573d6000803e3d6000fd5b5050505050612106565b6007546120a3907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b0316836134bf565b60075460405163b6b55f2560e01b81526001600160a01b039091169063b6b55f25906120d39084906004016146b7565b600060405180830381600087803b1580156120ed57600080fd5b505af1158015612101573d6000803e3d6000fd5b505050505b50565b600061161b612116611667565b612129612121611d46565b61212961157c565b90613401565b6121376116ac565b156121545760405162461bcd60e51b81526004016109e29061416f565b600260065414156121775760405162461bcd60e51b81526004016109e290614649565b6002600655806121865761248b565b600860009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156121d657600080fd5b505af11580156121ea573d6000803e3d6000fd5b505050506000612201826121fc6119cb565b6137a6565b9050600081116122235760405162461bcd60e51b81526004016109e290614361565b600061222e3361177e565b336000908152600a602052604081205491925061226d61224e8486613401565b6119ff61226388670de0b6b3a76400006136f3565b61212987876136f3565b336000908152600a6020526040902081905590507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b039081167f0000000000000000000000000000000000000000000000000000000000000000909116141561235f578434146122f65760405162461bcd60e51b81526004016109e2906145fd565b60075460405163b6b55f2560e01b81526001600160a01b039091169063b6b55f259034906123289089906004016146b7565b6000604051808303818588803b15801561234157600080fd5b505af1158015612355573d6000803e3d6000fd5b5050505050612426565b61238b7f00000000000000000000000000000000000000000000000000000000000000003330886135e6565b6007546123c3907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b0316876134bf565b60075460405163b6b55f2560e01b81526001600160a01b039091169063b6b55f25906123f39088906004016146b7565b600060405180830381600087803b15801561240d57600080fd5b505af1158015612421573d6000803e3d6000fd5b505050505b61243033856137be565b61244761243e86600a6135b4565b600f5490613401565b600f5560405133907f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159061247e90889088906146c0565b60405180910390a2505050505b506001600655565b61249b6130dc565b6001600160a01b03166124ac611b0a565b6001600160a01b0316146124d25760405162461bcd60e51b81526004016109e2906142f5565b600880546001600160a01b038381166001600160a01b03198316179092556040519116907f9ed29eb74f1356c602e59670cf82bfe8b0f564216ce091e163fbf7f0376aa19790610a3e9083908590613d47565b60125481565b6007546001600160a01b031681565b600061161b600c546135a6565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600c5481565b6125806130dc565b6001600160a01b0316612591611b0a565b6001600160a01b0316146125b75760405162461bcd60e51b81526004016109e2906142f5565b6001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156125eb576125e6334761387e565b612106565b6040516370a0823160e01b81526000906001600160a01b038316906370a082319061261a903090600401613d33565b60206040518083038186803b15801561263257600080fd5b505afa158015612646573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061266a9190613cdb565b905061267782338361331a565b5050565b6009546001600160a01b031681565b6126926130dc565b6001600160a01b03166126a3611b0a565b6001600160a01b0316146126c95760405162461bcd60e51b81526004016109e2906142f5565b601180546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6126f96130dc565b6001600160a01b031661270a611b0a565b6001600160a01b0316146127305760405162461bcd60e51b81526004016109e2906142f5565b6001600160a01b0381166127565760405162461bcd60e51b81526004016109e290613eb5565b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b336127c6611b0a565b6001600160a01b03161480612874575060405163af5b052b60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063af5b052b90612822903390600401613d33565b602060405180830381600087803b15801561283c57600080fd5b505af1158015612850573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128749190613ca3565b6128905760405162461bcd60e51b81526004016109e290614382565b60115460ff166128b25760405162461bcd60e51b81526004016109e2906141e6565b6128ba61170a565b156128d75760405162461bcd60e51b81526004016109e29061432a565b60006128e16119cb565b6011805460ff19169055905060006128f761253a565b90508015612bcb57600061295382600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d6d57600080fd5b600754604051632e1a7d4d60e01b81529192506001600160a01b031690632e1a7d4d906129849084906004016146b7565b600060405180830381600087803b15801561299e57600080fd5b505af11580156129b2573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161415612a85577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015612a6b57600080fd5b505af1158015612a7f573d6000803e3d6000fd5b50505050505b81612a8e61157c565b1015612a9957600080fd5b600954612ad1907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b0316846134bf565b6000612add600d61390b565b905060005b81811015612bb6576000612af7600d82613916565b6009546001600160a01b038083166000908152600b60205260409020549293501690639b927a91908390612b3990670de0b6b3a7640000906119ff908c6136f3565b6040518363ffffffff1660e01b8152600401612b56929190613d85565b600060405180830381600087803b158015612b7057600080fd5b505af1158015612b84573d6000803e3d6000fd5b5050506001600160a01b0382166000908152600b602052604081205550612bac600d82613922565b5050600101612ae2565b50612bc330600c54613937565b50506000600c555b60006010819055600854604080516351b9f6a760e11b815290516001600160a01b039092169263a373ed4e9260048084019382900301818387803b158015612c1257600080fd5b505af1158015612c26573d6000803e3d6000fd5b505050506000612c34612109565b9050612c4181600a6135b4565b600f55337f805ee433ea4242be6315bc317b1bf10e767ad8beb03ee547773b3ee1f842c20682612c6f611667565b612c77611d46565b604051612c86939291906146ce565b60405180910390a2505050565b612c9b6116ac565b15612cb85760405162461bcd60e51b81526004016109e29061416f565b60026006541415612cdb5760405162461bcd60e51b81526004016109e290614649565b600260065580612cfd5760405162461bcd60e51b81526004016109e290614533565b60115460ff1615612d205760405162461bcd60e51b81526004016109e290614199565b600f5460105410612d305761248b565b601054600f54612d3f91613497565b811115612d5e5760405162461bcd60e51b81526004016109e2906142c0565b600860009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612dae57600080fd5b505af1158015612dc2573d6000803e3d6000fd5b505050506000612dd482610da56119cb565b9050612de03382613937565b6000612e3483600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d6d57600080fd5b600754604051632e1a7d4d60e01b81529192506001600160a01b031690632e1a7d4d90612e659084906004016146b7565b600060405180830381600087803b158015612e7f57600080fd5b505af1158015612e93573d6000803e3d6000fd5b505060405163438f365360e11b8152600092506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016915063871e6ca690612ee6903390600401613d33565b602060405180830381600087803b158015612f0057600080fd5b505af1158015612f14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f389190613ca3565b612f5c57612f576127106119ff601254876136f390919063ffffffff16565b612f5f565b60005b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161415612fee57601154612fd69061010090046001600160a01b03168261387e565b612fe933612fe48684613497565b61387e565b61305f565b60115461302b907f00000000000000000000000000000000000000000000000000000000000000009061010090046001600160a01b03168361331a565b61305f7f00000000000000000000000000000000000000000000000000000000000000003361305a8785613497565b61331a565b60105461306c9085613401565b60105560405133907f672004d35ad2124f90299371ade95cf5594500e40705a7cf6eaf7c00b55a07ac906130a5908790869086906146ce565b60405180910390a2505050506001600655565b7f000000000000000000000000000000000000000000000000000000000000000081565b3390565b6001600160a01b0383166131065760405162461bcd60e51b81526004016109e2906144ef565b6001600160a01b03821661312c5760405162461bcd60e51b81526004016109e290613efb565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906131879085906146b7565b60405180910390a3505050565b6001600160a01b0383166131ba5760405162461bcd60e51b81526004016109e2906144aa565b6001600160a01b0382166131e05760405162461bcd60e51b81526004016109e290613e1e565b6131eb838383610f07565b6132288160405180606001604052806026815260200161475a602691396001600160a01b03861660009081526020819052604090205491906132a9565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546132579082613401565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906131879085906146b7565b600081848411156132cd5760405162461bcd60e51b81526004016109e29190613da9565b505050900390565b6000806132ee836119ff86670de0b6b3a76400006136f3565b9050836132fb828561378e565b146133105761330b816001613401565b613312565b805b949350505050565b60006060846001600160a01b031663a9059cbb8585604051602401613340929190613d85565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516133799190613d17565b6000604051808303816000865af19150503d80600081146133b6576040519150601f19603f3d011682016040523d82523d6000602084013e6133bb565b606091505b50915091508180156133e55750805115806133e55750808060200190518101906133e59190613ca3565b6121015760405162461bcd60e51b81526004016109e2906145b0565b6000828201838110156133105760405162461bcd60e51b81526004016109e290613f3d565b61342e6116ac565b61344a5760405162461bcd60e51b81526004016109e290613e61565b6005805460ff60a81b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6134806130dc565b60405161348d9190613d33565b60405180910390a1565b6000828211156134b95760405162461bcd60e51b81526004016109e290614095565b50900390565b60006060846001600160a01b031663095ea7b385856040516024016134e5929190613d85565b6040516020818303038152906040529060e01b6020820180516001600160e01b03838183161783525050505060405161351e9190613d17565b6000604051808303816000865af19150503d806000811461355b576040519150601f19603f3d011682016040523d82523d6000602084013e613560565b606091505b509150915081801561358a57508051158061358a57508080602001905181019061358a9190613ca3565b6121015760405162461bcd60e51b81526004016109e29061445f565b600061099d82611e536119cb565b60008082116135d55760405162461bcd60e51b81526004016109e2906140f1565b8183816135de57fe5b049392505050565b60006060856001600160a01b03166323b872dd86868660405160240161360e93929190613d61565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516136479190613d17565b6000604051808303816000865af19150503d8060008114613684576040519150601f19603f3d011682016040523d82523d6000602084013e613689565b606091505b50915091508180156136b35750805115806136b35750808060200190518101906136b39190613ca3565b6136cf5760405162461bcd60e51b81526004016109e290613fb9565b505050505050565b60006136ec836001600160a01b038416613a0d565b9392505050565b6000826137025750600061099d565b8282028284828161370f57fe5b04146133105760405162461bcd60e51b81526004016109e29061427f565b6137356116ac565b156137525760405162461bcd60e51b81526004016109e29061416f565b6005805460ff60a81b1916600160a81b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586134806130dc565b60006136ec670de0b6b3a76400006119ff85856136f3565b60006136ec826119ff85670de0b6b3a76400006136f3565b6001600160a01b0382166137e45760405162461bcd60e51b81526004016109e290614680565b6137f060008383610f07565b6002546137fd9082613401565b6002556001600160a01b0382166000908152602081905260409020546138239082613401565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906138729085906146b7565b60405180910390a35050565b604080516000808252602082019092526001600160a01b0384169083906040516138a89190613d17565b60006040518083038185875af1925050503d80600081146138e5576040519150601f19603f3d011682016040523d82523d6000602084013e6138ea565b606091505b5050905080610f075760405162461bcd60e51b81526004016109e29061400a565b600061099d82613a57565b60006136ec8383613a5b565b60006136ec836001600160a01b038416613aa0565b6001600160a01b03821661395d5760405162461bcd60e51b81526004016109e29061441e565b61396982600083610f07565b6139a681604051806060016040528060228152602001614738602291396001600160a01b03851660009081526020819052604090205491906132a9565b6001600160a01b0383166000908152602081905260409020556002546139cc9082613497565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906138729085906146b7565b6000613a198383613b66565b613a4f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561099d565b50600061099d565b5490565b81546000908210613a7e5760405162461bcd60e51b81526004016109e290613ddc565b826000018281548110613a8d57fe5b9060005260206000200154905092915050565b60008181526001830160205260408120548015613b5c5783546000198083019190810190600090879083908110613ad357fe5b9060005260206000200154905080876000018481548110613af057fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080613b2057fe5b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505061099d565b600091505061099d565b60009081526001919091016020526040902054151590565b600060208284031215613b8f578081fd5b813561331081614722565b600060208284031215613bab578081fd5b815161331081614722565b60008060408385031215613bc8578081fd5b8235613bd381614722565b91506020830135613be381614722565b809150509250929050565b600080600060608486031215613c02578081fd5b8335613c0d81614722565b92506020840135613c1d81614722565b91506040840135613c2d81614722565b809150509250925092565b600080600060608486031215613c4c578283fd5b8335613c5781614722565b92506020840135613c6781614722565b929592945050506040919091013590565b60008060408385031215613c8a578182fd5b8235613c9581614722565b946020939093013593505050565b600060208284031215613cb4578081fd5b81518015158114613310578182fd5b600060208284031215613cd4578081fd5b5035919050565b600060208284031215613cec578081fd5b5051919050565b60008060408385031215613d05578182fd5b823591506020830135613be381614722565b60008251613d298184602087016146f2565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6000602082528251806020840152613dc88160408501602087016146f2565b601f01601f19169190910160400192915050565b60208082526022908201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604082015261647360f01b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526014908201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604082015260600190565b6020808252600c908201526b1253959053125117d5d0539560a21b604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526025908201527f576f6f5375706572436861726765725661756c743a20216c656e64696e674d616040820152643730b3b2b960d91b606082015260800190565b60208082526031908201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a207472604082015270185b9cd9995c919c9bdb4819985a5b1959607a1b606082015260800190565b60208082526034908201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60408201527308115512081d1c985b9cd9995c8819985a5b195960621b606082015260800190565b60208082526018908201527f494e535546465f414d4f554e545f464f525f424f52524f570000000000000000604082015260600190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b6020808252600b908201526a494e5f534554544c494e4760a81b604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b60208082526027908201527f576f6f5375706572436861726765725661756c743a20215f776974686472617760408201526626b0b730b3b2b960c91b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602d908201527f576f6f5375706572436861726765725661756c743a204e4f545f414c4c4f574560408201526c445f494e5f534554544c494e4760981b606082015260800190565b60208082526009908201526821534554544c494e4760b81b604082015260600190565b60208082526031908201527f576f6f5375706572436861726765725661756c743a2043414e4e4f545f57495460408201527048445241575f494e5f534554544c494e4760781b606082015260800190565b6020808252600b908201526a494e20534554544c494e4760a81b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252818101527f576f6f5375706572436861726765725661756c743a204f55545f4f465f434150604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526018908201527f5745454b4c595f52455041595f4e4f545f434c45415245440000000000000000604082015260600190565b6020808252600790820152662173686172657360c81b604082015260600190565b6020808252601c908201527f576f6f5375706572436861726765725661756c743a202141444d494e00000000604082015260600190565b60208082526024908201527f576f6f5375706572436861726765725661756c743a20215f7265736572766556604082015263185d5b1d60e21b606082015260800190565b6020808252600790820152660857dd985d5b1d60ca1b604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b6020808252602b908201527f5472616e7366657248656c7065723a3a73616665417070726f76653a2061707060408201526a1c9bdd994819985a5b195960aa1b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f576f6f5375706572436861726765725661756c743a2021616d6f756e74000000604082015260600190565b60208082526026908201527f576f6f5375706572436861726765725661756c743a20215f6c656e64696e674d60408201526530b730b3b2b960d11b606082015260800190565b6020808252602d908201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260408201526c185b9cd9995c8819985a5b1959609a1b606082015260800190565b6020808252602c908201527f576f6f5375706572436861726765725661756c743a206d73672e76616c75655f60408201526b125394d551919250d251539560a21b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b918252602082015260400190565b9283526020830191909152604082015260600190565b60ff91909116815260200190565b60005b8381101561470d5781810151838201526020016146f5565b8381111561471c576000848401525b50505050565b6001600160a01b038116811461210657600080fdfe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220376fd49f39cbe5fc3ec4190d31b02f4b71ec82b2735faff8974106618e5521aa64736f6c634300060c003300000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c8300000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b75000000000000000000000000d6d6a0828a80e1832cd4c3585aded8971087fcb8

Deployed Bytecode

0x6080604052600436106103395760003560e01c80638456cb59116101ab578063b6b55f25116100f7578063e1a4e72a11610095578063f2fde38b1161006f578063f2fde38b14610885578063fac6182f146108a5578063fd92bff2146108ba578063fdcb6068146108da57610340565b8063e1a4e72a14610830578063ec3e9da514610850578063f0f442601461086557610340565b8063cef062fc116100d1578063cef062fc146107d1578063dadb6c1d146107e6578063dd62ed3e146107fb578063e14224f31461081b57610340565b8063b6b55f2514610789578063c869d0ed1461079c578063cecdb961146107bc57610340565b806396f25d4211610164578063a457c2d71161013e578063a457c2d714610714578063a9059cbb14610734578063b5589fad14610754578063b69ef8a81461077457610340565b806396f25d42146106d55780639e3b77af146106ea578063a10954fe146106ff57610340565b80638456cb591461064c578063864a897f14610661578063882c127e146106765780638da5cb5b146106965780638e400570146106ab57806395d89b41146106c057610340565b80634069ab6811610285578063622639911161022357806370a08231116101fd57806370a08231146105e2578063715018a614610602578063745400c91461061757806377c7b8fc1461063757610340565b806362263991146105985780636a7855fd146105b85780636aa9eda2146105cd57610340565b80634d9b48941161025f5780634d9b4894146105395780635c975abb1461054e57806360773a2c1461056357806361d027b31461058357610340565b80634069ab68146104ef57806348a0d7541461050f5780634bb2dcea1461052457610340565b806323b872dd116102f257806339509351116102cc57806339509351146104855780633bfb5c14146104a55780633f4ba83a146104c55780633fc8cef3146104da57610340565b806323b872dd146104235780632ea9239e14610443578063313ce5671461046357610340565b806306fdde0314610345578063095ea7b31461037057806317e3e2e81461039d57806318160ddd146103bf578063184b9559146103e15780631f1fcd511461040157610340565b3661034057005b600080fd5b34801561035157600080fd5b5061035a6108ef565b6040516103679190613da9565b60405180910390f35b34801561037c57600080fd5b5061039061038b366004613c78565b610985565b6040516103679190613d9e565b3480156103a957600080fd5b506103bd6103b8366004613b7e565b6109a3565b005b3480156103cb57600080fd5b506103d4610a4a565b60405161036791906146b7565b3480156103ed57600080fd5b506103bd6103fc366004613bee565b610a50565b34801561040d57600080fd5b50610416610bfa565b6040516103679190613d33565b34801561042f57600080fd5b5061039061043e366004613c38565b610c1e565b34801561044f57600080fd5b506103bd61045e366004613cf3565b610ca5565b34801561046f57600080fd5b50610478610f0c565b60405161036791906146e4565b34801561049157600080fd5b506103906104a0366004613c78565b610f15565b3480156104b157600080fd5b506103bd6104c0366004613cc3565b610f63565b3480156104d157600080fd5b506103bd610fdc565b3480156104e657600080fd5b506104166110b9565b3480156104fb57600080fd5b506103bd61050a366004613b7e565b6110dd565b34801561051b57600080fd5b506103d461157c565b34801561053057600080fd5b506103d4611620565b34801561054557600080fd5b506103d4611667565b34801561055a57600080fd5b506103906116ac565b34801561056f57600080fd5b506103d461057e366004613b7e565b6116bc565b34801561058f57600080fd5b506104166116de565b3480156105a457600080fd5b506103d46105b3366004613b7e565b6116f2565b3480156105c457600080fd5b506103d4611704565b3480156105d957600080fd5b506103d461170a565b3480156105ee57600080fd5b506103d46105fd366004613b7e565b61177e565b34801561060e57600080fd5b506103bd611799565b34801561062357600080fd5b506103bd610632366004613cc3565b611828565b34801561064357600080fd5b506103d46119cb565b34801561065857600080fd5b506103bd611a17565b34801561066d57600080fd5b506103d4611af2565b34801561068257600080fd5b506103d4610691366004613b7e565b611af8565b3480156106a257600080fd5b50610416611b0a565b3480156106b757600080fd5b506103bd611b1e565b3480156106cc57600080fd5b5061035a611ccd565b3480156106e157600080fd5b50610390611d2e565b3480156106f657600080fd5b50610416611d37565b34801561070b57600080fd5b506103d4611d46565b34801561072057600080fd5b5061039061072f366004613c78565b611e58565b34801561074057600080fd5b5061039061074f366004613c78565b611ec0565b34801561076057600080fd5b506103bd61076f366004613cc3565b611ed4565b34801561078057600080fd5b506103d4612109565b6103bd610797366004613cc3565b61212f565b3480156107a857600080fd5b506103bd6107b7366004613b7e565b612493565b3480156107c857600080fd5b506103d4612525565b3480156107dd57600080fd5b5061041661252b565b3480156107f257600080fd5b506103d461253a565b34801561080757600080fd5b506103d4610816366004613bb6565b612547565b34801561082757600080fd5b506103d4612572565b34801561083c57600080fd5b506103bd61084b366004613b7e565b612578565b34801561085c57600080fd5b5061041661267b565b34801561087157600080fd5b506103bd610880366004613b7e565b61268a565b34801561089157600080fd5b506103bd6108a0366004613b7e565b6126f1565b3480156108b157600080fd5b506103bd6127bd565b3480156108c657600080fd5b506103bd6108d5366004613cc3565b612c93565b3480156108e657600080fd5b506104166130b8565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561097b5780601f106109505761010080835404028352916020019161097b565b820191906000526020600020905b81548152906001019060200180831161095e57829003601f168201915b5050505050905090565b60006109996109926130dc565b84846130e0565b5060015b92915050565b6109ab6130dc565b6001600160a01b03166109bc611b0a565b6001600160a01b0316146109eb5760405162461bcd60e51b81526004016109e2906142f5565b60405180910390fd5b600980546001600160a01b038381166001600160a01b03198316179092556040519116907f68b42fcf63f2d28ae477b4539c3101ade5142acdcc91191a106d867f3554f28a90610a3e9083908590613d47565b60405180910390a15050565b60025490565b610a586130dc565b6001600160a01b0316610a69611b0a565b6001600160a01b031614610a8f5760405162461bcd60e51b81526004016109e2906142f5565b6001600160a01b038316610ab55760405162461bcd60e51b81526004016109e2906143b9565b6001600160a01b038216610adb5760405162461bcd60e51b81526004016109e29061456a565b6001600160a01b038116610b015760405162461bcd60e51b81526004016109e290614128565b600780546001600160a01b0319166001600160a01b03858116919091179182905560408051631f1fcd5160e01b815290517f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b7583169390921691631f1fcd5191600480820192602092909190829003018186803b158015610b8057600080fd5b505afa158015610b94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb89190613b9a565b6001600160a01b031614610bcb57600080fd5b600880546001600160a01b039384166001600160a01b0319918216179091556009805492909316911617905550565b7f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b7581565b6000610c2b848484613194565b610c9b84610c376130dc565b610c9685604051806060016040528060288152602001614780602891396001600160a01b038a16600090815260016020526040812090610c756130dc565b6001600160a01b0316815260208101919091526040016000205491906132a9565b6130e0565b5060019392505050565b6008546001600160a01b03163314610ccf5760405162461bcd60e51b81526004016109e290613f74565b60115460ff1615610cf25760405162461bcd60e51b81526004016109e29061425a565b610cfa611620565b821115610d195760405162461bcd60e51b81526004016109e29061405e565b6000610daa83600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d6d57600080fd5b505afa158015610d81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da59190613cdb565b6132d5565b600754604051632e1a7d4d60e01b81529192506001600160a01b031690632e1a7d4d90610ddb9084906004016146b7565b600060405180830381600087803b158015610df557600080fd5b505af1158015610e09573d6000803e3d6000fd5b505050507f00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c836001600160a01b03167f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b756001600160a01b03161415610edc577f00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c836001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b158015610ec257600080fd5b505af1158015610ed6573d6000803e3d6000fd5b50505050505b610f077f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b75838561331a565b505050565b60055460ff1690565b6000610999610f226130dc565b84610c968560016000610f336130dc565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490613401565b610f6b6130dc565b6001600160a01b0316610f7c611b0a565b6001600160a01b031614610fa25760405162461bcd60e51b81526004016109e2906142f5565b60128054908290556040517f2f0bfd95e6bf57fab22ace02a57c77bdabde00f81ccf61034ae4a915d3a47f4d90610a3e90839085906146c0565b33610fe5611b0a565b6001600160a01b03161480611093575060405163af5b052b60e01b81526001600160a01b037f000000000000000000000000d6d6a0828a80e1832cd4c3585aded8971087fcb8169063af5b052b90611041903390600401613d33565b602060405180830381600087803b15801561105b57600080fd5b505af115801561106f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110939190613ca3565b6110af5760405162461bcd60e51b81526004016109e290614382565b6110b7613426565b565b7f00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c8381565b6110e56130dc565b6001600160a01b03166110f6611b0a565b6001600160a01b03161461111c5760405162461bcd60e51b81526004016109e2906142f5565b6001600160a01b0381166111425760405162461bcd60e51b81526004016109e2906143fd565b60007f00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c836001600160a01b03167f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b756001600160a01b0316146111aa576111a561157c565b6111ac565b475b6007546040516370a0823160e01b81529192506001600160a01b031690632e1a7d4d9082906370a08231906111e5903090600401613d33565b60206040518083038186803b1580156111fd57600080fd5b505afa158015611211573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112359190613cdb565b6040518263ffffffff1660e01b815260040161125191906146b7565b600060405180830381600087803b15801561126b57600080fd5b505af115801561127f573d6000803e3d6000fd5b5050505060007f00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c836001600160a01b03167f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b756001600160a01b0316146112eb576112e661157c565b6112ed565b475b905060006112fb8284613497565b600780546001600160a01b038781166001600160a01b03198316179283905560408051631f1fcd5160e01b81529051949550918116937f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b7582169390911691631f1fcd51916004808301926020929190829003018186803b15801561137e57600080fd5b505afa158015611392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b69190613b9a565b6001600160a01b0316146113dc5760405162461bcd60e51b81526004016109e290613e8f565b7f00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c836001600160a01b03167f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b756001600160a01b0316141561149f5760075460405163b6b55f2560e01b81526001600160a01b039091169063b6b55f259084906114689082906004016146b7565b6000604051808303818588803b15801561148157600080fd5b505af1158015611495573d6000803e3d6000fd5b505050505061153a565b6007546114d7907f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b75906001600160a01b0316846134bf565b60075460405163b6b55f2560e01b81526001600160a01b039091169063b6b55f25906115079085906004016146b7565b600060405180830381600087803b15801561152157600080fd5b505af1158015611535573d6000803e3d6000fd5b505050505b6040516001600160a01b03808716919083169033907f548fe255eb14d86b43af1c165d3a356a85be79136670fa5ff20aa3e0284afde790600090a45050505050565b6040516370a0823160e01b81526000906001600160a01b037f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b7516906370a08231906115cb903090600401613d33565b60206040518083038186803b1580156115e357600080fd5b505afa1580156115f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161b9190613cdb565b905090565b60008061162b611d46565b90506000611646601054600f5461349790919063ffffffff16565b9050808211611656576000611660565b6116608282613497565b9250505090565b60085460408051631b07cd6760e31b815290516000926001600160a01b03169163d83e6b38916004808301926020929190829003018186803b1580156115e357600080fd5b600554600160a81b900460ff1690565b6001600160a01b0381166000908152600b602052604081205461099d906135a6565b60115461010090046001600160a01b031681565b600a6020526000908152604090205481565b60105481565b600080611715611d46565b9050600061172161253a565b9050600061173782611731612109565b90613497565b905061174e61174782600a6135b4565b8390613401565b8310156117735761176e8361173161176784600a6135b4565b8590613401565b611776565b60005b935050505090565b6001600160a01b031660009081526020819052604090205490565b6117a16130dc565b6001600160a01b03166117b2611b0a565b6001600160a01b0316146117d85760405162461bcd60e51b81526004016109e2906142f5565b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b6118306116ac565b1561184d5760405162461bcd60e51b81526004016109e29061416f565b600260065414156118705760405162461bcd60e51b81526004016109e290614649565b6002600655806118925760405162461bcd60e51b81526004016109e290614533565b60115460ff16156118b55760405162461bcd60e51b81526004016109e290614209565b600860009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561190557600080fd5b505af1158015611919573d6000803e3d6000fd5b50505050600061192b82610da56119cb565b9050611939303330846135e6565b336000908152600b60205260409020546119539082613401565b336000908152600b6020526040902055600c546119709082613401565b600c5561197e600d336136d7565b50336001600160a01b03167febeaa8785285a4f7c37a305351997dceebabc3c357dab98023dc37514a1b6ed683836040516119ba9291906146c0565b60405180910390a250506001600655565b60006119d5610a4a565b15611a0a57611a056119e5610a4a565b6119ff670de0b6b3a76400006119f9612109565b906136f3565b906135b4565b61161b565b50670de0b6b3a764000090565b33611a20611b0a565b6001600160a01b03161480611ace575060405163af5b052b60e01b81526001600160a01b037f000000000000000000000000d6d6a0828a80e1832cd4c3585aded8971087fcb8169063af5b052b90611a7c903390600401613d33565b602060405180830381600087803b158015611a9657600080fd5b505af1158015611aaa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ace9190613ca3565b611aea5760405162461bcd60e51b81526004016109e290614382565b6110b761372d565b600f5481565b600b6020526000908152604090205481565b60055461010090046001600160a01b031690565b33611b27611b0a565b6001600160a01b03161480611bd5575060405163af5b052b60e01b81526001600160a01b037f000000000000000000000000d6d6a0828a80e1832cd4c3585aded8971087fcb8169063af5b052b90611b83903390600401613d33565b602060405180830381600087803b158015611b9d57600080fd5b505af1158015611bb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bd59190613ca3565b611bf15760405162461bcd60e51b81526004016109e290614382565b60115460ff1615611c145760405162461bcd60e51b81526004016109e2906140cc565b6011805460ff19166001179055600854604080516351b9f6a760e11b815290516001600160a01b039092169163a373ed4e9160048082019260009290919082900301818387803b158015611c6757600080fd5b505af1158015611c7b573d6000803e3d6000fd5b50505050336001600160a01b03167ffce7d682dc90b7cc945fb8cfff947668bcf6d304aa58823b24d2c06dec38df6e600c54611cb561170a565b604051611cc39291906146c0565b60405180910390a2565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561097b5780601f106109505761010080835404028352916020019161097b565b60115460ff1681565b6008546001600160a01b031681565b6007546040516370a0823160e01b815260009161161b916001600160a01b03909116906370a0823190611d7d903090600401613d33565b60206040518083038186803b158015611d9557600080fd5b505afa158015611da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dcd9190613cdb565b600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015611e1b57600080fd5b505afa158015611e2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e539190613cdb565b61378e565b6000610999611e656130dc565b84610c96856040518060600160405280602581526020016147a86025913960016000611e8f6130dc565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906132a9565b6000610999611ecd6130dc565b8484613194565b6008546001600160a01b03163314611efe5760405162461bcd60e51b81526004016109e290613f74565b611f2a7f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b753330846135e6565b7f00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c836001600160a01b03167f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b756001600160a01b0316141561206b57604051632e1a7d4d60e01b81526001600160a01b037f00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c831690632e1a7d4d90611fd09084906004016146b7565b600060405180830381600087803b158015611fea57600080fd5b505af1158015611ffe573d6000803e3d6000fd5b505060075460405163b6b55f2560e01b81526001600160a01b03909116925063b6b55f25915083906120349082906004016146b7565b6000604051808303818588803b15801561204d57600080fd5b505af1158015612061573d6000803e3d6000fd5b5050505050612106565b6007546120a3907f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b75906001600160a01b0316836134bf565b60075460405163b6b55f2560e01b81526001600160a01b039091169063b6b55f25906120d39084906004016146b7565b600060405180830381600087803b1580156120ed57600080fd5b505af1158015612101573d6000803e3d6000fd5b505050505b50565b600061161b612116611667565b612129612121611d46565b61212961157c565b90613401565b6121376116ac565b156121545760405162461bcd60e51b81526004016109e29061416f565b600260065414156121775760405162461bcd60e51b81526004016109e290614649565b6002600655806121865761248b565b600860009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156121d657600080fd5b505af11580156121ea573d6000803e3d6000fd5b505050506000612201826121fc6119cb565b6137a6565b9050600081116122235760405162461bcd60e51b81526004016109e290614361565b600061222e3361177e565b336000908152600a602052604081205491925061226d61224e8486613401565b6119ff61226388670de0b6b3a76400006136f3565b61212987876136f3565b336000908152600a6020526040902081905590507f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b756001600160a01b039081167f00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c83909116141561235f578434146122f65760405162461bcd60e51b81526004016109e2906145fd565b60075460405163b6b55f2560e01b81526001600160a01b039091169063b6b55f259034906123289089906004016146b7565b6000604051808303818588803b15801561234157600080fd5b505af1158015612355573d6000803e3d6000fd5b5050505050612426565b61238b7f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b753330886135e6565b6007546123c3907f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b75906001600160a01b0316876134bf565b60075460405163b6b55f2560e01b81526001600160a01b039091169063b6b55f25906123f39088906004016146b7565b600060405180830381600087803b15801561240d57600080fd5b505af1158015612421573d6000803e3d6000fd5b505050505b61243033856137be565b61244761243e86600a6135b4565b600f5490613401565b600f5560405133907f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159061247e90889088906146c0565b60405180910390a2505050505b506001600655565b61249b6130dc565b6001600160a01b03166124ac611b0a565b6001600160a01b0316146124d25760405162461bcd60e51b81526004016109e2906142f5565b600880546001600160a01b038381166001600160a01b03198316179092556040519116907f9ed29eb74f1356c602e59670cf82bfe8b0f564216ce091e163fbf7f0376aa19790610a3e9083908590613d47565b60125481565b6007546001600160a01b031681565b600061161b600c546135a6565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600c5481565b6125806130dc565b6001600160a01b0316612591611b0a565b6001600160a01b0316146125b75760405162461bcd60e51b81526004016109e2906142f5565b6001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156125eb576125e6334761387e565b612106565b6040516370a0823160e01b81526000906001600160a01b038316906370a082319061261a903090600401613d33565b60206040518083038186803b15801561263257600080fd5b505afa158015612646573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061266a9190613cdb565b905061267782338361331a565b5050565b6009546001600160a01b031681565b6126926130dc565b6001600160a01b03166126a3611b0a565b6001600160a01b0316146126c95760405162461bcd60e51b81526004016109e2906142f5565b601180546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6126f96130dc565b6001600160a01b031661270a611b0a565b6001600160a01b0316146127305760405162461bcd60e51b81526004016109e2906142f5565b6001600160a01b0381166127565760405162461bcd60e51b81526004016109e290613eb5565b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b336127c6611b0a565b6001600160a01b03161480612874575060405163af5b052b60e01b81526001600160a01b037f000000000000000000000000d6d6a0828a80e1832cd4c3585aded8971087fcb8169063af5b052b90612822903390600401613d33565b602060405180830381600087803b15801561283c57600080fd5b505af1158015612850573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128749190613ca3565b6128905760405162461bcd60e51b81526004016109e290614382565b60115460ff166128b25760405162461bcd60e51b81526004016109e2906141e6565b6128ba61170a565b156128d75760405162461bcd60e51b81526004016109e29061432a565b60006128e16119cb565b6011805460ff19169055905060006128f761253a565b90508015612bcb57600061295382600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d6d57600080fd5b600754604051632e1a7d4d60e01b81529192506001600160a01b031690632e1a7d4d906129849084906004016146b7565b600060405180830381600087803b15801561299e57600080fd5b505af11580156129b2573d6000803e3d6000fd5b505050507f00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c836001600160a01b03167f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b756001600160a01b03161415612a85577f00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c836001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015612a6b57600080fd5b505af1158015612a7f573d6000803e3d6000fd5b50505050505b81612a8e61157c565b1015612a9957600080fd5b600954612ad1907f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b75906001600160a01b0316846134bf565b6000612add600d61390b565b905060005b81811015612bb6576000612af7600d82613916565b6009546001600160a01b038083166000908152600b60205260409020549293501690639b927a91908390612b3990670de0b6b3a7640000906119ff908c6136f3565b6040518363ffffffff1660e01b8152600401612b56929190613d85565b600060405180830381600087803b158015612b7057600080fd5b505af1158015612b84573d6000803e3d6000fd5b5050506001600160a01b0382166000908152600b602052604081205550612bac600d82613922565b5050600101612ae2565b50612bc330600c54613937565b50506000600c555b60006010819055600854604080516351b9f6a760e11b815290516001600160a01b039092169263a373ed4e9260048084019382900301818387803b158015612c1257600080fd5b505af1158015612c26573d6000803e3d6000fd5b505050506000612c34612109565b9050612c4181600a6135b4565b600f55337f805ee433ea4242be6315bc317b1bf10e767ad8beb03ee547773b3ee1f842c20682612c6f611667565b612c77611d46565b604051612c86939291906146ce565b60405180910390a2505050565b612c9b6116ac565b15612cb85760405162461bcd60e51b81526004016109e29061416f565b60026006541415612cdb5760405162461bcd60e51b81526004016109e290614649565b600260065580612cfd5760405162461bcd60e51b81526004016109e290614533565b60115460ff1615612d205760405162461bcd60e51b81526004016109e290614199565b600f5460105410612d305761248b565b601054600f54612d3f91613497565b811115612d5e5760405162461bcd60e51b81526004016109e2906142c0565b600860009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612dae57600080fd5b505af1158015612dc2573d6000803e3d6000fd5b505050506000612dd482610da56119cb565b9050612de03382613937565b6000612e3483600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d6d57600080fd5b600754604051632e1a7d4d60e01b81529192506001600160a01b031690632e1a7d4d90612e659084906004016146b7565b600060405180830381600087803b158015612e7f57600080fd5b505af1158015612e93573d6000803e3d6000fd5b505060405163438f365360e11b8152600092506001600160a01b037f000000000000000000000000d6d6a0828a80e1832cd4c3585aded8971087fcb816915063871e6ca690612ee6903390600401613d33565b602060405180830381600087803b158015612f0057600080fd5b505af1158015612f14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f389190613ca3565b612f5c57612f576127106119ff601254876136f390919063ffffffff16565b612f5f565b60005b90507f00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c836001600160a01b03167f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b756001600160a01b03161415612fee57601154612fd69061010090046001600160a01b03168261387e565b612fe933612fe48684613497565b61387e565b61305f565b60115461302b907f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b759061010090046001600160a01b03168361331a565b61305f7f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b753361305a8785613497565b61331a565b60105461306c9085613401565b60105560405133907f672004d35ad2124f90299371ade95cf5594500e40705a7cf6eaf7c00b55a07ac906130a5908790869086906146ce565b60405180910390a2505050506001600655565b7f000000000000000000000000d6d6a0828a80e1832cd4c3585aded8971087fcb881565b3390565b6001600160a01b0383166131065760405162461bcd60e51b81526004016109e2906144ef565b6001600160a01b03821661312c5760405162461bcd60e51b81526004016109e290613efb565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906131879085906146b7565b60405180910390a3505050565b6001600160a01b0383166131ba5760405162461bcd60e51b81526004016109e2906144aa565b6001600160a01b0382166131e05760405162461bcd60e51b81526004016109e290613e1e565b6131eb838383610f07565b6132288160405180606001604052806026815260200161475a602691396001600160a01b03861660009081526020819052604090205491906132a9565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546132579082613401565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906131879085906146b7565b600081848411156132cd5760405162461bcd60e51b81526004016109e29190613da9565b505050900390565b6000806132ee836119ff86670de0b6b3a76400006136f3565b9050836132fb828561378e565b146133105761330b816001613401565b613312565b805b949350505050565b60006060846001600160a01b031663a9059cbb8585604051602401613340929190613d85565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516133799190613d17565b6000604051808303816000865af19150503d80600081146133b6576040519150601f19603f3d011682016040523d82523d6000602084013e6133bb565b606091505b50915091508180156133e55750805115806133e55750808060200190518101906133e59190613ca3565b6121015760405162461bcd60e51b81526004016109e2906145b0565b6000828201838110156133105760405162461bcd60e51b81526004016109e290613f3d565b61342e6116ac565b61344a5760405162461bcd60e51b81526004016109e290613e61565b6005805460ff60a81b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6134806130dc565b60405161348d9190613d33565b60405180910390a1565b6000828211156134b95760405162461bcd60e51b81526004016109e290614095565b50900390565b60006060846001600160a01b031663095ea7b385856040516024016134e5929190613d85565b6040516020818303038152906040529060e01b6020820180516001600160e01b03838183161783525050505060405161351e9190613d17565b6000604051808303816000865af19150503d806000811461355b576040519150601f19603f3d011682016040523d82523d6000602084013e613560565b606091505b509150915081801561358a57508051158061358a57508080602001905181019061358a9190613ca3565b6121015760405162461bcd60e51b81526004016109e29061445f565b600061099d82611e536119cb565b60008082116135d55760405162461bcd60e51b81526004016109e2906140f1565b8183816135de57fe5b049392505050565b60006060856001600160a01b03166323b872dd86868660405160240161360e93929190613d61565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516136479190613d17565b6000604051808303816000865af19150503d8060008114613684576040519150601f19603f3d011682016040523d82523d6000602084013e613689565b606091505b50915091508180156136b35750805115806136b35750808060200190518101906136b39190613ca3565b6136cf5760405162461bcd60e51b81526004016109e290613fb9565b505050505050565b60006136ec836001600160a01b038416613a0d565b9392505050565b6000826137025750600061099d565b8282028284828161370f57fe5b04146133105760405162461bcd60e51b81526004016109e29061427f565b6137356116ac565b156137525760405162461bcd60e51b81526004016109e29061416f565b6005805460ff60a81b1916600160a81b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586134806130dc565b60006136ec670de0b6b3a76400006119ff85856136f3565b60006136ec826119ff85670de0b6b3a76400006136f3565b6001600160a01b0382166137e45760405162461bcd60e51b81526004016109e290614680565b6137f060008383610f07565b6002546137fd9082613401565b6002556001600160a01b0382166000908152602081905260409020546138239082613401565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906138729085906146b7565b60405180910390a35050565b604080516000808252602082019092526001600160a01b0384169083906040516138a89190613d17565b60006040518083038185875af1925050503d80600081146138e5576040519150601f19603f3d011682016040523d82523d6000602084013e6138ea565b606091505b5050905080610f075760405162461bcd60e51b81526004016109e29061400a565b600061099d82613a57565b60006136ec8383613a5b565b60006136ec836001600160a01b038416613aa0565b6001600160a01b03821661395d5760405162461bcd60e51b81526004016109e29061441e565b61396982600083610f07565b6139a681604051806060016040528060228152602001614738602291396001600160a01b03851660009081526020819052604090205491906132a9565b6001600160a01b0383166000908152602081905260409020556002546139cc9082613497565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906138729085906146b7565b6000613a198383613b66565b613a4f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561099d565b50600061099d565b5490565b81546000908210613a7e5760405162461bcd60e51b81526004016109e290613ddc565b826000018281548110613a8d57fe5b9060005260206000200154905092915050565b60008181526001830160205260408120548015613b5c5783546000198083019190810190600090879083908110613ad357fe5b9060005260206000200154905080876000018481548110613af057fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080613b2057fe5b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505061099d565b600091505061099d565b60009081526001919091016020526040902054151590565b600060208284031215613b8f578081fd5b813561331081614722565b600060208284031215613bab578081fd5b815161331081614722565b60008060408385031215613bc8578081fd5b8235613bd381614722565b91506020830135613be381614722565b809150509250929050565b600080600060608486031215613c02578081fd5b8335613c0d81614722565b92506020840135613c1d81614722565b91506040840135613c2d81614722565b809150509250925092565b600080600060608486031215613c4c578283fd5b8335613c5781614722565b92506020840135613c6781614722565b929592945050506040919091013590565b60008060408385031215613c8a578182fd5b8235613c9581614722565b946020939093013593505050565b600060208284031215613cb4578081fd5b81518015158114613310578182fd5b600060208284031215613cd4578081fd5b5035919050565b600060208284031215613cec578081fd5b5051919050565b60008060408385031215613d05578182fd5b823591506020830135613be381614722565b60008251613d298184602087016146f2565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6000602082528251806020840152613dc88160408501602087016146f2565b601f01601f19169190910160400192915050565b60208082526022908201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604082015261647360f01b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526014908201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604082015260600190565b6020808252600c908201526b1253959053125117d5d0539560a21b604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526025908201527f576f6f5375706572436861726765725661756c743a20216c656e64696e674d616040820152643730b3b2b960d91b606082015260800190565b60208082526031908201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a207472604082015270185b9cd9995c919c9bdb4819985a5b1959607a1b606082015260800190565b60208082526034908201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60408201527308115512081d1c985b9cd9995c8819985a5b195960621b606082015260800190565b60208082526018908201527f494e535546465f414d4f554e545f464f525f424f52524f570000000000000000604082015260600190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b6020808252600b908201526a494e5f534554544c494e4760a81b604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b60208082526027908201527f576f6f5375706572436861726765725661756c743a20215f776974686472617760408201526626b0b730b3b2b960c91b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602d908201527f576f6f5375706572436861726765725661756c743a204e4f545f414c4c4f574560408201526c445f494e5f534554544c494e4760981b606082015260800190565b60208082526009908201526821534554544c494e4760b81b604082015260600190565b60208082526031908201527f576f6f5375706572436861726765725661756c743a2043414e4e4f545f57495460408201527048445241575f494e5f534554544c494e4760781b606082015260800190565b6020808252600b908201526a494e20534554544c494e4760a81b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252818101527f576f6f5375706572436861726765725661756c743a204f55545f4f465f434150604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526018908201527f5745454b4c595f52455041595f4e4f545f434c45415245440000000000000000604082015260600190565b6020808252600790820152662173686172657360c81b604082015260600190565b6020808252601c908201527f576f6f5375706572436861726765725661756c743a202141444d494e00000000604082015260600190565b60208082526024908201527f576f6f5375706572436861726765725661756c743a20215f7265736572766556604082015263185d5b1d60e21b606082015260800190565b6020808252600790820152660857dd985d5b1d60ca1b604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b6020808252602b908201527f5472616e7366657248656c7065723a3a73616665417070726f76653a2061707060408201526a1c9bdd994819985a5b195960aa1b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f576f6f5375706572436861726765725661756c743a2021616d6f756e74000000604082015260600190565b60208082526026908201527f576f6f5375706572436861726765725661756c743a20215f6c656e64696e674d60408201526530b730b3b2b960d11b606082015260800190565b6020808252602d908201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260408201526c185b9cd9995c8819985a5b1959609a1b606082015260800190565b6020808252602c908201527f576f6f5375706572436861726765725661756c743a206d73672e76616c75655f60408201526b125394d551919250d251539560a21b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b918252602082015260400190565b9283526020830191909152604082015260600190565b60ff91909116815260200190565b60005b8381101561470d5781810151838201526020016146f5565b8381111561471c576000848401525b50505050565b6001600160a01b038116811461210657600080fdfe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220376fd49f39cbe5fc3ec4190d31b02f4b71ec82b2735faff8974106618e5521aa64736f6c634300060c0033

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

00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c8300000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b75000000000000000000000000d6d6a0828a80e1832cd4c3585aded8971087fcb8

-----Decoded View---------------
Arg [0] : _weth (address): 0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83
Arg [1] : _want (address): 0x04068DA6C83AFCFA0e13ba15A6696662335D5B75
Arg [2] : _accessManager (address): 0xd6d6A0828a80E1832cD4C3585aDED8971087fCb8

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c83
Arg [1] : 00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b75
Arg [2] : 000000000000000000000000d6d6a0828a80e1832cd4c3585aded8971087fcb8


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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