Mumbai Testnet

Contract

0x514E281477564Fff2C5cD92C66E39c64f1B73480

Overview

MATIC Balance

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Value
0x60806040274424362022-08-02 12:07:02691 days ago1659442022IN
 Create: MasterVault
0 MATIC0.1092812130.40272287

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

Contract Source Code Verified (Exact Match)

Contract Name:
MasterVault

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 100 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 28 : MasterVault.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "../ceros/interfaces/ICerosRouter.sol";
import "../ceros/interfaces/ISikkaProvider.sol";
import "../ceros/interfaces/ICertToken.sol";
import "../ceros/interfaces/IDao.sol";
import "../ceros/interfaces/IPriceGetter.sol";
import "./ERC4626Upgradeable.sol";
import "./interfaces/IWETH.sol";
import "./interfaces/IMasterVault.sol";
import "./interfaces/IWaitingPool.sol";
import "../Strategy/IBaseStrategy.sol";
import "../ceros/interfaces/ISwapPool.sol";

contract MasterVault is
IMasterVault,
ERC4626Upgradeable,
OwnableUpgradeable,
PausableUpgradeable,
ReentrancyGuardUpgradeable
{

    /**
     * Variables
     */
    uint256 public depositFee;
    uint256 public maxDepositFee;
    uint256 public withdrawalFee;
    uint256 public maxWithdrawalFee;

    // Tokens
    ICertToken private _certToken;
    
    address private _provider;
    address private _priceGetter;
    ICerosRouter private _ceRouter;
    IDao private _dao;

    mapping(address => bool) public manager;

    struct StrategyParams {
        bool active;
        uint256 allocation;
        uint256 debt;
    }

    mapping (address => StrategyParams) public strategyParams;
    address[] public strategies;
    address public cerosStrategy;
    address payable public feeReceiver;

    uint256 public MAX_STRATEGIES;
    uint256 public totalDebt;          // Amount of tokens that all strategies have borrowed
    IWaitingPool public waitingPool;
    ISwapPool public swapPool;
    uint256 public feeEarned;

    /**
     * Modifiers
     */
    modifier onlyProvider() {
        require(
            msg.sender == owner() || msg.sender == _provider,
            "Provider: not allowed"
        );
        _;
    }
    modifier onlyManager() {
        require(
            manager[msg.sender],
            "Manager: not allowed"
        );
        _;
    }

    function initialize(
        string memory name,
        string memory symbol,
        uint256 maxDepositFees,
        uint256 maxWithdrawalFees,
        IERC20MetadataUpgradeable asset,
        uint8 maxStrategies,
        address swapPoolAddr
    ) public initializer {
        __Ownable_init();
        __Pausable_init();
        __ReentrancyGuard_init();
        __ERC20_init(name, symbol);
        __ERC4626_init(asset);
        manager[msg.sender] = true;
        maxDepositFee = maxDepositFees;
        maxWithdrawalFee = maxWithdrawalFees;
        MAX_STRATEGIES = maxStrategies;
        feeReceiver = payable(msg.sender);
        swapPool = ISwapPool(swapPoolAddr);
    }

    function depositETH() public 
    payable
    override
    nonReentrant
    whenNotPaused 
    onlyProvider 
    returns (uint256 shares) {
        address src = msg.sender;
        uint256 amount = msg.value;
        require(amount > 0, "invalid amount");
        shares = _assessFee(amount, depositFee);
        uint256 waitingPoolDebt = waitingPool.totalDebt();
        uint256 waitingPoolBalance = address(waitingPool).balance;
        if(waitingPoolDebt > 0 && waitingPoolBalance < waitingPoolDebt) {
            uint256 poolAmount = (waitingPoolDebt < shares) ? waitingPoolDebt - waitingPoolBalance : shares;
            payable(address(waitingPool)).transfer(poolAmount);
            IWETH(asset()).deposit{value: amount - poolAmount}();
        } else {
            IWETH(asset()).deposit{value: amount}();
        }
        _mint(src, shares);

        emit Deposit(src, src, amount, shares);
    }

    function withdrawETH(address account, uint256 amount) 
    external
    override
    nonReentrant 
    whenNotPaused
    onlyProvider 
    returns (uint256 shares) {
        address src = msg.sender;
        shares = amount;
        _burn(src, shares);
        uint256 wethBalance = totalAssetInVault();
        if(wethBalance < amount) {
            shares = withdrawFromActiveStrategies(amount - wethBalance);
            if(shares == 0) {
                // submit to waiting pool
                waitingPool.addToQueue(account, amount);
                if(wethBalance > 0) {
                    IWETH(asset()).withdraw(wethBalance);
                    shares = _assessSwapFee(amount);
                    payable(address(waitingPool)).transfer(wethBalance);
                }
                emit Withdraw(src, src, src, amount, amount);
                return amount;
            }
            shares += _assessSwapFee(wethBalance);
        } else {
            shares = _assessSwapFee(amount);
        }
        shares = _assessFee(shares, withdrawalFee);
        IWETH(asset()).withdraw(shares);
        payable(account).transfer(shares);
        
        emit Withdraw(src, src, src, amount, shares);
    }

    function payDebt() public {
        waitingPool.tryRemove();
    }

    function withdrawFromActiveStrategies(uint256 amount) private returns(uint256 withdrawn) {
        for(uint8 i = 0; i < strategies.length; i++) {
           if(strategyParams[strategies[i]].active && 
              strategyParams[strategies[i]].debt >= amount) {
                return _withdrawFromStrategy(strategies[i], amount);
           }
        }
    }

    function _depositToStrategy(address strategy, uint256 amount) private {
        require(amount > 0, "invalid deposit amount");
        IWETH weth = IWETH(asset());
        require(totalAssetInVault() >= amount, "insufficient balance");
        totalDebt += amount;
        strategyParams[strategy].debt += amount;
        weth.transfer(strategy, amount);
    }

    function depositAllToStrategy(address strategy) public onlyManager {
        uint256 amount = totalAssetInVault();
        _depositToStrategy(strategy, amount);
        IBaseStrategy(strategy).deposit(amount);
        emit DepositedToStrategy(strategy, amount);
    }

    function depositToStrategy(address strategy, uint256 amount) public onlyManager {
        _depositToStrategy(strategy, amount);
        IBaseStrategy(strategy).deposit(amount);
        emit DepositedToStrategy(strategy, amount);
    }

    function withdrawFromStrategy(address strategy, uint256 amount) public onlyManager {
        _withdrawFromStrategy(strategy, amount);
    }

    function withdrawAllFromStrategy(address strategy) external onlyManager {
        _withdrawFromStrategy(strategy, strategyParams[strategy].debt - 10);
    }

    function _withdrawFromStrategy(address strategy, uint256 amount) private returns(uint256) {
        require(amount > 0, "invalid withdrawal amount");
        require(strategyParams[strategy].debt >= amount, "insufficient assets in strategy");
        uint256 value = IBaseStrategy(strategy).withdraw(amount);
        if(value > 0) {
            totalDebt -= amount;
            strategyParams[strategy].debt -= amount;
            emit WithdrawnFromStrategy(strategy, amount);
        }
        return value;
    }

    function setStrategy(
        address strategy,
        uint256 allocation   // 1% = 10000
        )
        external onlyOwner {
        require(strategy != address(0));
        require(strategies.length < MAX_STRATEGIES, "max strategies exceeded");
        StrategyParams memory params = StrategyParams({
            active: true,
            allocation: allocation,
            debt: 0
        });
        
        strategyParams[strategy] = params;
        strategies.push(strategy);
        approve(strategy, type(uint256).max);
        emit StrategyAdded(strategy, allocation);
    }

    function retireStrat(address strategy) external onlyManager {
        // require(strategyParams[strategy].active, "strategy is not active");
        _withdrawFromStrategy(strategy, strategyParams[strategy].debt - 10);
        if (strategyParams[strategy].debt <= 10) {
            strategyParams[strategy].active = false;
            strategyParams[strategy].debt = 0;
        }
    }

    function allocate() external onlyManager {
        // allocate to all active strategies based on respective allocation
        for(uint8 i = 0; i < strategies.length; i++) {
            if(strategyParams[strategies[i]].active) {
                StrategyParams memory strategy =  strategyParams[strategies[i]];
                uint256 allocation = strategy.allocation;
                if(allocation > 0) {
                    uint256 totalAssets = totalAssetInVault() + totalDebt;
                    uint256 strategyRatio = (strategy.debt / totalAssets) * 1e6;     // TODO check
                    if(strategyRatio < allocation) {
                        uint256 depositAmount = ((totalAssets * allocation) / 1e6) - strategy.debt;
                        if(totalAssetInVault() > depositAmount) {
                            _depositToStrategy(strategies[i], depositAmount);
                            IBaseStrategy(strategies[i]).depositAll();
                        }
                    } else {
                        _withdrawFromStrategy(strategies[i], strategy.debt - (totalAssets * allocation) / 1e6);
                    }
                }
            }
        }
    }

    function availableToWithdraw() public view returns(uint256 available) {
        for(uint8 i = 0; i < strategies.length; i++) {
            available += IWETH(asset()).balanceOf(strategies[i]);   // excluding the amount that is deposited to strategies
        }
        available += totalAssetInVault();
    }

    function totalAssetInVault() public view returns(uint256 balance) {
        return (totalAssets() > feeEarned) ? totalAssets() - feeEarned : 0;
    }

    function migrateStrategy(address oldStrategy, address newStrategy, uint256 newAllocation) external onlyManager {
        require(oldStrategy != address(0));
        require(newStrategy != address(0));
        
        uint256 oldStrategyDebt = strategyParams[oldStrategy].debt;
        
        if(oldStrategyDebt > 0) {
            _withdrawFromStrategy(oldStrategy, strategyParams[oldStrategy].debt - 10);
        }
        StrategyParams memory params = StrategyParams({
            active: true,
            allocation: newAllocation,
            debt: 0
        });

        for(uint256 i = 0; i < strategies.length; i++) {
            if(strategies[i] == oldStrategy) {
                strategies[i] = newStrategy;
                strategyParams[newStrategy] = params;
            } else {
                revert("invalid oldStrategy address");
            }
        }
        approve(oldStrategy, 0);
        approve(newStrategy, type(uint256).max);
        emit StrategyMigrated(oldStrategy, newStrategy, newAllocation);
    }

    function _assessFee(uint256 amount, uint256 fees) private returns(uint256 value) {
        if(fees > 0) {
            uint256 fee = (amount * fees) / 1e6;
            value = amount - fee;
            feeEarned += fee;
        } else {
            return amount;
        }
    }

    function _assessSwapFee(uint256 amount) private returns(uint256 value) {
        if(swapPool.unstakeFee() > 0 && amount > 0) {
            uint256 swapFee =  (amount * swapPool.unstakeFee()) / swapPool.FEE_MAX();
            feeEarned += swapFee;
            return (amount - swapFee);
        } else {
            return amount;
        }
    }

    receive() external payable {

    }

    function withdrawFee() external onlyOwner{
        if(feeEarned > 0) {
            IWETH(asset()).withdraw(feeEarned);
            feeEarned = 0;
            feeReceiver.transfer(feeEarned);
        }
    } 

    function setDepositFee(uint256 newDepositFee) external onlyOwner {
        require(maxDepositFee > newDepositFee,"more than maxDepositFee");
        depositFee = newDepositFee;    // 1% = 10000ppm
        emit DepositFeeChanged(newDepositFee);
    }

    function setMaxDepositFee(uint256 newMaxDepositFee) external onlyOwner {
        maxDepositFee = newMaxDepositFee;
        emit MaxDepositFeeChanged(newMaxDepositFee);
    }

    function setWithdrawalFee(uint256 newWithdrawalFee) external onlyOwner {
        require(maxWithdrawalFee > newWithdrawalFee,"more than maxWithdrawalFee");
        withdrawalFee = newWithdrawalFee;
        emit WithdrawalFeeChanged(newWithdrawalFee);
    }

    function setMaxWithdrawalFee(uint256 newMaxWithdrawalFee) external onlyOwner {
        maxWithdrawalFee = newMaxWithdrawalFee;
        emit MaxWithdrawalFeeChanged(newMaxWithdrawalFee);
    }

    function setWaitingPool(address _waitingPool) external onlyOwner {
        require(_waitingPool != address(0));
        waitingPool = IWaitingPool(_waitingPool);
        emit WaitingPoolChanged(_waitingPool);
    }

    function addManager(address newManager) external onlyOwner {
        require(newManager != address(0));
        manager[newManager] = true;
        emit ManagerAdded(newManager);
    }

    function removeManager(address _manager) external onlyOwner {
        require(manager[_manager]);
        manager[_manager] = false;
        emit ManagerRemoved(_manager);
    } 

    function changeProvider(address provider) external onlyOwner {
        require(provider != address(0));
        _provider = provider;
        emit ProviderChanged(provider);
    }

    function changeFeeReceiver(address payable _feeReceiver) external onlyOwner {
        require(_feeReceiver != address(0));
        feeReceiver = _feeReceiver;
        emit FeeReceiverChanged(_feeReceiver);
    }

    function changeSwapPool(address _swapPool) external onlyOwner {
        require(_swapPool != address(0));
        swapPool = ISwapPool(_swapPool);
        emit SwapPoolChanged(_swapPool);
    }

    function changeStrategyAllocation(address strategy, uint256 allocation) external onlyOwner {
        require(strategy != address(0));        
        strategyParams[strategy].allocation = allocation;
        emit StrategyAllocationChanged(strategy, allocation);
    }

    function setMaxStrategies(uint256 maxStrategies) external onlyOwner {
        MAX_STRATEGIES = maxStrategies;
    }
}

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

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

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

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

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

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 2 of 28 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ReentrancyGuardUpgradeable is Initializable {
    // 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;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

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

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @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.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _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());
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 2 of 28 : ICerosRouter.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

