ETH Price: $2,826.16 (-10.34%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AladdinCRVV2

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
istanbul EvmVersion
File 1 of 20 : AladdinCRVV2.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";

import "../../interfaces/concentrator/IAladdinCRV.sol";
import "../../interfaces/concentrator/IAladdinCompounder.sol";
import "../../interfaces/concentrator/IConcentratorStrategy.sol";
import "../../interfaces/IConvexBasicRewards.sol";
import "../../interfaces/IConvexCRVDepositor.sol";
import "../../interfaces/ICurveFactoryPlainPool.sol";
import "../../interfaces/ICvxCrvStakingWrapper.sol";
import "../../interfaces/IZap.sol";

import "../../common/fees/FeeCustomization.sol";
import "../ConcentratorBase.sol";

// solhint-disable no-empty-blocks, reason-string
contract AladdinCRVV2 is
  ERC20Upgradeable,
  OwnableUpgradeable,
  ReentrancyGuardUpgradeable,
  FeeCustomization,
  ConcentratorBase,
  IAladdinCRV,
  IAladdinCompounder
{
  using SafeMathUpgradeable for uint256;
  using SafeERC20Upgradeable for IERC20Upgradeable;

  /// @notice Emitted when pool assets migrated.
  /// @param _oldStrategy The address of old strategy.
  /// @param _newStrategy The address of current strategy.
  event MigrateStrategy(address _oldStrategy, address _newStrategy);

  /// @dev The type for withdraw fee, used in FeeCustomization.
  bytes32 internal constant WITHDRAW_FEE_TYPE = keccak256("AladdinCRV.WithdrawFee");

  /// @dev The maximum percentage of withdraw fee.
  uint256 private constant MAX_WITHDRAW_FEE = 1e8; // 10%

  /// @dev The maximum percentage of platform fee.
  uint256 private constant MAX_PLATFORM_FEE = 2e8; // 20%

  /// @dev The maximum percentage of harvest bounty.
  uint256 private constant MAX_HARVEST_BOUNTY = 1e8; // 10%

  /// @dev The address of cvxCRV token.
  address private constant CVXCRV = 0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7;

  /// @dev The address of CRV token.
  address private constant CRV = 0xD533a949740bb3306d119CC777fa900bA034cd52;

  /// @dev The address of CVX token.
  address private constant CVX = 0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B;

  /// @dev The address of Convex cvxCRV Staking Contract.
  address private constant CVXCRV_STAKING = 0x3Fe65692bfCD0e6CF84cB1E7d24108E434A7587e;

  /// @dev The address of Convex CRV => cvxCRV Contract.
  address private constant CRV_DEPOSITOR = 0x8014595F2AB54cD7c604B00E9fb932176fDc86Ae;

  /// @dev The address of Curve cvxCRV/CRV pool.
  address private immutable curveCvxCrvPool;

  /// @dev The token index for CRV in Curve cvxCRV/CRV pool.
  int128 private immutable poolIndexCRV;

  /// @dev The address of CvxCrvStakingWrapper contract.
  address private immutable wrapper;

  /// @notice The address of ZAP contract, will be used to swap tokens.
  address public zap;

  /// @notice The percentage of token to take on withdraw
  uint256 public withdrawFeePercentage;

  /// @notice The percentage of rewards to take for platform on harvest
  uint256 public platformFeePercentage;

  /// @notice The percentage of rewards to take for caller on harvest
  uint256 public harvestBountyPercentage;

  /// @notice The address of recipient of platform fee
  address public platform;

  /// @inheritdoc IAladdinCRV
  uint256 public override totalUnderlying;

  /// @notice The address of strategy.
  address public strategy;

  /// @notice The address of rewards depositor.
  address public depositor;

  receive() external payable {}

  constructor(address _curveCvxCrvPool, address _wrapper) {
    curveCvxCrvPool = _curveCvxCrvPool;
    address _token0 = ICurveFactoryPlainPool(_curveCvxCrvPool).coins(0);
    poolIndexCRV = _token0 == CRV ? 0 : 1;
    wrapper = _wrapper;
  }

  function initializeV2(address _strategy) external {
    require(strategy == address(0), "initialized");
    strategy = _strategy;

    // make sure harvest is called before upgrade.
    require(IConvexBasicRewards(CVXCRV_STAKING).earned(address(this)) == 0, "not harvested");

    // withdraw all cvxCRV from staking contract
    uint256 _totalUnderlying = IConvexBasicRewards(CVXCRV_STAKING).balanceOf(address(this));
    IConvexBasicRewards(CVXCRV_STAKING).withdraw(_totalUnderlying, false);

    // transfer all cvxCRV to strategy contract.
    IERC20Upgradeable(CVXCRV).safeTransfer(_strategy, _totalUnderlying);
    IConcentratorStrategy(_strategy).deposit(address(0), _totalUnderlying);
    totalUnderlying = _totalUnderlying;

    // approves
    IERC20Upgradeable(CRV).safeApprove(curveCvxCrvPool, uint256(-1));
    IERC20Upgradeable(CRV).safeApprove(CRV_DEPOSITOR, uint256(-1));
  }

  /********************************** View Functions **********************************/

  /// @inheritdoc IAladdinCRV
  /// @dev deprecated.
  function balanceOfUnderlying(address _user) external view override returns (uint256) {
    uint256 _totalSupply = totalSupply();
    if (_totalSupply == 0) return 0;
    uint256 _balance = balanceOf(_user);
    return _balance.mul(totalUnderlying) / _totalSupply;
  }

  /// @inheritdoc IAladdinCompounder
  function asset() external pure override returns (address) {
    return CVXCRV;
  }

  /// @inheritdoc IAladdinCompounder
  function totalAssets() public view override returns (uint256) {
    return totalUnderlying;
  }

  /// @inheritdoc IAladdinCompounder
  function convertToShares(uint256 _assets) public view override returns (uint256 shares) {
    uint256 _totalAssets = totalAssets();
    if (_totalAssets == 0) return _assets;

    uint256 _totalShares = totalSupply();
    return _totalShares.mul(_assets) / _totalAssets;
  }

  /// @inheritdoc IAladdinCompounder
  function convertToAssets(uint256 _shares) public view override returns (uint256) {
    uint256 _totalShares = totalSupply();
    if (_totalShares == 0) return _shares;

    uint256 _totalAssets = totalAssets();
    return _totalAssets.mul(_shares) / _totalShares;
  }

  /// @inheritdoc IAladdinCompounder
  function maxDeposit(address) external pure override returns (uint256) {
    return uint256(-1);
  }

  /// @inheritdoc IAladdinCompounder
  function previewDeposit(uint256 _assets) external view override returns (uint256) {
    return convertToShares(_assets);
  }

  /// @inheritdoc IAladdinCompounder
  function maxMint(address) external pure override returns (uint256) {
    return uint256(-1);
  }

  /// @inheritdoc IAladdinCompounder
  function previewMint(uint256 _shares) external view override returns (uint256) {
    return convertToAssets(_shares);
  }

  /// @inheritdoc IAladdinCompounder
  function maxWithdraw(address) external pure override returns (uint256) {
    return uint256(-1);
  }

  /// @inheritdoc IAladdinCompounder
  function previewWithdraw(uint256 _assets) external view override returns (uint256) {
    uint256 _totalAssets = totalAssets();
    require(_assets <= _totalAssets, "exceed total assets");
    uint256 _shares = convertToShares(_assets);
    if (_assets == _totalAssets) {
      return _shares;
    } else {
      return _shares.mul(FEE_PRECISION).div(FEE_PRECISION - withdrawFeePercentage);
    }
  }

  /// @inheritdoc IAladdinCompounder
  function maxRedeem(address) external pure override returns (uint256) {
    return uint256(-1);
  }

  /// @inheritdoc IAladdinCompounder
  function previewRedeem(uint256 _shares) external view override returns (uint256) {
    uint256 _totalSupply = totalSupply();
    require(_shares <= _totalSupply, "exceed total supply");

    uint256 _assets = convertToAssets(_shares);
    if (_shares == totalSupply()) {
      return _assets;
    } else {
      uint256 _withdrawFee = _assets.mul(withdrawFeePercentage) / FEE_PRECISION;
      return _assets - _withdrawFee;
    }
  }

  /********************************** Mutated Functions **********************************/

  /// @inheritdoc IAladdinCompounder
  function deposit(uint256 _assets, address _receiver) public override nonReentrant returns (uint256) {
    if (_assets == uint256(-1)) {
      _assets = IERC20Upgradeable(CVXCRV).balanceOf(msg.sender);
    }

    address _strategy = strategy;
    IERC20Upgradeable(CVXCRV).safeTransferFrom(msg.sender, _strategy, _assets);
    IConcentratorStrategy(_strategy).deposit(_receiver, _assets);

    return _deposit(_receiver, _assets);
  }

  /// @inheritdoc IAladdinCompounder
  function mint(uint256 _shares, address _receiver) external override nonReentrant returns (uint256) {
    uint256 _assets = convertToAssets(_shares);
    deposit(_assets, _receiver);
    return _assets;
  }

  /// @inheritdoc IAladdinCompounder
  function withdraw(
    uint256 _assets,
    address _receiver,
    address _owner
  ) external override nonReentrant returns (uint256) {
    if (_assets == uint256(-1)) {
      _assets = convertToAssets(balanceOf(_owner));
    }

    uint256 _totalAssets = totalAssets();
    require(_assets <= _totalAssets, "exceed total assets");

    uint256 _shares = convertToShares(_assets);
    if (_assets < _totalAssets) {
      uint256 _withdrawPercentage = getFeeRate(WITHDRAW_FEE_TYPE, _owner);
      _shares = _shares.mul(FEE_PRECISION).div(FEE_PRECISION - _withdrawPercentage);
    }

    if (msg.sender != _owner) {
      uint256 _allowance = allowance(_owner, msg.sender);
      require(_allowance >= _shares, "withdraw exceeds allowance");
      if (_allowance != uint256(-1)) {
        // decrease allowance if it is not max
        _approve(_owner, msg.sender, _allowance - _shares);
      }
    }

    _withdraw(_shares, _receiver, _owner);
    return _shares;
  }

  /// @inheritdoc IAladdinCompounder
  function redeem(
    uint256 _shares,
    address _receiver,
    address _owner
  ) public override nonReentrant returns (uint256) {
    if (_shares == uint256(-1)) {
      _shares = balanceOf(_owner);
    }

    if (msg.sender != _owner) {
      uint256 _allowance = allowance(_owner, msg.sender);
      require(_allowance >= _shares, "redeem exceeds allowance");
      if (_allowance != uint256(-1)) {
        // decrease allowance if it is not max
        _approve(_owner, msg.sender, _allowance - _shares);
      }
    }

    return _withdraw(_shares, _receiver, _owner);
  }

  /// @inheritdoc IAladdinCRV
  /// @dev deprecated.
  function deposit(address _recipient, uint256 _amount) public override returns (uint256) {
    return deposit(_amount, _recipient);
  }

  /// @inheritdoc IAladdinCRV
  /// @dev deprecated.
  function depositAll(address _recipient) external override returns (uint256) {
    return deposit(uint256(-1), _recipient);
  }

  /// @inheritdoc IAladdinCRV
  function depositWithCRV(address _recipient, uint256 _amount) public override nonReentrant returns (uint256) {
    if (_amount == uint256(-1)) {
      _amount = IERC20Upgradeable(CRV).balanceOf(msg.sender);
    }
    IERC20Upgradeable(CRV).safeTransferFrom(msg.sender, address(this), _amount);

    address _strategy = strategy;
    _amount = _swapCRVToCvxCRV(_amount, _strategy);
    IConcentratorStrategy(_strategy).deposit(_recipient, _amount);

    return _deposit(_recipient, _amount);
  }

  /// @inheritdoc IAladdinCRV
  /// @dev deprecated.
  function depositAllWithCRV(address _recipient) external override returns (uint256) {
    return depositWithCRV(_recipient, uint256(-1));
  }

  /// @notice Deposit cvxCRV staking wrapper token to this contract
  /// @param _recipient - The address who will receive the aCRV token.
  /// @param _amount - The amount of cvxCRV staking wrapper to deposit.
  /// @return share - The amount of aCRV received.
  function depositWithWrapper(address _recipient, uint256 _amount) external returns (uint256) {
    if (_amount == uint256(-1)) {
      _amount = IERC20Upgradeable(wrapper).balanceOf(msg.sender);
    }
    IERC20Upgradeable(wrapper).safeTransferFrom(msg.sender, strategy, _amount);
    return _deposit(_recipient, _amount);
  }

  /// @inheritdoc IAladdinCRV
  /// @dev deprecated.
  function withdraw(
    address _recipient,
    uint256 _shares,
    uint256 _minimumOut,
    WithdrawOption _option
  ) public override nonReentrant returns (uint256 _withdrawed) {
    if (_shares == uint256(-1)) {
      _shares = balanceOf(msg.sender);
    }

    if (_option == WithdrawOption.Withdraw) {
      _withdrawed = _withdraw(_shares, _recipient, msg.sender);
      require(_withdrawed >= _minimumOut, "AladdinCRV: insufficient output");
    } else {
      _withdrawed = _withdraw(_shares, address(this), msg.sender);
      _withdrawed = _withdrawAs(_recipient, _withdrawed, _minimumOut, _option);
    }

    // legacy event from IAladdinCRV
    emit Withdraw(msg.sender, _recipient, _shares, _option);
  }

  /// @inheritdoc IAladdinCRV
  /// @dev deprecated.
  function withdrawAll(
    address _recipient,
    uint256 _minimumOut,
    WithdrawOption _option
  ) external override returns (uint256) {
    return withdraw(_recipient, uint256(-1), _minimumOut, _option);
  }

  /// @inheritdoc IAladdinCompounder
  function harvest(address _recipient, uint256 _minimumOut)
    public
    override(IAladdinCRV, IAladdinCompounder)
    nonReentrant
    returns (uint256)
  {
    ensureCallerIsHarvester();

    return _harvest(_recipient, _minimumOut);
  }

  /// @notice Deposit and notify new rewards.
  /// @param _amount The amount of rewards to deposit.
  function depositReward(uint256 _amount) external {
    require(depositor == msg.sender, "only reward depositor");

    address _strategy = strategy;
    IERC20Upgradeable(CVXCRV).safeTransferFrom(msg.sender, _strategy, _amount);
    IConcentratorStrategy(_strategy).deposit(address(this), _amount);

    totalUnderlying += _amount;
  }

  /********************************** Restricted Functions **********************************/

  /// @notice Update the withdraw fee percentage.
  /// @param _feePercentage - The fee percentage to update.
  function updateWithdrawFeePercentage(uint256 _feePercentage) external onlyOwner {
    require(_feePercentage <= MAX_WITHDRAW_FEE, "AladdinCRV: fee too large");
    withdrawFeePercentage = _feePercentage;

    emit UpdateWithdrawalFeePercentage(_feePercentage);
  }

  /// @notice Update the platform fee percentage.
  /// @param _feePercentage - The fee percentage to update.
  function updatePlatformFeePercentage(uint256 _feePercentage) external onlyOwner {
    require(_feePercentage <= MAX_PLATFORM_FEE, "AladdinCRV: fee too large");
    platformFeePercentage = _feePercentage;

    emit UpdatePlatformFeePercentage(_feePercentage);
  }

  /// @notice Update the harvest bounty percentage.
  /// @param _percentage - The fee percentage to update.
  function updateHarvestBountyPercentage(uint256 _percentage) external onlyOwner {
    require(_percentage <= MAX_HARVEST_BOUNTY, "AladdinCRV: fee too large");
    harvestBountyPercentage = _percentage;

    emit UpdateHarvestBountyPercentage(_percentage);
  }

  /// @notice Update the recipient
  function updatePlatform(address _platform) external onlyOwner {
    require(_platform != address(0), "AladdinCRV: zero platform address");
    platform = _platform;

    emit UpdatePlatform(_platform);
  }

  /// @notice Update the zap contract
  function updateZap(address _zap) external onlyOwner {
    require(_zap != address(0), "AladdinCRV: zero zap address");
    zap = _zap;

    emit UpdateZap(_zap);
  }

  /// @notice Update the harvester contract
  /// @param _harvester The address of the harvester contract.
  function updateHarvester(address _harvester) external onlyOwner {
    _updateHarvester(_harvester);
  }

  /// @notice Update the address of reward depositor.
  /// @param _depositor The address of reward depositor.
  function updateDepositor(address _depositor) external onlyOwner {
    depositor = _depositor;
  }

  /// @notice Migrate pool assets to new strategy.
  /// @param _newStrategy The address of new strategy.
  function migrateStrategy(address _newStrategy) external onlyOwner {
    require(_newStrategy != address(0), "AladdinCRV: zero new strategy address");

    uint256 _totalUnderlying = totalUnderlying;
    address _oldStrategy = strategy;
    strategy = _newStrategy;

    IConcentratorStrategy(_oldStrategy).prepareMigrate(_newStrategy);
    IConcentratorStrategy(_oldStrategy).withdraw(_newStrategy, _totalUnderlying);
    IConcentratorStrategy(_oldStrategy).finishMigrate(_newStrategy);

    IConcentratorStrategy(_newStrategy).deposit(address(this), _totalUnderlying);

    emit MigrateStrategy(_oldStrategy, _newStrategy);
  }

  /// @notice Update rewards list of underlying strategy.
  /// @param newRewards The list of addresses of new rewards.
  function updateStrategyRewards(address[] memory newRewards) external onlyOwner {
    IConcentratorStrategy(strategy).updateRewards(newRewards);
  }

  /// @notice Update withdraw fee for certain user.
  /// @param _user The address of user to update.
  /// @param _percentage The withdraw fee percentage to be updated, multipled by 1e9.
  function setWithdrawFeeForUser(address _user, uint32 _percentage) external onlyOwner {
    require(_percentage <= MAX_WITHDRAW_FEE, "withdraw fee too large");

    _setFeeCustomization(WITHDRAW_FEE_TYPE, _user, _percentage);
  }

  /********************************** Internal Functions **********************************/

  function _deposit(address _recipient, uint256 _amount) internal returns (uint256) {
    require(_amount > 0, "AladdinCRV: zero amount deposit");
    uint256 _totalUnderlying = totalUnderlying;
    uint256 _totalSupply = totalSupply();

    uint256 _shares;
    if (_totalSupply == 0) {
      _shares = _amount;
    } else {
      _shares = _amount.mul(_totalSupply) / _totalUnderlying;
    }
    _mint(_recipient, _shares);
    totalUnderlying = _totalUnderlying + _amount;

    // legacy event from IAladdinCRV
    emit Deposit(msg.sender, _recipient, _amount);

    emit Deposit(msg.sender, _recipient, _amount, _shares);
    return _shares;
  }

  function _withdraw(
    uint256 _shares,
    address _receiver,
    address _owner
  ) internal returns (uint256 _withdrawable) {
    require(_shares > 0, "AladdinCRV: zero share withdraw");
    require(_shares <= balanceOf(_owner), "AladdinCRV: shares not enough");
    uint256 _totalUnderlying = totalUnderlying;
    uint256 _amount = _shares.mul(_totalUnderlying) / totalSupply();
    _burn(_owner, _shares);

    if (totalSupply() == 0) {
      // If user is last to withdraw, harvest before exit
      // The first parameter is actually not used.
      _harvest(msg.sender, 0);
      _totalUnderlying = totalUnderlying; // `totalUnderlying` is updated in `_harvest`.
      _withdrawable = _totalUnderlying;
      IConcentratorStrategy(strategy).withdraw(_receiver, _withdrawable);
    } else {
      // Otherwise compute share and unstake
      _withdrawable = _amount;
      // Substract a small withdrawal fee to prevent users "timing"
      // the harvests. The fee stays staked and is therefore
      // redistributed to all remaining participants.
      uint256 _withdrawFeePercentage = getFeeRate(WITHDRAW_FEE_TYPE, _owner);
      uint256 _withdrawFee = (_withdrawable * _withdrawFeePercentage) / FEE_PRECISION;
      _withdrawable = _withdrawable - _withdrawFee; // never overflow here
      IConcentratorStrategy(strategy).withdraw(_receiver, _withdrawable);
    }
    totalUnderlying = _totalUnderlying - _withdrawable;

    emit Withdraw(msg.sender, _receiver, _owner, _withdrawable, _shares);

    return _withdrawable;
  }

  function _withdrawAs(
    address _recipient,
    uint256 _amount,
    uint256 _minimumOut,
    WithdrawOption _option
  ) internal returns (uint256) {
    if (_option == WithdrawOption.WithdrawAndStake) {
      // simply stake the cvxCRV for _recipient
      require(_amount >= _minimumOut, "AladdinCRV: insufficient output");
      IERC20Upgradeable(CVXCRV).safeApprove(wrapper, 0);
      IERC20Upgradeable(CVXCRV).safeApprove(wrapper, _amount);
      ICvxCrvStakingWrapper(wrapper).stakeFor(_recipient, _amount);
    } else {
      address _toToken;
      if (_option == WithdrawOption.WithdrawAsCRV) _toToken = CRV;
      else if (_option == WithdrawOption.WithdrawAsETH) _toToken = address(0);
      else if (_option == WithdrawOption.WithdrawAsCVX) _toToken = CVX;
      else revert("AladdinCRV: unsupported option");

      address _zap = zap;
      IERC20Upgradeable(CVXCRV).safeTransfer(_zap, _amount);
      _amount = IZap(_zap).zap(CVXCRV, _amount, _toToken, _minimumOut);

      if (_toToken == address(0)) {
        // solhint-disable-next-line avoid-low-level-calls
        (bool success, ) = _recipient.call{ value: _amount }("");
        require(success, "AladdinCRV: ETH transfer failed");
      } else {
        IERC20Upgradeable(_toToken).safeTransfer(_recipient, _amount);
      }
    }
    return _amount;
  }

  function _harvest(address _recipient, uint256 _minimumOut) internal returns (uint256) {
    address _strategy = strategy;

    // harvest CRV from strategy
    uint256 _amountCRV = IConcentratorStrategy(_strategy).harvest(zap, CRV);
    // swap CRV to cvxCRV
    uint256 _amount = _swapCRVToCvxCRV(_amountCRV, _strategy);
    require(_amount >= _minimumOut, "AladdinCRV: insufficient rewards");
    // send back to strategy
    IConcentratorStrategy(_strategy).deposit(address(0), _amount);

    // legacy event from IAladdinCRV
    emit Harvest(msg.sender, _amount);

    // distribute fee and bounty
    uint256 _totalSupply = totalSupply();
    uint256 _platformFee = platformFeePercentage;
    uint256 _harvestBounty = harvestBountyPercentage;
    if (_platformFee > 0) {
      _platformFee = (_platformFee * _amount) / FEE_PRECISION;
    }
    if (_harvestBounty > 0) {
      _harvestBounty = (_harvestBounty * _amount) / FEE_PRECISION;
    }
    uint256 _stakeAmount = _amount - _platformFee - _harvestBounty; // never overflow here
    // This is the amount of underlying after staking harvested rewards.
    uint256 _underlying = totalUnderlying + _stakeAmount;
    // This is the share for platform fee.
    _platformFee = (_platformFee * _totalSupply) / _underlying;
    // This is the share for harvest bounty.
    _harvestBounty = (_harvestBounty * _totalSupply) / _underlying;

    emit Harvest(msg.sender, _recipient, _amount, _platformFee, _harvestBounty);

    _mint(platform, _platformFee);
    _mint(_recipient, _harvestBounty);

    totalUnderlying += _amount;
    return _amount;
  }

  /// @dev Internal function to swap CRV to cvxCRV
  /// @param _amountIn The amount of CRV to swap.
  /// @param _recipient The address of recipient who will recieve the cvxCRV.
  function _swapCRVToCvxCRV(uint256 _amountIn, address _recipient) internal returns (uint256) {
    // CRV swap to CVXCRV or stake to CVXCRV
    // CRV swap to CVXCRV or stake to CVXCRV
    uint256 _amountOut = ICurveFactoryPlainPool(curveCvxCrvPool).get_dy(poolIndexCRV, 1 - poolIndexCRV, _amountIn);
    bool useCurve = _amountOut > _amountIn;

    if (useCurve) {
      IERC20Upgradeable(CRV).safeApprove(curveCvxCrvPool, 0);
      IERC20Upgradeable(CRV).safeApprove(curveCvxCrvPool, _amountIn);
      _amountOut = ICurveFactoryPlainPool(curveCvxCrvPool).exchange(
        poolIndexCRV,
        1 - poolIndexCRV,
        _amountIn,
        0,
        _recipient
      );
    } else {
      uint256 _lockIncentive = IConvexCRVDepositor(CRV_DEPOSITOR).lockIncentive();
      // if use `lock = false`, will possible take fee
      // if use `lock = true`, some incentive will be given
      _amountOut = IERC20Upgradeable(CVXCRV).balanceOf(address(this));
      if (_lockIncentive == 0) {
        // no lock incentive, use `lock = false`
        IConvexCRVDepositor(CRV_DEPOSITOR).deposit(_amountIn, false, address(0));
      } else {
        // no lock incentive, use `lock = true`
        IConvexCRVDepositor(CRV_DEPOSITOR).deposit(_amountIn, true, address(0));
      }
      _amountOut = IERC20Upgradeable(CVXCRV).balanceOf(address(this)) - _amountOut; // never overflow here
      if (_recipient != address(this)) {
        IERC20Upgradeable(CVXCRV).safeTransfer(_recipient, _amountOut);
      }
    }
    return _amountOut;
  }

  /// @inheritdoc FeeCustomization
  function _defaultFeeRate(bytes32) internal view override returns (uint256) {
    return withdrawFeePercentage;
  }
}

File 2 of 20 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/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 initializer {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal initializer {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

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

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

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

File 3 of 20 : SafeMathUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 4 of 20 : Initializable.sol
// SPDX-License-Identifier: MIT

// solhint-disable-next-line compiler-version
pragma solidity >=0.4.24 <0.8.0;

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 a proxied contract can't have 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.
 *
 * 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 {UpgradeableProxy-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.
 */
abstract contract Initializable {

    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /// @dev Returns true if and only if the function is running in the constructor
    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 5 of 20 : ERC20Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "../../utils/ContextUpgradeable.sol";
import "./IERC20Upgradeable.sol";
import "../../math/SafeMathUpgradeable.sol";
import "../../proxy/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 guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable {
    using SafeMathUpgradeable for uint256;

    mapping (address => uint256) private _balances;

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

    uint256 private _totalSupply;

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

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

    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer {
        _name = name_;
        _symbol = symbol_;
        _decimals = 18;
    }

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

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

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(sender, recipient, amount);

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

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

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

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

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

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

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

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

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

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

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

File 6 of 20 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

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

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

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

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

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

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

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

File 7 of 20 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "./IERC20Upgradeable.sol";
import "../../math/SafeMathUpgradeable.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 SafeMathUpgradeable for uint256;
    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'
        // solhint-disable-next-line max-line-length
        require((value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

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

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

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

File 8 of 20 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

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

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

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

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

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

File 9 of 20 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;
import "../proxy/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 GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal initializer {
        __Context_init_unchained();
    }

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

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

File 10 of 20 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;
import "../proxy/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 initializer {
        __ReentrancyGuard_init_unchained();
    }

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

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

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

        _;

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

File 11 of 20 : FeeCustomization.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

// solhint-disable no-inline-assembly

abstract contract FeeCustomization {
  /// @notice Emitted when a fee customization is set.
  /// @param _feeType The type of fee to set.
  /// @param _user The address of user to set.
  /// @param _rate The fee rate for the user.
  event CustomizeFee(bytes32 _feeType, address _user, uint256 _rate);

  /// @notice Emitted when a fee customization is cancled.
  /// @param _feeType The type of fee to cancle.
  /// @param _user The address of user to cancle.
  event CancleCustomizeFee(bytes32 _feeType, address _user);

  /// @dev The fee denominator used for rate calculation.
  uint256 internal constant FEE_PRECISION = 1e9;

  /// @dev The salt used to compute storage slot.
  bytes32 private constant SALT = keccak256("FeeCustomization");

  /// @notice Return the fee rate for the user
  /// @param _feeType The type of fee to query.
  /// @param _user The address of user to query.
  /// @return rate The rate of fee for the user, multiplied by 1e9
  function getFeeRate(bytes32 _feeType, address _user) public view returns (uint256 rate) {
    rate = _defaultFeeRate(_feeType);

    (uint8 _customized, uint32 _rate) = _loadFeeCustomization(_feeType, _user);
    if (_customized == 1) {
      rate = _rate;
    }
  }

  /// @dev Internal function to set customized fee for user.
  /// @param _feeType The type of fee to update.
  /// @param _user The address of user to update.
  /// @param _rate The fee rate to update.
  function _setFeeCustomization(
    bytes32 _feeType,
    address _user,
    uint32 _rate
  ) internal {
    require(_rate <= FEE_PRECISION, "rate too large");

    uint256 _slot = _computeStorageSlot(_feeType, _user);
    uint256 _encoded = _encode(1, _rate);
    assembly {
      sstore(_slot, _encoded)
    }

    emit CustomizeFee(_feeType, _user, _rate);
  }

  /// @dev Internal function to cancel fee customization.
  /// @param _feeType The type of fee to update.
  /// @param _user The address of user to update.
  function _cancleFeeCustomization(bytes32 _feeType, address _user) internal {
    uint256 _slot = _computeStorageSlot(_feeType, _user);
    assembly {
      sstore(_slot, 0)
    }

    emit CancleCustomizeFee(_feeType, _user);
  }

  /// @dev Return the default fee rate for certain type.
  /// @param _feeType The type of fee to query.
  /// @return rate The default rate of fee, multiplied by 1e9
  function _defaultFeeRate(bytes32 _feeType) internal view virtual returns (uint256 rate);

  /// @dev Internal function to load fee customization from storage.
  /// @param _feeType The type of fee to query.
  /// @param _user The address of user to query.
  /// @return customized Whether there is a customization.
  /// @return rate The customized fee rate, multiplied by 1e9.
  function _loadFeeCustomization(bytes32 _feeType, address _user) private view returns (uint8 customized, uint32 rate) {
    uint256 _slot = _computeStorageSlot(_feeType, _user);
    uint256 _encoded;
    assembly {
      _encoded := sload(_slot)
    }
    (customized, rate) = _decode(_encoded);
  }

  /// @dev Internal function to compute storage slot for fee storage.
  /// @param _feeType The type of fee.
  /// @param _user The address of user.
  /// @return slot The destination storage slot.
  function _computeStorageSlot(bytes32 _feeType, address _user) private pure returns (uint256 slot) {
    bytes32 salt = SALT;
    assembly {
      mstore(0x00, _feeType)
      mstore(0x20, xor(_user, salt))
      slot := keccak256(0x00, 0x40)
    }
  }

  /// @dev Internal function to encode customized fee data. The encoding is
  /// low ---------------------> high
  /// |   8 bits   | 32 bits | 216 bits |
  /// | customized |   rate  | reserved |
  ///
  /// @param customized If it is 0, there is no customization; if it is 1, there is customization.
  /// @param rate The customized fee rate, multiplied by 1e9.
  function _encode(uint8 customized, uint32 rate) private pure returns (uint256 encoded) {
    encoded = (uint256(rate) << 8) | uint256(customized);
  }

  /// @dev Internal function to decode data.
  /// @param _encoded The data to decode.
  /// @return customized Whether there is a customization.
  /// @return rate The customized fee rate, multiplied by 1e9.
  function _decode(uint256 _encoded) private pure returns (uint8 customized, uint32 rate) {
    customized = uint8(_encoded & 0xff);
    rate = uint32((_encoded >> 8) & 0xffffffff);
  }
}

File 12 of 20 : ConcentratorBase.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

// solhint-disable no-inline-assembly

contract ConcentratorBase {
  /**********
   * Events *
   **********/

  /// @notice Emitted when the harvester contract is updated.
  /// @param _harvester The address of the harvester contract.
  event UpdateHarvester(address _harvester);

  /// @notice Emitted when the zap contract is updated.
  /// @param _zap The address of the zap contract.
  event UpdateZap(address _zap);

  /*************
   * Constants *
   *************/

  /// @dev The storage slot for harvester storage.
  bytes32 private constant CONCENTRATOR_STORAGE_POSITION = keccak256("concentrator.base.storage");

  /***********
   * Structs *
   ***********/

  struct BaseStorage {
    address harvester;
    uint256[100] gaps;
  }

  /**********************
   * Internal Functions *
   **********************/

  function baseStorage() internal pure returns (BaseStorage storage bs) {
    bytes32 position = CONCENTRATOR_STORAGE_POSITION;
    assembly {
      bs.slot := position
    }
  }

  function _updateHarvester(address _harvester) internal {
    baseStorage().harvester = _harvester;

    emit UpdateHarvester(_harvester);
  }

  function ensureCallerIsHarvester() internal view {
    address _harvester = baseStorage().harvester;

    require(_harvester == address(0) || _harvester == msg.sender, "only harvester");
  }
}

File 13 of 20 : IAladdinCompounder.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

/// @title IAladdinCompounder
/// @notice The interface for AladdinCompounder like aCRV, aFXS, and is also EIP4646 compatible.
interface IAladdinCompounder {
  /// @notice Emitted when someone deposits asset into this contract.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  /// @param sender The address who sends underlying asset.
  /// @param owner The address who will receive the pool shares.
  /// @param assets The amount of asset deposited.
  /// @param shares The amounf of pool shares received.
  event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);

  /// @notice Emitted when someone withdraws asset from this contract.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  /// @param sender The address who call the function.
  /// @param receiver The address who will receive the assets.
  /// @param owner The address who owns the assets.
  /// @param assets The amount of asset withdrawn.
  /// @param shares The amounf of pool shares to withdraw.
  event Withdraw(
    address indexed sender,
    address indexed receiver,
    address indexed owner,
    uint256 assets,
    uint256 shares
  );

  /// @notice Emitted when someone harvests rewards.
  /// @param caller The address who call the function.
  /// @param recipient The address of account to recieve the harvest bounty.
  /// @param assets The total amount of underlying asset harvested.
  /// @param platformFee The amount of harvested assets as platform fee.
  /// @param harvestBounty The amount of harvested assets as harvest bounty.
  event Harvest(
    address indexed caller,
    address indexed recipient,
    uint256 assets,
    uint256 platformFee,
    uint256 harvestBounty
  );

  /// @notice Return the address of underlying assert.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  function asset() external view returns (address assetTokenAddress);

  /// @notice Return the total amount of underlying assert mananged by the contract.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  function totalAssets() external view returns (uint256 totalManagedAssets);

  /// @notice Return the amount of pool shares given the amount of asset.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  /// @param assets The amount of asset to convert.
  function convertToShares(uint256 assets) external view returns (uint256 shares);

  /// @notice Return the amount of asset given the amount of pool share.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  /// @param assets The amount of pool shares to convert.
  function convertToAssets(uint256 shares) external view returns (uint256 assets);

  /// @notice Return the maximum amount of asset that the user can deposit.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  /// @param receiver The address of user to receive the pool share.
  function maxDeposit(address receiver) external view returns (uint256 maxAssets);

  /// @notice Return the amount of pool shares will receive, if perform a deposit.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  /// @param assets The amount of asset to deposit.
  function previewDeposit(uint256 assets) external view returns (uint256 shares);

  /// @notice Deposit assets into this contract.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  /// @param assets The amount of asset to deposit.
  /// @param receiver The address of account who will receive the pool share.
  /// @return shares The amount of pool shares received.
  function deposit(uint256 assets, address receiver) external returns (uint256 shares);

  /// @notice Return the maximum amount of pool shares that the user can mint.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  /// @param receiver The address of user to receive the pool share.
  function maxMint(address receiver) external view returns (uint256 maxShares);

  /// @notice Return the amount of assets needed, if perform a mint.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  /// @param shares The amount of pool shares to mint.
  function previewMint(uint256 shares) external view returns (uint256 assets);

  /// @notice Mint pool shares from this contract.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  /// @param shares The amount of pool shares to mint.
  /// @param receiver The address of account who will receive the pool share.
  /// @return assets The amount of assets deposited to the contract.
  function mint(uint256 shares, address receiver) external returns (uint256 assets);

  /// @notice Return the maximum amount of assets that the user can withdraw.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  /// @param owner The address of user to withdraw from.
  function maxWithdraw(address owner) external view returns (uint256 maxAssets);

  /// @notice Return the amount of shares needed, if perform a withdraw.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  /// @param assets The amount of assets to withdraw.
  function previewWithdraw(uint256 assets) external view returns (uint256 shares);

  /// @notice Withdraw assets from this contract.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  /// @param assets The amount of assets to withdraw.
  /// @param receiver The address of account who will receive the assets.
  /// @param owner The address of user to withdraw from.
  /// @return shares The amount of pool shares burned.
  function withdraw(
    uint256 assets,
    address receiver,
    address owner
  ) external returns (uint256 shares);

  /// @notice Return the maximum amount of pool shares that the user can redeem.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  /// @param owner The address of user to redeem from.
  function maxRedeem(address owner) external view returns (uint256 maxShares);

  /// @notice Return the amount of assets to be received, if perform a redeem.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  /// @param shares The amount of pool shares to redeem.
  function previewRedeem(uint256 shares) external view returns (uint256 assets);

  /// @notice Redeem assets from this contract.
  /// @dev See https://eips.ethereum.org/EIPS/eip-4626
  /// @param shares The amount of pool shares to burn.
  /// @param receiver The address of account who will receive the assets.
  /// @param owner The address of user to withdraw from.
  /// @return assets The amount of assets withdrawn.
  function redeem(
    uint256 shares,
    address receiver,
    address owner
  ) external returns (uint256 assets);

  /// @notice Harvest rewards and convert to underlying asset.
  /// @param recipient The address of account to recieve the harvest bounty.
  /// @param minAssets The minimum amount of underlying asset harvested.
  /// @return assets The total amount of underlying asset harvested.
  function harvest(address recipient, uint256 minAssets) external returns (uint256 assets);
}

File 14 of 20 : IAladdinCRV.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

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

interface IAladdinCRV is IERC20Upgradeable {
  event Harvest(address indexed _caller, uint256 _amount);
  event Deposit(address indexed _sender, address indexed _recipient, uint256 _amount);
  event Withdraw(
    address indexed _sender,
    address indexed _recipient,
    uint256 _shares,
    IAladdinCRV.WithdrawOption _option
  );

  event UpdateWithdrawalFeePercentage(uint256 _feePercentage);
  event UpdatePlatformFeePercentage(uint256 _feePercentage);
  event UpdateHarvestBountyPercentage(uint256 _percentage);
  event UpdatePlatform(address indexed _platform);

  enum WithdrawOption {
    // withdraw as cvxCRV
    Withdraw,
    // withdraw as cvxCRV staking wrapper
    WithdrawAndStake,
    // withdraw as CRV
    WithdrawAsCRV,
    // withdraw as CVX
    WithdrawAsCVX,
    // withdraw as ETH
    WithdrawAsETH
  }

  /// @notice return the total amount of cvxCRV staked.
  function totalUnderlying() external view returns (uint256);

  /// @notice return the amount of cvxCRV staked for user
  /// @param _user - The address of the account
  function balanceOfUnderlying(address _user) external view returns (uint256);

  /// @notice Deposit cvxCRV token to this contract
  /// @param _recipient - The address who will receive the aCRV token.
  /// @param _amount - The amount of cvxCRV to deposit.
  /// @return share - The amount of aCRV received.
  function deposit(address _recipient, uint256 _amount) external returns (uint256 share);

  /// @notice Deposit all cvxCRV token of the sender to this contract
  /// @param _recipient The address who will receive the aCRV token.
  /// @return share - The amount of aCRV received.
  function depositAll(address _recipient) external returns (uint256 share);

  /// @notice Deposit CRV token to this contract
  /// @param _recipient - The address who will receive the aCRV token.
  /// @param _amount - The amount of CRV to deposit.
  /// @return share - The amount of aCRV received.
  function depositWithCRV(address _recipient, uint256 _amount) external returns (uint256 share);

  /// @notice Deposit all CRV token of the sender to this contract
  /// @param _recipient The address who will receive the aCRV token.
  /// @return share - The amount of aCRV received.
  function depositAllWithCRV(address _recipient) external returns (uint256 share);

  /// @notice Withdraw cvxCRV in proportion to the amount of shares sent
  /// @param _recipient - The address who will receive the withdrawn token.
  /// @param _shares - The amount of aCRV to send.
  /// @param _minimumOut - The minimum amount of token should be received.
  /// @param _option - The withdraw option (as cvxCRV or CRV or CVX or ETH or stake to convex).
  /// @return withdrawn - The amount of token returned to the user.
  function withdraw(
    address _recipient,
    uint256 _shares,
    uint256 _minimumOut,
    WithdrawOption _option
  ) external returns (uint256 withdrawn);

  /// @notice Withdraw all cvxCRV in proportion to the amount of shares sent
  /// @param _recipient - The address who will receive the withdrawn token.
  /// @param _minimumOut - The minimum amount of token should be received.
  /// @param _option - The withdraw option (as cvxCRV or CRV or CVX or ETH or stake to convex).
  /// @return withdrawn - The amount of token returned to the user.
  function withdrawAll(
    address _recipient,
    uint256 _minimumOut,
    WithdrawOption _option
  ) external returns (uint256 withdrawn);

  /// @notice Harvest the pending reward and convert to cvxCRV.
  /// @param _recipient - The address of account to receive harvest bounty.
  /// @param _minimumOut - The minimum amount of cvxCRV should get.
  function harvest(address _recipient, uint256 _minimumOut) external returns (uint256);
}

File 15 of 20 : IConcentratorStrategy.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0 || ^0.8.0;

interface IConcentratorStrategy {
  /// @notice Return then name of the strategy.
  function name() external view returns (string memory);

  /// @notice Update the list of reward tokens.
  /// @param _rewards The address list of reward tokens to update.
  function updateRewards(address[] memory _rewards) external;

  /// @notice Deposit token to corresponding strategy.
  /// @dev Requirements:
  ///   + Caller should make sure the token is already transfered into the strategy contract.
  ///   + Caller should make sure the deposit amount is greater than zero.
  ///
  /// @param _recipient The address of recipient who will receive the share.
  /// @param _amount The amount of token to deposit.
  function deposit(address _recipient, uint256 _amount) external;

  /// @notice Withdraw underlying token or yield token from corresponding strategy.
  /// @dev Requirements:
  ///   + Caller should make sure the withdraw amount is greater than zero.
  ///
  /// @param _recipient The address of recipient who will receive the token.
  /// @param _amount The amount of token to withdraw.
  function withdraw(address _recipient, uint256 _amount) external;

  /// @notice Harvest possible rewards from strategy.
  ///
  /// @param _zapper The address of zap contract used to zap rewards.
  /// @param _intermediate The address of intermediate token to zap.
  /// @return amount The amount of corresponding reward token.
  function harvest(address _zapper, address _intermediate) external returns (uint256 amount);

  /// @notice Emergency function to execute arbitrary call.
  /// @dev This function should be only used in case of emergency. It should never be called explicitly
  ///  in any contract in normal case.
  ///
  /// @param _to The address of target contract to call.
  /// @param _value The value passed to the target contract.
  /// @param _data The calldata pseed to the target contract.
  function execute(
    address _to,
    uint256 _value,
    bytes calldata _data
  ) external payable returns (bool, bytes memory);

  /// @notice Do some extra work before migration.
  /// @param _newStrategy The address of new strategy.
  function prepareMigrate(address _newStrategy) external;

  /// @notice Do some extra work after migration.
  /// @param _newStrategy The address of new strategy.
  function finishMigrate(address _newStrategy) external;
}

File 16 of 20 : IConvexBasicRewards.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0 || ^0.8.0;

interface IConvexBasicRewards {
  function pid() external view returns (uint256);

  function totalSupply() external view returns (uint256);

  function periodFinish() external view returns (uint256);

  function rewardRate() external view returns (uint256);

  function stakingToken() external view returns (address);

  function stakeFor(address, uint256) external returns (bool);

  function balanceOf(address) external view returns (uint256);

  function earned(address) external view returns (uint256);

  function withdrawAll(bool) external returns (bool);

  function withdraw(uint256, bool) external returns (bool);

  function withdrawAndUnwrap(uint256, bool) external returns (bool);

  function getReward() external returns (bool);

  function stake(uint256) external returns (bool);

  function rewardToken() external view returns (address);

  function extraRewards(uint256) external view returns (address);

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

File 17 of 20 : IConvexCRVDepositor.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

interface IConvexCRVDepositor {
  function deposit(
    uint256 _amount,
    bool _lock,
    address _stakeAddress
  ) external;

  function deposit(uint256 _amount, bool _lock) external;

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

File 18 of 20 : ICurveFactoryPlainPool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0 || ^0.8.0;

// solhint-disable var-name-mixedcase, func-name-mixedcase
interface ICurveFactoryPlainPool {
  function remove_liquidity_one_coin(
    uint256 token_amount,
    int128 i,
    uint256 min_amount
  ) external returns (uint256);

  function calc_withdraw_one_coin(uint256 _token_amount, int128 i) external view returns (uint256);

  function exchange(
    int128 i,
    int128 j,
    uint256 _dx,
    uint256 _min_dy,
    address _receiver
  ) external returns (uint256);

  function get_dy(
    int128 i,
    int128 j,
    uint256 dx
  ) external view returns (uint256);

  function coins(uint256 index) external view returns (address);

  function balances(uint256 index) external view returns (uint256);

  function A_precise() external view returns (uint256);

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

/// @dev This is the interface of Curve Factory Plain Pool with 2 tokens, examples:
interface ICurveFactoryPlain2Pool is ICurveFactoryPlainPool {
  function add_liquidity(uint256[2] memory amounts, uint256 min_mint_amount) external returns (uint256);

  function calc_token_amount(uint256[2] memory amounts, bool _is_deposit) external view returns (uint256);
}

/// @dev This is the interface of Curve Factory Plain Pool with 3 tokens, examples:
interface ICurveFactoryPlain3Pool is ICurveFactoryPlainPool {
  function add_liquidity(uint256[3] memory amounts, uint256 min_mint_amount) external returns (uint256);

  function calc_token_amount(uint256[3] memory amounts, bool _is_deposit) external view returns (uint256);
}

/// @dev This is the interface of Curve Factory Plain Pool with 4 tokens, examples:
interface ICurveFactoryPlain4Pool is ICurveFactoryPlainPool {
  function add_liquidity(uint256[4] memory amounts, uint256 min_mint_amount) external returns (uint256);

  function calc_token_amount(uint256[4] memory amounts, bool _is_deposit) external view returns (uint256);
}

File 19 of 20 : ICvxCrvStakingWrapper.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0 || ^0.8.0;
pragma abicoder v2;

// solhint-disable func-name-mixedcase

interface ICvxCrvStakingWrapper {
  struct EarnedData {
    address token;
    uint256 amount;
  }

  function user_checkpoint(address _account) external returns (bool);

  // run earned as a mutable function to claim everything before calculating earned rewards
  function earned(address _account) external returns (EarnedData[] memory claimable);

  // set a user's reward weight to determine how much of each reward group to receive
  function setRewardWeight(uint256 _weight) external;

  function balanceOf(address) external view returns (uint256);

  // get user's weighted balance for specified reward group
  function userRewardBalance(address _address, uint256 _rewardGroup) external view returns (uint256);

  function userRewardWeight(address _address) external view returns (uint256);

  // get weighted supply for specified reward group
  function rewardSupply(uint256 _rewardGroup) external view returns (uint256);

  // claim
  function getReward(address _account) external;

  // claim and forward
  function getReward(address _account, address _forwardTo) external;

  // deposit vanilla crv
  function deposit(uint256 _amount, address _to) external;

  // stake cvxcrv
  function stake(uint256 _amount, address _to) external;

  // backwards compatibility for other systems (note: amount and address reversed)
  function stakeFor(address _to, uint256 _amount) external;

  // withdraw to convex deposit token
  function withdraw(uint256 _amount) external;
}

File 20 of 20 : IZap.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0 || ^0.8.0;

interface IZap {
  function zap(
    address _fromToken,
    uint256 _amountIn,
    address _toToken,
    uint256 _minOut
  ) external payable returns (uint256);

  function zapWithRoutes(
    address _fromToken,
    uint256 _amountIn,
    address _toToken,
    uint256[] calldata _routes,
    uint256 _minOut
  ) external payable returns (uint256);

  function zapFrom(
    address _fromToken,
    uint256 _amountIn,
    address _toToken,
    uint256 _minOut
  ) external payable returns (uint256);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_curveCvxCrvPool","type":"address"},{"internalType":"address","name":"_wrapper","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"_feeType","type":"bytes32"},{"indexed":false,"internalType":"address","name":"_user","type":"address"}],"name":"CancleCustomizeFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"_feeType","type":"bytes32"},{"indexed":false,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_rate","type":"uint256"}],"name":"CustomizeFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","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":true,"internalType":"address","name":"_sender","type":"address"},{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"platformFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"harvestBounty","type":"uint256"}],"name":"Harvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Harvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_oldStrategy","type":"address"},{"indexed":false,"internalType":"address","name":"_newStrategy","type":"address"}],"name":"MigrateStrategy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"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":"uint256","name":"_percentage","type":"uint256"}],"name":"UpdateHarvestBountyPercentage","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_harvester","type":"address"}],"name":"UpdateHarvester","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_platform","type":"address"}],"name":"UpdatePlatform","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_feePercentage","type":"uint256"}],"name":"UpdatePlatformFeePercentage","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_feePercentage","type":"uint256"}],"name":"UpdateWithdrawalFeePercentage","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_zap","type":"address"}],"name":"UpdateZap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","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":true,"internalType":"address","name":"_sender","type":"address"},{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"_shares","type":"uint256"},{"indexed":false,"internalType":"enum IAladdinCRV.WithdrawOption","name":"_option","type":"uint8"}],"name":"Withdraw","type":"event"},{"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":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"balanceOfUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"","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":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"_recipient","type":"address"}],"name":"depositAll","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"depositAllWithCRV","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositWithCRV","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositWithWrapper","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_feeType","type":"bytes32"},{"internalType":"address","name":"_user","type":"address"}],"name":"getFeeRate","outputs":[{"internalType":"uint256","name":"rate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_minimumOut","type":"uint256"}],"name":"harvest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"harvestBountyPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"address","name":"_strategy","type":"address"}],"name":"initializeV2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_newStrategy","type":"address"}],"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":"platform","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platformFeePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint32","name":"_percentage","type":"uint32"}],"name":"setWithdrawFeeForUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_depositor","type":"address"}],"name":"updateDepositor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_percentage","type":"uint256"}],"name":"updateHarvestBountyPercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_harvester","type":"address"}],"name":"updateHarvester","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_platform","type":"address"}],"name":"updatePlatform","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feePercentage","type":"uint256"}],"name":"updatePlatformFeePercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"newRewards","type":"address[]"}],"name":"updateStrategyRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feePercentage","type":"uint256"}],"name":"updateWithdrawFeePercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_zap","type":"address"}],"name":"updateZap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"uint256","name":"_minimumOut","type":"uint256"},{"internalType":"enum IAladdinCRV.WithdrawOption","name":"_option","type":"uint8"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"_withdrawed","type":"uint256"}],"stateMutability":"nonpayable","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":"_recipient","type":"address"},{"internalType":"uint256","name":"_minimumOut","type":"uint256"},{"internalType":"enum IAladdinCRV.WithdrawOption","name":"_option","type":"uint8"}],"name":"withdrawAll","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFeePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"zap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60e06040523480156200001157600080fd5b5060405162004de038038062004de0833981810160405260408110156200003757600080fd5b5080516020918201516001600160601b0319606083901b166080526040805163c661065760e01b815260006004820181905291519394929391926001600160a01b0386169263c6610657926024808201939291829003018186803b1580156200009f57600080fd5b505afa158015620000b4573d6000803e3d6000fd5b505050506040513d6020811015620000cb57600080fd5b505190506001600160a01b03811673d533a949740bb3306d119cc777fa900ba034cd5214620000fc576001620000ff565b60005b60ff16600f90810b900b60801b60a052506001600160601b031960609190911b1660c0525060805160601c60a05160801c60c05160601c614c4f6200019160003980611dd15280611e57528061356a52806135aa52806135d1525080613f9b5280613fbc528061410e528061412f52508061175a5280613f6c528061407852806140b852806140df5250614c4f6000f3fe60806040526004361061039b5760003560e01c80637c1ade19116101dc578063c63d75b611610102578063d905777e116100a0578063ef8b30f71161006f578063ef8b30f714610df1578063f2fde38b14610e1b578063f843c9ee14610e4e578063fafa6c6914610e87576103a2565b8063d905777e146107c2578063dd62ed3e14610d62578063e36a6b8314610d9d578063e483015314610dc7576103a2565b8063c7c4ff46116100dc578063c7c4ff4614610cf9578063ccc6367814610d0e578063cdd78cfc14610d4d578063ce96cb77146107c2576103a2565b8063c63d75b6146107c2578063c6e6f59214610cba578063c70920bc14610ce4576103a2565b8063a457c2d71161017a578063b3d7f6b911610149578063b3d7f6b914610b5e578063b460af9414610b88578063b4a03d5414610bc9578063ba08765214610c79576103a2565b8063a457c2d714610a95578063a8c62e7614610ace578063a9059cbb14610ae3578063ad2ea2e714610b1c576103a2565b806394bf804d116101b657806394bf804d146109e157806395d89b4114610a1a5780639f0d5f2714610a2f578063a293da0f14610a62576103a2565b80637c1ade19146109605780638da5cb5b146109995780638fe4e232146109ae576103a2565b806335c807e6116102c157806347e7ef241161025f5780636a4237271161022e5780636a423727146108ca5780636e553f65146108df57806370a0823114610918578063715018a61461094b576103a2565b806347e7ef241461081f5780634bde38c8146108585780634c4b5fd71461086d5780634cdad506146108a0576103a2565b8063395525ff1161029b578063395525ff1461077a5780633af9e6691461078f578063402d267d146107c25780634502cdfd146107f5576103a2565b806335c807e6146106f957806338d52e0f1461072c5780633950935114610741576103a2565b806315980d8911610339578063262d615211610308578063262d615214610631578063277982ca1461066257806329b6eca91461069b578063313ce567146106ce576103a2565b806315980d891461056757806318160ddd146105af5780631e2720ff146105c457806323b872dd146105ee576103a2565b806307a2d13a1161037557806307a2d13a14610491578063095ea7b3146104bb5780630a28a4771461050857806310f9a67714610532576103a2565b8063018ee9b7146103a757806301e1d114146103f257806306fdde0314610407576103a2565b366103a257005b600080fd5b3480156103b357600080fd5b506103e0600480360360408110156103ca57600080fd5b506001600160a01b038135169060200135610eba565b60408051918252519081900360200190f35b3480156103fe57600080fd5b506103e0610f25565b34801561041357600080fd5b5061041c610f2b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561045657818101518382015260200161043e565b50505050905090810190601f1680156104835780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561049d57600080fd5b506103e0600480360360208110156104b457600080fd5b5035610fc1565b3480156104c757600080fd5b506104f4600480360360408110156104de57600080fd5b506001600160a01b038135169060200135611005565b604080519115158252519081900360200190f35b34801561051457600080fd5b506103e06004803603602081101561052b57600080fd5b5035611023565b34801561053e57600080fd5b506105656004803603602081101561055557600080fd5b50356001600160a01b03166110cb565b005b34801561057357600080fd5b506103e06004803603608081101561058a57600080fd5b5080356001600160a01b0316906020810135906040810135906060013560ff1661114f565b3480156105bb57600080fd5b506103e06112b4565b3480156105d057600080fd5b50610565600480360360208110156105e757600080fd5b50356112ba565b3480156105fa57600080fd5b506104f46004803603606081101561061157600080fd5b506001600160a01b038135811691602081013590911690604001356113b0565b34801561063d57600080fd5b50610646611438565b604080516001600160a01b039092168252519081900360200190f35b34801561066e57600080fd5b506103e06004803603604081101561068557600080fd5b50803590602001356001600160a01b0316611447565b3480156106a757600080fd5b50610565600480360360208110156106be57600080fd5b50356001600160a01b0316611483565b3480156106da57600080fd5b506106e36117ba565b6040805160ff9092168252519081900360200190f35b34801561070557600080fd5b506105656004803603602081101561071c57600080fd5b50356001600160a01b03166117c3565b34801561073857600080fd5b506106466118d4565b34801561074d57600080fd5b506104f46004803603604081101561076457600080fd5b506001600160a01b0381351690602001356118ec565b34801561078657600080fd5b506103e061193a565b34801561079b57600080fd5b506103e0600480360360208110156107b257600080fd5b50356001600160a01b0316611940565b3480156107ce57600080fd5b506103e0600480360360208110156107e557600080fd5b50356001600160a01b031661197f565b34801561080157600080fd5b506105656004803603602081101561081857600080fd5b5035611986565b34801561082b57600080fd5b506103e06004803603604081101561084257600080fd5b506001600160a01b038135169060200135611a78565b34801561086457600080fd5b50610646611a84565b34801561087957600080fd5b506103e06004803603602081101561089057600080fd5b50356001600160a01b0316611a93565b3480156108ac57600080fd5b506103e0600480360360208110156108c357600080fd5b5035611aa1565b3480156108d657600080fd5b506103e0611b4f565b3480156108eb57600080fd5b506103e06004803603604081101561090257600080fd5b50803590602001356001600160a01b0316611b55565b34801561092457600080fd5b506103e06004803603602081101561093b57600080fd5b50356001600160a01b0316611cde565b34801561095757600080fd5b50610565611cf9565b34801561096c57600080fd5b506103e06004803603604081101561098357600080fd5b506001600160a01b038135169060200135611da5565b3480156109a557600080fd5b50610646611e8c565b3480156109ba57600080fd5b50610565600480360360208110156109d157600080fd5b50356001600160a01b0316611e9b565b3480156109ed57600080fd5b506103e060048036036040811015610a0457600080fd5b50803590602001356001600160a01b0316611f09565b348015610a2657600080fd5b5061041c611f7a565b348015610a3b57600080fd5b506103e060048036036020811015610a5257600080fd5b50356001600160a01b0316611fdb565b348015610a6e57600080fd5b5061056560048036036020811015610a8557600080fd5b50356001600160a01b0316611fe9565b348015610aa157600080fd5b506104f460048036036040811015610ab857600080fd5b506001600160a01b0381351690602001356120da565b348015610ada57600080fd5b50610646612142565b348015610aef57600080fd5b506104f460048036036040811015610b0657600080fd5b506001600160a01b038135169060200135612151565b348015610b2857600080fd5b506103e060048036036060811015610b3f57600080fd5b5080356001600160a01b0316906020810135906040013560ff16612165565b348015610b6a57600080fd5b506103e060048036036020811015610b8157600080fd5b503561217d565b348015610b9457600080fd5b506103e060048036036060811015610bab57600080fd5b508035906001600160a01b0360208201358116916040013516612188565b348015610bd557600080fd5b5061056560048036036020811015610bec57600080fd5b810190602081018135640100000000811115610c0757600080fd5b820183602082011115610c1957600080fd5b80359060200191846020830284011164010000000083111715610c3b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550612357945050505050565b348015610c8557600080fd5b506103e060048036036060811015610c9c57600080fd5b508035906001600160a01b036020820135811691604001351661245a565b348015610cc657600080fd5b506103e060048036036020811015610cdd57600080fd5b5035612553565b348015610cf057600080fd5b506103e0612578565b348015610d0557600080fd5b5061064661257e565b348015610d1a57600080fd5b5061056560048036036040811015610d3157600080fd5b5080356001600160a01b0316906020013563ffffffff1661258d565b348015610d5957600080fd5b506103e0612672565b348015610d6e57600080fd5b506103e060048036036040811015610d8557600080fd5b506001600160a01b0381358116916020013516612678565b348015610da957600080fd5b5061056560048036036020811015610dc057600080fd5b50356126a3565b348015610dd357600080fd5b5061056560048036036020811015610dea57600080fd5b5035612795565b348015610dfd57600080fd5b506103e060048036036020811015610e1457600080fd5b5035612887565b348015610e2757600080fd5b5061056560048036036020811015610e3e57600080fd5b50356001600160a01b0316612892565b348015610e5a57600080fd5b506103e060048036036040811015610e7157600080fd5b506001600160a01b038135169060200135612995565b348015610e9357600080fd5b5061056560048036036020811015610eaa57600080fd5b50356001600160a01b0316612b1d565b600060026097541415610f02576040805162461bcd60e51b815260206004820152601f60248201526000805160206149cc833981519152604482015290519081900360640190fd5b6002609755610f0f612dc7565b610f198383612e34565b60016097559392505050565b60ce5490565b60368054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610fb75780601f10610f8c57610100808354040283529160200191610fb7565b820191906000526020600020905b815481529060010190602001808311610f9a57829003601f168201915b5050505050905090565b600080610fcc6112b4565b905080610fdc5782915050611000565b6000610fe6610f25565b905081610ff382866130b9565b81610ffa57fe5b04925050505b919050565b6000611019611012613112565b8484613116565b5060015b92915050565b60008061102e610f25565b90508083111561107b576040805162461bcd60e51b815260206004820152601360248201527265786365656420746f74616c2061737365747360681b604482015290519081900360640190fd5b600061108684612553565b9050818414156110995791506110009050565b6110c260ca54633b9aca00036110bc633b9aca00846130b990919063ffffffff16565b90613202565b92505050611000565b6110d3613112565b6001600160a01b03166110e4611e8c565b6001600160a01b03161461112d576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b60d080546001600160a01b0319166001600160a01b0392909216919091179055565b600060026097541415611197576040805162461bcd60e51b815260206004820152601f60248201526000805160206149cc833981519152604482015290519081900360640190fd5b60026097556000198414156111b2576111af33611cde565b93505b60008260048111156111c057fe5b141561122d576111d1848633613269565b905082811015611228576040805162461bcd60e51b815260206004820152601f60248201527f416c616464696e4352563a20696e73756666696369656e74206f757470757400604482015290519081900360640190fd5b611249565b611238843033613269565b9050611246858285856134e5565b90505b846001600160a01b0316336001600160a01b03167fb9da3f3df62c28aca604806cc6ee9678189d7591ef511a77bb040fa8361e9e0286856040518083815260200182600481111561129657fe5b81526020019250505060405180910390a36001609755949350505050565b60355490565b60d0546001600160a01b03163314611311576040805162461bcd60e51b815260206004820152601560248201527437b7363c903932bbb0b932103232b837b9b4ba37b960591b604482015290519081900360640190fd5b60cf546001600160a01b031661133d7362b9c7356a2dc64a1969e19c23e4f579f9810aa73383856138d3565b604080516311f9fbc960e21b81523060048201526024810184905290516001600160a01b038316916347e7ef2491604480830192600092919082900301818387803b15801561138b57600080fd5b505af115801561139f573d6000803e3d6000fd5b505060ce8054909401909355505050565b60006113bd848484613933565b61142d846113c9613112565b61142885604051806060016040528060288152602001614ac2602891396001600160a01b038a16600090815260346020526040812090611407613112565b6001600160a01b031681526020810191909152604001600020549190613a90565b613116565b5060015b9392505050565b60c9546001600160a01b031681565b600061145283613b27565b90506000806114618585613b2e565b915091508160ff166001141561147b578063ffffffff1692505b505092915050565b60cf546001600160a01b0316156114cf576040805162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b604482015290519081900360640190fd5b60cf80546001600160a01b0319166001600160a01b038316179055604080516246613160e11b81523060048201529051733fe65692bfcd0e6cf84cb1e7d24108e434a7587e91628cc262916024808301926020929190829003018186803b15801561153957600080fd5b505afa15801561154d573d6000803e3d6000fd5b505050506040513d602081101561156357600080fd5b5051156115a7576040805162461bcd60e51b815260206004820152600d60248201526c1b9bdd081a185c9d995cdd1959609a1b604482015290519081900360640190fd5b604080516370a0823160e01b81523060048201529051600091733fe65692bfcd0e6cf84cb1e7d24108e434a7587e916370a0823191602480820192602092909190829003018186803b1580156115fc57600080fd5b505afa158015611610573d6000803e3d6000fd5b505050506040513d602081101561162657600080fd5b505160408051631c683a1b60e11b8152600481018390526000602482018190529151929350733fe65692bfcd0e6cf84cb1e7d24108e434a7587e926338d0743692604480840193602093929083900390910190829087803b15801561168a57600080fd5b505af115801561169e573d6000803e3d6000fd5b505050506040513d60208110156116b457600080fd5b506116d690507362b9c7356a2dc64a1969e19c23e4f579f9810aa78383613b58565b604080516311f9fbc960e21b81526000600482018190526024820184905291516001600160a01b038516926347e7ef24926044808201939182900301818387803b15801561172357600080fd5b505af1158015611737573d6000803e3d6000fd5b50505060ce8290555061178173d533a949740bb3306d119cc777fa900ba034cd527f0000000000000000000000000000000000000000000000000000000000000000600019613baf565b6117b673d533a949740bb3306d119cc777fa900ba034cd52738014595f2ab54cd7c604b00e9fb932176fdc86ae600019613baf565b5050565b60385460ff1690565b6117cb613112565b6001600160a01b03166117dc611e8c565b6001600160a01b031614611825576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b6001600160a01b038116611880576040805162461bcd60e51b815260206004820152601c60248201527f416c616464696e4352563a207a65726f207a6170206164647265737300000000604482015290519081900360640190fd5b60c980546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f03e59dbc22b06c47327d520cddc8bf2923ac525a1742732bf344562d7f72d0f59181900360200190a150565b7362b9c7356a2dc64a1969e19c23e4f579f9810aa790565b60006110196118f9613112565b84611428856034600061190a613112565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490613cc2565b60ca5481565b60008061194b6112b4565b90508061195c576000915050611000565b600061196784611cde565b905081610ff360ce54836130b990919063ffffffff16565b5060001990565b61198e613112565b6001600160a01b031661199f611e8c565b6001600160a01b0316146119e8576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b6305f5e100811115611a3d576040805162461bcd60e51b8152602060048201526019602482015278416c616464696e4352563a2066656520746f6f206c6172676560381b604482015290519081900360640190fd5b60ca8190556040805182815290517ff775bac4793637fce9f6895c2dd6f91e6847921d94ff446ecfdb9685b7f9829d9181900360200190a150565b60006114318284611b55565b60cd546001600160a01b031681565b600061101d82600019612995565b600080611aac6112b4565b905080831115611af9576040805162461bcd60e51b815260206004820152601360248201527265786365656420746f74616c20737570706c7960681b604482015290519081900360640190fd5b6000611b0484610fc1565b9050611b0e6112b4565b841415611b1e5791506110009050565b6000633b9aca00611b3a60ca54846130b990919063ffffffff16565b81611b4157fe5b049091039250611000915050565b60cc5481565b600060026097541415611b9d576040805162461bcd60e51b815260206004820152601f60248201526000805160206149cc833981519152604482015290519081900360640190fd5b6002609755600019831415611c2c57604080516370a0823160e01b815233600482015290517362b9c7356a2dc64a1969e19c23e4f579f9810aa7916370a08231916024808301926020929190829003018186803b158015611bfd57600080fd5b505afa158015611c11573d6000803e3d6000fd5b505050506040513d6020811015611c2757600080fd5b505192505b60cf546001600160a01b0316611c587362b9c7356a2dc64a1969e19c23e4f579f9810aa73383876138d3565b806001600160a01b03166347e7ef2484866040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611caf57600080fd5b505af1158015611cc3573d6000803e3d6000fd5b50505050611cd18385613d1c565b6001609755949350505050565b6001600160a01b031660009081526033602052604090205490565b611d01613112565b6001600160a01b0316611d12611e8c565b6001600160a01b031614611d5b576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b6065546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3606580546001600160a01b0319169055565b6000600019821415611e4657604080516370a0823160e01b815233600482015290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a08231916024808301926020929190829003018186803b158015611e1757600080fd5b505afa158015611e2b573d6000803e3d6000fd5b505050506040513d6020811015611e4157600080fd5b505191505b60cf54611e82906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691339116856138d3565b6114318383613d1c565b6065546001600160a01b031690565b611ea3613112565b6001600160a01b0316611eb4611e8c565b6001600160a01b031614611efd576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b611f0681613e46565b50565b600060026097541415611f51576040805162461bcd60e51b815260206004820152601f60248201526000805160206149cc833981519152604482015290519081900360640190fd5b60026097556000611f6184610fc1565b9050611f6d8184611b55565b5060016097559392505050565b60378054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610fb75780601f10610f8c57610100808354040283529160200191610fb7565b600061101d60001983611b55565b611ff1613112565b6001600160a01b0316612002611e8c565b6001600160a01b03161461204b576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b6001600160a01b0381166120905760405162461bcd60e51b8152600401808060200182810382526021815260200180614bf96021913960400191505060405180910390fd5b60cd80546001600160a01b0319166001600160a01b0383169081179091556040517f43412ddbc9c884a0be720e21657a878716d21710438ad24f74f7e99699df82fc90600090a250565b60006110196120e7613112565b8461142885604051806060016040528060258152602001614bd46025913960346000612111613112565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190613a90565b60cf546001600160a01b031681565b600061101961215e613112565b8484613933565b600061217584600019858561114f565b949350505050565b600061101d82610fc1565b6000600260975414156121d0576040805162461bcd60e51b815260206004820152601f60248201526000805160206149cc833981519152604482015290519081900360640190fd5b60026097556000198414156121f3576121f06121eb83611cde565b610fc1565b93505b60006121fd610f25565b90508085111561224a576040805162461bcd60e51b815260206004820152601360248201527265786365656420746f74616c2061737365747360681b604482015290519081900360640190fd5b600061225586612553565b9050818610156122b257600061228b7f8d2b8eacf0b88f0b387605673326a53dcb958998ee7592cf927b284ac721fc3386611447565b90506122ae81633b9aca00036110bc633b9aca00856130b990919063ffffffff16565b9150505b336001600160a01b0385161461233d5760006122ce8533612678565b905081811015612325576040805162461bcd60e51b815260206004820152601a60248201527f7769746864726177206578636565647320616c6c6f77616e6365000000000000604482015290519081900360640190fd5b600019811461233b5761233b8533848403613116565b505b612348818686613269565b50600160975595945050505050565b61235f613112565b6001600160a01b0316612370611e8c565b6001600160a01b0316146123b9576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b60cf5460405163019388d760e41b81526020600482018181528451602484015284516001600160a01b03909416936319388d709386938392604490920191818601910280838360005b8381101561241a578181015183820152602001612402565b5050505090500192505050600060405180830381600087803b15801561243f57600080fd5b505af1158015612453573d6000803e3d6000fd5b5050505050565b6000600260975414156124a2576040805162461bcd60e51b815260206004820152601f60248201526000805160206149cc833981519152604482015290519081900360640190fd5b60026097556000198414156124bd576124ba82611cde565b93505b336001600160a01b038316146125485760006124d98333612678565b905084811015612530576040805162461bcd60e51b815260206004820152601860248201527f72656465656d206578636565647320616c6c6f77616e63650000000000000000604482015290519081900360640190fd5b6000198114612546576125468333878403613116565b505b611cd1848484613269565b60008061255e610f25565b90508061256e5782915050611000565b6000610fe66112b4565b60ce5481565b60d0546001600160a01b031681565b612595613112565b6001600160a01b03166125a6611e8c565b6001600160a01b0316146125ef576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b6305f5e1008163ffffffff161115612647576040805162461bcd60e51b815260206004820152601660248201527577697468647261772066656520746f6f206c6172676560501b604482015290519081900360640190fd5b6117b67f8d2b8eacf0b88f0b387605673326a53dcb958998ee7592cf927b284ac721fc338383613ea1565b60cb5481565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b6126ab613112565b6001600160a01b03166126bc611e8c565b6001600160a01b031614612705576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b6305f5e10081111561275a576040805162461bcd60e51b8152602060048201526019602482015278416c616464696e4352563a2066656520746f6f206c6172676560381b604482015290519081900360640190fd5b60cc8190556040805182815290517fc69cbab065ddb19d4ee1f9cfe242c82b8facbd1e93c89e5830dfe0d4fb2598539181900360200190a150565b61279d613112565b6001600160a01b03166127ae611e8c565b6001600160a01b0316146127f7576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b630bebc20081111561284c576040805162461bcd60e51b8152602060048201526019602482015278416c616464696e4352563a2066656520746f6f206c6172676560381b604482015290519081900360640190fd5b60cb8190556040805182815290517f9f143d1158804dce75cd6feac5b8fde3c0d57c70d176355a6ab516a2524fcb9f9181900360200190a150565b600061101d82612553565b61289a613112565b6001600160a01b03166128ab611e8c565b6001600160a01b0316146128f4576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b6001600160a01b0381166129395760405162461bcd60e51b8152600401808060200182810382526026815260200180614a0e6026913960400191505060405180910390fd5b6065546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3606580546001600160a01b0319166001600160a01b0392909216919091179055565b6000600260975414156129dd576040805162461bcd60e51b815260206004820152601f60248201526000805160206149cc833981519152604482015290519081900360640190fd5b6002609755600019821415612a6c57604080516370a0823160e01b8152336004820152905173d533a949740bb3306d119cc777fa900ba034cd52916370a08231916024808301926020929190829003018186803b158015612a3d57600080fd5b505afa158015612a51573d6000803e3d6000fd5b505050506040513d6020811015612a6757600080fd5b505191505b612a8c73d533a949740bb3306d119cc777fa900ba034cd523330856138d3565b60cf546001600160a01b0316612aa28382613f67565b9250806001600160a01b03166347e7ef2485856040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015612afb57600080fd5b505af1158015612b0f573d6000803e3d6000fd5b50505050611cd18484613d1c565b612b25613112565b6001600160a01b0316612b36611e8c565b6001600160a01b031614612b7f576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b6001600160a01b038116612bc45760405162461bcd60e51b8152600401808060200182810382526025815260200180614a9d6025913960400191505060405180910390fd5b60ce5460cf80546001600160a01b038481166001600160a01b031983168117909355604080516388242e5d60e01b815260048101949094525191169182916388242e5d9160248082019260009290919082900301818387803b158015612c2957600080fd5b505af1158015612c3d573d6000803e3d6000fd5b50505050806001600160a01b031663f3fef3a384846040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015612c9857600080fd5b505af1158015612cac573d6000803e3d6000fd5b50505050806001600160a01b031663663c261b846040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b158015612cff57600080fd5b505af1158015612d13573d6000803e3d6000fd5b5050604080516311f9fbc960e21b81523060048201526024810186905290516001600160a01b03871693506347e7ef249250604480830192600092919082900301818387803b158015612d6557600080fd5b505af1158015612d79573d6000803e3d6000fd5b5050604080516001600160a01b0380861682528716602082015281517f9249d6a64288c19c5be5f4f1bb9b763ad4afac803128f1ef65b88acb13df9aa49450908190039091019150a1505050565b6000612dd161449c565b546001600160a01b03169050801580612df257506001600160a01b03811633145b611f06576040805162461bcd60e51b815260206004820152600e60248201526d37b7363c903430b93b32b9ba32b960911b604482015290519081900360640190fd5b60cf5460c954604080516366cc185760e01b81526001600160a01b03928316600482015273d533a949740bb3306d119cc777fa900ba034cd52602482015290516000939290921691839183916366cc18579160448082019260209290919082900301818787803b158015612ea757600080fd5b505af1158015612ebb573d6000803e3d6000fd5b505050506040513d6020811015612ed157600080fd5b505190506000612ee18284613f67565b905084811015612f38576040805162461bcd60e51b815260206004820181905260248201527f416c616464696e4352563a20696e73756666696369656e742072657761726473604482015290519081900360640190fd5b604080516311f9fbc960e21b81526000600482018190526024820184905291516001600160a01b038616926347e7ef24926044808201939182900301818387803b158015612f8557600080fd5b505af1158015612f99573d6000803e3d6000fd5b50506040805184815290513393507fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba92509081900360200190a26000612fdd6112b4565b60cb5460cc54919250908115612ff957633b9aca008285020491505b801561300957633b9aca00908402045b60ce54828503829003908101808585028161302057fe5b049350808584028161302e57fe5b60408051898152602081018890529290910482820181905290519094506001600160a01b038d169133917fd25759d838eb0a46600f8f327cce144e61d7caefbef27010fe31e2aab091704f9181900360600190a360cd54613098906001600160a01b0316856144c0565b6130a28b846144c0565b505060ce8054850190555091979650505050505050565b6000826130c85750600061101d565b828202828482816130d557fe5b04146114315760405162461bcd60e51b8152600401808060200182810382526021815260200180614a7c6021913960400191505060405180910390fd5b3390565b6001600160a01b03831661315b5760405162461bcd60e51b8152600401808060200182810382526024815260200180614b506024913960400191505060405180910390fd5b6001600160a01b0382166131a05760405162461bcd60e51b8152600401808060200182810382526022815260200180614a346022913960400191505060405180910390fd5b6001600160a01b03808416600081815260346020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6000808211613258576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161326157fe5b049392505050565b60008084116132bf576040805162461bcd60e51b815260206004820152601f60248201527f416c616464696e4352563a207a65726f20736861726520776974686472617700604482015290519081900360640190fd5b6132c882611cde565b84111561331c576040805162461bcd60e51b815260206004820152601d60248201527f416c616464696e4352563a20736861726573206e6f7420656e6f756768000000604482015290519081900360640190fd5b60ce5460006133296112b4565b61333387846130b9565b8161333a57fe5b04905061334784876145b2565b61334f6112b4565b6133d95761335e336000612e34565b5060ce5460cf546040805163f3fef3a360e01b81526001600160a01b03898116600483015260248201859052915193965086955091169163f3fef3a39160448082019260009290919082900301818387803b1580156133bc57600080fd5b505af11580156133d0573d6000803e3d6000fd5b50505050613489565b80925060006134087f8d2b8eacf0b88f0b387605673326a53dcb958998ee7592cf927b284ac721fc3386611447565b60cf546040805163f3fef3a360e01b81526001600160a01b038a81166004830152633b9aca00898602049889900360248301819052925192989495509092169163f3fef3a391604480830192600092919082900301818387803b15801561346e57600080fd5b505af1158015613482573d6000803e3d6000fd5b5050505050505b82820360ce55604080518481526020810188905281516001600160a01b03808816939089169233927ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db929181900390910190a450509392505050565b600060018260048111156134f557fe5b14156136635782841015613550576040805162461bcd60e51b815260206004820152601f60248201527f416c616464696e4352563a20696e73756666696369656e74206f757470757400604482015290519081900360640190fd5b6135907362b9c7356a2dc64a1969e19c23e4f579f9810aa77f00000000000000000000000000000000000000000000000000000000000000006000613baf565b6135cf7362b9c7356a2dc64a1969e19c23e4f579f9810aa77f000000000000000000000000000000000000000000000000000000000000000086613baf565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632ee4090886866040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561364657600080fd5b505af115801561365a573d6000803e3d6000fd5b505050506138ca565b6000600283600481111561367357fe5b1415613694575073d533a949740bb3306d119cc777fa900ba034cd5261372c565b60048360048111156136a257fe5b14156136b05750600061372c565b60038360048111156136be57fe5b14156136df5750734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b61372c565b6040805162461bcd60e51b815260206004820152601e60248201527f416c616464696e4352563a20756e737570706f72746564206f7074696f6e0000604482015290519081900360640190fd5b60c9546001600160a01b03166137577362b9c7356a2dc64a1969e19c23e4f579f9810aa78288613b58565b604080516349df439160e01b81527362b9c7356a2dc64a1969e19c23e4f579f9810aa76004820152602481018890526001600160a01b038481166044830152606482018890529151918316916349df4391916084808201926020929091908290030181600087803b1580156137cb57600080fd5b505af11580156137df573d6000803e3d6000fd5b505050506040513d60208110156137f557600080fd5b505195506001600160a01b0382166138b3576040516000906001600160a01b0389169088908381818185875af1925050503d8060008114613852576040519150601f19603f3d011682016040523d82523d6000602084013e613857565b606091505b50509050806138ad576040805162461bcd60e51b815260206004820152601f60248201527f416c616464696e4352563a20455448207472616e73666572206661696c656400604482015290519081900360640190fd5b506138c7565b6138c76001600160a01b0383168888613b58565b50505b50919392505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261392d9085906146ae565b50505050565b6001600160a01b0383166139785760405162461bcd60e51b8152600401808060200182810382526025815260200180614b2b6025913960400191505060405180910390fd5b6001600160a01b0382166139bd5760405162461bcd60e51b81526004018080602001828103825260238152602001806149a96023913960400191505060405180910390fd5b6139c8838383613baa565b613a0581604051806060016040528060268152602001614a56602691396001600160a01b0386166000908152603360205260409020549190613a90565b6001600160a01b038085166000908152603360205260408082209390935590841681522054613a349082613cc2565b6001600160a01b0380841660008181526033602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115613b1f5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613ae4578181015183820152602001613acc565b50505050905090810190601f168015613b115780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b5060ca5490565b6000806000613b3d858561475f565b8054909150613b4b81614790565b9097909650945050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052613baa9084906146ae565b505050565b801580613c35575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015613c0757600080fd5b505afa158015613c1b573d6000803e3d6000fd5b505050506040513d6020811015613c3157600080fd5b5051155b613c705760405162461bcd60e51b8152600401808060200182810382526036815260200180614b9e6036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052613baa9084906146ae565b600082820183811015611431576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000808211613d72576040805162461bcd60e51b815260206004820152601f60248201527f416c616464696e4352563a207a65726f20616d6f756e74206465706f73697400604482015290519081900360640190fd5b60ce546000613d7f6112b4565b9050600081613d8f575083613da5565b82613d9a86846130b9565b81613da157fe5b0490505b613daf86826144c0565b82850160ce556040805186815290516001600160a01b0388169133917f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f629181900360200190a3604080518681526020810183905281516001600160a01b0389169233927fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7929081900390910190a395945050505050565b80613e4f61449c565b80546001600160a01b0319166001600160a01b03928316179055604080519183168252517f66d0ef70431f555869903332dcd0c0aaaeb87594d8c2b234a5c2ddbc946533d8916020908290030190a150565b633b9aca008163ffffffff161115613ef1576040805162461bcd60e51b815260206004820152600e60248201526d7261746520746f6f206c6172676560901b604482015290519081900360640190fd5b6000613efd848461475f565b90506000613f0c6001846147a4565b808355604080518781526001600160a01b038716602082015263ffffffff86168183015290519192507f9d7c2ff41bb2c022bf25964b7e47c42b8ef2d0e16c0679bb1d61d0795d9b9f9a919081900360600190a15050505050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635e0d443f7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000600103876040518463ffffffff1660e01b81526004018084600f0b815260200183600f0b8152602001828152602001935050505060206040518083038186803b15801561402757600080fd5b505afa15801561403b573d6000803e3d6000fd5b505050506040513d602081101561405157600080fd5b5051905083811180156141e95761409e73d533a949740bb3306d119cc777fa900ba034cd527f00000000000000000000000000000000000000000000000000000000000000006000613baf565b6140dd73d533a949740bb3306d119cc777fa900ba034cd527f000000000000000000000000000000000000000000000000000000000000000087613baf565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ddc1f59d7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000600103886000896040518663ffffffff1660e01b81526004018086600f0b815260200185600f0b8152602001848152602001838152602001826001600160a01b0316815260200195505050505050602060405180830381600087803b1580156141b657600080fd5b505af11580156141ca573d6000803e3d6000fd5b505050506040513d60208110156141e057600080fd5b50519150614494565b6000738014595f2ab54cd7c604b00e9fb932176fdc86ae6001600160a01b031663509406186040518163ffffffff1660e01b815260040160206040518083038186803b15801561423857600080fd5b505afa15801561424c573d6000803e3d6000fd5b505050506040513d602081101561426257600080fd5b5051604080516370a0823160e01b815230600482015290519192507362b9c7356a2dc64a1969e19c23e4f579f9810aa7916370a0823191602480820192602092909190829003018186803b1580156142b957600080fd5b505afa1580156142cd573d6000803e3d6000fd5b505050506040513d60208110156142e357600080fd5b5051925080614368576040805163203b5c7960e21b815260048101889052600060248201819052604482018190529151738014595f2ab54cd7c604b00e9fb932176fdc86ae926380ed71e4926064808201939182900301818387803b15801561434b57600080fd5b505af115801561435f573d6000803e3d6000fd5b505050506143e0565b6040805163203b5c7960e21b815260048101889052600160248201526000604482018190529151738014595f2ab54cd7c604b00e9fb932176fdc86ae926380ed71e4926064808201939182900301818387803b1580156143c757600080fd5b505af11580156143db573d6000803e3d6000fd5b505050505b604080516370a0823160e01b8152306004820152905184917362b9c7356a2dc64a1969e19c23e4f579f9810aa7916370a0823191602480820192602092909190829003018186803b15801561443457600080fd5b505afa158015614448573d6000803e3d6000fd5b505050506040513d602081101561445e57600080fd5b50510392506001600160a01b0385163014614492576144927362b9c7356a2dc64a1969e19c23e4f579f9810aa78685613b58565b505b509392505050565b7f1919dfe11dcaf25b3f82002ff35c2a6059730a02b391fba6a3aa2e274c259ecb90565b6001600160a01b03821661451b576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b61452760008383613baa565b6035546145349082613cc2565b6035556001600160a01b03821660009081526033602052604090205461455a9082613cc2565b6001600160a01b03831660008181526033602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b0382166145f75760405162461bcd60e51b8152600401808060200182810382526021815260200180614b0a6021913960400191505060405180910390fd5b61460382600083613baa565b614640816040518060600160405280602281526020016149ec602291396001600160a01b0385166000908152603360205260409020549190613a90565b6001600160a01b03831660009081526033602052604090205560355461466690826147ba565b6035556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6000614703826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166148179092919063ffffffff16565b805190915015613baa5780806020019051602081101561472257600080fd5b5051613baa5760405162461bcd60e51b815260040180806020018281038252602a815260200180614b74602a913960400191505060405180910390fd5b60009182527fa6bf8a5c5402e9cfbc46c22ee8694e4f97b76e96329b697182e30481e8ba2894186020526040902090565b60ff81169160089190911c63ffffffff1690565b64ffffffff0060089190911b1660ff9091161790565b600082821115614811576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b606061217584846000858561482b8561493c565b61487c576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106148ba5780518252601f19909201916020918201910161489b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461491c576040519150601f19603f3d011682016040523d82523d6000602084013e614921565b606091505b5091509150614931828286614942565b979650505050505050565b3b151590565b60608315614951575081611431565b8251156149615782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315613ae4578181015183820152602001613acc56fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573735265656e7472616e637947756172643a207265656e7472616e742063616c6c0045524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77416c616464696e4352563a207a65726f206e6577207374726174656779206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f416c616464696e4352563a207a65726f20706c6174666f726d2061646472657373a264697066735822122089654a75aa8d520b694a74fa18deb8dffe7b5a9ef2c1e9c9f058b89baa2def2d64736f6c63430007060033000000000000000000000000971add32ea87f10bd192671630be3be8a11b8623000000000000000000000000aa0c3f5f7dfd688c6e646f66cd2a6b66acdbe434

