Source Code
More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 2,447 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Deposit | 44814231 | 27 hrs ago | IN | 0 ETH | 0.00000015 | ||||
| Deposit | 44814195 | 27 hrs ago | IN | 0 ETH | 0.00000015 | ||||
| Deposit | 44814176 | 27 hrs ago | IN | 0 ETH | 0.00000016 | ||||
| Request Withdraw... | 44750336 | 2 days ago | IN | 0 ETH | 0.00000146 | ||||
| Approve | 44750326 | 2 days ago | IN | 0 ETH | 0.00000024 | ||||
| Request Withdraw... | 44738184 | 2 days ago | IN | 0 ETH | 0.00000308 | ||||
| Approve | 44738183 | 2 days ago | IN | 0 ETH | 0.00000052 | ||||
| Approve | 44701265 | 3 days ago | IN | 0 ETH | 0.00000029 | ||||
| Request Withdraw... | 44701254 | 3 days ago | IN | 0 ETH | 0.00000027 | ||||
| Request Withdraw... | 44701231 | 3 days ago | IN | 0 ETH | 0.00000276 | ||||
| Approve | 44701206 | 3 days ago | IN | 0 ETH | 0.00000034 | ||||
| Approve | 44699842 | 3 days ago | IN | 0 ETH | 0.00000018 | ||||
| Approve | 44673118 | 4 days ago | IN | 0 ETH | 0.00000019 | ||||
| End Weekly Settl... | 44624764 | 5 days ago | IN | 0 ETH | 0.00000838 | ||||
| Start Weekly Set... | 44624757 | 5 days ago | IN | 0 ETH | 0.00000237 | ||||
| Request Withdraw... | 44615505 | 5 days ago | IN | 0 ETH | 0.00000139 | ||||
| Approve | 44615479 | 5 days ago | IN | 0 ETH | 0.00000023 | ||||
| Request Withdraw | 44599797 | 6 days ago | IN | 0 ETH | 0.00000193 | ||||
| Approve | 44599763 | 6 days ago | IN | 0 ETH | 0.00000019 | ||||
| Request Withdraw... | 44591097 | 6 days ago | IN | 0 ETH | 0.00000273 | ||||
| Deposit | 44552704 | 7 days ago | IN | 0 ETH | 0.00000015 | ||||
| Deposit | 44552699 | 7 days ago | IN | 0 ETH | 0.00000015 | ||||
| Deposit | 44552696 | 7 days ago | IN | 0 ETH | 0.00000015 | ||||
| Request Withdraw... | 44500196 | 8 days ago | IN | 0 ETH | 0.00000275 | ||||
| Approve | 44500195 | 8 days ago | IN | 0 ETH | 0.00000046 |
Latest 25 internal transactions (View All)
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 44624764 | 5 days ago | 0.55985588 ETH | ||||
| 44624764 | 5 days ago | 0.55985588 ETH | ||||
| 44329309 | 12 days ago | 2.47310265 ETH | ||||
| 44328994 | 12 days ago | 2.91043227 ETH | ||||
| 44325359 | 12 days ago | 0.18006225 ETH | ||||
| 44325359 | 12 days ago | 0.18006225 ETH | ||||
| 44324662 | 12 days ago | 0.34860566 ETH | ||||
| 44324662 | 12 days ago | 0.34860566 ETH | ||||
| 44290195 | 13 days ago | 0.0094314 ETH | ||||
| 44290195 | 13 days ago | 0.00009526 ETH | ||||
| 44290195 | 13 days ago | 0.00952666 ETH | ||||
| 44289273 | 13 days ago | 0.19910649 ETH | ||||
| 44289273 | 13 days ago | 0.00201117 ETH | ||||
| 44289273 | 13 days ago | 0.20111767 ETH | ||||
| 44170236 | 16 days ago | 0.0015 ETH | ||||
| 43419529 | 33 days ago | 0.005 ETH | ||||
| 43419034 | 33 days ago | 6.74112552 ETH | ||||
| 43419034 | 33 days ago | 6.74112552 ETH | ||||
| 43418245 | 33 days ago | 6.06848565 ETH | ||||
| 43418245 | 33 days ago | 6.06848565 ETH | ||||
| 43115724 | 40 days ago | 1.38223758 ETH | ||||
| 43115724 | 40 days ago | 1.38223758 ETH | ||||
| 43115606 | 40 days ago | 1.25097043 ETH | ||||
| 43115606 | 40 days ago | 1.25097043 ETH | ||||
| 42945874 | 44 days ago | 2.799 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
WooSuperChargerVaultV2
Compiler Version
v0.8.14+commit.80d49f37
Optimization Enabled:
Yes with 20000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;
/*
░██╗░░░░░░░██╗░█████╗░░█████╗░░░░░░░███████╗██╗
░██║░░██╗░░██║██╔══██╗██╔══██╗░░░░░░██╔════╝██║
░╚██╗████╗██╔╝██║░░██║██║░░██║█████╗█████╗░░██║
░░████╔═████║░██║░░██║██║░░██║╚════╝██╔══╝░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝╚█████╔╝░░░░░░██║░░░░░██║
░░░╚═╝░░░╚═╝░░░╚════╝░░╚════╝░░░░░░░╚═╝░░░░░╚═╝
*
* MIT License
* ===========
*
* Copyright (c) 2020 WooTrade
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import "../interfaces/IStrategy.sol";
import "../interfaces/IWETH.sol";
import "../interfaces/IWooAccessManager.sol";
import "../interfaces/IVaultV2.sol";
import "../interfaces/IMasterChefWoo.sol";
import "./WooWithdrawManagerV2.sol";
import "./WooLendingManager.sol";
import "../libraries/TransferHelper.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
contract WooSuperChargerVaultV2 is ERC20, Ownable, Pausable, ReentrancyGuard {
using EnumerableSet for EnumerableSet.AddressSet;
event Deposit(address indexed depositor, address indexed receiver, uint256 assets, uint256 shares);
event RequestWithdraw(address indexed owner, uint256 assets, uint256 shares);
event InstantWithdraw(address indexed owner, 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 SuperChargerVaultMigrated(
address indexed user,
address indexed oldVault,
address indexed newVault,
uint256 amount
);
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;
address public migrationVault;
WooLendingManager public lendingManager;
WooWithdrawManagerV2 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%
uint256 public maxWithdrawCount = 300;
address public masterChef;
uint256 public pid;
constructor(
address _weth,
address _want,
address _accessManager
)
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 = WooWithdrawManagerV2(_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 setMasterChef(address _masterChef, uint256 _pid) external onlyOwner {
require(_masterChef != address(0), "!_masterChef");
masterChef = _masterChef;
pid = _pid;
(IERC20 weToken, , , , ) = IMasterChefWoo(masterChef).poolInfo(pid);
require(address(weToken) == address(this), "!pid");
}
function stakedShares(address _user) public view returns (uint256 shares) {
if (masterChef == address(0)) {
shares = 0;
} else {
(shares, ) = IMasterChefWoo(masterChef).userInfo(pid, _user);
}
}
function deposit(uint256 amount) external payable whenNotPaused nonReentrant {
_deposit(amount, msg.sender);
}
function deposit(uint256 amount, address receiver) external payable whenNotPaused nonReentrant {
_deposit(amount, receiver);
}
function _deposit(uint256 amount, address receiver) private {
if (amount == 0) {
return;
}
lendingManager.accureInterest();
uint256 shares = _shares(amount, getPricePerFullShare());
require(shares > 0, "!shares");
uint256 sharesBefore = balanceOf(receiver) + stakedShares(receiver);
uint256 costBefore = costSharePrice[receiver];
uint256 costAfter = (sharesBefore * costBefore + amount * 1e18) / (sharesBefore + shares);
costSharePrice[receiver] = costAfter;
if (want == weth) {
require(amount == msg.value, "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(receiver, shares);
instantWithdrawCap = instantWithdrawCap + amount / 10;
emit Deposit(msg.sender, receiver, amount, shares);
}
function instantWithdraw(uint256 amount) external whenNotPaused nonReentrant {
_instantWithdrawShares(_sharesUpLatest(amount), msg.sender);
}
function instantWithdrawAll() external whenNotPaused nonReentrant {
_instantWithdrawShares(balanceOf(msg.sender), msg.sender);
}
function _instantWithdrawShares(uint256 shares, address owner) private {
require(shares > 0, "WooSuperChargerVault: !amount");
require(!isSettling, "WooSuperChargerVault: NOT_ALLOWED_IN_SETTLING");
if (instantWithdrawnAmount >= instantWithdrawCap) {
// NOTE: no more instant withdraw quota.
return;
}
lendingManager.accureInterest();
uint256 amount = _assets(shares);
require(amount <= instantWithdrawCap - instantWithdrawnAmount, "WooSuperChargerVault: OUT_OF_CAP");
if (msg.sender != owner) {
_spendAllowance(owner, msg.sender, shares);
}
_burn(owner, shares);
uint256 reserveShares = _sharesUp(amount, reserveVault.getPricePerFullShare());
reserveVault.withdraw(reserveShares);
uint256 fee = accessManager.isZeroFeeVault(msg.sender) ? 0 : (amount * instantWithdrawFeeRate) / 10000;
if (want == weth) {
TransferHelper.safeTransferETH(treasury, fee);
TransferHelper.safeTransferETH(owner, amount - fee);
} else {
TransferHelper.safeTransfer(want, treasury, fee);
TransferHelper.safeTransfer(want, owner, amount - fee);
}
instantWithdrawnAmount = instantWithdrawnAmount + amount;
emit InstantWithdraw(owner, amount, reserveShares, fee);
}
function migrateToNewVault() external whenNotPaused nonReentrant {
_migrateToNewVault(msg.sender);
}
function _migrateToNewVault(address owner) private {
require(owner != address(0), "WooSuperChargerVault: !owner");
require(migrationVault != address(0), "WooSuperChargerVault: !migrationVault");
WooSuperChargerVaultV2 newVault = WooSuperChargerVaultV2(payable(migrationVault));
require(newVault.want() == want, "WooSuperChargerVault: !WANT_newVault");
uint256 shares = balanceOf(owner);
if (shares == 0) {
return;
}
lendingManager.accureInterest();
uint256 amount = _assets(shares);
if (msg.sender != owner) {
_spendAllowance(owner, msg.sender, shares);
}
_burn(owner, shares);
uint256 reserveShares = _sharesUp(amount, reserveVault.getPricePerFullShare());
reserveVault.withdraw(reserveShares);
if (want == weth) {
newVault.deposit{value: amount}(amount, owner);
} else {
TransferHelper.safeApprove(want, address(newVault), amount);
newVault.deposit(amount, owner);
}
emit SuperChargerVaultMigrated(owner, address(this), address(newVault), amount);
}
function requestWithdraw(uint256 amount) external whenNotPaused nonReentrant {
_requestWithdrawShares(_sharesUpLatest(amount));
}
function requestWithdrawAll() external whenNotPaused nonReentrant {
_requestWithdrawShares(balanceOf(msg.sender));
}
function _requestWithdrawShares(uint256 shares) private {
require(shares > 0, "WooSuperChargerVault: !amount");
require(!isSettling, "WooSuperChargerVault: CANNOT_WITHDRAW_IN_SETTLING");
require(requestUsers.length() <= maxWithdrawCount, "WooSuperChargerVault: MAX_WITHDRAW_COUNT");
address owner = msg.sender;
lendingManager.accureInterest();
uint256 amount = _assets(shares);
TransferHelper.safeTransferFrom(address(this), owner, address(this), shares);
requestedWithdrawShares[owner] = requestedWithdrawShares[owner] + shares;
requestedTotalShares = requestedTotalShares + shares;
requestUsers.add(owner);
emit RequestWithdraw(owner, amount, shares);
}
function requestedTotalAmount() public view returns (uint256) {
return _assets(requestedTotalShares);
}
function totalRequestedUserNumber() external view returns (uint256 totalNumber) {
return requestUsers.length();
}
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() + reserveBalance() + lendingBalance();
}
function getPricePerFullShare() public view returns (uint256) {
return totalSupply() == 0 ? 1e18 : (balance() * 1e18) / totalSupply();
}
// --- For WooLendingManager --- //
function maxBorrowableAmount() public view returns (uint256) {
uint256 resBal = reserveBalance();
uint256 instWithdrawBal = instantWithdrawCap - instantWithdrawnAmount;
return resBal > instWithdrawBal ? resBal - 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() - requestedAmount;
return reserveBal >= requestedAmount + afterBal / 10 ? 0 : requestedAmount + afterBal / 10 - 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");
// NOTE: Do need accureInterest here, since it's already been updated in `startWeeklySettle`
uint256 sharePrice = getPricePerFullShare();
isSettling = false;
uint256 totalWithdrawAmount = requestedTotalAmount();
if (totalWithdrawAmount != 0) {
uint256 shares = _sharesUp(totalWithdrawAmount, reserveVault.getPricePerFullShare());
reserveVault.withdraw(shares);
if (want == weth) {
IWETH(weth).deposit{value: totalWithdrawAmount}();
}
require(available() >= totalWithdrawAmount);
uint256 length = requestUsers.length();
for (uint256 i = 0; i < length; i++) {
address user = requestUsers.at(0);
withdrawManager.addWithdrawAmount(user, (requestedWithdrawShares[user] * sharePrice) / 1e18);
requestedWithdrawShares[user] = 0;
requestUsers.remove(user);
}
_burn(address(this), requestedTotalShares);
requestedTotalShares = 0;
TransferHelper.safeTransfer(want, address(withdrawManager), totalWithdrawAmount);
}
instantWithdrawnAmount = 0;
lendingManager.accureInterest();
uint256 totalBalance = balance();
instantWithdrawCap = totalBalance / 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 - 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 = WooWithdrawManagerV2(_withdrawManager);
emit WithdrawManagerUpdated(formerManager, _withdrawManager);
}
function setTreasury(address _treasury) external onlyOwner {
treasury = _treasury;
}
function setMaxWithdrawCount(uint256 _maxWithdrawCount) external onlyOwner {
maxWithdrawCount = _maxWithdrawCount;
}
function setInstantWithdrawFeeRate(uint256 _feeRate) external onlyOwner {
uint256 formerFeeRate = instantWithdrawFeeRate;
instantWithdrawFeeRate = _feeRate;
emit InstantWithdrawFeeRateUpdated(formerFeeRate, _feeRate);
}
function setInstantWithdrawCap(uint256 _instantWithdrawCap) external onlyOwner {
instantWithdrawCap = _instantWithdrawCap;
}
function setMigrationVault(address _vault) external onlyOwner {
migrationVault = _vault;
WooSuperChargerVaultV2 newVault = WooSuperChargerVaultV2(payable(_vault));
require(newVault.want() == want, "WooSuperChargerVault: !WANT_vault");
}
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 * sharePrice) / 1e18;
}
function _shares(uint256 assets, uint256 sharePrice) private pure returns (uint256) {
return (assets * 1e18) / sharePrice;
}
function _sharesUpLatest(uint256 assets) private returns (uint256) {
lendingManager.accureInterest();
return _sharesUp(assets, getPricePerFullShare());
}
function _sharesUp(uint256 assets, uint256 sharePrice) private pure returns (uint256) {
uint256 shares = (assets * 1e18) / sharePrice;
return _assets(shares, sharePrice) == assets ? shares : shares + 1;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// 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 cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^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.
*
* ```solidity
* 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.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
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;
if (lastIndex != toDeleteIndex) {
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] = valueIndex; // Replace lastValue's index to valueIndex
}
// 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) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// 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);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// 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))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// 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 in 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));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;
/*
░██╗░░░░░░░██╗░█████╗░░█████╗░░░░░░░███████╗██╗
░██║░░██╗░░██║██╔══██╗██╔══██╗░░░░░░██╔════╝██║
░╚██╗████╗██╔╝██║░░██║██║░░██║█████╗█████╗░░██║
░░████╔═████║░██║░░██║██║░░██║╚════╝██╔══╝░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝╚█████╔╝░░░░░░██║░░░░░██║
░░░╚═╝░░░╚═╝░░░╚════╝░░╚════╝░░░░░░░╚═╝░░░░░╚═╝
*
* MIT License
* ===========
*
* Copyright (c) 2020 WooTrade
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import "./WooSuperChargerVaultV2.sol";
import "../interfaces/IWETH.sol";
import "../interfaces/IWooAccessManager.sol";
import "../interfaces/IWooPPV2.sol";
import "../libraries/TransferHelper.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
contract WooLendingManager is Ownable, ReentrancyGuard {
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;
WooSuperChargerVaultV2 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() {}
function init(
address _weth,
address _want,
address _accessManager,
address _wooPP,
address payable _superChargerVault
) external onlyOwner {
weth = _weth;
want = _want;
accessManager = _accessManager;
wooPP = _wooPP;
superChargerVault = WooSuperChargerVaultV2(_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] || msg.sender == wooPP, "WooLendingManager: !borrower");
_;
}
modifier onlySuperChargerVault() {
require(msg.sender == address(superChargerVault), "WooLendingManager: !superChargerVault");
_;
}
function setSuperChargerVault(address payable _wooSuperCharger) external onlyOwner {
superChargerVault = WooSuperChargerVaultV2(_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 + borrowedInterest;
}
function debtAfterPerfFee() public view returns (uint256 assets) {
return debt();
}
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 - lastAccuredTs;
// interestRate is in 10000th.
// 31536000 = 365 * 24 * 3600 (1 year of seconds)
uint256 interest = (borrowedPrincipal * interestRate * duration) / 31536000 / 10000;
borrowedInterest = borrowedInterest + 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();
}
/// @dev Borrow the fund from super charger and then deposit directly into WooPP.
/// @param amount the borrowing amount
function borrow(uint256 amount) external onlyBorrower {
require(amount > 0, "!AMOUNT");
accureInterest();
borrowedPrincipal = borrowedPrincipal + amount;
uint256 preBalance = IERC20(want).balanceOf(address(this));
superChargerVault.borrowFromLendingManager(amount, address(this));
uint256 afterBalance = IERC20(want).balanceOf(address(this));
require(afterBalance - preBalance == amount, "WooLendingManager: BORROW_AMOUNT_ERROR");
TransferHelper.safeApprove(want, wooPP, amount);
IWooPPV2(wooPP).deposit(want, amount);
emit Borrow(msg.sender, amount);
}
// NOTE: this is the view function;
// Remember to call the accureInterest to ensure the latest repayment state.
function weeklyRepayment() public view returns (uint256 repayAmount) {
(repayAmount, , , ) = weeklyRepaymentBreakdown();
}
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) {
interest = neededAmount;
principal = 0;
} else {
interest = borrowedInterest;
principal = neededAmount - borrowedInterest;
}
perfFee = (interest * perfRate) / 10000;
repayAmount = principal + interest + perfFee;
}
function repayWeekly() external onlyBorrower returns (uint256 repaidAmount) {
accureInterest();
uint256 _principal;
uint256 _interest;
(, _principal, _interest, ) = weeklyRepaymentBreakdown();
return _repay(_principal, _interest);
}
function repayAll() external onlyBorrower returns (uint256 repaidAmount) {
accureInterest();
return _repay(borrowedPrincipal, borrowedInterest);
}
// NOTE: repay the specified principal amount with all the borrowed interest
function repayPrincipal(uint256 _principal) external onlyBorrower returns (uint256 repaidAmount) {
accureInterest();
return _repay(_principal, borrowedInterest);
}
function _repay(uint256 _principal, uint256 _interest) private returns (uint256 repaidAmount) {
if (_principal == 0 && _interest == 0) {
emit Repay(msg.sender, 0, 0);
return 0;
}
uint256 _perfFee = (_interest * perfRate) / 10000;
uint256 _totalAmount = _principal + _interest + _perfFee;
TransferHelper.safeTransferFrom(want, msg.sender, address(this), _totalAmount);
borrowedInterest -= _interest;
borrowedPrincipal -= _principal;
TransferHelper.safeTransfer(want, treasury, _perfFee);
TransferHelper.safeApprove(want, address(superChargerVault), _principal + _interest);
superChargerVault.repayFromLendingManager(_principal + _interest);
emit Repay(msg.sender, _totalAmount, _perfFee);
return _totalAmount;
}
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);
}
}
}// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;
/*
░██╗░░░░░░░██╗░█████╗░░█████╗░░░░░░░███████╗██╗
░██║░░██╗░░██║██╔══██╗██╔══██╗░░░░░░██╔════╝██║
░╚██╗████╗██╔╝██║░░██║██║░░██║█████╗█████╗░░██║
░░████╔═████║░██║░░██║██║░░██║╚════╝██╔══╝░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝╚█████╔╝░░░░░░██║░░░░░██║
░░░╚═╝░░░╚═╝░░░╚════╝░░╚════╝░░░░░░░╚═╝░░░░░╚═╝
*
* MIT License
* ===========
*
* Copyright (c) 2020 WooTrade
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import "../interfaces/IWETH.sol";
import "../interfaces/IWooAccessManager.sol";
import "../libraries/TransferHelper.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
contract WooWithdrawManagerV2 is Ownable, ReentrancyGuard {
// 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() {}
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 {
// NOTE: in V2, granular token transfer is avoided to save the gas consumption;
// Do remember batch transfer the total amount of `want` tokens after calling this method.
// TransferHelper.safeTransferFrom(want, msg.sender, address(this), amount);
withdrawAmount[user] = withdrawAmount[user] + 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 {}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.14;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./IRewarder.sol";
interface IMasterChefWoo {
event PoolAdded(uint256 poolId, uint256 allocPoint, IERC20 weToken, IRewarder rewarder);
event PoolSet(uint256 poolId, uint256 allocPoint, IRewarder rewarder);
event PoolUpdated(uint256 poolId, uint256 lastRewardBlock, uint256 supply, uint256 accTokenPerShare);
event XWooPerBlockUpdated(uint256 xWooPerBlock);
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event Harvest(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
struct UserInfo {
uint256 amount;
uint256 rewardDebt;
}
struct PoolInfo {
IERC20 weToken;
uint256 allocPoint;
uint256 lastRewardBlock;
uint256 accTokenPerShare;
IRewarder rewarder;
}
// System-level function
function setXWooPerBlock(uint256 _xWooPerBlock) external;
// Pool-related functions
function poolLength() external view returns (uint256);
function add(
uint256 allocPoint,
IERC20 weToken,
IRewarder rewarder
) external;
function set(
uint256 pid,
uint256 allocPoint,
IRewarder rewarder
) external;
function massUpdatePools() external;
function updatePool(uint256 pid) external;
// User-related functions
function pendingXWoo(uint256 pid, address user) external view returns (uint256, uint256);
function deposit(uint256 pid, uint256 amount) external;
function withdraw(uint256 pid, uint256 amount) external;
function harvest(uint256 pid) external;
function emergencyWithdraw(uint256 pid) external;
function userInfo(uint256 pid, address user) external view returns (uint256 amount, uint256 rewardDebt);
function poolInfo(uint256 pid)
external
view
returns (
IERC20 weToken,
uint256 allocPoint,
uint256 lastRewardBlock,
uint256 accTokenPerShare,
IRewarder rewarder
);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.14;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IRewarder {
event OnRewarded(address indexed user, uint256 amount);
event RewardRateUpdated(uint256 oldRate, uint256 newRate);
struct UserInfo {
uint256 amount;
uint256 rewardDebt;
uint256 unpaidRewards;
}
struct PoolInfo {
uint256 accTokenPerShare;
uint256 lastRewardBlock;
}
function onRewarded(address user, uint256 amount) external;
function pendingTokens(address user) external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;
/*
░██╗░░░░░░░██╗░█████╗░░█████╗░░░░░░░███████╗██╗
░██║░░██╗░░██║██╔══██╗██╔══██╗░░░░░░██╔════╝██║
░╚██╗████╗██╔╝██║░░██║██║░░██║█████╗█████╗░░██║
░░████╔═████║░██║░░██║██║░░██║╚════╝██╔══╝░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝╚█████╔╝░░░░░░██║░░░░░██║
░░░╚═╝░░░╚═╝░░░╚════╝░░╚════╝░░░░░░░╚═╝░░░░░╚═╝
*
* MIT License
* ===========
*
* Copyright (c) 2020 WooTrade
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
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;
}// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;
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);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title Wrapped ETH.
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;
}// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;
/*
░██╗░░░░░░░██╗░█████╗░░█████╗░░░░░░░███████╗██╗
░██║░░██╗░░██║██╔══██╗██╔══██╗░░░░░░██╔════╝██║
░╚██╗████╗██╔╝██║░░██║██║░░██║█████╗█████╗░░██║
░░████╔═████║░██║░░██║██║░░██║╚════╝██╔══╝░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝╚█████╔╝░░░░░░██║░░░░░██║
░░░╚═╝░░░╚═╝░░░╚════╝░░╚════╝░░░░░░░╚═╝░░░░░╚═╝
*
* MIT License
* ===========
*
* Copyright (c) 2020 WooTrade
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/// @title 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 Sets vaultAdmin
function setVaultAdmin(address vaultAdmin, bool flag) external;
/// @notice Sets rebateAdmin
function setRebateAdmin(address rebateAdmin, bool flag) external;
/// @notice Sets zeroFeeVault
function setZeroFeeVault(address vault, bool flag) external;
}// SPDX-License-Identifier: MIT
pragma solidity =0.8.14;
/*
░██╗░░░░░░░██╗░█████╗░░█████╗░░░░░░░███████╗██╗
░██║░░██╗░░██║██╔══██╗██╔══██╗░░░░░░██╔════╝██║
░╚██╗████╗██╔╝██║░░██║██║░░██║█████╗█████╗░░██║
░░████╔═████║░██║░░██║██║░░██║╚════╝██╔══╝░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝╚█████╔╝░░░░░░██║░░░░░██║
░░░╚═╝░░░╚═╝░░░╚════╝░░╚════╝░░░░░░░╚═╝░░░░░╚═╝
*
* MIT License
* ===========
*
* Copyright (c) 2020 WooTrade
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/// @title Woo private pool for swap.
/// @notice Use this contract to directly interfact with woo's synthetic proactive
/// marketing making pool.
/// @author woo.network
interface IWooPPV2 {
/* ----- Events ----- */
event Deposit(address indexed token, address indexed sender, uint256 amount);
event Withdraw(address indexed token, address indexed receiver, uint256 amount);
event Migrate(address indexed token, address indexed receiver, uint256 amount);
event AdminUpdated(address indexed addr, bool flag);
event PauseRoleUpdated(address indexed addr, bool flag);
event FeeAddrUpdated(address indexed newFeeAddr);
event WooracleUpdated(address indexed newWooracle);
event WooSwap(
address indexed fromToken,
address indexed toToken,
uint256 fromAmount,
uint256 toAmount,
address from,
address indexed to,
address rebateTo,
uint256 swapVol,
uint256 swapFee
);
/* ----- External Functions ----- */
/// @notice The quote token address (immutable).
/// @return address of quote token
function quoteToken() external view returns (address);
/// @notice Gets the pool size of the specified token (swap liquidity).
/// @param token the token address
/// @return the pool size
function poolSize(address token) external view returns (uint256);
/// @notice Query the amount to swap `fromToken` to `toToken`, without checking the pool reserve balance.
/// @param fromToken the from token
/// @param toToken the to token
/// @param fromAmount the amount of `fromToken` to swap
/// @return toAmount the swapped amount of `toToken`
function tryQuery(
address fromToken,
address toToken,
uint256 fromAmount
) external view returns (uint256 toAmount);
/// @notice Query the amount to swap `fromToken` to `toToken`, with checking the pool reserve balance.
/// @dev tx reverts when 'toToken' balance is insufficient.
/// @param fromToken the from token
/// @param toToken the to token
/// @param fromAmount the amount of `fromToken` to swap
/// @return toAmount the swapped amount of `toToken`
function query(
address fromToken,
address toToken,
uint256 fromAmount
) external view returns (uint256 toAmount);
/// @notice Swap `fromToken` to `toToken`.
/// @param fromToken the from token
/// @param toToken the to token
/// @param fromAmount the amount of `fromToken` to swap
/// @param minToAmount the minimum amount of `toToken` to receive
/// @param to the destination address
/// @param rebateTo the rebate address (optional, can be address ZERO)
/// @return realToAmount the amount of toToken to receive
function swap(
address fromToken,
address toToken,
uint256 fromAmount,
uint256 minToAmount,
address to,
address rebateTo
) external returns (uint256 realToAmount);
/// @notice Deposit the specified token into the liquidity pool of WooPPV2.
/// @param token the token to deposit
/// @param amount the deposit amount
function deposit(address token, uint256 amount) external;
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/// @title TransferHelper
/// @notice Contains helper methods for interacting with ERC20 and native tokens that do not consistently return true/false
/// @dev implementation from https://github.com/Uniswap/v3-periphery/blob/main/contracts/libraries/TransferHelper.sol
library TransferHelper {
/// @notice Transfers tokens from the targeted address to the given destination
/// @notice Errors with 'STF' if transfer fails
/// @param token The contract address of the token to be transferred
/// @param from The originating address from which the tokens will be transferred
/// @param to The destination address of the transfer
/// @param value The amount to be transferred
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), "STF");
}
/// @notice Transfers tokens from msg.sender to a recipient
/// @dev Errors with ST if transfer fails
/// @param token The contract address of the token which will be transferred
/// @param to The recipient of the transfer
/// @param value The value of the transfer
function safeTransfer(
address token,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), "ST");
}
/// @notice Approves the stipulated contract to spend the given allowance in the given token
/// @dev Errors with 'SA' if transfer fails
/// @param token The contract address of the token to be approved
/// @param to The target of the approval
/// @param value The amount of the given token the target will be allowed to spend
function safeApprove(
address token,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), "SA");
}
/// @notice Transfers ETH to the recipient address
/// @dev Fails with `STE`
/// @param to The destination of the transfer
/// @param value The value to be transferred
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, "STE");
}
}{
"optimizer": {
"enabled": true,
"runs": 20000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_weth","type":"address"},{"internalType":"address","name":"_want","type":"address"},{"internalType":"address","name":"_accessManager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositor","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fees","type":"uint256"}],"name":"InstantWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"formerFeeRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFeeRate","type":"uint256"}],"name":"InstantWithdrawFeeRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"formerLendingManager","type":"address"},{"indexed":false,"internalType":"address","name":"newLendingManager","type":"address"}],"name":"LendingManagerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"RequestWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"oldVault","type":"address"},{"indexed":true,"internalType":"address","name":"newVault","type":"address"}],"name":"ReserveVaultMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"oldVault","type":"address"},{"indexed":true,"internalType":"address","name":"newVault","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SuperChargerVaultMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lendingBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reserveBalance","type":"uint256"}],"name":"WeeklySettleEnded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalRequestedShares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weeklyRepayAmount","type":"uint256"}],"name":"WeeklySettleStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"formerWithdrawManager","type":"address"},{"indexed":false,"internalType":"address","name":"newWithdrawManager","type":"address"}],"name":"WithdrawManagerUpdated","type":"event"},{"inputs":[],"name":"accessManager","outputs":[{"internalType":"contract IWooAccessManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"available","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"fundAddr","type":"address"}],"name":"borrowFromLendingManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"costSharePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"endWeeklySettle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getPricePerFullShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"stuckToken","type":"address"}],"name":"inCaseTokenGotStuck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_reserveVault","type":"address"},{"internalType":"address","name":"_lendingManager","type":"address"},{"internalType":"address payable","name":"_withdrawManager","type":"address"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"instantWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"instantWithdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"instantWithdrawCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"instantWithdrawFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"instantWithdrawnAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isSettling","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lendingBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lendingManager","outputs":[{"internalType":"contract WooLendingManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"masterChef","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxBorrowableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxWithdrawCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"migrateReserveVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"migrateToNewVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"migrationVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pid","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":"repayFromLendingManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"requestWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestWithdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestedTotalAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"requestedTotalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"requestedWithdrawAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"requestedWithdrawShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserveBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserveVault","outputs":[{"internalType":"contract IVaultV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_instantWithdrawCap","type":"uint256"}],"name":"setInstantWithdrawCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feeRate","type":"uint256"}],"name":"setInstantWithdrawFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_lendingManager","type":"address"}],"name":"setLendingManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_masterChef","type":"address"},{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"setMasterChef","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxWithdrawCount","type":"uint256"}],"name":"setMaxWithdrawCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"setMigrationVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_withdrawManager","type":"address"}],"name":"setWithdrawManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"stakedShares","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startWeeklySettle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRequestedUserNumber","outputs":[{"internalType":"uint256","name":"totalNumber","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"want","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weeklyNeededAmountForWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawManager","outputs":[{"internalType":"contract WooWithdrawManagerV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60e060405260128054610100600160a81b03191674815d4517427fc940a90a5653cdcea1544c6283c900179055601e60135561012c6014553480156200004457600080fd5b5060405162005ed338038062005ed3833981016040819052620000679162000425565b816001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015620000a6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620000d09190810190620004b8565b604051602001620000e2919062000570565b604051602081830303815290604052826001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000130573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526200015a9190810190620004b8565b6040516020016200016c9190620005b7565b60408051601f1981840301815291905281516200019190600390602085019062000362565b508051620001a790600490602084019062000362565b505050620001c4620001be6200030c60201b60201c565b62000310565b6005805460ff60a01b1916905560016006556001600160a01b038316620002325760405162461bcd60e51b815260206004820152601b60248201527f576f6f5375706572436861726765725661756c743a202177657468000000000060448201526064015b60405180910390fd5b6001600160a01b0382166200028a5760405162461bcd60e51b815260206004820152601b60248201527f576f6f5375706572436861726765725661756c743a202177616e740000000000604482015260640162000229565b6001600160a01b038116620002ee5760405162461bcd60e51b8152602060048201526024808201527f576f6f5375706572436861726765725661756c743a20216163636573734d616e60448201526330b3b2b960e11b606482015260840162000229565b6001600160a01b0392831660a0529082166080521660c0526200061f565b3390565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8280546200037090620005e3565b90600052602060002090601f016020900481019282620003945760008555620003df565b82601f10620003af57805160ff1916838001178555620003df565b82800160010185558215620003df579182015b82811115620003df578251825591602001919060010190620003c2565b50620003ed929150620003f1565b5090565b5b80821115620003ed5760008155600101620003f2565b80516001600160a01b03811681146200042057600080fd5b919050565b6000806000606084860312156200043b57600080fd5b620004468462000408565b9250620004566020850162000408565b9150620004666040850162000408565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004a257818101518382015260200162000488565b83811115620004b2576000848401525b50505050565b600060208284031215620004cb57600080fd5b81516001600160401b0380821115620004e357600080fd5b818401915084601f830112620004f857600080fd5b8151818111156200050d576200050d6200046f565b604051601f8201601f19908116603f011681019083821181831017156200053857620005386200046f565b816040528281528760208487010111156200055257600080fd5b6200056583602083016020880162000485565b979650505050505050565b7f574f4f4669205375706572204368617267657220000000000000000000000000815260008251620005aa81601485016020870162000485565b9190910160140192915050565b61776560f01b815260008251620005d681600285016020870162000485565b9190910160020192915050565b600181811c90821680620005f857607f821691505b6020821081036200061957634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c0516157656200076e60003960008181610c540152818161155b015281816121380152818161225e01528181612bd901526144470152600081816106430152818161134f015281816113a801528181611686015281816117ce01528181611975015281816126fa0152818161278001528181612e5a01528181612eb301528181613dfd015281816144e80152614a4e015260008181610531015281816110390152818161137901528181611420015281816116b0015281816117f8015281816118ab0152818161199f01528181611a5301528181611b6d01528181611c51015281816126d1015281816127240152818161286901528181612e840152818161307301528181613e2001528181613f3f01528181613f6f015281816145120152818161457b015281816145b4015281816147ce01528181614a780152614b2c01526157656000f3fe6080604052600436106104335760003560e01c80637ab7cbb111610228578063b69ef8a811610128578063e14224f3116100bb578063f10684541161008a578063fac6182f1161006f578063fac6182f14610c0d578063fd92bff214610c22578063fdcb606814610c4257600080fd5b8063f106845414610bd7578063f2fde38b14610bed57600080fd5b8063e14224f314610b61578063e1a4e72a14610b77578063ec3e9da514610b97578063f0f4426014610bb757600080fd5b8063cef062fc116100f7578063cef062fc14610ad0578063dadb6c1d14610af0578063dc692cd714610b05578063dd62ed3e14610b1b57600080fd5b8063b69ef8a814610a72578063b6b55f2514610a87578063c869d0ed14610a9a578063cecdb96114610aba57600080fd5b80638e400570116101bb5780639e3b77af1161018a578063a457c2d71161016f578063a457c2d714610a12578063a9059cbb14610a32578063b5589fad14610a5257600080fd5b80639e3b77af146109dd578063a10954fe146109fd57600080fd5b80638e4005701461098457806395d89b411461099957806396f25d42146109ae5780639d46c009146109c857600080fd5b80638542783f116101f75780638542783f1461090e578063864a897f14610923578063882c127e146109395780638da5cb5b1461096657600080fd5b80637ab7cbb1146108a45780637f293228146108b957806383165e59146108d95780638456cb59146108f957600080fd5b806348cdc14111610333578063672f1490116102c65780636e553f6511610295578063715018a61161027a578063715018a61461085a578063745400c91461086f57806377c7b8fc1461088f57600080fd5b80636e553f651461081157806370a082311461082457600080fd5b8063672f1490146107a65780636a7855fd146107c65780636aa9eda2146107dc5780636d67d5d4146107f157600080fd5b80635c975abb116103025780635c975abb1461070457806360773a2c1461073457806361d027b314610754578063622639911461077957600080fd5b806348cdc1411461069a5780634bb2dcea146106ba5780634d9b4894146106cf578063575a86b2146106e457600080fd5b80632ea9239e116103c65780633bfb5c14116103955780633fc8cef31161037a5780633fc8cef3146106315780634069ab681461066557806348a0d7541461068557600080fd5b80633bfb5c14146105fc5780633f4ba83a1461061c57600080fd5b80632ea9239e1461058b578063313ce567146105ab57806336ea4344146105c757806339509351146105dc57600080fd5b806318160ddd1161040257806318160ddd146104ea578063184b9559146104ff5780631f1fcd511461051f57806323b872dd1461056b57600080fd5b806306fdde031461043f578063095ea7b31461046a5780630eb0c8f31461049a57806317e3e2e8146104c857600080fd5b3661043a57005b600080fd5b34801561044b57600080fd5b50610454610c76565b60405161046191906152ce565b60405180910390f35b34801561047657600080fd5b5061048a610485366004615334565b610d08565b6040519015158152602001610461565b3480156104a657600080fd5b506104ba6104b5366004615360565b610d22565b604051908152602001610461565b3480156104d457600080fd5b506104e86104e3366004615360565b610dd5565b005b3480156104f657600080fd5b506002546104ba565b34801561050b57600080fd5b506104e861051a36600461537d565b610e57565b34801561052b57600080fd5b506105537f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610461565b34801561057757600080fd5b5061048a6105863660046153c8565b611105565b34801561059757600080fd5b506104e86105a6366004615409565b611129565b3480156105b757600080fd5b5060405160128152602001610461565b3480156105d357600080fd5b506104e861144b565b3480156105e857600080fd5b5061048a6105f7366004615334565b611485565b34801561060857600080fd5b506104e8610617366004615439565b6114c4565b34801561062857600080fd5b506104e861150a565b34801561063d57600080fd5b506105537f000000000000000000000000000000000000000000000000000000000000000081565b34801561067157600080fd5b506104e8610680366004615360565b611624565b34801561069157600080fd5b506104ba611b3c565b3480156106a657600080fd5b506104e86106b5366004615360565b611be5565b3480156106c657600080fd5b506104ba611d41565b3480156106db57600080fd5b506104ba611d81565b3480156106f057600080fd5b50601554610553906001600160a01b031681565b34801561071057600080fd5b5060055474010000000000000000000000000000000000000000900460ff1661048a565b34801561074057600080fd5b506104ba61074f366004615360565b611de4565b34801561076057600080fd5b506012546105539061010090046001600160a01b031681565b34801561078557600080fd5b506104ba610794366004615360565b600b6020526000908152604090205481565b3480156107b257600080fd5b506104e86107c1366004615334565b611e06565b3480156107d257600080fd5b506104ba60115481565b3480156107e857600080fd5b506104ba611f83565b3480156107fd57600080fd5b506104e861080c366004615439565b611fff565b6104e861081f366004615409565b61200c565b34801561083057600080fd5b506104ba61083f366004615360565b6001600160a01b031660009081526020819052604090205490565b34801561086657600080fd5b506104e8612030565b34801561087b57600080fd5b506104e861088a366004615439565b612042565b34801561089b57600080fd5b506104ba61206b565b3480156108b057600080fd5b506104e86120af565b3480156108c557600080fd5b506104e86108d4366004615439565b6120da565b3480156108e557600080fd5b50600854610553906001600160a01b031681565b34801561090557600080fd5b506104e86120e7565b34801561091a57600080fd5b506104ba612201565b34801561092f57600080fd5b506104ba60105481565b34801561094557600080fd5b506104ba610954366004615360565b600c6020526000908152604090205481565b34801561097257600080fd5b506005546001600160a01b0316610553565b34801561099057600080fd5b506104e861220d565b3480156109a557600080fd5b50610454612464565b3480156109ba57600080fd5b5060125461048a9060ff1681565b3480156109d457600080fd5b506104e8612473565b3480156109e957600080fd5b50600954610553906001600160a01b031681565b348015610a0957600080fd5b506104ba61248c565b348015610a1e57600080fd5b5061048a610a2d366004615334565b612594565b348015610a3e57600080fd5b5061048a610a4d366004615334565b61263e565b348015610a5e57600080fd5b506104e8610a6d366004615439565b61264c565b348015610a7e57600080fd5b506104ba612912565b6104e8610a95366004615439565b612940565b348015610aa657600080fd5b506104e8610ab5366004615360565b61295a565b348015610ac657600080fd5b506104ba60135481565b348015610adc57600080fd5b50600754610553906001600160a01b031681565b348015610afc57600080fd5b506104ba6129d4565b348015610b1157600080fd5b506104ba60145481565b348015610b2757600080fd5b506104ba610b36366004615452565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b348015610b6d57600080fd5b506104ba600d5481565b348015610b8357600080fd5b506104e8610b92366004615360565b6129e1565b348015610ba357600080fd5b50600a54610553906001600160a01b031681565b348015610bc357600080fd5b506104e8610bd2366004615360565b612ab4565b348015610be357600080fd5b506104ba60165481565b348015610bf957600080fd5b506104e8610c08366004615360565b612afb565b348015610c1957600080fd5b506104e8612b88565b348015610c2e57600080fd5b506104e8610c3d366004615439565b61318e565b348015610c4e57600080fd5b506105537f000000000000000000000000000000000000000000000000000000000000000081565b606060038054610c8590615480565b80601f0160208091040260200160405190810160405280929190818152602001828054610cb190615480565b8015610cfe5780601f10610cd357610100808354040283529160200191610cfe565b820191906000526020600020905b815481529060010190602001808311610ce157829003601f168201915b5050505050905090565b600033610d168185856131aa565b60019150505b92915050565b6015546000906001600160a01b0316610d3d57506000919050565b6015546016546040517f93f1a40b00000000000000000000000000000000000000000000000000000000815260048101919091526001600160a01b038481166024830152909116906393f1a40b906044016040805180830381865afa158015610daa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dce91906154d3565b5092915050565b610ddd613302565b600a80546001600160a01b038381167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080519190921680825260208201939093527f68b42fcf63f2d28ae477b4539c3101ade5142acdcc91191a106d867f3554f28a91015b60405180910390a15050565b610e5f613302565b6001600160a01b038316610edf5760405162461bcd60e51b8152602060048201526024808201527f576f6f5375706572436861726765725661756c743a20215f726573657276655660448201527f61756c740000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b038216610f5b5760405162461bcd60e51b815260206004820152602660248201527f576f6f5375706572436861726765725661756c743a20215f6c656e64696e674d60448201527f616e6167657200000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b038116610fd75760405162461bcd60e51b815260206004820152602760248201527f576f6f5375706572436861726765725661756c743a20215f776974686472617760448201527f4d616e61676572000000000000000000000000000000000000000000000000006064820152608401610ed6565b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03858116918217909255604080517f1f1fcd5100000000000000000000000000000000000000000000000000000000815290517f000000000000000000000000000000000000000000000000000000000000000090931692631f1fcd51916004808201926020929091908290030181865afa158015611087573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ab91906154f7565b6001600160a01b0316146110be57600080fd5b600980546001600160a01b039384167fffffffffffffffffffffffff000000000000000000000000000000000000000091821617909155600a805492909316911617905550565b60003361111385828561335c565b61111e85858561340c565b506001949350505050565b6009546001600160a01b031633146111a95760405162461bcd60e51b815260206004820152602560248201527f576f6f5375706572436861726765725661756c743a20216c656e64696e674d6160448201527f6e616765720000000000000000000000000000000000000000000000000000006064820152608401610ed6565b60125460ff16156111fc5760405162461bcd60e51b815260206004820152600b60248201527f494e20534554544c494e470000000000000000000000000000000000000000006044820152606401610ed6565b611204611d41565b8211156112535760405162461bcd60e51b815260206004820152601860248201527f494e535546465f414d4f554e545f464f525f424f52524f5700000000000000006044820152606401610ed6565b60006112d583600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d09190615514565b6135f9565b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561133557600080fd5b505af1158015611349573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03160361141b577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561140157600080fd5b505af1158015611415573d6000803e3d6000fd5b50505050505b6114467f00000000000000000000000000000000000000000000000000000000000000008385613645565b505050565b611453613787565b61145b6137f2565b336000908152602081905260409020546114799061384b565b61384b565b6114836001600655565b565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190610d1690829086906114bf90879061555c565b6131aa565b6114cc613302565b601380549082905560408051828152602081018490527f2f0bfd95e6bf57fab22ace02a57c77bdabde00f81ccf61034ae4a915d3a47f4d9101610e4b565b3361151d6005546001600160a01b031690565b6001600160a01b031614806115d057506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063af5b052b906024016020604051808303816000875af11580156115ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d09190615574565b61161c5760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e000000006044820152606401610ed6565b611483613abf565b61162c613302565b6001600160a01b0381166116825760405162461bcd60e51b815260206004820152600760248201527f215f7661756c74000000000000000000000000000000000000000000000000006044820152606401610ed6565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146116ea576116e5611b3c565b6116ec565b475b6007546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529192506001600160a01b031690632e1a7d4d9082906370a0823190602401602060405180830381865afa158015611756573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061177a9190615514565b6040518263ffffffff1660e01b815260040161179891815260200190565b600060405180830381600087803b1580156117b257600080fd5b505af11580156117c6573d6000803e3d6000fd5b5050505060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146118325761182d611b3c565b611834565b475b905060006118428383615596565b600780546001600160a01b038781167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080517f1f1fcd510000000000000000000000000000000000000000000000000000000081529051949550918116937f00000000000000000000000000000000000000000000000000000000000000009091169291631f1fcd519160048083019260209291908290030181865afa1580156118f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191d91906154f7565b6001600160a01b0316146119735760405162461bcd60e51b815260206004820152600c60248201527f494e56414c49445f57414e5400000000000000000000000000000000000000006044820152606401610ed6565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031603611a4a576007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b039091169063b6b55f259084906024016000604051808303818588803b158015611a2c57600080fd5b505af1158015611a40573d6000803e3d6000fd5b5050505050611afa565b600754611a82907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b031684613b2f565b6007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b039091169063b6b55f2590602401600060405180830381600087803b158015611ae157600080fd5b505af1158015611af5573d6000803e3d6000fd5b505050505b6040516001600160a01b03808716919083169033907f548fe255eb14d86b43af1c165d3a356a85be79136670fa5ff20aa3e0284afde790600090a45050505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611bbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be09190615514565b905090565b611bed613302565b600880547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03838116918217909255604080517f1f1fcd51000000000000000000000000000000000000000000000000000000008152905184937f0000000000000000000000000000000000000000000000000000000000000000169291631f1fcd519160048083019260209291908290030181865afa158015611c9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cc191906154f7565b6001600160a01b031614611d3d5760405162461bcd60e51b815260206004820152602160248201527f576f6f5375706572436861726765725661756c743a202157414e545f7661756c60448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610ed6565b5050565b600080611d4c61248c565b90506000601154601054611d609190615596565b9050808211611d70576000611d7a565b611d7a8183615596565b9250505090565b600954604080517fd83e6b3800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163d83e6b389160048083019260209291908290030181865afa158015611bbc573d6000803e3d6000fd5b6001600160a01b0381166000908152600c6020526040812054610d1c90613c71565b611e0e613302565b6001600160a01b038216611e645760405162461bcd60e51b815260206004820152600c60248201527f215f6d61737465724368656600000000000000000000000000000000000000006044820152606401610ed6565b601580547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03841690811790915560168290556040517f1526fe270000000000000000000000000000000000000000000000000000000081526004810183905260009190631526fe279060240160a060405180830381865afa158015611ef6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1a91906155ad565b505050509050306001600160a01b0316816001600160a01b0316146114465760405162461bcd60e51b8152600401610ed69060208082526004908201527f2170696400000000000000000000000000000000000000000000000000000000604082015260600190565b600080611f8e61248c565b90506000611f9a6129d4565b9050600081611fa7612912565b611fb19190615596565b9050611fbe600a82615605565b611fc8908361555c565b831015611ff45782611fdb600a83615605565b611fe5908461555c565b611fef9190615596565b611ff7565b60005b935050505090565b612007613302565b601455565b612014613787565b61201c6137f2565b6120268282613c7f565b611d3d6001600655565b612038613302565b6114836000614089565b61204a613787565b6120526137f2565b61205e611474826140f3565b6120686001600655565b50565b600061207660025490565b156120a257600254612086612912565b61209890670de0b6b3a7640000615640565b611be09190615605565b50670de0b6b3a764000090565b6120b7613787565b6120bf6137f2565b33600090815260208190526040902054611479905b33614175565b6120e2613302565b601055565b336120fa6005546001600160a01b031690565b6001600160a01b031614806121ad57506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063af5b052b906024016020604051808303816000875af1158015612189573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ad9190615574565b6121f95760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e000000006044820152606401610ed6565b611483614647565b6000611be0600e6146b6565b336122206005546001600160a01b031690565b6001600160a01b031614806122d357506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063af5b052b906024016020604051808303816000875af11580156122af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122d39190615574565b61231f5760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e000000006044820152606401610ed6565b60125460ff16156123725760405162461bcd60e51b815260206004820152600b60248201527f494e5f534554544c494e470000000000000000000000000000000000000000006044820152606401610ed6565b601280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055600954604080517fa373ed4e00000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169163a373ed4e9160048082019260009290919082900301818387803b1580156123fc57600080fd5b505af1158015612410573d6000803e3d6000fd5b50505050336001600160a01b03167ffce7d682dc90b7cc945fb8cfff947668bcf6d304aa58823b24d2c06dec38df6e600d5461244a611f83565b6040805192835260208301919091520160405180910390a2565b606060048054610c8590615480565b61247b613787565b6124836137f2565b611479336146c0565b6007546040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600091611be0916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156124f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125189190615514565b600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561256b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061258f9190615514565b614c2c565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156126315760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610ed6565b61111e82868684036131aa565b600033610d1681858561340c565b6009546001600160a01b031633146126cc5760405162461bcd60e51b815260206004820152602560248201527f576f6f5375706572436861726765725661756c743a20216c656e64696e674d6160448201527f6e616765720000000000000000000000000000000000000000000000000000006064820152608401610ed6565b6126f87f0000000000000000000000000000000000000000000000000000000000000000333084614c52565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031603612860576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156127cc57600080fd5b505af11580156127e0573d6000803e3d6000fd5b50506007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b03909116925063b6b55f25915083906024016000604051808303818588803b15801561284457600080fd5b505af1158015612858573d6000803e3d6000fd5b505050505050565b600754612898907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b031683613b2f565b6007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b039091169063b6b55f2590602401600060405180830381600087803b1580156128f757600080fd5b505af115801561290b573d6000803e3d6000fd5b5050505050565b600061291c611d81565b61292461248c565b61292c611b3c565b612936919061555c565b611be0919061555c565b612948613787565b6129506137f2565b61205e8133613c7f565b612962613302565b600980546001600160a01b038381167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080519190921680825260208201939093527f9ed29eb74f1356c602e59670cf82bfe8b0f564216ce091e163fbf7f0376aa1979101610e4b565b6000611be0600d54613c71565b6129e9613302565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601612a23576120683347614d9c565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015612a83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aa79190615514565b9050611d3d823383613645565b612abc613302565b601280546001600160a01b03909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b612b03613302565b6001600160a01b038116612b7f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610ed6565b61206881614089565b33612b9b6005546001600160a01b031690565b6001600160a01b03161480612c4e57506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063af5b052b906024016020604051808303816000875af1158015612c2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c4e9190615574565b612c9a5760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e000000006044820152606401610ed6565b60125460ff16612cec5760405162461bcd60e51b815260206004820152600960248201527f21534554544c494e4700000000000000000000000000000000000000000000006044820152606401610ed6565b612cf4611f83565b15612d415760405162461bcd60e51b815260206004820152601860248201527f5745454b4c595f52455041595f4e4f545f434c454152454400000000000000006044820152606401610ed6565b6000612d4b61206b565b601280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905590506000612d7f6129d4565b905080156130a5576000612de082600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112ac573d6000803e3d6000fd5b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015612e4057600080fd5b505af1158015612e54573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031603612f26577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015612f0c57600080fd5b505af1158015612f20573d6000803e3d6000fd5b50505050505b81612f2f611b3c565b1015612f3a57600080fd5b6000612f46600e6146b6565b905060005b81811015613058576000612f60600e82614e59565b600a546001600160a01b038083166000908152600c60205260409020549293501690639b927a91908390670de0b6b3a764000090612f9f908b90615640565b612fa99190615605565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561300757600080fd5b505af115801561301b573d6000803e3d6000fd5b5050506001600160a01b0382166000908152600c602052604081205550613043600e82614e65565b505080806130509061567d565b915050612f4b565b5061306530600d54614e7a565b6000600d55600a546130a2907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b031685613645565b50505b60006011819055600954604080517fa373ed4e00000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169263a373ed4e9260048084019382900301818387803b15801561310557600080fd5b505af1158015613119573d6000803e3d6000fd5b505050506000613127612912565b9050613134600a82615605565b601055337f805ee433ea4242be6315bc317b1bf10e767ad8beb03ee547773b3ee1f842c20682613162611d81565b61316a61248c565b604080519384526020840192909252908201526060015b60405180910390a2505050565b613196613787565b61319e6137f2565b61205e6120d4826140f3565b6001600160a01b0383166132255760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b0382166132a15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6005546001600160a01b031633146114835760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ed6565b6001600160a01b038381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461340657818110156133f95760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610ed6565b61340684848484036131aa565b50505050565b6001600160a01b0383166134885760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b0382166135045760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b038316600090815260208190526040902054818110156135935760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3613406565b6000808261360f85670de0b6b3a7640000615640565b6136199190615605565b9050836136268285614c2c565b1461363b5761363681600161555c565b61363d565b805b949350505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905291516000928392908716916136cf91906156b5565b6000604051808303816000865af19150503d806000811461370c576040519150601f19603f3d011682016040523d82523d6000602084013e613711565b606091505b509150915081801561373b57508051158061373b57508080602001905181019061373b9190615574565b61290b5760405162461bcd60e51b815260206004820152600260248201527f53540000000000000000000000000000000000000000000000000000000000006044820152606401610ed6565b60055474010000000000000000000000000000000000000000900460ff16156114835760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610ed6565b6002600654036138445760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610ed6565b6002600655565b6000811161389b5760405162461bcd60e51b815260206004820152601d60248201527f576f6f5375706572436861726765725661756c743a2021616d6f756e740000006044820152606401610ed6565b60125460ff16156139145760405162461bcd60e51b815260206004820152603160248201527f576f6f5375706572436861726765725661756c743a2043414e4e4f545f57495460448201527f48445241575f494e5f534554544c494e470000000000000000000000000000006064820152608401610ed6565b601454613921600e6146b6565b11156139955760405162461bcd60e51b815260206004820152602860248201527f576f6f5375706572436861726765725661756c743a204d41585f57495448445260448201527f41575f434f554e540000000000000000000000000000000000000000000000006064820152608401610ed6565b600954604080517fa373ed4e000000000000000000000000000000000000000000000000000000008152905133926001600160a01b03169163a373ed4e91600480830192600092919082900301818387803b1580156139f357600080fd5b505af1158015613a07573d6000803e3d6000fd5b505050506000613a1683613c71565b9050613a2430833086614c52565b6001600160a01b0382166000908152600c6020526040902054613a4890849061555c565b6001600160a01b0383166000908152600c6020526040902055600d54613a6f90849061555c565b600d55613a7d600e83614fe3565b5060408051828152602081018590526001600160a01b038416917febeaa8785285a4f7c37a305351997dceebabc3c357dab98023dc37514a1b6ed69101613181565b613ac7614ff8565b600580547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b3000000000000000000000000000000000000000000000000000000001790529151600092839290871691613bb991906156b5565b6000604051808303816000865af19150503d8060008114613bf6576040519150601f19603f3d011682016040523d82523d6000602084013e613bfb565b606091505b5091509150818015613c25575080511580613c25575080806020019051810190613c259190615574565b61290b5760405162461bcd60e51b815260206004820152600260248201527f53410000000000000000000000000000000000000000000000000000000000006044820152606401610ed6565b6000610d1c8261258f61206b565b81600003613c8b575050565b600960009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015613cdb57600080fd5b505af1158015613cef573d6000803e3d6000fd5b505050506000613d0683613d0161206b565b615062565b905060008111613d585760405162461bcd60e51b815260206004820152600760248201527f21736861726573000000000000000000000000000000000000000000000000006044820152606401610ed6565b6000613d6383610d22565b6001600160a01b038416600090815260208190526040902054613d86919061555c565b6001600160a01b0384166000908152600b6020526040812054919250613dac848461555c565b613dbe87670de0b6b3a7640000615640565b613dc88486615640565b613dd2919061555c565b613ddc9190615605565b6001600160a01b038087166000908152600b602052604090208290559091507f000000000000000000000000000000000000000000000000000000000000000081167f000000000000000000000000000000000000000000000000000000000000000090911603613f3a57348614613ebc5760405162461bcd60e51b815260206004820152602c60248201527f576f6f5375706572436861726765725661756c743a206d73672e76616c75655f60448201527f494e53554646494349454e5400000000000000000000000000000000000000006064820152608401610ed6565b6007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018890526001600160a01b039091169063b6b55f259034906024016000604051808303818588803b158015613f1c57600080fd5b505af1158015613f30573d6000803e3d6000fd5b5050505050614016565b613f667f0000000000000000000000000000000000000000000000000000000000000000333089614c52565b600754613f9e907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b031688613b2f565b6007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018890526001600160a01b039091169063b6b55f2590602401600060405180830381600087803b158015613ffd57600080fd5b505af1158015614011573d6000803e3d6000fd5b505050505b6140208585615077565b61402b600a87615605565b601054614038919061555c565b60105560408051878152602081018690526001600160a01b0387169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a3505050505050565b600580546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600954604080517fa373ed4e00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163a373ed4e916004808301928692919082900301818387803b15801561415157600080fd5b505af1158015614165573d6000803e3d6000fd5b50505050610d1c826112d061206b565b600082116141c55760405162461bcd60e51b815260206004820152601d60248201527f576f6f5375706572436861726765725661756c743a2021616d6f756e740000006044820152606401610ed6565b60125460ff161561423e5760405162461bcd60e51b815260206004820152602d60248201527f576f6f5375706572436861726765725661756c743a204e4f545f414c4c4f574560448201527f445f494e5f534554544c494e47000000000000000000000000000000000000006064820152608401610ed6565b6010546011541061424d575050565b600960009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561429d57600080fd5b505af11580156142b1573d6000803e3d6000fd5b5050505060006142c083613c71565b90506011546010546142d29190615596565b8111156143215760405162461bcd60e51b815260206004820181905260248201527f576f6f5375706572436861726765725661756c743a204f55545f4f465f4341506044820152606401610ed6565b336001600160a01b0383161461433c5761433c82338561335c565b6143468284614e7a565b600061439f82600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112ac573d6000803e3d6000fd5b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156143ff57600080fd5b505af1158015614413573d6000803e3d6000fd5b50506040517f871e6ca6000000000000000000000000000000000000000000000000000000008152336004820152600092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063871e6ca6906024016020604051808303816000875af1158015614499573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144bd9190615574565b6144e157612710601354846144d29190615640565b6144dc9190615605565b6144e4565b60005b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316036145725760125461455a9061010090046001600160a01b031682614d9c565b61456d846145688386615596565b614d9c565b6145e3565b6012546145af907f00000000000000000000000000000000000000000000000000000000000000009061010090046001600160a01b031683613645565b6145e37f0000000000000000000000000000000000000000000000000000000000000000856145de8487615596565b613645565b826011546145f1919061555c565b60115560408051848152602081018490529081018290526001600160a01b038516907f672004d35ad2124f90299371ade95cf5594500e40705a7cf6eaf7c00b55a07ac9060600160405180910390a25050505050565b61464f613787565b600580547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613b123390565b6000610d1c825490565b6001600160a01b0381166147165760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a20216f776e6572000000006044820152606401610ed6565b6008546001600160a01b03166147945760405162461bcd60e51b815260206004820152602560248201527f576f6f5375706572436861726765725661756c743a20216d6967726174696f6e60448201527f5661756c740000000000000000000000000000000000000000000000000000006064820152608401610ed6565b600854604080517f1f1fcd5100000000000000000000000000000000000000000000000000000000815290516001600160a01b03928316927f000000000000000000000000000000000000000000000000000000000000000016918391631f1fcd51916004808201926020929091908290030181865afa15801561481c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061484091906154f7565b6001600160a01b0316146148bb5760405162461bcd60e51b8152602060048201526024808201527f576f6f5375706572436861726765725661756c743a202157414e545f6e65775660448201527f61756c74000000000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b038216600090815260208190526040812054908190036148e157505050565b600960009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561493157600080fd5b505af1158015614945573d6000803e3d6000fd5b50505050600061495482613c71565b9050336001600160a01b038516146149715761497184338461335c565b61497b8483614e7a565b60006149d482600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112ac573d6000803e3d6000fd5b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015614a3457600080fd5b505af1158015614a48573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031603614b27576040517f6e553f65000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b038681166024830152851690636e553f659084906044016000604051808303818588803b158015614b0957600080fd5b505af1158015614b1d573d6000803e3d6000fd5b5050505050614bce565b614b527f00000000000000000000000000000000000000000000000000000000000000008584613b2f565b6040517f6e553f65000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b038681166024830152851690636e553f6590604401600060405180830381600087803b158015614bb557600080fd5b505af1158015614bc9573d6000803e3d6000fd5b505050505b836001600160a01b0316306001600160a01b0316866001600160a01b03167f2f003beff7d020bbaf25c7b278041e72cadccf9e4eaad1805835be384f19df5f85604051614c1d91815260200190565b60405180910390a45050505050565b6000670de0b6b3a7640000614c418385615640565b614c4b9190615605565b9392505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790529151600092839290881691614ce491906156b5565b6000604051808303816000865af19150503d8060008114614d21576040519150601f19603f3d011682016040523d82523d6000602084013e614d26565b606091505b5091509150818015614d50575080511580614d50575080806020019051810190614d509190615574565b6128585760405162461bcd60e51b815260206004820152600360248201527f53544600000000000000000000000000000000000000000000000000000000006044820152606401610ed6565b604080516000808252602082019092526001600160a01b038416908390604051614dc691906156b5565b60006040518083038185875af1925050503d8060008114614e03576040519150601f19603f3d011682016040523d82523d6000602084013e614e08565b606091505b50509050806114465760405162461bcd60e51b815260206004820152600360248201527f53544500000000000000000000000000000000000000000000000000000000006044820152606401610ed6565b6000614c4b8383615136565b6000614c4b836001600160a01b038416615160565b6001600160a01b038216614ef65760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b03821660009081526020819052604090205481811015614f855760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6000614c4b836001600160a01b038416615253565b60055474010000000000000000000000000000000000000000900460ff166114835760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610ed6565b600081614c4184670de0b6b3a7640000615640565b6001600160a01b0382166150cd5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610ed6565b80600260008282546150df919061555c565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600082600001828154811061514d5761514d6156d1565b9060005260206000200154905092915050565b60008181526001830160205260408120548015615249576000615184600183615596565b855490915060009061519890600190615596565b90508181146151fd5760008660000182815481106151b8576151b86156d1565b90600052602060002001549050808760000184815481106151db576151db6156d1565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061520e5761520e615700565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610d1c565b6000915050610d1c565b600081815260018301602052604081205461529a57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610d1c565b506000610d1c565b60005b838110156152bd5781810151838201526020016152a5565b838111156134065750506000910152565b60208152600082518060208401526152ed8160408501602087016152a2565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6001600160a01b038116811461206857600080fd5b6000806040838503121561534757600080fd5b82356153528161531f565b946020939093013593505050565b60006020828403121561537257600080fd5b813561363b8161531f565b60008060006060848603121561539257600080fd5b833561539d8161531f565b925060208401356153ad8161531f565b915060408401356153bd8161531f565b809150509250925092565b6000806000606084860312156153dd57600080fd5b83356153e88161531f565b925060208401356153f88161531f565b929592945050506040919091013590565b6000806040838503121561541c57600080fd5b82359150602083013561542e8161531f565b809150509250929050565b60006020828403121561544b57600080fd5b5035919050565b6000806040838503121561546557600080fd5b82356154708161531f565b9150602083013561542e8161531f565b600181811c9082168061549457607f821691505b6020821081036154cd577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600080604083850312156154e657600080fd5b505080516020909101519092909150565b60006020828403121561550957600080fd5b815161363b8161531f565b60006020828403121561552657600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000821982111561556f5761556f61552d565b500190565b60006020828403121561558657600080fd5b8151801515811461363b57600080fd5b6000828210156155a8576155a861552d565b500390565b600080600080600060a086880312156155c557600080fd5b85516155d08161531f565b8095505060208601519350604086015192506060860151915060808601516155f78161531f565b809150509295509295909350565b60008261563b577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156156785761567861552d565b500290565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036156ae576156ae61552d565b5060010190565b600082516156c78184602087016152a2565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea26469706673582212201feb31a4feeeade5de800f1560e893a38ddc46a33fe5aa3cba29ce37ce29ce4b64736f6c634300080e003300000000000000000000000042000000000000000000000000000000000000060000000000000000000000004200000000000000000000000000000000000006000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd9239
Deployed Bytecode
0x6080604052600436106104335760003560e01c80637ab7cbb111610228578063b69ef8a811610128578063e14224f3116100bb578063f10684541161008a578063fac6182f1161006f578063fac6182f14610c0d578063fd92bff214610c22578063fdcb606814610c4257600080fd5b8063f106845414610bd7578063f2fde38b14610bed57600080fd5b8063e14224f314610b61578063e1a4e72a14610b77578063ec3e9da514610b97578063f0f4426014610bb757600080fd5b8063cef062fc116100f7578063cef062fc14610ad0578063dadb6c1d14610af0578063dc692cd714610b05578063dd62ed3e14610b1b57600080fd5b8063b69ef8a814610a72578063b6b55f2514610a87578063c869d0ed14610a9a578063cecdb96114610aba57600080fd5b80638e400570116101bb5780639e3b77af1161018a578063a457c2d71161016f578063a457c2d714610a12578063a9059cbb14610a32578063b5589fad14610a5257600080fd5b80639e3b77af146109dd578063a10954fe146109fd57600080fd5b80638e4005701461098457806395d89b411461099957806396f25d42146109ae5780639d46c009146109c857600080fd5b80638542783f116101f75780638542783f1461090e578063864a897f14610923578063882c127e146109395780638da5cb5b1461096657600080fd5b80637ab7cbb1146108a45780637f293228146108b957806383165e59146108d95780638456cb59146108f957600080fd5b806348cdc14111610333578063672f1490116102c65780636e553f6511610295578063715018a61161027a578063715018a61461085a578063745400c91461086f57806377c7b8fc1461088f57600080fd5b80636e553f651461081157806370a082311461082457600080fd5b8063672f1490146107a65780636a7855fd146107c65780636aa9eda2146107dc5780636d67d5d4146107f157600080fd5b80635c975abb116103025780635c975abb1461070457806360773a2c1461073457806361d027b314610754578063622639911461077957600080fd5b806348cdc1411461069a5780634bb2dcea146106ba5780634d9b4894146106cf578063575a86b2146106e457600080fd5b80632ea9239e116103c65780633bfb5c14116103955780633fc8cef31161037a5780633fc8cef3146106315780634069ab681461066557806348a0d7541461068557600080fd5b80633bfb5c14146105fc5780633f4ba83a1461061c57600080fd5b80632ea9239e1461058b578063313ce567146105ab57806336ea4344146105c757806339509351146105dc57600080fd5b806318160ddd1161040257806318160ddd146104ea578063184b9559146104ff5780631f1fcd511461051f57806323b872dd1461056b57600080fd5b806306fdde031461043f578063095ea7b31461046a5780630eb0c8f31461049a57806317e3e2e8146104c857600080fd5b3661043a57005b600080fd5b34801561044b57600080fd5b50610454610c76565b60405161046191906152ce565b60405180910390f35b34801561047657600080fd5b5061048a610485366004615334565b610d08565b6040519015158152602001610461565b3480156104a657600080fd5b506104ba6104b5366004615360565b610d22565b604051908152602001610461565b3480156104d457600080fd5b506104e86104e3366004615360565b610dd5565b005b3480156104f657600080fd5b506002546104ba565b34801561050b57600080fd5b506104e861051a36600461537d565b610e57565b34801561052b57600080fd5b506105537f000000000000000000000000420000000000000000000000000000000000000681565b6040516001600160a01b039091168152602001610461565b34801561057757600080fd5b5061048a6105863660046153c8565b611105565b34801561059757600080fd5b506104e86105a6366004615409565b611129565b3480156105b757600080fd5b5060405160128152602001610461565b3480156105d357600080fd5b506104e861144b565b3480156105e857600080fd5b5061048a6105f7366004615334565b611485565b34801561060857600080fd5b506104e8610617366004615439565b6114c4565b34801561062857600080fd5b506104e861150a565b34801561063d57600080fd5b506105537f000000000000000000000000420000000000000000000000000000000000000681565b34801561067157600080fd5b506104e8610680366004615360565b611624565b34801561069157600080fd5b506104ba611b3c565b3480156106a657600080fd5b506104e86106b5366004615360565b611be5565b3480156106c657600080fd5b506104ba611d41565b3480156106db57600080fd5b506104ba611d81565b3480156106f057600080fd5b50601554610553906001600160a01b031681565b34801561071057600080fd5b5060055474010000000000000000000000000000000000000000900460ff1661048a565b34801561074057600080fd5b506104ba61074f366004615360565b611de4565b34801561076057600080fd5b506012546105539061010090046001600160a01b031681565b34801561078557600080fd5b506104ba610794366004615360565b600b6020526000908152604090205481565b3480156107b257600080fd5b506104e86107c1366004615334565b611e06565b3480156107d257600080fd5b506104ba60115481565b3480156107e857600080fd5b506104ba611f83565b3480156107fd57600080fd5b506104e861080c366004615439565b611fff565b6104e861081f366004615409565b61200c565b34801561083057600080fd5b506104ba61083f366004615360565b6001600160a01b031660009081526020819052604090205490565b34801561086657600080fd5b506104e8612030565b34801561087b57600080fd5b506104e861088a366004615439565b612042565b34801561089b57600080fd5b506104ba61206b565b3480156108b057600080fd5b506104e86120af565b3480156108c557600080fd5b506104e86108d4366004615439565b6120da565b3480156108e557600080fd5b50600854610553906001600160a01b031681565b34801561090557600080fd5b506104e86120e7565b34801561091a57600080fd5b506104ba612201565b34801561092f57600080fd5b506104ba60105481565b34801561094557600080fd5b506104ba610954366004615360565b600c6020526000908152604090205481565b34801561097257600080fd5b506005546001600160a01b0316610553565b34801561099057600080fd5b506104e861220d565b3480156109a557600080fd5b50610454612464565b3480156109ba57600080fd5b5060125461048a9060ff1681565b3480156109d457600080fd5b506104e8612473565b3480156109e957600080fd5b50600954610553906001600160a01b031681565b348015610a0957600080fd5b506104ba61248c565b348015610a1e57600080fd5b5061048a610a2d366004615334565b612594565b348015610a3e57600080fd5b5061048a610a4d366004615334565b61263e565b348015610a5e57600080fd5b506104e8610a6d366004615439565b61264c565b348015610a7e57600080fd5b506104ba612912565b6104e8610a95366004615439565b612940565b348015610aa657600080fd5b506104e8610ab5366004615360565b61295a565b348015610ac657600080fd5b506104ba60135481565b348015610adc57600080fd5b50600754610553906001600160a01b031681565b348015610afc57600080fd5b506104ba6129d4565b348015610b1157600080fd5b506104ba60145481565b348015610b2757600080fd5b506104ba610b36366004615452565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b348015610b6d57600080fd5b506104ba600d5481565b348015610b8357600080fd5b506104e8610b92366004615360565b6129e1565b348015610ba357600080fd5b50600a54610553906001600160a01b031681565b348015610bc357600080fd5b506104e8610bd2366004615360565b612ab4565b348015610be357600080fd5b506104ba60165481565b348015610bf957600080fd5b506104e8610c08366004615360565b612afb565b348015610c1957600080fd5b506104e8612b88565b348015610c2e57600080fd5b506104e8610c3d366004615439565b61318e565b348015610c4e57600080fd5b506105537f000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd923981565b606060038054610c8590615480565b80601f0160208091040260200160405190810160405280929190818152602001828054610cb190615480565b8015610cfe5780601f10610cd357610100808354040283529160200191610cfe565b820191906000526020600020905b815481529060010190602001808311610ce157829003601f168201915b5050505050905090565b600033610d168185856131aa565b60019150505b92915050565b6015546000906001600160a01b0316610d3d57506000919050565b6015546016546040517f93f1a40b00000000000000000000000000000000000000000000000000000000815260048101919091526001600160a01b038481166024830152909116906393f1a40b906044016040805180830381865afa158015610daa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dce91906154d3565b5092915050565b610ddd613302565b600a80546001600160a01b038381167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080519190921680825260208201939093527f68b42fcf63f2d28ae477b4539c3101ade5142acdcc91191a106d867f3554f28a91015b60405180910390a15050565b610e5f613302565b6001600160a01b038316610edf5760405162461bcd60e51b8152602060048201526024808201527f576f6f5375706572436861726765725661756c743a20215f726573657276655660448201527f61756c740000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b038216610f5b5760405162461bcd60e51b815260206004820152602660248201527f576f6f5375706572436861726765725661756c743a20215f6c656e64696e674d60448201527f616e6167657200000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b038116610fd75760405162461bcd60e51b815260206004820152602760248201527f576f6f5375706572436861726765725661756c743a20215f776974686472617760448201527f4d616e61676572000000000000000000000000000000000000000000000000006064820152608401610ed6565b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03858116918217909255604080517f1f1fcd5100000000000000000000000000000000000000000000000000000000815290517f000000000000000000000000420000000000000000000000000000000000000690931692631f1fcd51916004808201926020929091908290030181865afa158015611087573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ab91906154f7565b6001600160a01b0316146110be57600080fd5b600980546001600160a01b039384167fffffffffffffffffffffffff000000000000000000000000000000000000000091821617909155600a805492909316911617905550565b60003361111385828561335c565b61111e85858561340c565b506001949350505050565b6009546001600160a01b031633146111a95760405162461bcd60e51b815260206004820152602560248201527f576f6f5375706572436861726765725661756c743a20216c656e64696e674d6160448201527f6e616765720000000000000000000000000000000000000000000000000000006064820152608401610ed6565b60125460ff16156111fc5760405162461bcd60e51b815260206004820152600b60248201527f494e20534554544c494e470000000000000000000000000000000000000000006044820152606401610ed6565b611204611d41565b8211156112535760405162461bcd60e51b815260206004820152601860248201527f494e535546465f414d4f554e545f464f525f424f52524f5700000000000000006044820152606401610ed6565b60006112d583600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d09190615514565b6135f9565b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561133557600080fd5b505af1158015611349573d6000803e3d6000fd5b505050507f00000000000000000000000042000000000000000000000000000000000000066001600160a01b03167f00000000000000000000000042000000000000000000000000000000000000066001600160a01b03160361141b577f00000000000000000000000042000000000000000000000000000000000000066001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561140157600080fd5b505af1158015611415573d6000803e3d6000fd5b50505050505b6114467f00000000000000000000000042000000000000000000000000000000000000068385613645565b505050565b611453613787565b61145b6137f2565b336000908152602081905260409020546114799061384b565b61384b565b6114836001600655565b565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190610d1690829086906114bf90879061555c565b6131aa565b6114cc613302565b601380549082905560408051828152602081018490527f2f0bfd95e6bf57fab22ace02a57c77bdabde00f81ccf61034ae4a915d3a47f4d9101610e4b565b3361151d6005546001600160a01b031690565b6001600160a01b031614806115d057506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd92396001600160a01b03169063af5b052b906024016020604051808303816000875af11580156115ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d09190615574565b61161c5760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e000000006044820152606401610ed6565b611483613abf565b61162c613302565b6001600160a01b0381166116825760405162461bcd60e51b815260206004820152600760248201527f215f7661756c74000000000000000000000000000000000000000000000000006044820152606401610ed6565b60007f00000000000000000000000042000000000000000000000000000000000000066001600160a01b03167f00000000000000000000000042000000000000000000000000000000000000066001600160a01b0316146116ea576116e5611b3c565b6116ec565b475b6007546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529192506001600160a01b031690632e1a7d4d9082906370a0823190602401602060405180830381865afa158015611756573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061177a9190615514565b6040518263ffffffff1660e01b815260040161179891815260200190565b600060405180830381600087803b1580156117b257600080fd5b505af11580156117c6573d6000803e3d6000fd5b5050505060007f00000000000000000000000042000000000000000000000000000000000000066001600160a01b03167f00000000000000000000000042000000000000000000000000000000000000066001600160a01b0316146118325761182d611b3c565b611834565b475b905060006118428383615596565b600780546001600160a01b038781167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080517f1f1fcd510000000000000000000000000000000000000000000000000000000081529051949550918116937f00000000000000000000000042000000000000000000000000000000000000069091169291631f1fcd519160048083019260209291908290030181865afa1580156118f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191d91906154f7565b6001600160a01b0316146119735760405162461bcd60e51b815260206004820152600c60248201527f494e56414c49445f57414e5400000000000000000000000000000000000000006044820152606401610ed6565b7f00000000000000000000000042000000000000000000000000000000000000066001600160a01b03167f00000000000000000000000042000000000000000000000000000000000000066001600160a01b031603611a4a576007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b039091169063b6b55f259084906024016000604051808303818588803b158015611a2c57600080fd5b505af1158015611a40573d6000803e3d6000fd5b5050505050611afa565b600754611a82907f0000000000000000000000004200000000000000000000000000000000000006906001600160a01b031684613b2f565b6007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b039091169063b6b55f2590602401600060405180830381600087803b158015611ae157600080fd5b505af1158015611af5573d6000803e3d6000fd5b505050505b6040516001600160a01b03808716919083169033907f548fe255eb14d86b43af1c165d3a356a85be79136670fa5ff20aa3e0284afde790600090a45050505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f00000000000000000000000042000000000000000000000000000000000000066001600160a01b0316906370a0823190602401602060405180830381865afa158015611bbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be09190615514565b905090565b611bed613302565b600880547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03838116918217909255604080517f1f1fcd51000000000000000000000000000000000000000000000000000000008152905184937f0000000000000000000000004200000000000000000000000000000000000006169291631f1fcd519160048083019260209291908290030181865afa158015611c9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cc191906154f7565b6001600160a01b031614611d3d5760405162461bcd60e51b815260206004820152602160248201527f576f6f5375706572436861726765725661756c743a202157414e545f7661756c60448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610ed6565b5050565b600080611d4c61248c565b90506000601154601054611d609190615596565b9050808211611d70576000611d7a565b611d7a8183615596565b9250505090565b600954604080517fd83e6b3800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163d83e6b389160048083019260209291908290030181865afa158015611bbc573d6000803e3d6000fd5b6001600160a01b0381166000908152600c6020526040812054610d1c90613c71565b611e0e613302565b6001600160a01b038216611e645760405162461bcd60e51b815260206004820152600c60248201527f215f6d61737465724368656600000000000000000000000000000000000000006044820152606401610ed6565b601580547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03841690811790915560168290556040517f1526fe270000000000000000000000000000000000000000000000000000000081526004810183905260009190631526fe279060240160a060405180830381865afa158015611ef6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1a91906155ad565b505050509050306001600160a01b0316816001600160a01b0316146114465760405162461bcd60e51b8152600401610ed69060208082526004908201527f2170696400000000000000000000000000000000000000000000000000000000604082015260600190565b600080611f8e61248c565b90506000611f9a6129d4565b9050600081611fa7612912565b611fb19190615596565b9050611fbe600a82615605565b611fc8908361555c565b831015611ff45782611fdb600a83615605565b611fe5908461555c565b611fef9190615596565b611ff7565b60005b935050505090565b612007613302565b601455565b612014613787565b61201c6137f2565b6120268282613c7f565b611d3d6001600655565b612038613302565b6114836000614089565b61204a613787565b6120526137f2565b61205e611474826140f3565b6120686001600655565b50565b600061207660025490565b156120a257600254612086612912565b61209890670de0b6b3a7640000615640565b611be09190615605565b50670de0b6b3a764000090565b6120b7613787565b6120bf6137f2565b33600090815260208190526040902054611479905b33614175565b6120e2613302565b601055565b336120fa6005546001600160a01b031690565b6001600160a01b031614806121ad57506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd92396001600160a01b03169063af5b052b906024016020604051808303816000875af1158015612189573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ad9190615574565b6121f95760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e000000006044820152606401610ed6565b611483614647565b6000611be0600e6146b6565b336122206005546001600160a01b031690565b6001600160a01b031614806122d357506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd92396001600160a01b03169063af5b052b906024016020604051808303816000875af11580156122af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122d39190615574565b61231f5760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e000000006044820152606401610ed6565b60125460ff16156123725760405162461bcd60e51b815260206004820152600b60248201527f494e5f534554544c494e470000000000000000000000000000000000000000006044820152606401610ed6565b601280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055600954604080517fa373ed4e00000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169163a373ed4e9160048082019260009290919082900301818387803b1580156123fc57600080fd5b505af1158015612410573d6000803e3d6000fd5b50505050336001600160a01b03167ffce7d682dc90b7cc945fb8cfff947668bcf6d304aa58823b24d2c06dec38df6e600d5461244a611f83565b6040805192835260208301919091520160405180910390a2565b606060048054610c8590615480565b61247b613787565b6124836137f2565b611479336146c0565b6007546040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600091611be0916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156124f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125189190615514565b600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561256b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061258f9190615514565b614c2c565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156126315760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610ed6565b61111e82868684036131aa565b600033610d1681858561340c565b6009546001600160a01b031633146126cc5760405162461bcd60e51b815260206004820152602560248201527f576f6f5375706572436861726765725661756c743a20216c656e64696e674d6160448201527f6e616765720000000000000000000000000000000000000000000000000000006064820152608401610ed6565b6126f87f0000000000000000000000004200000000000000000000000000000000000006333084614c52565b7f00000000000000000000000042000000000000000000000000000000000000066001600160a01b03167f00000000000000000000000042000000000000000000000000000000000000066001600160a01b031603612860576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000042000000000000000000000000000000000000066001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156127cc57600080fd5b505af11580156127e0573d6000803e3d6000fd5b50506007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b03909116925063b6b55f25915083906024016000604051808303818588803b15801561284457600080fd5b505af1158015612858573d6000803e3d6000fd5b505050505050565b600754612898907f0000000000000000000000004200000000000000000000000000000000000006906001600160a01b031683613b2f565b6007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b039091169063b6b55f2590602401600060405180830381600087803b1580156128f757600080fd5b505af115801561290b573d6000803e3d6000fd5b5050505050565b600061291c611d81565b61292461248c565b61292c611b3c565b612936919061555c565b611be0919061555c565b612948613787565b6129506137f2565b61205e8133613c7f565b612962613302565b600980546001600160a01b038381167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080519190921680825260208201939093527f9ed29eb74f1356c602e59670cf82bfe8b0f564216ce091e163fbf7f0376aa1979101610e4b565b6000611be0600d54613c71565b6129e9613302565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601612a23576120683347614d9c565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015612a83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aa79190615514565b9050611d3d823383613645565b612abc613302565b601280546001600160a01b03909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b612b03613302565b6001600160a01b038116612b7f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610ed6565b61206881614089565b33612b9b6005546001600160a01b031690565b6001600160a01b03161480612c4e57506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd92396001600160a01b03169063af5b052b906024016020604051808303816000875af1158015612c2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c4e9190615574565b612c9a5760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e000000006044820152606401610ed6565b60125460ff16612cec5760405162461bcd60e51b815260206004820152600960248201527f21534554544c494e4700000000000000000000000000000000000000000000006044820152606401610ed6565b612cf4611f83565b15612d415760405162461bcd60e51b815260206004820152601860248201527f5745454b4c595f52455041595f4e4f545f434c454152454400000000000000006044820152606401610ed6565b6000612d4b61206b565b601280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905590506000612d7f6129d4565b905080156130a5576000612de082600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112ac573d6000803e3d6000fd5b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015612e4057600080fd5b505af1158015612e54573d6000803e3d6000fd5b505050507f00000000000000000000000042000000000000000000000000000000000000066001600160a01b03167f00000000000000000000000042000000000000000000000000000000000000066001600160a01b031603612f26577f00000000000000000000000042000000000000000000000000000000000000066001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015612f0c57600080fd5b505af1158015612f20573d6000803e3d6000fd5b50505050505b81612f2f611b3c565b1015612f3a57600080fd5b6000612f46600e6146b6565b905060005b81811015613058576000612f60600e82614e59565b600a546001600160a01b038083166000908152600c60205260409020549293501690639b927a91908390670de0b6b3a764000090612f9f908b90615640565b612fa99190615605565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561300757600080fd5b505af115801561301b573d6000803e3d6000fd5b5050506001600160a01b0382166000908152600c602052604081205550613043600e82614e65565b505080806130509061567d565b915050612f4b565b5061306530600d54614e7a565b6000600d55600a546130a2907f0000000000000000000000004200000000000000000000000000000000000006906001600160a01b031685613645565b50505b60006011819055600954604080517fa373ed4e00000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169263a373ed4e9260048084019382900301818387803b15801561310557600080fd5b505af1158015613119573d6000803e3d6000fd5b505050506000613127612912565b9050613134600a82615605565b601055337f805ee433ea4242be6315bc317b1bf10e767ad8beb03ee547773b3ee1f842c20682613162611d81565b61316a61248c565b604080519384526020840192909252908201526060015b60405180910390a2505050565b613196613787565b61319e6137f2565b61205e6120d4826140f3565b6001600160a01b0383166132255760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b0382166132a15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6005546001600160a01b031633146114835760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ed6565b6001600160a01b038381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461340657818110156133f95760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610ed6565b61340684848484036131aa565b50505050565b6001600160a01b0383166134885760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b0382166135045760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b038316600090815260208190526040902054818110156135935760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3613406565b6000808261360f85670de0b6b3a7640000615640565b6136199190615605565b9050836136268285614c2c565b1461363b5761363681600161555c565b61363d565b805b949350505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905291516000928392908716916136cf91906156b5565b6000604051808303816000865af19150503d806000811461370c576040519150601f19603f3d011682016040523d82523d6000602084013e613711565b606091505b509150915081801561373b57508051158061373b57508080602001905181019061373b9190615574565b61290b5760405162461bcd60e51b815260206004820152600260248201527f53540000000000000000000000000000000000000000000000000000000000006044820152606401610ed6565b60055474010000000000000000000000000000000000000000900460ff16156114835760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610ed6565b6002600654036138445760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610ed6565b6002600655565b6000811161389b5760405162461bcd60e51b815260206004820152601d60248201527f576f6f5375706572436861726765725661756c743a2021616d6f756e740000006044820152606401610ed6565b60125460ff16156139145760405162461bcd60e51b815260206004820152603160248201527f576f6f5375706572436861726765725661756c743a2043414e4e4f545f57495460448201527f48445241575f494e5f534554544c494e470000000000000000000000000000006064820152608401610ed6565b601454613921600e6146b6565b11156139955760405162461bcd60e51b815260206004820152602860248201527f576f6f5375706572436861726765725661756c743a204d41585f57495448445260448201527f41575f434f554e540000000000000000000000000000000000000000000000006064820152608401610ed6565b600954604080517fa373ed4e000000000000000000000000000000000000000000000000000000008152905133926001600160a01b03169163a373ed4e91600480830192600092919082900301818387803b1580156139f357600080fd5b505af1158015613a07573d6000803e3d6000fd5b505050506000613a1683613c71565b9050613a2430833086614c52565b6001600160a01b0382166000908152600c6020526040902054613a4890849061555c565b6001600160a01b0383166000908152600c6020526040902055600d54613a6f90849061555c565b600d55613a7d600e83614fe3565b5060408051828152602081018590526001600160a01b038416917febeaa8785285a4f7c37a305351997dceebabc3c357dab98023dc37514a1b6ed69101613181565b613ac7614ff8565b600580547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b3000000000000000000000000000000000000000000000000000000001790529151600092839290871691613bb991906156b5565b6000604051808303816000865af19150503d8060008114613bf6576040519150601f19603f3d011682016040523d82523d6000602084013e613bfb565b606091505b5091509150818015613c25575080511580613c25575080806020019051810190613c259190615574565b61290b5760405162461bcd60e51b815260206004820152600260248201527f53410000000000000000000000000000000000000000000000000000000000006044820152606401610ed6565b6000610d1c8261258f61206b565b81600003613c8b575050565b600960009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015613cdb57600080fd5b505af1158015613cef573d6000803e3d6000fd5b505050506000613d0683613d0161206b565b615062565b905060008111613d585760405162461bcd60e51b815260206004820152600760248201527f21736861726573000000000000000000000000000000000000000000000000006044820152606401610ed6565b6000613d6383610d22565b6001600160a01b038416600090815260208190526040902054613d86919061555c565b6001600160a01b0384166000908152600b6020526040812054919250613dac848461555c565b613dbe87670de0b6b3a7640000615640565b613dc88486615640565b613dd2919061555c565b613ddc9190615605565b6001600160a01b038087166000908152600b602052604090208290559091507f000000000000000000000000420000000000000000000000000000000000000681167f000000000000000000000000420000000000000000000000000000000000000690911603613f3a57348614613ebc5760405162461bcd60e51b815260206004820152602c60248201527f576f6f5375706572436861726765725661756c743a206d73672e76616c75655f60448201527f494e53554646494349454e5400000000000000000000000000000000000000006064820152608401610ed6565b6007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018890526001600160a01b039091169063b6b55f259034906024016000604051808303818588803b158015613f1c57600080fd5b505af1158015613f30573d6000803e3d6000fd5b5050505050614016565b613f667f0000000000000000000000004200000000000000000000000000000000000006333089614c52565b600754613f9e907f0000000000000000000000004200000000000000000000000000000000000006906001600160a01b031688613b2f565b6007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018890526001600160a01b039091169063b6b55f2590602401600060405180830381600087803b158015613ffd57600080fd5b505af1158015614011573d6000803e3d6000fd5b505050505b6140208585615077565b61402b600a87615605565b601054614038919061555c565b60105560408051878152602081018690526001600160a01b0387169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a3505050505050565b600580546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600954604080517fa373ed4e00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163a373ed4e916004808301928692919082900301818387803b15801561415157600080fd5b505af1158015614165573d6000803e3d6000fd5b50505050610d1c826112d061206b565b600082116141c55760405162461bcd60e51b815260206004820152601d60248201527f576f6f5375706572436861726765725661756c743a2021616d6f756e740000006044820152606401610ed6565b60125460ff161561423e5760405162461bcd60e51b815260206004820152602d60248201527f576f6f5375706572436861726765725661756c743a204e4f545f414c4c4f574560448201527f445f494e5f534554544c494e47000000000000000000000000000000000000006064820152608401610ed6565b6010546011541061424d575050565b600960009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561429d57600080fd5b505af11580156142b1573d6000803e3d6000fd5b5050505060006142c083613c71565b90506011546010546142d29190615596565b8111156143215760405162461bcd60e51b815260206004820181905260248201527f576f6f5375706572436861726765725661756c743a204f55545f4f465f4341506044820152606401610ed6565b336001600160a01b0383161461433c5761433c82338561335c565b6143468284614e7a565b600061439f82600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112ac573d6000803e3d6000fd5b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156143ff57600080fd5b505af1158015614413573d6000803e3d6000fd5b50506040517f871e6ca6000000000000000000000000000000000000000000000000000000008152336004820152600092507f000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd92396001600160a01b0316915063871e6ca6906024016020604051808303816000875af1158015614499573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144bd9190615574565b6144e157612710601354846144d29190615640565b6144dc9190615605565b6144e4565b60005b90507f00000000000000000000000042000000000000000000000000000000000000066001600160a01b03167f00000000000000000000000042000000000000000000000000000000000000066001600160a01b0316036145725760125461455a9061010090046001600160a01b031682614d9c565b61456d846145688386615596565b614d9c565b6145e3565b6012546145af907f00000000000000000000000042000000000000000000000000000000000000069061010090046001600160a01b031683613645565b6145e37f0000000000000000000000004200000000000000000000000000000000000006856145de8487615596565b613645565b826011546145f1919061555c565b60115560408051848152602081018490529081018290526001600160a01b038516907f672004d35ad2124f90299371ade95cf5594500e40705a7cf6eaf7c00b55a07ac9060600160405180910390a25050505050565b61464f613787565b600580547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613b123390565b6000610d1c825490565b6001600160a01b0381166147165760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a20216f776e6572000000006044820152606401610ed6565b6008546001600160a01b03166147945760405162461bcd60e51b815260206004820152602560248201527f576f6f5375706572436861726765725661756c743a20216d6967726174696f6e60448201527f5661756c740000000000000000000000000000000000000000000000000000006064820152608401610ed6565b600854604080517f1f1fcd5100000000000000000000000000000000000000000000000000000000815290516001600160a01b03928316927f000000000000000000000000420000000000000000000000000000000000000616918391631f1fcd51916004808201926020929091908290030181865afa15801561481c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061484091906154f7565b6001600160a01b0316146148bb5760405162461bcd60e51b8152602060048201526024808201527f576f6f5375706572436861726765725661756c743a202157414e545f6e65775660448201527f61756c74000000000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b038216600090815260208190526040812054908190036148e157505050565b600960009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561493157600080fd5b505af1158015614945573d6000803e3d6000fd5b50505050600061495482613c71565b9050336001600160a01b038516146149715761497184338461335c565b61497b8483614e7a565b60006149d482600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112ac573d6000803e3d6000fd5b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015614a3457600080fd5b505af1158015614a48573d6000803e3d6000fd5b505050507f00000000000000000000000042000000000000000000000000000000000000066001600160a01b03167f00000000000000000000000042000000000000000000000000000000000000066001600160a01b031603614b27576040517f6e553f65000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b038681166024830152851690636e553f659084906044016000604051808303818588803b158015614b0957600080fd5b505af1158015614b1d573d6000803e3d6000fd5b5050505050614bce565b614b527f00000000000000000000000042000000000000000000000000000000000000068584613b2f565b6040517f6e553f65000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b038681166024830152851690636e553f6590604401600060405180830381600087803b158015614bb557600080fd5b505af1158015614bc9573d6000803e3d6000fd5b505050505b836001600160a01b0316306001600160a01b0316866001600160a01b03167f2f003beff7d020bbaf25c7b278041e72cadccf9e4eaad1805835be384f19df5f85604051614c1d91815260200190565b60405180910390a45050505050565b6000670de0b6b3a7640000614c418385615640565b614c4b9190615605565b9392505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790529151600092839290881691614ce491906156b5565b6000604051808303816000865af19150503d8060008114614d21576040519150601f19603f3d011682016040523d82523d6000602084013e614d26565b606091505b5091509150818015614d50575080511580614d50575080806020019051810190614d509190615574565b6128585760405162461bcd60e51b815260206004820152600360248201527f53544600000000000000000000000000000000000000000000000000000000006044820152606401610ed6565b604080516000808252602082019092526001600160a01b038416908390604051614dc691906156b5565b60006040518083038185875af1925050503d8060008114614e03576040519150601f19603f3d011682016040523d82523d6000602084013e614e08565b606091505b50509050806114465760405162461bcd60e51b815260206004820152600360248201527f53544500000000000000000000000000000000000000000000000000000000006044820152606401610ed6565b6000614c4b8383615136565b6000614c4b836001600160a01b038416615160565b6001600160a01b038216614ef65760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b03821660009081526020819052604090205481811015614f855760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610ed6565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6000614c4b836001600160a01b038416615253565b60055474010000000000000000000000000000000000000000900460ff166114835760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610ed6565b600081614c4184670de0b6b3a7640000615640565b6001600160a01b0382166150cd5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610ed6565b80600260008282546150df919061555c565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600082600001828154811061514d5761514d6156d1565b9060005260206000200154905092915050565b60008181526001830160205260408120548015615249576000615184600183615596565b855490915060009061519890600190615596565b90508181146151fd5760008660000182815481106151b8576151b86156d1565b90600052602060002001549050808760000184815481106151db576151db6156d1565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061520e5761520e615700565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610d1c565b6000915050610d1c565b600081815260018301602052604081205461529a57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610d1c565b506000610d1c565b60005b838110156152bd5781810151838201526020016152a5565b838111156134065750506000910152565b60208152600082518060208401526152ed8160408501602087016152a2565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6001600160a01b038116811461206857600080fd5b6000806040838503121561534757600080fd5b82356153528161531f565b946020939093013593505050565b60006020828403121561537257600080fd5b813561363b8161531f565b60008060006060848603121561539257600080fd5b833561539d8161531f565b925060208401356153ad8161531f565b915060408401356153bd8161531f565b809150509250925092565b6000806000606084860312156153dd57600080fd5b83356153e88161531f565b925060208401356153f88161531f565b929592945050506040919091013590565b6000806040838503121561541c57600080fd5b82359150602083013561542e8161531f565b809150509250929050565b60006020828403121561544b57600080fd5b5035919050565b6000806040838503121561546557600080fd5b82356154708161531f565b9150602083013561542e8161531f565b600181811c9082168061549457607f821691505b6020821081036154cd577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600080604083850312156154e657600080fd5b505080516020909101519092909150565b60006020828403121561550957600080fd5b815161363b8161531f565b60006020828403121561552657600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000821982111561556f5761556f61552d565b500190565b60006020828403121561558657600080fd5b8151801515811461363b57600080fd5b6000828210156155a8576155a861552d565b500390565b600080600080600060a086880312156155c557600080fd5b85516155d08161531f565b8095505060208601519350604086015192506060860151915060808601516155f78161531f565b809150509295509295909350565b60008261563b577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156156785761567861552d565b500290565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036156ae576156ae61552d565b5060010190565b600082516156c78184602087016152a2565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea26469706673582212201feb31a4feeeade5de800f1560e893a38ddc46a33fe5aa3cba29ce37ce29ce4b64736f6c634300080e0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000042000000000000000000000000000000000000060000000000000000000000004200000000000000000000000000000000000006000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd9239
-----Decoded View---------------
Arg [0] : _weth (address): 0x4200000000000000000000000000000000000006
Arg [1] : _want (address): 0x4200000000000000000000000000000000000006
Arg [2] : _accessManager (address): 0xAf558f888e138CA9416111Ec7aE8e28354Cd9239
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000004200000000000000000000000000000000000006
Arg [1] : 0000000000000000000000004200000000000000000000000000000000000006
Arg [2] : 000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd9239
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Token Allocations
ETH
100.00%
Multichain Portfolio | 32 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| BASE | 100.00% | $2,358.56 | 0.000000000000000495 | <$0.000001 |
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.