interface ICerosRouter {
    /**
     * Events
     */

    event Deposit(
        address indexed account,
        address indexed token,
        uint256 amount,
        uint256 profit
    );

    event Claim(
        address indexed recipient,
        address indexed token,
        uint256 amount
    );

    event Withdrawal(
        address indexed owner,
        address indexed recipient,
        address indexed token,
        uint256 amount
    );

    event ChangeVault(address vault);

    event ChangeDex(address dex);

    event ChangeDexFactory(address factory);

    event ChangeSwapPool(address pool);

    event ChangeDao(address dao);

    event ChangeCeToken(address ceToken);

    event ChangeCeTokenJoin(address ceTokenJoin);

    event ChangeCertToken(address certToken);

    event ChangeCollateralToken(address collateralToken);

    event ChangeProvider(address provider);

    event ChangePairFee(uint24 fee);

    /**
     * Methods
     */

    /**
     * Deposit
     */

    // in MATIC
    function deposit() external payable returns (uint256);

    function depositWMatic(uint256 amount) external returns (uint256);

    // // in aMATICc
    // function depositAMATICcFrom(address owner, uint256 amount)
    // external
    // returns (uint256);

    // function depositAMATICc(uint256 amount) external returns (uint256);

    /**
     * Claim
     */

    // claim in aMATICc
    function claim(address recipient) external returns (uint256);

    function claimProfit(address recipient) external;

    function getProfitFor(address account) external view returns (uint256);

    function getYieldFor(address account) external view returns(uint256);

    /**
     * Withdrawal
     */

    // MATIC
    // function withdraw(address recipient, uint256 amount)
    // external
    // returns (uint256);

    // MATIC
    // function withdrawFor(address recipient, uint256 amount)
    // external
    // returns (uint256);

    // MATIC
    function withdrawWithSlippage(
        address recipient,
        uint256 amount,
        uint256 slippage
    ) external returns (uint256);

    // // aMATICc
    // function withdrawAMATICc(address recipient, uint256 amount)
    // external
    // returns (uint256);
}

File 2 of 28 : ISikkaProvider.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

interface ISikkaProvider {
    /**
     * Events
     */

    event Deposit(address indexed account, uint256 amount);

    event Claim(address indexed recipient, uint256 amount);

    event Withdrawal(
        address indexed owner,
        address indexed recipient,
        uint256 amount
    );

    event ChangeDao(address dao);

    event ChangeCeToken(address ceToken);

    event ChangeCollateralToken(address collateralToken);

    event ChangeProxy(address auctionProxy);

    /**
     * Deposit
     */

    // in MATIC
    function provide() external payable returns (uint256);

    // in aMATICc
    // function provideInAMATICc(uint256 amount) external returns (uint256);

    /**
     * Claim
     */

    // claim in aMATICc
    // function claimInAMATICc(address recipient) external returns (uint256);

    /**
     * Withdrawal
     */

    // MATIC
    function release(address recipient, uint256 amount)
    external
    returns (uint256);

    // aMATICc
    // function releaseInAMATICc(address recipient, uint256 amount)
    // external
    // returns (uint256);

    /**
     * DAO FUNCTIONALITY
     */

    function liquidation(address recipient, uint256 amount) external;

    function daoBurn(address account, uint256 value) external;

    function daoMint(address account, uint256 value) external;
}