Deployed Bytecode

0x60806040526004361061039b5760003560e01c80637c1ade19116101dc578063c63d75b611610102578063d905777e116100a0578063ef8b30f71161006f578063ef8b30f714610df1578063f2fde38b14610e1b578063f843c9ee14610e4e578063fafa6c6914610e87576103a2565b8063d905777e146107c2578063dd62ed3e14610d62578063e36a6b8314610d9d578063e483015314610dc7576103a2565b8063c7c4ff46116100dc578063c7c4ff4614610cf9578063ccc6367814610d0e578063cdd78cfc14610d4d578063ce96cb77146107c2576103a2565b8063c63d75b6146107c2578063c6e6f59214610cba578063c70920bc14610ce4576103a2565b8063a457c2d71161017a578063b3d7f6b911610149578063b3d7f6b914610b5e578063b460af9414610b88578063b4a03d5414610bc9578063ba08765214610c79576103a2565b8063a457c2d714610a95578063a8c62e7614610ace578063a9059cbb14610ae3578063ad2ea2e714610b1c576103a2565b806394bf804d116101b657806394bf804d146109e157806395d89b4114610a1a5780639f0d5f2714610a2f578063a293da0f14610a62576103a2565b80637c1ade19146109605780638da5cb5b146109995780638fe4e232146109ae576103a2565b806335c807e6116102c157806347e7ef241161025f5780636a4237271161022e5780636a423727146108ca5780636e553f65146108df57806370a0823114610918578063715018a61461094b576103a2565b806347e7ef241461081f5780634bde38c8146108585780634c4b5fd71461086d5780634cdad506146108a0576103a2565b8063395525ff1161029b578063395525ff1461077a5780633af9e6691461078f578063402d267d146107c25780634502cdfd146107f5576103a2565b806335c807e6146106f957806338d52e0f1461072c5780633950935114610741576103a2565b806315980d8911610339578063262d615211610308578063262d615214610631578063277982ca1461066257806329b6eca91461069b578063313ce567146106ce576103a2565b806315980d891461056757806318160ddd146105af5780631e2720ff146105c457806323b872dd146105ee576103a2565b806307a2d13a1161037557806307a2d13a14610491578063095ea7b3146104bb5780630a28a4771461050857806310f9a67714610532576103a2565b8063018ee9b7146103a757806301e1d114146103f257806306fdde0314610407576103a2565b366103a257005b600080fd5b3480156103b357600080fd5b506103e0600480360360408110156103ca57600080fd5b506001600160a01b038135169060200135610eba565b60408051918252519081900360200190f35b3480156103fe57600080fd5b506103e0610f25565b34801561041357600080fd5b5061041c610f2b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561045657818101518382015260200161043e565b50505050905090810190601f1680156104835780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561049d57600080fd5b506103e0600480360360208110156104b457600080fd5b5035610fc1565b3480156104c757600080fd5b506104f4600480360360408110156104de57600080fd5b506001600160a01b038135169060200135611005565b604080519115158252519081900360200190f35b34801561051457600080fd5b506103e06004803603602081101561052b57600080fd5b5035611023565b34801561053e57600080fd5b506105656004803603602081101561055557600080fd5b50356001600160a01b03166110cb565b005b34801561057357600080fd5b506103e06004803603608081101561058a57600080fd5b5080356001600160a01b0316906020810135906040810135906060013560ff1661114f565b3480156105bb57600080fd5b506103e06112b4565b3480156105d057600080fd5b50610565600480360360208110156105e757600080fd5b50356112ba565b3480156105fa57600080fd5b506104f46004803603606081101561061157600080fd5b506001600160a01b038135811691602081013590911690604001356113b0565b34801561063d57600080fd5b50610646611438565b604080516001600160a01b039092168252519081900360200190f35b34801561066e57600080fd5b506103e06004803603604081101561068557600080fd5b50803590602001356001600160a01b0316611447565b3480156106a757600080fd5b50610565600480360360208110156106be57600080fd5b50356001600160a01b0316611483565b3480156106da57600080fd5b506106e36117ba565b6040805160ff9092168252519081900360200190f35b34801561070557600080fd5b506105656004803603602081101561071c57600080fd5b50356001600160a01b03166117c3565b34801561073857600080fd5b506106466118d4565b34801561074d57600080fd5b506104f46004803603604081101561076457600080fd5b506001600160a01b0381351690602001356118ec565b34801561078657600080fd5b506103e061193a565b34801561079b57600080fd5b506103e0600480360360208110156107b257600080fd5b50356001600160a01b0316611940565b3480156107ce57600080fd5b506103e0600480360360208110156107e557600080fd5b50356001600160a01b031661197f565b34801561080157600080fd5b506105656004803603602081101561081857600080fd5b5035611986565b34801561082b57600080fd5b506103e06004803603604081101561084257600080fd5b506001600160a01b038135169060200135611a78565b34801561086457600080fd5b50610646611a84565b34801561087957600080fd5b506103e06004803603602081101561089057600080fd5b50356001600160a01b0316611a93565b3480156108ac57600080fd5b506103e0600480360360208110156108c357600080fd5b5035611aa1565b3480156108d657600080fd5b506103e0611b4f565b3480156108eb57600080fd5b506103e06004803603604081101561090257600080fd5b50803590602001356001600160a01b0316611b55565b34801561092457600080fd5b506103e06004803603602081101561093b57600080fd5b50356001600160a01b0316611cde565b34801561095757600080fd5b50610565611cf9565b34801561096c57600080fd5b506103e06004803603604081101561098357600080fd5b506001600160a01b038135169060200135611da5565b3480156109a557600080fd5b50610646611e8c565b3480156109ba57600080fd5b50610565600480360360208110156109d157600080fd5b50356001600160a01b0316611e9b565b3480156109ed57600080fd5b506103e060048036036040811015610a0457600080fd5b50803590602001356001600160a01b0316611f09565b348015610a2657600080fd5b5061041c611f7a565b348015610a3b57600080fd5b506103e060048036036020811015610a5257600080fd5b50356001600160a01b0316611fdb565b348015610a6e57600080fd5b5061056560048036036020811015610a8557600080fd5b50356001600160a01b0316611fe9565b348015610aa157600080fd5b506104f460048036036040811015610ab857600080fd5b506001600160a01b0381351690602001356120da565b348015610ada57600080fd5b50610646612142565b348015610aef57600080fd5b506104f460048036036040811015610b0657600080fd5b506001600160a01b038135169060200135612151565b348015610b2857600080fd5b506103e060048036036060811015610b3f57600080fd5b5080356001600160a01b0316906020810135906040013560ff16612165565b348015610b6a57600080fd5b506103e060048036036020811015610b8157600080fd5b503561217d565b348015610b9457600080fd5b506103e060048036036060811015610bab57600080fd5b508035906001600160a01b0360208201358116916040013516612188565b348015610bd557600080fd5b5061056560048036036020811015610bec57600080fd5b810190602081018135640100000000811115610c0757600080fd5b820183602082011115610c1957600080fd5b80359060200191846020830284011164010000000083111715610c3b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550612357945050505050565b348015610c8557600080fd5b506103e060048036036060811015610c9c57600080fd5b508035906001600160a01b036020820135811691604001351661245a565b348015610cc657600080fd5b506103e060048036036020811015610cdd57600080fd5b5035612553565b348015610cf057600080fd5b506103e0612578565b348015610d0557600080fd5b5061064661257e565b348015610d1a57600080fd5b5061056560048036036040811015610d3157600080fd5b5080356001600160a01b0316906020013563ffffffff1661258d565b348015610d5957600080fd5b506103e0612672565b348015610d6e57600080fd5b506103e060048036036040811015610d8557600080fd5b506001600160a01b0381358116916020013516612678565b348015610da957600080fd5b5061056560048036036020811015610dc057600080fd5b50356126a3565b348015610dd357600080fd5b5061056560048036036020811015610dea57600080fd5b5035612795565b348015610dfd57600080fd5b506103e060048036036020811015610e1457600080fd5b5035612887565b348015610e2757600080fd5b5061056560048036036020811015610e3e57600080fd5b50356001600160a01b0316612892565b348015610e5a57600080fd5b506103e060048036036040811015610e7157600080fd5b506001600160a01b038135169060200135612995565b348015610e9357600080fd5b5061056560048036036020811015610eaa57600080fd5b50356001600160a01b0316612b1d565b600060026097541415610f02576040805162461bcd60e51b815260206004820152601f60248201526000805160206149cc833981519152604482015290519081900360640190fd5b6002609755610f0f612dc7565b610f198383612e34565b60016097559392505050565b60ce5490565b60368054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610fb75780601f10610f8c57610100808354040283529160200191610fb7565b820191906000526020600020905b815481529060010190602001808311610f9a57829003601f168201915b5050505050905090565b600080610fcc6112b4565b905080610fdc5782915050611000565b6000610fe6610f25565b905081610ff382866130b9565b81610ffa57fe5b04925050505b919050565b6000611019611012613112565b8484613116565b5060015b92915050565b60008061102e610f25565b90508083111561107b576040805162461bcd60e51b815260206004820152601360248201527265786365656420746f74616c2061737365747360681b604482015290519081900360640190fd5b600061108684612553565b9050818414156110995791506110009050565b6110c260ca54633b9aca00036110bc633b9aca00846130b990919063ffffffff16565b90613202565b92505050611000565b6110d3613112565b6001600160a01b03166110e4611e8c565b6001600160a01b03161461112d576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b60d080546001600160a01b0319166001600160a01b0392909216919091179055565b600060026097541415611197576040805162461bcd60e51b815260206004820152601f60248201526000805160206149cc833981519152604482015290519081900360640190fd5b60026097556000198414156111b2576111af33611cde565b93505b60008260048111156111c057fe5b141561122d576111d1848633613269565b905082811015611228576040805162461bcd60e51b815260206004820152601f60248201527f416c616464696e4352563a20696e73756666696369656e74206f757470757400604482015290519081900360640190fd5b611249565b611238843033613269565b9050611246858285856134e5565b90505b846001600160a01b0316336001600160a01b03167fb9da3f3df62c28aca604806cc6ee9678189d7591ef511a77bb040fa8361e9e0286856040518083815260200182600481111561129657fe5b81526020019250505060405180910390a36001609755949350505050565b60355490565b60d0546001600160a01b03163314611311576040805162461bcd60e51b815260206004820152601560248201527437b7363c903932bbb0b932103232b837b9b4ba37b960591b604482015290519081900360640190fd5b60cf546001600160a01b031661133d7362b9c7356a2dc64a1969e19c23e4f579f9810aa73383856138d3565b604080516311f9fbc960e21b81523060048201526024810184905290516001600160a01b038316916347e7ef2491604480830192600092919082900301818387803b15801561138b57600080fd5b505af115801561139f573d6000803e3d6000fd5b505060ce8054909401909355505050565b60006113bd848484613933565b61142d846113c9613112565b61142885604051806060016040528060288152602001614ac2602891396001600160a01b038a16600090815260346020526040812090611407613112565b6001600160a01b031681526020810191909152604001600020549190613a90565b613116565b5060015b9392505050565b60c9546001600160a01b031681565b600061145283613b27565b90506000806114618585613b2e565b915091508160ff166001141561147b578063ffffffff1692505b505092915050565b60cf546001600160a01b0316156114cf576040805162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b604482015290519081900360640190fd5b60cf80546001600160a01b0319166001600160a01b038316179055604080516246613160e11b81523060048201529051733fe65692bfcd0e6cf84cb1e7d24108e434a7587e91628cc262916024808301926020929190829003018186803b15801561153957600080fd5b505afa15801561154d573d6000803e3d6000fd5b505050506040513d602081101561156357600080fd5b5051156115a7576040805162461bcd60e51b815260206004820152600d60248201526c1b9bdd081a185c9d995cdd1959609a1b604482015290519081900360640190fd5b604080516370a0823160e01b81523060048201529051600091733fe65692bfcd0e6cf84cb1e7d24108e434a7587e916370a0823191602480820192602092909190829003018186803b1580156115fc57600080fd5b505afa158015611610573d6000803e3d6000fd5b505050506040513d602081101561162657600080fd5b505160408051631c683a1b60e11b8152600481018390526000602482018190529151929350733fe65692bfcd0e6cf84cb1e7d24108e434a7587e926338d0743692604480840193602093929083900390910190829087803b15801561168a57600080fd5b505af115801561169e573d6000803e3d6000fd5b505050506040513d60208110156116b457600080fd5b506116d690507362b9c7356a2dc64a1969e19c23e4f579f9810aa78383613b58565b604080516311f9fbc960e21b81526000600482018190526024820184905291516001600160a01b038516926347e7ef24926044808201939182900301818387803b15801561172357600080fd5b505af1158015611737573d6000803e3d6000fd5b50505060ce8290555061178173d533a949740bb3306d119cc777fa900ba034cd527f000000000000000000000000971add32ea87f10bd192671630be3be8a11b8623600019613baf565b6117b673d533a949740bb3306d119cc777fa900ba034cd52738014595f2ab54cd7c604b00e9fb932176fdc86ae600019613baf565b5050565b60385460ff1690565b6117cb613112565b6001600160a01b03166117dc611e8c565b6001600160a01b031614611825576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b6001600160a01b038116611880576040805162461bcd60e51b815260206004820152601c60248201527f416c616464696e4352563a207a65726f207a6170206164647265737300000000604482015290519081900360640190fd5b60c980546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f03e59dbc22b06c47327d520cddc8bf2923ac525a1742732bf344562d7f72d0f59181900360200190a150565b7362b9c7356a2dc64a1969e19c23e4f579f9810aa790565b60006110196118f9613112565b84611428856034600061190a613112565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490613cc2565b60ca5481565b60008061194b6112b4565b90508061195c576000915050611000565b600061196784611cde565b905081610ff360ce54836130b990919063ffffffff16565b5060001990565b61198e613112565b6001600160a01b031661199f611e8c565b6001600160a01b0316146119e8576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b6305f5e100811115611a3d576040805162461bcd60e51b8152602060048201526019602482015278416c616464696e4352563a2066656520746f6f206c6172676560381b604482015290519081900360640190fd5b60ca8190556040805182815290517ff775bac4793637fce9f6895c2dd6f91e6847921d94ff446ecfdb9685b7f9829d9181900360200190a150565b60006114318284611b55565b60cd546001600160a01b031681565b600061101d82600019612995565b600080611aac6112b4565b905080831115611af9576040805162461bcd60e51b815260206004820152601360248201527265786365656420746f74616c20737570706c7960681b604482015290519081900360640190fd5b6000611b0484610fc1565b9050611b0e6112b4565b841415611b1e5791506110009050565b6000633b9aca00611b3a60ca54846130b990919063ffffffff16565b81611b4157fe5b049091039250611000915050565b60cc5481565b600060026097541415611b9d576040805162461bcd60e51b815260206004820152601f60248201526000805160206149cc833981519152604482015290519081900360640190fd5b6002609755600019831415611c2c57604080516370a0823160e01b815233600482015290517362b9c7356a2dc64a1969e19c23e4f579f9810aa7916370a08231916024808301926020929190829003018186803b158015611bfd57600080fd5b505afa158015611c11573d6000803e3d6000fd5b505050506040513d6020811015611c2757600080fd5b505192505b60cf546001600160a01b0316611c587362b9c7356a2dc64a1969e19c23e4f579f9810aa73383876138d3565b806001600160a01b03166347e7ef2484866040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611caf57600080fd5b505af1158015611cc3573d6000803e3d6000fd5b50505050611cd18385613d1c565b6001609755949350505050565b6001600160a01b031660009081526033602052604090205490565b611d01613112565b6001600160a01b0316611d12611e8c565b6001600160a01b031614611d5b576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b6065546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3606580546001600160a01b0319169055565b6000600019821415611e4657604080516370a0823160e01b815233600482015290516001600160a01b037f000000000000000000000000aa0c3f5f7dfd688c6e646f66cd2a6b66acdbe43416916370a08231916024808301926020929190829003018186803b158015611e1757600080fd5b505afa158015611e2b573d6000803e3d6000fd5b505050506040513d6020811015611e4157600080fd5b505191505b60cf54611e82906001600160a01b037f000000000000000000000000aa0c3f5f7dfd688c6e646f66cd2a6b66acdbe434811691339116856138d3565b6114318383613d1c565b6065546001600160a01b031690565b611ea3613112565b6001600160a01b0316611eb4611e8c565b6001600160a01b031614611efd576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b611f0681613e46565b50565b600060026097541415611f51576040805162461bcd60e51b815260206004820152601f60248201526000805160206149cc833981519152604482015290519081900360640190fd5b60026097556000611f6184610fc1565b9050611f6d8184611b55565b5060016097559392505050565b60378054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610fb75780601f10610f8c57610100808354040283529160200191610fb7565b600061101d60001983611b55565b611ff1613112565b6001600160a01b0316612002611e8c565b6001600160a01b03161461204b576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b6001600160a01b0381166120905760405162461bcd60e51b8152600401808060200182810382526021815260200180614bf96021913960400191505060405180910390fd5b60cd80546001600160a01b0319166001600160a01b0383169081179091556040517f43412ddbc9c884a0be720e21657a878716d21710438ad24f74f7e99699df82fc90600090a250565b60006110196120e7613112565b8461142885604051806060016040528060258152602001614bd46025913960346000612111613112565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190613a90565b60cf546001600160a01b031681565b600061101961215e613112565b8484613933565b600061217584600019858561114f565b949350505050565b600061101d82610fc1565b6000600260975414156121d0576040805162461bcd60e51b815260206004820152601f60248201526000805160206149cc833981519152604482015290519081900360640190fd5b60026097556000198414156121f3576121f06121eb83611cde565b610fc1565b93505b60006121fd610f25565b90508085111561224a576040805162461bcd60e51b815260206004820152601360248201527265786365656420746f74616c2061737365747360681b604482015290519081900360640190fd5b600061225586612553565b9050818610156122b257600061228b7f8d2b8eacf0b88f0b387605673326a53dcb958998ee7592cf927b284ac721fc3386611447565b90506122ae81633b9aca00036110bc633b9aca00856130b990919063ffffffff16565b9150505b336001600160a01b0385161461233d5760006122ce8533612678565b905081811015612325576040805162461bcd60e51b815260206004820152601a60248201527f7769746864726177206578636565647320616c6c6f77616e6365000000000000604482015290519081900360640190fd5b600019811461233b5761233b8533848403613116565b505b612348818686613269565b50600160975595945050505050565b61235f613112565b6001600160a01b0316612370611e8c565b6001600160a01b0316146123b9576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b60cf5460405163019388d760e41b81526020600482018181528451602484015284516001600160a01b03909416936319388d709386938392604490920191818601910280838360005b8381101561241a578181015183820152602001612402565b5050505090500192505050600060405180830381600087803b15801561243f57600080fd5b505af1158015612453573d6000803e3d6000fd5b5050505050565b6000600260975414156124a2576040805162461bcd60e51b815260206004820152601f60248201526000805160206149cc833981519152604482015290519081900360640190fd5b60026097556000198414156124bd576124ba82611cde565b93505b336001600160a01b038316146125485760006124d98333612678565b905084811015612530576040805162461bcd60e51b815260206004820152601860248201527f72656465656d206578636565647320616c6c6f77616e63650000000000000000604482015290519081900360640190fd5b6000198114612546576125468333878403613116565b505b611cd1848484613269565b60008061255e610f25565b90508061256e5782915050611000565b6000610fe66112b4565b60ce5481565b60d0546001600160a01b031681565b612595613112565b6001600160a01b03166125a6611e8c565b6001600160a01b0316146125ef576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b6305f5e1008163ffffffff161115612647576040805162461bcd60e51b815260206004820152601660248201527577697468647261772066656520746f6f206c6172676560501b604482015290519081900360640190fd5b6117b67f8d2b8eacf0b88f0b387605673326a53dcb958998ee7592cf927b284ac721fc338383613ea1565b60cb5481565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b6126ab613112565b6001600160a01b03166126bc611e8c565b6001600160a01b031614612705576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b6305f5e10081111561275a576040805162461bcd60e51b8152602060048201526019602482015278416c616464696e4352563a2066656520746f6f206c6172676560381b604482015290519081900360640190fd5b60cc8190556040805182815290517fc69cbab065ddb19d4ee1f9cfe242c82b8facbd1e93c89e5830dfe0d4fb2598539181900360200190a150565b61279d613112565b6001600160a01b03166127ae611e8c565b6001600160a01b0316146127f7576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b630bebc20081111561284c576040805162461bcd60e51b8152602060048201526019602482015278416c616464696e4352563a2066656520746f6f206c6172676560381b604482015290519081900360640190fd5b60cb8190556040805182815290517f9f143d1158804dce75cd6feac5b8fde3c0d57c70d176355a6ab516a2524fcb9f9181900360200190a150565b600061101d82612553565b61289a613112565b6001600160a01b03166128ab611e8c565b6001600160a01b0316146128f4576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b6001600160a01b0381166129395760405162461bcd60e51b8152600401808060200182810382526026815260200180614a0e6026913960400191505060405180910390fd5b6065546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3606580546001600160a01b0319166001600160a01b0392909216919091179055565b6000600260975414156129dd576040805162461bcd60e51b815260206004820152601f60248201526000805160206149cc833981519152604482015290519081900360640190fd5b6002609755600019821415612a6c57604080516370a0823160e01b8152336004820152905173d533a949740bb3306d119cc777fa900ba034cd52916370a08231916024808301926020929190829003018186803b158015612a3d57600080fd5b505afa158015612a51573d6000803e3d6000fd5b505050506040513d6020811015612a6757600080fd5b505191505b612a8c73d533a949740bb3306d119cc777fa900ba034cd523330856138d3565b60cf546001600160a01b0316612aa28382613f67565b9250806001600160a01b03166347e7ef2485856040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015612afb57600080fd5b505af1158015612b0f573d6000803e3d6000fd5b50505050611cd18484613d1c565b612b25613112565b6001600160a01b0316612b36611e8c565b6001600160a01b031614612b7f576040805162461bcd60e51b81526020600482018190526024820152600080516020614aea833981519152604482015290519081900360640190fd5b6001600160a01b038116612bc45760405162461bcd60e51b8152600401808060200182810382526025815260200180614a9d6025913960400191505060405180910390fd5b60ce5460cf80546001600160a01b038481166001600160a01b031983168117909355604080516388242e5d60e01b815260048101949094525191169182916388242e5d9160248082019260009290919082900301818387803b158015612c2957600080fd5b505af1158015612c3d573d6000803e3d6000fd5b50505050806001600160a01b031663f3fef3a384846040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015612c9857600080fd5b505af1158015612cac573d6000803e3d6000fd5b50505050806001600160a01b031663663c261b846040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b158015612cff57600080fd5b505af1158015612d13573d6000803e3d6000fd5b5050604080516311f9fbc960e21b81523060048201526024810186905290516001600160a01b03871693506347e7ef249250604480830192600092919082900301818387803b158015612d6557600080fd5b505af1158015612d79573d6000803e3d6000fd5b5050604080516001600160a01b0380861682528716602082015281517f9249d6a64288c19c5be5f4f1bb9b763ad4afac803128f1ef65b88acb13df9aa49450908190039091019150a1505050565b6000612dd161449c565b546001600160a01b03169050801580612df257506001600160a01b03811633145b611f06576040805162461bcd60e51b815260206004820152600e60248201526d37b7363c903430b93b32b9ba32b960911b604482015290519081900360640190fd5b60cf5460c954604080516366cc185760e01b81526001600160a01b03928316600482015273d533a949740bb3306d119cc777fa900ba034cd52602482015290516000939290921691839183916366cc18579160448082019260209290919082900301818787803b158015612ea757600080fd5b505af1158015612ebb573d6000803e3d6000fd5b505050506040513d6020811015612ed157600080fd5b505190506000612ee18284613f67565b905084811015612f38576040805162461bcd60e51b815260206004820181905260248201527f416c616464696e4352563a20696e73756666696369656e742072657761726473604482015290519081900360640190fd5b604080516311f9fbc960e21b81526000600482018190526024820184905291516001600160a01b038616926347e7ef24926044808201939182900301818387803b158015612f8557600080fd5b505af1158015612f99573d6000803e3d6000fd5b50506040805184815290513393507fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba92509081900360200190a26000612fdd6112b4565b60cb5460cc54919250908115612ff957633b9aca008285020491505b801561300957633b9aca00908402045b60ce54828503829003908101808585028161302057fe5b049350808584028161302e57fe5b60408051898152602081018890529290910482820181905290519094506001600160a01b038d169133917fd25759d838eb0a46600f8f327cce144e61d7caefbef27010fe31e2aab091704f9181900360600190a360cd54613098906001600160a01b0316856144c0565b6130a28b846144c0565b505060ce8054850190555091979650505050505050565b6000826130c85750600061101d565b828202828482816130d557fe5b04146114315760405162461bcd60e51b8152600401808060200182810382526021815260200180614a7c6021913960400191505060405180910390fd5b3390565b6001600160a01b03831661315b5760405162461bcd60e51b8152600401808060200182810382526024815260200180614b506024913960400191505060405180910390fd5b6001600160a01b0382166131a05760405162461bcd60e51b8152600401808060200182810382526022815260200180614a346022913960400191505060405180910390fd5b6001600160a01b03808416600081815260346020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6000808211613258576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161326157fe5b049392505050565b60008084116132bf576040805162461bcd60e51b815260206004820152601f60248201527f416c616464696e4352563a207a65726f20736861726520776974686472617700604482015290519081900360640190fd5b6132c882611cde565b84111561331c576040805162461bcd60e51b815260206004820152601d60248201527f416c616464696e4352563a20736861726573206e6f7420656e6f756768000000604482015290519081900360640190fd5b60ce5460006133296112b4565b61333387846130b9565b8161333a57fe5b04905061334784876145b2565b61334f6112b4565b6133d95761335e336000612e34565b5060ce5460cf546040805163f3fef3a360e01b81526001600160a01b03898116600483015260248201859052915193965086955091169163f3fef3a39160448082019260009290919082900301818387803b1580156133bc57600080fd5b505af11580156133d0573d6000803e3d6000fd5b50505050613489565b80925060006134087f8d2b8eacf0b88f0b387605673326a53dcb958998ee7592cf927b284ac721fc3386611447565b60cf546040805163f3fef3a360e01b81526001600160a01b038a81166004830152633b9aca00898602049889900360248301819052925192989495509092169163f3fef3a391604480830192600092919082900301818387803b15801561346e57600080fd5b505af1158015613482573d6000803e3d6000fd5b5050505050505b82820360ce55604080518481526020810188905281516001600160a01b03808816939089169233927ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db929181900390910190a450509392505050565b600060018260048111156134f557fe5b14156136635782841015613550576040805162461bcd60e51b815260206004820152601f60248201527f416c616464696e4352563a20696e73756666696369656e74206f757470757400604482015290519081900360640190fd5b6135907362b9c7356a2dc64a1969e19c23e4f579f9810aa77f000000000000000000000000aa0c3f5f7dfd688c6e646f66cd2a6b66acdbe4346000613baf565b6135cf7362b9c7356a2dc64a1969e19c23e4f579f9810aa77f000000000000000000000000aa0c3f5f7dfd688c6e646f66cd2a6b66acdbe43486613baf565b7f000000000000000000000000aa0c3f5f7dfd688c6e646f66cd2a6b66acdbe4346001600160a01b0316632ee4090886866040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561364657600080fd5b505af115801561365a573d6000803e3d6000fd5b505050506138ca565b6000600283600481111561367357fe5b1415613694575073d533a949740bb3306d119cc777fa900ba034cd5261372c565b60048360048111156136a257fe5b14156136b05750600061372c565b60038360048111156136be57fe5b14156136df5750734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b61372c565b6040805162461bcd60e51b815260206004820152601e60248201527f416c616464696e4352563a20756e737570706f72746564206f7074696f6e0000604482015290519081900360640190fd5b60c9546001600160a01b03166137577362b9c7356a2dc64a1969e19c23e4f579f9810aa78288613b58565b604080516349df439160e01b81527362b9c7356a2dc64a1969e19c23e4f579f9810aa76004820152602481018890526001600160a01b038481166044830152606482018890529151918316916349df4391916084808201926020929091908290030181600087803b1580156137cb57600080fd5b505af11580156137df573d6000803e3d6000fd5b505050506040513d60208110156137f557600080fd5b505195506001600160a01b0382166138b3576040516000906001600160a01b0389169088908381818185875af1925050503d8060008114613852576040519150601f19603f3d011682016040523d82523d6000602084013e613857565b606091505b50509050806138ad576040805162461bcd60e51b815260206004820152601f60248201527f416c616464696e4352563a20455448207472616e73666572206661696c656400604482015290519081900360640190fd5b506138c7565b6138c76001600160a01b0383168888613b58565b50505b50919392505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261392d9085906146ae565b50505050565b6001600160a01b0383166139785760405162461bcd60e51b8152600401808060200182810382526025815260200180614b2b6025913960400191505060405180910390fd5b6001600160a01b0382166139bd5760405162461bcd60e51b81526004018080602001828103825260238152602001806149a96023913960400191505060405180910390fd5b6139c8838383613baa565b613a0581604051806060016040528060268152602001614a56602691396001600160a01b0386166000908152603360205260409020549190613a90565b6001600160a01b038085166000908152603360205260408082209390935590841681522054613a349082613cc2565b6001600160a01b0380841660008181526033602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115613b1f5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613ae4578181015183820152602001613acc565b50505050905090810190601f168015613b115780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b5060ca5490565b6000806000613b3d858561475f565b8054909150613b4b81614790565b9097909650945050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052613baa9084906146ae565b505050565b801580613c35575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015613c0757600080fd5b505afa158015613c1b573d6000803e3d6000fd5b505050506040513d6020811015613c3157600080fd5b5051155b613c705760405162461bcd60e51b8152600401808060200182810382526036815260200180614b9e6036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052613baa9084906146ae565b600082820183811015611431576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000808211613d72576040805162461bcd60e51b815260206004820152601f60248201527f416c616464696e4352563a207a65726f20616d6f756e74206465706f73697400604482015290519081900360640190fd5b60ce546000613d7f6112b4565b9050600081613d8f575083613da5565b82613d9a86846130b9565b81613da157fe5b0490505b613daf86826144c0565b82850160ce556040805186815290516001600160a01b0388169133917f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f629181900360200190a3604080518681526020810183905281516001600160a01b0389169233927fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7929081900390910190a395945050505050565b80613e4f61449c565b80546001600160a01b0319166001600160a01b03928316179055604080519183168252517f66d0ef70431f555869903332dcd0c0aaaeb87594d8c2b234a5c2ddbc946533d8916020908290030190a150565b633b9aca008163ffffffff161115613ef1576040805162461bcd60e51b815260206004820152600e60248201526d7261746520746f6f206c6172676560901b604482015290519081900360640190fd5b6000613efd848461475f565b90506000613f0c6001846147a4565b808355604080518781526001600160a01b038716602082015263ffffffff86168183015290519192507f9d7c2ff41bb2c022bf25964b7e47c42b8ef2d0e16c0679bb1d61d0795d9b9f9a919081900360600190a15050505050565b6000807f000000000000000000000000971add32ea87f10bd192671630be3be8a11b86236001600160a01b0316635e0d443f7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000600103876040518463ffffffff1660e01b81526004018084600f0b815260200183600f0b8152602001828152602001935050505060206040518083038186803b15801561402757600080fd5b505afa15801561403b573d6000803e3d6000fd5b505050506040513d602081101561405157600080fd5b5051905083811180156141e95761409e73d533a949740bb3306d119cc777fa900ba034cd527f000000000000000000000000971add32ea87f10bd192671630be3be8a11b86236000613baf565b6140dd73d533a949740bb3306d119cc777fa900ba034cd527f000000000000000000000000971add32ea87f10bd192671630be3be8a11b862387613baf565b7f000000000000000000000000971add32ea87f10bd192671630be3be8a11b86236001600160a01b031663ddc1f59d7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000600103886000896040518663ffffffff1660e01b81526004018086600f0b815260200185600f0b8152602001848152602001838152602001826001600160a01b0316815260200195505050505050602060405180830381600087803b1580156141b657600080fd5b505af11580156141ca573d6000803e3d6000fd5b505050506040513d60208110156141e057600080fd5b50519150614494565b6000738014595f2ab54cd7c604b00e9fb932176fdc86ae6001600160a01b031663509406186040518163ffffffff1660e01b815260040160206040518083038186803b15801561423857600080fd5b505afa15801561424c573d6000803e3d6000fd5b505050506040513d602081101561426257600080fd5b5051604080516370a0823160e01b815230600482015290519192507362b9c7356a2dc64a1969e19c23e4f579f9810aa7916370a0823191602480820192602092909190829003018186803b1580156142b957600080fd5b505afa1580156142cd573d6000803e3d6000fd5b505050506040513d60208110156142e357600080fd5b5051925080614368576040805163203b5c7960e21b815260048101889052600060248201819052604482018190529151738014595f2ab54cd7c604b00e9fb932176fdc86ae926380ed71e4926064808201939182900301818387803b15801561434b57600080fd5b505af115801561435f573d6000803e3d6000fd5b505050506143e0565b6040805163203b5c7960e21b815260048101889052600160248201526000604482018190529151738014595f2ab54cd7c604b00e9fb932176fdc86ae926380ed71e4926064808201939182900301818387803b1580156143c757600080fd5b505af11580156143db573d6000803e3d6000fd5b505050505b604080516370a0823160e01b8152306004820152905184917362b9c7356a2dc64a1969e19c23e4f579f9810aa7916370a0823191602480820192602092909190829003018186803b15801561443457600080fd5b505afa158015614448573d6000803e3d6000fd5b505050506040513d602081101561445e57600080fd5b50510392506001600160a01b0385163014614492576144927362b9c7356a2dc64a1969e19c23e4f579f9810aa78685613b58565b505b509392505050565b7f1919dfe11dcaf25b3f82002ff35c2a6059730a02b391fba6a3aa2e274c259ecb90565b6001600160a01b03821661451b576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b61452760008383613baa565b6035546145349082613cc2565b6035556001600160a01b03821660009081526033602052604090205461455a9082613cc2565b6001600160a01b03831660008181526033602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b0382166145f75760405162461bcd60e51b8152600401808060200182810382526021815260200180614b0a6021913960400191505060405180910390fd5b61460382600083613baa565b614640816040518060600160405280602281526020016149ec602291396001600160a01b0385166000908152603360205260409020549190613a90565b6001600160a01b03831660009081526033602052604090205560355461466690826147ba565b6035556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6000614703826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166148179092919063ffffffff16565b805190915015613baa5780806020019051602081101561472257600080fd5b5051613baa5760405162461bcd60e51b815260040180806020018281038252602a815260200180614b74602a913960400191505060405180910390fd5b60009182527fa6bf8a5c5402e9cfbc46c22ee8694e4f97b76e96329b697182e30481e8ba2894186020526040902090565b60ff81169160089190911c63ffffffff1690565b64ffffffff0060089190911b1660ff9091161790565b600082821115614811576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b606061217584846000858561482b8561493c565b61487c576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106148ba5780518252601f19909201916020918201910161489b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461491c576040519150601f19603f3d011682016040523d82523d6000602084013e614921565b606091505b5091509150614931828286614942565b979650505050505050565b3b151590565b60608315614951575081611431565b8251156149615782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315613ae4578181015183820152602001613acc56fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573735265656e7472616e637947756172643a207265656e7472616e742063616c6c0045524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77416c616464696e4352563a207a65726f206e6577207374726174656779206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f416c616464696e4352563a207a65726f20706c6174666f726d2061646472657373a264697066735822122089654a75aa8d520b694a74fa18deb8dffe7b5a9ef2c1e9c9f058b89baa2def2d64736f6c63430007060033

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

000000000000000000000000971add32ea87f10bd192671630be3be8a11b8623000000000000000000000000aa0c3f5f7dfd688c6e646f66cd2a6b66acdbe434

-----Decoded View---------------
Arg [0] : _curveCvxCrvPool (address): 0x971add32Ea87f10bD192671630be3BE8A11b8623
Arg [1] : _wrapper (address): 0xaa0C3f5F7DFD688C6E646F66CD2a6B66ACdbE434

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000971add32ea87f10bd192671630be3be8a11b8623
Arg [1] : 000000000000000000000000aa0c3f5f7dfd688c6e646f66cd2a6b66acdbe434


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

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

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.