creation_sourcecode: {{
    "language": "Solidity",
    "settings": {
      "evmVersion": "london",
      "libraries": {},
      "metadata": {
        "bytecodeHash": "ipfs",
        "useLiteralContent": true
      },
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "remappings": [],
      "viaIR": true,
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      }
    },
    "sources": {
      "@openzeppelin/contracts-upgradeable/interfaces/IERC4626Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20Upgradeable.sol\";\nimport \"../token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626Upgradeable is IERC20Upgradeable, IERC20MetadataUpgradeable {\n    event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\n\n    event Withdraw(\n        address indexed sender,\n        address indexed receiver,\n        address indexed owner,\n        uint256 assets,\n        uint256 shares\n    );\n\n    /**\n     * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n     *\n     * - MUST be an ERC-20 token contract.\n     * - MUST NOT revert.\n     */\n    function asset() external view returns (address assetTokenAddress);\n\n    /**\n     * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n     *\n     * - SHOULD include any compounding that occurs from yield.\n     * - MUST be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT revert.\n     */\n    function totalAssets() external view returns (uint256 totalManagedAssets);\n\n    /**\n     * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n     * scenario where all the conditions are met.\n     *\n     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT show any variations depending on the caller.\n     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n     * - MUST NOT revert.\n     *\n     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n     * from.\n     */\n    function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n     * scenario where all the conditions are met.\n     *\n     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT show any variations depending on the caller.\n     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n     * - MUST NOT revert.\n     *\n     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n     * from.\n     */\n    function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n     * through a deposit call.\n     *\n     * - MUST return a limited value if receiver is subject to some deposit limit.\n     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n     * - MUST NOT revert.\n     */\n    function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n     * current on-chain conditions.\n     *\n     * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n     *   call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n     *   in the same transaction.\n     * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n     *   deposit would be accepted, regardless if the user has enough tokens approved, etc.\n     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n     */\n    function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n     *\n     * - MUST emit the Deposit event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   deposit execution, and are accounted for during deposit.\n     * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n     *   approving enough underlying tokens to the Vault contract, etc).\n     *\n     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n     */\n    function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n    /**\n     * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n     * - MUST return a limited value if receiver is subject to some mint limit.\n     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n     * - MUST NOT revert.\n     */\n    function maxMint(address receiver) external view returns (uint256 maxShares);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n     * current on-chain conditions.\n     *\n     * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n     *   in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n     *   same transaction.\n     * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n     *   would be accepted, regardless if the user has enough tokens approved, etc.\n     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by minting.\n     */\n    function previewMint(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n     *\n     * - MUST emit the Deposit event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n     *   execution, and are accounted for during mint.\n     * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n     *   approving enough underlying tokens to the Vault contract, etc).\n     *\n     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n     */\n    function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n    /**\n     * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n     * Vault, through a withdraw call.\n     *\n     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n     * - MUST NOT revert.\n     */\n    function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n     * given current on-chain conditions.\n     *\n     * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n     *   call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n     *   called\n     *   in the same transaction.\n     * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n     *   the withdrawal would be accepted, regardless if the user has enough shares, etc.\n     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n     */\n    function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n     *\n     * - MUST emit the Withdraw event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   withdraw execution, and are accounted for during withdraw.\n     * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n     *   not having enough shares, etc).\n     *\n     * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n     * Those methods should be performed separately.\n     */\n    function withdraw(\n        uint256 assets,\n        address receiver,\n        address owner\n    ) external returns (uint256 shares);\n\n    /**\n     * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n     * through a redeem call.\n     *\n     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n     * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n     * - MUST NOT revert.\n     */\n    function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n     * given current on-chain conditions.\n     *\n     * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n     *   in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n     *   same transaction.\n     * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n     *   redemption would be accepted, regardless if the user has enough shares, etc.\n     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n     */\n    function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n     *\n     * - MUST emit the Withdraw event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   redeem execution, and are accounted for during redeem.\n     * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n     *   not having enough shares, etc).\n     *\n     * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n     * Those methods should be performed separately.\n     */\n    function redeem(\n        uint256 shares,\n        address receiver,\n        address owner\n    ) external returns (uint256 assets);\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\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    /**\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 `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, 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 `from` to `to` 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(\n        address from,\n        address to,\n        uint256 amount\n    ) external returns (bool);\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"
      },
      "@openzeppelin/contracts/access/Ownable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    constructor() {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions anymore. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby removing any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\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    /**\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 `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, 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 `from` to `to` 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(\n        address from,\n        address to,\n        uint256 amount\n    ) external returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\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 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 Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n"
      },
      "contracts/HATGovernanceArbitrator.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// Disclaimer https://github.com/hats-finance/hats-contracts/blob/main/DISCLAIMER.md\n\npragma solidity 0.8.16;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./interfaces/IHATClaimsManager.sol\";\n\ncontract HATGovernanceArbitrator is Ownable {\n\n    function approveClaim(IHATClaimsManager _vault, bytes32 _claimId) external onlyOwner {\n        _vault.challengeClaim(_claimId);\n        _vault.approveClaim(_claimId, 0, address(0));\n    }\n\n    function dismissClaim(IHATClaimsManager _vault, bytes32 _claimId) external onlyOwner {\n        _vault.challengeClaim(_claimId);\n        _vault.dismissClaim(_claimId);\n    }\n\n}\n"
      },
      "contracts/interfaces/IHATClaimsManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// Disclaimer https://github.com/hats-finance/hats-contracts/blob/main/DISCLAIMER.md\n\npragma solidity 0.8.16;\n\nimport \"@openzeppelin/contracts-upgradeable/interfaces/IERC4626Upgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./IRewardController.sol\";\nimport \"./IHATVault.sol\";\nimport \"./IHATVaultsRegistry.sol\";\n\n/** @title Interface for Hats.finance Vaults\n * @author Hats.finance\n * @notice A HATVault holds the funds for a specific project's bug bounties.\n * Anyone can permissionlessly deposit into the HATVault using\n * the vault’s native token. When a bug is submitted and approved, the bounty \n * is paid out using the funds in the vault. Bounties are paid out as a\n * percentage of the vault. The percentage is set according to the severity of\n * the bug. Vaults have regular safety periods (typically for an hour twice a\n * day) which are time for the committee to make decisions.\n *\n * In addition to the roles defined in the IHATVaultsRegistry, every HATVault \n * has the roles:\n * Committee - The only address which can submit a claim for a bounty payout\n * and set the maximum bounty.\n * User - Anyone can deposit the vault's native token into the vault and \n * recieve shares for it. Shares represent the user's relative part in the\n * vault, and when a bounty is paid out, users lose part of their deposits\n * (based on percentage paid), but keep their share of the vault.\n * Users also receive rewards for their deposits, which can be claimed at any\n *  time.\n * To withdraw previously deposited tokens, a user must first send a withdraw\n * request, and the withdrawal will be made available after a pending period.\n * Withdrawals are not permitted during safety periods or while there is an \n * active claim for a bounty payout.\n *\n * Bounties are payed out distributed between a few channels, and that \n * distribution is set upon creation (the hacker gets part in direct transfer,\n * part in vested reward and part in vested HAT token, part gets rewarded to\n * the committee, part gets swapped to HAT token and burned and/or sent to Hats\n * governance).\n *\n * NOTE: Vaults should not use tokens which do not guarantee that the amount\n * specified is the amount transferred\n *\n * This project is open-source and can be found at:\n * https://github.com/hats-finance/hats-contracts\n */\ninterface IHATClaimsManager {\n\n    // How to divide the bounty - after deducting the part that is swapped to\n    // HAT tokens (and then sent to governance and vested to the hacker)\n    // values are in percentages and should add up to 100% (defined as 10000)\n    struct BountySplit {\n        // the percentage of reward sent to the hacker via vesting contract\n        uint16 hackerVested;\n        // the percentage of tokens that are sent directly to the hacker\n        uint16 hacker;\n        // the percentage sent to the committee\n        uint16 committee;\n    }\n\n    // How to divide a bounty for a claim that has been approved\n    // used to keep track of payouts, amounts are in vault's native token\n    struct ClaimBounty {\n        uint256 hacker;\n        uint256 hackerVested;\n        uint256 committee;\n        uint256 hackerHatVested;\n        uint256 governanceHat;\n    }\n\n    struct Claim {\n        bytes32 claimId;\n        address beneficiary;\n        uint16 bountyPercentage;\n        // the address of the committee at the time of the submission, so that this committee will\n        // be paid their share of the bounty in case the committee changes before claim approval\n        address committee;\n        uint32 createdAt;\n        uint32 challengedAt;\n        uint256 bountyGovernanceHAT;\n        uint256 bountyHackerHATVested;\n        address arbitrator;\n        uint32 challengePeriod;\n        uint32 challengeTimeOutPeriod;\n        bool arbitratorCanChangeBounty;\n        bool arbitratorCanChangeBeneficiary;\n    }\n\n    struct PendingMaxBounty {\n        uint16 maxBounty;\n        uint32 timestamp;\n    }\n\n    /**\n    * @notice Initialization parameters for the vault\n    * @param name The vault's name (concatenated as \"Hats Vault \" + name)\n    * @param symbol The vault's symbol (concatenated as \"HAT\" + symbol)\n    * @param rewardController The reward controller for the vault\n    * @param vestingDuration Duration of the vesting period of the vault's\n    * token vested part of the bounty\n    * @param vestingPeriods The number of vesting periods of the vault's token\n    * vested part of the bounty\n    * @param maxBounty The maximum percentage of the vault that can be paid\n    * out as a bounty\n    * @param bountySplit The way to split the bounty between the hacker, \n    * hacker vested, and committee.\n    *   Each entry is a number between 0 and `HUNDRED_PERCENT`.\n    *   Total splits should be equal to `HUNDRED_PERCENT`.\n    * @param bountyGovernanceHAT The HAT bounty for governance\n    * @param bountyHackerHATVested The HAT bounty vested for the hacker\n    * @param asset The vault's native token\n    * @param owner The address of the vault's owner \n    * @param committee The address of the vault's committee \n    * @param arbitrator The address of the vault's arbitrator\n    * @param arbitratorCanChangeBounty Can the arbitrator change a claim's bounty\n    * @param arbitratorCanChangeBeneficiary Can the arbitrator change a claim's beneficiary\n    * @param arbitratorCanSubmitClaims Can the arbitrator submit a claim\n    * @param isTokenLockRevocable can the committee revoke the token lock\n    * @dev Needed to avoid a \"stack too deep\" error\n    */\n    struct ClaimsManagerInitParams {\n        uint32 vestingDuration;\n        uint32 vestingPeriods;\n        uint16 maxBounty;\n        BountySplit bountySplit;\n        uint16 bountyGovernanceHAT;\n        uint16 bountyHackerHATVested;\n        address owner;\n        address committee;\n        address arbitrator;\n        bool arbitratorCanChangeBounty;\n        bool arbitratorCanChangeBeneficiary;\n        bool arbitratorCanSubmitClaims;\n        bool isTokenLockRevocable;\n    }\n\n    // Only committee\n    error OnlyCommittee();\n    // Active claim exists\n    error ActiveClaimExists();\n    // Safety period\n    error SafetyPeriod();\n    // Not safety period\n    error NotSafetyPeriod();\n    // Bounty percentage is higher than the max bounty\n    error BountyPercentageHigherThanMaxBounty();\n    // Only callable by arbitrator or after challenge timeout period\n    error OnlyCallableByArbitratorOrAfterChallengeTimeOutPeriod();\n    // No active claim exists\n    error NoActiveClaimExists();\n    // Claim Id specified is not the active claim Id\n    error ClaimIdIsNotActive();\n    // Not enough fee paid\n    error NotEnoughFeePaid();\n    // No pending max bounty\n    error NoPendingMaxBounty();\n    // Delay period for setting max bounty had not passed\n    error DelayPeriodForSettingMaxBountyHadNotPassed();\n    // Committee already checked in\n    error CommitteeAlreadyCheckedIn();\n    // Total bounty split % should be `HUNDRED_PERCENT`\n    error TotalSplitPercentageShouldBeHundredPercent();\n    // Vesting duration is too long\n    error VestingDurationTooLong();\n    // Vesting periods cannot be zero\n    error VestingPeriodsCannotBeZero();\n    // Vesting duration smaller than periods\n    error VestingDurationSmallerThanPeriods();\n    // Max bounty cannot be more than `MAX_BOUNTY_LIMIT` (unless if it is 100%)\n    error MaxBountyCannotBeMoreThanMaxBountyLimit();\n    // Committee bounty split cannot be more than `MAX_COMMITTEE_BOUNTY`\n    error CommitteeBountyCannotBeMoreThanMax();\n    // Only registry owner\n    error OnlyRegistryOwner();\n    // Set shares arrays must have same length\n    error SetSharesArraysMustHaveSameLength();\n    // Not enough user balance\n    error NotEnoughUserBalance();\n    // Only arbitrator or registry owner\n    error OnlyArbitratorOrRegistryOwner();\n    // Unchallenged claim can only be approved if challenge period is over\n    error UnchallengedClaimCanOnlyBeApprovedAfterChallengePeriod();\n    // Challenged claim can only be approved by arbitrator before the challenge timeout period\n    error ChallengedClaimCanOnlyBeApprovedByArbitratorUntilChallengeTimeoutPeriod();\n    // Claim has expired\n    error ClaimExpired();\n    // Challenge period is over\n    error ChallengePeriodEnded();\n    // Claim can be challenged only once\n    error ClaimAlreadyChallenged();\n    // Only callable if challenged\n    error OnlyCallableIfChallenged();\n    // System is in an emergency pause\n    error SystemInEmergencyPause();\n    // Cannot set a reward controller that was already used in the past\n    error CannotSetToPerviousRewardController();\n    // Payout must either be 100%, or up to the MAX_BOUNTY_LIMIT\n    error PayoutMustBeUpToMaxBountyLimitOrHundredPercent();\n\n\n    event SubmitClaim(\n        bytes32 indexed _claimId,\n        address _committee,\n        address indexed _submitter,\n        address indexed _beneficiary,\n        uint256 _bountyPercentage,\n        string _descriptionHash\n    );\n    event ChallengeClaim(bytes32 indexed _claimId);\n    event ApproveClaim(\n        bytes32 indexed _claimId,\n        address _committee,\n        address indexed _approver,\n        address indexed _beneficiary,\n        uint256 _bountyPercentage,\n        address _tokenLock,\n        ClaimBounty _claimBounty\n    );\n    event DismissClaim(bytes32 indexed _claimId);\n    event SetCommittee(address indexed _committee);\n    event SetVestingParams(\n        uint256 _duration,\n        uint256 _periods\n    );\n    event SetBountySplit(BountySplit _bountySplit);\n    event CommitteeCheckedIn();\n    event SetPendingMaxBounty(uint256 _maxBounty);\n    event SetMaxBounty(uint256 _maxBounty);\n    event SetHATBountySplit(uint256 _bountyGovernanceHAT, uint256 _bountyHackerHATVested);\n    event SetArbitrator(address indexed _arbitrator);\n    event SetChallengePeriod(uint256 _challengePeriod);\n    event SetChallengeTimeOutPeriod(uint256 _challengeTimeOutPeriod);\n    event SetArbitratorOptions(bool _arbitratorCanChangeBounty, bool _arbitratorCanChangeBeneficiary, bool _arbitratorCanSubmitClaims);\n\n    /**\n    * @notice Initialize a claims manager instance\n    * @param _vault The vault instance\n    * @param _params The claim manager's initialization parameters\n    * @dev See {IHATClaimsManager-ClaimsManagerInitParams} for more details\n    * @dev Called when the vault is created in {IHATVaultsRegistry-createVault}\n    */\n    function initialize(IHATVault _vault, ClaimsManagerInitParams calldata _params) external;\n\n    /* -------------------------------------------------------------------------------- */\n\n    /* ---------------------------------- Claim --------------------------------------- */\n\n    /**\n     * @notice Called by the committee to submit a claim for a bounty payout.\n     * This function should be called only on a safety period, when withdrawals\n     * are disabled, and while there's no other active claim. Cannot be called\n     * when the registry is in an emergency pause.\n     * Upon a call to this function by the committee the vault's withdrawals\n     * will be disabled until the claim is approved or dismissed. Also from the\n     * time of this call the arbitrator will have a period of \n     * {IHATVaultsRegistry.challengePeriod} to challenge the claim.\n     * @param _beneficiary The submitted claim's beneficiary\n     * @param _bountyPercentage The submitted claim's bug requested reward percentage\n     */\n    function submitClaim(\n        address _beneficiary, \n        uint16 _bountyPercentage, \n        string calldata _descriptionHash\n    )\n        external\n        returns (bytes32 claimId);\n\n   \n    /**\n    * @notice Called by the arbitrator or governance to challenge a claim for a bounty\n    * payout that had been previously submitted by the committee.\n    * Can only be called during the challenge period after submission of the\n    * claim.\n    * @param _claimId The claim ID\n    */\n    function challengeClaim(bytes32 _claimId) external;\n\n    /**\n    * @notice Approve a claim for a bounty submitted by a committee, and\n    * pay out bounty to hacker and committee. Also transfer to the \n    * IHATVaultsRegistry the part of the bounty that will be swapped to HAT \n    * tokens.\n    * If the claim had been previously challenged, this is only callable by\n    * the arbitrator. Otherwise, callable by anyone after challengePeriod had\n    * passed.\n    * @param _claimId The claim ID\n    * @param _bountyPercentage The percentage of the vault's balance that will\n    * be sent as a bounty. This value will be ignored if the caller is not the\n    * arbitrator.\n    * @param _beneficiary where the bounty will be sent to. This value will be \n    * ignored if the caller is not the arbitrator.\n    */\n    function approveClaim(bytes32 _claimId, uint16 _bountyPercentage, address _beneficiary)\n        external;\n\n    /**\n    * @notice Dismiss the active claim for bounty payout submitted by the\n    * committee.\n    * Called either by the arbitrator, or by anyone if the claim has timed out.\n    * @param _claimId The claim ID\n    */\n    function dismissClaim(bytes32 _claimId) external;\n\n    /* -------------------------------------------------------------------------------- */\n\n    /* ---------------------------------- Params -------------------------------------- */\n\n    /**\n    * @notice Set new committee address. Can be called by existing committee,\n    * or by the the vault's owner in the case that the committee hadn't checked in\n    * yet.\n    * @param _committee The address of the new committee \n    */\n    function setCommittee(address _committee) external;\n\n    /**\n    * @notice Called by the vault's owner to set the vesting params for the\n    * part of the bounty that the hacker gets vested in the vault's native\n    * token\n    * @param _duration Duration of the vesting period. Must be smaller than\n    * 120 days and bigger than `_periods`\n    * @param _periods Number of vesting periods. Cannot be 0.\n    */\n    function setVestingParams(uint32 _duration, uint32 _periods) external;\n\n    /**\n    * @notice Called by the vault's owner to set the vault token bounty split\n    * upon an approval.\n    * Can only be called if is no active claim and not during safety periods.\n    * @param _bountySplit The bounty split\n    */\n    function setBountySplit(BountySplit calldata _bountySplit) external;\n\n    /**\n    * @notice Called by the vault's committee to claim it's role.\n    * Deposits are enabled only after committee check in.\n    */\n    function committeeCheckIn() external;\n\n    /**\n    * @notice Called by the vault's owner to set a pending request for the\n    * maximum percentage of the vault that can be paid out as a bounty.\n    * Cannot be called if there is an active claim that has been submitted.\n    * Max bounty should be less than or equal to 90% (defined as 9000).\n    * It can also be set to 100%, but in this mode the vault will only allow\n    * payouts of the 100%, and the vault will become inactive forever afterwards.\n    * The pending value can be set by the owner after the time delay (of \n    * {IHATVaultsRegistry.generalParameters.setMaxBountyDelay}) had passed.\n    * @param _maxBounty The maximum bounty percentage that can be paid out\n    */\n    function setPendingMaxBounty(uint16 _maxBounty) external;\n\n    /**\n    * @notice Called by the vault's owner to set the vault's max bounty to\n    * the already pending max bounty.\n    * Cannot be called if there are active claims that have been submitted.\n    * Can only be called if there is a max bounty pending approval, and the\n    * time delay since setting the pending max bounty had passed.\n    */\n    function setMaxBounty() external;\n\n    /**\n    * @notice Called by the registry's owner to set the vault HAT token bounty \n    * split upon an approval.\n    * If the value passed is the special \"null\" value the vault will use the\n    * registry's default value.\n    * @param _bountyGovernanceHAT The HAT bounty for governance\n    * @param _bountyHackerHATVested The HAT bounty vested for the hacker\n    */\n    function setHATBountySplit(\n        uint16 _bountyGovernanceHAT,\n        uint16 _bountyHackerHATVested\n    ) \n        external;\n\n    /**\n    * @notice Called by the registry's owner to set the vault arbitrator\n    * If the value passed is the special \"null\" value the vault will use the\n    * registry's default value.\n    * @param _arbitrator The address of vault's arbitrator\n    */\n    function setArbitrator(address _arbitrator) external;\n\n    /**\n    * @notice Called by the registry's owner to set the period of time after\n    * a claim for a bounty payout has been submitted that it can be challenged\n    * by the arbitrator.\n    * If the value passed is the special \"null\" value the vault will use the\n    * registry's default value.\n    * @param _challengePeriod The vault's challenge period\n    */\n    function setChallengePeriod(uint32 _challengePeriod) external;\n\n    /**\n    * @notice Called by the registry's owner to set the period of time after\n    * which a claim for a bounty payout can be dismissed by anyone.\n    * If the value passed is the special \"null\" value the vault will use the\n    * registry's default value.\n    * @param _challengeTimeOutPeriod The vault's challenge timeout period\n    */\n    function setChallengeTimeOutPeriod(uint32 _challengeTimeOutPeriod)\n        external;\n\n    /**\n    * @notice Called by the registry's owner to set whether the arbitrator\n    * can change a claim bounty percentage and/ or beneficiary\n    * If the value passed is the special \"null\" value the vault will use the\n    * registry's default value.\n    * @param _arbitratorCanChangeBounty Whether the arbitrator can change a claim bounty percentage\n    * @param _arbitratorCanChangeBeneficiary Whether the arbitrator can change a claim beneficiary\n    */\n    function setArbitratorOptions(\n        bool _arbitratorCanChangeBounty,\n        bool _arbitratorCanChangeBeneficiary,\n        bool _arbitratorCanSubmitClaims\n    )\n        external;\n\n    /* -------------------------------------------------------------------------------- */\n\n    /* --------------------------------- Getters -------------------------------------- */\n\n    /** \n    * @notice Returns the max bounty that can be paid from the vault in percentages out of HUNDRED_PERCENT\n    * @return The max bounty\n    */\n    function maxBounty() external view returns(uint16);\n\n    /** \n    * @notice Returns the vault's registry\n    * @return The registry's address\n    */\n    function registry() external view returns(IHATVaultsRegistry);\n\n    /** \n    * @notice Returns whether the committee has checked in\n    * @return Whether the committee has checked in\n    */\n    function committeeCheckedIn() external view returns(bool);\n\n    /** \n    * @notice Returns the current active claim\n    * @return The current active claim\n    */\n    function getActiveClaim() external view returns(Claim memory);\n\n    /** \n    * @notice Returns the vault HAT bounty split part that goes to the governance\n    * If no specific value for this vault has been set, the registry's default\n    * value will be returned.\n    * @return The vault's HAT bounty split part that goes to the governance\n    */\n    function getBountyGovernanceHAT() external view returns(uint16);\n    \n    /** \n    * @notice Returns the vault HAT bounty split part that is vested for the hacker\n    * If no specific value for this vault has been set, the registry's default\n    * value will be returned.\n    * @return The vault's HAT bounty split part that is vested for the hacker\n    */\n    function getBountyHackerHATVested() external view returns(uint16);\n\n    /** \n    * @notice Returns the address of the vault's arbitrator\n    * If no specific value for this vault has been set, the registry's default\n    * value will be returned.\n    * @return The address of the vault's arbitrator\n    */\n    function getArbitrator() external view returns(address);\n\n    /** \n    * @notice Returns the period of time after a claim for a bounty payout has\n    * been submitted that it can be challenged by the arbitrator.\n    * If no specific value for this vault has been set, the registry's default\n    * value will be returned.\n    * @return The vault's challenge period\n    */\n    function getChallengePeriod() external view returns(uint32);\n\n    /** \n    * @notice Returns the period of time after which a claim for a bounty\n    * payout can be dismissed by anyone.\n    * If no specific value for this vault has been set, the registry's default\n    * value will be returned.\n    * @return The vault's challenge timeout period\n    */\n    function getChallengeTimeOutPeriod() external view returns(uint32);\n\n    /** \n    * @notice Returns the claims manager's version\n    * @return The claims manager's version\n    */\n    function VERSION() external view returns(string calldata);\n}\n"
      },
      "contracts/interfaces/IHATVault.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// Disclaimer https://github.com/hats-finance/hats-contracts/blob/main/DISCLAIMER.md\n\npragma solidity 0.8.16;\n\nimport \"@openzeppelin/contracts-upgradeable/interfaces/IERC4626Upgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./IRewardController.sol\";\nimport \"./IHATVaultsRegistry.sol\";\nimport \"./IHATClaimsManager.sol\";\n\n/** @title Interface for Hats.finance Vaults\n * @author Hats.finance\n * @notice A HATVault holds the funds for a specific project's bug bounties.\n * Anyone can permissionlessly deposit into the HATVault using\n * the vault’s native token. When a bug is submitted and approved, the bounty \n * is paid out using the funds in the vault. Bounties are paid out as a\n * percentage of the vault. The percentage is set according to the severity of\n * the bug. Vaults have regular safety periods (typically for an hour twice a\n * day) which are time for the committee to make decisions.\n *\n * In addition to the roles defined in the HATVaultsRegistry, every HATVault \n * has the roles:\n * Committee - The only address which can submit a claim for a bounty payout\n * and set the maximum bounty.\n * User - Anyone can deposit the vault's native token into the vault and \n * recieve shares for it. Shares represent the user's relative part in the\n * vault, and when a bounty is paid out, users lose part of their deposits\n * (based on percentage paid), but keep their share of the vault.\n * Users also receive rewards for their deposits, which can be claimed at any\n *  time.\n * To withdraw previously deposited tokens, a user must first send a withdraw\n * request, and the withdrawal will be made available after a pending period.\n * Withdrawals are not permitted during safety periods or while there is an \n * active claim for a bounty payout.\n *\n * Bounties are payed out distributed between a few channels, and that \n * distribution is set upon creation (the hacker gets part in direct transfer,\n * part in vested reward and part in vested HAT token, part gets rewarded to\n * the committee, part gets swapped to HAT token and burned and/or sent to Hats\n * governance).\n *\n * NOTE: Vaults should not use tokens which do not guarantee that the amount\n * specified is the amount transferred\n *\n * This project is open-source and can be found at:\n * https://github.com/hats-finance/hats-contracts\n */\ninterface IHATVault is IERC4626Upgradeable {\n\n    /**\n    * @notice Initialization parameters for the vault token\n    * @param name The vault's name (concatenated as \"Hats Vault \" + name)\n    * @param symbol The vault's symbol (concatenated as \"HAT\" + symbol)\n    * @param rewardController The reward controller for the vault\n    * @param asset The vault's native token\n    * @param owner The address of the vault's owner \n    * @param isPaused Whether to initialize the vault with deposits disabled\n    * @param descriptionHash The hash of the vault's description\n    */\n    struct VaultInitParams {\n        string name;\n        string symbol;\n        IRewardController[] rewardControllers;\n        IERC20 asset;\n        address owner;\n        bool isPaused;\n        string descriptionHash;\n    }\n\n    // Only claims manager can make this call\n    error OnlyClaimsManager();\n    // Only registry owner\n    error OnlyRegistryOwner();\n    // Vault not started yet\n    error VaultNotStartedYet();\n    // First deposit must return at least MINIMAL_AMOUNT_OF_SHARES\n    error AmountOfSharesMustBeMoreThanMinimalAmount();\n    // Withdraw amount must be greater than zero\n    error WithdrawMustBeGreaterThanZero();\n    // Cannot mint burn or transfer 0 amount of shares\n    error AmountCannotBeZero();\n    // Cannot transfer shares to self\n    error CannotTransferToSelf();\n    // Cannot deposit to another user with withdraw request\n    error CannotTransferToAnotherUserWithActiveWithdrawRequest();\n    // Redeem amount cannot be more than maximum for user\n    error RedeemMoreThanMax();\n    // Deposit passed max slippage\n    error DepositSlippageProtection();\n    // Mint passed max slippage\n    error MintSlippageProtection();\n    // Withdraw passed max slippage\n    error WithdrawSlippageProtection();\n    // Redeem passed max slippage\n    error RedeemSlippageProtection();\n    // Cannot add the same reward controller more than once\n    error DuplicatedRewardController();\n    // Fee must be less than or equal to 2%\n    error WithdrawalFeeTooBig();\n    // System is in an emergency pause\n    error SystemInEmergencyPause();\n    // Only fee setter\n    error OnlyFeeSetter();\n    // Cannot unpasue deposits for a vault that was destroyed\n    error CannotUnpauseDestroyedVault();\n\n    event AddRewardController(IRewardController indexed _newRewardController);\n    event SetWithdrawalFee(uint256 _newFee);\n    event VaultPayout(uint256 _amount);\n    event SetDepositPause(bool _depositPause);\n    event SetWithdrawPaused(bool _withdrawPaused);\n    event VaultStarted();\n    event VaultDestroyed();\n    event SetVaultDescription(string _descriptionHash);\n    event WithdrawRequest(\n        address indexed _beneficiary,\n        uint256 _withdrawEnableTime\n    );\n\n    /**\n    * @notice Initialize a vault token instance\n    * @param _claimsManager The vault's claims manager\n    * @param _params The vault token initialization parameters\n    * @dev See {IHATVault-VaultInitParams} for more details\n    * @dev Called when the vault token is created in {IHATVaultsRegistry-createVault}\n    */\n    function initialize(address _claimsManager, VaultInitParams calldata _params) external;\n\n    /**\n    * @notice Adds a reward controller to the reward controllers list\n    * @param _rewardController The reward controller to add\n    */\n    function addRewardController(IRewardController _rewardController) external;\n\n    /**\n    * @notice Called by the vault's owner to disable all deposits to the vault\n    * @param _depositPause Are deposits paused\n    */\n    function setDepositPause(bool _depositPause) external;\n\n    /**\n    * @notice Called by the registry's fee setter to set the fee for \n    * withdrawals from the vault.\n    * @param _fee The new fee. Must be smaller than or equal to `MAX_WITHDRAWAL_FEE`\n    */\n    function setWithdrawalFee(uint256 _fee) external;\n\n    /**\n    * @notice Make a payout out of the vault\n    * @param _amount The amount to send out for the payout\n    */\n    function makePayout(uint256 _amount) external;\n\n    /**\n    * @notice Called by the vault's claims manager to disable all withdrawals from the vault\n    * @param _withdrawPaused Are withdraws paused\n    */\n    function setWithdrawPaused(bool _withdrawPaused) external;\n\n    /**\n    * @notice Start the vault, deposits are disabled until the vault is first started\n    */\n    function startVault() external;\n\n\n    /**\n    * @notice Permanently disables deposits to the vault\n    */\n    function destroyVault() external;\n\n    /**\n    * @notice Called by the registry's owner to change the description of the\n    * vault in the Hats.finance UI\n    * @param _descriptionHash the hash of the vault's description\n    */\n    function setVaultDescription(string calldata _descriptionHash) external;\n    \n    /** \n    * @notice Returns the vault's version\n    * @return The vault's version\n    */\n    function VERSION() external view returns(string calldata);\n\n    /** \n    * @notice Returns the vault's registry\n    * @return The registry's address\n    */\n    function registry() external view returns(IHATVaultsRegistry);\n\n    /** \n    * @notice Returns the vault's registry\n    * @return The registry's address\n    */\n    function claimsManager() external view returns(address);\n\n    /**\n    * @notice Submit a request to withdraw funds from the vault.\n    * The request will only be approved if there is no previous active\n    * withdraw request.\n    * The request will be pending for a period of\n    * {HATVaultsRegistry.generalParameters.withdrawRequestPendingPeriod},\n    * after which a withdraw will be possible for a duration of\n    * {HATVaultsRegistry.generalParameters.withdrawRequestEnablePeriod}\n    */\n    function withdrawRequest() external;\n\n    /** \n    * @notice Withdraw previously deposited funds from the vault and claim\n    * the HAT reward that the user has earned.\n    * Can only be performed if a withdraw request has been previously\n    * submitted, and the pending period had passed, and while the withdraw\n    * enabled timeout had not passed. Withdrawals are not permitted during\n    * safety periods or while there is an active claim for a bounty payout.\n    * @param assets Amount of tokens to withdraw\n    * @param receiver Address of receiver of the funds\n    * @param owner Address of owner of the funds\n    * @dev See {IERC4626-withdraw}.\n    */\n    function withdrawAndClaim(uint256 assets, address receiver, address owner)\n        external \n        returns (uint256 shares);\n\n    /** \n    * @notice Redeem shares in the vault for the respective amount\n    * of underlying assets and claim the HAT reward that the user has earned.\n    * Can only be performed if a withdraw request has been previously\n    * submitted, and the pending period had passed, and while the withdraw\n    * enabled timeout had not passed. Withdrawals are not permitted during\n    * safety periods or while there is an active claim for a bounty payout.\n    * @param shares Amount of shares to redeem\n    * @param receiver Address of receiver of the funds \n    * @param owner Address of owner of the funds \n    * @dev See {IERC4626-redeem}.\n    */\n    function redeemAndClaim(uint256 shares, address receiver, address owner)\n        external \n        returns (uint256 assets);\n\n    /** \n    * @notice Redeem all of the user's shares in the vault for the respective amount\n    * of underlying assets without calling the reward controller, meaning user renounces\n    * their uncommited part of the reward.\n    * Can only be performed if a withdraw request has been previously\n    * submitted, and the pending period had passed, and while the withdraw\n    * enabled timeout had not passed. Withdrawals are not permitted during\n    * safety periods or while there is an active claim for a bounty payout.\n    * @param receiver Address of receiver of the funds \n    */\n    function emergencyWithdraw(address receiver) external returns (uint256 assets);\n\n    /** \n    * @notice Withdraw previously deposited funds from the vault, without\n    * transferring the accumulated rewards.\n    * Can only be performed if a withdraw request has been previously\n    * submitted, and the pending period had passed, and while the withdraw\n    * enabled timeout had not passed. Withdrawals are not permitted during\n    * safety periods or while there is an active claim for a bounty payout.\n    * @param assets Amount of tokens to withdraw\n    * @param receiver Address of receiver of the funds \n    * @param owner Address of owner of the funds \n    * @dev See {IERC4626-withdraw}.\n    */\n    function withdraw(uint256 assets, address receiver, address owner)\n        external \n        returns (uint256);\n\n    /** \n    * @notice Redeem shares in the vault for the respective amount\n    * of underlying assets, without transferring the accumulated reward.\n    * Can only be performed if a withdraw request has been previously\n    * submitted, and the pending period had passed, and while the withdraw\n    * enabled timeout had not passed. Withdrawals are not permitted during\n    * safety periods or while there is an active claim for a bounty payout.\n    * @param shares Amount of shares to redeem\n    * @param receiver Address of receiver of the funds \n    * @param owner Address of owner of the funds \n    * @dev See {IERC4626-redeem}.\n    */\n    function redeem(uint256 shares, address receiver, address owner)\n        external  \n        returns (uint256);\n\n    /**\n    * @dev Deposit funds to the vault. Can only be called if the committee had\n    * checked in and deposits are not paused, and the registry is not in an emergency pause.\n    * @param receiver Reciever of the shares from the deposit\n    * @param assets Amount of vault's native token to deposit\n    * @dev See {IERC4626-deposit}.\n    */\n    function deposit(uint256 assets, address receiver) \n        external\n        returns (uint256);\n\n    /**\n    * @dev Deposit funds to the vault. Can only be called if the committee had\n    * checked in and deposits are not paused, and the registry is not in an emergency pause.\n    * Allows to specify minimum shares to be minted for slippage protection.\n    * @param receiver Reciever of the shares from the deposit\n    * @param assets Amount of vault's native token to deposit\n    * @param minShares Minimum amount of shares to minted for the assets\n    */\n    function deposit(uint256 assets, address receiver, uint256 minShares) \n        external\n        returns (uint256);\n\n    /**\n    * @dev Deposit funds to the vault based on the amount of shares to mint specified.\n    * Can only be called if the committee had checked in and deposits are not paused,\n    * and the registry is not in an emergency pause.\n    * Allows to specify maximum assets to be deposited for slippage protection.\n    * @param receiver Reciever of the shares from the deposit\n    * @param shares Amount of vault's shares to mint\n    * @param maxAssets Maximum amount of assets to deposit for the shares\n    */\n    function mint(uint256 shares, address receiver, uint256 maxAssets) \n        external\n        returns (uint256);\n\n    /** \n    * @notice Withdraw previously deposited funds from the vault, without\n    * transferring the accumulated HAT reward.\n    * Can only be performed if a withdraw request has been previously\n    * submitted, and the pending period had passed, and while the withdraw\n    * enabled timeout had not passed. Withdrawals are not permitted during\n    * safety periods or while there is an active claim for a bounty payout.\n    * Allows to specify maximum shares to be burnt for slippage protection.\n    * @param assets Amount of tokens to withdraw\n    * @param receiver Address of receiver of the funds \n    * @param owner Address of owner of the funds\n    * @param maxShares Maximum amount of shares to burn for the assets\n    */\n    function withdraw(uint256 assets, address receiver, address owner, uint256 maxShares)\n        external \n        returns (uint256);\n\n    /** \n    * @notice Redeem shares in the vault for the respective amount\n    * of underlying assets, without transferring the accumulated reward.\n    * Can only be performed if a withdraw request has been previously\n    * submitted, and the pending period had passed, and while the withdraw\n    * enabled timeout had not passed. Withdrawals are not permitted during\n    * safety periods or while there is an active claim for a bounty payout.\n    * Allows to specify minimum assets to be received for slippage protection.\n    * @param shares Amount of shares to redeem\n    * @param receiver Address of receiver of the funds \n    * @param owner Address of owner of the funds\n    * @param minAssets Minimum amount of assets to receive for the shares\n    */\n    function redeem(uint256 shares, address receiver, address owner, uint256 minAssets)\n        external  \n        returns (uint256);\n\n    /** \n    * @notice Withdraw previously deposited funds from the vault and claim\n    * the HAT reward that the user has earned.\n    * Can only be performed if a withdraw request has been previously\n    * submitted, and the pending period had passed, and while the withdraw\n    * enabled timeout had not passed. Withdrawals are not permitted during\n    * safety periods or while there is an active claim for a bounty payout.\n    * Allows to specify maximum shares to be burnt for slippage protection.\n    * @param assets Amount of tokens to withdraw\n    * @param receiver Address of receiver of the funds\n    * @param owner Address of owner of the funds\n    * @param maxShares Maximum amount of shares to burn for the assets\n    * @dev See {IERC4626-withdraw}.\n    */\n    function withdrawAndClaim(uint256 assets, address receiver, address owner, uint256 maxShares)\n        external \n        returns (uint256 shares);\n\n    /** \n    * @notice Redeem shares in the vault for the respective amount\n    * of underlying assets and claim the HAT reward that the user has earned.\n    * Can only be performed if a withdraw request has been previously\n    * submitted, and the pending period had passed, and while the withdraw\n    * enabled timeout had not passed. Withdrawals are not permitted during\n    * safety periods or while there is an active claim for a bounty payout.\n    * Allows to specify minimum assets to be received for slippage protection.\n    * @param shares Amount of shares to redeem\n    * @param receiver Address of receiver of the funds \n    * @param owner Address of owner of the funds\n    * @param minAssets Minimum amount of assets to receive for the shares\n    * @dev See {IERC4626-redeem}.\n    */\n    function redeemAndClaim(uint256 shares, address receiver, address owner, uint256 minAssets)\n        external \n        returns (uint256 assets);\n\n    /** \n    * @notice Returns the amount of shares to be burned to give the user the exact\n    * amount of assets requested plus cover for the fee. Also returns the amount assets\n    * to be paid as fee.\n    * @return shares The amount of shares to be burned to get the requested amount of assets\n    * @return fee The amount of assets that will be paid as fee\n    */\n    function previewWithdrawAndFee(uint256 assets) external view returns (uint256 shares, uint256 fee);\n\n\n    /** \n    * @notice Returns the amount of assets to be sent to the user for the exact\n    * amount of shares to redeem. Also returns the amount assets to be paid as fee.\n    * @return assets amount of assets to be sent in exchange for the amount of shares specified\n    * @return fee The amount of assets that will be paid as fee\n    */\n    function previewRedeemAndFee(uint256 shares) external view returns (uint256 assets, uint256 fee);\n}\n"
      },
      "contracts/interfaces/IHATVaultsRegistry.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// Disclaimer https://github.com/hats-finance/hats-contracts/blob/main/DISCLAIMER.md\n\npragma solidity 0.8.16;\n\nimport \"./IHATVault.sol\";\nimport \"./IHATClaimsManager.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/** @title Interface for the Hats.finance Vault Registry\n * @author hats.finance\n * @notice The Hats.finance Vault Registry is used to deploy Hats.finance\n * vaults and manage shared parameters.\n *\n * Hats.finance is a proactive bounty protocol for white hat hackers and\n * security experts, where projects, community members, and stakeholders\n * incentivize protocol security and responsible disclosure.\n * Hats create scalable vaults using the project’s own token. The value of the\n * bounty increases with the success of the token and project.\n *\n * The owner of the registry has the permission to set time limits and bounty\n * parameters and change vaults' info, and to set the other registry roles -\n * fee setter and arbitrator.\n * The arbitrator can challenge submitted claims for bounty payouts made by\n * vaults' committees, approve them with a different bounty percentage or\n * dismiss them.\n * The fee setter can set the fee on withdrawals on all vaults.\n *\n * This project is open-source and can be found at:\n * https://github.com/hats-finance/hats-contracts\n *\n * @dev New hats.finance vaults should be created through a call to {createVault}\n * so that they are linked to the registry\n */\ninterface IHATVaultsRegistry {\n\n    // a struct with parameters for all vaults\n    struct GeneralParameters {\n        // vesting duration for the part of the bounty given to the hacker in HAT tokens\n        uint32 hatVestingDuration;\n        // vesting periods for the part of the bounty given to the hacker in HAT tokens\n        uint32 hatVestingPeriods;\n        // withdraw enable period. safetyPeriod starts when finished.\n        uint32 withdrawPeriod;\n        // withdraw disable period - time for the committee to gather and decide on actions,\n        // withdrawals are not possible in this time. withdrawPeriod starts when finished.\n        uint32 safetyPeriod;\n        // period of time after withdrawRequestPendingPeriod where it is possible to withdraw\n        // (after which withdrawals are not possible)\n        uint32 withdrawRequestEnablePeriod;\n        // period of time that has to pass after withdraw request until withdraw is possible\n        uint32 withdrawRequestPendingPeriod;\n        // period of time that has to pass after setting a pending max\n        // bounty before it can be set as the new max bounty\n        uint32 setMaxBountyDelay;\n        // fee in ETH to be transferred with every logging of a claim\n        uint256 claimFee;\n    }\n\n    /**\n     * @notice Raised on {setWithdrawSafetyPeriod} if the withdraw period to\n     * be set is shorter than 1 hour\n     */\n    error WithdrawPeriodTooShort();\n\n    /**\n     * @notice Raised on {setWithdrawSafetyPeriod} if the safety period to\n     * be set is longer than 6 hours\n     */\n    error SafetyPeriodTooLong();\n\n    /**\n     * @notice Raised on {setWithdrawRequestParams} if the withdraw request\n     * pending period to be set is shorter than 3 months\n     */\n    error WithdrawRequestPendingPeriodTooLong();\n\n    /**\n     * @notice Raised on {setWithdrawRequestParams} if the withdraw request\n     * enabled period to be set is shorter than 6 hours\n     */\n    error WithdrawRequestEnabledPeriodTooShort();\n\n    /**\n     * @notice Raised on {setWithdrawRequestParams} if the withdraw request\n     * enabled period to be set is longer than 100 days\n     */\n    error WithdrawRequestEnabledPeriodTooLong();\n\n    /**\n     * @notice Raised on {setHatVestingParams} if the vesting duration to be\n     * set is longer than 180 days\n     */\n    error HatVestingDurationTooLong();\n\n    /**\n     * @notice Raised on {setHatVestingParams} if the vesting periods to be\n     * set is 0\n     */\n    error HatVestingPeriodsCannotBeZero();\n    \n    /**\n     * @notice Raised on {setHatVestingParams} if the vesting duration is \n     * smaller than the vesting periods\n     */\n    error HatVestingDurationSmallerThanPeriods();\n\n    /**\n     * @notice Raised on {setMaxBountyDelay} if the max bounty to be set is\n     * shorter than 2 days\n     */\n    error DelayTooShort();\n\n    /**\n     * @notice Raised on {swapAndSend} if the amount to swap is zero\n     */\n    error AmountToSwapIsZero();\n\n    /**\n     * @notice Raised on {swapAndSend} if the swap was not successful\n     */\n    error SwapFailed();\n    // Wrong amount received\n\n    /**\n     * @notice Raised on {swapAndSend} if the amount that was recieved in\n     * the swap was less than the minimum amount specified\n     */\n    error AmountSwappedLessThanMinimum();\n\n    /**\n     * @notice Raised on {setDefaultHATBountySplit} if the split to be set is\n     * greater than 20% (defined as 2000)\n     */\n    error TotalHatsSplitPercentageShouldBeUpToMaxHATSplit();\n\n    /**\n     * @notice Raised on {setDefaultChallengePeriod} if the challenge period\n     *  to be set is shorter than 1 day\n     */\n    error ChallengePeriodTooShort();\n\n    /**\n     * @notice Raised on {setDefaultChallengePeriod} if the challenge period\n     *  to be set is longer than 5 days\n     */\n    error ChallengePeriodTooLong();\n        \n    /**\n     * @notice Raised on {setDefaultChallengeTimeOutPeriod} if the challenge\n     * timeout period to be set is shorter than 1 day\n     */\n    error ChallengeTimeOutPeriodTooShort();\n\n    /**\n     * @notice Raised on {setDefaultChallengeTimeOutPeriod} if the challenge\n     * timeout period to be set is longer than 125 days\n     */\n    error ChallengeTimeOutPeriodTooLong();\n    \n    /**\n     * @notice Raised on {LogClaim} if the transaction was not sent with the\n     * amount of ETH specified as {generalParameters.claimFee}\n     */\n    error NotEnoughFeePaid();\n\n    /**\n     * @notice Raised on {LogClaim} if the transfer of the claim fee failed\n     */\n    error ClaimFeeTransferFailed();\n\n    /**\n     * @notice Emitted on deployment of the registry\n     * @param _hatVaultImplementation The HATVault implementation address\n     * @param _hatClaimsManagerImplementation The HATClaimsManager implementation address\n     * @param _HAT The HAT token address\n     * @param _tokenLockFactory The token lock factory address\n     * @param _generalParameters The registry's general parameters\n     * @param _bountyGovernanceHAT The HAT bounty for governance\n     * @param _bountyHackerHATVested The HAT bounty vested for the hacker\n     * @param _hatGovernance The registry's governance\n     * @param _defaultChallengePeriod The new default challenge period\n     * @param _defaultChallengeTimeOutPeriod The new default challenge timeout\n     */\n    event RegistryCreated(\n        address _hatVaultImplementation,\n        address _hatClaimsManagerImplementation,\n        address _HAT,\n        address _tokenLockFactory,\n        GeneralParameters _generalParameters,\n        uint256 _bountyGovernanceHAT,\n        uint256 _bountyHackerHATVested,\n        address _hatGovernance,\n        address _defaultArbitrator,\n        uint256 _defaultChallengePeriod,\n        uint256 _defaultChallengeTimeOutPeriod\n    );\n\n    /**\n     * @notice Emitted when a claim is logged\n     * @param _claimer The address of the claimer\n     * @param _descriptionHash - a hash of an ipfs encrypted file which\n     * describes the claim.\n     */\n    event LogClaim(address indexed _claimer, string _descriptionHash);\n\n    /**\n     * @notice Emitted when a new fee setter is set\n     * @param _feeSetter The address of the new fee setter\n     */\n    event SetFeeSetter(address indexed _feeSetter);\n\n    /**\n     * @notice Emitted when new withdraw request time limits are set\n     * @param _withdrawRequestPendingPeriod Time period where the withdraw\n     * request is pending\n     * @param _withdrawRequestEnablePeriod Time period after the peding period\n     * has ended during which withdrawal is enabled\n     */\n    event SetWithdrawRequestParams(\n        uint256 _withdrawRequestPendingPeriod,\n        uint256 _withdrawRequestEnablePeriod\n    );\n\n    /**\n     * @notice Emitted when a new fee for logging a claim for a bounty is set\n     * @param _fee Claim fee in ETH to be transferred on any call of {logClaim}\n     */\n    event SetClaimFee(uint256 _fee);\n\n    /**\n     * @notice Emitted when new durations are set for withdraw period and\n     * safety period\n     * @param _withdrawPeriod Amount of time during which withdrawals are\n     * enabled, and the bounty split can be changed by the governance\n     * @param _safetyPeriod Amount of time during which claims for bounties \n     * can be submitted and withdrawals are disabled\n     */\n    event SetWithdrawSafetyPeriod(\n        uint256 _withdrawPeriod,\n        uint256 _safetyPeriod\n    );\n\n    /**\n     * @notice Emitted when new HAT vesting parameters are set\n     * @param _duration The duration of the vesting period\n     * @param _periods The number of vesting periods\n     */\n    event SetHatVestingParams(uint256 _duration, uint256 _periods);\n\n    /**\n     * @notice Emitted when a new timelock delay for setting the\n     * max bounty is set\n     * @param _delay The time period for the delay\n     */\n    event SetMaxBountyDelay(uint256 _delay);\n\n    /**\n     * @notice Emitted when the UI visibility of a vault is changed\n     * @param _vault The address of the vault to update\n     * @param _visible Is this vault visible in the UI\n     */\n    event SetVaultVisibility(address indexed _vault, bool indexed _visible);\n\n    /** @dev Emitted when a new vault is created\n     * @param _vault The address of the vault to add to the registry\n     * @param _claimsManager The address of the vault's claims manager\n     * @param _vaultParams The vault initialization parameters\n     * @param _claimsManagerParams The vault's claims manager initialization parameters\n     */\n    event VaultCreated(\n        address indexed _vault,\n        address indexed _claimsManager,\n        IHATVault.VaultInitParams _vaultParams,\n        IHATClaimsManager.ClaimsManagerInitParams _claimsManagerParams\n    );\n    \n    /** @notice Emitted when a swap of vault tokens to HAT tokens is done and\n     * the HATS tokens are sent to beneficiary through vesting contract\n     * @param _beneficiary Address of beneficiary\n     * @param _amountSwapped Amount of vault's native tokens that was swapped\n     * @param _amountSent Amount of HAT tokens sent to beneficiary\n     * @param _tokenLock Address of the token lock contract that holds the HAT\n     * tokens (address(0) if no token lock is used)\n     */\n    event SwapAndSend(\n        address indexed _beneficiary,\n        uint256 _amountSwapped,\n        uint256 _amountSent,\n        address indexed _tokenLock\n    );\n\n    /**\n     * @notice Emitted when a new default HAT bounty split is set\n     * @param _defaultBountyGovernanceHAT The new default HAT bounty part sent to governance\n     * @param _defaultBountyHackerHATVested The new default HAT bounty part vseted for the hacker\n     */\n    event SetDefaultHATBountySplit(uint256 _defaultBountyGovernanceHAT, uint256 _defaultBountyHackerHATVested);\n\n    /**\n     * @notice Emitted when a new default arbitrator is set\n     * @param _defaultArbitrator The address of the new arbitrator\n     */\n    event SetDefaultArbitrator(address indexed _defaultArbitrator);\n\n    /**\n     * @notice Emitted when a new default challenge period is set\n     * @param _defaultChallengePeriod The new default challenge period\n     */ \n    event SetDefaultChallengePeriod(uint256 _defaultChallengePeriod);\n\n    /**\n     * @notice Emitted when a new default challenge timeout period is set\n     * @param _defaultChallengeTimeOutPeriod The new default challenge timeout\n     * period\n     */\n    event SetDefaultChallengeTimeOutPeriod(uint256 _defaultChallengeTimeOutPeriod);\n\n    /** @notice Emitted when the system is put into emergency pause/unpause\n     * @param _isEmergencyPaused Is the system in an emergency pause\n     */\n    event SetEmergencyPaused(bool _isEmergencyPaused);\n\n    /**\n     * @notice Emitted when a new swap token is set\n     * @param _swapToken The new swap token address\n     */\n    event SetSwapToken(address indexed _swapToken);\n\n    /**\n     * @notice Emitted when a new HATVault implementation is set\n     * @param _hatVaultImplementation The address of the new HATVault implementation\n     */\n    event SetHATVaultImplementation(address indexed _hatVaultImplementation);\n\n    /**\n     * @notice Emitted when a new HATClaimsManager implementation is set\n     * @param _hatClaimsManagerImplementation The address of the new HATClaimsManager implementation\n     */\n    event SetHATClaimsManagerImplementation(address indexed _hatClaimsManagerImplementation);\n\n    /**\n     * @notice Called by governance to pause/unpause the system in case of an\n     * emergency\n     * @param _isEmergencyPaused Is the system in an emergency pause\n     */\n    function setEmergencyPaused(bool _isEmergencyPaused) external;\n\n    /**\n     * @notice Called by governance to set a new swap token\n     * @param _swapToken the new swap token address\n     */\n    function setSwapToken(address _swapToken) external;\n\n    /**\n     * @notice Called by governance to set a new HATVault and HATVault implementation to be\n     * used by the registry for creating new vaults\n     * @param _hatVaultImplementation The address of the HATVault implementation\n     * @param _hatClaimsManagerImplementation The address of the HATClaimsManager implementation\n     */\n    function setVaultImplementations(address _hatVaultImplementation, address _hatClaimsManagerImplementation) external;\n\n    /**\n     * @notice Emit an event that includes the given _descriptionHash\n     * This can be used by the claimer as evidence that she had access to the\n     * information at the time of the call\n     * if a {generalParameters.claimFee} > 0, the caller must send that amount\n     * of ETH for the claim to succeed\n     * @param _descriptionHash - a hash of an IPFS encrypted file which \n     * describes the claim.\n     */\n    function logClaim(string calldata _descriptionHash) external payable;\n\n    /**\n     * @notice Called by governance to set the default percentage of each claim bounty\n     * that will be swapped for hats and sent to the governance or vested for the hacker\n     * @param _defaultBountyGovernanceHAT The HAT bounty for governance\n     * @param _defaultBountyHackerHATVested The HAT bounty vested for the hacker\n     */\n    function setDefaultHATBountySplit(\n        uint16 _defaultBountyGovernanceHAT,\n        uint16 _defaultBountyHackerHATVested\n    ) \n        external;\n\n    /** \n     * @dev Check that a given hats bounty split is legal, meaning that:\n     *   Each entry is a number between 0 and less than `MAX_HAT_SPLIT`.\n     *   Total splits should be less than `MAX_HAT_SPLIT`.\n     * function will revert in case the bounty split is not legal.\n     * @param _bountyGovernanceHAT The HAT bounty for governance\n     * @param _bountyHackerHATVested The HAT bounty vested for the hacker\n     */\n    function validateHATSplit(uint16 _bountyGovernanceHAT, uint16 _bountyHackerHATVested)\n         external\n         pure;\n\n    /**\n     * @notice Called by governance to set the default arbitrator.\n     * @param _defaultArbitrator The default arbitrator address\n     */\n    function setDefaultArbitrator(address _defaultArbitrator) external;\n\n    /**\n     * @notice Called by governance to set the default challenge period\n     * @param _defaultChallengePeriod The default challenge period\n     */\n    function setDefaultChallengePeriod(uint32 _defaultChallengePeriod) \n        external;\n\n    /**\n     * @notice Called by governance to set the default challenge timeout\n     * @param _defaultChallengeTimeOutPeriod The Default challenge timeout\n     */\n    function setDefaultChallengeTimeOutPeriod(\n        uint32 _defaultChallengeTimeOutPeriod\n    ) \n        external;\n\n    /**\n     * @notice Check that the given challenge period is legal, meaning that it\n     * is greater than 1 day and less than 5 days.\n     * @param _challengePeriod The challenge period to check\n     */\n    function validateChallengePeriod(uint32 _challengePeriod) external pure;\n\n    /**\n     * @notice Check that the given challenge timeout period is legal, meaning\n     * that it is greater than 2 days and less than 125 days.\n     * @param _challengeTimeOutPeriod The challenge timeout period to check\n     */\n    function validateChallengeTimeOutPeriod(uint32 _challengeTimeOutPeriod) external pure;\n   \n    /**\n     * @notice Called by governance to set the fee setter role\n     * @param _feeSetter Address of new fee setter\n     */\n    function setFeeSetter(address _feeSetter) external;\n\n    /**\n     * @notice Called by governance to set time limits for withdraw requests\n     * @param _withdrawRequestPendingPeriod Time period where the withdraw\n     * request is pending\n     * @param _withdrawRequestEnablePeriod Time period after the peding period\n     * has ended during which withdrawal is enabled\n     */\n    function setWithdrawRequestParams(\n        uint32 _withdrawRequestPendingPeriod,\n        uint32  _withdrawRequestEnablePeriod\n    )\n        external;\n\n    /**\n     * @notice Called by governance to set the fee for logging a claim for a\n     * bounty in any vault.\n     * @param _fee Claim fee in ETH to be transferred on any call of\n     * {logClaim}\n     */\n    function setClaimFee(uint256 _fee) external;\n\n    /**\n     * @notice Called by governance to set the withdraw period and safety\n     * period, which are always interchanging.\n     * The safety period is time that the committee can submit claims for \n     * bounty payouts, and during which withdrawals are disabled and the\n     * bounty split cannot be changed.\n     * @param _withdrawPeriod Amount of time during which withdrawals are\n     * enabled, and the bounty split can be changed by the governance. Must be\n     * at least 1 hour.\n     * @param _safetyPeriod Amount of time during which claims for bounties \n     * can be submitted and withdrawals are disabled. Must be at most 6 hours.\n     */\n    function setWithdrawSafetyPeriod(\n        uint32 _withdrawPeriod,\n        uint32 _safetyPeriod\n    ) \n        external;\n\n    /**\n     * @notice Called by governance to set vesting params for rewarding hackers\n     * with rewardToken, for all vaults\n     * @param _duration Duration of the vesting period. Must be less than 180\n     * days.\n     * @param _periods The number of vesting periods. Must be more than 0 and \n     * less then the vesting duration.\n     */\n    function setHatVestingParams(uint32 _duration, uint32 _periods) external;\n\n    /**\n     * @notice Called by governance to set the timelock delay for setting the\n     * max bounty (the time between setPendingMaxBounty and setMaxBounty)\n     * @param _delay The time period for the delay. Must be at least 2 days.\n     */\n    function setMaxBountyDelay(uint32 _delay) external;\n\n    /**\n     * @notice Create a new vault\n     * NOTE: Vaults should not use tokens which do not guarantee that the \n     * amount specified is the amount transferred\n     * @param _vaultParams The vault initialization parameters\n     * @param _vaultParams The vault token initialization parameters\n     * @return vault The address of the new vault\n     */\n    function createVault(\n        IHATVault.VaultInitParams calldata _vaultParams,\n        IHATClaimsManager.ClaimsManagerInitParams calldata _claimsManagerParams\n    ) external returns(address vault, address vaultClaimsManager);\n\n    /**\n     * @notice Called by governance to change the UI visibility of a vault\n     * @param _vault The address of the vault to update\n     * @param _visible Is this vault visible in the UI\n     * This parameter can be used by the UI to include or exclude the vault\n     */\n    function setVaultVisibility(address _vault, bool _visible) external;\n\n    /**\n     * @notice Transfer the part of the bounty that is supposed to be swapped\n     * into HAT tokens from the HATVault to the registry, and keep track of\n     * the amounts to be swapped and sent/burnt in a later transaction\n     * @param _asset The vault's native token\n     * @param _hacker The address of the beneficiary of the bounty\n     * @param _hackersHatReward The amount of the vault's native token to be\n     * swapped to HAT tokens and sent to the hacker via a vesting contract\n     * @param _governanceHatReward The amount of the vault's native token to\n     * be swapped to HAT tokens and sent to governance\n     */\n    function addTokensToSwap(\n        IERC20 _asset,\n        address _hacker,\n        uint256 _hackersHatReward,\n        uint256 _governanceHatReward\n    ) external;\n\n    /**\n     * @notice Called by governance to swap the given asset to HAT tokens and \n     * distribute the HAT tokens: Send to governance their share and send to\n     * beneficiaries their share through a vesting contract.\n     * @param _asset The address of the token to be swapped to HAT tokens\n     * @param _beneficiaries Addresses of beneficiaries\n     * @param _amountOutMinimum Minimum amount of HAT tokens at swap\n     * @param _routingContract Routing contract to call for the swap\n     * @param _routingPayload Payload to send to the _routingContract for the\n     * swap\n     */\n    function swapAndSend(\n        address _asset,\n        address[] calldata _beneficiaries,\n        uint256 _amountOutMinimum,\n        address _routingContract,\n        bytes calldata _routingPayload\n    ) external;\n  \n    /**\n     * @notice Returns the withdraw enable period for all vaults. The safety\n     * period starts when finished.\n     * @return Withdraw enable period for all vaults\n     */\n    function getWithdrawPeriod() external view returns (uint256);\n\n    /**\n     * @notice Returns the withdraw disable period - time for the committee to\n     * gather and decide on actions, withdrawals are not possible in this\n     * time. The withdraw period starts when finished.\n     * @return Safety period for all vaults\n     */\n    function getSafetyPeriod() external view returns (uint256);\n\n    /**\n     * @notice Returns the withdraw request enable period for all vaults -\n     * period of time after withdrawRequestPendingPeriod where it is possible\n     * to withdraw, and after which withdrawals are not possible.\n     * @return Withdraw request enable period for all vaults\n     */\n    function getWithdrawRequestEnablePeriod() external view returns (uint256);\n\n    /**\n     * @notice Returns the withdraw request pending period for all vaults -\n     * period of time that has to pass after withdraw request until withdraw\n     * is possible\n     * @return Withdraw request pending period for all vaults\n     */\n    function getWithdrawRequestPendingPeriod() external view returns (uint256);\n\n    /**\n     * @notice Returns the set max bounty delay for all vaults - period of\n     * time that has to pass after setting a pending max bounty before it can\n     * be set as the new max bounty\n     * @return Set max bounty delay for all vaults\n     */\n    function getSetMaxBountyDelay() external view returns (uint256);\n\n    /**\n     * @notice Returns the number of vaults that have been previously created\n     * @return The number of vaults in the registry\n     */\n    function getNumberOfVaults() external view returns(uint256);\n\n    /**\n     * @notice Get the fee setter address\n     * @return The address of the fee setter\n     */\n    function feeSetter() external view returns(address);\n\n    /**\n     * @notice Get whether the system is in an emergency pause\n     * @return Whether the system is in an emergency pause\n     */\n    function isEmergencyPaused() external view returns(bool);\n\n    /**\n     * @notice Get the owner address\n     * @return The address of the owner\n     */\n    function owner() external view returns(address);\n\n    /**\n     * @notice Get the default percentage of the total bounty to be swapped to HATs and sent to governance\n     * @return The default percentage of the total bounty to be swapped to HATs and sent to governance\n     */\n    function defaultBountyGovernanceHAT() external view returns(uint16);\n\n    /**\n     * @notice Get the default percentage of the total bounty to be swapped to HATs and sent to the hacker via vesting contract\n     * @return The default percentage of the total bounty to be swapped to HATs and sent to the hacker via vesting contract\n     */\n    function defaultBountyHackerHATVested() external view returns(uint16);\n\n    /**\n     * @notice Get the default arbitrator address\n     * @return The default arbitrator address\n     */\n    function defaultArbitrator() external view returns(address);\n\n    /**\n     * @notice Get the default challenge period\n     * @return The default challenge period\n     */\n    function defaultChallengePeriod() external view returns(uint32);\n\n    /**\n     * @notice Get the default challenge time out period\n     * @return The default challenge time out period\n     */\n    function defaultChallengeTimeOutPeriod() external view returns(uint32);\n}\n"
      },
      "contracts/interfaces/IRewardController.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.16;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface IRewardController {\n    \n    error EpochLengthZero();\n    // Not enough rewards to transfer to user\n    error NotEnoughRewardsToTransferToUser();\n\n    event RewardControllerCreated(\n        address _rewardToken,\n        address _governance,\n        uint256 _startBlock,\n        uint256 _epochLength,\n        uint256[24] _epochRewardPerBlock\n    );\n    event SetEpochRewardPerBlock(uint256[24] _epochRewardPerBlock);\n    event SetAllocPoint(address indexed _vault, uint256 _prevAllocPoint, uint256 _allocPoint);\n    event VaultUpdated(address indexed _vault, uint256 _rewardPerShare, uint256 _lastProcessedVaultUpdate);\n    event UserBalanceCommitted(address indexed _vault, address indexed _user, uint256 _unclaimedReward, uint256 _rewardDebt);\n    event ClaimReward(address indexed _vault, address indexed _user, uint256 _amount);\n\n    /**\n     * @notice Initializes the reward controller\n     * @param _rewardToken The address of the ERC20 token to be distributed as rewards\n     * @param _governance The hats governance address, to be given ownership of the reward controller\n     * @param _startRewardingBlock The block number from which to start rewarding\n     * @param _epochLength The length of a rewarding epoch\n     * @param _epochRewardPerBlock The reward per block for each of the 24 epochs\n     */\n    function initialize(\n        address _rewardToken,\n        address _governance,\n        uint256 _startRewardingBlock,\n        uint256 _epochLength,\n        uint256[24] calldata _epochRewardPerBlock\n    ) external;\n\n    /**\n     * @notice Called by the owner to set the allocation points for a vault, meaning the\n     * vault's relative share of the total rewards\n     * @param _vault The address of the vault\n     * @param _allocPoint The allocation points for the vault\n     */\n    function setAllocPoint(address _vault, uint256 _allocPoint) external;\n\n    /**\n    * @notice Update the vault's reward per share, not more then once per block\n    * @param _vault The vault's address\n    */\n    function updateVault(address _vault) external;\n\n    /**\n    * @notice Called by the owner to set reward per epoch\n    * Reward can only be set for epochs which have not yet started\n    * @param _epochRewardPerBlock reward per block for each epoch\n    */\n    function setEpochRewardPerBlock(uint256[24] calldata _epochRewardPerBlock) external;\n\n    /**\n    * @notice Called by the vault to update a user claimable reward after deposit or withdraw.\n    * This call should never revert.\n    * @param _user The user address to updare rewards for\n    * @param _sharesChange The user of shared the user deposited or withdrew\n    * @param _isDeposit Whether user deposited or withdrew\n    */\n    function commitUserBalance(address _user, uint256 _sharesChange, bool _isDeposit) external;\n    /**\n    * @notice Transfer to the specified user their pending share of rewards.\n    * @param _vault The vault address\n    * @param _user The user address to claim for\n    */\n    function claimReward(address _vault, address _user) external;\n\n    /**\n    * @notice Calculate rewards for a vault by iterating over the history of totalAllocPoints updates,\n    * and sum up all rewards periods from vault.lastRewardBlock until current block number.\n    * @param _vault The vault address\n    * @param _fromBlock The block from which to start calculation\n    * @return reward The amount of rewards for the vault\n    */\n    function getVaultReward(address _vault, uint256 _fromBlock) external view returns(uint256 reward);\n\n    /**\n    * @notice Calculate the amount of rewards a user can claim for having contributed to a specific vault\n    * @param _vault The vault address\n    * @param _user The user for which the reward is calculated\n    */\n    function getPendingReward(address _vault, address _user) external view returns (uint256);\n\n    /**\n    * @notice Called by the owner to transfer any tokens held in this contract to the owner\n    * @param _token The token to sweep\n    * @param _amount The amount of token to sweep\n    */\n    function sweepToken(IERC20Upgradeable _token, uint256 _amount) external;\n\n}\n"
      }
    }
  }}