MATIC Price: $0.99 (-2.43%)
Gas: 127 GWei
 

Overview

MATIC Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 MATIC

MATIC Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
Value
Accure Interest379214082023-01-11 0:00:14443 days ago1673395214IN
0x8cd11C6F...cFF14b108
0 MATIC0.0013472740.40639123
Repay All379040632023-01-10 13:49:33443 days ago1673358573IN
0x8cd11C6F...cFF14b108
0 MATIC0.0256524262.53790188
Accure Interest378810292023-01-10 0:00:41444 days ago1673308841IN
0x8cd11C6F...cFF14b108
0 MATIC0.00363589100.32542761
Set Interest Rat...378013422023-01-08 0:00:48446 days ago1673136048IN
0x8cd11C6F...cFF14b108
0 MATIC0.0030992960.73708769
Accure Interest378013202023-01-08 0:00:04446 days ago1673136004IN
0x8cd11C6F...cFF14b108
0 MATIC0.0018314650.53565111
Set Interest Rat...377874262023-01-07 15:32:48446 days ago1673105568IN
0x8cd11C6F...cFF14b108
0 MATIC0.0034082966.79269682
Set Interest Rat...377787732023-01-07 10:29:54446 days ago1673087394IN
0x8cd11C6F...cFF14b108
0 MATIC0.00535111104.86622891
Set Interest Rat...377708732023-01-07 5:47:07447 days ago1673070427IN
0x8cd11C6F...cFF14b108
0 MATIC0.0030671260.106686
Set Interest Rat...377614142023-01-07 0:07:20447 days ago1673050040IN
0x8cd11C6F...cFF14b108
0 MATIC0.0033211865.08550989
Accure Interest377612482023-01-07 0:01:36447 days ago1673049696IN
0x8cd11C6F...cFF14b108
0 MATIC0.0018038149.77278028
Accure Interest377209832023-01-06 0:01:08448 days ago1672963268IN
0x8cd11C6F...cFF14b108
0 MATIC0.0018516951.09385903
Set Interest Rat...377141552023-01-05 19:55:03448 days ago1672948503IN
0x8cd11C6F...cFF14b108
0 MATIC0.00812699159.26540233
Set Interest Rat...377059412023-01-05 14:52:45448 days ago1672930365IN
0x8cd11C6F...cFF14b108
0 MATIC0.0032603663.89368621
Set Interest Rat...377020202023-01-05 12:35:48448 days ago1672922148IN
0x8cd11C6F...cFF14b108
0 MATIC0.0038580275.6060854
Set Interest Rat...376995172023-01-05 11:06:08448 days ago1672916768IN
0x8cd11C6F...cFF14b108
0 MATIC0.0040391979.15639451
Set Interest Rat...376976832023-01-05 9:59:31449 days ago1672912771IN
0x8cd11C6F...cFF14b108
0 MATIC0.00562021110.13982683
Set Interest Rat...376853582023-01-05 2:42:39449 days ago1672886559IN
0x8cd11C6F...cFF14b108
0 MATIC0.0050459198.88521356
Set Interest Rat...376831402023-01-05 1:26:21449 days ago1672881981IN
0x8cd11C6F...cFF14b108
0 MATIC0.00556629109.0832348
Set Interest Rat...376814462023-01-05 0:25:55449 days ago1672878355IN
0x8cd11C6F...cFF14b108
0 MATIC0.002291244.90093291
Accure Interest376809092023-01-05 0:05:21449 days ago1672877121IN
0x8cd11C6F...cFF14b108
0 MATIC0.0024875768.63973695
Set Interest Rat...376799222023-01-04 23:31:01449 days ago1672875061IN
0x8cd11C6F...cFF14b108
0 MATIC0.0026681452.28794337
Set Interest Rat...376469712023-01-04 3:21:04450 days ago1672802464IN
0x8cd11C6F...cFF14b108
0 MATIC0.0041024180.39528212
Accure Interest376416162023-01-04 0:06:13450 days ago1672790773IN
0x8cd11C6F...cFF14b108
0 MATIC0.0019270753.17377962
Set Interest Rat...376370142023-01-03 21:21:33450 days ago1672780893IN
0x8cd11C6F...cFF14b108
0 MATIC0.0028169955.20479935
Set Interest Rat...376328992023-01-03 18:55:51450 days ago1672772151IN
0x8cd11C6F...cFF14b108
0 MATIC0.0023830446.70066851
View all transactions

Parent Txn Hash Block From To Value
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
WooLendingManager

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 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 : 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 3 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 4 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 5 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 6 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 7 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 8 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 9 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 10 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 11 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 12 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 13 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 14 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);
            }
        }
    }
}

