More Info
Private Name Tags
ContractCreator
TokenTracker
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 --- // /* NOTE: this method is for fund rescue in emergency. */ function setIsSettling(bool _isSettling) external onlyOwner { isSettling = _isSettling; } 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 batchEndWeeklySettle(uint256 _length) public onlyAdmin { require(isSettling, "!SETTLING"); // require(weeklyNeededAmountForWithdraw() == 0, "WEEKLY_REPAY_NOT_CLEARED"); uint256 sharePrice = getPricePerFullShare(); uint256 _batchWithdrawAmount = 0; uint256 _batchRequestedShares = 0; require(_length <= requestUsers.length(), "!batch_length"); for (uint256 i = 0; i < _length; i++) { address user = requestUsers.at(0); uint256 _amount = (requestedWithdrawShares[user] * sharePrice) / 1e18; _batchWithdrawAmount += _amount; _batchRequestedShares += requestedWithdrawShares[user]; withdrawManager.addWithdrawAmount(user, _amount); // NOTE: accounting only, no fund transfering. requestedWithdrawShares[user] = 0; requestUsers.remove(user); } uint256 shares = _sharesUp(_batchWithdrawAmount, reserveVault.getPricePerFullShare()); reserveVault.withdraw(shares); if (want == weth) { IWETH(weth).deposit{value: _batchWithdrawAmount}(); // WETH for withdraw manager } require(available() >= _batchWithdrawAmount, "!available_amount_for_withdraw"); _burn(address(this), _batchRequestedShares); requestedTotalShares -= _batchRequestedShares; TransferHelper.safeTransfer(want, address(withdrawManager), _batchWithdrawAmount); if (requestUsers.length() == 0) { // NOTE: all settling finished isSettling == false; 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
[{"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":"_length","type":"uint256"}],"name":"batchEndWeeklySettle","outputs":[],"stateMutability":"nonpayable","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":"bool","name":"_isSettling","type":"bool"}],"name":"setIsSettling","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
60e060405260128054610100600160a81b03191674815d4517427fc940a90a5653cdcea1544c6283c900179055601e60135561012c6014553480156200004457600080fd5b506040516200661e3803806200661e833981016040819052620000679162000425565b816001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015620000a6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620000d09190810190620004b8565b604051602001620000e2919062000570565b604051602081830303815290604052826001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000130573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526200015a9190810190620004b8565b6040516020016200016c9190620005b7565b60408051601f1981840301815291905281516200019190600390602085019062000362565b508051620001a790600490602084019062000362565b505050620001c4620001be6200030c60201b60201c565b62000310565b6005805460ff60a01b1916905560016006556001600160a01b038316620002325760405162461bcd60e51b815260206004820152601b60248201527f576f6f5375706572436861726765725661756c743a202177657468000000000060448201526064015b60405180910390fd5b6001600160a01b0382166200028a5760405162461bcd60e51b815260206004820152601b60248201527f576f6f5375706572436861726765725661756c743a202177616e740000000000604482015260640162000229565b6001600160a01b038116620002ee5760405162461bcd60e51b8152602060048201526024808201527f576f6f5375706572436861726765725661756c743a20216163636573734d616e60448201526330b3b2b960e11b606482015260840162000229565b6001600160a01b0392831660a0529082166080521660c0526200061f565b3390565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8280546200037090620005e3565b90600052602060002090601f016020900481019282620003945760008555620003df565b82601f10620003af57805160ff1916838001178555620003df565b82800160010185558215620003df579182015b82811115620003df578251825591602001919060010190620003c2565b50620003ed929150620003f1565b5090565b5b80821115620003ed5760008155600101620003f2565b80516001600160a01b03811681146200042057600080fd5b919050565b6000806000606084860312156200043b57600080fd5b620004468462000408565b9250620004566020850162000408565b9150620004666040850162000408565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004a257818101518382015260200162000488565b83811115620004b2576000848401525b50505050565b600060208284031215620004cb57600080fd5b81516001600160401b0380821115620004e357600080fd5b818401915084601f830112620004f857600080fd5b8151818111156200050d576200050d6200046f565b604051601f8201601f19908116603f011681019083821181831017156200053857620005386200046f565b816040528281528760208487010111156200055257600080fd5b6200056583602083016020880162000485565b979650505050505050565b7f574f4f4669205375706572204368617267657220000000000000000000000000815260008251620005aa81601485016020870162000485565b9190910160140192915050565b61776560f01b815260008251620005d681600285016020870162000485565b9190910160020192915050565b600181811c90821680620005f857607f821691505b6020821081036200061957634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c051615e8d6200079160003960008181610cca01528181610de901528181611c2b0152818161284101528181612967015281816132db0152614ce4015260008181610699015281816111a70152818161120001528181611a1f01528181611a7801528181611d5601528181611e9e0152818161204501528181612e0301528181612e890152818161355c015281816135b50152818161469a01528181614d8501526152e1015260008181610587015281816111d1015281816112f40152818161173201528181611a4901528181611af001528181611d8001528181611ec801528181611f7b0152818161206f015281816121230152818161223d0152818161232101528181612dda01528181612e2d01528181612f720152818161358601528181613775015281816146bd015281816147dc0152818161480c01528181614daf01528181614e1801528181614e51015281816150610152818161530b01526153bf0152615e8d6000f3fe6080604052600436106104695760003560e01c806377c7b8fc11610243578063b5589fad11610143578063e14224f3116100bb578063f10684541161008a578063fac6182f1161006f578063fac6182f14610c83578063fd92bff214610c98578063fdcb606814610cb857600080fd5b8063f106845414610c4d578063f2fde38b14610c6357600080fd5b8063e14224f314610bd7578063e1a4e72a14610bed578063ec3e9da514610c0d578063f0f4426014610c2d57600080fd5b8063cecdb96111610112578063dadb6c1d116100f7578063dadb6c1d14610b66578063dc692cd714610b7b578063dd62ed3e14610b9157600080fd5b8063cecdb96114610b30578063cef062fc14610b4657600080fd5b8063b5589fad14610ac8578063b69ef8a814610ae8578063b6b55f2514610afd578063c869d0ed14610b1057600080fd5b80638da5cb5b116101d65780639d46c009116101a5578063a10954fe1161018a578063a10954fe14610a73578063a457c2d714610a88578063a9059cbb14610aa857600080fd5b80639d46c00914610a3e5780639e3b77af14610a5357600080fd5b80638da5cb5b146109dc5780638e400570146109fa57806395d89b4114610a0f57806396f25d4214610a2457600080fd5b80638456cb59116102125780638456cb591461096f5780638542783f14610984578063864a897f14610999578063882c127e146109af57600080fd5b806377c7b8fc146109055780637ab7cbb11461091a5780637f2932281461092f57806383165e591461094f57600080fd5b806348a0d75411610369578063672f1490116102e15780636e553f65116102b0578063715018a611610295578063715018a6146108b0578063745400c9146108c5578063776b6539146108e557600080fd5b80636e553f651461086757806370a082311461087a57600080fd5b8063672f1490146107fc5780636a7855fd1461081c5780636aa9eda2146108325780636d67d5d41461084757600080fd5b8063575a86b21161033857806360773a2c1161031d57806360773a2c1461078a57806361d027b3146107aa57806362263991146107cf57600080fd5b8063575a86b21461073a5780635c975abb1461075a57600080fd5b806348a0d754146106db57806348cdc141146106f05780634bb2dcea146107105780634d9b48941461072557600080fd5b806323b872dd116103fc57806339509351116103cb5780633f4ba83a116103b05780633f4ba83a146106725780633fc8cef3146106875780634069ab68146106bb57600080fd5b806339509351146106325780633bfb5c141461065257600080fd5b806323b872dd146105c15780632ea9239e146105e1578063313ce5671461060157806336ea43441461061d57600080fd5b806317e3e2e81161043857806317e3e2e81461052057806318160ddd14610540578063184b9559146105555780631f1fcd511461057557600080fd5b806306fdde0314610475578063095ea7b3146104a05780630c0fb800146104d05780630eb0c8f3146104f257600080fd5b3661047057005b600080fd5b34801561048157600080fd5b5061048a610cec565b60405161049791906159d0565b60405180910390f35b3480156104ac57600080fd5b506104c06104bb366004615a36565b610d7e565b6040519015158152602001610497565b3480156104dc57600080fd5b506104f06104eb366004615a62565b610d98565b005b3480156104fe57600080fd5b5061051261050d366004615a7b565b611420565b604051908152602001610497565b34801561052c57600080fd5b506104f061053b366004615a7b565b6114d3565b34801561054c57600080fd5b50600254610512565b34801561056157600080fd5b506104f0610570366004615a98565b611555565b34801561058157600080fd5b506105a97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610497565b3480156105cd57600080fd5b506104c06105dc366004615ae3565b6117fe565b3480156105ed57600080fd5b506104f06105fc366004615b24565b611822565b34801561060d57600080fd5b5060405160128152602001610497565b34801561062957600080fd5b506104f0611b1b565b34801561063e57600080fd5b506104c061064d366004615a36565b611b55565b34801561065e57600080fd5b506104f061066d366004615a62565b611b94565b34801561067e57600080fd5b506104f0611bda565b34801561069357600080fd5b506105a97f000000000000000000000000000000000000000000000000000000000000000081565b3480156106c757600080fd5b506104f06106d6366004615a7b565b611cf4565b3480156106e757600080fd5b5061051261220c565b3480156106fc57600080fd5b506104f061070b366004615a7b565b6122b5565b34801561071c57600080fd5b50610512612411565b34801561073157600080fd5b50610512612451565b34801561074657600080fd5b506015546105a9906001600160a01b031681565b34801561076657600080fd5b5060055474010000000000000000000000000000000000000000900460ff166104c0565b34801561079657600080fd5b506105126107a5366004615a7b565b6124b4565b3480156107b657600080fd5b506012546105a99061010090046001600160a01b031681565b3480156107db57600080fd5b506105126107ea366004615a7b565b600b6020526000908152604090205481565b34801561080857600080fd5b506104f0610817366004615a36565b6124d6565b34801561082857600080fd5b5061051260115481565b34801561083e57600080fd5b50610512612653565b34801561085357600080fd5b506104f0610862366004615a62565b6126cf565b6104f0610875366004615b24565b6126dc565b34801561088657600080fd5b50610512610895366004615a7b565b6001600160a01b031660009081526020819052604090205490565b3480156108bc57600080fd5b506104f0612700565b3480156108d157600080fd5b506104f06108e0366004615a62565b612712565b3480156108f157600080fd5b506104f0610900366004615b62565b61273b565b34801561091157600080fd5b50610512612774565b34801561092657600080fd5b506104f06127b8565b34801561093b57600080fd5b506104f061094a366004615a62565b6127e3565b34801561095b57600080fd5b506008546105a9906001600160a01b031681565b34801561097b57600080fd5b506104f06127f0565b34801561099057600080fd5b5061051261290a565b3480156109a557600080fd5b5061051260105481565b3480156109bb57600080fd5b506105126109ca366004615a7b565b600c6020526000908152604090205481565b3480156109e857600080fd5b506005546001600160a01b03166105a9565b348015610a0657600080fd5b506104f0612916565b348015610a1b57600080fd5b5061048a612b6d565b348015610a3057600080fd5b506012546104c09060ff1681565b348015610a4a57600080fd5b506104f0612b7c565b348015610a5f57600080fd5b506009546105a9906001600160a01b031681565b348015610a7f57600080fd5b50610512612b95565b348015610a9457600080fd5b506104c0610aa3366004615a36565b612c9d565b348015610ab457600080fd5b506104c0610ac3366004615a36565b612d47565b348015610ad457600080fd5b506104f0610ae3366004615a62565b612d55565b348015610af457600080fd5b50610512613014565b6104f0610b0b366004615a62565b613042565b348015610b1c57600080fd5b506104f0610b2b366004615a7b565b61305c565b348015610b3c57600080fd5b5061051260135481565b348015610b5257600080fd5b506007546105a9906001600160a01b031681565b348015610b7257600080fd5b506105126130d6565b348015610b8757600080fd5b5061051260145481565b348015610b9d57600080fd5b50610512610bac366004615b7f565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b348015610be357600080fd5b50610512600d5481565b348015610bf957600080fd5b506104f0610c08366004615a7b565b6130e3565b348015610c1957600080fd5b50600a546105a9906001600160a01b031681565b348015610c3957600080fd5b506104f0610c48366004615a7b565b6131b6565b348015610c5957600080fd5b5061051260165481565b348015610c6f57600080fd5b506104f0610c7e366004615a7b565b6131fd565b348015610c8f57600080fd5b506104f061328a565b348015610ca457600080fd5b506104f0610cb3366004615a62565b613890565b348015610cc457600080fd5b506105a97f000000000000000000000000000000000000000000000000000000000000000081565b606060038054610cfb90615bad565b80601f0160208091040260200160405190810160405280929190818152602001828054610d2790615bad565b8015610d745780601f10610d4957610100808354040283529160200191610d74565b820191906000526020600020905b815481529060010190602001808311610d5757829003601f168201915b5050505050905090565b600033610d8c8185856138ac565b60019150505b92915050565b33610dab6005546001600160a01b031690565b6001600160a01b03161480610e5e57506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063af5b052b906024016020604051808303816000875af1158015610e3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5e9190615c00565b610eaf5760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e0000000060448201526064015b60405180910390fd5b60125460ff16610f015760405162461bcd60e51b815260206004820152600960248201527f21534554544c494e4700000000000000000000000000000000000000000000006044820152606401610ea6565b6000610f0b612774565b9050600080610f1a600e613a04565b841115610f695760405162461bcd60e51b815260206004820152600d60248201527f2162617463685f6c656e677468000000000000000000000000000000000000006044820152606401610ea6565b60005b848110156110aa576000610f81600e82613a0e565b6001600160a01b0381166000908152600c602052604081205491925090670de0b6b3a764000090610fb3908890615c4c565b610fbd9190615c89565b9050610fc98186615cc4565b6001600160a01b0383166000908152600c6020526040902054909550610fef9085615cc4565b600a546040517f9b927a910000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015260248201859052929650911690639b927a9190604401600060405180830381600087803b15801561105857600080fd5b505af115801561106c573d6000803e3d6000fd5b5050506001600160a01b0383166000908152600c602052604081205550611094600e83613a21565b50505080806110a290615cdc565b915050610f6c565b50600061112d83600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611104573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111289190615d14565b613a36565b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561118d57600080fd5b505af11580156111a1573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031603611273577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561125957600080fd5b505af115801561126d573d6000803e3d6000fd5b50505050505b8261127c61220c565b10156112ca5760405162461bcd60e51b815260206004820152601e60248201527f21617661696c61626c655f616d6f756e745f666f725f776974686472617700006044820152606401610ea6565b6112d43083613a82565b81600d60008282546112e69190615d2d565b9091555050600a54611323907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b031685613beb565b61132d600e613a04565b6000036114195760006011819055600954604080517fa373ed4e00000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169263a373ed4e9260048084019382900301818387803b15801561139457600080fd5b505af11580156113a8573d6000803e3d6000fd5b5050505060006113b6613014565b90506113c3600a82615c89565b601055337f805ee433ea4242be6315bc317b1bf10e767ad8beb03ee547773b3ee1f842c206826113f1612451565b6113f9612b95565b6040805193845260208401929092529082015260600160405180910390a2505b5050505050565b6015546000906001600160a01b031661143b57506000919050565b6015546016546040517f93f1a40b00000000000000000000000000000000000000000000000000000000815260048101919091526001600160a01b038481166024830152909116906393f1a40b906044016040805180830381865afa1580156114a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114cc9190615d44565b5092915050565b6114db613d2d565b600a80546001600160a01b038381167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080519190921680825260208201939093527f68b42fcf63f2d28ae477b4539c3101ade5142acdcc91191a106d867f3554f28a91015b60405180910390a15050565b61155d613d2d565b6001600160a01b0383166115d85760405162461bcd60e51b8152602060048201526024808201527f576f6f5375706572436861726765725661756c743a20215f726573657276655660448201527f61756c74000000000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b0382166116545760405162461bcd60e51b815260206004820152602660248201527f576f6f5375706572436861726765725661756c743a20215f6c656e64696e674d60448201527f616e6167657200000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b0381166116d05760405162461bcd60e51b815260206004820152602760248201527f576f6f5375706572436861726765725661756c743a20215f776974686472617760448201527f4d616e61676572000000000000000000000000000000000000000000000000006064820152608401610ea6565b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03858116918217909255604080517f1f1fcd5100000000000000000000000000000000000000000000000000000000815290517f000000000000000000000000000000000000000000000000000000000000000090931692631f1fcd51916004808201926020929091908290030181865afa158015611780573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a49190615d68565b6001600160a01b0316146117b757600080fd5b600980546001600160a01b039384167fffffffffffffffffffffffff000000000000000000000000000000000000000091821617909155600a805492909316911617905550565b60003361180c858285613d87565b611817858585613e37565b506001949350505050565b6009546001600160a01b031633146118a25760405162461bcd60e51b815260206004820152602560248201527f576f6f5375706572436861726765725661756c743a20216c656e64696e674d6160448201527f6e616765720000000000000000000000000000000000000000000000000000006064820152608401610ea6565b60125460ff16156118f55760405162461bcd60e51b815260206004820152600b60248201527f494e20534554544c494e470000000000000000000000000000000000000000006044820152606401610ea6565b6118fd612411565b82111561194c5760405162461bcd60e51b815260206004820152601860248201527f494e535546465f414d4f554e545f464f525f424f52524f5700000000000000006044820152606401610ea6565b60006119a583600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611104573d6000803e3d6000fd5b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015611a0557600080fd5b505af1158015611a19573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031603611aeb577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b158015611ad157600080fd5b505af1158015611ae5573d6000803e3d6000fd5b50505050505b611b167f00000000000000000000000000000000000000000000000000000000000000008385613beb565b505050565b611b23614024565b611b2b61408f565b33600090815260208190526040902054611b49906140e8565b6140e8565b611b536001600655565b565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190610d8c9082908690611b8f908790615cc4565b6138ac565b611b9c613d2d565b601380549082905560408051828152602081018490527f2f0bfd95e6bf57fab22ace02a57c77bdabde00f81ccf61034ae4a915d3a47f4d9101611549565b33611bed6005546001600160a01b031690565b6001600160a01b03161480611ca057506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063af5b052b906024016020604051808303816000875af1158015611c7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca09190615c00565b611cec5760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e000000006044820152606401610ea6565b611b5361435c565b611cfc613d2d565b6001600160a01b038116611d525760405162461bcd60e51b815260206004820152600760248201527f215f7661756c74000000000000000000000000000000000000000000000000006044820152606401610ea6565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614611dba57611db561220c565b611dbc565b475b6007546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529192506001600160a01b031690632e1a7d4d9082906370a0823190602401602060405180830381865afa158015611e26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e4a9190615d14565b6040518263ffffffff1660e01b8152600401611e6891815260200190565b600060405180830381600087803b158015611e8257600080fd5b505af1158015611e96573d6000803e3d6000fd5b5050505060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614611f0257611efd61220c565b611f04565b475b90506000611f128383615d2d565b600780546001600160a01b038781167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080517f1f1fcd510000000000000000000000000000000000000000000000000000000081529051949550918116937f00000000000000000000000000000000000000000000000000000000000000009091169291631f1fcd519160048083019260209291908290030181865afa158015611fc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fed9190615d68565b6001600160a01b0316146120435760405162461bcd60e51b815260206004820152600c60248201527f494e56414c49445f57414e5400000000000000000000000000000000000000006044820152606401610ea6565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03160361211a576007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b039091169063b6b55f259084906024016000604051808303818588803b1580156120fc57600080fd5b505af1158015612110573d6000803e3d6000fd5b50505050506121ca565b600754612152907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b0316846143cc565b6007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b039091169063b6b55f2590602401600060405180830381600087803b1580156121b157600080fd5b505af11580156121c5573d6000803e3d6000fd5b505050505b6040516001600160a01b03808716919083169033907f548fe255eb14d86b43af1c165d3a356a85be79136670fa5ff20aa3e0284afde790600090a45050505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa15801561228c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b09190615d14565b905090565b6122bd613d2d565b600880547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03838116918217909255604080517f1f1fcd51000000000000000000000000000000000000000000000000000000008152905184937f0000000000000000000000000000000000000000000000000000000000000000169291631f1fcd519160048083019260209291908290030181865afa15801561236d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123919190615d68565b6001600160a01b03161461240d5760405162461bcd60e51b815260206004820152602160248201527f576f6f5375706572436861726765725661756c743a202157414e545f7661756c60448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610ea6565b5050565b60008061241c612b95565b905060006011546010546124309190615d2d565b905080821161244057600061244a565b61244a8183615d2d565b9250505090565b600954604080517fd83e6b3800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163d83e6b389160048083019260209291908290030181865afa15801561228c573d6000803e3d6000fd5b6001600160a01b0381166000908152600c6020526040812054610d929061450e565b6124de613d2d565b6001600160a01b0382166125345760405162461bcd60e51b815260206004820152600c60248201527f215f6d61737465724368656600000000000000000000000000000000000000006044820152606401610ea6565b601580547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03841690811790915560168290556040517f1526fe270000000000000000000000000000000000000000000000000000000081526004810183905260009190631526fe279060240160a060405180830381865afa1580156125c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125ea9190615d85565b505050509050306001600160a01b0316816001600160a01b031614611b165760405162461bcd60e51b8152600401610ea69060208082526004908201527f2170696400000000000000000000000000000000000000000000000000000000604082015260600190565b60008061265e612b95565b9050600061266a6130d6565b9050600081612677613014565b6126819190615d2d565b905061268e600a82615c89565b6126989083615cc4565b8310156126c457826126ab600a83615c89565b6126b59084615cc4565b6126bf9190615d2d565b6126c7565b60005b935050505090565b6126d7613d2d565b601455565b6126e4614024565b6126ec61408f565b6126f6828261451c565b61240d6001600655565b612708613d2d565b611b536000614926565b61271a614024565b61272261408f565b61272e611b4482614990565b6127386001600655565b50565b612743613d2d565b601280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b600061277f60025490565b156127ab5760025461278f613014565b6127a190670de0b6b3a7640000615c4c565b6122b09190615c89565b50670de0b6b3a764000090565b6127c0614024565b6127c861408f565b33600090815260208190526040902054611b49905b33614a12565b6127eb613d2d565b601055565b336128036005546001600160a01b031690565b6001600160a01b031614806128b657506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063af5b052b906024016020604051808303816000875af1158015612892573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b69190615c00565b6129025760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e000000006044820152606401610ea6565b611b53614ee4565b60006122b0600e613a04565b336129296005546001600160a01b031690565b6001600160a01b031614806129dc57506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063af5b052b906024016020604051808303816000875af11580156129b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129dc9190615c00565b612a285760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e000000006044820152606401610ea6565b60125460ff1615612a7b5760405162461bcd60e51b815260206004820152600b60248201527f494e5f534554544c494e470000000000000000000000000000000000000000006044820152606401610ea6565b601280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055600954604080517fa373ed4e00000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169163a373ed4e9160048082019260009290919082900301818387803b158015612b0557600080fd5b505af1158015612b19573d6000803e3d6000fd5b50505050336001600160a01b03167ffce7d682dc90b7cc945fb8cfff947668bcf6d304aa58823b24d2c06dec38df6e600d54612b53612653565b6040805192835260208301919091520160405180910390a2565b606060048054610cfb90615bad565b612b84614024565b612b8c61408f565b611b4933614f53565b6007546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000916122b0916001600160a01b03909116906370a0823190602401602060405180830381865afa158015612bfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c219190615d14565b600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c989190615d14565b6154bf565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919083811015612d3a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610ea6565b61181782868684036138ac565b600033610d8c818585613e37565b6009546001600160a01b03163314612dd55760405162461bcd60e51b815260206004820152602560248201527f576f6f5375706572436861726765725661756c743a20216c656e64696e674d6160448201527f6e616765720000000000000000000000000000000000000000000000000000006064820152608401610ea6565b612e017f00000000000000000000000000000000000000000000000000000000000000003330846154de565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031603612f69576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015612ed557600080fd5b505af1158015612ee9573d6000803e3d6000fd5b50506007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b03909116925063b6b55f25915083906024016000604051808303818588803b158015612f4d57600080fd5b505af1158015612f61573d6000803e3d6000fd5b505050505050565b600754612fa1907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b0316836143cc565b6007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b039091169063b6b55f2590602401600060405180830381600087803b15801561300057600080fd5b505af1158015611419573d6000803e3d6000fd5b600061301e612451565b613026612b95565b61302e61220c565b6130389190615cc4565b6122b09190615cc4565b61304a614024565b61305261408f565b61272e813361451c565b613064613d2d565b600980546001600160a01b038381167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080519190921680825260208201939093527f9ed29eb74f1356c602e59670cf82bfe8b0f564216ce091e163fbf7f0376aa1979101611549565b60006122b0600d5461450e565b6130eb613d2d565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601613125576127383347615628565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015613185573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131a99190615d14565b905061240d823383613beb565b6131be613d2d565b601280546001600160a01b03909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b613205613d2d565b6001600160a01b0381166132815760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610ea6565b61273881614926565b3361329d6005546001600160a01b031690565b6001600160a01b0316148061335057506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063af5b052b906024016020604051808303816000875af115801561332c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133509190615c00565b61339c5760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e000000006044820152606401610ea6565b60125460ff166133ee5760405162461bcd60e51b815260206004820152600960248201527f21534554544c494e4700000000000000000000000000000000000000000000006044820152606401610ea6565b6133f6612653565b156134435760405162461bcd60e51b815260206004820152601860248201527f5745454b4c595f52455041595f4e4f545f434c454152454400000000000000006044820152606401610ea6565b600061344d612774565b601280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055905060006134816130d6565b905080156137a75760006134e282600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611104573d6000803e3d6000fd5b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561354257600080fd5b505af1158015613556573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031603613628577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561360e57600080fd5b505af1158015613622573d6000803e3d6000fd5b50505050505b8161363161220c565b101561363c57600080fd5b6000613648600e613a04565b905060005b8181101561375a576000613662600e82613a0e565b600a546001600160a01b038083166000908152600c60205260409020549293501690639b927a91908390670de0b6b3a7640000906136a1908b90615c4c565b6136ab9190615c89565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561370957600080fd5b505af115801561371d573d6000803e3d6000fd5b5050506001600160a01b0382166000908152600c602052604081205550613745600e82613a21565b5050808061375290615cdc565b91505061364d565b5061376730600d54613a82565b6000600d55600a546137a4907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b031685613beb565b50505b60006011819055600954604080517fa373ed4e00000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169263a373ed4e9260048084019382900301818387803b15801561380757600080fd5b505af115801561381b573d6000803e3d6000fd5b505050506000613829613014565b9050613836600a82615c89565b601055337f805ee433ea4242be6315bc317b1bf10e767ad8beb03ee547773b3ee1f842c20682613864612451565b61386c612b95565b604080519384526020840192909252908201526060015b60405180910390a2505050565b613898614024565b6138a061408f565b61272e6127dd82614990565b6001600160a01b0383166139275760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b0382166139a35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610d92825490565b6000613a1a83836156e5565b9392505050565b6000613a1a836001600160a01b03841661570f565b60008082613a4c85670de0b6b3a7640000615c4c565b613a569190615c89565b905083613a6382856154bf565b14613a7857613a73816001615cc4565b613a7a565b805b949350505050565b6001600160a01b038216613afe5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b03821660009081526020819052604090205481811015613b8d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790529151600092839290871691613c759190615ddd565b6000604051808303816000865af19150503d8060008114613cb2576040519150601f19603f3d011682016040523d82523d6000602084013e613cb7565b606091505b5091509150818015613ce1575080511580613ce1575080806020019051810190613ce19190615c00565b6114195760405162461bcd60e51b815260206004820152600260248201527f53540000000000000000000000000000000000000000000000000000000000006044820152606401610ea6565b6005546001600160a01b03163314611b535760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ea6565b6001600160a01b038381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114613e315781811015613e245760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610ea6565b613e3184848484036138ac565b50505050565b6001600160a01b038316613eb35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b038216613f2f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b03831660009081526020819052604090205481811015613fbe5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3613e31565b60055474010000000000000000000000000000000000000000900460ff1615611b535760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610ea6565b6002600654036140e15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610ea6565b6002600655565b600081116141385760405162461bcd60e51b815260206004820152601d60248201527f576f6f5375706572436861726765725661756c743a2021616d6f756e740000006044820152606401610ea6565b60125460ff16156141b15760405162461bcd60e51b815260206004820152603160248201527f576f6f5375706572436861726765725661756c743a2043414e4e4f545f57495460448201527f48445241575f494e5f534554544c494e470000000000000000000000000000006064820152608401610ea6565b6014546141be600e613a04565b11156142325760405162461bcd60e51b815260206004820152602860248201527f576f6f5375706572436861726765725661756c743a204d41585f57495448445260448201527f41575f434f554e540000000000000000000000000000000000000000000000006064820152608401610ea6565b600954604080517fa373ed4e000000000000000000000000000000000000000000000000000000008152905133926001600160a01b03169163a373ed4e91600480830192600092919082900301818387803b15801561429057600080fd5b505af11580156142a4573d6000803e3d6000fd5b5050505060006142b38361450e565b90506142c1308330866154de565b6001600160a01b0382166000908152600c60205260409020546142e5908490615cc4565b6001600160a01b0383166000908152600c6020526040902055600d5461430c908490615cc4565b600d5561431a600e83615802565b5060408051828152602081018590526001600160a01b038416917febeaa8785285a4f7c37a305351997dceebabc3c357dab98023dc37514a1b6ed69101613883565b614364615817565b600580547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905291516000928392908716916144569190615ddd565b6000604051808303816000865af19150503d8060008114614493576040519150601f19603f3d011682016040523d82523d6000602084013e614498565b606091505b50915091508180156144c25750805115806144c25750808060200190518101906144c29190615c00565b6114195760405162461bcd60e51b815260206004820152600260248201527f53410000000000000000000000000000000000000000000000000000000000006044820152606401610ea6565b6000610d9282612c98612774565b81600003614528575050565b600960009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561457857600080fd5b505af115801561458c573d6000803e3d6000fd5b5050505060006145a38361459e612774565b615881565b9050600081116145f55760405162461bcd60e51b815260206004820152600760248201527f21736861726573000000000000000000000000000000000000000000000000006044820152606401610ea6565b600061460083611420565b6001600160a01b0384166000908152602081905260409020546146239190615cc4565b6001600160a01b0384166000908152600b60205260408120549192506146498484615cc4565b61465b87670de0b6b3a7640000615c4c565b6146658486615c4c565b61466f9190615cc4565b6146799190615c89565b6001600160a01b038087166000908152600b602052604090208290559091507f000000000000000000000000000000000000000000000000000000000000000081167f0000000000000000000000000000000000000000000000000000000000000000909116036147d7573486146147595760405162461bcd60e51b815260206004820152602c60248201527f576f6f5375706572436861726765725661756c743a206d73672e76616c75655f60448201527f494e53554646494349454e5400000000000000000000000000000000000000006064820152608401610ea6565b6007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018890526001600160a01b039091169063b6b55f259034906024016000604051808303818588803b1580156147b957600080fd5b505af11580156147cd573d6000803e3d6000fd5b50505050506148b3565b6148037f00000000000000000000000000000000000000000000000000000000000000003330896154de565b60075461483b907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b0316886143cc565b6007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018890526001600160a01b039091169063b6b55f2590602401600060405180830381600087803b15801561489a57600080fd5b505af11580156148ae573d6000803e3d6000fd5b505050505b6148bd8585615896565b6148c8600a87615c89565b6010546148d59190615cc4565b60105560408051878152602081018690526001600160a01b0387169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a3505050505050565b600580546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600954604080517fa373ed4e00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163a373ed4e916004808301928692919082900301818387803b1580156149ee57600080fd5b505af1158015614a02573d6000803e3d6000fd5b50505050610d9282611128612774565b60008211614a625760405162461bcd60e51b815260206004820152601d60248201527f576f6f5375706572436861726765725661756c743a2021616d6f756e740000006044820152606401610ea6565b60125460ff1615614adb5760405162461bcd60e51b815260206004820152602d60248201527f576f6f5375706572436861726765725661756c743a204e4f545f414c4c4f574560448201527f445f494e5f534554544c494e47000000000000000000000000000000000000006064820152608401610ea6565b60105460115410614aea575050565b600960009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015614b3a57600080fd5b505af1158015614b4e573d6000803e3d6000fd5b505050506000614b5d8361450e565b9050601154601054614b6f9190615d2d565b811115614bbe5760405162461bcd60e51b815260206004820181905260248201527f576f6f5375706572436861726765725661756c743a204f55545f4f465f4341506044820152606401610ea6565b336001600160a01b03831614614bd957614bd9823385613d87565b614be38284613a82565b6000614c3c82600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611104573d6000803e3d6000fd5b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015614c9c57600080fd5b505af1158015614cb0573d6000803e3d6000fd5b50506040517f871e6ca6000000000000000000000000000000000000000000000000000000008152336004820152600092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063871e6ca6906024016020604051808303816000875af1158015614d36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614d5a9190615c00565b614d7e5761271060135484614d6f9190615c4c565b614d799190615c89565b614d81565b60005b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031603614e0f57601254614df79061010090046001600160a01b031682615628565b614e0a84614e058386615d2d565b615628565b614e80565b601254614e4c907f00000000000000000000000000000000000000000000000000000000000000009061010090046001600160a01b031683613beb565b614e807f000000000000000000000000000000000000000000000000000000000000000085614e7b8487615d2d565b613beb565b82601154614e8e9190615cc4565b60115560408051848152602081018490529081018290526001600160a01b038516907f672004d35ad2124f90299371ade95cf5594500e40705a7cf6eaf7c00b55a07ac9060600160405180910390a25050505050565b614eec614024565b600580547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586143af3390565b6001600160a01b038116614fa95760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a20216f776e6572000000006044820152606401610ea6565b6008546001600160a01b03166150275760405162461bcd60e51b815260206004820152602560248201527f576f6f5375706572436861726765725661756c743a20216d6967726174696f6e60448201527f5661756c740000000000000000000000000000000000000000000000000000006064820152608401610ea6565b600854604080517f1f1fcd5100000000000000000000000000000000000000000000000000000000815290516001600160a01b03928316927f000000000000000000000000000000000000000000000000000000000000000016918391631f1fcd51916004808201926020929091908290030181865afa1580156150af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906150d39190615d68565b6001600160a01b03161461514e5760405162461bcd60e51b8152602060048201526024808201527f576f6f5375706572436861726765725661756c743a202157414e545f6e65775660448201527f61756c74000000000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b0382166000908152602081905260408120549081900361517457505050565b600960009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156151c457600080fd5b505af11580156151d8573d6000803e3d6000fd5b5050505060006151e78261450e565b9050336001600160a01b0385161461520457615204843384613d87565b61520e8483613a82565b600061526782600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611104573d6000803e3d6000fd5b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156152c757600080fd5b505af11580156152db573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316036153ba576040517f6e553f65000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b038681166024830152851690636e553f659084906044016000604051808303818588803b15801561539c57600080fd5b505af11580156153b0573d6000803e3d6000fd5b5050505050615461565b6153e57f000000000000000000000000000000000000000000000000000000000000000085846143cc565b6040517f6e553f65000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b038681166024830152851690636e553f6590604401600060405180830381600087803b15801561544857600080fd5b505af115801561545c573d6000803e3d6000fd5b505050505b836001600160a01b0316306001600160a01b0316866001600160a01b03167f2f003beff7d020bbaf25c7b278041e72cadccf9e4eaad1805835be384f19df5f856040516154b091815260200190565b60405180910390a45050505050565b6000670de0b6b3a76400006154d48385615c4c565b613a1a9190615c89565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905291516000928392908816916155709190615ddd565b6000604051808303816000865af19150503d80600081146155ad576040519150601f19603f3d011682016040523d82523d6000602084013e6155b2565b606091505b50915091508180156155dc5750805115806155dc5750808060200190518101906155dc9190615c00565b612f615760405162461bcd60e51b815260206004820152600360248201527f53544600000000000000000000000000000000000000000000000000000000006044820152606401610ea6565b604080516000808252602082019092526001600160a01b0384169083906040516156529190615ddd565b60006040518083038185875af1925050503d806000811461568f576040519150601f19603f3d011682016040523d82523d6000602084013e615694565b606091505b5050905080611b165760405162461bcd60e51b815260206004820152600360248201527f53544500000000000000000000000000000000000000000000000000000000006044820152606401610ea6565b60008260000182815481106156fc576156fc615df9565b9060005260206000200154905092915050565b600081815260018301602052604081205480156157f8576000615733600183615d2d565b855490915060009061574790600190615d2d565b90508181146157ac57600086600001828154811061576757615767615df9565b906000526020600020015490508087600001848154811061578a5761578a615df9565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806157bd576157bd615e28565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610d92565b6000915050610d92565b6000613a1a836001600160a01b038416615955565b60055474010000000000000000000000000000000000000000900460ff16611b535760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610ea6565b6000816154d484670de0b6b3a7640000615c4c565b6001600160a01b0382166158ec5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610ea6565b80600260008282546158fe9190615cc4565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600081815260018301602052604081205461599c57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610d92565b506000610d92565b60005b838110156159bf5781810151838201526020016159a7565b83811115613e315750506000910152565b60208152600082518060208401526159ef8160408501602087016159a4565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6001600160a01b038116811461273857600080fd5b60008060408385031215615a4957600080fd5b8235615a5481615a21565b946020939093013593505050565b600060208284031215615a7457600080fd5b5035919050565b600060208284031215615a8d57600080fd5b8135613a7881615a21565b600080600060608486031215615aad57600080fd5b8335615ab881615a21565b92506020840135615ac881615a21565b91506040840135615ad881615a21565b809150509250925092565b600080600060608486031215615af857600080fd5b8335615b0381615a21565b92506020840135615b1381615a21565b929592945050506040919091013590565b60008060408385031215615b3757600080fd5b823591506020830135615b4981615a21565b809150509250929050565b801515811461273857600080fd5b600060208284031215615b7457600080fd5b8135613a7881615b54565b60008060408385031215615b9257600080fd5b8235615b9d81615a21565b91506020830135615b4981615a21565b600181811c90821680615bc157607f821691505b602082108103615bfa577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215615c1257600080fd5b8151613a7881615b54565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615615c8457615c84615c1d565b500290565b600082615cbf577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60008219821115615cd757615cd7615c1d565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203615d0d57615d0d615c1d565b5060010190565b600060208284031215615d2657600080fd5b5051919050565b600082821015615d3f57615d3f615c1d565b500390565b60008060408385031215615d5757600080fd5b505080516020909101519092909150565b600060208284031215615d7a57600080fd5b8151613a7881615a21565b600080600080600060a08688031215615d9d57600080fd5b8551615da881615a21565b809550506020860151935060408601519250606086015191506080860151615dcf81615a21565b809150509295509295909350565b60008251615def8184602087016159a4565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea264697066735822122038e9d547b8bf1e6ca51e89814e082afcb7ae40f73c81d1e9c4edf57051225e3364736f6c634300080e0033000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd9239
Deployed Bytecode
0x6080604052600436106104695760003560e01c806377c7b8fc11610243578063b5589fad11610143578063e14224f3116100bb578063f10684541161008a578063fac6182f1161006f578063fac6182f14610c83578063fd92bff214610c98578063fdcb606814610cb857600080fd5b8063f106845414610c4d578063f2fde38b14610c6357600080fd5b8063e14224f314610bd7578063e1a4e72a14610bed578063ec3e9da514610c0d578063f0f4426014610c2d57600080fd5b8063cecdb96111610112578063dadb6c1d116100f7578063dadb6c1d14610b66578063dc692cd714610b7b578063dd62ed3e14610b9157600080fd5b8063cecdb96114610b30578063cef062fc14610b4657600080fd5b8063b5589fad14610ac8578063b69ef8a814610ae8578063b6b55f2514610afd578063c869d0ed14610b1057600080fd5b80638da5cb5b116101d65780639d46c009116101a5578063a10954fe1161018a578063a10954fe14610a73578063a457c2d714610a88578063a9059cbb14610aa857600080fd5b80639d46c00914610a3e5780639e3b77af14610a5357600080fd5b80638da5cb5b146109dc5780638e400570146109fa57806395d89b4114610a0f57806396f25d4214610a2457600080fd5b80638456cb59116102125780638456cb591461096f5780638542783f14610984578063864a897f14610999578063882c127e146109af57600080fd5b806377c7b8fc146109055780637ab7cbb11461091a5780637f2932281461092f57806383165e591461094f57600080fd5b806348a0d75411610369578063672f1490116102e15780636e553f65116102b0578063715018a611610295578063715018a6146108b0578063745400c9146108c5578063776b6539146108e557600080fd5b80636e553f651461086757806370a082311461087a57600080fd5b8063672f1490146107fc5780636a7855fd1461081c5780636aa9eda2146108325780636d67d5d41461084757600080fd5b8063575a86b21161033857806360773a2c1161031d57806360773a2c1461078a57806361d027b3146107aa57806362263991146107cf57600080fd5b8063575a86b21461073a5780635c975abb1461075a57600080fd5b806348a0d754146106db57806348cdc141146106f05780634bb2dcea146107105780634d9b48941461072557600080fd5b806323b872dd116103fc57806339509351116103cb5780633f4ba83a116103b05780633f4ba83a146106725780633fc8cef3146106875780634069ab68146106bb57600080fd5b806339509351146106325780633bfb5c141461065257600080fd5b806323b872dd146105c15780632ea9239e146105e1578063313ce5671461060157806336ea43441461061d57600080fd5b806317e3e2e81161043857806317e3e2e81461052057806318160ddd14610540578063184b9559146105555780631f1fcd511461057557600080fd5b806306fdde0314610475578063095ea7b3146104a05780630c0fb800146104d05780630eb0c8f3146104f257600080fd5b3661047057005b600080fd5b34801561048157600080fd5b5061048a610cec565b60405161049791906159d0565b60405180910390f35b3480156104ac57600080fd5b506104c06104bb366004615a36565b610d7e565b6040519015158152602001610497565b3480156104dc57600080fd5b506104f06104eb366004615a62565b610d98565b005b3480156104fe57600080fd5b5061051261050d366004615a7b565b611420565b604051908152602001610497565b34801561052c57600080fd5b506104f061053b366004615a7b565b6114d3565b34801561054c57600080fd5b50600254610512565b34801561056157600080fd5b506104f0610570366004615a98565b611555565b34801561058157600080fd5b506105a97f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3881565b6040516001600160a01b039091168152602001610497565b3480156105cd57600080fd5b506104c06105dc366004615ae3565b6117fe565b3480156105ed57600080fd5b506104f06105fc366004615b24565b611822565b34801561060d57600080fd5b5060405160128152602001610497565b34801561062957600080fd5b506104f0611b1b565b34801561063e57600080fd5b506104c061064d366004615a36565b611b55565b34801561065e57600080fd5b506104f061066d366004615a62565b611b94565b34801561067e57600080fd5b506104f0611bda565b34801561069357600080fd5b506105a97f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3881565b3480156106c757600080fd5b506104f06106d6366004615a7b565b611cf4565b3480156106e757600080fd5b5061051261220c565b3480156106fc57600080fd5b506104f061070b366004615a7b565b6122b5565b34801561071c57600080fd5b50610512612411565b34801561073157600080fd5b50610512612451565b34801561074657600080fd5b506015546105a9906001600160a01b031681565b34801561076657600080fd5b5060055474010000000000000000000000000000000000000000900460ff166104c0565b34801561079657600080fd5b506105126107a5366004615a7b565b6124b4565b3480156107b657600080fd5b506012546105a99061010090046001600160a01b031681565b3480156107db57600080fd5b506105126107ea366004615a7b565b600b6020526000908152604090205481565b34801561080857600080fd5b506104f0610817366004615a36565b6124d6565b34801561082857600080fd5b5061051260115481565b34801561083e57600080fd5b50610512612653565b34801561085357600080fd5b506104f0610862366004615a62565b6126cf565b6104f0610875366004615b24565b6126dc565b34801561088657600080fd5b50610512610895366004615a7b565b6001600160a01b031660009081526020819052604090205490565b3480156108bc57600080fd5b506104f0612700565b3480156108d157600080fd5b506104f06108e0366004615a62565b612712565b3480156108f157600080fd5b506104f0610900366004615b62565b61273b565b34801561091157600080fd5b50610512612774565b34801561092657600080fd5b506104f06127b8565b34801561093b57600080fd5b506104f061094a366004615a62565b6127e3565b34801561095b57600080fd5b506008546105a9906001600160a01b031681565b34801561097b57600080fd5b506104f06127f0565b34801561099057600080fd5b5061051261290a565b3480156109a557600080fd5b5061051260105481565b3480156109bb57600080fd5b506105126109ca366004615a7b565b600c6020526000908152604090205481565b3480156109e857600080fd5b506005546001600160a01b03166105a9565b348015610a0657600080fd5b506104f0612916565b348015610a1b57600080fd5b5061048a612b6d565b348015610a3057600080fd5b506012546104c09060ff1681565b348015610a4a57600080fd5b506104f0612b7c565b348015610a5f57600080fd5b506009546105a9906001600160a01b031681565b348015610a7f57600080fd5b50610512612b95565b348015610a9457600080fd5b506104c0610aa3366004615a36565b612c9d565b348015610ab457600080fd5b506104c0610ac3366004615a36565b612d47565b348015610ad457600080fd5b506104f0610ae3366004615a62565b612d55565b348015610af457600080fd5b50610512613014565b6104f0610b0b366004615a62565b613042565b348015610b1c57600080fd5b506104f0610b2b366004615a7b565b61305c565b348015610b3c57600080fd5b5061051260135481565b348015610b5257600080fd5b506007546105a9906001600160a01b031681565b348015610b7257600080fd5b506105126130d6565b348015610b8757600080fd5b5061051260145481565b348015610b9d57600080fd5b50610512610bac366004615b7f565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b348015610be357600080fd5b50610512600d5481565b348015610bf957600080fd5b506104f0610c08366004615a7b565b6130e3565b348015610c1957600080fd5b50600a546105a9906001600160a01b031681565b348015610c3957600080fd5b506104f0610c48366004615a7b565b6131b6565b348015610c5957600080fd5b5061051260165481565b348015610c6f57600080fd5b506104f0610c7e366004615a7b565b6131fd565b348015610c8f57600080fd5b506104f061328a565b348015610ca457600080fd5b506104f0610cb3366004615a62565b613890565b348015610cc457600080fd5b506105a97f000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd923981565b606060038054610cfb90615bad565b80601f0160208091040260200160405190810160405280929190818152602001828054610d2790615bad565b8015610d745780601f10610d4957610100808354040283529160200191610d74565b820191906000526020600020905b815481529060010190602001808311610d5757829003601f168201915b5050505050905090565b600033610d8c8185856138ac565b60019150505b92915050565b33610dab6005546001600160a01b031690565b6001600160a01b03161480610e5e57506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd92396001600160a01b03169063af5b052b906024016020604051808303816000875af1158015610e3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5e9190615c00565b610eaf5760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e0000000060448201526064015b60405180910390fd5b60125460ff16610f015760405162461bcd60e51b815260206004820152600960248201527f21534554544c494e4700000000000000000000000000000000000000000000006044820152606401610ea6565b6000610f0b612774565b9050600080610f1a600e613a04565b841115610f695760405162461bcd60e51b815260206004820152600d60248201527f2162617463685f6c656e677468000000000000000000000000000000000000006044820152606401610ea6565b60005b848110156110aa576000610f81600e82613a0e565b6001600160a01b0381166000908152600c602052604081205491925090670de0b6b3a764000090610fb3908890615c4c565b610fbd9190615c89565b9050610fc98186615cc4565b6001600160a01b0383166000908152600c6020526040902054909550610fef9085615cc4565b600a546040517f9b927a910000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015260248201859052929650911690639b927a9190604401600060405180830381600087803b15801561105857600080fd5b505af115801561106c573d6000803e3d6000fd5b5050506001600160a01b0383166000908152600c602052604081205550611094600e83613a21565b50505080806110a290615cdc565b915050610f6c565b50600061112d83600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611104573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111289190615d14565b613a36565b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561118d57600080fd5b505af11580156111a1573d6000803e3d6000fd5b505050507f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b03167f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b031603611273577f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561125957600080fd5b505af115801561126d573d6000803e3d6000fd5b50505050505b8261127c61220c565b10156112ca5760405162461bcd60e51b815260206004820152601e60248201527f21617661696c61626c655f616d6f756e745f666f725f776974686472617700006044820152606401610ea6565b6112d43083613a82565b81600d60008282546112e69190615d2d565b9091555050600a54611323907f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38906001600160a01b031685613beb565b61132d600e613a04565b6000036114195760006011819055600954604080517fa373ed4e00000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169263a373ed4e9260048084019382900301818387803b15801561139457600080fd5b505af11580156113a8573d6000803e3d6000fd5b5050505060006113b6613014565b90506113c3600a82615c89565b601055337f805ee433ea4242be6315bc317b1bf10e767ad8beb03ee547773b3ee1f842c206826113f1612451565b6113f9612b95565b6040805193845260208401929092529082015260600160405180910390a2505b5050505050565b6015546000906001600160a01b031661143b57506000919050565b6015546016546040517f93f1a40b00000000000000000000000000000000000000000000000000000000815260048101919091526001600160a01b038481166024830152909116906393f1a40b906044016040805180830381865afa1580156114a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114cc9190615d44565b5092915050565b6114db613d2d565b600a80546001600160a01b038381167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080519190921680825260208201939093527f68b42fcf63f2d28ae477b4539c3101ade5142acdcc91191a106d867f3554f28a91015b60405180910390a15050565b61155d613d2d565b6001600160a01b0383166115d85760405162461bcd60e51b8152602060048201526024808201527f576f6f5375706572436861726765725661756c743a20215f726573657276655660448201527f61756c74000000000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b0382166116545760405162461bcd60e51b815260206004820152602660248201527f576f6f5375706572436861726765725661756c743a20215f6c656e64696e674d60448201527f616e6167657200000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b0381166116d05760405162461bcd60e51b815260206004820152602760248201527f576f6f5375706572436861726765725661756c743a20215f776974686472617760448201527f4d616e61676572000000000000000000000000000000000000000000000000006064820152608401610ea6565b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03858116918217909255604080517f1f1fcd5100000000000000000000000000000000000000000000000000000000815290517f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3890931692631f1fcd51916004808201926020929091908290030181865afa158015611780573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a49190615d68565b6001600160a01b0316146117b757600080fd5b600980546001600160a01b039384167fffffffffffffffffffffffff000000000000000000000000000000000000000091821617909155600a805492909316911617905550565b60003361180c858285613d87565b611817858585613e37565b506001949350505050565b6009546001600160a01b031633146118a25760405162461bcd60e51b815260206004820152602560248201527f576f6f5375706572436861726765725661756c743a20216c656e64696e674d6160448201527f6e616765720000000000000000000000000000000000000000000000000000006064820152608401610ea6565b60125460ff16156118f55760405162461bcd60e51b815260206004820152600b60248201527f494e20534554544c494e470000000000000000000000000000000000000000006044820152606401610ea6565b6118fd612411565b82111561194c5760405162461bcd60e51b815260206004820152601860248201527f494e535546465f414d4f554e545f464f525f424f52524f5700000000000000006044820152606401610ea6565b60006119a583600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611104573d6000803e3d6000fd5b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015611a0557600080fd5b505af1158015611a19573d6000803e3d6000fd5b505050507f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b03167f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b031603611aeb577f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b158015611ad157600080fd5b505af1158015611ae5573d6000803e3d6000fd5b50505050505b611b167f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad388385613beb565b505050565b611b23614024565b611b2b61408f565b33600090815260208190526040902054611b49906140e8565b6140e8565b611b536001600655565b565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190610d8c9082908690611b8f908790615cc4565b6138ac565b611b9c613d2d565b601380549082905560408051828152602081018490527f2f0bfd95e6bf57fab22ace02a57c77bdabde00f81ccf61034ae4a915d3a47f4d9101611549565b33611bed6005546001600160a01b031690565b6001600160a01b03161480611ca057506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd92396001600160a01b03169063af5b052b906024016020604051808303816000875af1158015611c7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca09190615c00565b611cec5760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e000000006044820152606401610ea6565b611b5361435c565b611cfc613d2d565b6001600160a01b038116611d525760405162461bcd60e51b815260206004820152600760248201527f215f7661756c74000000000000000000000000000000000000000000000000006044820152606401610ea6565b60007f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b03167f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b031614611dba57611db561220c565b611dbc565b475b6007546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529192506001600160a01b031690632e1a7d4d9082906370a0823190602401602060405180830381865afa158015611e26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e4a9190615d14565b6040518263ffffffff1660e01b8152600401611e6891815260200190565b600060405180830381600087803b158015611e8257600080fd5b505af1158015611e96573d6000803e3d6000fd5b5050505060007f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b03167f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b031614611f0257611efd61220c565b611f04565b475b90506000611f128383615d2d565b600780546001600160a01b038781167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080517f1f1fcd510000000000000000000000000000000000000000000000000000000081529051949550918116937f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad389091169291631f1fcd519160048083019260209291908290030181865afa158015611fc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fed9190615d68565b6001600160a01b0316146120435760405162461bcd60e51b815260206004820152600c60248201527f494e56414c49445f57414e5400000000000000000000000000000000000000006044820152606401610ea6565b7f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b03167f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b03160361211a576007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b039091169063b6b55f259084906024016000604051808303818588803b1580156120fc57600080fd5b505af1158015612110573d6000803e3d6000fd5b50505050506121ca565b600754612152907f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38906001600160a01b0316846143cc565b6007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b039091169063b6b55f2590602401600060405180830381600087803b1580156121b157600080fd5b505af11580156121c5573d6000803e3d6000fd5b505050505b6040516001600160a01b03808716919083169033907f548fe255eb14d86b43af1c165d3a356a85be79136670fa5ff20aa3e0284afde790600090a45050505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b0316906370a0823190602401602060405180830381865afa15801561228c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b09190615d14565b905090565b6122bd613d2d565b600880547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03838116918217909255604080517f1f1fcd51000000000000000000000000000000000000000000000000000000008152905184937f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38169291631f1fcd519160048083019260209291908290030181865afa15801561236d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123919190615d68565b6001600160a01b03161461240d5760405162461bcd60e51b815260206004820152602160248201527f576f6f5375706572436861726765725661756c743a202157414e545f7661756c60448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610ea6565b5050565b60008061241c612b95565b905060006011546010546124309190615d2d565b905080821161244057600061244a565b61244a8183615d2d565b9250505090565b600954604080517fd83e6b3800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163d83e6b389160048083019260209291908290030181865afa15801561228c573d6000803e3d6000fd5b6001600160a01b0381166000908152600c6020526040812054610d929061450e565b6124de613d2d565b6001600160a01b0382166125345760405162461bcd60e51b815260206004820152600c60248201527f215f6d61737465724368656600000000000000000000000000000000000000006044820152606401610ea6565b601580547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03841690811790915560168290556040517f1526fe270000000000000000000000000000000000000000000000000000000081526004810183905260009190631526fe279060240160a060405180830381865afa1580156125c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125ea9190615d85565b505050509050306001600160a01b0316816001600160a01b031614611b165760405162461bcd60e51b8152600401610ea69060208082526004908201527f2170696400000000000000000000000000000000000000000000000000000000604082015260600190565b60008061265e612b95565b9050600061266a6130d6565b9050600081612677613014565b6126819190615d2d565b905061268e600a82615c89565b6126989083615cc4565b8310156126c457826126ab600a83615c89565b6126b59084615cc4565b6126bf9190615d2d565b6126c7565b60005b935050505090565b6126d7613d2d565b601455565b6126e4614024565b6126ec61408f565b6126f6828261451c565b61240d6001600655565b612708613d2d565b611b536000614926565b61271a614024565b61272261408f565b61272e611b4482614990565b6127386001600655565b50565b612743613d2d565b601280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b600061277f60025490565b156127ab5760025461278f613014565b6127a190670de0b6b3a7640000615c4c565b6122b09190615c89565b50670de0b6b3a764000090565b6127c0614024565b6127c861408f565b33600090815260208190526040902054611b49905b33614a12565b6127eb613d2d565b601055565b336128036005546001600160a01b031690565b6001600160a01b031614806128b657506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd92396001600160a01b03169063af5b052b906024016020604051808303816000875af1158015612892573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b69190615c00565b6129025760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e000000006044820152606401610ea6565b611b53614ee4565b60006122b0600e613a04565b336129296005546001600160a01b031690565b6001600160a01b031614806129dc57506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd92396001600160a01b03169063af5b052b906024016020604051808303816000875af11580156129b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129dc9190615c00565b612a285760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e000000006044820152606401610ea6565b60125460ff1615612a7b5760405162461bcd60e51b815260206004820152600b60248201527f494e5f534554544c494e470000000000000000000000000000000000000000006044820152606401610ea6565b601280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055600954604080517fa373ed4e00000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169163a373ed4e9160048082019260009290919082900301818387803b158015612b0557600080fd5b505af1158015612b19573d6000803e3d6000fd5b50505050336001600160a01b03167ffce7d682dc90b7cc945fb8cfff947668bcf6d304aa58823b24d2c06dec38df6e600d54612b53612653565b6040805192835260208301919091520160405180910390a2565b606060048054610cfb90615bad565b612b84614024565b612b8c61408f565b611b4933614f53565b6007546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000916122b0916001600160a01b03909116906370a0823190602401602060405180830381865afa158015612bfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c219190615d14565b600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c989190615d14565b6154bf565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919083811015612d3a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610ea6565b61181782868684036138ac565b600033610d8c818585613e37565b6009546001600160a01b03163314612dd55760405162461bcd60e51b815260206004820152602560248201527f576f6f5375706572436861726765725661756c743a20216c656e64696e674d6160448201527f6e616765720000000000000000000000000000000000000000000000000000006064820152608401610ea6565b612e017f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad383330846154de565b7f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b03167f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b031603612f69576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015612ed557600080fd5b505af1158015612ee9573d6000803e3d6000fd5b50506007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b03909116925063b6b55f25915083906024016000604051808303818588803b158015612f4d57600080fd5b505af1158015612f61573d6000803e3d6000fd5b505050505050565b600754612fa1907f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38906001600160a01b0316836143cc565b6007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b039091169063b6b55f2590602401600060405180830381600087803b15801561300057600080fd5b505af1158015611419573d6000803e3d6000fd5b600061301e612451565b613026612b95565b61302e61220c565b6130389190615cc4565b6122b09190615cc4565b61304a614024565b61305261408f565b61272e813361451c565b613064613d2d565b600980546001600160a01b038381167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080519190921680825260208201939093527f9ed29eb74f1356c602e59670cf82bfe8b0f564216ce091e163fbf7f0376aa1979101611549565b60006122b0600d5461450e565b6130eb613d2d565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601613125576127383347615628565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015613185573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131a99190615d14565b905061240d823383613beb565b6131be613d2d565b601280546001600160a01b03909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b613205613d2d565b6001600160a01b0381166132815760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610ea6565b61273881614926565b3361329d6005546001600160a01b031690565b6001600160a01b0316148061335057506040517faf5b052b0000000000000000000000000000000000000000000000000000000081523360048201527f000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd92396001600160a01b03169063af5b052b906024016020604051808303816000875af115801561332c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133509190615c00565b61339c5760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a202141444d494e000000006044820152606401610ea6565b60125460ff166133ee5760405162461bcd60e51b815260206004820152600960248201527f21534554544c494e4700000000000000000000000000000000000000000000006044820152606401610ea6565b6133f6612653565b156134435760405162461bcd60e51b815260206004820152601860248201527f5745454b4c595f52455041595f4e4f545f434c454152454400000000000000006044820152606401610ea6565b600061344d612774565b601280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055905060006134816130d6565b905080156137a75760006134e282600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611104573d6000803e3d6000fd5b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561354257600080fd5b505af1158015613556573d6000803e3d6000fd5b505050507f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b03167f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b031603613628577f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561360e57600080fd5b505af1158015613622573d6000803e3d6000fd5b50505050505b8161363161220c565b101561363c57600080fd5b6000613648600e613a04565b905060005b8181101561375a576000613662600e82613a0e565b600a546001600160a01b038083166000908152600c60205260409020549293501690639b927a91908390670de0b6b3a7640000906136a1908b90615c4c565b6136ab9190615c89565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561370957600080fd5b505af115801561371d573d6000803e3d6000fd5b5050506001600160a01b0382166000908152600c602052604081205550613745600e82613a21565b5050808061375290615cdc565b91505061364d565b5061376730600d54613a82565b6000600d55600a546137a4907f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38906001600160a01b031685613beb565b50505b60006011819055600954604080517fa373ed4e00000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169263a373ed4e9260048084019382900301818387803b15801561380757600080fd5b505af115801561381b573d6000803e3d6000fd5b505050506000613829613014565b9050613836600a82615c89565b601055337f805ee433ea4242be6315bc317b1bf10e767ad8beb03ee547773b3ee1f842c20682613864612451565b61386c612b95565b604080519384526020840192909252908201526060015b60405180910390a2505050565b613898614024565b6138a061408f565b61272e6127dd82614990565b6001600160a01b0383166139275760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b0382166139a35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610d92825490565b6000613a1a83836156e5565b9392505050565b6000613a1a836001600160a01b03841661570f565b60008082613a4c85670de0b6b3a7640000615c4c565b613a569190615c89565b905083613a6382856154bf565b14613a7857613a73816001615cc4565b613a7a565b805b949350505050565b6001600160a01b038216613afe5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b03821660009081526020819052604090205481811015613b8d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790529151600092839290871691613c759190615ddd565b6000604051808303816000865af19150503d8060008114613cb2576040519150601f19603f3d011682016040523d82523d6000602084013e613cb7565b606091505b5091509150818015613ce1575080511580613ce1575080806020019051810190613ce19190615c00565b6114195760405162461bcd60e51b815260206004820152600260248201527f53540000000000000000000000000000000000000000000000000000000000006044820152606401610ea6565b6005546001600160a01b03163314611b535760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ea6565b6001600160a01b038381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114613e315781811015613e245760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610ea6565b613e3184848484036138ac565b50505050565b6001600160a01b038316613eb35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b038216613f2f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b03831660009081526020819052604090205481811015613fbe5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3613e31565b60055474010000000000000000000000000000000000000000900460ff1615611b535760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610ea6565b6002600654036140e15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610ea6565b6002600655565b600081116141385760405162461bcd60e51b815260206004820152601d60248201527f576f6f5375706572436861726765725661756c743a2021616d6f756e740000006044820152606401610ea6565b60125460ff16156141b15760405162461bcd60e51b815260206004820152603160248201527f576f6f5375706572436861726765725661756c743a2043414e4e4f545f57495460448201527f48445241575f494e5f534554544c494e470000000000000000000000000000006064820152608401610ea6565b6014546141be600e613a04565b11156142325760405162461bcd60e51b815260206004820152602860248201527f576f6f5375706572436861726765725661756c743a204d41585f57495448445260448201527f41575f434f554e540000000000000000000000000000000000000000000000006064820152608401610ea6565b600954604080517fa373ed4e000000000000000000000000000000000000000000000000000000008152905133926001600160a01b03169163a373ed4e91600480830192600092919082900301818387803b15801561429057600080fd5b505af11580156142a4573d6000803e3d6000fd5b5050505060006142b38361450e565b90506142c1308330866154de565b6001600160a01b0382166000908152600c60205260409020546142e5908490615cc4565b6001600160a01b0383166000908152600c6020526040902055600d5461430c908490615cc4565b600d5561431a600e83615802565b5060408051828152602081018590526001600160a01b038416917febeaa8785285a4f7c37a305351997dceebabc3c357dab98023dc37514a1b6ed69101613883565b614364615817565b600580547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905291516000928392908716916144569190615ddd565b6000604051808303816000865af19150503d8060008114614493576040519150601f19603f3d011682016040523d82523d6000602084013e614498565b606091505b50915091508180156144c25750805115806144c25750808060200190518101906144c29190615c00565b6114195760405162461bcd60e51b815260206004820152600260248201527f53410000000000000000000000000000000000000000000000000000000000006044820152606401610ea6565b6000610d9282612c98612774565b81600003614528575050565b600960009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561457857600080fd5b505af115801561458c573d6000803e3d6000fd5b5050505060006145a38361459e612774565b615881565b9050600081116145f55760405162461bcd60e51b815260206004820152600760248201527f21736861726573000000000000000000000000000000000000000000000000006044820152606401610ea6565b600061460083611420565b6001600160a01b0384166000908152602081905260409020546146239190615cc4565b6001600160a01b0384166000908152600b60205260408120549192506146498484615cc4565b61465b87670de0b6b3a7640000615c4c565b6146658486615c4c565b61466f9190615cc4565b6146799190615c89565b6001600160a01b038087166000908152600b602052604090208290559091507f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3881167f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38909116036147d7573486146147595760405162461bcd60e51b815260206004820152602c60248201527f576f6f5375706572436861726765725661756c743a206d73672e76616c75655f60448201527f494e53554646494349454e5400000000000000000000000000000000000000006064820152608401610ea6565b6007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018890526001600160a01b039091169063b6b55f259034906024016000604051808303818588803b1580156147b957600080fd5b505af11580156147cd573d6000803e3d6000fd5b50505050506148b3565b6148037f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad383330896154de565b60075461483b907f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38906001600160a01b0316886143cc565b6007546040517fb6b55f25000000000000000000000000000000000000000000000000000000008152600481018890526001600160a01b039091169063b6b55f2590602401600060405180830381600087803b15801561489a57600080fd5b505af11580156148ae573d6000803e3d6000fd5b505050505b6148bd8585615896565b6148c8600a87615c89565b6010546148d59190615cc4565b60105560408051878152602081018690526001600160a01b0387169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a3505050505050565b600580546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600954604080517fa373ed4e00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163a373ed4e916004808301928692919082900301818387803b1580156149ee57600080fd5b505af1158015614a02573d6000803e3d6000fd5b50505050610d9282611128612774565b60008211614a625760405162461bcd60e51b815260206004820152601d60248201527f576f6f5375706572436861726765725661756c743a2021616d6f756e740000006044820152606401610ea6565b60125460ff1615614adb5760405162461bcd60e51b815260206004820152602d60248201527f576f6f5375706572436861726765725661756c743a204e4f545f414c4c4f574560448201527f445f494e5f534554544c494e47000000000000000000000000000000000000006064820152608401610ea6565b60105460115410614aea575050565b600960009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015614b3a57600080fd5b505af1158015614b4e573d6000803e3d6000fd5b505050506000614b5d8361450e565b9050601154601054614b6f9190615d2d565b811115614bbe5760405162461bcd60e51b815260206004820181905260248201527f576f6f5375706572436861726765725661756c743a204f55545f4f465f4341506044820152606401610ea6565b336001600160a01b03831614614bd957614bd9823385613d87565b614be38284613a82565b6000614c3c82600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611104573d6000803e3d6000fd5b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015614c9c57600080fd5b505af1158015614cb0573d6000803e3d6000fd5b50506040517f871e6ca6000000000000000000000000000000000000000000000000000000008152336004820152600092507f000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd92396001600160a01b0316915063871e6ca6906024016020604051808303816000875af1158015614d36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614d5a9190615c00565b614d7e5761271060135484614d6f9190615c4c565b614d799190615c89565b614d81565b60005b90507f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b03167f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b031603614e0f57601254614df79061010090046001600160a01b031682615628565b614e0a84614e058386615d2d565b615628565b614e80565b601254614e4c907f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad389061010090046001600160a01b031683613beb565b614e807f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3885614e7b8487615d2d565b613beb565b82601154614e8e9190615cc4565b60115560408051848152602081018490529081018290526001600160a01b038516907f672004d35ad2124f90299371ade95cf5594500e40705a7cf6eaf7c00b55a07ac9060600160405180910390a25050505050565b614eec614024565b600580547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586143af3390565b6001600160a01b038116614fa95760405162461bcd60e51b815260206004820152601c60248201527f576f6f5375706572436861726765725661756c743a20216f776e6572000000006044820152606401610ea6565b6008546001600160a01b03166150275760405162461bcd60e51b815260206004820152602560248201527f576f6f5375706572436861726765725661756c743a20216d6967726174696f6e60448201527f5661756c740000000000000000000000000000000000000000000000000000006064820152608401610ea6565b600854604080517f1f1fcd5100000000000000000000000000000000000000000000000000000000815290516001600160a01b03928316927f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3816918391631f1fcd51916004808201926020929091908290030181865afa1580156150af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906150d39190615d68565b6001600160a01b03161461514e5760405162461bcd60e51b8152602060048201526024808201527f576f6f5375706572436861726765725661756c743a202157414e545f6e65775660448201527f61756c74000000000000000000000000000000000000000000000000000000006064820152608401610ea6565b6001600160a01b0382166000908152602081905260408120549081900361517457505050565b600960009054906101000a90046001600160a01b03166001600160a01b031663a373ed4e6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156151c457600080fd5b505af11580156151d8573d6000803e3d6000fd5b5050505060006151e78261450e565b9050336001600160a01b0385161461520457615204843384613d87565b61520e8483613a82565b600061526782600760009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611104573d6000803e3d6000fd5b6007546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156152c757600080fd5b505af11580156152db573d6000803e3d6000fd5b505050507f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b03167f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b0316036153ba576040517f6e553f65000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b038681166024830152851690636e553f659084906044016000604051808303818588803b15801561539c57600080fd5b505af11580156153b0573d6000803e3d6000fd5b5050505050615461565b6153e57f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3885846143cc565b6040517f6e553f65000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b038681166024830152851690636e553f6590604401600060405180830381600087803b15801561544857600080fd5b505af115801561545c573d6000803e3d6000fd5b505050505b836001600160a01b0316306001600160a01b0316866001600160a01b03167f2f003beff7d020bbaf25c7b278041e72cadccf9e4eaad1805835be384f19df5f856040516154b091815260200190565b60405180910390a45050505050565b6000670de0b6b3a76400006154d48385615c4c565b613a1a9190615c89565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905291516000928392908816916155709190615ddd565b6000604051808303816000865af19150503d80600081146155ad576040519150601f19603f3d011682016040523d82523d6000602084013e6155b2565b606091505b50915091508180156155dc5750805115806155dc5750808060200190518101906155dc9190615c00565b612f615760405162461bcd60e51b815260206004820152600360248201527f53544600000000000000000000000000000000000000000000000000000000006044820152606401610ea6565b604080516000808252602082019092526001600160a01b0384169083906040516156529190615ddd565b60006040518083038185875af1925050503d806000811461568f576040519150601f19603f3d011682016040523d82523d6000602084013e615694565b606091505b5050905080611b165760405162461bcd60e51b815260206004820152600360248201527f53544500000000000000000000000000000000000000000000000000000000006044820152606401610ea6565b60008260000182815481106156fc576156fc615df9565b9060005260206000200154905092915050565b600081815260018301602052604081205480156157f8576000615733600183615d2d565b855490915060009061574790600190615d2d565b90508181146157ac57600086600001828154811061576757615767615df9565b906000526020600020015490508087600001848154811061578a5761578a615df9565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806157bd576157bd615e28565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610d92565b6000915050610d92565b6000613a1a836001600160a01b038416615955565b60055474010000000000000000000000000000000000000000900460ff16611b535760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610ea6565b6000816154d484670de0b6b3a7640000615c4c565b6001600160a01b0382166158ec5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610ea6565b80600260008282546158fe9190615cc4565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600081815260018301602052604081205461599c57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610d92565b506000610d92565b60005b838110156159bf5781810151838201526020016159a7565b83811115613e315750506000910152565b60208152600082518060208401526159ef8160408501602087016159a4565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6001600160a01b038116811461273857600080fd5b60008060408385031215615a4957600080fd5b8235615a5481615a21565b946020939093013593505050565b600060208284031215615a7457600080fd5b5035919050565b600060208284031215615a8d57600080fd5b8135613a7881615a21565b600080600060608486031215615aad57600080fd5b8335615ab881615a21565b92506020840135615ac881615a21565b91506040840135615ad881615a21565b809150509250925092565b600080600060608486031215615af857600080fd5b8335615b0381615a21565b92506020840135615b1381615a21565b929592945050506040919091013590565b60008060408385031215615b3757600080fd5b823591506020830135615b4981615a21565b809150509250929050565b801515811461273857600080fd5b600060208284031215615b7457600080fd5b8135613a7881615b54565b60008060408385031215615b9257600080fd5b8235615b9d81615a21565b91506020830135615b4981615a21565b600181811c90821680615bc157607f821691505b602082108103615bfa577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215615c1257600080fd5b8151613a7881615b54565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615615c8457615c84615c1d565b500290565b600082615cbf577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60008219821115615cd757615cd7615c1d565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203615d0d57615d0d615c1d565b5060010190565b600060208284031215615d2657600080fd5b5051919050565b600082821015615d3f57615d3f615c1d565b500390565b60008060408385031215615d5757600080fd5b505080516020909101519092909150565b600060208284031215615d7a57600080fd5b8151613a7881615a21565b600080600080600060a08688031215615d9d57600080fd5b8551615da881615a21565b809550506020860151935060408601519250606086015191506080860151615dcf81615a21565b809150509295509295909350565b60008251615def8184602087016159a4565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea264697066735822122038e9d547b8bf1e6ca51e89814e082afcb7ae40f73c81d1e9c4edf57051225e3364736f6c634300080e0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd9239
-----Decoded View---------------
Arg [0] : _weth (address): 0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38
Arg [1] : _want (address): 0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38
Arg [2] : _accessManager (address): 0xAf558f888e138CA9416111Ec7aE8e28354Cd9239
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38
Arg [1] : 000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38
Arg [2] : 000000000000000000000000af558f888e138ca9416111ec7ae8e28354cd9239
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.