File 2 of 28 : ICertToken.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface ICertToken is IERC20 {

    function burn(address account, uint256 amount) external;

    function mint(address account, uint256 amount) external;

    function balanceWithRewardsOf(address account) external returns (uint256);

    function isRebasing() external returns (bool);

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

File 2 of 28 : IDao.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

import "../../interfaces/GemJoinLike.sol";

    struct CollateralType {
    GemJoinLike gem;
    bytes32 ilk;
    uint32 live; //0 - inactive, 1 - started, 2 - stopped
    address clip;
}

interface IDao {

    event Deposit(address indexed user, uint256 amount);
    event Borrow(address indexed user, address collateral, uint256 amount, uint256 liquidationPrice);
    event Payback(address indexed user, address collateral, uint256 amount, uint256 debt, uint256 liquidationPrice);
    event Withdraw(address indexed user, uint256 amount);
    event CollateralEnabled(address token, bytes32 ilk);
    event CollateralDisabled(address token, bytes32 ilk);
    event AuctionStarted(address indexed token, address user, uint256 amount, uint256 price);
    event AuctionFinished(address indexed token, address keeper,  uint256 amount);

    function deposit(
        address participant,
        address token,
        uint256 dink
    ) external returns (uint256);

    function withdraw(
        address participant,
        address token,
        uint256 dink
    ) external returns (uint256);

    function dropRewards(address token, address usr) external;
}

File 2 of 28 : IPriceGetter.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IPriceGetter {
    function getPrice(
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        uint160 sqrtPriceLimitX96,
        uint24 fee
    ) external view returns (uint256 amountOut);
}

File 2 of 28 : ERC4626Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
import "./interfaces/IERC4626Upgradeable.sol";

/**
 * @dev Implementation of the ERC4626 "Tokenized Vault Standard" as defined in
 * https://eips.ethereum.org/EIPS/eip-4626[EIP-4626].
 *
 * This extension allows the minting and burning of "shares" (represented using the ERC20 inheritance) in exchange for
 * underlying "assets" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends
 * the ERC20 standard. Any additional extensions included along it would affect the "shares" token represented by this
 * contract and not the "assets" token which is an independent contract.
 *
 * CAUTION: Deposits and withdrawals may incur unexpected slippage. Users should verify that the amount received of
 * shares or assets is as expected. EOAs should operate through a wrapper that performs these checks such as
 * https://github.com/fei-protocol/ERC4626#erc4626router-and-base[ERC4626Router].
 *
 * _Available since v4.7._
 */
abstract contract ERC4626Upgradeable is Initializable, ERC20Upgradeable, IERC4626Upgradeable {
    using MathUpgradeable for uint256;

    IERC20MetadataUpgradeable private _asset;

    /**
     * @dev Set the underlying asset contract. This must be an ERC20-compatible contract (ERC20 or ERC777).
     */
    function __ERC4626_init(IERC20MetadataUpgradeable asset_) internal onlyInitializing {
        __ERC4626_init_unchained(asset_);
    }

    function __ERC4626_init_unchained(IERC20MetadataUpgradeable asset_) internal onlyInitializing {
        _asset = asset_;
    }

    /** @dev See {IERC4262-asset} */
    function asset() public view virtual override returns (address) {
        return address(_asset);
    }

    /** @dev See {IERC4262-totalAssets} */
    function totalAssets() public view virtual override returns (uint256) {
        return _asset.balanceOf(address(this));
    }

    /** @dev See {IERC4262-convertToShares} */
    function convertToShares(uint256 assets) public view virtual override returns (uint256 shares) {
        return _convertToShares(assets, MathUpgradeable.Rounding.Down);
    }

    /** @dev See {IERC4262-convertToAssets} */
    function convertToAssets(uint256 shares) public view virtual override returns (uint256 assets) {
        return _convertToAssets(shares, MathUpgradeable.Rounding.Down);
    }

    /** @dev See {IERC4262-maxDeposit} */
    function maxDeposit(address) public view virtual override returns (uint256) {
        return _isVaultCollateralized() ? type(uint256).max : 0;
    }

    /** @dev See {IERC4262-maxMint} */
    function maxMint(address) public view virtual override returns (uint256) {
        return type(uint256).max;
    }

    /** @dev See {IERC4262-maxWithdraw} */
    function maxWithdraw(address owner) public view virtual override returns (uint256) {
        return _convertToAssets(balanceOf(owner), MathUpgradeable.Rounding.Down);
    }

    /** @dev See {IERC4262-maxRedeem} */
    function maxRedeem(address owner) public view virtual override returns (uint256) {
        return balanceOf(owner);
    }

    /** @dev See {IERC4262-previewDeposit} */
    function previewDeposit(uint256 assets) public view virtual override returns (uint256) {
        return _convertToShares(assets, MathUpgradeable.Rounding.Down);
    }

    /** @dev See {IERC4262-previewMint} */
    function previewMint(uint256 shares) public view virtual override returns (uint256) {
        return _convertToAssets(shares, MathUpgradeable.Rounding.Up);
    }

    /** @dev See {IERC4262-previewWithdraw} */
    function previewWithdraw(uint256 assets) public view virtual override returns (uint256) {
        return _convertToShares(assets, MathUpgradeable.Rounding.Up);
    }

    /** @dev See {IERC4262-previewRedeem} */
    function previewRedeem(uint256 shares) public view virtual override returns (uint256) {
        return _convertToAssets(shares, MathUpgradeable.Rounding.Down);
    }

    /** @dev See {IERC4262-deposit} */
    function deposit(uint256 assets, address receiver) public virtual override returns (uint256) {
        // Kept only for the sake of ERC4626 standard
    }

    /** @dev See {IERC4262-mint} */
    function mint(uint256 shares, address receiver) public virtual override returns (uint256) {
        // Kept only for the sake of ERC4626 standard
    }

    /** @dev See {IERC4262-withdraw} */
    function withdraw(
        uint256 assets,
        address receiver,
        address owner
    ) public virtual override returns (uint256) {
        // Kept only for the sake of ERC4626 standard
    }

    /** @dev See {IERC4262-redeem} */
    function redeem(
        uint256 shares,
        address receiver,
        address owner
    ) public virtual override returns (uint256) {
        // Kept only for the sake of ERC4626 standard
    }

    /**
     * @dev Internal convertion function (from assets to shares) with support for rounding direction
     *
     * Will revert if assets > 0, totalSupply > 0 and totalAssets = 0. That corresponds to a case where any asset
     * would represent an infinite amout of shares.
     */
    function _convertToShares(uint256 assets, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256 shares) {
        uint256 supply = totalSupply();
        return
            (assets == 0 || supply == 0)
                ? assets.mulDiv(10**decimals(), 10**_asset.decimals(), rounding)
                : assets.mulDiv(supply, totalAssets(), rounding);
    }

    /**
     * @dev Internal convertion function (from shares to assets) with support for rounding direction
     */
    function _convertToAssets(uint256 shares, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256 assets) {
        uint256 supply = totalSupply();
        return
            (supply == 0)
                ? shares.mulDiv(10**_asset.decimals(), 10**decimals(), rounding)
                : shares.mulDiv(totalAssets(), supply, rounding);
    }

    /**
     * @dev Deposit/mint common workflow
     */
    function _deposit(
        address caller,
        address receiver,
        uint256 assets,
        uint256 shares
    ) internal virtual {
        // If _asset is ERC777, `transferFrom` can trigger a reenterancy BEFORE the transfer happens through the
        // `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,
        // calls the vault, which is assumed not malicious.
        //
        // Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the
        // assets are transfered and before the shares are minted, which is a valid state.
        // slither-disable-next-line reentrancy-no-eth
        SafeERC20Upgradeable.safeTransferFrom(_asset, caller, address(this), assets);
        _mint(receiver, shares);

        emit Deposit(caller, receiver, assets, shares);
    }

    /**
     * @dev Withdraw/redeem common workflow
     */
    function _withdraw(
        address caller,
        address receiver,
        address owner,
        uint256 assets,
        uint256 shares
    ) internal virtual {
        if (caller != owner) {
            _spendAllowance(owner, caller, shares);
        }

        // If _asset is ERC777, `transfer` can trigger trigger a reentrancy AFTER the transfer happens through the
        // `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer,
        // calls the vault, which is assumed not malicious.
        //
        // Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the
        // shares are burned and after the assets are transfered, which is a valid state.
        _burn(owner, shares);
        SafeERC20Upgradeable.safeTransfer(_asset, receiver, assets);

        emit Withdraw(caller, receiver, owner, assets, shares);
    }

    function _isVaultCollateralized() private view returns (bool) {
        return totalAssets() > 0 || totalSupply() == 0;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 2 of 28 : IWETH.sol
// SPDX-License-Identifier: MIT

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

pragma solidity ^0.8.0;

interface IWETH is IERC20 {
    function deposit() external payable;

    function withdraw(uint256 wad) external;
}

File 2 of 28 : IMasterVault.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// import "./IERC4626Upgradeable.sol";

interface IMasterVault {
    event DepositFeeChanged(uint256 newDepositFee);
    event MaxDepositFeeChanged(uint256 newMaxDepositFee);
    event WithdrawalFeeChanged(uint256 newWithdrawalFee);
    event MaxWithdrawalFeeChanged(uint256 newMaxWithdrawalFee);
    event ProviderChanged(address provider);
    event RouterChanged(address ceRouter);
    event ManagerAdded(address newManager);
    event ManagerRemoved(address manager);
    event FeeReceiverChanged(address feeReceiver);
    event WaitingPoolChanged(address waitingPool);
    event StrategyAllocationChanged(address strategy, uint256 allocation);
    event SwapPoolChanged(address swapPool);
    event StrategyAdded(address strategy, uint256 allocation);
    event StrategyMigrated(address oldStrategy, address newStrategy, uint256 newAllocation);
    event DepositedToStrategy(address strategy, uint256 amount);
    event WithdrawnFromStrategy(address strategy, uint256 value);

    function withdrawETH(address account, uint256 amount) external  returns (uint256);
    function depositETH() external payable returns (uint256);
    function feeReceiver() external returns (address payable);
    function withdrawalFee() external view returns (uint256);
    function strategyParams(address strategy) external view returns(bool active, uint256 allocation, uint256 debt);
}

File 2 of 28 : IWaitingPool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IWaitingPool {
    function addToQueue(address, uint256) external;
    function tryRemove() external;
    function totalDebt() external view returns(uint256);
}

File 2 of 28 : IBaseStrategy.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IBaseStrategy {

// to deposit funds to a destination contract
function deposit(uint256 amount) external returns(uint256);

function depositAll() external returns(uint256);

// to withdraw funds from the destination contract
function withdraw() external returns(uint256);

function withdraw(uint256 amount) external returns(uint256);

// actions to do before depositing the funds
function beforeDeposit() external returns (bool);

// claim or collect rewards functions
function harvest() external;

// to be triggered by the owner in the emergency case to send all available funds back to the MasterVault
function retireStrat() external;

// withdraw all funds from the destination contract
function panic() external returns (uint256);

// disable deposit
function pause() external;

// enable deposit
function unpause() external;

// calculate the total underlying token in the strategy contract and destination contract
function balanceOf() external view returns(uint256);

// calculate the total amount of tokens in the strategy contract
function balanceOfWant() external view returns(uint256);

// calculate the total amount of tokens in the destination contract
function balanceOfPool() external view returns(uint256);

// set amount of fee to be collected from the total amount of tokens received from the harvest
function setHarvestFeeBP(uint256 newHarvestFee) external;

// set the recipient address of the collected fee
function setFeeRecipient(address newFeeRecipient) external;
}

File 2 of 28 : ISwapPool.sol
// SPDX-License-Identifier: Unliscensed
pragma solidity ^0.8.0;

interface ISwapPool {
    function swap(
        bool nativeToCeros,
        uint256 amountIn,
        address receiver
    ) external returns (uint256 amountOut);
    
    function getAmountOut(
        bool nativeToCeros,
        uint amountIn,
        bool isExcludedFromFee) 
        external view returns(uint amountOut, bool enoughLiquidity);
    
    function unstakeFee() external view returns (uint24 unstakeFee);

    function FEE_MAX() external view returns (uint24 feeMax);
}

File 2 of 28 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 2 of 28 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
     * initialization step. This is essential to configure modules that are added through upgrades and that require
     * initialization.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }
}

File 2 of 28 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

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

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

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

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

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

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

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

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

File 2 of 28 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves `amount` tokens from the caller's account to `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);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

File 2 of 28 : GemJoinLike.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import "./GemLike.sol";

interface GemJoinLike {
    function join(address usr, uint256 wad) external;

    function exit(address usr, uint256 wad) external;

    function gem() external view returns (GemLike);
}

File 2 of 28 : GemLike.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";

interface GemLike is IERC20Upgradeable {
    function decimals() external view returns (uint);
}

File 2 of 28 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../extensions/draft-IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
    using AddressUpgradeable for address;

    function safeTransfer(
        IERC20Upgradeable token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20Upgradeable 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(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20PermitUpgradeable 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(IERC20Upgradeable token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 2 of 28 : draft-IERC20PermitUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20PermitUpgradeable {
    /**
     * @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);
}

File 2 of 28 : ERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin 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 ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
    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}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC20_init_unchained(name_, symbol_);
    }

    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _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 value {ERC20} uses, unless this function is
     * 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;
        }
        _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;
        _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;
        }
        _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 {}

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[45] private __gap;
}

File 2 of 28 : MathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library MathUpgradeable {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`.
        // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.
        // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.
        // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a
        // good first aproximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1;
        uint256 x = a;
        if (x >> 128 > 0) {
            x >>= 128;
            result <<= 64;
        }
        if (x >> 64 > 0) {
            x >>= 64;
            result <<= 32;
        }
        if (x >> 32 > 0) {
            x >>= 32;
            result <<= 16;
        }
        if (x >> 16 > 0) {
            x >>= 16;
            result <<= 8;
        }
        if (x >> 8 > 0) {
            x >>= 8;
            result <<= 4;
        }
        if (x >> 4 > 0) {
            x >>= 4;
            result <<= 2;
        }
        if (x >> 2 > 0) {
            result <<= 1;
        }

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        uint256 result = sqrt(a);
        if (rounding == Rounding.Up && result * result < a) {
            result += 1;
        }
        return result;
    }
}

File 2 of 28 : IERC4626Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";

/**
 * @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in
 * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].
 *
 * _Available since v4.7._
 */
interface IERC4626Upgradeable is IERC20Upgradeable, IERC20MetadataUpgradeable {
    event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);

    event Withdraw(
        address indexed caller,
        address indexed receiver,
        address indexed owner,
        uint256 assets,
        uint256 shares
    );

    /**
     * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
     *
     * - MUST be an ERC-20 token contract.
     * - MUST NOT revert.
     */
    function asset() external view returns (address assetTokenAddress);

    /**
     * @dev Returns the total amount of the underlying asset that is “managed” by Vault.
     *
     * - SHOULD include any compounding that occurs from yield.
     * - MUST be inclusive of any fees that are charged against assets in the Vault.
     * - MUST NOT revert.
     */
    function totalAssets() external view returns (uint256 totalManagedAssets);

    /**
     * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal
     * scenario where all the conditions are met.
     *
     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
     * - MUST NOT show any variations depending on the caller.
     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
     * - MUST NOT revert.
     *
     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
     * from.
     */
    function convertToShares(uint256 assets) external view returns (uint256 shares);

    /**
     * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
     * scenario where all the conditions are met.
     *
     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
     * - MUST NOT show any variations depending on the caller.
     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
     * - MUST NOT revert.
     *
     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
     * from.
     */
    function convertToAssets(uint256 shares) external view returns (uint256 assets);

    /**
     * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,
     * through a deposit call.
     *
     * - MUST return a limited value if receiver is subject to some deposit limit.
     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
     * - MUST NOT revert.
     */
    function maxDeposit(address receiver) external view returns (uint256 maxAssets);

    /**
     * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given
     * current on-chain conditions.
     *
     * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit
     *   call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called
     *   in the same transaction.
     * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the
     *   deposit would be accepted, regardless if the user has enough tokens approved, etc.
     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
     * - MUST NOT revert.
     *
     * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
     * share price or some other type of condition, meaning the depositor will lose assets by depositing.
     */
    function previewDeposit(uint256 assets) external view returns (uint256 shares);

    /**
     * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.
     *
     * - MUST emit the Deposit event.
     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
     *   deposit execution, and are accounted for during deposit.
     * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
     *   approving enough underlying tokens to the Vault contract, etc).
     *
     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
     */
    function deposit(uint256 assets, address receiver) external returns (uint256 shares);

    /**
     * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.
     * - MUST return a limited value if receiver is subject to some mint limit.
     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
     * - MUST NOT revert.
     */
    function maxMint(address receiver) external view returns (uint256 maxShares);

    /**
     * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given
     * current on-chain conditions.
     *
     * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call
     *   in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the
     *   same transaction.
     * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint
     *   would be accepted, regardless if the user has enough tokens approved, etc.
     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
     * - MUST NOT revert.
     *
     * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
     * share price or some other type of condition, meaning the depositor will lose assets by minting.
     */
    function previewMint(uint256 shares) external view returns (uint256 assets);

    /**
     * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.
     *
     * - MUST emit the Deposit event.
     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint
     *   execution, and are accounted for during mint.
     * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not
     *   approving enough underlying tokens to the Vault contract, etc).
     *
     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
     */
    function mint(uint256 shares, address receiver) external returns (uint256 assets);

    /**
     * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the
     * Vault, through a withdraw call.
     *
     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
     * - MUST NOT revert.
     */
    function maxWithdraw(address owner) external view returns (uint256 maxAssets);

    /**
     * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,
     * given current on-chain conditions.
     *
     * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
     *   call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if
     *   called
     *   in the same transaction.
     * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though
     *   the withdrawal would be accepted, regardless if the user has enough shares, etc.
     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
     * - MUST NOT revert.
     *
     * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in
     * share price or some other type of condition, meaning the depositor will lose assets by depositing.
     */
    function previewWithdraw(uint256 assets) external view returns (uint256 shares);

    /**
     * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.
     *
     * - MUST emit the Withdraw event.
     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
     *   withdraw execution, and are accounted for during withdraw.
     * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner
     *   not having enough shares, etc).
     *
     * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
     * Those methods should be performed separately.
     */
    function withdraw(
        uint256 assets,
        address receiver,
        address owner
    ) external returns (uint256 shares);

    /**
     * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,
     * through a redeem call.
     *
     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
     * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.
     * - MUST NOT revert.
     */
    function maxRedeem(address owner) external view returns (uint256 maxShares);

    /**
     * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,
     * given current on-chain conditions.
     *
     * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call
     *   in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the
     *   same transaction.
     * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
     *   redemption would be accepted, regardless if the user has enough shares, etc.
     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
     * - MUST NOT revert.
     *
     * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
     * share price or some other type of condition, meaning the depositor will lose assets by redeeming.
     */
    function previewRedeem(uint256 shares) external view returns (uint256 assets);

    /**
     * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.
     *
     * - MUST emit the Withdraw event.
     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
     *   redeem execution, and are accounted for during redeem.
     * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner
     *   not having enough shares, etc).
     *
     * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
     * Those methods should be performed separately.
     */
    function redeem(
        uint256 shares,
        address receiver,
        address owner
    ) external returns (uint256 assets);
}

File 2 of 28 : IERC20MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
    /**
     * @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);
}

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

Contract ABI

[{"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":"caller","type":"address"},{"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":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newDepositFee","type":"uint256"}],"name":"DepositFeeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DepositedToStrategy","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"feeReceiver","type":"address"}],"name":"FeeReceiverChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newManager","type":"address"}],"name":"ManagerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"manager","type":"address"}],"name":"ManagerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMaxDepositFee","type":"uint256"}],"name":"MaxDepositFeeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMaxWithdrawalFee","type":"uint256"}],"name":"MaxWithdrawalFeeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"provider","type":"address"}],"name":"ProviderChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"ceRouter","type":"address"}],"name":"RouterChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"allocation","type":"uint256"}],"name":"StrategyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"allocation","type":"uint256"}],"name":"StrategyAllocationChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldStrategy","type":"address"},{"indexed":false,"internalType":"address","name":"newStrategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"newAllocation","type":"uint256"}],"name":"StrategyMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"swapPool","type":"address"}],"name":"SwapPoolChanged","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":false,"internalType":"address","name":"waitingPool","type":"address"}],"name":"WaitingPoolChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"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":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newWithdrawalFee","type":"uint256"}],"name":"WithdrawalFeeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"WithdrawnFromStrategy","type":"event"},{"inputs":[],"name":"MAX_STRATEGIES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newManager","type":"address"}],"name":"addManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"allocate","outputs":[],"stateMutability":"nonpayable","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":"asset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"availableToWithdraw","outputs":[{"internalType":"uint256","name":"available","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":[],"name":"cerosStrategy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"_feeReceiver","type":"address"}],"name":"changeFeeReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"provider","type":"address"}],"name":"changeProvider","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"strategy","type":"address"},{"internalType":"uint256","name":"allocation","type":"uint256"}],"name":"changeStrategyAllocation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_swapPool","type":"address"}],"name":"changeSwapPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"shares","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":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"strategy","type":"address"}],"name":"depositAllToStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositETH","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"depositFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"strategy","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositToStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeEarned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeReceiver","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","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":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"maxDepositFees","type":"uint256"},{"internalType":"uint256","name":"maxWithdrawalFees","type":"uint256"},{"internalType":"contract IERC20MetadataUpgradeable","name":"asset","type":"address"},{"internalType":"uint8","name":"maxStrategies","type":"uint8"},{"internalType":"address","name":"swapPoolAddr","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"manager","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxDepositFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxWithdrawalFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oldStrategy","type":"address"},{"internalType":"address","name":"newStrategy","type":"address"},{"internalType":"uint256","name":"newAllocation","type":"uint256"}],"name":"migrateStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"payDebt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_manager","type":"address"}],"name":"removeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"strategy","type":"address"}],"name":"retireStrat","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newDepositFee","type":"uint256"}],"name":"setDepositFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxDepositFee","type":"uint256"}],"name":"setMaxDepositFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxStrategies","type":"uint256"}],"name":"setMaxStrategies","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxWithdrawalFee","type":"uint256"}],"name":"setMaxWithdrawalFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"strategy","type":"address"},{"internalType":"uint256","name":"allocation","type":"uint256"}],"name":"setStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_waitingPool","type":"address"}],"name":"setWaitingPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newWithdrawalFee","type":"uint256"}],"name":"setWithdrawalFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"strategies","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"strategyParams","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"allocation","type":"uint256"},{"internalType":"uint256","name":"debt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapPool","outputs":[{"internalType":"contract ISwapPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssetInVault","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDebt","outputs":[{"internalType":"uint256","name":"","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":"waitingPool","outputs":[{"internalType":"contract IWaitingPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"strategy","type":"address"}],"name":"withdrawAllFromStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawETH","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"strategy","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawFromStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawalFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b50614011806100206000396000f3fe60806040526004361061039f5760003560e01c80638bc7e8c4116101de578063c63d75b611610103578063dd62ed3e1161009b578063dd62ed3e14610b28578063ddb56b2614610b48578063e322ad2b14610b68578063e941fa7814610b7d578063ec1c0a9914610b92578063ef8b30f714610a2a578063f2fde38b14610ba9578063f6326fb314610bc9578063fc7b9c1814610bd157600080fd5b8063c63d75b614610a08578063c6e6f59214610a2a578063c99f062f14610a4a578063ce96cb7714610a6b578063d463bc6514610a8b578063d4d2e7f214610aa0578063d574ea3d14610ad1578063d5f63a0614610af1578063d905777e14610b0857600080fd5b8063ac18de4311610176578063ac18de43146108c5578063ac1e5025146108e5578063af76d4bd14610905578063b3d7f6b914610925578063b3f0067414610945578063b460af9414610966578063b53d09581461098a578063ba08765214610966578063c4c2d9b9146109aa57600080fd5b80638bc7e8c4146107ee5780638da5cb5b1461080557806394bf804d146106ff57806395d89b4114610823578063982697dd14610838578063a457c2d714610859578063a8d1dbfb14610879578063a9059cbb14610890578063abaa9916146108b057600080fd5b8063490ae210116102c457806367a527931161025c57806367a52793146106e85780636e553f65146106ff57806370a0823114610722578063715018a61461074257806372890dbd1461075757806372ff8a3414610777578063767f06ae14610797578063796f69aa146107ae5780637c08b964146107ce57600080fd5b8063490ae210146105ef5780634bee2ba21461060f5780634c3531371461062f5780634cdad506146103f55780634ff173d71461064f578063588fbd9c1461066f578063596ff76e1461068f578063597c8910146106b05780635c975abb146106d057600080fd5b806323b872dd1161033757806323b872dd146104d15780632d06177a146104f1578063313ce5671461051157806338d52e0f1461052d578063395093511461054f5780633e99fdcd1461056f578063402d267d1461058f57806345d34def146105af5780634782f779146105cf57600080fd5b806301e1d114146103ab57806306fdde03146103d357806307a2d13a146103f5578063095ea7b3146104155780630a28a4771461044557806310ee4cb51461046557806312ee50571461048757806318160ddd1461049c5780631992a088146104b157600080fd5b366103a657005b600080fd5b3480156103b757600080fd5b506103c0610be8565b6040519081526020015b60405180910390f35b3480156103df57600080fd5b506103e8610c5f565b6040516103ca91906137ed565b34801561040157600080fd5b506103c0610410366004613842565b610cf1565b34801561042157600080fd5b50610435610430366004613870565b610d04565b60405190151581526020016103ca565b34801561045157600080fd5b506103c0610460366004613842565b610d1c565b34801561047157600080fd5b5061048561048036600461389c565b610d29565b005b34801561049357600080fd5b50610485610d9b565b3480156104a857600080fd5b506035546103c0565b3480156104bd57600080fd5b506104856104cc366004613842565b610e06565b3480156104dd57600080fd5b506104356104ec3660046138b9565b610e44565b3480156104fd57600080fd5b5061048561050c36600461389c565b610e6a565b34801561051d57600080fd5b50604051601281526020016103ca565b34801561053957600080fd5b50610542610ed9565b6040516103ca91906138fa565b34801561055b57600080fd5b5061043561056a366004613870565b610ee8565b34801561057b57600080fd5b5061048561058a366004613842565b610f0a565b34801561059b57600080fd5b506103c06105aa36600461389c565b610f48565b3480156105bb57600080fd5b506104856105ca366004613870565b610f66565b3480156105db57600080fd5b506103c06105ea366004613870565b6110b2565b3480156105fb57600080fd5b5061048561060a366004613842565b6113f7565b34801561061b57600080fd5b5061048561062a36600461389c565b611481565b34801561063b57600080fd5b5061048561064a3660046139c0565b611570565b34801561065b57600080fd5b5061048561066a366004613842565b611707565b34801561067b57600080fd5b5061048561068a36600461389c565b611715565b34801561069b57600080fd5b5061013954610542906001600160a01b031681565b3480156106bc57600080fd5b506104856106cb36600461389c565b61177c565b3480156106dc57600080fd5b5060c95460ff16610435565b3480156106f457600080fd5b506103c061012d5481565b34801561070b57600080fd5b506103c061071a366004613a71565b600092915050565b34801561072e57600080fd5b506103c061073d36600461389c565b6117e4565b34801561074e57600080fd5b506104856117ff565b34801561076357600080fd5b5061048561077236600461389c565b611813565b34801561078357600080fd5b50610485610792366004613870565b6118c0565b3480156107a357600080fd5b506103c061013b5481565b3480156107ba57600080fd5b506104856107c936600461389c565b61192c565b3480156107da57600080fd5b506104856107e936600461389c565b611993565b3480156107fa57600080fd5b506103c061012f5481565b34801561081157600080fd5b506097546001600160a01b0316610542565b34801561082f57600080fd5b506103e86119fa565b34801561084457600080fd5b5061013e54610542906001600160a01b031681565b34801561086557600080fd5b50610435610874366004613870565b611a09565b34801561088557600080fd5b506103c061012e5481565b34801561089c57600080fd5b506104356108ab366004613870565b611a8f565b3480156108bc57600080fd5b50610485611a9d565b3480156108d157600080fd5b506104856108e036600461389c565b611d60565b3480156108f157600080fd5b50610485610900366004613842565b611ddf565b34801561091157600080fd5b50610485610920366004613870565b611e6f565b34801561093157600080fd5b506103c0610940366004613842565b611ea9565b34801561095157600080fd5b5061013a54610542906001600160a01b031681565b34801561097257600080fd5b506103c0610981366004613aa1565b60009392505050565b34801561099657600080fd5b506104856109a5366004613870565b611eb6565b3480156109b657600080fd5b506109eb6109c536600461389c565b6101376020526000908152604090208054600182015460029092015460ff909116919083565b6040805193151584526020840192909252908201526060016103ca565b348015610a1457600080fd5b506103c0610a2336600461389c565b5060001990565b348015610a3657600080fd5b506103c0610a45366004613842565b611ef5565b348015610a5657600080fd5b5061013d54610542906001600160a01b031681565b348015610a7757600080fd5b506103c0610a8636600461389c565b611f02565b348015610a9757600080fd5b506103c0611f17565b348015610aac57600080fd5b50610435610abb36600461389c565b6101366020526000908152604090205460ff1681565b348015610add57600080fd5b50610542610aec366004613842565b611f46565b348015610afd57600080fd5b506103c061013f5481565b348015610b1457600080fd5b506103c0610b2336600461389c565b611f71565b348015610b3457600080fd5b506103c0610b43366004613ae3565b611f7c565b348015610b5457600080fd5b50610485610b633660046138b9565b611fa7565b348015610b7457600080fd5b506103c06121eb565b348015610b8957600080fd5b506104856122d2565b348015610b9e57600080fd5b506103c06101305481565b348015610bb557600080fd5b50610485610bc436600461389c565b61238a565b6103c0612400565b348015610bdd57600080fd5b506103c061013c5481565b6065546040516370a0823160e01b81526000916001600160a01b0316906370a0823190610c199030906004016138fa565b602060405180830381865afa158015610c36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5a9190613b11565b905090565b606060368054610c6e90613b2a565b80601f0160208091040260200160405190810160405280929190818152602001828054610c9a90613b2a565b8015610ce75780601f10610cbc57610100808354040283529160200191610ce7565b820191906000526020600020905b815481529060010190602001808311610cca57829003601f168201915b5050505050905090565b6000610cfe8260006126d8565b92915050565b600033610d1281858561279e565b5060019392505050565b6000610cfe8260016128c2565b610d31612971565b6001600160a01b038116610d4457600080fd5b61013d80546001600160a01b0319166001600160a01b0383161790556040517fa432db9ace1b934a63faa0623ff13bc2fd03dcd87ba64feb711abfcaba1f225a90610d909083906138fa565b60405180910390a150565b61013d60009054906101000a90046001600160a01b03166001600160a01b03166397d227666040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610dec57600080fd5b505af1158015610e00573d6000803e3d6000fd5b50505050565b610e0e612971565b6101308190556040518181527f96c657d16f9e2fd59288ff48fa375297a008a7c2bd8687d8df627cbb5f3f006290602001610d90565b600033610e528582856129cb565b610e5d858585612a3f565b60019150505b9392505050565b610e72612971565b6001600160a01b038116610e8557600080fd5b6001600160a01b0381166000908152610136602052604090819020805460ff19166001179055517f3b4a40cccf2058c593542587329dd385be4f0b588db5471fbd9598e56dd7093a90610d909083906138fa565b6065546001600160a01b031690565b600033610d12818585610efb8383611f7c565b610f059190613b74565b61279e565b610f12612971565b61012e8190556040518181527f1fcec621d2165ddad9f40f59774c48275fc2c031cf8141a4973e3b29a6bd53a190602001610d90565b6000610f52612bfb565b610f5d576000610cfe565b60001992915050565b610f6e612971565b6001600160a01b038216610f8157600080fd5b61013b546101385410610fd55760405162461bcd60e51b81526020600482015260176024820152761b585e081cdd1c985d1959da595cc8195e18d959591959604a1b60448201526064015b60405180910390fd5b604080516060810182526001808252602080830185815260008486018181526001600160a01b0389168083526101379094529581208551815460ff19169015151781559151828501559451600290910155610138805492830181559093527ff79a63dcec80ed75c82f36161f17b9c2f407860160383a7be0a0ee7962c527ae0180546001600160a01b03191690921790915561107383600019610d04565b507f2f564a83158ad1831793ad3e69257b52f39ece5d49cb0d8746708ecb9ef964da83836040516110a5929190613b8c565b60405180910390a1505050565b6000600260fb54036110d65760405162461bcd60e51b8152600401610fcc90613ba5565b600260fb556110e3612c15565b6097546001600160a01b03163314806111075750610132546001600160a01b031633145b6111235760405162461bcd60e51b8152600401610fcc90613bdc565b5080336111308183612c5b565b600061113a611f17565b9050838110156112e8576111566111518286613c0b565b612d97565b9250826000036112ce5761013d54604051630f610f1f60e31b81526001600160a01b0390911690637b0878f8906111939088908890600401613b8c565b600060405180830381600087803b1580156111ad57600080fd5b505af11580156111c1573d6000803e3d6000fd5b50505050600081111561127c576111d6610ed9565b6001600160a01b0316632e1a7d4d826040518263ffffffff1660e01b815260040161120391815260200190565b600060405180830381600087803b15801561121d57600080fd5b505af1158015611231573d6000803e3d6000fd5b5050505061123e84612e8e565b61013d546040519194506001600160a01b03169082156108fc029083906000818181858888f1935050505015801561127a573d6000803e3d6000fd5b505b60408051858152602081018690526001600160a01b03841691829182917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a483925050506113ec565b6112d781612e8e565b6112e19084613b74565b92506112f4565b6112f184612e8e565b92505b6113018361012f5461304e565b925061130b610ed9565b6001600160a01b0316632e1a7d4d846040518263ffffffff1660e01b815260040161133891815260200190565b600060405180830381600087803b15801561135257600080fd5b505af1158015611366573d6000803e3d6000fd5b50506040516001600160a01b038816925085156108fc02915085906000818181858888f193505050501580156113a0573d6000803e3d6000fd5b5060408051858152602081018590526001600160a01b03841691829182917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a450505b600160fb5592915050565b6113ff612971565b8061012e541161144b5760405162461bcd60e51b81526020600482015260176024820152766d6f7265207468616e206d61784465706f73697446656560481b6044820152606401610fcc565b61012d8190556040518181527f2a6f1084651542f3142c70f4c43c096d016a8b517c063660b146268f646ea43a90602001610d90565b336000908152610136602052604090205460ff166114b15760405162461bcd60e51b8152600401610fcc90613c22565b60006114bb611f17565b90506114c782826130a4565b60405163b6b55f2560e01b8152600481018290526001600160a01b0383169063b6b55f25906024016020604051808303816000875af115801561150e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115329190613b11565b507ff47c2ba90b71ef36b592a780f1d750d3a480494fdc7c9b84bb3f9d8de8a1b40a8282604051611564929190613b8c565b60405180910390a15050565b600054610100900460ff16158080156115905750600054600160ff909116105b806115aa5750303b1580156115aa575060005460ff166001145b61160d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610fcc565b6000805460ff191660011790558015611630576000805461ff0019166101001790555b611638613201565b611640613230565b61164861325f565b611652888861328e565b61165b846132bf565b33600081815261013660205260409020805460ff1916600117905561012e87905561013086905560ff841661013b5561013a80546001600160a01b0319908116909217905561013e80546001600160a01b038516921691909117905580156116fd576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b61170f612971565b61013b55565b61171d612971565b6001600160a01b03811661173057600080fd5b61013e80546001600160a01b0319166001600160a01b0383161790556040517f686f89a6ecbf2a3d59b997474f0c3924243521154529f47be3cbd9fd8859b8e690610d909083906138fa565b336000908152610136602052604090205460ff166117ac5760405162461bcd60e51b8152600401610fcc90613c22565b6001600160a01b038116600090815261013760205260409020600201546117e09082906117db90600a90613c0b565b6132ef565b5050565b6001600160a01b031660009081526033602052604090205490565b611807612971565b61181160006134a8565b565b336000908152610136602052604090205460ff166118435760405162461bcd60e51b8152600401610fcc90613c22565b6001600160a01b038116600090815261013760205260409020600201546118729082906117db90600a90613c0b565b506001600160a01b03811660009081526101376020526040902060020154600a106118bd576001600160a01b038116600090815261013760205260408120805460ff19168155600201555b50565b6118c8612971565b6001600160a01b0382166118db57600080fd5b6001600160a01b0382166000908152610137602052604090819020600101829055517f12550b3055a78afe91da1a02a6e99583200fe1b2f7f571269bb013ff3f7c05e8906115649084908490613b8c565b611934612971565b6001600160a01b03811661194757600080fd5b61013280546001600160a01b0319166001600160a01b0383161790556040517fa480657dfd615e3ba406b865a0da683507aeeb1b3e8206eb2c080bc1c0b23e8290610d909083906138fa565b61199b612971565b6001600160a01b0381166119ae57600080fd5b61013a80546001600160a01b0319166001600160a01b0383161790556040517f647672599d3468abcfa241a13c9e3d34383caadb5cc80fb67c3cdfcd5f78605990610d909083906138fa565b606060378054610c6e90613b2a565b60003381611a178286611f7c565b905083811015611a775760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610fcc565b611a84828686840361279e565b506001949350505050565b600033610d12818585612a3f565b336000908152610136602052604090205460ff16611acd5760405162461bcd60e51b8152600401610fcc90613c22565b60005b6101385460ff821610156118bd5761013760006101388360ff1681548110611afa57611afa613c50565b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff1615611d4e57600061013760006101388460ff1681548110611b4557611b45613c50565b60009182526020808320909101546001600160a01b0316835282810193909352604091820190208151606081018352815460ff161515815260018201549381018490526002909101549181019190915291508015611d4b57600061013c54611bab611f17565b611bb59190613b74565b90506000818460400151611bc99190613c7c565b611bd690620f4240613c9e565b905082811015611cf0576040840151600090620f4240611bf68686613c9e565b611c009190613c7c565b611c0a9190613c0b565b905080611c15611f17565b1115611cea57611c506101388760ff1681548110611c3557611c35613c50565b6000918252602090912001546001600160a01b0316826130a4565b6101388660ff1681548110611c6757611c67613c50565b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b031663de5f62686040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611cc4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ce89190613b11565b505b50611d48565b611d466101388660ff1681548110611d0a57611d0a613c50565b6000918252602090912001546001600160a01b0316620f4240611d2d8686613c9e565b611d379190613c7c565b86604001516117db9190613c0b565b505b50505b50505b80611d5881613cbd565b915050611ad0565b611d68612971565b6001600160a01b0381166000908152610136602052604090205460ff16611d8e57600080fd5b6001600160a01b0381166000908152610136602052604090819020805460ff19169055517fef69f7d97228658c92417be1b16b19058315de71fecb435d07b7d23728b6bd3190610d909083906138fa565b611de7612971565b806101305411611e395760405162461bcd60e51b815260206004820152601a60248201527f6d6f7265207468616e206d61785769746864726177616c4665650000000000006044820152606401610fcc565b61012f8190556040518181527ffc1353e6b18ce07b5a979c8edf77a87455939a17a9eebbb084dcde5bfb3b19ac90602001610d90565b336000908152610136602052604090205460ff16611e9f5760405162461bcd60e51b8152600401610fcc90613c22565b6114c782826130a4565b6000610cfe8260016126d8565b336000908152610136602052604090205460ff16611ee65760405162461bcd60e51b8152600401610fcc90613c22565b611ef082826132ef565b505050565b6000610cfe8260006128c2565b6000610cfe611f10836117e4565b60006126d8565b600061013f54611f25610be8565b11611f305750600090565b61013f54611f3c610be8565b610c5a9190613c0b565b6101388181548110611f5757600080fd5b6000918252602090912001546001600160a01b0316905081565b6000610cfe826117e4565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b336000908152610136602052604090205460ff16611fd75760405162461bcd60e51b8152600401610fcc90613c22565b6001600160a01b038316611fea57600080fd5b6001600160a01b038216611ffd57600080fd5b6001600160a01b038316600090815261013760205260409020600201548015612051576001600160a01b0384166000908152610137602052604090206002015461204f9085906117db90600a90613c0b565b505b6040805160608101825260018152602081018490526000918101829052905b6101385481101561217f57856001600160a01b0316610138828154811061209957612099613c50565b6000918252602090912001546001600160a01b031603612125578461013882815481106120c8576120c8613c50565b600091825260208083209190910180546001600160a01b0319166001600160a01b03948516179055918716815261013782526040908190208451815460ff191690151517815591840151600183015583015160029091015561216d565b60405162461bcd60e51b815260206004820152601b60248201527f696e76616c6964206f6c645374726174656779206164647265737300000000006044820152606401610fcc565b8061217781613cdc565b915050612070565b5061218b856000610d04565b5061219884600019610d04565b50604080516001600160a01b038088168252861660208201529081018490527ff55572e1238e3cef1cce627268598c0bcdc71b7316311157752ae0a2e920998c9060600160405180910390a15050505050565b6000805b6101385460ff821610156122bf57612205610ed9565b6001600160a01b03166370a082316101388360ff168154811061222a5761222a613c50565b6000918252602090912001546040516001600160e01b031960e084901b168152612260916001600160a01b0316906004016138fa565b602060405180830381865afa15801561227d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a19190613b11565b6122ab9083613b74565b9150806122b781613cbd565b9150506121ef565b506122c8611f17565b610c5a9082613b74565b6122da612971565b61013f5415611811576122eb610ed9565b6001600160a01b0316632e1a7d4d61013f546040518263ffffffff1660e01b815260040161231b91815260200190565b600060405180830381600087803b15801561233557600080fd5b505af1158015612349573d6000803e3d6000fd5b5050600061013f81905561013a546040516001600160a01b0390911693506108fc925081818181818888f193505050501580156118bd573d6000803e3d6000fd5b612392612971565b6001600160a01b0381166123f75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610fcc565b6118bd816134a8565b6000600260fb54036124245760405162461bcd60e51b8152600401610fcc90613ba5565b600260fb55612431612c15565b6097546001600160a01b03163314806124555750610132546001600160a01b031633145b6124715760405162461bcd60e51b8152600401610fcc90613bdc565b3334806124b15760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a5908185b5bdd5b9d60921b6044820152606401610fcc565b6124be8161012d5461304e565b9250600061013d60009054906101000a90046001600160a01b03166001600160a01b031663fc7b9c186040518163ffffffff1660e01b8152600401602060405180830381865afa158015612516573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061253a9190613b11565b61013d549091506001600160a01b031631811580159061255957508181105b1561261e57600085831061256d5785612577565b6125778284613c0b565b61013d546040519192506001600160a01b03169082156108fc029083906000818181858888f193505050501580156125b3573d6000803e3d6000fd5b506125bc610ed9565b6001600160a01b031663d0e30db06125d48387613c0b565b6040518263ffffffff1660e01b81526004016000604051808303818588803b1580156125ff57600080fd5b505af1158015612613573d6000803e3d6000fd5b50505050505061267a565b612626610ed9565b6001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561266057600080fd5b505af1158015612674573d6000803e3d6000fd5b50505050505b61268484866134fa565b60408051848152602081018790526001600160a01b0386169182917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a35050600160fb555090919050565b6000806126e460355490565b90508015612705576127006126f7610be8565b859083866135c7565b612796565b6065546040805163313ce56760e01b81529051612796926001600160a01b03169163313ce5679160048083019260209291908290030181865afa158015612750573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127749190613cf5565b61277f90600a613df6565b60125b61278d90600a613df6565b869190866135c7565b949350505050565b6001600160a01b0383166128005760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610fcc565b6001600160a01b0382166128615760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610fcc565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000806128ce60355490565b90508315806128db575080155b6128eb576127008161278d610be8565b6127966128fa6012600a613df6565b606560009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561294d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127829190613cf5565b6097546001600160a01b031633146118115760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610fcc565b60006129d78484611f7c565b90506000198114610e005781811015612a325760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610fcc565b610e00848484840361279e565b6001600160a01b038316612aa35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610fcc565b6001600160a01b038216612b055760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610fcc565b6001600160a01b03831660009081526033602052604090205481811015612b7d5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610fcc565b6001600160a01b03808516600090815260336020526040808220858503905591851681529081208054849290612bb4908490613b74565b92505081905550826001600160a01b0316846001600160a01b0316600080516020613fbc83398151915284604051612bee91815260200190565b60405180910390a3610e00565b600080612c06610be8565b1180610c5a5750506035541590565b60c95460ff16156118115760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610fcc565b6001600160a01b038216612cbb5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610fcc565b6001600160a01b03821660009081526033602052604090205481811015612d2f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610fcc565b6001600160a01b0383166000908152603360205260408120838303905560358054849290612d5e908490613c0b565b90915550506040518281526000906001600160a01b03851690600080516020613fbc8339815191529060200160405180910390a3505050565b6000805b6101385460ff82161015612e885761013760006101388360ff1681548110612dc557612dc5613c50565b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff168015612e3c57508261013760006101388460ff1681548110612e1157612e11613c50565b60009182526020808320909101546001600160a01b0316835282019290925260400190206002015410155b15612e7657610e636101388260ff1681548110612e5b57612e5b613c50565b6000918252602090912001546001600160a01b0316846132ef565b80612e8081613cbd565b915050612d9b565b50919050565b60008061013e60009054906101000a90046001600160a01b03166001600160a01b0316638ea97d266040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ee5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f099190613e05565b62ffffff16118015612f1b5750600082115b1561304a5761013e5460408051636131270f60e11b815290516000926001600160a01b03169163c2624e1e9160048083019260209291908290030181865afa158015612f6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f8f9190613e05565b62ffffff1661013e60009054906101000a90046001600160a01b03166001600160a01b0316638ea97d266040518163ffffffff1660e01b8152600401602060405180830381865afa158015612fe8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061300c9190613e05565b61301b9062ffffff1685613c9e565b6130259190613c7c565b90508061013f600082825461303a9190613b74565b90915550610e6390508184613c0b565b5090565b6000811561309d576000620f42406130668486613c9e565b6130709190613c7c565b905061307c8185613c0b565b91508061013f60008282546130919190613b74565b90915550610cfe915050565b5081610cfe565b600081116130ed5760405162461bcd60e51b81526020600482015260166024820152751a5b9d985b1a590819195c1bdcda5d08185b5bdd5b9d60521b6044820152606401610fcc565b60006130f7610ed9565b905081613102611f17565b10156131475760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b6044820152606401610fcc565b8161013c600082825461315a9190613b74565b90915550506001600160a01b038316600090815261013760205260408120600201805484929061318b908490613b74565b909155505060405163a9059cbb60e01b81526001600160a01b0382169063a9059cbb906131be9086908690600401613b8c565b6020604051808303816000875af11580156131dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e009190613e2a565b600054610100900460ff166132285760405162461bcd60e51b8152600401610fcc90613e4c565b611811613624565b600054610100900460ff166132575760405162461bcd60e51b8152600401610fcc90613e4c565b611811613654565b600054610100900460ff166132865760405162461bcd60e51b8152600401610fcc90613e4c565b611811613687565b600054610100900460ff166132b55760405162461bcd60e51b8152600401610fcc90613e4c565b6117e082826136b5565b600054610100900460ff166132e65760405162461bcd60e51b8152600401610fcc90613e4c565b6118bd816136f5565b600080821161333c5760405162461bcd60e51b81526020600482015260196024820152781a5b9d985b1a59081dda5d1a191c985dd85b08185b5bdd5b9d603a1b6044820152606401610fcc565b6001600160a01b038316600090815261013760205260409020600201548211156133a85760405162461bcd60e51b815260206004820152601f60248201527f696e73756666696369656e742061737365747320696e207374726174656779006044820152606401610fcc565b604051632e1a7d4d60e01b8152600481018390526000906001600160a01b03851690632e1a7d4d906024016020604051808303816000875af11580156133f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134169190613b11565b90508015610e63578261013c60008282546134319190613c0b565b90915550506001600160a01b0384166000908152610137602052604081206002018054859290613462908490613c0b565b90915550506040517fd442d8f1594fc5996caed833eb6135a4c223a05bdbed778c0d8415a52eb87fea906134999086908690613b8c565b60405180910390a19392505050565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0382166135505760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610fcc565b80603560008282546135629190613b74565b90915550506001600160a01b0382166000908152603360205260408120805483929061358f908490613b74565b90915550506040518181526001600160a01b03831690600090600080516020613fbc8339815191529060200160405180910390a35050565b6000806135d586868661373e565b905060018360028111156135eb576135eb613e97565b14801561360857506000848061360357613603613c66565b868809115b1561361b57613618600182613b74565b90505b95945050505050565b600054610100900460ff1661364b5760405162461bcd60e51b8152600401610fcc90613e4c565b611811336134a8565b600054610100900460ff1661367b5760405162461bcd60e51b8152600401610fcc90613e4c565b60c9805460ff19169055565b600054610100900460ff166136ae5760405162461bcd60e51b8152600401610fcc90613e4c565b600160fb55565b600054610100900460ff166136dc5760405162461bcd60e51b8152600401610fcc90613e4c565b60366136e88382613efb565b506037611ef08282613efb565b600054610100900460ff1661371c5760405162461bcd60e51b8152600401610fcc90613e4c565b606580546001600160a01b0319166001600160a01b0392909216919091179055565b60008080600019858709858702925082811083820303915050806000036137785783828161376e5761376e613c66565b0492505050610e63565b80841161378457600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b600060208083528351808285015260005b8181101561381a578581018301518582016040015282016137fe565b8181111561382c576000604083870101525b50601f01601f1916929092016040019392505050565b60006020828403121561385457600080fd5b5035919050565b6001600160a01b03811681146118bd57600080fd5b6000806040838503121561388357600080fd5b823561388e8161385b565b946020939093013593505050565b6000602082840312156138ae57600080fd5b8135610e638161385b565b6000806000606084860312156138ce57600080fd5b83356138d98161385b565b925060208401356138e98161385b565b929592945050506040919091013590565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261393557600080fd5b813567ffffffffffffffff808211156139505761395061390e565b604051601f8301601f19908116603f011681019082821181831017156139785761397861390e565b8160405283815286602085880101111561399157600080fd5b836020870160208301376000602085830101528094505050505092915050565b60ff811681146118bd57600080fd5b600080600080600080600060e0888a0312156139db57600080fd5b873567ffffffffffffffff808211156139f357600080fd5b6139ff8b838c01613924565b985060208a0135915080821115613a1557600080fd5b50613a228a828b01613924565b96505060408801359450606088013593506080880135613a418161385b565b925060a0880135613a51816139b1565b915060c0880135613a618161385b565b8091505092959891949750929550565b60008060408385031215613a8457600080fd5b823591506020830135613a968161385b565b809150509250929050565b600080600060608486031215613ab657600080fd5b833592506020840135613ac88161385b565b91506040840135613ad88161385b565b809150509250925092565b60008060408385031215613af657600080fd5b8235613b018161385b565b91506020830135613a968161385b565b600060208284031215613b2357600080fd5b5051919050565b600181811c90821680613b3e57607f821691505b602082108103612e8857634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115613b8757613b87613b5e565b500190565b6001600160a01b03929092168252602082015260400190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602080825260159082015274141c9bdd9a59195c8e881b9bdd08185b1b1bddd959605a1b604082015260600190565b600082821015613c1d57613c1d613b5e565b500390565b60208082526014908201527313585b9859d95c8e881b9bdd08185b1b1bddd95960621b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b600082613c9957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615613cb857613cb8613b5e565b500290565b600060ff821660ff8103613cd357613cd3613b5e565b60010192915050565b600060018201613cee57613cee613b5e565b5060010190565b600060208284031215613d0757600080fd5b8151610e63816139b1565b600181815b80851115613d4d578160001904821115613d3357613d33613b5e565b80851615613d4057918102915b93841c9390800290613d17565b509250929050565b600082613d6457506001610cfe565b81613d7157506000610cfe565b8160018114613d875760028114613d9157613dad565b6001915050610cfe565b60ff841115613da257613da2613b5e565b50506001821b610cfe565b5060208310610133831016604e8410600b8410161715613dd0575081810a610cfe565b613dda8383613d12565b8060001904821115613dee57613dee613b5e565b029392505050565b6000610e6360ff841683613d55565b600060208284031215613e1757600080fd5b815162ffffff81168114610e6357600080fd5b600060208284031215613e3c57600080fd5b81518015158114610e6357600080fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b601f821115611ef057600081815260208120601f850160051c81016020861015613ed45750805b601f850160051c820191505b81811015613ef357828155600101613ee0565b505050505050565b815167ffffffffffffffff811115613f1557613f1561390e565b613f2981613f238454613b2a565b84613ead565b602080601f831160018114613f5e5760008415613f465750858301515b600019600386901b1c1916600185901b178555613ef3565b600085815260208120601f198616915b82811015613f8d57888601518255948401946001909101908401613f6e565b5085821015613fab5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212203fb46c6eec2bc47e2675f61419e61770eff98e01d85e2675fb01fc79871d0a1a64736f6c634300080f0033

Deployed Bytecode

0x60806040526004361061039f5760003560e01c80638bc7e8c4116101de578063c63d75b611610103578063dd62ed3e1161009b578063dd62ed3e14610b28578063ddb56b2614610b48578063e322ad2b14610b68578063e941fa7814610b7d578063ec1c0a9914610b92578063ef8b30f714610a2a578063f2fde38b14610ba9578063f6326fb314610bc9578063fc7b9c1814610bd157600080fd5b8063c63d75b614610a08578063c6e6f59214610a2a578063c99f062f14610a4a578063ce96cb7714610a6b578063d463bc6514610a8b578063d4d2e7f214610aa0578063d574ea3d14610ad1578063d5f63a0614610af1578063d905777e14610b0857600080fd5b8063ac18de4311610176578063ac18de43146108c5578063ac1e5025146108e5578063af76d4bd14610905578063b3d7f6b914610925578063b3f0067414610945578063b460af9414610966578063b53d09581461098a578063ba08765214610966578063c4c2d9b9146109aa57600080fd5b80638bc7e8c4146107ee5780638da5cb5b1461080557806394bf804d146106ff57806395d89b4114610823578063982697dd14610838578063a457c2d714610859578063a8d1dbfb14610879578063a9059cbb14610890578063abaa9916146108b057600080fd5b8063490ae210116102c457806367a527931161025c57806367a52793146106e85780636e553f65146106ff57806370a0823114610722578063715018a61461074257806372890dbd1461075757806372ff8a3414610777578063767f06ae14610797578063796f69aa146107ae5780637c08b964146107ce57600080fd5b8063490ae210146105ef5780634bee2ba21461060f5780634c3531371461062f5780634cdad506146103f55780634ff173d71461064f578063588fbd9c1461066f578063596ff76e1461068f578063597c8910146106b05780635c975abb146106d057600080fd5b806323b872dd1161033757806323b872dd146104d15780632d06177a146104f1578063313ce5671461051157806338d52e0f1461052d578063395093511461054f5780633e99fdcd1461056f578063402d267d1461058f57806345d34def146105af5780634782f779146105cf57600080fd5b806301e1d114146103ab57806306fdde03146103d357806307a2d13a146103f5578063095ea7b3146104155780630a28a4771461044557806310ee4cb51461046557806312ee50571461048757806318160ddd1461049c5780631992a088146104b157600080fd5b366103a657005b600080fd5b3480156103b757600080fd5b506103c0610be8565b6040519081526020015b60405180910390f35b3480156103df57600080fd5b506103e8610c5f565b6040516103ca91906137ed565b34801561040157600080fd5b506103c0610410366004613842565b610cf1565b34801561042157600080fd5b50610435610430366004613870565b610d04565b60405190151581526020016103ca565b34801561045157600080fd5b506103c0610460366004613842565b610d1c565b34801561047157600080fd5b5061048561048036600461389c565b610d29565b005b34801561049357600080fd5b50610485610d9b565b3480156104a857600080fd5b506035546103c0565b3480156104bd57600080fd5b506104856104cc366004613842565b610e06565b3480156104dd57600080fd5b506104356104ec3660046138b9565b610e44565b3480156104fd57600080fd5b5061048561050c36600461389c565b610e6a565b34801561051d57600080fd5b50604051601281526020016103ca565b34801561053957600080fd5b50610542610ed9565b6040516103ca91906138fa565b34801561055b57600080fd5b5061043561056a366004613870565b610ee8565b34801561057b57600080fd5b5061048561058a366004613842565b610f0a565b34801561059b57600080fd5b506103c06105aa36600461389c565b610f48565b3480156105bb57600080fd5b506104856105ca366004613870565b610f66565b3480156105db57600080fd5b506103c06105ea366004613870565b6110b2565b3480156105fb57600080fd5b5061048561060a366004613842565b6113f7565b34801561061b57600080fd5b5061048561062a36600461389c565b611481565b34801561063b57600080fd5b5061048561064a3660046139c0565b611570565b34801561065b57600080fd5b5061048561066a366004613842565b611707565b34801561067b57600080fd5b5061048561068a36600461389c565b611715565b34801561069b57600080fd5b5061013954610542906001600160a01b031681565b3480156106bc57600080fd5b506104856106cb36600461389c565b61177c565b3480156106dc57600080fd5b5060c95460ff16610435565b3480156106f457600080fd5b506103c061012d5481565b34801561070b57600080fd5b506103c061071a366004613a71565b600092915050565b34801561072e57600080fd5b506103c061073d36600461389c565b6117e4565b34801561074e57600080fd5b506104856117ff565b34801561076357600080fd5b5061048561077236600461389c565b611813565b34801561078357600080fd5b50610485610792366004613870565b6118c0565b3480156107a357600080fd5b506103c061013b5481565b3480156107ba57600080fd5b506104856107c936600461389c565b61192c565b3480156107da57600080fd5b506104856107e936600461389c565b611993565b3480156107fa57600080fd5b506103c061012f5481565b34801561081157600080fd5b506097546001600160a01b0316610542565b34801561082f57600080fd5b506103e86119fa565b34801561084457600080fd5b5061013e54610542906001600160a01b031681565b34801561086557600080fd5b50610435610874366004613870565b611a09565b34801561088557600080fd5b506103c061012e5481565b34801561089c57600080fd5b506104356108ab366004613870565b611a8f565b3480156108bc57600080fd5b50610485611a9d565b3480156108d157600080fd5b506104856108e036600461389c565b611d60565b3480156108f157600080fd5b50610485610900366004613842565b611ddf565b34801561091157600080fd5b50610485610920366004613870565b611e6f565b34801561093157600080fd5b506103c0610940366004613842565b611ea9565b34801561095157600080fd5b5061013a54610542906001600160a01b031681565b34801561097257600080fd5b506103c0610981366004613aa1565b60009392505050565b34801561099657600080fd5b506104856109a5366004613870565b611eb6565b3480156109b657600080fd5b506109eb6109c536600461389c565b6101376020526000908152604090208054600182015460029092015460ff909116919083565b6040805193151584526020840192909252908201526060016103ca565b348015610a1457600080fd5b506103c0610a2336600461389c565b5060001990565b348015610a3657600080fd5b506103c0610a45366004613842565b611ef5565b348015610a5657600080fd5b5061013d54610542906001600160a01b031681565b348015610a7757600080fd5b506103c0610a8636600461389c565b611f02565b348015610a9757600080fd5b506103c0611f17565b348015610aac57600080fd5b50610435610abb36600461389c565b6101366020526000908152604090205460ff1681565b348015610add57600080fd5b50610542610aec366004613842565b611f46565b348015610afd57600080fd5b506103c061013f5481565b348015610b1457600080fd5b506103c0610b2336600461389c565b611f71565b348015610b3457600080fd5b506103c0610b43366004613ae3565b611f7c565b348015610b5457600080fd5b50610485610b633660046138b9565b611fa7565b348015610b7457600080fd5b506103c06121eb565b348015610b8957600080fd5b506104856122d2565b348015610b9e57600080fd5b506103c06101305481565b348015610bb557600080fd5b50610485610bc436600461389c565b61238a565b6103c0612400565b348015610bdd57600080fd5b506103c061013c5481565b6065546040516370a0823160e01b81526000916001600160a01b0316906370a0823190610c199030906004016138fa565b602060405180830381865afa158015610c36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5a9190613b11565b905090565b606060368054610c6e90613b2a565b80601f0160208091040260200160405190810160405280929190818152602001828054610c9a90613b2a565b8015610ce75780601f10610cbc57610100808354040283529160200191610ce7565b820191906000526020600020905b815481529060010190602001808311610cca57829003601f168201915b5050505050905090565b6000610cfe8260006126d8565b92915050565b600033610d1281858561279e565b5060019392505050565b6000610cfe8260016128c2565b610d31612971565b6001600160a01b038116610d4457600080fd5b61013d80546001600160a01b0319166001600160a01b0383161790556040517fa432db9ace1b934a63faa0623ff13bc2fd03dcd87ba64feb711abfcaba1f225a90610d909083906138fa565b60405180910390a150565b61013d60009054906101000a90046001600160a01b03166001600160a01b03166397d227666040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610dec57600080fd5b505af1158015610e00573d6000803e3d6000fd5b50505050565b610e0e612971565b6101308190556040518181527f96c657d16f9e2fd59288ff48fa375297a008a7c2bd8687d8df627cbb5f3f006290602001610d90565b600033610e528582856129cb565b610e5d858585612a3f565b60019150505b9392505050565b610e72612971565b6001600160a01b038116610e8557600080fd5b6001600160a01b0381166000908152610136602052604090819020805460ff19166001179055517f3b4a40cccf2058c593542587329dd385be4f0b588db5471fbd9598e56dd7093a90610d909083906138fa565b6065546001600160a01b031690565b600033610d12818585610efb8383611f7c565b610f059190613b74565b61279e565b610f12612971565b61012e8190556040518181527f1fcec621d2165ddad9f40f59774c48275fc2c031cf8141a4973e3b29a6bd53a190602001610d90565b6000610f52612bfb565b610f5d576000610cfe565b60001992915050565b610f6e612971565b6001600160a01b038216610f8157600080fd5b61013b546101385410610fd55760405162461bcd60e51b81526020600482015260176024820152761b585e081cdd1c985d1959da595cc8195e18d959591959604a1b60448201526064015b60405180910390fd5b604080516060810182526001808252602080830185815260008486018181526001600160a01b0389168083526101379094529581208551815460ff19169015151781559151828501559451600290910155610138805492830181559093527ff79a63dcec80ed75c82f36161f17b9c2f407860160383a7be0a0ee7962c527ae0180546001600160a01b03191690921790915561107383600019610d04565b507f2f564a83158ad1831793ad3e69257b52f39ece5d49cb0d8746708ecb9ef964da83836040516110a5929190613b8c565b60405180910390a1505050565b6000600260fb54036110d65760405162461bcd60e51b8152600401610fcc90613ba5565b600260fb556110e3612c15565b6097546001600160a01b03163314806111075750610132546001600160a01b031633145b6111235760405162461bcd60e51b8152600401610fcc90613bdc565b5080336111308183612c5b565b600061113a611f17565b9050838110156112e8576111566111518286613c0b565b612d97565b9250826000036112ce5761013d54604051630f610f1f60e31b81526001600160a01b0390911690637b0878f8906111939088908890600401613b8c565b600060405180830381600087803b1580156111ad57600080fd5b505af11580156111c1573d6000803e3d6000fd5b50505050600081111561127c576111d6610ed9565b6001600160a01b0316632e1a7d4d826040518263ffffffff1660e01b815260040161120391815260200190565b600060405180830381600087803b15801561121d57600080fd5b505af1158015611231573d6000803e3d6000fd5b5050505061123e84612e8e565b61013d546040519194506001600160a01b03169082156108fc029083906000818181858888f1935050505015801561127a573d6000803e3d6000fd5b505b60408051858152602081018690526001600160a01b03841691829182917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a483925050506113ec565b6112d781612e8e565b6112e19084613b74565b92506112f4565b6112f184612e8e565b92505b6113018361012f5461304e565b925061130b610ed9565b6001600160a01b0316632e1a7d4d846040518263ffffffff1660e01b815260040161133891815260200190565b600060405180830381600087803b15801561135257600080fd5b505af1158015611366573d6000803e3d6000fd5b50506040516001600160a01b038816925085156108fc02915085906000818181858888f193505050501580156113a0573d6000803e3d6000fd5b5060408051858152602081018590526001600160a01b03841691829182917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a450505b600160fb5592915050565b6113ff612971565b8061012e541161144b5760405162461bcd60e51b81526020600482015260176024820152766d6f7265207468616e206d61784465706f73697446656560481b6044820152606401610fcc565b61012d8190556040518181527f2a6f1084651542f3142c70f4c43c096d016a8b517c063660b146268f646ea43a90602001610d90565b336000908152610136602052604090205460ff166114b15760405162461bcd60e51b8152600401610fcc90613c22565b60006114bb611f17565b90506114c782826130a4565b60405163b6b55f2560e01b8152600481018290526001600160a01b0383169063b6b55f25906024016020604051808303816000875af115801561150e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115329190613b11565b507ff47c2ba90b71ef36b592a780f1d750d3a480494fdc7c9b84bb3f9d8de8a1b40a8282604051611564929190613b8c565b60405180910390a15050565b600054610100900460ff16158080156115905750600054600160ff909116105b806115aa5750303b1580156115aa575060005460ff166001145b61160d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610fcc565b6000805460ff191660011790558015611630576000805461ff0019166101001790555b611638613201565b611640613230565b61164861325f565b611652888861328e565b61165b846132bf565b33600081815261013660205260409020805460ff1916600117905561012e87905561013086905560ff841661013b5561013a80546001600160a01b0319908116909217905561013e80546001600160a01b038516921691909117905580156116fd576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b61170f612971565b61013b55565b61171d612971565b6001600160a01b03811661173057600080fd5b61013e80546001600160a01b0319166001600160a01b0383161790556040517f686f89a6ecbf2a3d59b997474f0c3924243521154529f47be3cbd9fd8859b8e690610d909083906138fa565b336000908152610136602052604090205460ff166117ac5760405162461bcd60e51b8152600401610fcc90613c22565b6001600160a01b038116600090815261013760205260409020600201546117e09082906117db90600a90613c0b565b6132ef565b5050565b6001600160a01b031660009081526033602052604090205490565b611807612971565b61181160006134a8565b565b336000908152610136602052604090205460ff166118435760405162461bcd60e51b8152600401610fcc90613c22565b6001600160a01b038116600090815261013760205260409020600201546118729082906117db90600a90613c0b565b506001600160a01b03811660009081526101376020526040902060020154600a106118bd576001600160a01b038116600090815261013760205260408120805460ff19168155600201555b50565b6118c8612971565b6001600160a01b0382166118db57600080fd5b6001600160a01b0382166000908152610137602052604090819020600101829055517f12550b3055a78afe91da1a02a6e99583200fe1b2f7f571269bb013ff3f7c05e8906115649084908490613b8c565b611934612971565b6001600160a01b03811661194757600080fd5b61013280546001600160a01b0319166001600160a01b0383161790556040517fa480657dfd615e3ba406b865a0da683507aeeb1b3e8206eb2c080bc1c0b23e8290610d909083906138fa565b61199b612971565b6001600160a01b0381166119ae57600080fd5b61013a80546001600160a01b0319166001600160a01b0383161790556040517f647672599d3468abcfa241a13c9e3d34383caadb5cc80fb67c3cdfcd5f78605990610d909083906138fa565b606060378054610c6e90613b2a565b60003381611a178286611f7c565b905083811015611a775760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610fcc565b611a84828686840361279e565b506001949350505050565b600033610d12818585612a3f565b336000908152610136602052604090205460ff16611acd5760405162461bcd60e51b8152600401610fcc90613c22565b60005b6101385460ff821610156118bd5761013760006101388360ff1681548110611afa57611afa613c50565b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff1615611d4e57600061013760006101388460ff1681548110611b4557611b45613c50565b60009182526020808320909101546001600160a01b0316835282810193909352604091820190208151606081018352815460ff161515815260018201549381018490526002909101549181019190915291508015611d4b57600061013c54611bab611f17565b611bb59190613b74565b90506000818460400151611bc99190613c7c565b611bd690620f4240613c9e565b905082811015611cf0576040840151600090620f4240611bf68686613c9e565b611c009190613c7c565b611c0a9190613c0b565b905080611c15611f17565b1115611cea57611c506101388760ff1681548110611c3557611c35613c50565b6000918252602090912001546001600160a01b0316826130a4565b6101388660ff1681548110611c6757611c67613c50565b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b031663de5f62686040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611cc4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ce89190613b11565b505b50611d48565b611d466101388660ff1681548110611d0a57611d0a613c50565b6000918252602090912001546001600160a01b0316620f4240611d2d8686613c9e565b611d379190613c7c565b86604001516117db9190613c0b565b505b50505b50505b80611d5881613cbd565b915050611ad0565b611d68612971565b6001600160a01b0381166000908152610136602052604090205460ff16611d8e57600080fd5b6001600160a01b0381166000908152610136602052604090819020805460ff19169055517fef69f7d97228658c92417be1b16b19058315de71fecb435d07b7d23728b6bd3190610d909083906138fa565b611de7612971565b806101305411611e395760405162461bcd60e51b815260206004820152601a60248201527f6d6f7265207468616e206d61785769746864726177616c4665650000000000006044820152606401610fcc565b61012f8190556040518181527ffc1353e6b18ce07b5a979c8edf77a87455939a17a9eebbb084dcde5bfb3b19ac90602001610d90565b336000908152610136602052604090205460ff16611e9f5760405162461bcd60e51b8152600401610fcc90613c22565b6114c782826130a4565b6000610cfe8260016126d8565b336000908152610136602052604090205460ff16611ee65760405162461bcd60e51b8152600401610fcc90613c22565b611ef082826132ef565b505050565b6000610cfe8260006128c2565b6000610cfe611f10836117e4565b60006126d8565b600061013f54611f25610be8565b11611f305750600090565b61013f54611f3c610be8565b610c5a9190613c0b565b6101388181548110611f5757600080fd5b6000918252602090912001546001600160a01b0316905081565b6000610cfe826117e4565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b336000908152610136602052604090205460ff16611fd75760405162461bcd60e51b8152600401610fcc90613c22565b6001600160a01b038316611fea57600080fd5b6001600160a01b038216611ffd57600080fd5b6001600160a01b038316600090815261013760205260409020600201548015612051576001600160a01b0384166000908152610137602052604090206002015461204f9085906117db90600a90613c0b565b505b6040805160608101825260018152602081018490526000918101829052905b6101385481101561217f57856001600160a01b0316610138828154811061209957612099613c50565b6000918252602090912001546001600160a01b031603612125578461013882815481106120c8576120c8613c50565b600091825260208083209190910180546001600160a01b0319166001600160a01b03948516179055918716815261013782526040908190208451815460ff191690151517815591840151600183015583015160029091015561216d565b60405162461bcd60e51b815260206004820152601b60248201527f696e76616c6964206f6c645374726174656779206164647265737300000000006044820152606401610fcc565b8061217781613cdc565b915050612070565b5061218b856000610d04565b5061219884600019610d04565b50604080516001600160a01b038088168252861660208201529081018490527ff55572e1238e3cef1cce627268598c0bcdc71b7316311157752ae0a2e920998c9060600160405180910390a15050505050565b6000805b6101385460ff821610156122bf57612205610ed9565b6001600160a01b03166370a082316101388360ff168154811061222a5761222a613c50565b6000918252602090912001546040516001600160e01b031960e084901b168152612260916001600160a01b0316906004016138fa565b602060405180830381865afa15801561227d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a19190613b11565b6122ab9083613b74565b9150806122b781613cbd565b9150506121ef565b506122c8611f17565b610c5a9082613b74565b6122da612971565b61013f5415611811576122eb610ed9565b6001600160a01b0316632e1a7d4d61013f546040518263ffffffff1660e01b815260040161231b91815260200190565b600060405180830381600087803b15801561233557600080fd5b505af1158015612349573d6000803e3d6000fd5b5050600061013f81905561013a546040516001600160a01b0390911693506108fc925081818181818888f193505050501580156118bd573d6000803e3d6000fd5b612392612971565b6001600160a01b0381166123f75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610fcc565b6118bd816134a8565b6000600260fb54036124245760405162461bcd60e51b8152600401610fcc90613ba5565b600260fb55612431612c15565b6097546001600160a01b03163314806124555750610132546001600160a01b031633145b6124715760405162461bcd60e51b8152600401610fcc90613bdc565b3334806124b15760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a5908185b5bdd5b9d60921b6044820152606401610fcc565b6124be8161012d5461304e565b9250600061013d60009054906101000a90046001600160a01b03166001600160a01b031663fc7b9c186040518163ffffffff1660e01b8152600401602060405180830381865afa158015612516573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061253a9190613b11565b61013d549091506001600160a01b031631811580159061255957508181105b1561261e57600085831061256d5785612577565b6125778284613c0b565b61013d546040519192506001600160a01b03169082156108fc029083906000818181858888f193505050501580156125b3573d6000803e3d6000fd5b506125bc610ed9565b6001600160a01b031663d0e30db06125d48387613c0b565b6040518263ffffffff1660e01b81526004016000604051808303818588803b1580156125ff57600080fd5b505af1158015612613573d6000803e3d6000fd5b50505050505061267a565b612626610ed9565b6001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561266057600080fd5b505af1158015612674573d6000803e3d6000fd5b50505050505b61268484866134fa565b60408051848152602081018790526001600160a01b0386169182917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a35050600160fb555090919050565b6000806126e460355490565b90508015612705576127006126f7610be8565b859083866135c7565b612796565b6065546040805163313ce56760e01b81529051612796926001600160a01b03169163313ce5679160048083019260209291908290030181865afa158015612750573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127749190613cf5565b61277f90600a613df6565b60125b61278d90600a613df6565b869190866135c7565b949350505050565b6001600160a01b0383166128005760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610fcc565b6001600160a01b0382166128615760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610fcc565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000806128ce60355490565b90508315806128db575080155b6128eb576127008161278d610be8565b6127966128fa6012600a613df6565b606560009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561294d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127829190613cf5565b6097546001600160a01b031633146118115760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610fcc565b60006129d78484611f7c565b90506000198114610e005781811015612a325760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610fcc565b610e00848484840361279e565b6001600160a01b038316612aa35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610fcc565b6001600160a01b038216612b055760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610fcc565b6001600160a01b03831660009081526033602052604090205481811015612b7d5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610fcc565b6001600160a01b03808516600090815260336020526040808220858503905591851681529081208054849290612bb4908490613b74565b92505081905550826001600160a01b0316846001600160a01b0316600080516020613fbc83398151915284604051612bee91815260200190565b60405180910390a3610e00565b600080612c06610be8565b1180610c5a5750506035541590565b60c95460ff16156118115760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610fcc565b6001600160a01b038216612cbb5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610fcc565b6001600160a01b03821660009081526033602052604090205481811015612d2f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610fcc565b6001600160a01b0383166000908152603360205260408120838303905560358054849290612d5e908490613c0b565b90915550506040518281526000906001600160a01b03851690600080516020613fbc8339815191529060200160405180910390a3505050565b6000805b6101385460ff82161015612e885761013760006101388360ff1681548110612dc557612dc5613c50565b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff168015612e3c57508261013760006101388460ff1681548110612e1157612e11613c50565b60009182526020808320909101546001600160a01b0316835282019290925260400190206002015410155b15612e7657610e636101388260ff1681548110612e5b57612e5b613c50565b6000918252602090912001546001600160a01b0316846132ef565b80612e8081613cbd565b915050612d9b565b50919050565b60008061013e60009054906101000a90046001600160a01b03166001600160a01b0316638ea97d266040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ee5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f099190613e05565b62ffffff16118015612f1b5750600082115b1561304a5761013e5460408051636131270f60e11b815290516000926001600160a01b03169163c2624e1e9160048083019260209291908290030181865afa158015612f6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f8f9190613e05565b62ffffff1661013e60009054906101000a90046001600160a01b03166001600160a01b0316638ea97d266040518163ffffffff1660e01b8152600401602060405180830381865afa158015612fe8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061300c9190613e05565b61301b9062ffffff1685613c9e565b6130259190613c7c565b90508061013f600082825461303a9190613b74565b90915550610e6390508184613c0b565b5090565b6000811561309d576000620f42406130668486613c9e565b6130709190613c7c565b905061307c8185613c0b565b91508061013f60008282546130919190613b74565b90915550610cfe915050565b5081610cfe565b600081116130ed5760405162461bcd60e51b81526020600482015260166024820152751a5b9d985b1a590819195c1bdcda5d08185b5bdd5b9d60521b6044820152606401610fcc565b60006130f7610ed9565b905081613102611f17565b10156131475760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b6044820152606401610fcc565b8161013c600082825461315a9190613b74565b90915550506001600160a01b038316600090815261013760205260408120600201805484929061318b908490613b74565b909155505060405163a9059cbb60e01b81526001600160a01b0382169063a9059cbb906131be9086908690600401613b8c565b6020604051808303816000875af11580156131dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e009190613e2a565b600054610100900460ff166132285760405162461bcd60e51b8152600401610fcc90613e4c565b611811613624565b600054610100900460ff166132575760405162461bcd60e51b8152600401610fcc90613e4c565b611811613654565b600054610100900460ff166132865760405162461bcd60e51b8152600401610fcc90613e4c565b611811613687565b600054610100900460ff166132b55760405162461bcd60e51b8152600401610fcc90613e4c565b6117e082826136b5565b600054610100900460ff166132e65760405162461bcd60e51b8152600401610fcc90613e4c565b6118bd816136f5565b600080821161333c5760405162461bcd60e51b81526020600482015260196024820152781a5b9d985b1a59081dda5d1a191c985dd85b08185b5bdd5b9d603a1b6044820152606401610fcc565b6001600160a01b038316600090815261013760205260409020600201548211156133a85760405162461bcd60e51b815260206004820152601f60248201527f696e73756666696369656e742061737365747320696e207374726174656779006044820152606401610fcc565b604051632e1a7d4d60e01b8152600481018390526000906001600160a01b03851690632e1a7d4d906024016020604051808303816000875af11580156133f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134169190613b11565b90508015610e63578261013c60008282546134319190613c0b565b90915550506001600160a01b0384166000908152610137602052604081206002018054859290613462908490613c0b565b90915550506040517fd442d8f1594fc5996caed833eb6135a4c223a05bdbed778c0d8415a52eb87fea906134999086908690613b8c565b60405180910390a19392505050565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0382166135505760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610fcc565b80603560008282546135629190613b74565b90915550506001600160a01b0382166000908152603360205260408120805483929061358f908490613b74565b90915550506040518181526001600160a01b03831690600090600080516020613fbc8339815191529060200160405180910390a35050565b6000806135d586868661373e565b905060018360028111156135eb576135eb613e97565b14801561360857506000848061360357613603613c66565b868809115b1561361b57613618600182613b74565b90505b95945050505050565b600054610100900460ff1661364b5760405162461bcd60e51b8152600401610fcc90613e4c565b611811336134a8565b600054610100900460ff1661367b5760405162461bcd60e51b8152600401610fcc90613e4c565b60c9805460ff19169055565b600054610100900460ff166136ae5760405162461bcd60e51b8152600401610fcc90613e4c565b600160fb55565b600054610100900460ff166136dc5760405162461bcd60e51b8152600401610fcc90613e4c565b60366136e88382613efb565b506037611ef08282613efb565b600054610100900460ff1661371c5760405162461bcd60e51b8152600401610fcc90613e4c565b606580546001600160a01b0319166001600160a01b0392909216919091179055565b60008080600019858709858702925082811083820303915050806000036137785783828161376e5761376e613c66565b0492505050610e63565b80841161378457600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b600060208083528351808285015260005b8181101561381a578581018301518582016040015282016137fe565b8181111561382c576000604083870101525b50601f01601f1916929092016040019392505050565b60006020828403121561385457600080fd5b5035919050565b6001600160a01b03811681146118bd57600080fd5b6000806040838503121561388357600080fd5b823561388e8161385b565b946020939093013593505050565b6000602082840312156138ae57600080fd5b8135610e638161385b565b6000806000606084860312156138ce57600080fd5b83356138d98161385b565b925060208401356138e98161385b565b929592945050506040919091013590565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261393557600080fd5b813567ffffffffffffffff808211156139505761395061390e565b604051601f8301601f19908116603f011681019082821181831017156139785761397861390e565b8160405283815286602085880101111561399157600080fd5b836020870160208301376000602085830101528094505050505092915050565b60ff811681146118bd57600080fd5b600080600080600080600060e0888a0312156139db57600080fd5b873567ffffffffffffffff808211156139f357600080fd5b6139ff8b838c01613924565b985060208a0135915080821115613a1557600080fd5b50613a228a828b01613924565b96505060408801359450606088013593506080880135613a418161385b565b925060a0880135613a51816139b1565b915060c0880135613a618161385b565b8091505092959891949750929550565b60008060408385031215613a8457600080fd5b823591506020830135613a968161385b565b809150509250929050565b600080600060608486031215613ab657600080fd5b833592506020840135613ac88161385b565b91506040840135613ad88161385b565b809150509250925092565b60008060408385031215613af657600080fd5b8235613b018161385b565b91506020830135613a968161385b565b600060208284031215613b2357600080fd5b5051919050565b600181811c90821680613b3e57607f821691505b602082108103612e8857634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115613b8757613b87613b5e565b500190565b6001600160a01b03929092168252602082015260400190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602080825260159082015274141c9bdd9a59195c8e881b9bdd08185b1b1bddd959605a1b604082015260600190565b600082821015613c1d57613c1d613b5e565b500390565b60208082526014908201527313585b9859d95c8e881b9bdd08185b1b1bddd95960621b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b600082613c9957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615613cb857613cb8613b5e565b500290565b600060ff821660ff8103613cd357613cd3613b5e565b60010192915050565b600060018201613cee57613cee613b5e565b5060010190565b600060208284031215613d0757600080fd5b8151610e63816139b1565b600181815b80851115613d4d578160001904821115613d3357613d33613b5e565b80851615613d4057918102915b93841c9390800290613d17565b509250929050565b600082613d6457506001610cfe565b81613d7157506000610cfe565b8160018114613d875760028114613d9157613dad565b6001915050610cfe565b60ff841115613da257613da2613b5e565b50506001821b610cfe565b5060208310610133831016604e8410600b8410161715613dd0575081810a610cfe565b613dda8383613d12565b8060001904821115613dee57613dee613b5e565b029392505050565b6000610e6360ff841683613d55565b600060208284031215613e1757600080fd5b815162ffffff81168114610e6357600080fd5b600060208284031215613e3c57600080fd5b81518015158114610e6357600080fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b601f821115611ef057600081815260208120601f850160051c81016020861015613ed45750805b601f850160051c820191505b81811015613ef357828155600101613ee0565b505050505050565b815167ffffffffffffffff811115613f1557613f1561390e565b613f2981613f238454613b2a565b84613ead565b602080601f831160018114613f5e5760008415613f465750858301515b600019600386901b1c1916600185901b178555613ef3565b600085815260208120601f198616915b82811015613f8d57888601518255948401946001909101908401613f6e565b5085821015613fab5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212203fb46c6eec2bc47e2675f61419e61770eff98e01d85e2675fb01fc79871d0a1a64736f6c634300080f0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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