File 15 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 16 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 17 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 18 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 {}
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"}],"name":"Borrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldInterest","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newInterest","type":"uint256"}],"name":"InterestRateUpdated","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":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"perfFee","type":"uint256"}],"name":"Repay","type":"event"},{"inputs":[],"name":"accessManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accureInterest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"borrow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"borrowState","outputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"principal","type":"uint256"},{"internalType":"uint256","name":"interest","type":"uint256"},{"internalType":"uint256","name":"borrowable","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"borrowedInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"borrowedPrincipal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"debt","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"debtAfterPerfFee","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"stuckToken","type":"address"}],"name":"inCaseTokenGotStuck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_weth","type":"address"},{"internalType":"address","name":"_want","type":"address"},{"internalType":"address","name":"_accessManager","type":"address"},{"internalType":"address","name":"_wooPP","type":"address"},{"internalType":"address payable","name":"_superChargerVault","type":"address"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"interestRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isBorrower","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastAccuredTs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxBorrowableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"perfRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"repay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"repayAll","outputs":[{"internalType":"uint256","name":"repaidAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"repayWeekly","outputs":[{"internalType":"uint256","name":"repaidAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_borrower","type":"address"},{"internalType":"bool","name":"_isBorrower","type":"bool"}],"name":"setBorrower","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rate","type":"uint256"}],"name":"setInterestRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rate","type":"uint256"}],"name":"setPerfRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_wooSuperCharger","type":"address"}],"name":"setSuperChargerVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_wooPP","type":"address"}],"name":"setWooPP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"superChargerVault","outputs":[{"internalType":"contract WooSuperChargerVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"want","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weeklyRepayment","outputs":[{"internalType":"uint256","name":"repayAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weeklyRepaymentBreakdown","outputs":[{"internalType":"uint256","name":"repayAmount","type":"uint256"},{"internalType":"uint256","name":"principal","type":"uint256"},{"internalType":"uint256","name":"interest","type":"uint256"},{"internalType":"uint256","name":"perfFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wooPP","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60806040526103e860095534801561001657600080fd5b506000610021610074565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35060018055610078565b3390565b612277806100876000396000f3fe608060405234801561001057600080fd5b50600436106102065760003560e01c8063a373ed4e1161011a578063e1a4e72a116100ad578063f0f442601161007c578063f0f442601461048f578063f2fde38b146104b5578063fa3ae6dc146104db578063fcc7c4ed146104e3578063fdcb6068146104eb57610206565b8063e1a4e72a1461041f578063e5e2abf514610445578063eaf6e4831461044d578063f077cbab1461048757610206565b8063d183a7a2116100e9578063d183a7a2146103d9578063d736ce7c14610407578063d83e6b381461040f578063dbe08b561461041757610206565b8063a373ed4e1461038f578063bab8583a14610397578063c1ae359a146103b4578063c5ebeaec146103bc57610206565b80634bb2dcea1161019d57806361d027b31161016c57806361d027b314610367578063715018a61461036f5780637c3a00fd146103775780637e452aff1461037f5780638da5cb5b1461038757610206565b80634bb2dcea1461031457806352c49c441461031c5780635bc9f65d146103245780635f84f3021461034a57610206565b8063359ef75b116101d9578063359ef75b14610279578063371fd8e6146102c15780633fc8cef3146102de5780634422bc5a146102e657610206565b80630dca59c11461020b5780631779aacf146102255780631f1fcd511461024d578063245b74be14610271575b600080fd5b6102136104f3565b60408051918252519081900360200190f35b61024b6004803603602081101561023b57600080fd5b50356001600160a01b0316610512565b005b610255610596565b604080516001600160a01b039092168252519081900360200190f35b6102556105a5565b61024b600480360360a081101561028f57600080fd5b506001600160a01b038135811691602081013582169160408201358116916060810135821691608090910135166105b4565b61024b600480360360208110156102d757600080fd5b5035610699565b610255610a4b565b61024b600480360360408110156102fc57600080fd5b506001600160a01b0381351690602001351515610a5a565b610213610ae7565b610213610b5d565b61024b6004803603602081101561033a57600080fd5b50356001600160a01b0316610b63565b61024b6004803603602081101561036057600080fd5b5035610be7565b610255610d5c565b61024b610d6b565b610213610e17565b610213610e1d565b610255610e23565b61024b610e32565b61024b600480360360208110156103ad57600080fd5b5035610ea8565b610213610f9c565b61024b600480360360208110156103d257600080fd5b5035611051565b6103e16112f0565b604080519485526020850193909352838301919091526060830152519081900360800190f35b61025561144a565b610213611459565b6103e16114a2565b61024b6004803603602081101561043557600080fd5b50356001600160a01b0316611540565b610213611663565b6104736004803603602081101561046357600080fd5b50356001600160a01b0316611669565b604080519115158252519081900360200190f35b61021361167e565b61024b600480360360208110156104a557600080fd5b50356001600160a01b0316611761565b61024b600480360360208110156104cb57600080fd5b50356001600160a01b03166118bf565b6102136119c1565b610213611a23565b610255611a29565b600061050c600854600754611a3890919063ffffffff16565b90505b90565b61051a611a9b565b6001600160a01b031661052b610e23565b6001600160a01b031614610574576040805162461bcd60e51b815260206004820181905260248201526000805160206121aa833981519152604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b031681565b6006546001600160a01b031681565b6105bc611a9b565b6001600160a01b03166105cd610e23565b6001600160a01b031614610616576040805162461bcd60e51b815260206004820181905260248201526000805160206121aa833981519152604482015290519081900360640190fd5b600280546001600160a01b03199081166001600160a01b03978816179091556003805482169587169590951790945560048054851693861693909317909255600580548416918516919091179055600680548316919093161790915542600c55600a8054734094d7a17a387795838c7aba4687387b0d32bcf39216919091179055565b336000908152600d602052604090205460ff166106eb576040805162461bcd60e51b815260206004820152601c60248201526000805160206121f5833981519152604482015290519081900360640190fd5b600081116106f857600080fd5b610700610e32565b600354610718906001600160a01b0316333084611a9f565b600354604080516370a0823160e01b8152306004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561076257600080fd5b505afa158015610776573d6000803e3d6000fd5b505050506040513d602081101561078c57600080fd5b5051101561079957600080fd5b600081600854106107d7576008546107b19083611bfc565b6008556009546107d090612710906107ca908590611c59565b90611cb2565b9050610820565b6107f46127106107ca600954600854611c5990919063ffffffff16565b905061081761080e60085484611bfc90919063ffffffff16565b60075490611bfc565b60075560006008555b600354600a5461083d916001600160a01b03908116911683611d19565b60006108498383611bfc565b600354600654919250610869916001600160a01b03918216911683611e6d565b600354604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156108b457600080fd5b505afa1580156108c8573d6000803e3d6000fd5b505050506040513d60208110156108de57600080fd5b50516006546040805163b5589fad60e01b81526004810186905290519293506001600160a01b039091169163b5589fad9160248082019260009290919082900301818387803b15801561093057600080fd5b505af1158015610944573d6000803e3d6000fd5b5050600354604080516370a0823160e01b81523060048201529051600094506001600160a01b0390921692506370a08231916024808301926020929190829003018186803b15801561099557600080fd5b505afa1580156109a9573d6000803e3d6000fd5b505050506040513d60208110156109bf57600080fd5b50519050826109ce8383611bfc565b14610a0a5760405162461bcd60e51b815260040180806020018281038252602581526020018061213e6025913960400191505060405180910390fd5b6040805186815260208101869052815133927f77c6871227e5d2dec8dadd5354f78453203e22e669cd0ec4c19d9a8c5edb31d0928290030190a25050505050565b6002546001600160a01b031681565b610a62611a9b565b6001600160a01b0316610a73610e23565b6001600160a01b031614610abc576040805162461bcd60e51b815260206004820181905260248201526000805160206121aa833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600d60205260409020805460ff1916911515919091179055565b600654604080516325d96e7560e11b815290516000926001600160a01b031691634bb2dcea916004808301926020929190829003018186803b158015610b2c57600080fd5b505afa158015610b40573d6000803e3d6000fd5b505050506040513d6020811015610b5657600080fd5b5051905090565b60085481565b610b6b611a9b565b6001600160a01b0316610b7c610e23565b6001600160a01b031614610bc5576040805162461bcd60e51b815260206004820181905260248201526000805160206121aa833981519152604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b33610bf0610e23565b6001600160a01b03161480610c7b5750600480546040805163af5b052b60e01b81523393810193909352516001600160a01b039091169163af5b052b9160248083019260209291908290030181600087803b158015610c4e57600080fd5b505af1158015610c62573d6000803e3d6000fd5b505050506040513d6020811015610c7857600080fd5b50515b610cc8576040805162461bcd60e51b81526020600482015260196024820152782bb7b7a632b73234b733a6b0b730b3b2b91d1010a0a226a4a760391b604482015290519081900360640190fd5b61c350811115610d0e576040805162461bcd60e51b815260206004820152600c60248201526b1490551157d253959053125160a21b604482015290519081900360640190fd5b610d16610e32565b600b8054908290556040805182815260208101849052815133927f3aebbb85b9698ba4e1588e9f25e8e3bb8d3c5fb5199f6b36b362e6775947b383928290030190a25050565b600a546001600160a01b031681565b610d73611a9b565b6001600160a01b0316610d84610e23565b6001600160a01b031614610dcd576040805162461bcd60e51b815260206004820181905260248201526000805160206121aa833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600b5481565b600c5481565b6000546001600160a01b031690565b600c5442908111610e435750610ea6565b6000610e5a600c5483611bfc90919063ffffffff16565b90506000610e8d6127106107ca6301e133806107ca86610e87600b54600754611c5990919063ffffffff16565b90611c59565b600854909150610e9d9082611a38565b6008555050600c555b565b33610eb1610e23565b6001600160a01b03161480610f3c5750600480546040805163af5b052b60e01b81523393810193909352516001600160a01b039091169163af5b052b9160248083019260209291908290030181600087803b158015610f0f57600080fd5b505af1158015610f23573d6000803e3d6000fd5b505050506040513d6020811015610f3957600080fd5b50515b610f89576040805162461bcd60e51b81526020600482015260196024820152782bb7b7a632b73234b733a6b0b730b3b2b91d1010a0a226a4a760391b604482015290519081900360640190fd5b6127108110610f9757600080fd5b600955565b336000908152600d602052604081205460ff16610fee576040805162461bcd60e51b815260206004820152601c60248201526000805160206121f5833981519152604482015290519081900360640190fd5b610ff6610e32565b610ffe61167e565b905080156110145761100f81610699565b61050f565b6040805160008082526020820152815133927f77c6871227e5d2dec8dadd5354f78453203e22e669cd0ec4c19d9a8c5edb31d0928290030190a290565b336000908152600d602052604090205460ff166110a3576040805162461bcd60e51b815260206004820152601c60248201526000805160206121f5833981519152604482015290519081900360640190fd5b600081116110e2576040805162461bcd60e51b815260206004820152600760248201526608505353d5539560ca1b604482015290519081900360640190fd5b6110ea610e32565b6007546110f79082611a38565b600755600354600554604080516370a0823160e01b81526001600160a01b039283166004820152905160009392909216916370a0823191602480820192602092909190829003018186803b15801561114e57600080fd5b505afa158015611162573d6000803e3d6000fd5b505050506040513d602081101561117857600080fd5b50516006546005546040805163175491cf60e11b8152600481018790526001600160a01b0392831660248201529051939450911691632ea9239e9160448082019260009290919082900301818387803b1580156111d457600080fd5b505af11580156111e8573d6000803e3d6000fd5b5050600354600554604080516370a0823160e01b81526001600160a01b0392831660048201529051600095509190921692506370a0823191602480820192602092909190829003018186803b15801561124057600080fd5b505afa158015611254573d6000803e3d6000fd5b505050506040513d602081101561126a57600080fd5b50519050826112798284611bfc565b146112b55760405162461bcd60e51b81526004018080602001828103825260268152602001806121636026913960400191505060405180910390fd5b60408051848152905133917fcbc04eca7e9da35cb1393a6135a199ca52e450d5e9251cbd99f7847d33a36750919081900360200190a2505050565b6000806000806000600660009054906101000a90046001600160a01b03166001600160a01b0316636aa9eda26040518163ffffffff1660e01b815260040160206040518083038186803b15801561134657600080fd5b505afa15801561135a573d6000803e3d6000fd5b505050506040513d602081101561137057600080fd5b505190508061138d57600080600080945094509450945050611444565b60085481116113ca576113bc6113b0600954612710611bfc90919063ffffffff16565b6107ca83612710611c59565b945060009350809250611429565b61140a6113f66113e7600954612710611bfc90919063ffffffff16565b6008546107ca90612710611c59565b600854611404908490611bfc565b90611a38565b945061142160085482611bfc90919063ffffffff16565b935060085492505b611434856001611a38565b94506114408582611bfc565b9150505b90919293565b6005546001600160a01b031681565b6000806114796127106107ca600954600854611c5990919063ffffffff16565b905061149c81611496600854600754611a3890919063ffffffff16565b90611bfc565b91505090565b6000806000806114b06104f3565b935060075492506008549150600660009054906101000a90046001600160a01b03166001600160a01b0316634bb2dcea6040518163ffffffff1660e01b815260040160206040518083038186803b15801561150a57600080fd5b505afa15801561151e573d6000803e3d6000fd5b505050506040513d602081101561153457600080fd5b50519394929391929050565b611548611a9b565b6001600160a01b0316611559610e23565b6001600160a01b0316146115a2576040805162461bcd60e51b815260206004820181905260248201526000805160206121aa833981519152604482015290519081900360640190fd5b6001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156115d6576115d13347611fba565b611660565b6000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561162557600080fd5b505afa158015611639573d6000803e3d6000fd5b505050506040513d602081101561164f57600080fd5b5051905061165e823383611d19565b505b50565b60095481565b600d6020526000908152604090205460ff1681565b600080600660009054906101000a90046001600160a01b03166001600160a01b0316636aa9eda26040518163ffffffff1660e01b815260040160206040518083038186803b1580156116cf57600080fd5b505afa1580156116e3573d6000803e3d6000fd5b505050506040513d60208110156116f957600080fd5b505190508061170c57600091505061050f565b60085481116117365761172f6113b0600954612710611bfc90919063ffffffff16565b9150611756565b6117536113f66113e7600954612710611bfc90919063ffffffff16565b91505b61149c826001611a38565b3361176a610e23565b6001600160a01b031614806117f55750600480546040805163af5b052b60e01b81523393810193909352516001600160a01b039091169163af5b052b9160248083019260209291908290030181600087803b1580156117c857600080fd5b505af11580156117dc573d6000803e3d6000fd5b505050506040513d60208110156117f257600080fd5b50515b611842576040805162461bcd60e51b81526020600482015260196024820152782bb7b7a632b73234b733a6b0b730b3b2b91d1010a0a226a4a760391b604482015290519081900360640190fd5b6001600160a01b03811661189d576040805162461bcd60e51b815260206004820152601d60248201527f576f6f4c656e64696e674d616e616765723a20215f7472656173757279000000604482015290519081900360640190fd5b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6118c7611a9b565b6001600160a01b03166118d8610e23565b6001600160a01b031614611921576040805162461bcd60e51b815260206004820181905260248201526000805160206121aa833981519152604482015290519081900360640190fd5b6001600160a01b0381166119665760405162461bcd60e51b81526004018080602001828103825260268152602001806120b36026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b336000908152600d602052604081205460ff16611a13576040805162461bcd60e51b815260206004820152601c60248201526000805160206121f5833981519152604482015290519081900360640190fd5b611a1b610e32565b610ffe6104f3565b60075481565b6004546001600160a01b031681565b600082820183811015611a92576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b3390565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17815292518251600094606094938a169392918291908083835b60208310611b245780518252601f199092019160209182019101611b05565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611b86576040519150601f19603f3d011682016040523d82523d6000602084013e611b8b565b606091505b5091509150818015611bb9575080511580611bb95750808060200190516020811015611bb657600080fd5b50515b611bf45760405162461bcd60e51b81526004018080602001828103825260318152602001806120d96031913960400191505060405180910390fd5b505050505050565b600082821115611c53576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082611c6857506000611a95565b82820282848281611c7557fe5b0414611a925760405162461bcd60e51b81526004018080602001828103825260218152602001806121896021913960400191505060405180910390fd5b6000808211611d08576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381611d1157fe5b049392505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b178152925182516000946060949389169392918291908083835b60208310611d965780518252601f199092019160209182019101611d77565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611df8576040519150601f19603f3d011682016040523d82523d6000602084013e611dfd565b606091505b5091509150818015611e2b575080511580611e2b5750808060200190516020811015611e2857600080fd5b50515b611e665760405162461bcd60e51b815260040180806020018281038252602d815260200180612215602d913960400191505060405180910390fd5b5050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b178152925182516000946060949389169392918291908083835b60208310611eea5780518252601f199092019160209182019101611ecb565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611f4c576040519150601f19603f3d011682016040523d82523d6000602084013e611f51565b606091505b5091509150818015611f7f575080511580611f7f5750808060200190516020811015611f7c57600080fd5b50515b611e665760405162461bcd60e51b815260040180806020018281038252602b8152602001806121ca602b913960400191505060405180910390fd5b604080516000808252602082019092526001600160a01b0384169083906040518082805190602001908083835b602083106120065780518252601f199092019160209182019101611fe7565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612068576040519150601f19603f3d011682016040523d82523d6000602084013e61206d565b606091505b50509050806120ad5760405162461bcd60e51b815260040180806020018281038252603481526020018061210a6034913960400191505060405180910390fd5b50505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573735472616e7366657248656c7065723a3a7472616e7366657246726f6d3a207472616e7366657246726f6d206661696c65645472616e7366657248656c7065723a3a736166655472616e736665724554483a20455448207472616e73666572206661696c6564576f6f4c656e64696e674d616e616765723a2052455041595f414d4f554e545f4552524f52576f6f4c656e64696e674d616e616765723a20424f52524f575f414d4f554e545f4552524f52536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657248656c7065723a3a73616665417070726f76653a20617070726f7665206661696c6564576f6f4c656e64696e674d616e616765723a2021626f72726f776572000000005472616e7366657248656c7065723a3a736166655472616e736665723a207472616e73666572206661696c6564a264697066735822122004e376606ee003754564a33928bf357df1d81776c0014c93a6b5b1c8b3210bd664736f6c634300060c0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102065760003560e01c8063a373ed4e1161011a578063e1a4e72a116100ad578063f0f442601161007c578063f0f442601461048f578063f2fde38b146104b5578063fa3ae6dc146104db578063fcc7c4ed146104e3578063fdcb6068146104eb57610206565b8063e1a4e72a1461041f578063e5e2abf514610445578063eaf6e4831461044d578063f077cbab1461048757610206565b8063d183a7a2116100e9578063d183a7a2146103d9578063d736ce7c14610407578063d83e6b381461040f578063dbe08b561461041757610206565b8063a373ed4e1461038f578063bab8583a14610397578063c1ae359a146103b4578063c5ebeaec146103bc57610206565b80634bb2dcea1161019d57806361d027b31161016c57806361d027b314610367578063715018a61461036f5780637c3a00fd146103775780637e452aff1461037f5780638da5cb5b1461038757610206565b80634bb2dcea1461031457806352c49c441461031c5780635bc9f65d146103245780635f84f3021461034a57610206565b8063359ef75b116101d9578063359ef75b14610279578063371fd8e6146102c15780633fc8cef3146102de5780634422bc5a146102e657610206565b80630dca59c11461020b5780631779aacf146102255780631f1fcd511461024d578063245b74be14610271575b600080fd5b6102136104f3565b60408051918252519081900360200190f35b61024b6004803603602081101561023b57600080fd5b50356001600160a01b0316610512565b005b610255610596565b604080516001600160a01b039092168252519081900360200190f35b6102556105a5565b61024b600480360360a081101561028f57600080fd5b506001600160a01b038135811691602081013582169160408201358116916060810135821691608090910135166105b4565b61024b600480360360208110156102d757600080fd5b5035610699565b610255610a4b565b61024b600480360360408110156102fc57600080fd5b506001600160a01b0381351690602001351515610a5a565b610213610ae7565b610213610b5d565b61024b6004803603602081101561033a57600080fd5b50356001600160a01b0316610b63565b61024b6004803603602081101561036057600080fd5b5035610be7565b610255610d5c565b61024b610d6b565b610213610e17565b610213610e1d565b610255610e23565b61024b610e32565b61024b600480360360208110156103ad57600080fd5b5035610ea8565b610213610f9c565b61024b600480360360208110156103d257600080fd5b5035611051565b6103e16112f0565b604080519485526020850193909352838301919091526060830152519081900360800190f35b61025561144a565b610213611459565b6103e16114a2565b61024b6004803603602081101561043557600080fd5b50356001600160a01b0316611540565b610213611663565b6104736004803603602081101561046357600080fd5b50356001600160a01b0316611669565b604080519115158252519081900360200190f35b61021361167e565b61024b600480360360208110156104a557600080fd5b50356001600160a01b0316611761565b61024b600480360360208110156104cb57600080fd5b50356001600160a01b03166118bf565b6102136119c1565b610213611a23565b610255611a29565b600061050c600854600754611a3890919063ffffffff16565b90505b90565b61051a611a9b565b6001600160a01b031661052b610e23565b6001600160a01b031614610574576040805162461bcd60e51b815260206004820181905260248201526000805160206121aa833981519152604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b031681565b6006546001600160a01b031681565b6105bc611a9b565b6001600160a01b03166105cd610e23565b6001600160a01b031614610616576040805162461bcd60e51b815260206004820181905260248201526000805160206121aa833981519152604482015290519081900360640190fd5b600280546001600160a01b03199081166001600160a01b03978816179091556003805482169587169590951790945560048054851693861693909317909255600580548416918516919091179055600680548316919093161790915542600c55600a8054734094d7a17a387795838c7aba4687387b0d32bcf39216919091179055565b336000908152600d602052604090205460ff166106eb576040805162461bcd60e51b815260206004820152601c60248201526000805160206121f5833981519152604482015290519081900360640190fd5b600081116106f857600080fd5b610700610e32565b600354610718906001600160a01b0316333084611a9f565b600354604080516370a0823160e01b8152306004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561076257600080fd5b505afa158015610776573d6000803e3d6000fd5b505050506040513d602081101561078c57600080fd5b5051101561079957600080fd5b600081600854106107d7576008546107b19083611bfc565b6008556009546107d090612710906107ca908590611c59565b90611cb2565b9050610820565b6107f46127106107ca600954600854611c5990919063ffffffff16565b905061081761080e60085484611bfc90919063ffffffff16565b60075490611bfc565b60075560006008555b600354600a5461083d916001600160a01b03908116911683611d19565b60006108498383611bfc565b600354600654919250610869916001600160a01b03918216911683611e6d565b600354604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156108b457600080fd5b505afa1580156108c8573d6000803e3d6000fd5b505050506040513d60208110156108de57600080fd5b50516006546040805163b5589fad60e01b81526004810186905290519293506001600160a01b039091169163b5589fad9160248082019260009290919082900301818387803b15801561093057600080fd5b505af1158015610944573d6000803e3d6000fd5b5050600354604080516370a0823160e01b81523060048201529051600094506001600160a01b0390921692506370a08231916024808301926020929190829003018186803b15801561099557600080fd5b505afa1580156109a9573d6000803e3d6000fd5b505050506040513d60208110156109bf57600080fd5b50519050826109ce8383611bfc565b14610a0a5760405162461bcd60e51b815260040180806020018281038252602581526020018061213e6025913960400191505060405180910390fd5b6040805186815260208101869052815133927f77c6871227e5d2dec8dadd5354f78453203e22e669cd0ec4c19d9a8c5edb31d0928290030190a25050505050565b6002546001600160a01b031681565b610a62611a9b565b6001600160a01b0316610a73610e23565b6001600160a01b031614610abc576040805162461bcd60e51b815260206004820181905260248201526000805160206121aa833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600d60205260409020805460ff1916911515919091179055565b600654604080516325d96e7560e11b815290516000926001600160a01b031691634bb2dcea916004808301926020929190829003018186803b158015610b2c57600080fd5b505afa158015610b40573d6000803e3d6000fd5b505050506040513d6020811015610b5657600080fd5b5051905090565b60085481565b610b6b611a9b565b6001600160a01b0316610b7c610e23565b6001600160a01b031614610bc5576040805162461bcd60e51b815260206004820181905260248201526000805160206121aa833981519152604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b33610bf0610e23565b6001600160a01b03161480610c7b5750600480546040805163af5b052b60e01b81523393810193909352516001600160a01b039091169163af5b052b9160248083019260209291908290030181600087803b158015610c4e57600080fd5b505af1158015610c62573d6000803e3d6000fd5b505050506040513d6020811015610c7857600080fd5b50515b610cc8576040805162461bcd60e51b81526020600482015260196024820152782bb7b7a632b73234b733a6b0b730b3b2b91d1010a0a226a4a760391b604482015290519081900360640190fd5b61c350811115610d0e576040805162461bcd60e51b815260206004820152600c60248201526b1490551157d253959053125160a21b604482015290519081900360640190fd5b610d16610e32565b600b8054908290556040805182815260208101849052815133927f3aebbb85b9698ba4e1588e9f25e8e3bb8d3c5fb5199f6b36b362e6775947b383928290030190a25050565b600a546001600160a01b031681565b610d73611a9b565b6001600160a01b0316610d84610e23565b6001600160a01b031614610dcd576040805162461bcd60e51b815260206004820181905260248201526000805160206121aa833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600b5481565b600c5481565b6000546001600160a01b031690565b600c5442908111610e435750610ea6565b6000610e5a600c5483611bfc90919063ffffffff16565b90506000610e8d6127106107ca6301e133806107ca86610e87600b54600754611c5990919063ffffffff16565b90611c59565b600854909150610e9d9082611a38565b6008555050600c555b565b33610eb1610e23565b6001600160a01b03161480610f3c5750600480546040805163af5b052b60e01b81523393810193909352516001600160a01b039091169163af5b052b9160248083019260209291908290030181600087803b158015610f0f57600080fd5b505af1158015610f23573d6000803e3d6000fd5b505050506040513d6020811015610f3957600080fd5b50515b610f89576040805162461bcd60e51b81526020600482015260196024820152782bb7b7a632b73234b733a6b0b730b3b2b91d1010a0a226a4a760391b604482015290519081900360640190fd5b6127108110610f9757600080fd5b600955565b336000908152600d602052604081205460ff16610fee576040805162461bcd60e51b815260206004820152601c60248201526000805160206121f5833981519152604482015290519081900360640190fd5b610ff6610e32565b610ffe61167e565b905080156110145761100f81610699565b61050f565b6040805160008082526020820152815133927f77c6871227e5d2dec8dadd5354f78453203e22e669cd0ec4c19d9a8c5edb31d0928290030190a290565b336000908152600d602052604090205460ff166110a3576040805162461bcd60e51b815260206004820152601c60248201526000805160206121f5833981519152604482015290519081900360640190fd5b600081116110e2576040805162461bcd60e51b815260206004820152600760248201526608505353d5539560ca1b604482015290519081900360640190fd5b6110ea610e32565b6007546110f79082611a38565b600755600354600554604080516370a0823160e01b81526001600160a01b039283166004820152905160009392909216916370a0823191602480820192602092909190829003018186803b15801561114e57600080fd5b505afa158015611162573d6000803e3d6000fd5b505050506040513d602081101561117857600080fd5b50516006546005546040805163175491cf60e11b8152600481018790526001600160a01b0392831660248201529051939450911691632ea9239e9160448082019260009290919082900301818387803b1580156111d457600080fd5b505af11580156111e8573d6000803e3d6000fd5b5050600354600554604080516370a0823160e01b81526001600160a01b0392831660048201529051600095509190921692506370a0823191602480820192602092909190829003018186803b15801561124057600080fd5b505afa158015611254573d6000803e3d6000fd5b505050506040513d602081101561126a57600080fd5b50519050826112798284611bfc565b146112b55760405162461bcd60e51b81526004018080602001828103825260268152602001806121636026913960400191505060405180910390fd5b60408051848152905133917fcbc04eca7e9da35cb1393a6135a199ca52e450d5e9251cbd99f7847d33a36750919081900360200190a2505050565b6000806000806000600660009054906101000a90046001600160a01b03166001600160a01b0316636aa9eda26040518163ffffffff1660e01b815260040160206040518083038186803b15801561134657600080fd5b505afa15801561135a573d6000803e3d6000fd5b505050506040513d602081101561137057600080fd5b505190508061138d57600080600080945094509450945050611444565b60085481116113ca576113bc6113b0600954612710611bfc90919063ffffffff16565b6107ca83612710611c59565b945060009350809250611429565b61140a6113f66113e7600954612710611bfc90919063ffffffff16565b6008546107ca90612710611c59565b600854611404908490611bfc565b90611a38565b945061142160085482611bfc90919063ffffffff16565b935060085492505b611434856001611a38565b94506114408582611bfc565b9150505b90919293565b6005546001600160a01b031681565b6000806114796127106107ca600954600854611c5990919063ffffffff16565b905061149c81611496600854600754611a3890919063ffffffff16565b90611bfc565b91505090565b6000806000806114b06104f3565b935060075492506008549150600660009054906101000a90046001600160a01b03166001600160a01b0316634bb2dcea6040518163ffffffff1660e01b815260040160206040518083038186803b15801561150a57600080fd5b505afa15801561151e573d6000803e3d6000fd5b505050506040513d602081101561153457600080fd5b50519394929391929050565b611548611a9b565b6001600160a01b0316611559610e23565b6001600160a01b0316146115a2576040805162461bcd60e51b815260206004820181905260248201526000805160206121aa833981519152604482015290519081900360640190fd5b6001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156115d6576115d13347611fba565b611660565b6000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561162557600080fd5b505afa158015611639573d6000803e3d6000fd5b505050506040513d602081101561164f57600080fd5b5051905061165e823383611d19565b505b50565b60095481565b600d6020526000908152604090205460ff1681565b600080600660009054906101000a90046001600160a01b03166001600160a01b0316636aa9eda26040518163ffffffff1660e01b815260040160206040518083038186803b1580156116cf57600080fd5b505afa1580156116e3573d6000803e3d6000fd5b505050506040513d60208110156116f957600080fd5b505190508061170c57600091505061050f565b60085481116117365761172f6113b0600954612710611bfc90919063ffffffff16565b9150611756565b6117536113f66113e7600954612710611bfc90919063ffffffff16565b91505b61149c826001611a38565b3361176a610e23565b6001600160a01b031614806117f55750600480546040805163af5b052b60e01b81523393810193909352516001600160a01b039091169163af5b052b9160248083019260209291908290030181600087803b1580156117c857600080fd5b505af11580156117dc573d6000803e3d6000fd5b505050506040513d60208110156117f257600080fd5b50515b611842576040805162461bcd60e51b81526020600482015260196024820152782bb7b7a632b73234b733a6b0b730b3b2b91d1010a0a226a4a760391b604482015290519081900360640190fd5b6001600160a01b03811661189d576040805162461bcd60e51b815260206004820152601d60248201527f576f6f4c656e64696e674d616e616765723a20215f7472656173757279000000604482015290519081900360640190fd5b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6118c7611a9b565b6001600160a01b03166118d8610e23565b6001600160a01b031614611921576040805162461bcd60e51b815260206004820181905260248201526000805160206121aa833981519152604482015290519081900360640190fd5b6001600160a01b0381166119665760405162461bcd60e51b81526004018080602001828103825260268152602001806120b36026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b336000908152600d602052604081205460ff16611a13576040805162461bcd60e51b815260206004820152601c60248201526000805160206121f5833981519152604482015290519081900360640190fd5b611a1b610e32565b610ffe6104f3565b60075481565b6004546001600160a01b031681565b600082820183811015611a92576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b3390565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17815292518251600094606094938a169392918291908083835b60208310611b245780518252601f199092019160209182019101611b05565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611b86576040519150601f19603f3d011682016040523d82523d6000602084013e611b8b565b606091505b5091509150818015611bb9575080511580611bb95750808060200190516020811015611bb657600080fd5b50515b611bf45760405162461bcd60e51b81526004018080602001828103825260318152602001806120d96031913960400191505060405180910390fd5b505050505050565b600082821115611c53576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082611c6857506000611a95565b82820282848281611c7557fe5b0414611a925760405162461bcd60e51b81526004018080602001828103825260218152602001806121896021913960400191505060405180910390fd5b6000808211611d08576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381611d1157fe5b049392505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b178152925182516000946060949389169392918291908083835b60208310611d965780518252601f199092019160209182019101611d77565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611df8576040519150601f19603f3d011682016040523d82523d6000602084013e611dfd565b606091505b5091509150818015611e2b575080511580611e2b5750808060200190516020811015611e2857600080fd5b50515b611e665760405162461bcd60e51b815260040180806020018281038252602d815260200180612215602d913960400191505060405180910390fd5b5050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b178152925182516000946060949389169392918291908083835b60208310611eea5780518252601f199092019160209182019101611ecb565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611f4c576040519150601f19603f3d011682016040523d82523d6000602084013e611f51565b606091505b5091509150818015611f7f575080511580611f7f5750808060200190516020811015611f7c57600080fd5b50515b611e665760405162461bcd60e51b815260040180806020018281038252602b8152602001806121ca602b913960400191505060405180910390fd5b604080516000808252602082019092526001600160a01b0384169083906040518082805190602001908083835b602083106120065780518252601f199092019160209182019101611fe7565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612068576040519150601f19603f3d011682016040523d82523d6000602084013e61206d565b606091505b50509050806120ad5760405162461bcd60e51b815260040180806020018281038252603481526020018061210a6034913960400191505060405180910390fd5b50505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573735472616e7366657248656c7065723a3a7472616e7366657246726f6d3a207472616e7366657246726f6d206661696c65645472616e7366657248656c7065723a3a736166655472616e736665724554483a20455448207472616e73666572206661696c6564576f6f4c656e64696e674d616e616765723a2052455041595f414d4f554e545f4552524f52576f6f4c656e64696e674d616e616765723a20424f52524f575f414d4f554e545f4552524f52536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657248656c7065723a3a73616665417070726f76653a20617070726f7665206661696c6564576f6f4c656e64696e674d616e616765723a2021626f72726f776572000000005472616e7366657248656c7065723a3a736166655472616e736665723a207472616e73666572206661696c6564a264697066735822122004e376606ee003754564a33928bf357df1d81776c0014c93a6b5b1c8b3210bd664736f6c634300060c0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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