{"file_path":"contracts/f(x)/v1/Market.sol","creation_status":"success","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.6;\n\nimport { AccessControlUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport { SafeMathUpgradeable } from \"@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport { SafeERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\";\n\nimport { IFxMarket } from \"../../interfaces/f(x)/IFxMarket.sol\";\nimport { IFxReservePool } from \"../../interfaces/f(x)/IFxReservePool.sol\";\nimport { IFxTreasury } from \"../../interfaces/f(x)/IFxTreasury.sol\";\n\n// solhint-disable max-states-count\n\ncontract Market is AccessControlUpgradeable, ReentrancyGuardUpgradeable, IFxMarket {\n  using SafeERC20Upgradeable for IERC20Upgradeable;\n  using SafeMathUpgradeable for uint256;\n\n  /**********\n   * Events *\n   **********/\n\n  /// @notice Emitted when the fee ratio for minting fToken is updated.\n  /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n  /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n  event UpdateMintFeeRatioFToken(uint128 defaultFeeRatio, int128 extraFeeRatio);\n\n  /// @notice Emitted when the fee ratio for minting xToken is updated.\n  /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n  /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n  event UpdateMintFeeRatioXToken(uint128 defaultFeeRatio, int128 extraFeeRatio);\n\n  /// @notice Emitted when the fee ratio for redeeming fToken is updated.\n  /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n  /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n  event UpdateRedeemFeeRatioFToken(uint128 defaultFeeRatio, int128 extraFeeRatio);\n\n  /// @notice Emitted when the fee ratio for redeeming xToken is updated.\n  /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n  /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n  event UpdateRedeemFeeRatioXToken(uint128 defaultFeeRatio, int128 extraFeeRatio);\n\n  /// @notice Emitted when the market config is updated.\n  /// @param stabilityRatio The new start collateral ratio to enter system stability mode, multiplied by 1e18.\n  /// @param liquidationRatio The new start collateral ratio to enter incentivized user liquidation mode, multiplied by 1e18.\n  /// @param selfLiquidationRatio The new start collateral ratio to enter self liquidation mode, multiplied by 1e18.\n  /// @param recapRatio The new start collateral ratio to enter recap mode, multiplied by 1e18.\n  event UpdateMarketConfig(\n    uint64 stabilityRatio,\n    uint64 liquidationRatio,\n    uint64 selfLiquidationRatio,\n    uint64 recapRatio\n  );\n\n  /// @notice Emitted when the incentive config is updated.\n  /// @param stabilityIncentiveRatio The new incentive ratio for system stability mode, multiplied by 1e18.\n  /// @param liquidationIncentiveRatio The new incentive ratio for incentivized user liquidation mode, multiplied by 1e18.\n  /// @param selfLiquidationIncentiveRatio The new incentive ratio for self liquidation mode, multiplied by 1e18.\n  event UpdateIncentiveConfig(\n    uint64 stabilityIncentiveRatio,\n    uint64 liquidationIncentiveRatio,\n    uint64 selfLiquidationIncentiveRatio\n  );\n\n  /// @notice Emitted when the whitelist status for settle is changed.\n  /// @param account The address of account to change.\n  /// @param status The new whitelist status.\n  event UpdateLiquidationWhitelist(address account, bool status);\n\n  /// @notice Emitted when the platform contract is changed.\n  /// @param platform The address of new platform.\n  event UpdatePlatform(address platform);\n\n  /// @notice Emitted when the  reserve pool contract is changed.\n  /// @param reservePool The address of new reserve pool.\n  event UpdateReservePool(address reservePool);\n\n  /// @notice Emitted when the RebalancePoolRegistry contract is updated.\n  /// @param registry The address of new RebalancePoolRegistry pool.\n  event UpdateRebalancePoolRegistry(address registry);\n\n  /// @notice Pause or unpause mint.\n  /// @param status The new status for mint.\n  event PauseMint(bool status);\n\n  /// @notice Pause or unpause redeem.\n  /// @param status The new status for redeem.\n  event PauseRedeem(bool status);\n\n  /// @notice Pause or unpause fToken mint in system stability mode.\n  /// @param status The new status for mint.\n  event PauseFTokenMintInSystemStabilityMode(bool status);\n\n  /// @notice Pause or unpause xToken redeem in system stability mode.\n  /// @param status The new status for redeem.\n  event PauseXTokenRedeemInSystemStabilityMode(bool status);\n\n  /// @notice Pause or unpause mintBoth in system stability mode.\n  /// @param status The new status for mintBoth.\n  event PauseMintBothInSystemStabilityMode(bool status);\n\n  /*************\n   * Constants *\n   *************/\n\n  /// @notice The role for emergency dao.\n  bytes32 public constant EMERGENCY_DAO_ROLE = keccak256(\"EMERGENCY_DAO_ROLE\");\n\n    /// @notice The role for permissioned mint/redeem operator.\n  bytes32 public constant MANAGER_ROLE = keccak256(\"MANAGER_ROLE\");\n\n  /// @dev The precision used to compute nav.\n  uint256 private constant PRECISION = 1e18;\n\n  /***********\n   * Structs *\n   ***********/\n\n  /// @dev Compiler will pack this into single `uint256`.\n  struct FeeRatio {\n    // The default fee ratio, multiplied by 1e18.\n    uint128 defaultFeeRatio;\n    // The extra delta fee ratio, multiplied by 1e18.\n    int128 extraFeeRatio;\n  }\n\n  /// @dev Compiler will pack this into single `uint256`.\n  struct MarketConfig {\n    // The start collateral ratio to enter system stability mode, multiplied by 1e18.\n    uint64 stabilityRatio;\n    // The start collateral ratio to enter incentivized user liquidation mode, multiplied by 1e18.\n    uint64 liquidationRatio;\n    // The start collateral ratio to enter self liquidation mode, multiplied by 1e18.\n    uint64 selfLiquidationRatio;\n    // The start collateral ratio to enter recap mode, multiplied by 1e18.\n    uint64 recapRatio;\n  }\n\n  /// @dev Compiler will pack this into single `uint256`.\n  struct IncentiveConfig {\n    // The incentive ratio for system stability mode, multiplied by 1e18.\n    uint64 stabilityIncentiveRatio;\n    // The incentive ratio for incentivized user liquidation mode, multiplied by 1e18.\n    uint64 liquidationIncentiveRatio;\n    // The incentive ratio for self liquidation mode, multiplied by 1e18.\n    uint64 selfLiquidationIncentiveRatio;\n  }\n\n  /*************\n   * Variables *\n   *************/\n\n  /// @notice The address of Treasury contract.\n  address public treasury;\n\n  /// @notice The address of platform contract;\n  address public platform;\n\n  /// @notice The address base token;\n  address public baseToken;\n\n  /// @notice The address fractional base token.\n  address public fToken;\n\n  /// @notice The address leveraged base token.\n  address public xToken;\n\n  /// @notice The market config in each mode.\n  MarketConfig public marketConfig;\n\n  /// @notice The incentive config in each mode.\n  IncentiveConfig public incentiveConfig;\n\n  /// @notice The mint fee ratio for fToken.\n  FeeRatio public fTokenMintFeeRatio;\n\n  /// @notice The mint fee ratio for xToken.\n  FeeRatio public xTokenMintFeeRatio;\n\n  /// @notice The redeem fee ratio for fToken.\n  FeeRatio public fTokenRedeemFeeRatio;\n\n  /// @notice The redeem fee ratio for xToken.\n  FeeRatio public xTokenRedeemFeeRatio;\n\n  /// @notice Whether the sender is allowed to do self liquidation.\n  mapping(address => bool) public liquidationWhitelist;\n\n  /// @notice Whether the mint is paused.\n  bool public mintPaused;\n\n  /// @notice Whether the redeem is paused.\n  bool public redeemPaused;\n\n  /// @notice Whether the mintBoth is paused in system stability mode.\n  bool public mintBothInSystemStabilityModePaused;\n\n  /// @notice Whether to pause fToken mint in system stability mode\n  bool public fTokenMintInSystemStabilityModePaused;\n\n  /// @notice Whether to pause xToken redeem in system stability mode\n  bool public xTokenRedeemInSystemStabilityModePaused;\n\n  /// @notice The address of ReservePool contract.\n  address public reservePool;\n\n  /// @notice The address of RebalancePoolRegistry contract.\n  address public registry;\n\n  /************\n   * Modifier *\n   ************/\n\n  modifier onlyAdmin() {\n    require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), \"only Admin\");\n    _;\n  }\n\n  modifier onlyEmergencyDAO() {\n    require(hasRole(EMERGENCY_DAO_ROLE, msg.sender), \"only Emergency DAO\");\n    _;\n  }\n\n    /// @notice Ensures that the caller has the manager role.\n  modifier onlyManager() {\n    require(hasRole(MANAGER_ROLE, msg.sender), \"only Manager\");\n    _;\n  }\n\n  /***************\n   * Constructor *\n   ***************/\n\n  function initialize(address _treasury, address _platform) external initializer {\n    AccessControlUpgradeable.__AccessControl_init();\n    ReentrancyGuardUpgradeable.__ReentrancyGuard_init();\n    _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);\n\n    treasury = _treasury;\n    platform = _platform;\n\n    baseToken = IFxTreasury(_treasury).baseToken();\n    fToken = IFxTreasury(_treasury).fToken();\n    xToken = IFxTreasury(_treasury).xToken();\n  }\n\n  /****************************\n   * Public Mutated Functions *\n   ****************************/\n\n  /// @inheritdoc IFxMarket\n  function mint(\n    uint256 _baseIn,\n    address _recipient,\n    uint256 _minFTokenMinted,\n    uint256 _minXTokenMinted\n  ) external override nonReentrant onlyManager returns (uint256 _fTokenMinted, uint256 _xTokenMinted) {\n    require(!mintPaused, \"mint is paused\");\n    address _baseToken = baseToken;\n    if (_baseIn == uint256(-1)) {\n      _baseIn = IERC20Upgradeable(_baseToken).balanceOf(msg.sender);\n    }\n    require(_baseIn > 0, \"mint zero amount\");\n\n    IFxTreasury _treasury = IFxTreasury(treasury);\n\n    if (mintBothInSystemStabilityModePaused && _treasury.totalBaseToken() > 0) {\n      uint256 _collateralRatio = _treasury.collateralRatio();\n      require(_collateralRatio >= marketConfig.stabilityRatio, \"mintBoth paused\");\n    }\n\n    IERC20Upgradeable(_baseToken).safeTransferFrom(msg.sender, address(_treasury), _baseIn);\n    (_fTokenMinted, _xTokenMinted) = _treasury.mint(\n      _treasury.convertToUnwrapped(_baseIn),\n      _recipient,\n      IFxTreasury.MintOption.Both\n    );\n\n    require(_fTokenMinted >= _minFTokenMinted, \"insufficient fToken output\");\n    require(_xTokenMinted >= _minXTokenMinted, \"insufficient xToken output\");\n\n    emit Mint(msg.sender, _recipient, _baseIn, _fTokenMinted, _xTokenMinted, 0);\n  }\n\n  /// @inheritdoc IFxMarket\n  function mintFToken(\n    uint256 _baseIn,\n    address _recipient,\n    uint256 _minFTokenMinted\n  ) external override nonReentrant onlyManager returns (uint256 _fTokenMinted) {\n    require(!mintPaused, \"mint is paused\");\n\n    address _baseToken = baseToken;\n    if (_baseIn == uint256(-1)) {\n      _baseIn = IERC20Upgradeable(_baseToken).balanceOf(msg.sender);\n    }\n    require(_baseIn > 0, \"mint zero amount\");\n\n    IFxTreasury _treasury = IFxTreasury(treasury);\n    (uint256 _maxBaseInBeforeSystemStabilityMode, ) = _treasury.maxMintableFToken(marketConfig.stabilityRatio);\n    _maxBaseInBeforeSystemStabilityMode = _treasury.convertToWrapped(_maxBaseInBeforeSystemStabilityMode);\n\n    if (fTokenMintInSystemStabilityModePaused) {\n      uint256 _collateralRatio = _treasury.collateralRatio();\n      require(_collateralRatio > marketConfig.stabilityRatio, \"fToken mint paused\");\n\n      // bound maximum amount of base token to mint fToken.\n      if (_baseIn > _maxBaseInBeforeSystemStabilityMode) {\n        _baseIn = _maxBaseInBeforeSystemStabilityMode;\n      }\n    }\n\n    IERC20Upgradeable(_baseToken).safeTransferFrom(msg.sender, address(_treasury), _baseIn);\n    (_fTokenMinted, ) = _treasury.mint(\n      _treasury.convertToUnwrapped(_baseIn),\n      _recipient,\n      IFxTreasury.MintOption.FToken\n    );\n    require(_fTokenMinted >= _minFTokenMinted, \"insufficient fToken output\");\n\n    emit Mint(msg.sender, _recipient, _baseIn, _fTokenMinted, 0, 0);\n  }\n\n  /// @inheritdoc IFxMarket\n  function mintFTokenWithoutBaseToken(\n    uint256 _targetCollateralRatio,\n    address _recipient,\n    uint256 _minFTokenMinted\n  ) external override nonReentrant onlyManager returns (uint256 _fTokenMinted) {\n    require(!mintPaused, \"mint is paused\");\n    require(_recipient != address(0), \"invalid recipient\");\n    require(_targetCollateralRatio >= marketConfig.stabilityRatio, \"target collateral ratio too low\");\n\n    IFxTreasury _treasury = IFxTreasury(treasury);\n\n    if (fTokenMintInSystemStabilityModePaused) {\n      uint256 _collateralRatio = _treasury.collateralRatio();\n      require(_collateralRatio > marketConfig.stabilityRatio, \"fToken mint paused\");\n    }\n\n    _fTokenMinted = _treasury.mintFTokenWithoutBaseToken(_targetCollateralRatio, _recipient);\n    require(_fTokenMinted >= _minFTokenMinted, \"insufficient fToken output\");\n\n    emit Mint(msg.sender, _recipient, 0, _fTokenMinted, 0, 0);\n  }\n\n  /// @inheritdoc IFxMarket\n  function mintXToken(\n    uint256 _baseIn,\n    address _recipient,\n    uint256 _minXTokenMinted\n  ) external override nonReentrant onlyManager returns (uint256 _xTokenMinted, uint256 _bonus) {\n    require(!mintPaused, \"mint is paused\");\n\n    address _baseToken = baseToken;\n    if (_baseIn == uint256(-1)) {\n      _baseIn = IERC20Upgradeable(_baseToken).balanceOf(msg.sender);\n    }\n    require(_baseIn > 0, \"mint zero amount\");\n\n    IFxTreasury _treasury = IFxTreasury(treasury);\n    (uint256 _maxBaseInBeforeSystemStabilityMode, ) = _treasury.maxMintableXToken(marketConfig.stabilityRatio);\n    _maxBaseInBeforeSystemStabilityMode = _treasury.convertToWrapped(_maxBaseInBeforeSystemStabilityMode);\n\n    IERC20Upgradeable(_baseToken).safeTransferFrom(msg.sender, address(_treasury), _baseIn);\n    (, _xTokenMinted) = _treasury.mint(\n      _treasury.convertToUnwrapped(_baseIn),\n      _recipient,\n      IFxTreasury.MintOption.XToken\n    );\n    require(_xTokenMinted >= _minXTokenMinted, \"insufficient xToken output\");\n// Optional Bonus- onl if reservePool is set\n    if (reservePool !=address(0)){\n    uint256 _bonusAmount;\n      if (_baseIn < _maxBaseInBeforeSystemStabilityMode) {\n        _bonusAmount = _baseIn;\n      } else {\n        _bonusAmount = _maxBaseInBeforeSystemStabilityMode;\n      }\n      if (_bonusAmount > 0) {\n        try IFxReservePool(reservePool).requestBonus(baseToken, _recipient, _bonusAmount) returns (uint256 result) {\n          _bonus = result;\n        } catch {\n          // If bonus request fails, continue without bonus\n          _bonus = 0;\n        }\n      }\n    }\n\n\n    emit Mint(msg.sender, _recipient, _baseIn, 0, _xTokenMinted, 0);\n  }\n\n  /// @inheritdoc IFxMarket\n  function addBaseToken(\n    uint256 _baseIn,\n    address _recipient,\n    uint256 _minXTokenMinted\n  ) external override nonReentrant onlyManager returns (uint256 _xTokenMinted) {\n    require(!mintPaused, \"mint is paused\");\n\n    IFxTreasury _treasury = IFxTreasury(treasury);\n    uint256 _collateralRatio = _treasury.collateralRatio();\n\n    MarketConfig memory _marketConfig = marketConfig;\n    require(\n      _marketConfig.recapRatio <= _collateralRatio && _collateralRatio < _marketConfig.stabilityRatio,\n      \"Not system stability mode\"\n    );\n\n    (uint256 _maxBaseInBeforeSystemStabilityMode, ) = _treasury.maxMintableXToken(\n      _marketConfig.stabilityRatio\n    );\n    _maxBaseInBeforeSystemStabilityMode = _treasury.convertToWrapped(_maxBaseInBeforeSystemStabilityMode);\n\n    // bound the amount of base token - use full amount\n    if (_baseIn  > _maxBaseInBeforeSystemStabilityMode ) {\n      _baseIn = _maxBaseInBeforeSystemStabilityMode;\n    }\n\n    IERC20Upgradeable(baseToken).safeTransferFrom(msg.sender, address(_treasury), _baseIn);\n    _xTokenMinted = _treasury.addBaseToken(\n      _treasury.convertToUnwrapped(_baseIn),\n      incentiveConfig.stabilityIncentiveRatio,\n      _recipient\n    );\n    require(_xTokenMinted >= _minXTokenMinted, \"insufficient xToken output\");\n\n    emit AddCollateral(msg.sender, _recipient, _baseIn, _xTokenMinted);\n  }\n\n  /// @inheritdoc IFxMarket\n  function donateBaseToken(uint256 _baseIn) external override nonReentrant onlyManager {\n    IFxTreasury _treasury = IFxTreasury(treasury);\n    \n    IERC20Upgradeable(baseToken).safeTransferFrom(msg.sender, address(_treasury), _baseIn);\n    _treasury.donateBaseToken(\n      _treasury.convertToUnwrapped(_baseIn)\n    );\n\n    emit DonateBaseToken(msg.sender, _baseIn);\n  }\n\n  /// @inheritdoc IFxMarket\n  function redeem(\n    uint256 _fTokenIn,\n    uint256 _xTokenIn,\n    address _recipient,\n    uint256 _minBaseOut\n  ) external override nonReentrant onlyManager returns (uint256 _baseOut, uint256 _bonus) {\n    require(!redeemPaused, \"redeem is paused\");\n\n    if (_fTokenIn == uint256(-1)) {\n      _fTokenIn = IERC20Upgradeable(fToken).balanceOf(msg.sender);\n    }\n    if (_xTokenIn == uint256(-1)) {\n      _xTokenIn = IERC20Upgradeable(xToken).balanceOf(msg.sender);\n    }\n    require(_fTokenIn > 0 || _xTokenIn > 0, \"redeem zero amount\");\n    require(_fTokenIn == 0 || _xTokenIn == 0, \"only redeem single side\");\n\n    IFxTreasury _treasury = IFxTreasury(treasury);\n    MarketConfig memory _marketConfig = marketConfig;\n\n    uint256 _maxBaseOut;\n    if (_fTokenIn > 0) {\n      uint256 _maxFTokenInBeforeSystemStabilityMode;\n      (_maxBaseOut, _maxFTokenInBeforeSystemStabilityMode) = _treasury.maxRedeemableFToken(\n        _marketConfig.stabilityRatio\n      );\n    } else {\n      (, uint256 _maxXTokenInBeforeSystemStabilityMode) = _treasury.maxRedeemableXToken(_marketConfig.stabilityRatio);\n\n      if (xTokenRedeemInSystemStabilityModePaused) {\n        uint256 _collateralRatio = _treasury.collateralRatio();\n        require(_collateralRatio > _marketConfig.stabilityRatio, \"xToken redeem paused\");\n\n        // bound maximum amount of xToken to redeem.\n        if (_xTokenIn > _maxXTokenInBeforeSystemStabilityMode) {\n          _xTokenIn = _maxXTokenInBeforeSystemStabilityMode;\n        }\n      }\n\n    }\n\n    _baseOut = _treasury.redeem(_fTokenIn, _xTokenIn, msg.sender);\n   // Optional bonus for fToken redemption - only if reservePool is set\n    if (_fTokenIn > 0 && reservePool != address(0)) {\n      uint256 _bonusAmount;\n      if (_baseOut < _maxBaseOut) {\n        _bonusAmount = _baseOut;\n      } else {\n        _bonusAmount = _maxBaseOut;\n      }\n      // No fee deduction from bonus\n      if (_bonusAmount > 0) {\n        try IFxReservePool(reservePool).requestBonus(baseToken, _recipient, _bonusAmount) returns (uint256 result) {\n          _bonus = result;\n        } catch {\n          // If bonus request fails, continue without bonus\n          _bonus = 0;\n        }\n      }\n    }\n\n    _baseOut = _treasury.convertToWrapped(_baseOut);\n    uint256 _balance = IERC20Upgradeable(baseToken).balanceOf(address(this));\n    // consider possible slippage\n    if (_balance < _baseOut) {\n      _baseOut = _balance;\n    }\n\n    require(_baseOut >= _minBaseOut, \"insufficient base output\");\n\n    IERC20Upgradeable(baseToken).safeTransfer(_recipient, _baseOut);\n\n    emit Redeem(msg.sender, _recipient, _fTokenIn, _xTokenIn, _baseOut, 0);\n  }\n\n  /*******************************\n   * Public Restricted Functions *\n   *******************************/\n\n  /// @notice Update the fee ratio for redeeming.\n  /// @param _defaultFeeRatio The new default fee ratio, multipled by 1e18.\n  /// @param _extraFeeRatio The new extra fee ratio, multipled by 1e18.\n  /// @param _isFToken Whether we are updating for fToken.\n  function updateRedeemFeeRatio(\n    uint128 _defaultFeeRatio,\n    int128 _extraFeeRatio,\n    bool _isFToken\n  ) external onlyAdmin {\n    require(_defaultFeeRatio <= PRECISION, \"default fee ratio too large\");\n    if (_extraFeeRatio < 0) {\n      require(uint128(-_extraFeeRatio) <= _defaultFeeRatio, \"delta fee too small\");\n    } else {\n      require(uint128(_extraFeeRatio) <= PRECISION - _defaultFeeRatio, \"total fee too large\");\n    }\n\n    if (_isFToken) {\n      fTokenRedeemFeeRatio = FeeRatio(_defaultFeeRatio, _extraFeeRatio);\n      emit UpdateRedeemFeeRatioFToken(_defaultFeeRatio, _extraFeeRatio);\n    } else {\n      xTokenRedeemFeeRatio = FeeRatio(_defaultFeeRatio, _extraFeeRatio);\n      emit UpdateRedeemFeeRatioXToken(_defaultFeeRatio, _extraFeeRatio);\n    }\n  }\n\n  /// @notice Update the fee ratio for minting.\n  /// @param _defaultFeeRatio The new default fee ratio, multipled by 1e18.\n  /// @param _extraFeeRatio The new extra fee ratio, multipled by 1e18.\n  /// @param _isFToken Whether we are updating for fToken.\n  function updateMintFeeRatio(\n    uint128 _defaultFeeRatio,\n    int128 _extraFeeRatio,\n    bool _isFToken\n  ) external onlyAdmin {\n    require(_defaultFeeRatio <= PRECISION, \"default fee ratio too large\");\n    if (_extraFeeRatio < 0) {\n      require(uint128(-_extraFeeRatio) <= _defaultFeeRatio, \"delta fee too small\");\n    } else {\n      require(uint128(_extraFeeRatio) <= PRECISION - _defaultFeeRatio, \"total fee too large\");\n    }\n\n    if (_isFToken) {\n      fTokenMintFeeRatio = FeeRatio(_defaultFeeRatio, _extraFeeRatio);\n      emit UpdateMintFeeRatioFToken(_defaultFeeRatio, _extraFeeRatio);\n    } else {\n      xTokenMintFeeRatio = FeeRatio(_defaultFeeRatio, _extraFeeRatio);\n      emit UpdateMintFeeRatioXToken(_defaultFeeRatio, _extraFeeRatio);\n    }\n  }\n\n  /// @notice Update the market config.\n  /// @param _stabilityRatio The start collateral ratio to enter system stability mode to update, multiplied by 1e18.\n  /// @param _liquidationRatio The start collateral ratio to enter incentivized user liquidation mode to update, multiplied by 1e18.\n  /// @param _selfLiquidationRatio The start collateral ratio to enter self liquidation mode to update, multiplied by 1e18.\n  /// @param _recapRatio The start collateral ratio to enter recap mode to update, multiplied by 1e18.\n  function updateMarketConfig(\n    uint64 _stabilityRatio,\n    uint64 _liquidationRatio,\n    uint64 _selfLiquidationRatio,\n    uint64 _recapRatio\n  ) external onlyAdmin {\n    require(\n      _stabilityRatio > _liquidationRatio &&\n        _liquidationRatio > _selfLiquidationRatio &&\n        _selfLiquidationRatio > _recapRatio &&\n        _recapRatio >= PRECISION,\n      \"invalid market config\"\n    );\n\n    marketConfig = MarketConfig(_stabilityRatio, _liquidationRatio, _selfLiquidationRatio, _recapRatio);\n\n    emit UpdateMarketConfig(_stabilityRatio, _liquidationRatio, _selfLiquidationRatio, _recapRatio);\n  }\n\n  /// @notice Update the incentive config.\n  /// @param _stabilityIncentiveRatio The incentive ratio for system stability mode to update, multiplied by 1e18.\n  /// @param _liquidationIncentiveRatio The incentive ratio for incentivized user liquidation mode to update, multiplied by 1e18.\n  /// @param _selfLiquidationIncentiveRatio The incentive ratio for self liquidation mode to update, multiplied by 1e18.\n  function updateIncentiveConfig(\n    uint64 _stabilityIncentiveRatio,\n    uint64 _liquidationIncentiveRatio,\n    uint64 _selfLiquidationIncentiveRatio\n  ) external onlyAdmin {\n    require(_stabilityIncentiveRatio > 0, \"incentive too small\");\n    require(_selfLiquidationIncentiveRatio > 0, \"incentive too small\");\n    require(_liquidationIncentiveRatio >= _selfLiquidationIncentiveRatio, \"invalid incentive config\");\n\n    incentiveConfig = IncentiveConfig(\n      _stabilityIncentiveRatio,\n      _liquidationIncentiveRatio,\n      _selfLiquidationIncentiveRatio\n    );\n\n    emit UpdateIncentiveConfig(_stabilityIncentiveRatio, _liquidationIncentiveRatio, _selfLiquidationIncentiveRatio);\n  }\n\n  /// @notice Change address of platform contract.\n  /// @param _platform The new address of platform contract.\n  function updatePlatform(address _platform) external onlyAdmin {\n    platform = _platform;\n\n    emit UpdatePlatform(_platform);\n  }\n\n  /// @notice Change address of reserve pool contract.\n  /// @param _reservePool The new address of reserve pool contract.\n  function updateReservePool(address _reservePool) external onlyAdmin {\n    reservePool = _reservePool;\n\n    emit UpdateReservePool(_reservePool);\n  }\n\n  /// @notice Change address of RebalancePoolRegistry contract.\n  /// @param _registry The new address of RebalancePoolRegistry contract.\n  function updateRebalancePoolRegistry(address _registry) external onlyAdmin {\n    registry = _registry;\n\n    emit UpdateRebalancePoolRegistry(_registry);\n  }\n\n  /// @notice Update the whitelist status for self liquidation account.\n  /// @param _account The address of account to update.\n  /// @param _status The status of the account to update.\n  function updateLiquidationWhitelist(address _account, bool _status) external onlyAdmin {\n    liquidationWhitelist[_account] = _status;\n\n    emit UpdateLiquidationWhitelist(_account, _status);\n  }\n\n  /// @notice Pause mint in this contract\n  /// @param _status The pause status.\n  function pauseMint(bool _status) external onlyEmergencyDAO {\n    mintPaused = _status;\n\n    emit PauseMint(_status);\n  }\n    /// @notice Add a new manager for permissioned operations.\n  /// @param _manager The address to grant manager role.\n  function grantManagerRole(address _manager) external onlyAdmin {\n    grantRole(MANAGER_ROLE, _manager);\n  }\n\n    /// @notice Remove a manager for permissioned operations.\n  /// @param _manager The address to revoke manager role.\n  function revokeManagerRole(address _manager) external onlyAdmin {\n    revokeRole(MANAGER_ROLE, _manager);\n  }\n\n  /// @notice Pause redeem in this contract\n  /// @param _status The pause status.\n  function pauseRedeem(bool _status) external onlyEmergencyDAO {\n    redeemPaused = _status;\n\n    emit PauseRedeem(_status);\n  }\n\n  /// @notice Pause fToken mint in system stability mode.\n  /// @param _status The pause status.\n  function pauseFTokenMintInSystemStabilityMode(bool _status) external onlyEmergencyDAO {\n    fTokenMintInSystemStabilityModePaused = _status;\n\n    emit PauseFTokenMintInSystemStabilityMode(_status);\n  }\n\n  /// @notice Pause xToken redeem in system stability mode\n  /// @param _status The pause status.\n  function pauseXTokenRedeemInSystemStabilityMode(bool _status) external onlyEmergencyDAO {\n    xTokenRedeemInSystemStabilityModePaused = _status;\n\n    emit PauseXTokenRedeemInSystemStabilityMode(_status);\n  }\n\n  /// @notice Pause mintBoth in system stability mode\n  /// @param _status The pause status.\n  function pauseMintBothInSystemStabilityMode(bool _status) external onlyEmergencyDAO {\n    mintBothInSystemStabilityModePaused = _status;\n    emit PauseMintBothInSystemStabilityMode(_status);\n  }\n\n  /**********************\n   * Internal Functions *\n   **********************/\n\n  /// @dev Internal function to deduct fToken mint fee for base token.\n  /// @param _baseIn The amount of base token.\n  /// @param _ratio The mint fee ratio.\n  /// @param _maxBaseInBeforeSystemStabilityMode The maximum amount of base token can be deposit before entering system stability mode.\n  /// @return _baseInWithoutFee The amount of base token without fee.\n  function _deductFTokenMintFee(\n    uint256 _baseIn,\n    FeeRatio memory _ratio,\n    uint256 _maxBaseInBeforeSystemStabilityMode\n  ) internal returns (uint256 _baseInWithoutFee) {\n    // [0, _maxBaseInBeforeSystemStabilityMode) => default = fee_ratio_0\n    // [_maxBaseInBeforeSystemStabilityMode, infinity) => default + extra = fee_ratio_1\n\n    uint256 _feeRatio0 = _ratio.defaultFeeRatio;\n    uint256 _feeRatio1 = uint256(int256(_ratio.defaultFeeRatio) + _ratio.extraFeeRatio);\n\n    _baseInWithoutFee = _deductMintFee(_baseIn, _feeRatio0, _feeRatio1, _maxBaseInBeforeSystemStabilityMode);\n  }\n\n  /// @dev Internal function to deduct fToken mint fee for base token.\n  /// @param _baseIn The amount of base token.\n  /// @param _ratio The mint fee ratio.\n  /// @param _maxBaseInBeforeSystemStabilityMode The maximum amount of base token can be deposit before entering system stability mode.\n  /// @return _baseInWithoutFee The amount of base token without fee.\n  function _deductXTokenMintFee(\n    uint256 _baseIn,\n    FeeRatio memory _ratio,\n    uint256 _maxBaseInBeforeSystemStabilityMode\n  ) internal returns (uint256 _baseInWithoutFee) {\n    // [0, _maxBaseInBeforeSystemStabilityMode) => default + extra = fee_ratio_0\n    // [_maxBaseInBeforeSystemStabilityMode, infinity) => default = fee_ratio_1\n\n    uint256 _feeRatio0 = uint256(int256(_ratio.defaultFeeRatio) + _ratio.extraFeeRatio);\n    uint256 _feeRatio1 = _ratio.defaultFeeRatio;\n\n    _baseInWithoutFee = _deductMintFee(_baseIn, _feeRatio0, _feeRatio1, _maxBaseInBeforeSystemStabilityMode);\n  }\n\n  function _deductMintFee(\n    uint256 _baseIn,\n    uint256 _feeRatio0,\n    uint256 _feeRatio1,\n    uint256 _maxBaseInBeforeSystemStabilityMode\n  ) internal returns (uint256 _baseInWithoutFee) {\n    uint256 _maxBaseIn = _maxBaseInBeforeSystemStabilityMode.mul(PRECISION).div(PRECISION - _feeRatio0);\n\n    // compute fee\n    uint256 _fee;\n    if (_baseIn <= _maxBaseIn) {\n      _fee = _baseIn.mul(_feeRatio0).div(PRECISION);\n    } else {\n      _fee = _maxBaseIn.mul(_feeRatio0).div(PRECISION);\n      _fee = _fee.add((_baseIn - _maxBaseIn).mul(_feeRatio1).div(PRECISION));\n    }\n\n    _baseInWithoutFee = _baseIn.sub(_fee);\n    // take fee to platform\n    if (_fee > 0) {\n      IERC20Upgradeable(baseToken).safeTransferFrom(msg.sender, platform, _fee);\n    }\n  }\n\n  /// @dev Internal function to deduct mint fee for base token.\n  /// @param _amountIn The amount of fToken.\n  /// @param _ratio The redeem fee ratio.\n  /// @param _maxInBeforeSystemStabilityMode The maximum amount of fToken can be redeemed before leaving system stability mode.\n  /// @return _feeRatio The computed fee ratio for base token redeemed.\n  function _computeFTokenRedeemFeeRatio(\n    uint256 _amountIn,\n    FeeRatio memory _ratio,\n    uint256 _maxInBeforeSystemStabilityMode\n  ) internal pure returns (uint256 _feeRatio) {\n    // [0, _maxBaseInBeforeSystemStabilityMode) => default + extra = fee_ratio_0\n    // [_maxBaseInBeforeSystemStabilityMode, infinity) => default = fee_ratio_1\n\n    uint256 _feeRatio0 = uint256(int256(_ratio.defaultFeeRatio) + _ratio.extraFeeRatio);\n    uint256 _feeRatio1 = _ratio.defaultFeeRatio;\n\n    _feeRatio = _computeRedeemFeeRatio(_amountIn, _feeRatio0, _feeRatio1, _maxInBeforeSystemStabilityMode);\n  }\n\n  /// @dev Internal function to deduct mint fee for base token.\n  /// @param _amountIn The amount of xToken.\n  /// @param _ratio The redeem fee ratio.\n  /// @param _maxInBeforeSystemStabilityMode The maximum amount of xToken can be redeemed before entering system stability mode.\n  /// @return _feeRatio The computed fee ratio for base token redeemed.\n  function _computeXTokenRedeemFeeRatio(\n    uint256 _amountIn,\n    FeeRatio memory _ratio,\n    uint256 _maxInBeforeSystemStabilityMode\n  ) internal pure returns (uint256 _feeRatio) {\n    // [0, _maxBaseInBeforeSystemStabilityMode) => default = fee_ratio_0\n    // [_maxBaseInBeforeSystemStabilityMode, infinity) => default + extra = fee_ratio_1\n\n    uint256 _feeRatio0 = _ratio.defaultFeeRatio;\n    uint256 _feeRatio1 = uint256(int256(_ratio.defaultFeeRatio) + _ratio.extraFeeRatio);\n\n    _feeRatio = _computeRedeemFeeRatio(_amountIn, _feeRatio0, _feeRatio1, _maxInBeforeSystemStabilityMode);\n  }\n\n  /// @dev Internal function to deduct mint fee for base token.\n  /// @param _amountIn The amount of fToken or xToken.\n  /// @param _feeRatio0 The default fee ratio.\n  /// @param _feeRatio1 The second fee ratio.\n  /// @param _maxInBeforeSystemStabilityMode The maximum amount of fToken/xToken can be redeemed before entering/leaving system stability mode.\n  /// @return _feeRatio The computed fee ratio for base token redeemed.\n  function _computeRedeemFeeRatio(\n    uint256 _amountIn,\n    uint256 _feeRatio0,\n    uint256 _feeRatio1,\n    uint256 _maxInBeforeSystemStabilityMode\n  ) internal pure returns (uint256 _feeRatio) {\n    if (_amountIn <= _maxInBeforeSystemStabilityMode) {\n      return _feeRatio0;\n    }\n    uint256 _fee = _maxInBeforeSystemStabilityMode.mul(_feeRatio0);\n    _fee = _fee.add((_amountIn - _maxInBeforeSystemStabilityMode).mul(_feeRatio1));\n    return _fee.div(_amountIn);\n  }\n}\n","deployed_bytecode":"0x608060405234801561001057600080fd5b506004361061030c5760003560e01c806395a086d71161019d578063c26a4ed0116100e9578063e1694288116100a2578063edd6fcd21161007c578063edd6fcd21461096e578063f30e6e7714610976578063f478f35d14610995578063fc6abd411461099d5761030c565b8063e16942881461092a578063ec87621c14610949578063ed0aa428146109515761030c565b8063c26a4ed014610880578063c55dae63146108b2578063c7904919146108ba578063ca15c873146108d9578063d547741f146108f6578063db7dae1b146109225761030c565b8063a8694e5711610156578063bddd87eb11610130578063bddd87eb146107fb578063be4dc94f14610803578063bf2c8a9414610829578063c17680cd146108615761030c565b8063a8694e57146107b9578063b235d468146107c1578063b5567473146107c95761030c565b806395a086d71461070c57806396e83839146107435780639a54616b1461074b578063a217fddf14610783578063a293da0f1461078b578063a455f1ac146107b15761030c565b80634bde38c81161025c5780637b10399911610215578063874be59b116101ef578063874be59b146106775780638838a3db1461067f5780639010d07c146106bd57806391d14854146106e05761030c565b80637b103999146106395780637e4831d31461064157806385915707146106495761030c565b80634bde38c814610546578063534b23bb1461054e5780635bfb36f21461057457806361d027b3146105ae57806364c9b4c3146105b6578063694a7ce7146105e85761030c565b806318ebbb82116102c957806326e885e3116102a357806326e885e31461049a5780632f2ff15d146104c057806336568abe146104ec578063485cc955146105185761030c565b806318ebbb821461041357806323c113dc14610441578063248a9ca31461047d5761030c565b80630266f04414610311578063088b699e14610335578063119e38201461033d5780631447696a14610376578063144f1704146103a9578063153f7cd0146103ed575b600080fd5b6103196109bc565b604080516001600160a01b039092168252519081900360200190f35b6103196109d2565b6103746004803603606081101561035357600080fd5b506001600160801b03813516906020810135600f0b906040013515156109e1565b005b61037e610c7d565b604080516001600160401b039485168152928416602084015292168183015290519081900360600190f35b6103db600480360360608110156103bf57600080fd5b508035906001600160a01b036020820135169060400135610ca2565b60408051918252519081900360200190f35b6103746004803603602081101561040357600080fd5b50356001600160a01b0316611046565b61041b6110f1565b604080516001600160801b039093168352600f9190910b60208301528051918290030190f35b61044961110c565b604080516001600160401b039586168152938516602085015291841683830152909216606082015290519081900360800190f35b6103db6004803603602081101561049357600080fd5b503561113a565b610374600480360360208110156104b057600080fd5b50356001600160a01b031661114f565b610374600480360360408110156104d657600080fd5b50803590602001356001600160a01b03166111b3565b6103746004803603604081101561050257600080fd5b50803590602001356001600160a01b031661121f565b6103746004803603604081101561052e57600080fd5b506001600160a01b0381358116916020013516611280565b6103196114f1565b6103746004803603602081101561056457600080fd5b50356001600160a01b0316611500565b61059a6004803603602081101561058a57600080fd5b50356001600160a01b031661159d565b604080519115158252519081900360200190f35b6103196115b2565b6103db600480360360608110156105cc57600080fd5b508035906001600160a01b0360208201351690604001356115c1565b610620600480360360808110156105fe57600080fd5b508035906020810135906001600160a01b036040820135169060600135611b13565b6040805192835260208301919091528051918290030190f35b61031961233a565b61059a612349565b6103746004803603604081101561065f57600080fd5b506001600160a01b0381351690602001351515612352565b61059a6123ff565b6103746004803603608081101561069557600080fd5b506001600160401b03813581169160208101358216916040820135811691606001351661240e565b610319600480360360408110156106d357600080fd5b50803590602001356125de565b61059a600480360360408110156106f657600080fd5b50803590602001356001600160a01b03166125ff565b6103746004803603606081101561072257600080fd5b506001600160801b03813516906020810135600f0b90604001351515612617565b6103db6128b2565b6103746004803603606081101561076157600080fd5b506001600160401b0381358116916020810135821691604090910135166128c4565b6103db612acd565b610374600480360360208110156107a157600080fd5b50356001600160a01b0316612ad2565b61041b612b6f565b610319612b8a565b61059a612b99565b610620600480360360608110156107df57600080fd5b508035906001600160a01b036020820135169060400135612ba7565b61059a6130f3565b6103746004803603602081101561081957600080fd5b50356001600160a01b0316613104565b6106206004803603608081101561083f57600080fd5b508035906001600160a01b036020820135169060408101359060600135613165565b6103746004803603602081101561087757600080fd5b50351515613690565b6103db6004803603606081101561089657600080fd5b508035906001600160a01b03602082013516906040013561373f565b610319613c2b565b610374600480360360208110156108d057600080fd5b50351515613c3a565b6103db600480360360208110156108ef57600080fd5b5035613ceb565b6103746004803603604081101561090c57600080fd5b50803590602001356001600160a01b0316613d02565b61059a613d5b565b6103746004803603602081101561094057600080fd5b50351515613d6b565b6103db613e1e565b6103746004803603602081101561096757600080fd5b5035613e30565b61041b614006565b6103746004803603602081101561098c57600080fd5b50351515614021565b61041b6140c6565b610374600480360360208110156109b357600080fd5b503515156140e1565b60a354600160281b90046001600160a01b031681565b609b546001600160a01b031681565b6109ec6000336125ff565b610a2a576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b670de0b6b3a7640000836001600160801b03161115610a90576040805162461bcd60e51b815260206004820152601b60248201527f64656661756c742066656520726174696f20746f6f206c617267650000000000604482015290519081900360640190fd5b600082600f0b1215610b0157826001600160801b0316826000036001600160801b03161115610afc576040805162461bcd60e51b815260206004820152601360248201527219195b1d1848199959481d1bdbc81cdb585b1b606a1b604482015290519081900360640190fd5b610b68565b826001600160801b0316670de0b6b3a764000003826001600160801b03161115610b68576040805162461bcd60e51b8152602060048201526013602482015272746f74616c2066656520746f6f206c6172676560681b604482015290519081900360640190fd5b8015610bf5576040805180820182526001600160801b03808616808352600f86810b602094850181905260a080549282900b8516600160801b026001600160801b031990931684179094169190911790925583519081529182015281517ffce764732a3255daf06ab4e5370ba4555bab529a9ae95e401067d9db337f64e9929181900390910190a1610c78565b6040805180820182526001600160801b03808616808352600f86810b602094850181905260a180549282900b8516600160801b026001600160801b031990931684179094169190911790925583519081529182015281517f137ea7143d6b2c0ee9295ef5da20af0586620f43982b58a55643b5d1c8e525e1929181900390910190a15b505050565b609d546001600160401b0380821691600160401b8104821691600160801b9091041683565b600060026065541415610cea576040805162461bcd60e51b815260206004820152601f6024820152600080516020614aba833981519152604482015290519081900360640190fd5b6002606555610d07600080516020614b7e833981519152336125ff565b610d47576040805162461bcd60e51b815260206004820152600c60248201526b37b7363c9026b0b730b3b2b960a11b604482015290519081900360640190fd5b60a35460ff1615610d90576040805162461bcd60e51b815260206004820152600e60248201526d1b5a5b9d081a5cc81c185d5cd95960921b604482015290519081900360640190fd5b6001600160a01b038316610ddf576040805162461bcd60e51b81526020600482015260116024820152701a5b9d985b1a59081c9958da5c1a595b9d607a1b604482015290519081900360640190fd5b609c546001600160401b0316841015610e3f576040805162461bcd60e51b815260206004820152601f60248201527f74617267657420636f6c6c61746572616c20726174696f20746f6f206c6f7700604482015290519081900360640190fd5b60975460a3546001600160a01b03909116906301000000900460ff1615610f20576000816001600160a01b031663b4eae1cb6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9b57600080fd5b505afa158015610eaf573d6000803e3d6000fd5b505050506040513d6020811015610ec557600080fd5b5051609c549091506001600160401b03168111610f1e576040805162461bcd60e51b815260206004820152601260248201527119951bdad95b881b5a5b9d081c185d5cd95960721b604482015290519081900360640190fd5b505b806001600160a01b031663c6613ae186866040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050602060405180830381600087803b158015610f7757600080fd5b505af1158015610f8b573d6000803e3d6000fd5b505050506040513d6020811015610fa157600080fd5b5051915082821015610ff7576040805162461bcd60e51b815260206004820152601a6024820152791a5b9cdd59999a58da595b9d0819951bdad95b881bdd5d1c1d5d60321b604482015290519081900360640190fd5b60408051600080825260208201859052818301819052606082015290516001600160a01b038616913391600080516020614ada8339815191529181900360800190a35060016065559392505050565b6110516000336125ff565b61108f576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b60a380546001600160a01b038316600160281b810265010000000000600160c81b03199092169190911790915560408051918252517f029a249314e1823cb2942c931203164b40496eaa6f87277ea9ca7492357755ba9181900360200190a150565b60a1546001600160801b03811690600160801b9004600f0b82565b609c546001600160401b0380821691600160401b8104821691600160801b8204811691600160c01b90041684565b60009081526033602052604090206002015490565b61115a6000336125ff565b611198576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b6111b0600080516020614b7e833981519152826111b3565b50565b6000828152603360205260409020600201546111d6906111d161418e565b6125ff565b6112115760405162461bcd60e51b815260040180806020018281038252602f815260200180614a8b602f913960400191505060405180910390fd5b61121b8282614192565b5050565b61122761418e565b6001600160a01b0316816001600160a01b0316146112765760405162461bcd60e51b815260040180806020018281038252602f815260200180614be8602f913960400191505060405180910390fd5b61121b82826141fb565b600054610100900460ff16806112995750611299614264565b806112a7575060005460ff16155b6112e25760405162461bcd60e51b815260040180806020018281038252602e815260200180614b50602e913960400191505060405180910390fd5b600054610100900460ff1615801561130d576000805460ff1961ff0019909116610100171660011790555b611315614275565b61131d614326565b611328600033611211565b609780546001600160a01b038086166001600160a01b0319928316811790935560988054918616919092161790556040805163c55dae6360e01b8152905163c55dae6391600480820192602092909190829003018186803b15801561138c57600080fd5b505afa1580156113a0573d6000803e3d6000fd5b505050506040513d60208110156113b657600080fd5b5051609980546001600160a01b0319166001600160a01b039283161790556040805163a8694e5760e01b815290519185169163a8694e5791600480820192602092909190829003018186803b15801561140e57600080fd5b505afa158015611422573d6000803e3d6000fd5b505050506040513d602081101561143857600080fd5b5051609a80546001600160a01b0319166001600160a01b0392831617905560408051630445b4cf60e11b815290519185169163088b699e91600480820192602092909190829003018186803b15801561149057600080fd5b505afa1580156114a4573d6000803e3d6000fd5b505050506040513d60208110156114ba57600080fd5b5051609b80546001600160a01b0319166001600160a01b039092169190911790558015610c78576000805461ff0019169055505050565b6098546001600160a01b031681565b61150b6000336125ff565b611549576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b60a480546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f964a21914a7149ce5cc4a604ed564c4c9d725683a7fe09d1737bc3d13578788f9181900360200190a150565b60a26020526000908152604090205460ff1681565b6097546001600160a01b031681565b600060026065541415611609576040805162461bcd60e51b815260206004820152601f6024820152600080516020614aba833981519152604482015290519081900360640190fd5b6002606555611626600080516020614b7e833981519152336125ff565b611666576040805162461bcd60e51b815260206004820152600c60248201526b37b7363c9026b0b730b3b2b960a11b604482015290519081900360640190fd5b60a35460ff16156116af576040805162461bcd60e51b815260206004820152600e60248201526d1b5a5b9d081a5cc81c185d5cd95960921b604482015290519081900360640190fd5b6099546001600160a01b031660001985141561173a57604080516370a0823160e01b815233600482015290516001600160a01b038316916370a08231916024808301926020929190829003018186803b15801561170b57600080fd5b505afa15801561171f573d6000803e3d6000fd5b505050506040513d602081101561173557600080fd5b505194505b60008511611782576040805162461bcd60e51b815260206004820152601060248201526f1b5a5b9d081e995c9bc8185b5bdd5b9d60821b604482015290519081900360640190fd5b609754609c546040805163066498a160e41b81526001600160401b03909216600483015280516001600160a01b039093169260009284926366498a1092602480840193829003018186803b1580156117d957600080fd5b505afa1580156117ed573d6000803e3d6000fd5b505050506040513d604081101561180357600080fd5b50516040805163287583f160e01b81526004810183905290519192506001600160a01b0384169163287583f191602480820192602092909190829003018186803b15801561185057600080fd5b505afa158015611864573d6000803e3d6000fd5b505050506040513d602081101561187a57600080fd5b505160a3549091506301000000900460ff161561195d576000826001600160a01b031663b4eae1cb6040518163ffffffff1660e01b815260040160206040518083038186803b1580156118cc57600080fd5b505afa1580156118e0573d6000803e3d6000fd5b505050506040513d60208110156118f657600080fd5b5051609c549091506001600160401b0316811161194f576040805162461bcd60e51b815260206004820152601260248201527119951bdad95b881b5a5b9d081c185d5cd95960721b604482015290519081900360640190fd5b8188111561195b578197505b505b6119726001600160a01b03841633848a6143bb565b816001600160a01b031663c061ddc7836001600160a01b03166309c431b78a6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156119c557600080fd5b505afa1580156119d9573d6000803e3d6000fd5b505050506040513d60208110156119ef57600080fd5b50516040805160e084901b6001600160e01b031916815260048101929092526001600160a01b038a1660248301526001604483015280516064808401938290030181600087803b158015611a4257600080fd5b505af1158015611a56573d6000803e3d6000fd5b505050506040513d6040811015611a6c57600080fd5b5051935084841015611ac2576040805162461bcd60e51b815260206004820152601a6024820152791a5b9cdd59999a58da595b9d0819951bdad95b881bdd5d1c1d5d60321b604482015290519081900360640190fd5b60408051888152602081018690526000818301819052606082015290516001600160a01b038816913391600080516020614ada8339815191529181900360800190a350506001606555509392505050565b60008060026065541415611b5c576040805162461bcd60e51b815260206004820152601f6024820152600080516020614aba833981519152604482015290519081900360640190fd5b6002606555611b79600080516020614b7e833981519152336125ff565b611bb9576040805162461bcd60e51b815260206004820152600c60248201526b37b7363c9026b0b730b3b2b960a11b604482015290519081900360640190fd5b60a354610100900460ff1615611c09576040805162461bcd60e51b815260206004820152601060248201526f1c995919595b481a5cc81c185d5cd95960821b604482015290519081900360640190fd5b600019861415611c8d57609a54604080516370a0823160e01b815233600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015611c5e57600080fd5b505afa158015611c72573d6000803e3d6000fd5b505050506040513d6020811015611c8857600080fd5b505195505b600019851415611d1157609b54604080516370a0823160e01b815233600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015611ce257600080fd5b505afa158015611cf6573d6000803e3d6000fd5b505050506040513d6020811015611d0c57600080fd5b505194505b6000861180611d205750600085115b611d66576040805162461bcd60e51b81526020600482015260126024820152711c995919595b481e995c9bc8185b5bdd5b9d60721b604482015290519081900360640190fd5b851580611d71575084155b611dc2576040805162461bcd60e51b815260206004820152601760248201527f6f6e6c792072656465656d2073696e676c652073696465000000000000000000604482015290519081900360640190fd5b60975460408051608081018252609c546001600160401b038082168352600160401b820481166020840152600160801b8204811693830193909352600160c01b900490911660608201526001600160a01b039091169060008815611ea4578151604080516271691b60e21b81526001600160401b03909216600483015280516000926001600160a01b038716926301c5a46c92602480840193829003018186803b158015611e6f57600080fd5b505afa158015611e83573d6000803e3d6000fd5b505050506040513d6040811015611e9957600080fd5b505191506120089050565b815160408051636902b79f60e11b81526001600160401b03909216600483015280516000926001600160a01b0387169263d2056f3e92602480840193829003018186803b158015611ef457600080fd5b505afa158015611f08573d6000803e3d6000fd5b505050506040513d6040811015611f1e57600080fd5b506020015160a354909150640100000000900460ff1615612006576000846001600160a01b031663b4eae1cb6040518163ffffffff1660e01b815260040160206040518083038186803b158015611f7457600080fd5b505afa158015611f88573d6000803e3d6000fd5b505050506040513d6020811015611f9e57600080fd5b505184519091506001600160401b03168111611ff8576040805162461bcd60e51b81526020600482015260146024820152731e151bdad95b881c995919595b481c185d5cd95960621b604482015290519081900360640190fd5b818a1115612004578199505b505b505b6040805163049104e560e01b8152600481018b9052602481018a905233604482015290516001600160a01b0385169163049104e59160648083019260209291908290030181600087803b15801561205e57600080fd5b505af1158015612072573d6000803e3d6000fd5b505050506040513d602081101561208857600080fd5b5051945088158015906120ac575060a354600160281b90046001600160a01b031615155b1561216b576000818610156120c25750846120c5565b50805b80156121695760a35460995460408051632b2b2cf560e11b81526001600160a01b0392831660048201528b83166024820152604481018590529051600160281b9093049091169163565659ea916064808201926020929091908290030181600087803b15801561213457600080fd5b505af192505050801561215957506040513d602081101561215457600080fd5b505160015b6121665760009450612169565b94505b505b826001600160a01b031663287583f1866040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156121af57600080fd5b505afa1580156121c3573d6000803e3d6000fd5b505050506040513d60208110156121d957600080fd5b5051609954604080516370a0823160e01b815230600482015290519297506000926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561222c57600080fd5b505afa158015612240573d6000803e3d6000fd5b505050506040513d602081101561225657600080fd5b5051905085811015612266578095505b868610156122bb576040805162461bcd60e51b815260206004820152601860248201527f696e73756666696369656e742062617365206f75747075740000000000000000604482015290519081900360640190fd5b6099546122d2906001600160a01b0316898861441b565b604080518b8152602081018b90528082018890526000606082015290516001600160a01b038a169133917f8caf04742286d017f9ac3924388e188c73e6e5094311c5e59a61a7ef86dda8bf9181900360800190a3505060016065555091969095509350505050565b60a4546001600160a01b031681565b60a35460ff1681565b61235d6000336125ff565b61239b576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b038216600081815260a26020908152604091829020805460ff191685151590811790915582519384529083015280517f24c0dcc77a0a580f413a8d41a2efffeb4b4643c8f2a6cfce6680a25fc2cc3bf19281900390910190a15050565b60a35462010000900460ff1681565b6124196000336125ff565b612457576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b826001600160401b0316846001600160401b03161180156124895750816001600160401b0316836001600160401b0316115b80156124a65750806001600160401b0316826001600160401b0316115b80156124c35750670de0b6b3a7640000816001600160401b031610155b61250c576040805162461bcd60e51b8152602060048201526015602482015274696e76616c6964206d61726b657420636f6e66696760581b604482015290519081900360640190fd5b60408051608080820183526001600160401b0387811680845287821660208086018290528884168688018190529388166060968701819052609c805467ffffffffffffffff1916851767ffffffffffffffff60401b1916600160401b85021767ffffffffffffffff60801b1916600160801b8702176001600160c01b0316600160c01b8302179055875193845290830191909152818601929092529283015291517f75dcf5f4ede2681107b573664f473d2282f8dc82de08d07844bb5c6191b7795f929181900390910190a150505050565b60008281526033602052604081206125f6908361446d565b90505b92915050565b60008281526033602052604081206125f69083614479565b6126226000336125ff565b612660576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b670de0b6b3a7640000836001600160801b031611156126c6576040805162461bcd60e51b815260206004820152601b60248201527f64656661756c742066656520726174696f20746f6f206c617267650000000000604482015290519081900360640190fd5b600082600f0b121561273757826001600160801b0316826000036001600160801b03161115612732576040805162461bcd60e51b815260206004820152601360248201527219195b1d1848199959481d1bdbc81cdb585b1b606a1b604482015290519081900360640190fd5b61279e565b826001600160801b0316670de0b6b3a764000003826001600160801b0316111561279e576040805162461bcd60e51b8152602060048201526013602482015272746f74616c2066656520746f6f206c6172676560681b604482015290519081900360640190fd5b801561282b576040805180820182526001600160801b03808616808352600f86810b6020948501819052609e80549282900b8516600160801b026001600160801b031990931684179094169190911790925583519081529182015281517fc5e9a5b971bffb75f7fa60d9d340915ae3514b4afcd80b3d510b483f86923735929181900390910190a1610c78565b6040805180820182526001600160801b03808616808352600f86810b6020948501819052609f80549282900b8516600160801b026001600160801b031990931684179094169190911790925583519081529182015281517f1cc54cd8b09b21a5f5ae2334b14e5bce0ffcf23845aeb2739f791637cf30fed3929181900390910190a1505050565b600080516020614b9e83398151915281565b6128cf6000336125ff565b61290d576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b6000836001600160401b031611612961576040805162461bcd60e51b81526020600482015260136024820152721a5b98d95b9d1a5d99481d1bdbc81cdb585b1b606a1b604482015290519081900360640190fd5b6000816001600160401b0316116129b5576040805162461bcd60e51b81526020600482015260136024820152721a5b98d95b9d1a5d99481d1bdbc81cdb585b1b606a1b604482015290519081900360640190fd5b806001600160401b0316826001600160401b03161015612a1c576040805162461bcd60e51b815260206004820152601860248201527f696e76616c696420696e63656e7469766520636f6e6669670000000000000000604482015290519081900360640190fd5b60408051606080820183526001600160401b038681168084528682166020808601829052928716948601859052609d805467ffffffffffffffff1916831767ffffffffffffffff60401b1916600160401b83021767ffffffffffffffff60801b1916600160801b87021790558551918252918101919091528084019290925291517fff560a359aa5e5f8b0a2de8c59393f72576e47c178f00c8c6b8794c6bbd29e7f929181900390910190a1505050565b600081565b612add6000336125ff565b612b1b576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b609880546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f43412ddbc9c884a0be720e21657a878716d21710438ad24f74f7e99699df82fc9181900360200190a150565b609e546001600160801b03811690600160801b9004600f0b82565b609a546001600160a01b031681565b60a354610100900460ff1681565b60008060026065541415612bf0576040805162461bcd60e51b815260206004820152601f6024820152600080516020614aba833981519152604482015290519081900360640190fd5b6002606555612c0d600080516020614b7e833981519152336125ff565b612c4d576040805162461bcd60e51b815260206004820152600c60248201526b37b7363c9026b0b730b3b2b960a11b604482015290519081900360640190fd5b60a35460ff1615612c96576040805162461bcd60e51b815260206004820152600e60248201526d1b5a5b9d081a5cc81c185d5cd95960921b604482015290519081900360640190fd5b6099546001600160a01b0316600019861415612d2157604080516370a0823160e01b815233600482015290516001600160a01b038316916370a08231916024808301926020929190829003018186803b158015612cf257600080fd5b505afa158015612d06573d6000803e3d6000fd5b505050506040513d6020811015612d1c57600080fd5b505195505b60008611612d69576040805162461bcd60e51b815260206004820152601060248201526f1b5a5b9d081e995c9bc8185b5bdd5b9d60821b604482015290519081900360640190fd5b609754609c546040805163e9ea2b2560e01b81526001600160401b03909216600483015280516001600160a01b0390931692600092849263e9ea2b2592602480840193829003018186803b158015612dc057600080fd5b505afa158015612dd4573d6000803e3d6000fd5b505050506040513d6040811015612dea57600080fd5b50516040805163287583f160e01b81526004810183905290519192506001600160a01b0384169163287583f191602480820192602092909190829003018186803b158015612e3757600080fd5b505afa158015612e4b573d6000803e3d6000fd5b505050506040513d6020811015612e6157600080fd5b50519050612e7a6001600160a01b03841633848b6143bb565b816001600160a01b031663c061ddc7836001600160a01b03166309c431b78b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015612ecd57600080fd5b505afa158015612ee1573d6000803e3d6000fd5b505050506040513d6020811015612ef757600080fd5b50516040805160e084901b6001600160e01b031916815260048101929092526001600160a01b038b1660248301526002604483015280516064808401938290030181600087803b158015612f4a57600080fd5b505af1158015612f5e573d6000803e3d6000fd5b505050506040513d6040811015612f7457600080fd5b5060200151945085851015612fcd576040805162461bcd60e51b815260206004820152601a6024820152791a5b9cdd59999a58da595b9d081e151bdad95b881bdd5d1c1d5d60321b604482015290519081900360640190fd5b60a354600160281b90046001600160a01b03161561309f57600081891015612ff6575087612ff9565b50805b801561309d5760a35460995460408051632b2b2cf560e11b81526001600160a01b0392831660048201528b83166024820152604481018590529051600160281b9093049091169163565659ea916064808201926020929091908290030181600087803b15801561306857600080fd5b505af192505050801561308d57506040513d602081101561308857600080fd5b505160015b61309a576000945061309d565b94505b505b60408051898152600060208201819052818301889052606082015290516001600160a01b038916913391600080516020614ada8339815191529181900360800190a350506001606555509094909350915050565b60a354640100000000900460ff1681565b61310f6000336125ff565b61314d576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b6111b0600080516020614b7e83398151915282613d02565b600080600260655414156131ae576040805162461bcd60e51b815260206004820152601f6024820152600080516020614aba833981519152604482015290519081900360640190fd5b60026065556131cb600080516020614b7e833981519152336125ff565b61320b576040805162461bcd60e51b815260206004820152600c60248201526b37b7363c9026b0b730b3b2b960a11b604482015290519081900360640190fd5b60a35460ff1615613254576040805162461bcd60e51b815260206004820152600e60248201526d1b5a5b9d081a5cc81c185d5cd95960921b604482015290519081900360640190fd5b6099546001600160a01b03166000198714156132df57604080516370a0823160e01b815233600482015290516001600160a01b038316916370a08231916024808301926020929190829003018186803b1580156132b057600080fd5b505afa1580156132c4573d6000803e3d6000fd5b505050506040513d60208110156132da57600080fd5b505196505b60008711613327576040805162461bcd60e51b815260206004820152601060248201526f1b5a5b9d081e995c9bc8185b5bdd5b9d60821b604482015290519081900360640190fd5b60975460a3546001600160a01b039091169062010000900460ff1680156133b257506000816001600160a01b03166344d90cf96040518163ffffffff1660e01b815260040160206040518083038186803b15801561338457600080fd5b505afa158015613398573d6000803e3d6000fd5b505050506040513d60208110156133ae57600080fd5b5051115b15613475576000816001600160a01b031663b4eae1cb6040518163ffffffff1660e01b815260040160206040518083038186803b1580156133f257600080fd5b505afa158015613406573d6000803e3d6000fd5b505050506040513d602081101561341c57600080fd5b5051609c549091506001600160401b0316811015613473576040805162461bcd60e51b815260206004820152600f60248201526e1b5a5b9d109bdd1a081c185d5cd959608a1b604482015290519081900360640190fd5b505b61348a6001600160a01b03831633838b6143bb565b806001600160a01b031663c061ddc7826001600160a01b03166309c431b78b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156134dd57600080fd5b505afa1580156134f1573d6000803e3d6000fd5b505050506040513d602081101561350757600080fd5b50516040516001600160e01b031960e084901b168152600481018281526001600160a01b038c1660248301528b916000919060440182815260200193505050506040805180830381600087803b15801561356057600080fd5b505af1158015613574573d6000803e3d6000fd5b505050506040513d604081101561358a57600080fd5b5080516020909101519094509250858410156135ea576040805162461bcd60e51b815260206004820152601a6024820152791a5b9cdd59999a58da595b9d0819951bdad95b881bdd5d1c1d5d60321b604482015290519081900360640190fd5b8483101561363c576040805162461bcd60e51b815260206004820152601a6024820152791a5b9cdd59999a58da595b9d081e151bdad95b881bdd5d1c1d5d60321b604482015290519081900360640190fd5b60408051898152602081018690528082018590526000606082015290516001600160a01b038916913391600080516020614ada8339815191529181900360800190a350506001606555909590945092505050565b6136a8600080516020614b9e833981519152336125ff565b6136ee576040805162461bcd60e51b81526020600482015260126024820152716f6e6c7920456d657267656e63792044414f60701b604482015290519081900360640190fd5b60a3805482151562010000810262ff0000199092169190911790915560408051918252517f4196aae9709137bf1668200549e5670dd60740a4c0f0a0b8fa8af720ea6890c29181900360200190a150565b600060026065541415613787576040805162461bcd60e51b815260206004820152601f6024820152600080516020614aba833981519152604482015290519081900360640190fd5b60026065556137a4600080516020614b7e833981519152336125ff565b6137e4576040805162461bcd60e51b815260206004820152600c60248201526b37b7363c9026b0b730b3b2b960a11b604482015290519081900360640190fd5b60a35460ff161561382d576040805162461bcd60e51b815260206004820152600e60248201526d1b5a5b9d081a5cc81c185d5cd95960921b604482015290519081900360640190fd5b6097546040805163b4eae1cb60e01b815290516001600160a01b0390921691600091839163b4eae1cb91600480820192602092909190829003018186803b15801561387757600080fd5b505afa15801561388b573d6000803e3d6000fd5b505050506040513d60208110156138a157600080fd5b505160408051608081018252609c546001600160401b038082168352600160401b820481166020840152600160801b8204811693830193909352600160c01b900490911660608201819052919250908210801590613908575080516001600160401b031682105b613959576040805162461bcd60e51b815260206004820152601960248201527f4e6f742073797374656d2073746162696c697479206d6f646500000000000000604482015290519081900360640190fd5b80516040805163e9ea2b2560e01b81526001600160401b03909216600483015280516000926001600160a01b0387169263e9ea2b2592602480840193829003018186803b1580156139a957600080fd5b505afa1580156139bd573d6000803e3d6000fd5b505050506040513d60408110156139d357600080fd5b50516040805163287583f160e01b81526004810183905290519192506001600160a01b0386169163287583f191602480820192602092909190829003018186803b158015613a2057600080fd5b505afa158015613a34573d6000803e3d6000fd5b505050506040513d6020811015613a4a57600080fd5b5051905080881115613a5a578097505b609954613a72906001600160a01b031633868b6143bb565b836001600160a01b03166357558b4d856001600160a01b03166309c431b78b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015613ac557600080fd5b505afa158015613ad9573d6000803e3d6000fd5b505050506040513d6020811015613aef57600080fd5b5051609d54604080516001600160e01b031960e086901b16815260048101939093526001600160401b0390911660248301526001600160a01b038b1660448301525160648083019260209291908290030181600087803b158015613b5257600080fd5b505af1158015613b66573d6000803e3d6000fd5b505050506040513d6020811015613b7c57600080fd5b5051945085851015613bd2576040805162461bcd60e51b815260206004820152601a6024820152791a5b9cdd59999a58da595b9d081e151bdad95b881bdd5d1c1d5d60321b604482015290519081900360640190fd5b604080518981526020810187905281516001600160a01b038a169233927f33a089d94f9a0b7d0fe21e69b40d7dbe1965be652c7382cc778d46963db8c49b929081900390910190a3505060016065555090949350505050565b6099546001600160a01b031681565b613c52600080516020614b9e833981519152336125ff565b613c98576040805162461bcd60e51b81526020600482015260126024820152716f6e6c7920456d657267656e63792044414f60701b604482015290519081900360640190fd5b60a380548215156301000000810263ff000000199092169190911790915560408051918252517f562f2fbd65ffba75e2b1c56803014f7484f53b7120e6bf67039025b31660aaf09181900360200190a150565b60008181526033602052604081206125f99061448e565b600082815260336020526040902060020154613d20906111d161418e565b6112765760405162461bcd60e51b8152600401808060200182810382526030815260200180614b206030913960400191505060405180910390fd5b60a3546301000000900460ff1681565b613d83600080516020614b9e833981519152336125ff565b613dc9576040805162461bcd60e51b81526020600482015260126024820152716f6e6c7920456d657267656e63792044414f60701b604482015290519081900360640190fd5b60a38054821515640100000000810264ff00000000199092169190911790915560408051918252517f4ba9c03f3fff652e6b24c17c32ac16ea7e33ad6798607a0f2a93026758c8da829181900360200190a150565b600080516020614b7e83398151915281565b60026065541415613e76576040805162461bcd60e51b815260206004820152601f6024820152600080516020614aba833981519152604482015290519081900360640190fd5b6002606555613e93600080516020614b7e833981519152336125ff565b613ed3576040805162461bcd60e51b815260206004820152600c60248201526b37b7363c9026b0b730b3b2b960a11b604482015290519081900360640190fd5b6097546099546001600160a01b0391821691613ef291163383856143bb565b806001600160a01b031663ed0aa428826001600160a01b03166309c431b7856040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015613f4557600080fd5b505afa158015613f59573d6000803e3d6000fd5b505050506040513d6020811015613f6f57600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b158015613faf57600080fd5b505af1158015613fc3573d6000803e3d6000fd5b50506040805185815290513393507f8657af3bd000528e14a071a6fd4c19969f08408ea71f0a0de0e66f086553f2be92509081900360200190a250506001606555565b609f546001600160801b03811690600160801b9004600f0b82565b614039600080516020614b9e833981519152336125ff565b61407f576040805162461bcd60e51b81526020600482015260126024820152716f6e6c7920456d657267656e63792044414f60701b604482015290519081900360640190fd5b60a3805482151560ff19909116811790915560408051918252517fab8d77c2f5164ba5c97920287b1e1e94a7c86073017b7a030f8df6625fbf07599181900360200190a150565b60a0546001600160801b03811690600160801b9004600f0b82565b6140f9600080516020614b9e833981519152336125ff565b61413f576040805162461bcd60e51b81526020600482015260126024820152716f6e6c7920456d657267656e63792044414f60701b604482015290519081900360640190fd5b60a38054821515610100810261ff00199092169190911790915560408051918252517fb60bda3106a5d9df6e4586ea2337b945413f796eab0e0a7c2758baa997a461dc9181900360200190a150565b3390565b60008281526033602052604090206141aa9082614499565b1561121b576141b761418e565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260336020526040902061421390826144ae565b1561121b5761422061418e565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b600061426f306144c3565b15905090565b600054610100900460ff168061428e575061428e614264565b8061429c575060005460ff16155b6142d75760405162461bcd60e51b815260040180806020018281038252602e815260200180614b50602e913960400191505060405180910390fd5b600054610100900460ff16158015614302576000805460ff1961ff0019909116610100171660011790555b61430a6144c9565b6143126144c9565b80156111b0576000805461ff001916905550565b600054610100900460ff168061433f575061433f614264565b8061434d575060005460ff16155b6143885760405162461bcd60e51b815260040180806020018281038252602e815260200180614b50602e913960400191505060405180910390fd5b600054610100900460ff161580156143b3576000805460ff1961ff0019909116610100171660011790555b614312614569565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261441590859061460f565b50505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610c7890849061460f565b60006125f683836146c0565b60006125f6836001600160a01b038416614724565b60006125f98261473c565b60006125f6836001600160a01b038416614740565b60006125f6836001600160a01b03841661478a565b3b151590565b600054610100900460ff16806144e257506144e2614264565b806144f0575060005460ff16155b61452b5760405162461bcd60e51b815260040180806020018281038252602e815260200180614b50602e913960400191505060405180910390fd5b600054610100900460ff16158015614312576000805460ff1961ff00199091166101001716600117905580156111b0576000805461ff001916905550565b600054610100900460ff16806145825750614582614264565b80614590575060005460ff16155b6145cb5760405162461bcd60e51b815260040180806020018281038252602e815260200180614b50602e913960400191505060405180910390fd5b600054610100900460ff161580156145f6576000805460ff1961ff0019909116610100171660011790555b600160655580156111b0576000805461ff001916905550565b6000614664826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166148509092919063ffffffff16565b805190915015610c785780806020019051602081101561468357600080fd5b5051610c785760405162461bcd60e51b815260040180806020018281038252602a815260200180614bbe602a913960400191505060405180910390fd5b815460009082106147025760405162461bcd60e51b8152600401808060200182810382526022815260200180614a696022913960400191505060405180910390fd5b82600001828154811061471157fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b5490565b600061474c8383614724565b614782575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556125f9565b5060006125f9565b6000818152600183016020526040812054801561484657835460001980830191908101906000908790839081106147bd57fe5b90600052602060002001549050808760000184815481106147da57fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061480a57fe5b600190038181906000526020600020016000905590558660010160008781526020019081526020016000206000905560019450505050506125f9565b60009150506125f9565b606061485f8484600085614869565b90505b9392505050565b6060824710156148aa5760405162461bcd60e51b8152600401808060200182810382526026815260200180614afa6026913960400191505060405180910390fd5b6148b3856144c3565b614904576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106149425780518252601f199092019160209182019101614923565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146149a4576040519150601f19603f3d011682016040523d82523d6000602084013e6149a9565b606091505b50915091506149b98282866149c4565b979650505050505050565b606083156149d3575081614862565b8251156149e35782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614a2d578181015183820152602001614a15565b50505050905090810190601f168015614a5a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e745265656e7472616e637947756172643a207265656e7472616e742063616c6c00a55115a2f9ae57c699b769e23a7f54ce6ba307a078c5b5378368e3ec086b69bb416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0830d43bb366ef85d2e9345bef3138e4a552faefea6255fa2db4667fdcf34d69a55361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a2646970667358221220ffad4fecca309f8a3fe28a2955bdba7697fa0fab2d2aa1bf22675bbce438d16d64736f6c63430007060033","optimization_enabled":true,"verified_twin_address_hash":null,"is_verified":true,"compiler_settings":{"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"optimization_runs":200,"sourcify_repo_url":"https://repo.sourcify.dev/contracts/full_match/1/0x11b21aFA735e24683f0912D9f6F8a8bFAbBeb10E/","decoded_constructor_args":null,"compiler_version":"0.7.6+commit.7338295f","is_verified_via_verifier_alliance":false,"verified_at":"2026-01-12T23:03:31.087355Z","implementations":[],"proxy_type":null,"external_libraries":[],"creation_bytecode":"0x608060405234801561001057600080fd5b50614c4c806100206000396000f3fe608060405234801561001057600080fd5b506004361061030c5760003560e01c806395a086d71161019d578063c26a4ed0116100e9578063e1694288116100a2578063edd6fcd21161007c578063edd6fcd21461096e578063f30e6e7714610976578063f478f35d14610995578063fc6abd411461099d5761030c565b8063e16942881461092a578063ec87621c14610949578063ed0aa428146109515761030c565b8063c26a4ed014610880578063c55dae63146108b2578063c7904919146108ba578063ca15c873146108d9578063d547741f146108f6578063db7dae1b146109225761030c565b8063a8694e5711610156578063bddd87eb11610130578063bddd87eb146107fb578063be4dc94f14610803578063bf2c8a9414610829578063c17680cd146108615761030c565b8063a8694e57146107b9578063b235d468146107c1578063b5567473146107c95761030c565b806395a086d71461070c57806396e83839146107435780639a54616b1461074b578063a217fddf14610783578063a293da0f1461078b578063a455f1ac146107b15761030c565b80634bde38c81161025c5780637b10399911610215578063874be59b116101ef578063874be59b146106775780638838a3db1461067f5780639010d07c146106bd57806391d14854146106e05761030c565b80637b103999146106395780637e4831d31461064157806385915707146106495761030c565b80634bde38c814610546578063534b23bb1461054e5780635bfb36f21461057457806361d027b3146105ae57806364c9b4c3146105b6578063694a7ce7146105e85761030c565b806318ebbb82116102c957806326e885e3116102a357806326e885e31461049a5780632f2ff15d146104c057806336568abe146104ec578063485cc955146105185761030c565b806318ebbb821461041357806323c113dc14610441578063248a9ca31461047d5761030c565b80630266f04414610311578063088b699e14610335578063119e38201461033d5780631447696a14610376578063144f1704146103a9578063153f7cd0146103ed575b600080fd5b6103196109bc565b604080516001600160a01b039092168252519081900360200190f35b6103196109d2565b6103746004803603606081101561035357600080fd5b506001600160801b03813516906020810135600f0b906040013515156109e1565b005b61037e610c7d565b604080516001600160401b039485168152928416602084015292168183015290519081900360600190f35b6103db600480360360608110156103bf57600080fd5b508035906001600160a01b036020820135169060400135610ca2565b60408051918252519081900360200190f35b6103746004803603602081101561040357600080fd5b50356001600160a01b0316611046565b61041b6110f1565b604080516001600160801b039093168352600f9190910b60208301528051918290030190f35b61044961110c565b604080516001600160401b039586168152938516602085015291841683830152909216606082015290519081900360800190f35b6103db6004803603602081101561049357600080fd5b503561113a565b610374600480360360208110156104b057600080fd5b50356001600160a01b031661114f565b610374600480360360408110156104d657600080fd5b50803590602001356001600160a01b03166111b3565b6103746004803603604081101561050257600080fd5b50803590602001356001600160a01b031661121f565b6103746004803603604081101561052e57600080fd5b506001600160a01b0381358116916020013516611280565b6103196114f1565b6103746004803603602081101561056457600080fd5b50356001600160a01b0316611500565b61059a6004803603602081101561058a57600080fd5b50356001600160a01b031661159d565b604080519115158252519081900360200190f35b6103196115b2565b6103db600480360360608110156105cc57600080fd5b508035906001600160a01b0360208201351690604001356115c1565b610620600480360360808110156105fe57600080fd5b508035906020810135906001600160a01b036040820135169060600135611b13565b6040805192835260208301919091528051918290030190f35b61031961233a565b61059a612349565b6103746004803603604081101561065f57600080fd5b506001600160a01b0381351690602001351515612352565b61059a6123ff565b6103746004803603608081101561069557600080fd5b506001600160401b03813581169160208101358216916040820135811691606001351661240e565b610319600480360360408110156106d357600080fd5b50803590602001356125de565b61059a600480360360408110156106f657600080fd5b50803590602001356001600160a01b03166125ff565b6103746004803603606081101561072257600080fd5b506001600160801b03813516906020810135600f0b90604001351515612617565b6103db6128b2565b6103746004803603606081101561076157600080fd5b506001600160401b0381358116916020810135821691604090910135166128c4565b6103db612acd565b610374600480360360208110156107a157600080fd5b50356001600160a01b0316612ad2565b61041b612b6f565b610319612b8a565b61059a612b99565b610620600480360360608110156107df57600080fd5b508035906001600160a01b036020820135169060400135612ba7565b61059a6130f3565b6103746004803603602081101561081957600080fd5b50356001600160a01b0316613104565b6106206004803603608081101561083f57600080fd5b508035906001600160a01b036020820135169060408101359060600135613165565b6103746004803603602081101561087757600080fd5b50351515613690565b6103db6004803603606081101561089657600080fd5b508035906001600160a01b03602082013516906040013561373f565b610319613c2b565b610374600480360360208110156108d057600080fd5b50351515613c3a565b6103db600480360360208110156108ef57600080fd5b5035613ceb565b6103746004803603604081101561090c57600080fd5b50803590602001356001600160a01b0316613d02565b61059a613d5b565b6103746004803603602081101561094057600080fd5b50351515613d6b565b6103db613e1e565b6103746004803603602081101561096757600080fd5b5035613e30565b61041b614006565b6103746004803603602081101561098c57600080fd5b50351515614021565b61041b6140c6565b610374600480360360208110156109b357600080fd5b503515156140e1565b60a354600160281b90046001600160a01b031681565b609b546001600160a01b031681565b6109ec6000336125ff565b610a2a576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b670de0b6b3a7640000836001600160801b03161115610a90576040805162461bcd60e51b815260206004820152601b60248201527f64656661756c742066656520726174696f20746f6f206c617267650000000000604482015290519081900360640190fd5b600082600f0b1215610b0157826001600160801b0316826000036001600160801b03161115610afc576040805162461bcd60e51b815260206004820152601360248201527219195b1d1848199959481d1bdbc81cdb585b1b606a1b604482015290519081900360640190fd5b610b68565b826001600160801b0316670de0b6b3a764000003826001600160801b03161115610b68576040805162461bcd60e51b8152602060048201526013602482015272746f74616c2066656520746f6f206c6172676560681b604482015290519081900360640190fd5b8015610bf5576040805180820182526001600160801b03808616808352600f86810b602094850181905260a080549282900b8516600160801b026001600160801b031990931684179094169190911790925583519081529182015281517ffce764732a3255daf06ab4e5370ba4555bab529a9ae95e401067d9db337f64e9929181900390910190a1610c78565b6040805180820182526001600160801b03808616808352600f86810b602094850181905260a180549282900b8516600160801b026001600160801b031990931684179094169190911790925583519081529182015281517f137ea7143d6b2c0ee9295ef5da20af0586620f43982b58a55643b5d1c8e525e1929181900390910190a15b505050565b609d546001600160401b0380821691600160401b8104821691600160801b9091041683565b600060026065541415610cea576040805162461bcd60e51b815260206004820152601f6024820152600080516020614aba833981519152604482015290519081900360640190fd5b6002606555610d07600080516020614b7e833981519152336125ff565b610d47576040805162461bcd60e51b815260206004820152600c60248201526b37b7363c9026b0b730b3b2b960a11b604482015290519081900360640190fd5b60a35460ff1615610d90576040805162461bcd60e51b815260206004820152600e60248201526d1b5a5b9d081a5cc81c185d5cd95960921b604482015290519081900360640190fd5b6001600160a01b038316610ddf576040805162461bcd60e51b81526020600482015260116024820152701a5b9d985b1a59081c9958da5c1a595b9d607a1b604482015290519081900360640190fd5b609c546001600160401b0316841015610e3f576040805162461bcd60e51b815260206004820152601f60248201527f74617267657420636f6c6c61746572616c20726174696f20746f6f206c6f7700604482015290519081900360640190fd5b60975460a3546001600160a01b03909116906301000000900460ff1615610f20576000816001600160a01b031663b4eae1cb6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9b57600080fd5b505afa158015610eaf573d6000803e3d6000fd5b505050506040513d6020811015610ec557600080fd5b5051609c549091506001600160401b03168111610f1e576040805162461bcd60e51b815260206004820152601260248201527119951bdad95b881b5a5b9d081c185d5cd95960721b604482015290519081900360640190fd5b505b806001600160a01b031663c6613ae186866040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050602060405180830381600087803b158015610f7757600080fd5b505af1158015610f8b573d6000803e3d6000fd5b505050506040513d6020811015610fa157600080fd5b5051915082821015610ff7576040805162461bcd60e51b815260206004820152601a6024820152791a5b9cdd59999a58da595b9d0819951bdad95b881bdd5d1c1d5d60321b604482015290519081900360640190fd5b60408051600080825260208201859052818301819052606082015290516001600160a01b038616913391600080516020614ada8339815191529181900360800190a35060016065559392505050565b6110516000336125ff565b61108f576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b60a380546001600160a01b038316600160281b810265010000000000600160c81b03199092169190911790915560408051918252517f029a249314e1823cb2942c931203164b40496eaa6f87277ea9ca7492357755ba9181900360200190a150565b60a1546001600160801b03811690600160801b9004600f0b82565b609c546001600160401b0380821691600160401b8104821691600160801b8204811691600160c01b90041684565b60009081526033602052604090206002015490565b61115a6000336125ff565b611198576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b6111b0600080516020614b7e833981519152826111b3565b50565b6000828152603360205260409020600201546111d6906111d161418e565b6125ff565b6112115760405162461bcd60e51b815260040180806020018281038252602f815260200180614a8b602f913960400191505060405180910390fd5b61121b8282614192565b5050565b61122761418e565b6001600160a01b0316816001600160a01b0316146112765760405162461bcd60e51b815260040180806020018281038252602f815260200180614be8602f913960400191505060405180910390fd5b61121b82826141fb565b600054610100900460ff16806112995750611299614264565b806112a7575060005460ff16155b6112e25760405162461bcd60e51b815260040180806020018281038252602e815260200180614b50602e913960400191505060405180910390fd5b600054610100900460ff1615801561130d576000805460ff1961ff0019909116610100171660011790555b611315614275565b61131d614326565b611328600033611211565b609780546001600160a01b038086166001600160a01b0319928316811790935560988054918616919092161790556040805163c55dae6360e01b8152905163c55dae6391600480820192602092909190829003018186803b15801561138c57600080fd5b505afa1580156113a0573d6000803e3d6000fd5b505050506040513d60208110156113b657600080fd5b5051609980546001600160a01b0319166001600160a01b039283161790556040805163a8694e5760e01b815290519185169163a8694e5791600480820192602092909190829003018186803b15801561140e57600080fd5b505afa158015611422573d6000803e3d6000fd5b505050506040513d602081101561143857600080fd5b5051609a80546001600160a01b0319166001600160a01b0392831617905560408051630445b4cf60e11b815290519185169163088b699e91600480820192602092909190829003018186803b15801561149057600080fd5b505afa1580156114a4573d6000803e3d6000fd5b505050506040513d60208110156114ba57600080fd5b5051609b80546001600160a01b0319166001600160a01b039092169190911790558015610c78576000805461ff0019169055505050565b6098546001600160a01b031681565b61150b6000336125ff565b611549576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b60a480546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f964a21914a7149ce5cc4a604ed564c4c9d725683a7fe09d1737bc3d13578788f9181900360200190a150565b60a26020526000908152604090205460ff1681565b6097546001600160a01b031681565b600060026065541415611609576040805162461bcd60e51b815260206004820152601f6024820152600080516020614aba833981519152604482015290519081900360640190fd5b6002606555611626600080516020614b7e833981519152336125ff565b611666576040805162461bcd60e51b815260206004820152600c60248201526b37b7363c9026b0b730b3b2b960a11b604482015290519081900360640190fd5b60a35460ff16156116af576040805162461bcd60e51b815260206004820152600e60248201526d1b5a5b9d081a5cc81c185d5cd95960921b604482015290519081900360640190fd5b6099546001600160a01b031660001985141561173a57604080516370a0823160e01b815233600482015290516001600160a01b038316916370a08231916024808301926020929190829003018186803b15801561170b57600080fd5b505afa15801561171f573d6000803e3d6000fd5b505050506040513d602081101561173557600080fd5b505194505b60008511611782576040805162461bcd60e51b815260206004820152601060248201526f1b5a5b9d081e995c9bc8185b5bdd5b9d60821b604482015290519081900360640190fd5b609754609c546040805163066498a160e41b81526001600160401b03909216600483015280516001600160a01b039093169260009284926366498a1092602480840193829003018186803b1580156117d957600080fd5b505afa1580156117ed573d6000803e3d6000fd5b505050506040513d604081101561180357600080fd5b50516040805163287583f160e01b81526004810183905290519192506001600160a01b0384169163287583f191602480820192602092909190829003018186803b15801561185057600080fd5b505afa158015611864573d6000803e3d6000fd5b505050506040513d602081101561187a57600080fd5b505160a3549091506301000000900460ff161561195d576000826001600160a01b031663b4eae1cb6040518163ffffffff1660e01b815260040160206040518083038186803b1580156118cc57600080fd5b505afa1580156118e0573d6000803e3d6000fd5b505050506040513d60208110156118f657600080fd5b5051609c549091506001600160401b0316811161194f576040805162461bcd60e51b815260206004820152601260248201527119951bdad95b881b5a5b9d081c185d5cd95960721b604482015290519081900360640190fd5b8188111561195b578197505b505b6119726001600160a01b03841633848a6143bb565b816001600160a01b031663c061ddc7836001600160a01b03166309c431b78a6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156119c557600080fd5b505afa1580156119d9573d6000803e3d6000fd5b505050506040513d60208110156119ef57600080fd5b50516040805160e084901b6001600160e01b031916815260048101929092526001600160a01b038a1660248301526001604483015280516064808401938290030181600087803b158015611a4257600080fd5b505af1158015611a56573d6000803e3d6000fd5b505050506040513d6040811015611a6c57600080fd5b5051935084841015611ac2576040805162461bcd60e51b815260206004820152601a6024820152791a5b9cdd59999a58da595b9d0819951bdad95b881bdd5d1c1d5d60321b604482015290519081900360640190fd5b60408051888152602081018690526000818301819052606082015290516001600160a01b038816913391600080516020614ada8339815191529181900360800190a350506001606555509392505050565b60008060026065541415611b5c576040805162461bcd60e51b815260206004820152601f6024820152600080516020614aba833981519152604482015290519081900360640190fd5b6002606555611b79600080516020614b7e833981519152336125ff565b611bb9576040805162461bcd60e51b815260206004820152600c60248201526b37b7363c9026b0b730b3b2b960a11b604482015290519081900360640190fd5b60a354610100900460ff1615611c09576040805162461bcd60e51b815260206004820152601060248201526f1c995919595b481a5cc81c185d5cd95960821b604482015290519081900360640190fd5b600019861415611c8d57609a54604080516370a0823160e01b815233600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015611c5e57600080fd5b505afa158015611c72573d6000803e3d6000fd5b505050506040513d6020811015611c8857600080fd5b505195505b600019851415611d1157609b54604080516370a0823160e01b815233600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015611ce257600080fd5b505afa158015611cf6573d6000803e3d6000fd5b505050506040513d6020811015611d0c57600080fd5b505194505b6000861180611d205750600085115b611d66576040805162461bcd60e51b81526020600482015260126024820152711c995919595b481e995c9bc8185b5bdd5b9d60721b604482015290519081900360640190fd5b851580611d71575084155b611dc2576040805162461bcd60e51b815260206004820152601760248201527f6f6e6c792072656465656d2073696e676c652073696465000000000000000000604482015290519081900360640190fd5b60975460408051608081018252609c546001600160401b038082168352600160401b820481166020840152600160801b8204811693830193909352600160c01b900490911660608201526001600160a01b039091169060008815611ea4578151604080516271691b60e21b81526001600160401b03909216600483015280516000926001600160a01b038716926301c5a46c92602480840193829003018186803b158015611e6f57600080fd5b505afa158015611e83573d6000803e3d6000fd5b505050506040513d6040811015611e9957600080fd5b505191506120089050565b815160408051636902b79f60e11b81526001600160401b03909216600483015280516000926001600160a01b0387169263d2056f3e92602480840193829003018186803b158015611ef457600080fd5b505afa158015611f08573d6000803e3d6000fd5b505050506040513d6040811015611f1e57600080fd5b506020015160a354909150640100000000900460ff1615612006576000846001600160a01b031663b4eae1cb6040518163ffffffff1660e01b815260040160206040518083038186803b158015611f7457600080fd5b505afa158015611f88573d6000803e3d6000fd5b505050506040513d6020811015611f9e57600080fd5b505184519091506001600160401b03168111611ff8576040805162461bcd60e51b81526020600482015260146024820152731e151bdad95b881c995919595b481c185d5cd95960621b604482015290519081900360640190fd5b818a1115612004578199505b505b505b6040805163049104e560e01b8152600481018b9052602481018a905233604482015290516001600160a01b0385169163049104e59160648083019260209291908290030181600087803b15801561205e57600080fd5b505af1158015612072573d6000803e3d6000fd5b505050506040513d602081101561208857600080fd5b5051945088158015906120ac575060a354600160281b90046001600160a01b031615155b1561216b576000818610156120c25750846120c5565b50805b80156121695760a35460995460408051632b2b2cf560e11b81526001600160a01b0392831660048201528b83166024820152604481018590529051600160281b9093049091169163565659ea916064808201926020929091908290030181600087803b15801561213457600080fd5b505af192505050801561215957506040513d602081101561215457600080fd5b505160015b6121665760009450612169565b94505b505b826001600160a01b031663287583f1866040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156121af57600080fd5b505afa1580156121c3573d6000803e3d6000fd5b505050506040513d60208110156121d957600080fd5b5051609954604080516370a0823160e01b815230600482015290519297506000926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561222c57600080fd5b505afa158015612240573d6000803e3d6000fd5b505050506040513d602081101561225657600080fd5b5051905085811015612266578095505b868610156122bb576040805162461bcd60e51b815260206004820152601860248201527f696e73756666696369656e742062617365206f75747075740000000000000000604482015290519081900360640190fd5b6099546122d2906001600160a01b0316898861441b565b604080518b8152602081018b90528082018890526000606082015290516001600160a01b038a169133917f8caf04742286d017f9ac3924388e188c73e6e5094311c5e59a61a7ef86dda8bf9181900360800190a3505060016065555091969095509350505050565b60a4546001600160a01b031681565b60a35460ff1681565b61235d6000336125ff565b61239b576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b038216600081815260a26020908152604091829020805460ff191685151590811790915582519384529083015280517f24c0dcc77a0a580f413a8d41a2efffeb4b4643c8f2a6cfce6680a25fc2cc3bf19281900390910190a15050565b60a35462010000900460ff1681565b6124196000336125ff565b612457576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b826001600160401b0316846001600160401b03161180156124895750816001600160401b0316836001600160401b0316115b80156124a65750806001600160401b0316826001600160401b0316115b80156124c35750670de0b6b3a7640000816001600160401b031610155b61250c576040805162461bcd60e51b8152602060048201526015602482015274696e76616c6964206d61726b657420636f6e66696760581b604482015290519081900360640190fd5b60408051608080820183526001600160401b0387811680845287821660208086018290528884168688018190529388166060968701819052609c805467ffffffffffffffff1916851767ffffffffffffffff60401b1916600160401b85021767ffffffffffffffff60801b1916600160801b8702176001600160c01b0316600160c01b8302179055875193845290830191909152818601929092529283015291517f75dcf5f4ede2681107b573664f473d2282f8dc82de08d07844bb5c6191b7795f929181900390910190a150505050565b60008281526033602052604081206125f6908361446d565b90505b92915050565b60008281526033602052604081206125f69083614479565b6126226000336125ff565b612660576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b670de0b6b3a7640000836001600160801b031611156126c6576040805162461bcd60e51b815260206004820152601b60248201527f64656661756c742066656520726174696f20746f6f206c617267650000000000604482015290519081900360640190fd5b600082600f0b121561273757826001600160801b0316826000036001600160801b03161115612732576040805162461bcd60e51b815260206004820152601360248201527219195b1d1848199959481d1bdbc81cdb585b1b606a1b604482015290519081900360640190fd5b61279e565b826001600160801b0316670de0b6b3a764000003826001600160801b0316111561279e576040805162461bcd60e51b8152602060048201526013602482015272746f74616c2066656520746f6f206c6172676560681b604482015290519081900360640190fd5b801561282b576040805180820182526001600160801b03808616808352600f86810b6020948501819052609e80549282900b8516600160801b026001600160801b031990931684179094169190911790925583519081529182015281517fc5e9a5b971bffb75f7fa60d9d340915ae3514b4afcd80b3d510b483f86923735929181900390910190a1610c78565b6040805180820182526001600160801b03808616808352600f86810b6020948501819052609f80549282900b8516600160801b026001600160801b031990931684179094169190911790925583519081529182015281517f1cc54cd8b09b21a5f5ae2334b14e5bce0ffcf23845aeb2739f791637cf30fed3929181900390910190a1505050565b600080516020614b9e83398151915281565b6128cf6000336125ff565b61290d576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b6000836001600160401b031611612961576040805162461bcd60e51b81526020600482015260136024820152721a5b98d95b9d1a5d99481d1bdbc81cdb585b1b606a1b604482015290519081900360640190fd5b6000816001600160401b0316116129b5576040805162461bcd60e51b81526020600482015260136024820152721a5b98d95b9d1a5d99481d1bdbc81cdb585b1b606a1b604482015290519081900360640190fd5b806001600160401b0316826001600160401b03161015612a1c576040805162461bcd60e51b815260206004820152601860248201527f696e76616c696420696e63656e7469766520636f6e6669670000000000000000604482015290519081900360640190fd5b60408051606080820183526001600160401b038681168084528682166020808601829052928716948601859052609d805467ffffffffffffffff1916831767ffffffffffffffff60401b1916600160401b83021767ffffffffffffffff60801b1916600160801b87021790558551918252918101919091528084019290925291517fff560a359aa5e5f8b0a2de8c59393f72576e47c178f00c8c6b8794c6bbd29e7f929181900390910190a1505050565b600081565b612add6000336125ff565b612b1b576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b609880546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f43412ddbc9c884a0be720e21657a878716d21710438ad24f74f7e99699df82fc9181900360200190a150565b609e546001600160801b03811690600160801b9004600f0b82565b609a546001600160a01b031681565b60a354610100900460ff1681565b60008060026065541415612bf0576040805162461bcd60e51b815260206004820152601f6024820152600080516020614aba833981519152604482015290519081900360640190fd5b6002606555612c0d600080516020614b7e833981519152336125ff565b612c4d576040805162461bcd60e51b815260206004820152600c60248201526b37b7363c9026b0b730b3b2b960a11b604482015290519081900360640190fd5b60a35460ff1615612c96576040805162461bcd60e51b815260206004820152600e60248201526d1b5a5b9d081a5cc81c185d5cd95960921b604482015290519081900360640190fd5b6099546001600160a01b0316600019861415612d2157604080516370a0823160e01b815233600482015290516001600160a01b038316916370a08231916024808301926020929190829003018186803b158015612cf257600080fd5b505afa158015612d06573d6000803e3d6000fd5b505050506040513d6020811015612d1c57600080fd5b505195505b60008611612d69576040805162461bcd60e51b815260206004820152601060248201526f1b5a5b9d081e995c9bc8185b5bdd5b9d60821b604482015290519081900360640190fd5b609754609c546040805163e9ea2b2560e01b81526001600160401b03909216600483015280516001600160a01b0390931692600092849263e9ea2b2592602480840193829003018186803b158015612dc057600080fd5b505afa158015612dd4573d6000803e3d6000fd5b505050506040513d6040811015612dea57600080fd5b50516040805163287583f160e01b81526004810183905290519192506001600160a01b0384169163287583f191602480820192602092909190829003018186803b158015612e3757600080fd5b505afa158015612e4b573d6000803e3d6000fd5b505050506040513d6020811015612e6157600080fd5b50519050612e7a6001600160a01b03841633848b6143bb565b816001600160a01b031663c061ddc7836001600160a01b03166309c431b78b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015612ecd57600080fd5b505afa158015612ee1573d6000803e3d6000fd5b505050506040513d6020811015612ef757600080fd5b50516040805160e084901b6001600160e01b031916815260048101929092526001600160a01b038b1660248301526002604483015280516064808401938290030181600087803b158015612f4a57600080fd5b505af1158015612f5e573d6000803e3d6000fd5b505050506040513d6040811015612f7457600080fd5b5060200151945085851015612fcd576040805162461bcd60e51b815260206004820152601a6024820152791a5b9cdd59999a58da595b9d081e151bdad95b881bdd5d1c1d5d60321b604482015290519081900360640190fd5b60a354600160281b90046001600160a01b03161561309f57600081891015612ff6575087612ff9565b50805b801561309d5760a35460995460408051632b2b2cf560e11b81526001600160a01b0392831660048201528b83166024820152604481018590529051600160281b9093049091169163565659ea916064808201926020929091908290030181600087803b15801561306857600080fd5b505af192505050801561308d57506040513d602081101561308857600080fd5b505160015b61309a576000945061309d565b94505b505b60408051898152600060208201819052818301889052606082015290516001600160a01b038916913391600080516020614ada8339815191529181900360800190a350506001606555509094909350915050565b60a354640100000000900460ff1681565b61310f6000336125ff565b61314d576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9020b236b4b760b11b604482015290519081900360640190fd5b6111b0600080516020614b7e83398151915282613d02565b600080600260655414156131ae576040805162461bcd60e51b815260206004820152601f6024820152600080516020614aba833981519152604482015290519081900360640190fd5b60026065556131cb600080516020614b7e833981519152336125ff565b61320b576040805162461bcd60e51b815260206004820152600c60248201526b37b7363c9026b0b730b3b2b960a11b604482015290519081900360640190fd5b60a35460ff1615613254576040805162461bcd60e51b815260206004820152600e60248201526d1b5a5b9d081a5cc81c185d5cd95960921b604482015290519081900360640190fd5b6099546001600160a01b03166000198714156132df57604080516370a0823160e01b815233600482015290516001600160a01b038316916370a08231916024808301926020929190829003018186803b1580156132b057600080fd5b505afa1580156132c4573d6000803e3d6000fd5b505050506040513d60208110156132da57600080fd5b505196505b60008711613327576040805162461bcd60e51b815260206004820152601060248201526f1b5a5b9d081e995c9bc8185b5bdd5b9d60821b604482015290519081900360640190fd5b60975460a3546001600160a01b039091169062010000900460ff1680156133b257506000816001600160a01b03166344d90cf96040518163ffffffff1660e01b815260040160206040518083038186803b15801561338457600080fd5b505afa158015613398573d6000803e3d6000fd5b505050506040513d60208110156133ae57600080fd5b5051115b15613475576000816001600160a01b031663b4eae1cb6040518163ffffffff1660e01b815260040160206040518083038186803b1580156133f257600080fd5b505afa158015613406573d6000803e3d6000fd5b505050506040513d602081101561341c57600080fd5b5051609c549091506001600160401b0316811015613473576040805162461bcd60e51b815260206004820152600f60248201526e1b5a5b9d109bdd1a081c185d5cd959608a1b604482015290519081900360640190fd5b505b61348a6001600160a01b03831633838b6143bb565b806001600160a01b031663c061ddc7826001600160a01b03166309c431b78b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156134dd57600080fd5b505afa1580156134f1573d6000803e3d6000fd5b505050506040513d602081101561350757600080fd5b50516040516001600160e01b031960e084901b168152600481018281526001600160a01b038c1660248301528b916000919060440182815260200193505050506040805180830381600087803b15801561356057600080fd5b505af1158015613574573d6000803e3d6000fd5b505050506040513d604081101561358a57600080fd5b5080516020909101519094509250858410156135ea576040805162461bcd60e51b815260206004820152601a6024820152791a5b9cdd59999a58da595b9d0819951bdad95b881bdd5d1c1d5d60321b604482015290519081900360640190fd5b8483101561363c576040805162461bcd60e51b815260206004820152601a6024820152791a5b9cdd59999a58da595b9d081e151bdad95b881bdd5d1c1d5d60321b604482015290519081900360640190fd5b60408051898152602081018690528082018590526000606082015290516001600160a01b038916913391600080516020614ada8339815191529181900360800190a350506001606555909590945092505050565b6136a8600080516020614b9e833981519152336125ff565b6136ee576040805162461bcd60e51b81526020600482015260126024820152716f6e6c7920456d657267656e63792044414f60701b604482015290519081900360640190fd5b60a3805482151562010000810262ff0000199092169190911790915560408051918252517f4196aae9709137bf1668200549e5670dd60740a4c0f0a0b8fa8af720ea6890c29181900360200190a150565b600060026065541415613787576040805162461bcd60e51b815260206004820152601f6024820152600080516020614aba833981519152604482015290519081900360640190fd5b60026065556137a4600080516020614b7e833981519152336125ff565b6137e4576040805162461bcd60e51b815260206004820152600c60248201526b37b7363c9026b0b730b3b2b960a11b604482015290519081900360640190fd5b60a35460ff161561382d576040805162461bcd60e51b815260206004820152600e60248201526d1b5a5b9d081a5cc81c185d5cd95960921b604482015290519081900360640190fd5b6097546040805163b4eae1cb60e01b815290516001600160a01b0390921691600091839163b4eae1cb91600480820192602092909190829003018186803b15801561387757600080fd5b505afa15801561388b573d6000803e3d6000fd5b505050506040513d60208110156138a157600080fd5b505160408051608081018252609c546001600160401b038082168352600160401b820481166020840152600160801b8204811693830193909352600160c01b900490911660608201819052919250908210801590613908575080516001600160401b031682105b613959576040805162461bcd60e51b815260206004820152601960248201527f4e6f742073797374656d2073746162696c697479206d6f646500000000000000604482015290519081900360640190fd5b80516040805163e9ea2b2560e01b81526001600160401b03909216600483015280516000926001600160a01b0387169263e9ea2b2592602480840193829003018186803b1580156139a957600080fd5b505afa1580156139bd573d6000803e3d6000fd5b505050506040513d60408110156139d357600080fd5b50516040805163287583f160e01b81526004810183905290519192506001600160a01b0386169163287583f191602480820192602092909190829003018186803b158015613a2057600080fd5b505afa158015613a34573d6000803e3d6000fd5b505050506040513d6020811015613a4a57600080fd5b5051905080881115613a5a578097505b609954613a72906001600160a01b031633868b6143bb565b836001600160a01b03166357558b4d856001600160a01b03166309c431b78b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015613ac557600080fd5b505afa158015613ad9573d6000803e3d6000fd5b505050506040513d6020811015613aef57600080fd5b5051609d54604080516001600160e01b031960e086901b16815260048101939093526001600160401b0390911660248301526001600160a01b038b1660448301525160648083019260209291908290030181600087803b158015613b5257600080fd5b505af1158015613b66573d6000803e3d6000fd5b505050506040513d6020811015613b7c57600080fd5b5051945085851015613bd2576040805162461bcd60e51b815260206004820152601a6024820152791a5b9cdd59999a58da595b9d081e151bdad95b881bdd5d1c1d5d60321b604482015290519081900360640190fd5b604080518981526020810187905281516001600160a01b038a169233927f33a089d94f9a0b7d0fe21e69b40d7dbe1965be652c7382cc778d46963db8c49b929081900390910190a3505060016065555090949350505050565b6099546001600160a01b031681565b613c52600080516020614b9e833981519152336125ff565b613c98576040805162461bcd60e51b81526020600482015260126024820152716f6e6c7920456d657267656e63792044414f60701b604482015290519081900360640190fd5b60a380548215156301000000810263ff000000199092169190911790915560408051918252517f562f2fbd65ffba75e2b1c56803014f7484f53b7120e6bf67039025b31660aaf09181900360200190a150565b60008181526033602052604081206125f99061448e565b600082815260336020526040902060020154613d20906111d161418e565b6112765760405162461bcd60e51b8152600401808060200182810382526030815260200180614b206030913960400191505060405180910390fd5b60a3546301000000900460ff1681565b613d83600080516020614b9e833981519152336125ff565b613dc9576040805162461bcd60e51b81526020600482015260126024820152716f6e6c7920456d657267656e63792044414f60701b604482015290519081900360640190fd5b60a38054821515640100000000810264ff00000000199092169190911790915560408051918252517f4ba9c03f3fff652e6b24c17c32ac16ea7e33ad6798607a0f2a93026758c8da829181900360200190a150565b600080516020614b7e83398151915281565b60026065541415613e76576040805162461bcd60e51b815260206004820152601f6024820152600080516020614aba833981519152604482015290519081900360640190fd5b6002606555613e93600080516020614b7e833981519152336125ff565b613ed3576040805162461bcd60e51b815260206004820152600c60248201526b37b7363c9026b0b730b3b2b960a11b604482015290519081900360640190fd5b6097546099546001600160a01b0391821691613ef291163383856143bb565b806001600160a01b031663ed0aa428826001600160a01b03166309c431b7856040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015613f4557600080fd5b505afa158015613f59573d6000803e3d6000fd5b505050506040513d6020811015613f6f57600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b158015613faf57600080fd5b505af1158015613fc3573d6000803e3d6000fd5b50506040805185815290513393507f8657af3bd000528e14a071a6fd4c19969f08408ea71f0a0de0e66f086553f2be92509081900360200190a250506001606555565b609f546001600160801b03811690600160801b9004600f0b82565b614039600080516020614b9e833981519152336125ff565b61407f576040805162461bcd60e51b81526020600482015260126024820152716f6e6c7920456d657267656e63792044414f60701b604482015290519081900360640190fd5b60a3805482151560ff19909116811790915560408051918252517fab8d77c2f5164ba5c97920287b1e1e94a7c86073017b7a030f8df6625fbf07599181900360200190a150565b60a0546001600160801b03811690600160801b9004600f0b82565b6140f9600080516020614b9e833981519152336125ff565b61413f576040805162461bcd60e51b81526020600482015260126024820152716f6e6c7920456d657267656e63792044414f60701b604482015290519081900360640190fd5b60a38054821515610100810261ff00199092169190911790915560408051918252517fb60bda3106a5d9df6e4586ea2337b945413f796eab0e0a7c2758baa997a461dc9181900360200190a150565b3390565b60008281526033602052604090206141aa9082614499565b1561121b576141b761418e565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260336020526040902061421390826144ae565b1561121b5761422061418e565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b600061426f306144c3565b15905090565b600054610100900460ff168061428e575061428e614264565b8061429c575060005460ff16155b6142d75760405162461bcd60e51b815260040180806020018281038252602e815260200180614b50602e913960400191505060405180910390fd5b600054610100900460ff16158015614302576000805460ff1961ff0019909116610100171660011790555b61430a6144c9565b6143126144c9565b80156111b0576000805461ff001916905550565b600054610100900460ff168061433f575061433f614264565b8061434d575060005460ff16155b6143885760405162461bcd60e51b815260040180806020018281038252602e815260200180614b50602e913960400191505060405180910390fd5b600054610100900460ff161580156143b3576000805460ff1961ff0019909116610100171660011790555b614312614569565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261441590859061460f565b50505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610c7890849061460f565b60006125f683836146c0565b60006125f6836001600160a01b038416614724565b60006125f98261473c565b60006125f6836001600160a01b038416614740565b60006125f6836001600160a01b03841661478a565b3b151590565b600054610100900460ff16806144e257506144e2614264565b806144f0575060005460ff16155b61452b5760405162461bcd60e51b815260040180806020018281038252602e815260200180614b50602e913960400191505060405180910390fd5b600054610100900460ff16158015614312576000805460ff1961ff00199091166101001716600117905580156111b0576000805461ff001916905550565b600054610100900460ff16806145825750614582614264565b80614590575060005460ff16155b6145cb5760405162461bcd60e51b815260040180806020018281038252602e815260200180614b50602e913960400191505060405180910390fd5b600054610100900460ff161580156145f6576000805460ff1961ff0019909116610100171660011790555b600160655580156111b0576000805461ff001916905550565b6000614664826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166148509092919063ffffffff16565b805190915015610c785780806020019051602081101561468357600080fd5b5051610c785760405162461bcd60e51b815260040180806020018281038252602a815260200180614bbe602a913960400191505060405180910390fd5b815460009082106147025760405162461bcd60e51b8152600401808060200182810382526022815260200180614a696022913960400191505060405180910390fd5b82600001828154811061471157fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b5490565b600061474c8383614724565b614782575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556125f9565b5060006125f9565b6000818152600183016020526040812054801561484657835460001980830191908101906000908790839081106147bd57fe5b90600052602060002001549050808760000184815481106147da57fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061480a57fe5b600190038181906000526020600020016000905590558660010160008781526020019081526020016000206000905560019450505050506125f9565b60009150506125f9565b606061485f8484600085614869565b90505b9392505050565b6060824710156148aa5760405162461bcd60e51b8152600401808060200182810382526026815260200180614afa6026913960400191505060405180910390fd5b6148b3856144c3565b614904576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106149425780518252601f199092019160209182019101614923565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146149a4576040519150601f19603f3d011682016040523d82523d6000602084013e6149a9565b606091505b50915091506149b98282866149c4565b979650505050505050565b606083156149d3575081614862565b8251156149e35782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614a2d578181015183820152602001614a15565b50505050905090810190601f168015614a5a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e745265656e7472616e637947756172643a207265656e7472616e742063616c6c00a55115a2f9ae57c699b769e23a7f54ce6ba307a078c5b5378368e3ec086b69bb416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0830d43bb366ef85d2e9345bef3138e4a552faefea6255fa2db4667fdcf34d69a55361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a2646970667358221220ffad4fecca309f8a3fe28a2955bdba7697fa0fab2d2aa1bf22675bbce438d16d64736f6c63430007060033","name":"Market","is_blueprint":false,"license_type":"none","is_fully_verified":true,"is_verified_via_eth_bytecode_db":true,"language":"solidity","evm_version":"istanbul","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":true,"additional_sources":[{"file_path":"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0;\n\nimport \"../utils/EnumerableSetUpgradeable.sol\";\nimport \"../utils/AddressUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/Initializable.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n *     require(hasRole(MY_ROLE, msg.sender));\n *     ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable {\n    function __AccessControl_init() internal initializer {\n        __Context_init_unchained();\n        __AccessControl_init_unchained();\n    }\n\n    function __AccessControl_init_unchained() internal initializer {\n    }\n    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;\n    using AddressUpgradeable for address;\n\n    struct RoleData {\n        EnumerableSetUpgradeable.AddressSet members;\n        bytes32 adminRole;\n    }\n\n    mapping (bytes32 => RoleData) private _roles;\n\n    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n    /**\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n     *\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n     * {RoleAdminChanged} not being emitted signaling this.\n     *\n     * _Available since v3.1._\n     */\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n    /**\n     * @dev Emitted when `account` is granted `role`.\n     *\n     * `sender` is the account that originated the contract call, an admin role\n     * bearer except when using {_setupRole}.\n     */\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Emitted when `account` is revoked `role`.\n     *\n     * `sender` is the account that originated the contract call:\n     *   - if using `revokeRole`, it is the admin role bearer\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\n     */\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) public view returns (bool) {\n        return _roles[role].members.contains(account);\n    }\n\n    /**\n     * @dev Returns the number of accounts that have `role`. Can be used\n     * together with {getRoleMember} to enumerate all bearers of a role.\n     */\n    function getRoleMemberCount(bytes32 role) public view returns (uint256) {\n        return _roles[role].members.length();\n    }\n\n    /**\n     * @dev Returns one of the accounts that have `role`. `index` must be a\n     * value between 0 and {getRoleMemberCount}, non-inclusive.\n     *\n     * Role bearers are not sorted in any particular way, and their ordering may\n     * change at any point.\n     *\n     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n     * you perform all queries on the same block. See the following\n     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n     * for more information.\n     */\n    function getRoleMember(bytes32 role, uint256 index) public view returns (address) {\n        return _roles[role].members.at(index);\n    }\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) public view returns (bytes32) {\n        return _roles[role].adminRole;\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function grantRole(bytes32 role, address account) public virtual {\n        require(hasRole(_roles[role].adminRole, _msgSender()), \"AccessControl: sender must be an admin to grant\");\n\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function revokeRole(bytes32 role, address account) public virtual {\n        require(hasRole(_roles[role].adminRole, _msgSender()), \"AccessControl: sender must be an admin to revoke\");\n\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `account`.\n     */\n    function renounceRole(bytes32 role, address account) public virtual {\n        require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event. Note that unlike {grantRole}, this function doesn't perform any\n     * checks on the calling account.\n     *\n     * [WARNING]\n     * ====\n     * This function should only be called from the constructor when setting\n     * up the initial roles for the system.\n     *\n     * Using this function in any other way is effectively circumventing the admin\n     * system imposed by {AccessControl}.\n     * ====\n     */\n    function _setupRole(bytes32 role, address account) internal virtual {\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Sets `adminRole` as ``role``'s admin role.\n     *\n     * Emits a {RoleAdminChanged} event.\n     */\n    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n        emit RoleAdminChanged(role, _roles[role].adminRole, adminRole);\n        _roles[role].adminRole = adminRole;\n    }\n\n    function _grantRole(bytes32 role, address account) private {\n        if (_roles[role].members.add(account)) {\n            emit RoleGranted(role, account, _msgSender());\n        }\n    }\n\n    function _revokeRole(bytes32 role, address account) private {\n        if (_roles[role].members.remove(account)) {\n            emit RoleRevoked(role, account, _msgSender());\n        }\n    }\n    uint256[49] private __gap;\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeMathUpgradeable {\n    /**\n     * @dev Returns the addition of two unsigned integers, with an overflow flag.\n     *\n     * _Available since v3.4._\n     */\n    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        uint256 c = a + b;\n        if (c < a) return (false, 0);\n        return (true, c);\n    }\n\n    /**\n     * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n     *\n     * _Available since v3.4._\n     */\n    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        if (b > a) return (false, 0);\n        return (true, a - b);\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n     *\n     * _Available since v3.4._\n     */\n    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n        // benefit is lost if 'b' is also tested.\n        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n        if (a == 0) return (true, 0);\n        uint256 c = a * b;\n        if (c / a != b) return (false, 0);\n        return (true, c);\n    }\n\n    /**\n     * @dev Returns the division of two unsigned integers, with a division by zero flag.\n     *\n     * _Available since v3.4._\n     */\n    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        if (b == 0) return (false, 0);\n        return (true, a / b);\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n     *\n     * _Available since v3.4._\n     */\n    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        if (b == 0) return (false, 0);\n        return (true, a % b);\n    }\n\n    /**\n     * @dev Returns the addition of two unsigned integers, reverting on\n     * overflow.\n     *\n     * Counterpart to Solidity's `+` operator.\n     *\n     * Requirements:\n     *\n     * - Addition cannot overflow.\n     */\n    function add(uint256 a, uint256 b) internal pure returns (uint256) {\n        uint256 c = a + b;\n        require(c >= a, \"SafeMath: addition overflow\");\n        return c;\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, reverting on\n     * overflow (when the result is negative).\n     *\n     * Counterpart to Solidity's `-` operator.\n     *\n     * Requirements:\n     *\n     * - Subtraction cannot overflow.\n     */\n    function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n        require(b <= a, \"SafeMath: subtraction overflow\");\n        return a - b;\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, reverting on\n     * overflow.\n     *\n     * Counterpart to Solidity's `*` operator.\n     *\n     * Requirements:\n     *\n     * - Multiplication cannot overflow.\n     */\n    function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n        if (a == 0) return 0;\n        uint256 c = a * b;\n        require(c / a == b, \"SafeMath: multiplication overflow\");\n        return c;\n    }\n\n    /**\n     * @dev Returns the integer division of two unsigned integers, reverting on\n     * division by zero. The result is rounded towards zero.\n     *\n     * Counterpart to Solidity's `/` operator. Note: this function uses a\n     * `revert` opcode (which leaves remaining gas untouched) while Solidity\n     * uses an invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     *\n     * - The divisor cannot be zero.\n     */\n    function div(uint256 a, uint256 b) internal pure returns (uint256) {\n        require(b > 0, \"SafeMath: division by zero\");\n        return a / b;\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n     * reverting when dividing by zero.\n     *\n     * Counterpart to Solidity's `%` operator. This function uses a `revert`\n     * opcode (which leaves remaining gas untouched) while Solidity uses an\n     * invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     *\n     * - The divisor cannot be zero.\n     */\n    function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n        require(b > 0, \"SafeMath: modulo by zero\");\n        return a % b;\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n     * overflow (when the result is negative).\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {trySub}.\n     *\n     * Counterpart to Solidity's `-` operator.\n     *\n     * Requirements:\n     *\n     * - Subtraction cannot overflow.\n     */\n    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        require(b <= a, errorMessage);\n        return a - b;\n    }\n\n    /**\n     * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n     * division by zero. The result is rounded towards zero.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryDiv}.\n     *\n     * Counterpart to Solidity's `/` operator. Note: this function uses a\n     * `revert` opcode (which leaves remaining gas untouched) while Solidity\n     * uses an invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     *\n     * - The divisor cannot be zero.\n     */\n    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        require(b > 0, errorMessage);\n        return a / b;\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n     * reverting with custom message when dividing by zero.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryMod}.\n     *\n     * Counterpart to Solidity's `%` operator. This function uses a `revert`\n     * opcode (which leaves remaining gas untouched) while Solidity uses an\n     * invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     *\n     * - The divisor cannot be zero.\n     */\n    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        require(b > 0, errorMessage);\n        return a % b;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/proxy/Initializable.sol","source_code":"// SPDX-License-Identifier: MIT\n\n// solhint-disable-next-line compiler-version\npragma solidity >=0.4.24 <0.8.0;\n\nimport \"../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n */\nabstract contract Initializable {\n\n    /**\n     * @dev Indicates that the contract has been initialized.\n     */\n    bool private _initialized;\n\n    /**\n     * @dev Indicates that the contract is in the process of being initialized.\n     */\n    bool private _initializing;\n\n    /**\n     * @dev Modifier to protect an initializer function from being invoked twice.\n     */\n    modifier initializer() {\n        require(_initializing || _isConstructor() || !_initialized, \"Initializable: contract is already initialized\");\n\n        bool isTopLevelCall = !_initializing;\n        if (isTopLevelCall) {\n            _initializing = true;\n            _initialized = true;\n        }\n\n        _;\n\n        if (isTopLevelCall) {\n            _initializing = false;\n        }\n    }\n\n    /// @dev Returns true if and only if the function is running in the constructor\n    function _isConstructor() private view returns (bool) {\n        return !AddressUpgradeable.isContract(address(this));\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `recipient`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address recipient, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `sender` to `recipient` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"../../math/SafeMathUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n    using SafeMathUpgradeable for uint256;\n    using AddressUpgradeable for address;\n\n    function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n    }\n\n    function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n    }\n\n    /**\n     * @dev Deprecated. This function has issues similar to the ones found in\n     * {IERC20-approve}, and its usage is discouraged.\n     *\n     * Whenever possible, use {safeIncreaseAllowance} and\n     * {safeDecreaseAllowance} instead.\n     */\n    function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n        // safeApprove should only be called when setting an initial allowance,\n        // or when resetting it to zero. To increase and decrease it, use\n        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n        // solhint-disable-next-line max-line-length\n        require((value == 0) || (token.allowance(address(this), spender) == 0),\n            \"SafeERC20: approve from non-zero to non-zero allowance\"\n        );\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n    }\n\n    function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n        uint256 newAllowance = token.allowance(address(this), spender).add(value);\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n    }\n\n    function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n        uint256 newAllowance = token.allowance(address(this), spender).sub(value, \"SafeERC20: decreased allowance below zero\");\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     */\n    function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n        if (returndata.length > 0) { // Return data is optional\n            // solhint-disable-next-line max-line-length\n            require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize, which returns 0 for contracts in\n        // construction, since the code is only stored at the end of the\n        // constructor execution.\n\n        uint256 size;\n        // solhint-disable-next-line no-inline-assembly\n        assembly { size := extcodesize(account) }\n        return size > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n        (bool success, ) = recipient.call{ value: amount }(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain`call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n      return functionCall(target, data, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        require(isContract(target), \"Address: call to non-contract\");\n\n        // solhint-disable-next-line avoid-low-level-calls\n        (bool success, bytes memory returndata) = target.call{ value: value }(data);\n        return _verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n        require(isContract(target), \"Address: static call to non-contract\");\n\n        // solhint-disable-next-line avoid-low-level-calls\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return _verifyCallResult(success, returndata, errorMessage);\n    }\n\n    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            // Look for revert reason and bubble it up if present\n            if (returndata.length > 0) {\n                // The easiest way to bubble the revert reason is using memory via assembly\n\n                // solhint-disable-next-line no-inline-assembly\n                assembly {\n                    let returndata_size := mload(returndata)\n                    revert(add(32, returndata), returndata_size)\n                }\n            } else {\n                revert(errorMessage);\n            }\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\nimport \"../proxy/Initializable.sol\";\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with GSN meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n    function __Context_init() internal initializer {\n        __Context_init_unchained();\n    }\n\n    function __Context_init_unchained() internal initializer {\n    }\n    function _msgSender() internal view virtual returns (address payable) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes memory) {\n        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n        return msg.data;\n    }\n    uint256[50] private __gap;\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n *     // Add the library methods\n *     using EnumerableSet for EnumerableSet.AddressSet;\n *\n *     // Declare a set state variable\n *     EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSetUpgradeable {\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Set type with\n    // bytes32 values.\n    // The Set implementation uses private functions, and user-facing\n    // implementations (such as AddressSet) are just wrappers around the\n    // underlying Set.\n    // This means that we can only create new EnumerableSets for types that fit\n    // in bytes32.\n\n    struct Set {\n        // Storage of set values\n        bytes32[] _values;\n\n        // Position of the value in the `values` array, plus 1 because index 0\n        // means a value is not in the set.\n        mapping (bytes32 => uint256) _indexes;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function _add(Set storage set, bytes32 value) private returns (bool) {\n        if (!_contains(set, value)) {\n            set._values.push(value);\n            // The value is stored at length-1, but we add 1 to all indexes\n            // and use 0 as a sentinel value\n            set._indexes[value] = set._values.length;\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function _remove(Set storage set, bytes32 value) private returns (bool) {\n        // We read and store the value's index to prevent multiple reads from the same storage slot\n        uint256 valueIndex = set._indexes[value];\n\n        if (valueIndex != 0) { // Equivalent to contains(set, value)\n            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n            // the array, and then remove the last element (sometimes called as 'swap and pop').\n            // This modifies the order of the array, as noted in {at}.\n\n            uint256 toDeleteIndex = valueIndex - 1;\n            uint256 lastIndex = set._values.length - 1;\n\n            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs\n            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.\n\n            bytes32 lastvalue = set._values[lastIndex];\n\n            // Move the last value to the index where the value to delete is\n            set._values[toDeleteIndex] = lastvalue;\n            // Update the index for the moved value\n            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based\n\n            // Delete the slot where the moved value was stored\n            set._values.pop();\n\n            // Delete the index for the deleted slot\n            delete set._indexes[value];\n\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function _contains(Set storage set, bytes32 value) private view returns (bool) {\n        return set._indexes[value] != 0;\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function _length(Set storage set) private view returns (uint256) {\n        return set._values.length;\n    }\n\n   /**\n    * @dev Returns the value stored at position `index` in the set. O(1).\n    *\n    * Note that there are no guarantees on the ordering of values inside the\n    * array, and it may change when more values are added or removed.\n    *\n    * Requirements:\n    *\n    * - `index` must be strictly less than {length}.\n    */\n    function _at(Set storage set, uint256 index) private view returns (bytes32) {\n        require(set._values.length > index, \"EnumerableSet: index out of bounds\");\n        return set._values[index];\n    }\n\n    // Bytes32Set\n\n    struct Bytes32Set {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _add(set._inner, value);\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _remove(set._inner, value);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n        return _contains(set._inner, value);\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(Bytes32Set storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n   /**\n    * @dev Returns the value stored at position `index` in the set. O(1).\n    *\n    * Note that there are no guarantees on the ordering of values inside the\n    * array, and it may change when more values are added or removed.\n    *\n    * Requirements:\n    *\n    * - `index` must be strictly less than {length}.\n    */\n    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n        return _at(set._inner, index);\n    }\n\n    // AddressSet\n\n    struct AddressSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(AddressSet storage set, address value) internal returns (bool) {\n        return _add(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(AddressSet storage set, address value) internal returns (bool) {\n        return _remove(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(AddressSet storage set, address value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(AddressSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n   /**\n    * @dev Returns the value stored at position `index` in the set. O(1).\n    *\n    * Note that there are no guarantees on the ordering of values inside the\n    * array, and it may change when more values are added or removed.\n    *\n    * Requirements:\n    *\n    * - `index` must be strictly less than {length}.\n    */\n    function at(AddressSet storage set, uint256 index) internal view returns (address) {\n        return address(uint160(uint256(_at(set._inner, index))));\n    }\n\n\n    // UintSet\n\n    struct UintSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(UintSet storage set, uint256 value) internal returns (bool) {\n        return _add(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(UintSet storage set, uint256 value) internal returns (bool) {\n        return _remove(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function length(UintSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n   /**\n    * @dev Returns the value stored at position `index` in the set. O(1).\n    *\n    * Note that there are no guarantees on the ordering of values inside the\n    * array, and it may change when more values are added or removed.\n    *\n    * Requirements:\n    *\n    * - `index` must be strictly less than {length}.\n    */\n    function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n        return uint256(_at(set._inner, index));\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0;\nimport \"../proxy/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    uint256 private _status;\n\n    function __ReentrancyGuard_init() internal initializer {\n        __ReentrancyGuard_init_unchained();\n    }\n\n    function __ReentrancyGuard_init_unchained() internal initializer {\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and make it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        // On the first call to nonReentrant, _notEntered will be true\n        require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        _status = _ENTERED;\n\n        _;\n\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = _NOT_ENTERED;\n    }\n    uint256[49] private __gap;\n}\n"},{"file_path":"contracts/interfaces/f(x)/IFxMarket.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxMarket {\n  /**********\n   * Events *\n   **********/\n\n  /// @notice Emitted when fToken or xToken is minted.\n  /// @param owner The address of base token owner.\n  /// @param recipient The address of receiver for fToken or xToken.\n  /// @param baseTokenIn The amount of base token deposited.\n  /// @param fTokenOut The amount of fToken minted.\n  /// @param xTokenOut The amount of xToken minted.\n  /// @param mintFee The amount of mint fee charged.\n  event Mint(\n    address indexed owner,\n    address indexed recipient,\n    uint256 baseTokenIn,\n    uint256 fTokenOut,\n    uint256 xTokenOut,\n    uint256 mintFee\n  );\n\n  /// @notice Emitted when someone redeem base token with fToken or xToken.\n  /// @param owner The address of fToken and xToken owner.\n  /// @param recipient The address of receiver for base token.\n  /// @param fTokenBurned The amount of fToken burned.\n  /// @param xTokenBurned The amount of xToken burned.\n  /// @param baseTokenOut The amount of base token redeemed.\n  /// @param redeemFee The amount of redeem fee charged.\n  event Redeem(\n    address indexed owner,\n    address indexed recipient,\n    uint256 fTokenBurned,\n    uint256 xTokenBurned,\n    uint256 baseTokenOut,\n    uint256 redeemFee\n  );\n\n  /// @notice Emitted when someone add more base token.\n  /// @param owner The address of base token owner.\n  /// @param recipient The address of receiver for fToken or xToken.\n  /// @param baseTokenIn The amount of base token deposited.\n  /// @param xTokenMinted The amount of xToken minted.\n  event AddCollateral(address indexed owner, address indexed recipient, uint256 baseTokenIn, uint256 xTokenMinted);\n\n  /// @notice Emitted when someone liquidate with fToken.\n  /// @param owner The address of fToken and xToken owner.\n  /// @param recipient The address of receiver for base token.\n  /// @param fTokenBurned The amount of fToken burned.\n  /// @param baseTokenOut The amount of base token redeemed.\n  event UserLiquidate(address indexed owner, address indexed recipient, uint256 fTokenBurned, uint256 baseTokenOut);\n\n  /// @notice Emitted when self liquidate with fToken.\n  /// @param caller The address of caller.\n  /// @param baseSwapAmt The amount of base token used to swap.\n  /// @param baseTokenOut The amount of base token redeemed.\n  /// @param fTokenBurned The amount of fToken liquidated.\n  event SelfLiquidate(address indexed caller, uint256 baseSwapAmt, uint256 baseTokenOut, uint256 fTokenBurned);\n\n  /// @notice Emitted when someone donates base token to the treasury.\n  /// @param owner The address of base token owner.\n  /// @param baseTokenIn The amount of base token donated.\n  event DonateBaseToken(address indexed owner, uint256 baseTokenIn);\n\n  /****************************\n   * Public Mutated Functions *\n   ****************************/\n\n  /// @notice Mint both fToken and xToken with some base token.\n  /// @param baseIn The amount of base token supplied.\n  /// @param recipient The address of receiver for fToken and xToken.\n  /// @param minFTokenMinted The minimum amount of fToken should be received.\n  /// @param minXTokenMinted The minimum amount of xToken should be received.\n  /// @return fTokenMinted The amount of fToken should be received.\n  /// @return xTokenMinted The amount of xToken should be received.\n  function mint(\n    uint256 baseIn,\n    address recipient,\n    uint256 minFTokenMinted,\n    uint256 minXTokenMinted\n  ) external returns (uint256 fTokenMinted, uint256 xTokenMinted);\n\n  /// @notice Mint some fToken with some base token.\n  /// @param baseIn The amount of base token supplied, use `uint256(-1)` to supply all base token.\n  /// @param recipient The address of receiver for fToken.\n  /// @param minFTokenMinted The minimum amount of fToken should be received.\n  /// @return fTokenMinted The amount of fToken should be received.\n  function mintFToken(\n    uint256 baseIn,\n    address recipient,\n    uint256 minFTokenMinted\n  ) external returns (uint256 fTokenMinted);\n\n  /// @notice Mint fToken without adding base token by targeting a collateral ratio.\n  /// @param targetCollateralRatio The desired collateral ratio, multipled by 1e18.\n  /// @param recipient The address of receiver for fToken.\n  /// @param minFTokenMinted The minimum amount of fToken should be received.\n  /// @return fTokenMinted The amount of fToken should be received.\n  function mintFTokenWithoutBaseToken(\n    uint256 targetCollateralRatio,\n    address recipient,\n    uint256 minFTokenMinted\n  ) external returns (uint256 fTokenMinted);\n\n  /// @notice Mint some xToken with some base token.\n  /// @param baseIn The amount of base token supplied, use `uint256(-1)` to supply all base token.\n  /// @param recipient The address of receiver for xToken.\n  /// @param minXTokenMinted The minimum amount of xToken should be received.\n  /// @return xTokenMinted The amount of xToken should be received.\n  /// @return bonus The amount of base token as bonus.\n  function mintXToken(\n    uint256 baseIn,\n    address recipient,\n    uint256 minXTokenMinted\n  ) external returns (uint256 xTokenMinted, uint256 bonus);\n\n  /// @notice Mint some xToken by add some base token as collateral.\n  /// @param baseIn The amount of base token supplied, use `uint256(-1)` to supply all base token.\n  /// @param recipient The address of receiver for xToken.\n  /// @param minXTokenMinted The minimum amount of xToken should be received.\n  /// @return xTokenMinted The amount of xToken should be received.\n  function addBaseToken(\n    uint256 baseIn,\n    address recipient,\n    uint256 minXTokenMinted\n  ) external returns (uint256 xTokenMinted);\n\n  /// @notice Redeem base token with fToken and xToken.\n  /// @param fTokenIn the amount of fToken to redeem, use `uint256(-1)` to redeem all fToken.\n  /// @param xTokenIn the amount of xToken to redeem, use `uint256(-1)` to redeem all xToken.\n  /// @param recipient The address of receiver for base token.\n  /// @param minBaseOut The minimum amount of base token should be received.\n  /// @return baseOut The amount of base token should be received.\n  /// @return bonus The amount of base token as bonus.\n  function redeem(\n    uint256 fTokenIn,\n    uint256 xTokenIn,\n    address recipient,\n    uint256 minBaseOut\n  ) external returns (uint256 baseOut, uint256 bonus);\n\n  /// @notice Donate base token to the treasury.\n  /// @param baseIn The amount of base token to donate.\n  function donateBaseToken(uint256 baseIn) external;\n\n}\n"},{"file_path":"contracts/interfaces/f(x)/IFxReservePool.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxReservePool {\n  /// @notice Request bonus token from Reserve Pool.\n  /// @param token The address of token to request.\n  /// @param receiver The address recipient for the bonus token.\n  /// @param originalAmount The original amount of token used.\n  /// @param bonus The amount of bonus token received.\n  function requestBonus(\n    address token,\n    address receiver,\n    uint256 originalAmount\n  ) external returns (uint256 bonus);\n}\n"},{"file_path":"contracts/interfaces/f(x)/IFxTreasury.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxTreasury {\n  /**********\n   * Events *\n   **********/\n\n  /// @notice Emitted when the net asset value is updated.\n  /// @param price The new price of base token.\n  /// @param fNav The new net asset value of fToken.\n  event ProtocolSettle(uint256 price, uint256 fNav);\n\n  /*********\n   * Enums *\n   *********/\n\n  enum MintOption {\n    Both,\n    FToken,\n    XToken\n  }\n\n  /*************************\n   * Public View Functions *\n   *************************/\n\n  /// @notice Return the address of base token.\n  function baseToken() external view returns (address);\n\n  /// @notice Return the address fractional base token.\n  function fToken() external view returns (address);\n\n  /// @notice Return the address leveraged base token.\n  function xToken() external view returns (address);\n\n  /// @notice Return the address of strategy contract.\n  function strategy() external view returns (address);\n\n  /// @notice The last updated permissioned base token price.\n  function lastPermissionedPrice() external view returns (uint256);\n\n  /// @notice Return the total amount of base token deposited.\n  function totalBaseToken() external view returns (uint256);\n\n  /// @notice Return the total amount of base token managed by strategy.\n  function strategyUnderlying() external view returns (uint256);\n\n  /// @notice Return the current collateral ratio of fToken, multipled by 1e18.\n  function collateralRatio() external view returns (uint256);\n\n  /// @notice Convert unwrapped token amount to wrapped token amount.\n  /// @param amount The unwrapped token amount.\n  function convertToWrapped(uint256 amount) external view returns (uint256);\n\n  /// @notice Convert wrapped token amount to unwrapped token amount.\n  /// @param amount The wrapped token amount.\n  function convertToUnwrapped(uint256 amount) external view returns (uint256);\n\n  /// @notice Return current nav for base token, fToken and xToken.\n  /// @return baseNav The nav for base token.\n  /// @return fNav The nav for fToken.\n  /// @return xNav The nav for xToken.\n  function getCurrentNav()\n    external\n    view\n    returns (\n      uint256 baseNav,\n      uint256 fNav,\n      uint256 xNav\n    );\n\n  /// @notice Compute the amount of base token needed to reach the new collateral ratio.\n  /// @param newCollateralRatio The target collateral ratio, multipled by 1e18.\n  /// @return maxBaseIn The amount of base token needed.\n  /// @return maxFTokenMintable The amount of fToken can be minted.\n  function maxMintableFToken(uint256 newCollateralRatio)\n    external\n    view\n    returns (uint256 maxBaseIn, uint256 maxFTokenMintable);\n\n  /// @notice Compute the amount of fToken can be minted without adding base to reach the new collateral ratio.\n  /// @param newCollateralRatio The target collateral ratio, multipled by 1e18.\n  /// @return maxFTokenMintable The amount of fToken can be minted without adding base.\n  function maxMintableFTokenWithoutBaseToken(uint256 newCollateralRatio)\n    external\n    view\n    returns (uint256 maxFTokenMintable);\n\n  /// @notice Compute the amount of base token needed to reach the new collateral ratio.\n  /// @param newCollateralRatio The target collateral ratio, multipled by 1e18.\n  /// @return maxBaseIn The amount of base token needed.\n  /// @return maxXTokenMintable The amount of xToken can be minted.\n  function maxMintableXToken(uint256 newCollateralRatio)\n    external\n    view\n    returns (uint256 maxBaseIn, uint256 maxXTokenMintable);\n\n  /// @notice Compute the amount of base token needed to reach the new collateral ratio, with incentive.\n  /// @param newCollateralRatio The target collateral ratio, multipled by 1e18.\n  /// @param incentiveRatio The extra incentive ratio, multipled by 1e18.\n  /// @return maxBaseIn The amount of base token needed.\n  /// @return maxXTokenMintable The amount of xToken can be minted.\n  function maxMintableXTokenWithIncentive(uint256 newCollateralRatio, uint256 incentiveRatio)\n    external\n    view\n    returns (uint256 maxBaseIn, uint256 maxXTokenMintable);\n\n  /// @notice Compute the amount of fToken needed to reach the new collateral ratio.\n  /// @param newCollateralRatio The target collateral ratio, multipled by 1e18.\n  /// @return maxBaseOut The amount of base token redeemed.\n  /// @return maxFTokenRedeemable The amount of fToken needed.\n  function maxRedeemableFToken(uint256 newCollateralRatio)\n    external\n    view\n    returns (uint256 maxBaseOut, uint256 maxFTokenRedeemable);\n\n  /// @notice Compute the amount of xToken needed to reach the new collateral ratio.\n  /// @param newCollateralRatio The target collateral ratio, multipled by 1e18.\n  /// @return maxBaseOut The amount of base token redeemed.\n  /// @return maxXTokenRedeemable The amount of xToken needed.\n  function maxRedeemableXToken(uint256 newCollateralRatio)\n    external\n    view\n    returns (uint256 maxBaseOut, uint256 maxXTokenRedeemable);\n\n  /// @notice Return the maximum amount of base token that can be donated to reach the new collateral ratio.\n  /// @param newCollateralRatio The target collateral ratio, multipled by 1e18.\n  /// @return maxBaseIn The amount of base token needed.\n  function maxBaseForCollateralRatio(uint256 newCollateralRatio) external view returns (uint256 maxBaseIn);\n\n  /// @notice Compute the maximum amount of fToken can be liquidated.\n  /// @param newCollateralRatio The target collateral ratio, multipled by 1e18.\n  /// @param incentiveRatio The extra incentive ratio, multipled by 1e18.\n  /// @return maxBaseOut The maximum amount of base token can liquidate, without incentive.\n  /// @return maxFTokenLiquidatable The maximum amount of fToken can be liquidated.\n  function maxLiquidatable(uint256 newCollateralRatio, uint256 incentiveRatio)\n    external\n    view\n    returns (uint256 maxBaseOut, uint256 maxFTokenLiquidatable);\n\n  /// @notice Return the exponential moving average of the leverage ratio.\n  function leverageRatio() external view returns (uint256);\n\n  /****************************\n   * Public Mutated Functions *\n   ****************************/\n\n  /// @notice Mint fToken and xToken with some base token.\n  /// @param baseIn The amount of base token deposited.\n  /// @param recipient The address of receiver.\n  /// @param option The mint option, xToken or fToken or both.\n  /// @return fTokenOut The amount of fToken minted.\n  /// @return xTokenOut The amount of xToken minted.\n  function mint(\n    uint256 baseIn,\n    address recipient,\n    MintOption option\n  ) external returns (uint256 fTokenOut, uint256 xTokenOut);\n\n  /// @notice Redeem fToken and xToken to base tokne.\n  /// @param fTokenIn The amount of fToken to redeem.\n  /// @param xTokenIn The amount of xToken to redeem.\n  /// @param owner The owner of the fToken or xToken.\n  /// @param baseOut The amount of base token redeemed.\n  function redeem(\n    uint256 fTokenIn,\n    uint256 xTokenIn,\n    address owner\n  ) external returns (uint256 baseOut);\n\n  /// @notice Add some base token to mint xToken with incentive.\n  /// @param baseIn The amount of base token deposited.\n  /// @param incentiveRatio The incentive ratio.\n  /// @param recipient The address of receiver.\n  /// @return xTokenOut The amount of xToken minted.\n  function addBaseToken(\n    uint256 baseIn,\n    uint256 incentiveRatio,\n    address recipient\n  ) external returns (uint256 xTokenOut);\n\n  /// @notice Donate base token to the treasury.\n  /// @param baseIn The amount of base token to donate.\n  function donateBaseToken(uint256 baseIn) external;\n\n  /// @notice Mint fToken without adding base token by targeting a collateral ratio.\n  /// @param newCollateralRatio The target collateral ratio, multipled by 1e18.\n  /// @param recipient The address of receiver.\n  /// @return fTokenOut The amount of fToken minted.\n  function mintFTokenWithoutBaseToken(uint256 newCollateralRatio, address recipient)\n    external\n    returns (uint256 fTokenOut);\n\n  /// @notice Liquidate fToken to base token with incentive.\n  /// @param fTokenIn The amount of fToken to liquidate.\n  /// @param incentiveRatio The incentive ratio.\n  /// @param owner The owner of the fToken.\n  /// @param baseOut The amount of base token liquidated.\n  function liquidate(\n    uint256 fTokenIn,\n    uint256 incentiveRatio,\n    address owner\n  ) external returns (uint256 baseOut);\n\n  /// @notice Settle the nav of base token, fToken and xToken.\n  function protocolSettle() external;\n\n  /// @notice Transfer some base token to strategy contract.\n  /// @param amount The amount of token to transfer.\n  function transferToStrategy(uint256 amount) external;\n\n  /// @notice Notify base token profit from strategy contract.\n  /// @param amount The amount of base token.\n  function notifyStrategyProfit(uint256 amount) external;\n\n  /// @notice Return the current price of base token.\n  function currentBaseTokenPrice() external view returns (uint256);\n}\n"}],"certified":false,"conflicting_implementations":null,"abi":[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"baseTokenIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"xTokenMinted","type":"uint256"}],"name":"AddCollateral","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"baseTokenIn","type":"uint256"}],"name":"DonateBaseToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"baseTokenIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fTokenOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"xTokenOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintFee","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"PauseFTokenMintInSystemStabilityMode","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"PauseMint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"PauseMintBothInSystemStabilityMode","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"PauseRedeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"PauseXTokenRedeemInSystemStabilityMode","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"fTokenBurned","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"xTokenBurned","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"baseTokenOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"redeemFee","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"baseSwapAmt","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"baseTokenOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fTokenBurned","type":"uint256"}],"name":"SelfLiquidate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"stabilityIncentiveRatio","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"liquidationIncentiveRatio","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"selfLiquidationIncentiveRatio","type":"uint64"}],"name":"UpdateIncentiveConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"UpdateLiquidationWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"stabilityRatio","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"liquidationRatio","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"selfLiquidationRatio","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"recapRatio","type":"uint64"}],"name":"UpdateMarketConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint128","name":"defaultFeeRatio","type":"uint128"},{"indexed":false,"internalType":"int128","name":"extraFeeRatio","type":"int128"}],"name":"UpdateMintFeeRatioFToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint128","name":"defaultFeeRatio","type":"uint128"},{"indexed":false,"internalType":"int128","name":"extraFeeRatio","type":"int128"}],"name":"UpdateMintFeeRatioXToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"platform","type":"address"}],"name":"UpdatePlatform","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"registry","type":"address"}],"name":"UpdateRebalancePoolRegistry","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint128","name":"defaultFeeRatio","type":"uint128"},{"indexed":false,"internalType":"int128","name":"extraFeeRatio","type":"int128"}],"name":"UpdateRedeemFeeRatioFToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint128","name":"defaultFeeRatio","type":"uint128"},{"indexed":false,"internalType":"int128","name":"extraFeeRatio","type":"int128"}],"name":"UpdateRedeemFeeRatioXToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"reservePool","type":"address"}],"name":"UpdateReservePool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"fTokenBurned","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"baseTokenOut","type":"uint256"}],"name":"UserLiquidate","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EMERGENCY_DAO_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_baseIn","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_minXTokenMinted","type":"uint256"}],"name":"addBaseToken","outputs":[{"internalType":"uint256","name":"_xTokenMinted","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"baseToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_baseIn","type":"uint256"}],"name":"donateBaseToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fTokenMintFeeRatio","outputs":[{"internalType":"uint128","name":"defaultFeeRatio","type":"uint128"},{"internalType":"int128","name":"extraFeeRatio","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fTokenMintInSystemStabilityModePaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fTokenRedeemFeeRatio","outputs":[{"internalType":"uint128","name":"defaultFeeRatio","type":"uint128"},{"internalType":"int128","name":"extraFeeRatio","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_manager","type":"address"}],"name":"grantManagerRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"incentiveConfig","outputs":[{"internalType":"uint64","name":"stabilityIncentiveRatio","type":"uint64"},{"internalType":"uint64","name":"liquidationIncentiveRatio","type":"uint64"},{"internalType":"uint64","name":"selfLiquidationIncentiveRatio","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_platform","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"liquidationWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketConfig","outputs":[{"internalType":"uint64","name":"stabilityRatio","type":"uint64"},{"internalType":"uint64","name":"liquidationRatio","type":"uint64"},{"internalType":"uint64","name":"selfLiquidationRatio","type":"uint64"},{"internalType":"uint64","name":"recapRatio","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_baseIn","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_minFTokenMinted","type":"uint256"},{"internalType":"uint256","name":"_minXTokenMinted","type":"uint256"}],"name":"mint","outputs":[{"internalType":"uint256","name":"_fTokenMinted","type":"uint256"},{"internalType":"uint256","name":"_xTokenMinted","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintBothInSystemStabilityModePaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_baseIn","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_minFTokenMinted","type":"uint256"}],"name":"mintFToken","outputs":[{"internalType":"uint256","name":"_fTokenMinted","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_targetCollateralRatio","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_minFTokenMinted","type":"uint256"}],"name":"mintFTokenWithoutBaseToken","outputs":[{"internalType":"uint256","name":"_fTokenMinted","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_baseIn","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_minXTokenMinted","type":"uint256"}],"name":"mintXToken","outputs":[{"internalType":"uint256","name":"_xTokenMinted","type":"uint256"},{"internalType":"uint256","name":"_bonus","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"pauseFTokenMintInSystemStabilityMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"pauseMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"pauseMintBothInSystemStabilityMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"pauseRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"pauseXTokenRedeemInSystemStabilityMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"platform","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fTokenIn","type":"uint256"},{"internalType":"uint256","name":"_xTokenIn","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_minBaseOut","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"_baseOut","type":"uint256"},{"internalType":"uint256","name":"_bonus","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"redeemPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reservePool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_manager","type":"address"}],"name":"revokeManagerRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_stabilityIncentiveRatio","type":"uint64"},{"internalType":"uint64","name":"_liquidationIncentiveRatio","type":"uint64"},{"internalType":"uint64","name":"_selfLiquidationIncentiveRatio","type":"uint64"}],"name":"updateIncentiveConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"updateLiquidationWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_stabilityRatio","type":"uint64"},{"internalType":"uint64","name":"_liquidationRatio","type":"uint64"},{"internalType":"uint64","name":"_selfLiquidationRatio","type":"uint64"},{"internalType":"uint64","name":"_recapRatio","type":"uint64"}],"name":"updateMarketConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"_defaultFeeRatio","type":"uint128"},{"internalType":"int128","name":"_extraFeeRatio","type":"int128"},{"internalType":"bool","name":"_isFToken","type":"bool"}],"name":"updateMintFeeRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_platform","type":"address"}],"name":"updatePlatform","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_registry","type":"address"}],"name":"updateRebalancePoolRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"_defaultFeeRatio","type":"uint128"},{"internalType":"int128","name":"_extraFeeRatio","type":"int128"},{"internalType":"bool","name":"_isFToken","type":"bool"}],"name":"updateRedeemFeeRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_reservePool","type":"address"}],"name":"updateReservePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"xToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xTokenMintFeeRatio","outputs":[{"internalType":"uint128","name":"defaultFeeRatio","type":"uint128"},{"internalType":"int128","name":"extraFeeRatio","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xTokenRedeemFeeRatio","outputs":[{"internalType":"uint128","name":"defaultFeeRatio","type":"uint128"},{"internalType":"int128","name":"extraFeeRatio","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xTokenRedeemInSystemStabilityModePaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}],"is_changed_bytecode":false,"is_partially_verified":false,"constructor_args":null}