creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IAccountManager.sol": {
        "content": "pragma solidity ^0.8.10;\n\nimport { IDataStructures } from './IDataStructures.sol';\n\n// SPDX-License-Identifier: BUSL-1.1\n\ninterface IAccountManager {\n    /// @dev Get LifecycleStatus of a KNOT by public key\n    /// @param _blsPublicKey - Public Key of the Validator\n    function blsPublicKeyToLifecycleStatus(bytes calldata _blsPublicKey) external view returns (IDataStructures.LifecycleStatus);\n\n    /// @dev Get Account by public key\n    /// @param _blsPublicKey - Public key of the validator\n    function getAccountByPublicKey(bytes calldata _blsPublicKey) external view returns (IDataStructures.Account memory);\n\n    /// @notice Get all last known state about a KNOT\n    /// @param _blsPublicKey Public key of the validator\n    function getLastKnownStateByPublicKey(bytes calldata _blsPublicKey) external view returns (IDataStructures.ETH2DataReport memory);\n\n    /// @dev Get the number of deposits registered on this contract\n    function numberOfAccounts() external view returns (uint256);\n\n    /// @dev Get the specific Account from the Account array\n    /// @param _index - Index of the account to be fetched\n    function getAccount(uint256 _index) external view returns(IDataStructures.Account memory);\n\n    /// @dev Get the block Account happened\n    /// @param _blsPublicKey - public key of the user\n    function getDepositBlock(bytes calldata _blsPublicKey) external view returns (uint256);\n\n    /// @notice Returns the last known active balance for a KNOT that came from a balance reporting adaptor\n    /// @param _blsPublicKey - public key of the validator\n    function getLastKnownActiveBalance(bytes calldata _blsPublicKey) external view returns (uint64);\n\n    /// @notice Returns the last report epoch for a KNOT that came from a balance reporting adaptor\n    /// @param _blsPublicKey - public key of the validator\n    function getLastReportEpoch(bytes calldata _blsPublicKey) external view returns (uint64);\n\n    /// @dev External function to check if the derivative tokens were claimed\n    /// @param _blsPublicKey - BLS public key used for validation\n    function claimedTokens(bytes calldata _blsPublicKey) external view returns (bool);\n\n    /// @notice Obtain the original BLS signature generated for the 32 ETH deposit to the Ethereum Foundation deposit contract\n    function getSignatureByBLSKey(bytes calldata _blsPublicKey) external view returns (bytes memory);\n\n    /// @dev Function to check if the key is already deposited\n    /// @param _blsPublicKey - BLS public key of the validator\n    function isKeyDeposited(bytes calldata _blsPublicKey) external view returns (bool);\n\n    /// @dev Check if validator initials have been registered\n    /// @param _blsPublicKey - BLS public key of the validator\n    function areInitialsRegistered(bytes calldata _blsPublicKey) external view returns (bool);\n}\n"
      },
      "@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IBalanceReporter.sol": {
        "content": "pragma solidity ^0.8.10;\n\n// SPDX-License-Identifier: BUSL-1.1\n\nimport { IDataStructures } from \"./IDataStructures.sol\";\n\ninterface IBalanceReporter {\n    /// @notice Report an increased KNOT balance that has come from beacon chain inflation rewards\n    /// @dev This method only cares about active balance increases when effective balance is 32 (otherwise a slashing or leaking is assumed to have happened)\n    /// @param _stakeHouse Associated StakeHouse for the KNOT\n    /// @param _blsPublicKey BLS public key of the KNOT\n    /// @param _eth2Report Beacon chain report for the given KNOT\n    /// @param _signatureMetadata Signature over ETH2 data report ensuring the integrity of the data against a public node\n    function balanceIncrease(\n        address _stakeHouse,\n        bytes calldata _blsPublicKey,\n        IDataStructures.ETH2DataReport calldata _eth2Report,\n        IDataStructures.EIP712Signature calldata _signatureMetadata\n    ) external;\n\n    /// @notice When a KNOT has voluntarily withdrawn from the beacon chain, it can be reported here (for a healthy KNOT i.e. no bal reduction / slashing)\n    /// @dev Assumption is that no slashing has happened and if it has, the appropriate slashing method should be called\n    /// @param _stakeHouse Associated StakeHouse for the KNOT\n    /// @param _blsPublicKey BLS public key of the KNOT\n    /// @param _eth2Report Beacon chain report for the given KNOT\n    /// @param _signatureMetadata Authenticating the beacon chain report\n    function voluntaryWithdrawal(\n        address _stakeHouse,\n        bytes calldata _blsPublicKey,\n        IDataStructures.ETH2DataReport calldata _eth2Report,\n        IDataStructures.EIP712Signature calldata _signatureMetadata\n    ) external;\n\n    /// @dev Adaptor extension for reporting a balance reduction and or slashing\n    /// @param _stakeHouse Associated StakeHouse for the KNOT\n    /// @param _blsPublicKey BLS public key of the KNOT\n    /// @param _eth2Report Beacon chain report for the given KNOT\n    /// @param _signatureMetadata Authenticating the beacon chain report\n    function slash(\n        address _stakeHouse,\n        bytes calldata _blsPublicKey,\n        IDataStructures.ETH2DataReport calldata _eth2Report,\n        IDataStructures.EIP712Signature calldata _signatureMetadata\n    ) external;\n\n    /// @notice Allows for reporting of a balance reduction of a validator that is still performing duties + topping up that SLOT at the same time\n    /// @param _stakeHouse Associated StakeHouse for the KNOT\n    /// @param _blsPublicKey BLS public key of the KNOT\n    /// @param _slasher Address slashing the validator's collateralised SLOT registry\n    /// @param _buyAmount Amount of SLOT purchasing in the same transaction which is not the same as amount being slashed (dictated by latest balance)\n    /// @param _eth2Report Beacon chain report for the given KNOT\n    /// @param _signatureMetadata Authenticating the beacon chain report\n    function slashAndTopUpSlot(\n        address _stakeHouse,\n        bytes calldata _blsPublicKey,\n        address _slasher,\n        uint256 _buyAmount,\n        IDataStructures.ETH2DataReport calldata _eth2Report,\n        IDataStructures.EIP712Signature calldata _signatureMetadata\n    ) external payable;\n\n    /// @dev Adaptor extension for topping up slashed SLOT tokens\n    /// @param _stakeHouse Associated StakeHouse for the KNOT\n    /// @param _blsPublicKey BLS public key of the KNOT\n    /// @param _recipient - Address receiving the collateralised SLOT tokens\n    /// @param _amount - Amount being bought\n    function topUpSlashedSlot(\n        address _stakeHouse,\n        bytes calldata _blsPublicKey,\n        address _recipient,\n        uint256 _amount\n    ) external payable;\n\n    /// @notice for a healthy and active KNOT that wants to exit the StakeHouse universe and burn all their dETH and SLOT, use this method\n    /// @dev This method assumes msg.sender owns all tokens\n    /// @param _stakeHouse Associated StakeHouse for the KNOT\n    /// @param _blsPublicKey BLS public key of the KNOT\n    /// @param _eth2Report Beacon chain report for the given KNOT\n    /// @param _signatureMetadata Authenticating the beacon chain report\n    function rageQuitKnot(\n        address _stakeHouse,\n        bytes calldata _blsPublicKey,\n        IDataStructures.ETH2DataReport calldata _eth2Report,\n        IDataStructures.EIP712Signature calldata _signatureMetadata\n    ) external payable;\n\n    /// @notice for a healthy and active KNOT that wants to exit the StakeHouse universe and burn all their dETH and SLOT, use this method if multi party coordination is required via signatures\n    /// @param _stakeHouse Address of the registry containing the KNOT\n    /// @param _blsPublicKey BLS public key of the KNOT that is part of the house\n    /// @param _ethRecipient Account that will be the recipient of the ETH that comes from the beacon chain balance of the BLS public key\n    /// @param _eth2Report Beacon chain report containing the latest state of the KNOT\n    /// @param _reportAndTokenHolderSignatures Signatures for report, free floating slot owner, savETH index owner and collateralised SLOT holders\n    function multipartyRageQuit(\n        address _stakeHouse,\n        bytes calldata _blsPublicKey,\n        address _ethRecipient,\n        address _freeFloatingSlotOwner,\n        IDataStructures.ETH2DataReport calldata _eth2Report,\n        IDataStructures.EIP712Signature[] calldata _reportAndTokenHolderSignatures\n    ) external payable;\n\n    /// @notice Allows a KNOT owner to manually top up a KNOT by sending ETH to the Ethereum Foundation deposit contract\n    /// @param _blsPublicKey KNOT ID i.e. BLS public key of the validator\n    function topUpKNOT(bytes calldata _blsPublicKey) external payable;\n}\n"
      },
      "@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IDataStructures.sol": {
        "content": "pragma solidity ^0.8.10;\n\n// SPDX-License-Identifier: BUSL-1.1\n\ninterface IDataStructures {\n    /// @dev Data structure used for ETH2 data reporting\n    struct ETH2DataReport {\n        bytes blsPublicKey; /// Public key of the validator\n        bytes withdrawalCredentials; /// Withdrawal credentials submitted to the beacon chain\n        bool slashed; /// Slashing status\n        uint64 activeBalance; /// Validator active balance\n        uint64 effectiveBalance; /// Validator effective balance\n        uint64 exitEpoch; /// Exit epoch of the validator\n        uint64 activationEpoch; /// Activation Epoch of the validator\n        uint64 withdrawalEpoch; /// Withdrawal Epoch of the validator\n        uint64 currentCheckpointEpoch; /// Epoch of the checkpoint during data reporting\n    }\n\n    /// @dev Signature over the hash of essential data\n    struct EIP712Signature {\n        // we are able to pack these two unsigned ints into a\n        uint248 deadline; // deadline defined in ETH1 blocks\n        uint8 v; // signature component 1\n        bytes32 r; // signature component 2\n        bytes32 s; // signature component 3\n    }\n\n    /// @dev Data Structure used for Accounts\n    struct Account {\n        address depositor; /// ECDSA address executing the deposit\n        bytes blsSignature; /// BLS signature over the SSZ \"DepositMessage\" container\n        uint256 depositBlock; /// Block During which the deposit to EF Deposit Contract was completed\n    }\n\n    /// @dev lifecycle status enumeration of the user\n    enum LifecycleStatus {\n        UNBEGUN,\n        INITIALS_REGISTERED,\n        DEPOSIT_COMPLETED,\n        TOKENS_MINTED,\n        EXITED\n    }\n}\n"
      },
      "@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/ISavETHManager.sol": {
        "content": "pragma solidity ^0.8.10;\n\n// SPDX-License-Identifier: BUSL-1.1\n\ninterface ISavETHManager {\n    /// @notice Allows any account to create a savETH index in order to group KNOTs together that earn exclusive dETH rewards. The index will be owned by _owner\n    /// @param _owner Address that will own the new index. ID of the index is auto generated and assigned to this account\n    function createIndex(address _owner) external returns (uint256);\n\n    /// @notice Allow an owner of an index to approve another account to transfer ownership (like a marketplace)\n    /// @param _indexId ID of the index being approved\n    /// @param _spender Authorised spender or zero address to clear approval\n    function approveForIndexOwnershipTransfer(\n        uint256 _indexId,\n        address _spender\n    ) external;\n\n    /// @notice Transfer ownership of an index of KNOTs to a new owner\n    /// @param _indexId ID of the index having ownership transferred\n    /// @param _to Account receiving ownership of the index\n    function transferIndexOwnership(uint256 _indexId, address _to) external;\n\n    /// @notice Allows an index owner or KNOT spender to transfer ownership of a KNOT to another index\n    /// @param _stakeHouse Registry that the KNOT is part of\n    /// @param _blsPublicKey of the KNOT\n    /// @param _newIndexId ID of the index receiving the KNOT\n    function transferKnotToAnotherIndex(\n        address _stakeHouse,\n        bytes calldata _blsPublicKey,\n        uint256 _newIndexId\n    ) external;\n\n    /// @notice Allows an index owner to approve a marketplace to transfer ownership of a KNOT from one index to another\n    /// @param _stakeHouse Registry that the KNOT is part of\n    /// @param _blsPublicKey of the KNOT\n    /// @param _spender Account that can transfer the knot that is isolated within an index\n    function approveSpendingOfKnotInIndex(\n        address _stakeHouse,\n        bytes calldata _blsPublicKey,\n        address _spender\n    ) external;\n\n    /// @notice Move a KNOT that is part of an index into the open index in order to get access to the savETH <> dETH\n    /// @param _stakeHouse Registry that the KNOT is part of\n    /// @param _blsPublicKey of the KNOT\n    /// @param _recipient Address receiving savETH\n    function addKnotToOpenIndex(\n        address _stakeHouse,\n        bytes calldata _blsPublicKey,\n        address _recipient\n    ) external;\n\n    /// @notice Given a KNOT that is part of the open index, allow a savETH holder to isolate the KNOT into their own index gaining exclusive rights to the network inflation rewards\n    /// @param _stakeHouse Address of StakeHouse that the KNOT belongs to\n    /// @param _blsPublicKey KNOT ID within the StakeHouse\n    /// @param _targetIndexId ID of the index that the KNOT will be added to\n    function isolateKnotFromOpenIndex(\n        address _stakeHouse,\n        bytes calldata _blsPublicKey,\n        uint256 _targetIndexId\n    ) external;\n\n    /// @notice In a single transaction, add knot to open index and withdraw dETH in registry\n    /// @param _stakeHouse Address of StakeHouse that the KNOT belongs to\n    /// @param _blsPublicKey KNOT ID that belongs to an index\n    /// @param _recipient Recipient of dETH tokens\n    function addKnotToOpenIndexAndWithdraw(\n        address _stakeHouse,\n        bytes calldata _blsPublicKey,\n        address _recipient\n    ) external;\n\n    /// @notice In a single transaction, deposit dETH and isolate a knot into an index\n    /// @param _stakeHouse Address of StakeHouse that the KNOT belongs to\n    /// @param _blsPublicKey KNOT ID that requires adding to an index\n    /// @param _indexId ID of the index that the KNOT is being added into\n    function depositAndIsolateKnotIntoIndex(\n        address _stakeHouse,\n        bytes calldata _blsPublicKey,\n        uint256 _indexId\n    ) external;\n\n    /// @notice Allows a SaveETH holder to exchange some or all of their SaveETH for dETH\n    /// @param _amount of SaveETH to burn\n    function withdraw(address _recipient, uint128 _amount) external;\n\n    /// @notice Deposit dETH in exchange for SaveETH\n    /// @param _amount of dETH being deposited\n    function deposit(address _recipient, uint128 _amount) external;\n\n    /// @notice Total number of dETH rewards minted for knot from inflation rewards\n    function dETHRewardsMintedForKnot(bytes calldata _blsPublicKey) external view returns (uint256);\n\n    /// @notice Approved spender that can transfer ownership of a KNOT from one index to another (a marketplace for example)\n    function approvedKnotSpender(bytes calldata _blsPublicKey) external view returns (address);\n\n    /// @notice Approved spender that can transfer ownership of an entire index (a marketplace for example)\n    function approvedIndexSpender(uint256 _indexId) external view returns (address);\n\n    /// @notice Given an index identifier, returns the owner of the index or zero address if index not created\n    function indexIdToOwner(uint256 _indexId) external view returns (address);\n\n    /// @notice Total dETH isolated for a knot associated with an index. Returns zero if knot is not part of an index\n    function knotDETHBalanceInIndex(uint256 _indexId, bytes calldata _blsPublicKey) external view returns (uint256);\n\n    /// @notice ID of KNOT associated index. Zero if part of open index or non zero if part of a user-owned index\n    function associatedIndexIdForKnot(bytes calldata _blsPublicKey) external view returns (uint256);\n\n    /// @notice Returns true if KNOT is part of the open index where they can spend their savETH. Otherwise they are part of a user owned index\n    function isKnotPartOfOpenIndex(bytes calldata _blsPublicKey) external view returns (bool);\n\n    /// @notice Total number of dETH deposited into the open index that is not part of user owned indices\n    function dETHUnderManagementInOpenIndex() external view returns (uint256);\n\n    /// @notice Total number of dETH minted across all KNOTs\n    function dETHInCirculation() external view returns (uint256);\n\n    /// @notice Total amount of dETH isolated in user owned indices\n    function totalDETHInIndices() external view returns (uint256);\n\n    /// @notice Helper to convert dETH to savETH based on the current exchange rate\n    function dETHToSavETH(uint256 _amount) external view returns (uint256);\n\n    /// @notice Helper to convert savETH to dETH based on the current exchange rate\n    function savETHToDETH(uint256 _amount) external view returns (uint256);\n\n    /// @notice Address of the dETH token\n    function dETHToken() external view returns (address);\n\n    /// @notice Address of the savETH token\n    function savETHToken() external view returns (address);\n}\n"
      },
      "@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/ISlotSettlementRegistry.sol": {
        "content": "pragma solidity ^0.8.10;\n\n// SPDX-License-Identifier: BUSL-1.1\n\ninterface ISlotSettlementRegistry {\n\n    ////////////\n    // Events //\n    ////////////\n\n    /// @notice Collateralised SLOT deducted from a collateralised SLOT owner\n    event SlotSlashed(bytes memberId, uint256 amount);\n\n    /// @notice Collateralised SLOT purchased from KNOT\n    event SlashedSlotPurchased(bytes memberId, uint256 amount);\n\n    /// @notice KNOT has exited the protocol exercising their redemption rights\n    event RageQuitKnot(bytes memberId);\n\n    event CollateralisedOwnerAddedToKnot(bytes knotId, address indexed owner);\n\n    /// @notice User is able to trigger beacon chain withdrawal\n    event UserEnabledForWithdrawal(address indexed user, bytes memberId);\n\n    /// @notice User has withdrawn ETH from beacon chain - do not allow any more withdrawals\n    event UserWithdrawn(address indexed user, bytes memberId);\n\n    ////////////\n    // View   //\n    ////////////\n\n    /// @notice Total collateralised SLOT owned by an account across all KNOTs in a given StakeHouse\n    function totalUserCollateralisedSLOTBalanceInHouse(address _stakeHouse, address _user) external view returns (uint256);\n\n    /// @notice Total collateralised SLOT owned by an account for a given KNOT in a Stakehouse\n    function totalUserCollateralisedSLOTBalanceForKnot(address _stakeHouse, address _user, bytes calldata _blsPublicKey) external view returns (uint256);\n\n    // @notice Given a KNOT and account, a flag represents whether the account has been a collateralised SLOT owner at some point in the past\n    function isCollateralisedOwner(bytes calldata blsPublicKey, address _user) external view returns (bool);\n\n    /// @notice If a user account has been able to rage quit a KNOT, this flag is set to true to allow beacon chain funds to be claimed\n    function isUserEnabledForKnotWithdrawal(address _user, bytes calldata _blsPublicKey) external view returns (bool);\n\n    /// @notice Once beacon chain funds have been redeemed, this flag is set to true in order to block double withdrawals\n    function userWithdrawn(address _user, bytes calldata _blsPublicKey) external view returns (bool);\n\n    /// @notice Total number of collateralised SLOT owners for a given KNOT\n    /// @param _blsPublicKey BLS public key of the KNOT\n    function numberOfCollateralisedSlotOwnersForKnot(bytes calldata _blsPublicKey) external view returns (uint256);\n\n    /// @notice Fetch a collateralised SLOT owner address for a specific KNOT at a specific index\n    function getCollateralisedOwnerAtIndex(bytes calldata _blsPublicKey, uint256 _index) external view returns (address);\n\n    /// @dev Get the sum of total collateralized SLOT balances for multiple sETH tokens for specific owner\n    /// @param _sETHList List of sETH token addresses from different Stakehouses\n    /// @param _owner Address that has an sETH token balance within the sETH list\n    function getCollateralizedSlotAccumulation(address[] calldata _sETHList, address _owner) external view returns (uint256);\n\n    /// @notice Total amount of SLOT that has been slashed but not topped up yet\n    /// @param _blsPublicKey BLS public key of KNOT\n    function currentSlashedAmountForKnot(bytes calldata _blsPublicKey) external view returns (uint256 currentSlashedAmount);\n\n    /// @notice Total amount of collateralised sETH owned by an account for a given KNOT\n    /// @param _stakeHouse Address of Stakehouse registry contract\n    /// @param _user Collateralised SLOT owner address\n    /// @param _blsPublicKey BLS pub key of the validator\n    function totalUserCollateralisedSETHBalanceForKnot(\n        address _stakeHouse,\n        address _user,\n        bytes calldata _blsPublicKey\n    ) external view returns (uint256);\n\n    /// @notice Total collateralised sETH owned by a user across all KNOTs in the house\n    /// @param _stakeHouse Address of the Stakehouse registry\n    /// @param _user Collateralised SLOT owner in house\n    function totalUserCollateralisedSETHBalanceInHouse(\n        address _stakeHouse,\n        address _user\n    ) external view returns (uint256);\n\n    /// @notice The total collateralised sETH circulating for the house i.e. (8 * number of knots) - total slashed\n    /// @param _stakeHouse Address of the Stakehouse registry in order to fetch its exchange rate\n    function totalCollateralisedSETHForStakehouse(\n        address _stakeHouse\n    ) external view returns (uint256);\n\n    /// @notice Minimum amount of collateralised sETH a user must hold at a house level in order to rage quit a healthy knot\n    function sETHRedemptionThreshold(address _stakeHouse) external view returns (uint256);\n\n    /// @notice Given the total SLOT in the house (8 * number of KNOTs), how much is in circulation when filtering out total slashed\n    /// @param _stakeHouse Address of the Stakehouse registry\n    function circulatingSlot(\n        address _stakeHouse\n    ) external view returns (uint256);\n\n    /// @notice Given the total amount of collateralised SLOT in the house (4 * number of KNOTs), how much is in circulation when filtering out total slashed\n    /// @param _stakeHouse Address of the Stakehouse registry\n    function circulatingCollateralisedSlot(\n        address _stakeHouse\n    ) external view returns (uint256);\n\n    /// @notice Amount of sETH required per SLOT at the house level in order to rage quit\n    /// @param _stakeHouse Address of the Stakehouse registry in order to fetch its exchange rate\n    function redemptionRate(address _stakeHouse) external view returns (uint256);\n\n    /// @notice Amount of sETH per SLOT for a given house calculated as total dETH minted in house / total SLOT from all KNOTs\n    /// @param _stakeHouse Address of the Stakehouse registry in order to fetch its exchange rate\n    function exchangeRate(address _stakeHouse) external view returns (uint256);\n\n    /// @notice Returns the address of the sETH token for a given Stakehouse registry\n    function stakeHouseShareTokens(address _stakeHouse) external view returns (address);\n\n    /// @notice Returns the address of the associated house for an sETH token\n    function shareTokensToStakeHouse(address _sETHToken) external view returns (address);\n\n    /// @notice Returns the total amount of SLOT slashed at the Stakehouse level\n    function stakeHouseCurrentSLOTSlashed(address _stakeHouse) external view returns (uint256);\n\n    /// @notice Returns the total amount of SLOT slashed for a KNOT\n    function currentSlashedAmountOfSLOTForKnot(bytes calldata _blsPublicKey) external view returns (uint256);\n\n    /// @notice Total dETH minted by adding knots and minting inflation rewards within a house\n    function dETHMintedInHouse(address _stakeHouse) external view returns (uint256);\n\n    /// @notice Total SLOT minted for all KNOTs that have not rage quit the house\n    function activeSlotMintedInHouse(address _stakeHouse) external view returns (uint256);\n\n    /// @notice Total collateralised SLOT minted for all KNOTs that have not rage quit the house\n    function activeCollateralisedSlotMintedInHouse(address _stakeHouse) external view returns (uint256);\n\n    /// @notice Helper for calculating an active sETH balance from a SLOT amount\n    /// @param _stakeHouse Target Stakehouse registry - each has their own exchange rate\n    /// @param _slotAmount SLOT amount in wei\n    function sETHForSLOTBalance(address _stakeHouse, uint256 _slotAmount) external view returns (uint256);\n\n    /// @notice Helper for calculating a SLOT balance from an sETH amount\n    /// @param _stakeHouse Target Stakehouse registry - each has their own exchange rate\n    /// @param _sETHAmount sETH amount in wei\n    function slotForSETHBalance(address _stakeHouse, uint256 _sETHAmount) external view returns (uint256);\n\n}\n"
      },
      "@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IStakeHouseRegistry.sol": {
        "content": "pragma solidity ^0.8.10;\n\n// SPDX-License-Identifier: BUSL-1.1\n\ninterface IStakeHouseRegistry {\n\n    ////////////\n    // Events //\n    ////////////\n\n    /// @notice A new member was added to the registry\n    event MemberAdded(uint256 indexed knotIndex);\n\n    /// @notice A member was kicked due to an action in another core module\n    event MemberKicked(uint256 indexed knotIndex);\n\n    /// @notice A member decided that they did not want to be part of the protocol\n    event MemberRageQuit(uint256 indexed knotIndex);\n\n    ////////////\n    // View   //\n    ////////////\n\n    /// @notice number of members of a StakeHouse\n    function numberOfMemberKNOTs() external view returns (uint256);\n\n    /// @notice Total number of KNOTs that have rage quit from the house\n    function numberOfRageQuitKnots() external view returns (uint256);\n\n    /// @notice Total number of KNOTs that have been kicked from the house\n    function numberOfKickedKnots() external view returns (uint256);\n\n    /// @notice View for establishing if a future validator is allowed to become a member of a Stakehouse\n    /// @param _blsPubKey of the validator registered on the beacon chain\n    function isMemberPermitted(bytes calldata _blsPubKey) external view returns (bool);\n\n    /// @notice total number of KNOTs in the house that have not rage quit\n    function numberOfActiveKNOTsThatHaveNotRageQuit() external view returns (uint256);\n\n    /// @notice Allows an external entity to check if a member is part of a stake house\n    /// @param _memberId Bytes of the public key of the member\n    function isActiveMember(bytes calldata _memberId) external returns (bool);\n\n    /// @notice Check if a member is part of the registry but not rage quit (this ignores whether they have been kicked)\n    /// @param _memberId Bytes of the public key of the member\n    function hasMemberRageQuit(bytes calldata _memberId) external view returns (bool);\n\n    /// @notice Get all info about a member at its assigned index\n    function getMemberInfoAtIndex(uint256 _memberKNOTIndex) external view returns (\n        address applicant,      // Address of ETH account that added the member to the StakeHouse\n        uint256 knotMemberIndex,// KNOT Index of the member within the StakeHouse\n        uint16 flags,           // Flags associated with the member\n        bool isActive           // Whether the member is active or knot\n    );\n\n    /// @notice Get all info about a member given its unique ID (validator pub key)\n    function getMemberInfo(bytes memory _memberId) external view returns (\n        address applicant,      // Address of ETH account that added the member to the StakeHouse\n        uint256 knotMemberIndex,// KNOT Index of the member within the StakeHouse\n        uint16 flags,           // Flags associated with the member\n        bool isActive           // Whether the member is active or knot\n    );\n\n    ////////////\n    // Modify //\n    ////////////\n\n    /// @notice Called by house owner to set up a gate keeper smart contracts used when adding members\n    /// @param _gateKeeper Address of gate keeper contract that will perform member checks. Set to zero to disable\n    function setGateKeeper(address _gateKeeper) external;\n}\n"
      },
      "@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IStakeHouseUniverse.sol": {
        "content": "pragma solidity ^0.8.10;\n\n// SPDX-License-Identifier: BUSL-1.1\n\ninterface IStakeHouseUniverse {\n\n    ////////////\n    // Events //\n    ////////////\n\n    /// @notice Emitted when all of the core modules are initialised\n    event CoreModulesInit();\n\n    /// @notice Emitted after a Stakehouse has been deployed. A share token and brand are also deployed\n    event NewStakeHouse(address indexed stakeHouse, uint256 indexed brandId);\n\n    /// @notice Emitted after a member is added to an existing Stakehouse\n    event MemberAddedToExistingStakeHouse(address indexed stakeHouse);\n\n    /// @notice Emitted after a member is added to an existing house but a brand was created\n    event MemberAddedToExistingStakeHouseAndBrandCreated(address indexed stakeHouse, uint256 indexed brandId);\n\n    ////////////\n    // View   //\n    ////////////\n\n    /// @notice Number of StakeHouses in the universe\n    function numberOfStakeHouses() external view returns (uint256);\n\n    /// @notice Returns the address of a StakeHouse assigned to an index\n    /// @param _index Query which must be greater than zero\n    function stakeHouseAtIndex(uint256 _index) external view returns (address);\n\n    /// @notice number of members of a StakeHouse (aggregate number of KNOTs)\n    /// @dev This enumerable method is used along with `numberOfStakeHouses`\n    /// @param _index of a StakeHouse\n    /// @return uint256 The number of total KNOTs / members of a StakeHouse\n    function numberOfSubKNOTsAtIndex(uint256 _index) external view returns (uint256);\n\n    /// @notice Given a StakeHouse index and a member index (i.e. coordinates to a member), return the member ID\n    /// @param _index Coordinate assigned to Stakehouse\n    /// @param _subIndex Coordinate assigned to a member of a Stakehouse\n    function subKNOTAtIndexCoordinates(uint256 _index, uint256 _subIndex) external view returns (bytes memory);\n\n    /// @notice Get all info about a StakeHouse KNOT (a member a.k.a a validator) given index coordinates\n    /// @param _index StakeHouse index\n    /// @param _subIndex Member index within the StakeHouse\n    function stakeHouseKnotInfoGivenCoordinates(uint256 _index, uint256 _subIndex) external view returns (\n        address stakeHouse,     // Address of registered StakeHouse\n        address sETHAddress,    // Address of sETH address associated with StakeHouse\n        address applicant,      // Address of ETH account that added the member to the StakeHouse\n        uint256 knotMemberIndex,// KNOT Index of the member within the StakeHouse\n        uint256 flags,          // Flags associated with the member\n        bool isActive           // Whether the member is active or knot\n    );\n\n    // @notice Get all info about a StakeHouse KNOT (a member a.k.a a validator)\n    /// @param _blsPublicKey ID of member (Validator public key) assigned to StakeHouse\n    function stakeHouseKnotInfo(bytes calldata _blsPublicKey) external view returns (\n        address stakeHouse,     // Address of registered StakeHouse\n        address sETHAddress,    // Address of sETH address associated with StakeHouse\n        address applicant,      // Address of ETH account that added the member to the StakeHouse\n        uint256 knotMemberIndex,// KNOT Index of the member within the StakeHouse\n        uint256 flags,          // Flags associated with the member\n        bool isActive           // Whether the member is active or knot\n    );\n\n    /// @notice Returns the address of the Stakehouse that a KNOT is associated with\n    function memberKnotToStakeHouse(bytes calldata _blsPublicKey) external view returns (address);\n}\n"
      },
      "@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/ITransactionRouter.sol": {
        "content": "pragma solidity ^0.8.10;\n\nimport { IDataStructures } from './IDataStructures.sol';\n\n// SPDX-License-Identifier: BUSL-1.1\n\ninterface ITransactionRouter {\n    /// @notice Fetch representative to representee status\n    /// @param _user - User checked for representation\n    /// @param _representative - Address representing the user\n    function userToRepresentativeStatus(address _user, address _representative) external view returns (bool);\n\n    /// @notice Signaling added representative\n    event RepresentativeAdded(address indexed user, address indexed representative);\n\n    /// @notice Signaling removed representative\n    event RepresentativeRemoved(address indexed user, address indexed representative);\n\n    /// @notice Select representative address to perform staking actions for you\n    /// @param _representative - Address representing the user in the staking process\n    /// @param _enabled Whether they are being activated or deactivated\n    function authorizeRepresentative(address _representative, bool _enabled) external;\n\n    /// @notice First user interaction in the process of registering validator\n    /// @param _user - User registering the stake for _blsPublicKey (managed by representative)\n    /// @param _blsPublicKey - BLS public key of the validator\n    function registerValidatorInitials(\n        address _user, bytes calldata _blsPublicKey, bytes calldata _blsSignature\n    ) external;\n\n    /// @notice function to register the ETH2 validator by depositing 32ETH to EF deposit contract\n    /// @param _user - User registering the stake for _blsPublicKey (managed by representative)\n    /// @param _blsPublicKey - BLS validation public key\n    /// @param _ciphertext - Encryption packet for disaster recovery\n    /// @param _aesEncryptorKey - Randomly generated AES key used for BLS signing key encryption\n    /// @param _encryptionSignature - ECDSA signature used for encryption validity, issued by committee\n    /// @param _dataRoot - Root of the DepositMessage SSZ container\n    function registerValidator(\n        address _user,\n        bytes calldata _blsPublicKey,\n        bytes calldata _ciphertext,\n        bytes calldata _aesEncryptorKey,\n        IDataStructures.EIP712Signature calldata _encryptionSignature,\n        bytes32 _dataRoot\n    ) external payable;\n\n    /// @notice Adapter call to core for stakehouse creation\n    /// @notice Direct extension for the function in AccountManager\n    /// @param _user - User registering the stake for _blsPublicKey (managed by representative)\n    /// @param _blsPublicKey - BLS public key of the validator\n    /// @param _ticker - Ticker of the stakehouse to be created\n    /// @param _savETHIndexId ID of the savETH registry index that will receive savETH for the KNOT. Set to zero to create a new index owned by _user\n    /// @param _eth2Report - ETH2 data report for self-validation\n    /// @param _reportSignature - ECDSA signature used for data validity proof by committee\n    function createStakehouse(\n        address _user,\n        bytes calldata _blsPublicKey,\n        string calldata _ticker,\n        uint256 _savETHIndexId,\n        IDataStructures.ETH2DataReport calldata _eth2Report,\n        IDataStructures.EIP712Signature calldata _reportSignature\n    ) external;\n\n    /// @notice Join the house and get derivative tokens\n    /// @notice Direct extension for the function in AccountManager\n    /// @param _user - User registering the stake for _blsPublicKey (managed by representative)\n    /// @param _eth2Report - ETH2 data report for self-validation\n    /// @param _stakehouse - stakehouse address to join\n    /// @param _savETHIndexId ID of the savETH registry index that will receive savETH for the KNOT. Set to zero to create a new index owned by _user\n    /// @param _blsPublicKey - BLS public key of the validator\n    /// @param _reportSignature - ECDSA signature used for data validity proof by committee\n    function joinStakehouse(\n        address _user,\n        bytes calldata _blsPublicKey,\n        address _stakehouse,\n        uint256 _brandTokenId,\n        uint256 _savETHIndexId,\n        IDataStructures.ETH2DataReport calldata _eth2Report,\n        IDataStructures.EIP712Signature calldata _reportSignature\n    ) external;\n\n    /// @notice Join the house and get derivative tokens + create the brand\n    /// @notice Direct extension for the function in AccountManager\n    /// @param _user - User registering the stake for _blsPublicKey (managed by representative)\n    /// @param _blsPublicKey - BLS public key of the validator\n    /// @param _ticker - Ticker of the stakehouse\n    /// @param _stakehouse - Stakehouse address the user wants to join\n    /// @param _savETHIndexId ID of the savETH registry index that will receive savETH for the KNOT. Set to zero to create a new index owned by _user\n    /// @param _eth2Report - ETH2 data report for self-validation\n    /// @param _reportSignature - ECDSA signature used for data validity proof by committee\n    function joinStakeHouseAndCreateBrand(\n        address _user,\n        bytes calldata _blsPublicKey,\n        string calldata _ticker,\n        address _stakehouse,\n        uint256 _savETHIndexId,\n        IDataStructures.ETH2DataReport calldata _eth2Report,\n        IDataStructures.EIP712Signature calldata _reportSignature\n    ) external;\n\n    /// @notice Enable a user that has deposited through checkpoint A to exit via an escape hatch before even minting their derivative tokens\n    /// @param _blsPublicKey Validator public key\n    /// @param _stakehouse House to rage quit against\n    /// @param _eth2Report Beacon chain report showing last known state of the validator\n    /// @param _reportSignature Signature over the ETH 2 data report packet\n    function rageQuitPostDeposit(\n        address _user,\n        bytes calldata _blsPublicKey,\n        address _stakehouse,\n        IDataStructures.ETH2DataReport calldata _eth2Report,\n        IDataStructures.EIP712Signature calldata _reportSignature\n    ) external;\n}\n"
      },
      "@blockswaplab/stakehouse-solidity-api/contracts/Constants.sol": {
        "content": "pragma solidity ^0.8.0;\n\n// SPDX-License-Identifier: BUSL-1.1\n\n/// @dev Library containing constants independent of network\nlibrary GeneralConstants {\n\n    /// @dev Deposit amount required to form a knot (validator) inside the protocol\n    uint256 constant DEPOSIT_AMOUNT = 32 ether;\n\n    /// @dev Consensus-reward base token mint\n    uint256 constant DETH_MINTED_AMOUNT = 24 ether;\n\n    /// @dev SLOT Tokens collect network fees such as gas fees, MEV rewards, etc.\n    uint256 constant SLOT_MINTED_AMOUNT = 8 ether;\n}\n\n/// @dev Library containing address constants for the Ethereum mainnet\nlibrary MainnetConstants {\n\n    /// @dev chain id of the Ethereum mainnet\n    uint256 constant CHAIN_ID = 1;\n\n    /// @dev AccountManager address in the Ethereum mainnet\n    address constant AccountManager = 0xDd6E67942a9566A70446f7400a21240C5f71377C;\n\n    /// @dev SavETHManager address in the Ethereum mainnet\n    address constant SavETHManager = 0x9CbC2Bf747510731eE3A38bf209a299261038369;\n\n    /// @dev SlotSettlementRegistry address in the Ethereum mainnet\n    address constant SlotSettlementRegistry = 0xC01DC3c7F83B12CFdF6C0AAa09c880EB45c48569;\n\n    /// @dev StakeHouseUniverse address in the Ethereum mainnet\n    address constant StakeHouseUniverse = 0xC6306C52ea0405D3630249f202751aE3043056bd;\n\n    /// @dev TransactionRouter address in the Ethereum mainnet\n    address constant TransactionRouter = 0x03F4310bfE3968934bC11DfA17B8DF809D7DEA80;\n\n    /// @dev dETH address in the Ethereum mainnet\n    address constant dETH = 0x3d1E5Cf16077F349e999d6b21A4f646e83Cd90c5;\n}\n\n/// @dev Library containing address constants for the Goerli network\nlibrary GoerliConstants {\n\n    /// @dev chain id of the Goerli network\n    uint256 constant CHAIN_ID = 5;\n\n    /// @dev AccountManager address in the Goerli network\n    address constant AccountManager = 0x952295078A226bF40c8cb076C16E0e7229F77B28;\n\n    /// @dev SavETHManager address in the Goerli network\n    address constant SavETHManager = 0x9Ef3Bb02CadA3e332Bbaa27cd750541c5FFb5b03;\n\n    /// @dev SlotSettlementRegistry address in the Goerli network\n    address constant SlotSettlementRegistry = 0x1a86d0FE29c57e19f340C5Af34dE82946F22eC5d;\n\n    /// @dev StakeHouseUniverse address in the Goerli network\n    address constant StakeHouseUniverse = 0xC38ee0eCc213293757dC5a30Cf253D3f40726E4c;\n\n    /// @dev TransactionRouter address in the Goerli network\n    address constant TransactionRouter = 0xc4b44383C15E4afeD9845393b215a75D44D3d24B;\n\n    /// @dev dETH address in the Goerli network\n    address constant dETH = 0x506C2B850D519065a4005b04b9ceed946A64CB6F;\n}\n"
      },
      "@blockswaplab/stakehouse-solidity-api/contracts/IERC20.sol": {
        "content": "pragma solidity ^0.8.0;\n\n// SPDX-License-Identifier: BUSL-1.1\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `recipient`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address recipient, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `sender` to `recipient` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address sender,\n        address recipient,\n        uint256 amount\n    ) external returns (bool);\n\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n"
      },
      "@blockswaplab/stakehouse-solidity-api/contracts/StakehouseAPI.sol": {
        "content": "pragma solidity ^0.8.0;\n\n// SPDX-License-Identifier: BUSL-1.1\n\nimport { IERC20 } from \"./IERC20.sol\";\nimport { ISavETHManager } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/ISavETHManager.sol\";\nimport { IAccountManager } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IAccountManager.sol\";\nimport { IBalanceReporter } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IBalanceReporter.sol\";\nimport { ISlotSettlementRegistry } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/ISlotSettlementRegistry.sol\";\nimport { IStakeHouseRegistry } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IStakeHouseRegistry.sol\";\nimport { IStakeHouseUniverse } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IStakeHouseUniverse.sol\";\nimport { ITransactionRouter } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/ITransactionRouter.sol\";\n\nimport { MainnetConstants, GoerliConstants } from \"./Constants.sol\";\n\n/// @title Implementable Stakehouse protocol smart contract consumer without worrying about the interfaces or addresses\nabstract contract StakehouseAPI {\n\n    /// @dev Get the interface connected to the AccountManager smart contract\n    function getAccountManager() internal view virtual returns (IAccountManager accountManager) {\n        uint256 chainId = _getChainId();\n\n        if(chainId == MainnetConstants.CHAIN_ID) {\n            accountManager = IAccountManager(MainnetConstants.AccountManager);\n        }\n\n        else if (chainId == GoerliConstants.CHAIN_ID) {\n            accountManager = IAccountManager(GoerliConstants.AccountManager);\n        }\n\n        else {\n            _unsupported();\n        }\n    }\n\n    /// @dev Get the interface connected to the Balance Reporter smart contract\n    function getBalanceReporter() internal view virtual returns (IBalanceReporter balanceReporter) {\n        uint256 chainId = _getChainId();\n\n        if(chainId == MainnetConstants.CHAIN_ID) {\n            balanceReporter = IBalanceReporter(MainnetConstants.TransactionRouter);\n        }\n\n        else if (chainId == GoerliConstants.CHAIN_ID) {\n            balanceReporter = IBalanceReporter(GoerliConstants.TransactionRouter);\n        }\n\n        else {\n            _unsupported();\n        }\n    }\n\n    /// @dev Get the interface connected to the savETH registry adaptor smart contract\n    function getSavETHRegistry() internal view virtual returns (ISavETHManager savETHManager) {\n        uint256 chainId = _getChainId();\n\n        if(chainId == MainnetConstants.CHAIN_ID) {\n            savETHManager = ISavETHManager(MainnetConstants.SavETHManager);\n        }\n\n        else if (chainId == GoerliConstants.CHAIN_ID) {\n            savETHManager = ISavETHManager(GoerliConstants.SavETHManager);\n        }\n\n        else {\n            _unsupported();\n        }\n    }\n\n    /// @dev Get the interface connected to the SLOT registry smart contract\n    function getSlotRegistry() internal view virtual returns (ISlotSettlementRegistry slotSettlementRegistry) {\n        uint256 chainId = _getChainId();\n\n        if(chainId == MainnetConstants.CHAIN_ID) {\n            slotSettlementRegistry = ISlotSettlementRegistry(MainnetConstants.SlotSettlementRegistry);\n        }\n\n        else if (chainId == GoerliConstants.CHAIN_ID) {\n            slotSettlementRegistry = ISlotSettlementRegistry(GoerliConstants.SlotSettlementRegistry);\n        }\n\n        else {\n            _unsupported();\n        }\n    }\n\n    /// @dev Get the interface connected to an arbitrary Stakehouse registry smart contract\n    function getStakeHouseRegistry(address _stakeHouse) internal view virtual returns (IStakeHouseRegistry stakehouse) {\n        uint256 chainId = _getChainId();\n\n        if(chainId == MainnetConstants.CHAIN_ID) {\n            stakehouse = IStakeHouseRegistry(_stakeHouse);\n        }\n\n        else if (chainId == GoerliConstants.CHAIN_ID) {\n            stakehouse = IStakeHouseRegistry(_stakeHouse);\n        }\n\n        else {\n            _unsupported();\n        }\n    }\n\n    /// @dev Get the interface connected to the Stakehouse universe smart contract\n    function getStakeHouseUniverse() internal view virtual returns (IStakeHouseUniverse universe) {\n        uint256 chainId = _getChainId();\n\n        if(chainId == MainnetConstants.CHAIN_ID) {\n            universe = IStakeHouseUniverse(MainnetConstants.StakeHouseUniverse);\n        }\n\n        else if (chainId == GoerliConstants.CHAIN_ID) {\n            universe = IStakeHouseUniverse(GoerliConstants.StakeHouseUniverse);\n        }\n\n        else {\n            _unsupported();\n        }\n    }\n\n    /// @dev Get the interface connected to the Transaction Router adaptor smart contract\n    function getTransactionRouter() internal view virtual returns (ITransactionRouter transactionRouter) {\n        uint256 chainId = _getChainId();\n\n        if(chainId == MainnetConstants.CHAIN_ID) {\n            transactionRouter = ITransactionRouter(MainnetConstants.TransactionRouter);\n        }\n\n        else if (chainId == GoerliConstants.CHAIN_ID) {\n            transactionRouter = ITransactionRouter(GoerliConstants.TransactionRouter);\n        }\n\n        else {\n            _unsupported();\n        }\n    }\n\n    /// @notice Get the dETH instance\n    function getDETH() internal view virtual returns (IERC20 dETH) {\n        uint256 chainId = _getChainId();\n\n        if(chainId == MainnetConstants.CHAIN_ID) {\n            dETH = IERC20(MainnetConstants.dETH);\n        }\n\n        else if (chainId == GoerliConstants.CHAIN_ID) {\n            dETH = IERC20(GoerliConstants.dETH);\n        }\n\n        else {\n            _unsupported();\n        }\n    }\n\n    /// @dev If the network does not match one of the choices stop the flow\n    function _unsupported() internal pure {\n        revert('Network unsupported');\n    }\n\n    /// @dev Helper function to get the id of the current chain\n    function _getChainId() internal view returns (uint256 chainId) {\n        assembly {\n            chainId := chainid()\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {\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    function __Ownable_init() internal onlyInitializing {\n        __Ownable_init_unchained();\n    }\n\n    function __Ownable_init_unchained() internal onlyInitializing {\n        _transferOwnership(_msgSender());\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 called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n        _;\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    /**\n     * This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n    /**\n     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n     * address.\n     *\n     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n     * function revert if invoked through a proxy.\n     */\n    function proxiableUUID() external view returns (bytes32);\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n    /**\n     * @dev Must return an address that can be used as a delegate call target.\n     *\n     * {BeaconProxy} will check that this address is a contract.\n     */\n    function implementation() external view returns (address);\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\n    function __ERC1967Upgrade_init() internal onlyInitializing {\n    }\n\n    function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n    }\n    // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n    /**\n     * @dev Storage slot with the address of the current implementation.\n     * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n     * validated in the constructor.\n     */\n    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n    /**\n     * @dev Emitted when the implementation is upgraded.\n     */\n    event Upgraded(address indexed implementation);\n\n    /**\n     * @dev Returns the current implementation address.\n     */\n    function _getImplementation() internal view returns (address) {\n        return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new address in the EIP1967 implementation slot.\n     */\n    function _setImplementation(address newImplementation) private {\n        require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n        StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n    }\n\n    /**\n     * @dev Perform implementation upgrade\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeTo(address newImplementation) internal {\n        _setImplementation(newImplementation);\n        emit Upgraded(newImplementation);\n    }\n\n    /**\n     * @dev Perform implementation upgrade with additional setup call.\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeToAndCall(\n        address newImplementation,\n        bytes memory data,\n        bool forceCall\n    ) internal {\n        _upgradeTo(newImplementation);\n        if (data.length > 0 || forceCall) {\n            _functionDelegateCall(newImplementation, data);\n        }\n    }\n\n    /**\n     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeToAndCallUUPS(\n        address newImplementation,\n        bytes memory data,\n        bool forceCall\n    ) internal {\n        // Upgrades from old implementations will perform a rollback test. This test requires the new\n        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n        // this special case will break upgrade paths from old UUPS implementation to new ones.\n        if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n            _setImplementation(newImplementation);\n        } else {\n            try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n                require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n            } catch {\n                revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n            }\n            _upgradeToAndCall(newImplementation, data, forceCall);\n        }\n    }\n\n    /**\n     * @dev Storage slot with the admin of the contract.\n     * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n     * validated in the constructor.\n     */\n    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n    /**\n     * @dev Emitted when the admin account has changed.\n     */\n    event AdminChanged(address previousAdmin, address newAdmin);\n\n    /**\n     * @dev Returns the current admin.\n     */\n    function _getAdmin() internal view returns (address) {\n        return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new address in the EIP1967 admin slot.\n     */\n    function _setAdmin(address newAdmin) private {\n        require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n        StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n    }\n\n    /**\n     * @dev Changes the admin of the proxy.\n     *\n     * Emits an {AdminChanged} event.\n     */\n    function _changeAdmin(address newAdmin) internal {\n        emit AdminChanged(_getAdmin(), newAdmin);\n        _setAdmin(newAdmin);\n    }\n\n    /**\n     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n     */\n    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n    /**\n     * @dev Emitted when the beacon is upgraded.\n     */\n    event BeaconUpgraded(address indexed beacon);\n\n    /**\n     * @dev Returns the current beacon.\n     */\n    function _getBeacon() internal view returns (address) {\n        return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new beacon in the EIP1967 beacon slot.\n     */\n    function _setBeacon(address newBeacon) private {\n        require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n        require(\n            AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n            \"ERC1967: beacon implementation is not a contract\"\n        );\n        StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n    }\n\n    /**\n     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n     *\n     * Emits a {BeaconUpgraded} event.\n     */\n    function _upgradeBeaconToAndCall(\n        address newBeacon,\n        bytes memory data,\n        bool forceCall\n    ) internal {\n        _setBeacon(newBeacon);\n        emit BeaconUpgraded(newBeacon);\n        if (data.length > 0 || forceCall) {\n            _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n        }\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n        require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n        // solhint-disable-next-line avoid-low-level-calls\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the\n * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() initializer {}\n * ```\n * ====\n */\nabstract contract Initializable {\n    /**\n     * @dev Indicates that the contract has been initialized.\n     */\n    bool private _initialized;\n\n    /**\n     * @dev Indicates that the contract is in the process of being initialized.\n     */\n    bool private _initializing;\n\n    /**\n     * @dev Modifier to protect an initializer function from being invoked twice.\n     */\n    modifier initializer() {\n        // If the contract is initializing we ignore whether _initialized is set in order to support multiple\n        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the\n        // contract may have been reentered.\n        require(_initializing ? _isConstructor() : !_initialized, \"Initializable: contract is already initialized\");\n\n        bool isTopLevelCall = !_initializing;\n        if (isTopLevelCall) {\n            _initializing = true;\n            _initialized = true;\n        }\n\n        _;\n\n        if (isTopLevelCall) {\n            _initializing = false;\n        }\n    }\n\n    /**\n     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n     * {initializer} modifier, directly or indirectly.\n     */\n    modifier onlyInitializing() {\n        require(_initializing, \"Initializable: contract is not initializing\");\n        _;\n    }\n\n    function _isConstructor() private view returns (bool) {\n        return !AddressUpgradeable.isContract(address(this));\n    }\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n    function __UUPSUpgradeable_init() internal onlyInitializing {\n    }\n\n    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n    }\n    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n    address private immutable __self = address(this);\n\n    /**\n     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n     * fail.\n     */\n    modifier onlyProxy() {\n        require(address(this) != __self, \"Function must be called through delegatecall\");\n        require(_getImplementation() == __self, \"Function must be called through active proxy\");\n        _;\n    }\n\n    /**\n     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n     * callable on the implementing contract but not through proxies.\n     */\n    modifier notDelegated() {\n        require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n        _;\n    }\n\n    /**\n     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n     * implementation. It is used to validate that the this implementation remains valid after an upgrade.\n     *\n     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n     */\n    function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n        return _IMPLEMENTATION_SLOT;\n    }\n\n    /**\n     * @dev Upgrade the implementation of the proxy to `newImplementation`.\n     *\n     * Calls {_authorizeUpgrade}.\n     *\n     * Emits an {Upgraded} event.\n     */\n    function upgradeTo(address newImplementation) external virtual onlyProxy {\n        _authorizeUpgrade(newImplementation);\n        _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n    }\n\n    /**\n     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n     * encoded in `data`.\n     *\n     * Calls {_authorizeUpgrade}.\n     *\n     * Emits an {Upgraded} event.\n     */\n    function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n        _authorizeUpgrade(newImplementation);\n        _upgradeToAndCallUUPS(newImplementation, data, true);\n    }\n\n    /**\n     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n     * {upgradeTo} and {upgradeToAndCall}.\n     *\n     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n     *\n     * ```solidity\n     * function _authorizeUpgrade(address) internal override onlyOwner {}\n     * ```\n     */\n    function _authorizeUpgrade(address newImplementation) internal virtual;\n\n    /**\n     * This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n    /**\n     * @dev Emitted when the pause is triggered by `account`.\n     */\n    event Paused(address account);\n\n    /**\n     * @dev Emitted when the pause is lifted by `account`.\n     */\n    event Unpaused(address account);\n\n    bool private _paused;\n\n    /**\n     * @dev Initializes the contract in unpaused state.\n     */\n    function __Pausable_init() internal onlyInitializing {\n        __Pausable_init_unchained();\n    }\n\n    function __Pausable_init_unchained() internal onlyInitializing {\n        _paused = false;\n    }\n\n    /**\n     * @dev Returns true if the contract is paused, and false otherwise.\n     */\n    function paused() public view virtual returns (bool) {\n        return _paused;\n    }\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is not paused.\n     *\n     * Requirements:\n     *\n     * - The contract must not be paused.\n     */\n    modifier whenNotPaused() {\n        require(!paused(), \"Pausable: paused\");\n        _;\n    }\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is paused.\n     *\n     * Requirements:\n     *\n     * - The contract must be paused.\n     */\n    modifier whenPaused() {\n        require(paused(), \"Pausable: not paused\");\n        _;\n    }\n\n    /**\n     * @dev Triggers stopped state.\n     *\n     * Requirements:\n     *\n     * - The contract must not be paused.\n     */\n    function _pause() internal virtual whenNotPaused {\n        _paused = true;\n        emit Paused(_msgSender());\n    }\n\n    /**\n     * @dev Returns to normal state.\n     *\n     * Requirements:\n     *\n     * - The contract must be paused.\n     */\n    function _unpause() internal virtual whenPaused {\n        _paused = false;\n        emit Unpaused(_msgSender());\n    }\n\n    /**\n     * This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    uint256 private _status;\n\n    function __ReentrancyGuard_init() internal onlyInitializing {\n        __ReentrancyGuard_init_unchained();\n    }\n\n    function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        // On the first call to nonReentrant, _notEntered will be true\n        require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        _status = _ENTERED;\n\n        _;\n\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n    mapping(address => uint256) private _balances;\n\n    mapping(address => mapping(address => uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string private _name;\n    string private _symbol;\n\n    /**\n     * @dev Sets the values for {name} and {symbol}.\n     *\n     * The default value of {decimals} is 18. To select a different value for\n     * {decimals} you should overload it.\n     *\n     * All two of these values are immutable: they can only be set once during\n     * construction.\n     */\n    function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n        __ERC20_init_unchained(name_, symbol_);\n    }\n\n    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual override returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view virtual override returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the value {ERC20} uses, unless this function is\n     * overridden;\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view virtual override returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view virtual override returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view virtual override returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - the caller must have a balance of at least `amount`.\n     */\n    function transfer(address to, uint256 amount) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual override returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n     * `transferFrom`. This is semantically equivalent to an infinite approval.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function approve(address spender, uint256 amount) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Emits an {Approval} event indicating the updated allowance. This is not\n     * required by the EIP. See the note at the beginning of {ERC20}.\n     *\n     * NOTE: Does not update the allowance if the current allowance\n     * is the maximum `uint256`.\n     *\n     * Requirements:\n     *\n     * - `from` and `to` cannot be the zero address.\n     * - `from` must have a balance of at least `amount`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `amount`.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 amount\n    ) public virtual override returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, amount);\n        _transfer(from, to, amount);\n        return true;\n    }\n\n    /**\n     * @dev Atomically increases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, _allowances[owner][spender] + addedValue);\n        return true;\n    }\n\n    /**\n     * @dev Atomically decreases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `spender` must have allowance for the caller of at least\n     * `subtractedValue`.\n     */\n    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n        address owner = _msgSender();\n        uint256 currentAllowance = _allowances[owner][spender];\n        require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n        unchecked {\n            _approve(owner, spender, currentAllowance - subtractedValue);\n        }\n\n        return true;\n    }\n\n    /**\n     * @dev Moves `amount` of tokens from `sender` to `recipient`.\n     *\n     * This internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `from` must have a balance of at least `amount`.\n     */\n    function _transfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal virtual {\n        require(from != address(0), \"ERC20: transfer from the zero address\");\n        require(to != address(0), \"ERC20: transfer to the zero address\");\n\n        _beforeTokenTransfer(from, to, amount);\n\n        uint256 fromBalance = _balances[from];\n        require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n        unchecked {\n            _balances[from] = fromBalance - amount;\n        }\n        _balances[to] += amount;\n\n        emit Transfer(from, to, amount);\n\n        _afterTokenTransfer(from, to, amount);\n    }\n\n    /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n     * the total supply.\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     */\n    function _mint(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: mint to the zero address\");\n\n        _beforeTokenTransfer(address(0), account, amount);\n\n        _totalSupply += amount;\n        _balances[account] += amount;\n        emit Transfer(address(0), account, amount);\n\n        _afterTokenTransfer(address(0), account, amount);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens from `account`, reducing the\n     * total supply.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     * - `account` must have at least `amount` tokens.\n     */\n    function _burn(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: burn from the zero address\");\n\n        _beforeTokenTransfer(account, address(0), amount);\n\n        uint256 accountBalance = _balances[account];\n        require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n        unchecked {\n            _balances[account] = accountBalance - amount;\n        }\n        _totalSupply -= amount;\n\n        emit Transfer(account, address(0), amount);\n\n        _afterTokenTransfer(account, address(0), amount);\n    }\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n     *\n     * This internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     */\n    function _approve(\n        address owner,\n        address spender,\n        uint256 amount\n    ) internal virtual {\n        require(owner != address(0), \"ERC20: approve from the zero address\");\n        require(spender != address(0), \"ERC20: approve to the zero address\");\n\n        _allowances[owner][spender] = amount;\n        emit Approval(owner, spender, amount);\n    }\n\n    /**\n     * @dev Spend `amount` form the allowance of `owner` toward `spender`.\n     *\n     * Does not update the allowance amount in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Might emit an {Approval} event.\n     */\n    function _spendAllowance(\n        address owner,\n        address spender,\n        uint256 amount\n    ) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance != type(uint256).max) {\n            require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n            unchecked {\n                _approve(owner, spender, currentAllowance - amount);\n            }\n        }\n    }\n\n    /**\n     * @dev Hook that is called before any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * will be transferred to `to`.\n     * - when `from` is zero, `amount` tokens will be minted for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _beforeTokenTransfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal virtual {}\n\n    /**\n     * @dev Hook that is called after any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * has been transferred to `to`.\n     * - when `from` is zero, `amount` tokens have been minted for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _afterTokenTransfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal virtual {}\n\n    /**\n     * This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[45] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-IERC20PermitUpgradeable.sol\";\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/cryptography/draft-EIP712Upgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * _Available since v3.4._\n */\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {\n    using CountersUpgradeable for CountersUpgradeable.Counter;\n\n    mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n    // solhint-disable-next-line var-name-mixedcase\n    bytes32 private _PERMIT_TYPEHASH;\n\n    /**\n     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n     *\n     * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n     */\n    function __ERC20Permit_init(string memory name) internal onlyInitializing {\n        __EIP712_init_unchained(name, \"1\");\n        __ERC20Permit_init_unchained(name);\n    }\n\n    function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {\n        _PERMIT_TYPEHASH = keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");}\n\n    /**\n     * @dev See {IERC20Permit-permit}.\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) public virtual override {\n        require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n        bytes32 hash = _hashTypedDataV4(structHash);\n\n        address signer = ECDSAUpgradeable.recover(hash, v, r, s);\n        require(signer == owner, \"ERC20Permit: invalid signature\");\n\n        _approve(owner, spender, value);\n    }\n\n    /**\n     * @dev See {IERC20Permit-nonces}.\n     */\n    function nonces(address owner) public view virtual override returns (uint256) {\n        return _nonces[owner].current();\n    }\n\n    /**\n     * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n        return _domainSeparatorV4();\n    }\n\n    /**\n     * @dev \"Consume a nonce\": return the current value and increment.\n     *\n     * _Available since v4.1._\n     */\n    function _useNonce(address owner) internal virtual returns (uint256 current) {\n        CountersUpgradeable.Counter storage nonce = _nonces[owner];\n        current = nonce.current();\n        nonce.increment();\n    }\n\n    /**\n     * This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\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-upgradeable/token/ERC20/IERC20Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.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 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    /**\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"
      },
      "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n    using AddressUpgradeable for address;\n    using StringsUpgradeable for uint256;\n\n    // Token name\n    string private _name;\n\n    // Token symbol\n    string private _symbol;\n\n    // Mapping from token ID to owner address\n    mapping(uint256 => address) private _owners;\n\n    // Mapping owner address to token count\n    mapping(address => uint256) private _balances;\n\n    // Mapping from token ID to approved address\n    mapping(uint256 => address) private _tokenApprovals;\n\n    // Mapping from owner to operator approvals\n    mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n    /**\n     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n     */\n    function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n        __ERC721_init_unchained(name_, symbol_);\n    }\n\n    function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n        return\n            interfaceId == type(IERC721Upgradeable).interfaceId ||\n            interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n            super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev See {IERC721-balanceOf}.\n     */\n    function balanceOf(address owner) public view virtual override returns (uint256) {\n        require(owner != address(0), \"ERC721: balance query for the zero address\");\n        return _balances[owner];\n    }\n\n    /**\n     * @dev See {IERC721-ownerOf}.\n     */\n    function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n        address owner = _owners[tokenId];\n        require(owner != address(0), \"ERC721: owner query for nonexistent token\");\n        return owner;\n    }\n\n    /**\n     * @dev See {IERC721Metadata-name}.\n     */\n    function name() public view virtual override returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev See {IERC721Metadata-symbol}.\n     */\n    function symbol() public view virtual override returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev See {IERC721Metadata-tokenURI}.\n     */\n    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n        require(_exists(tokenId), \"ERC721Metadata: URI query for nonexistent token\");\n\n        string memory baseURI = _baseURI();\n        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n    }\n\n    /**\n     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n     * by default, can be overriden in child contracts.\n     */\n    function _baseURI() internal view virtual returns (string memory) {\n        return \"\";\n    }\n\n    /**\n     * @dev See {IERC721-approve}.\n     */\n    function approve(address to, uint256 tokenId) public virtual override {\n        address owner = ERC721Upgradeable.ownerOf(tokenId);\n        require(to != owner, \"ERC721: approval to current owner\");\n\n        require(\n            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n            \"ERC721: approve caller is not owner nor approved for all\"\n        );\n\n        _approve(to, tokenId);\n    }\n\n    /**\n     * @dev See {IERC721-getApproved}.\n     */\n    function getApproved(uint256 tokenId) public view virtual override returns (address) {\n        require(_exists(tokenId), \"ERC721: approved query for nonexistent token\");\n\n        return _tokenApprovals[tokenId];\n    }\n\n    /**\n     * @dev See {IERC721-setApprovalForAll}.\n     */\n    function setApprovalForAll(address operator, bool approved) public virtual override {\n        _setApprovalForAll(_msgSender(), operator, approved);\n    }\n\n    /**\n     * @dev See {IERC721-isApprovedForAll}.\n     */\n    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n        return _operatorApprovals[owner][operator];\n    }\n\n    /**\n     * @dev See {IERC721-transferFrom}.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 tokenId\n    ) public virtual override {\n        //solhint-disable-next-line max-line-length\n        require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n\n        _transfer(from, to, tokenId);\n    }\n\n    /**\n     * @dev See {IERC721-safeTransferFrom}.\n     */\n    function safeTransferFrom(\n        address from,\n        address to,\n        uint256 tokenId\n    ) public virtual override {\n        safeTransferFrom(from, to, tokenId, \"\");\n    }\n\n    /**\n     * @dev See {IERC721-safeTransferFrom}.\n     */\n    function safeTransferFrom(\n        address from,\n        address to,\n        uint256 tokenId,\n        bytes memory _data\n    ) public virtual override {\n        require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n        _safeTransfer(from, to, tokenId, _data);\n    }\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n     * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n     *\n     * `_data` is additional data, it has no specified format and it is sent in call to `to`.\n     *\n     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n     * implement alternative mechanisms to perform token transfer, such as signature-based.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _safeTransfer(\n        address from,\n        address to,\n        uint256 tokenId,\n        bytes memory _data\n    ) internal virtual {\n        _transfer(from, to, tokenId);\n        require(_checkOnERC721Received(from, to, tokenId, _data), \"ERC721: transfer to non ERC721Receiver implementer\");\n    }\n\n    /**\n     * @dev Returns whether `tokenId` exists.\n     *\n     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n     *\n     * Tokens start existing when they are minted (`_mint`),\n     * and stop existing when they are burned (`_burn`).\n     */\n    function _exists(uint256 tokenId) internal view virtual returns (bool) {\n        return _owners[tokenId] != address(0);\n    }\n\n    /**\n     * @dev Returns whether `spender` is allowed to manage `tokenId`.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n        require(_exists(tokenId), \"ERC721: operator query for nonexistent token\");\n        address owner = ERC721Upgradeable.ownerOf(tokenId);\n        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));\n    }\n\n    /**\n     * @dev Safely mints `tokenId` and transfers it to `to`.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must not exist.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _safeMint(address to, uint256 tokenId) internal virtual {\n        _safeMint(to, tokenId, \"\");\n    }\n\n    /**\n     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n     */\n    function _safeMint(\n        address to,\n        uint256 tokenId,\n        bytes memory _data\n    ) internal virtual {\n        _mint(to, tokenId);\n        require(\n            _checkOnERC721Received(address(0), to, tokenId, _data),\n            \"ERC721: transfer to non ERC721Receiver implementer\"\n        );\n    }\n\n    /**\n     * @dev Mints `tokenId` and transfers it to `to`.\n     *\n     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n     *\n     * Requirements:\n     *\n     * - `tokenId` must not exist.\n     * - `to` cannot be the zero address.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _mint(address to, uint256 tokenId) internal virtual {\n        require(to != address(0), \"ERC721: mint to the zero address\");\n        require(!_exists(tokenId), \"ERC721: token already minted\");\n\n        _beforeTokenTransfer(address(0), to, tokenId);\n\n        _balances[to] += 1;\n        _owners[tokenId] = to;\n\n        emit Transfer(address(0), to, tokenId);\n\n        _afterTokenTransfer(address(0), to, tokenId);\n    }\n\n    /**\n     * @dev Destroys `tokenId`.\n     * The approval is cleared when the token is burned.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _burn(uint256 tokenId) internal virtual {\n        address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n        _beforeTokenTransfer(owner, address(0), tokenId);\n\n        // Clear approvals\n        _approve(address(0), tokenId);\n\n        _balances[owner] -= 1;\n        delete _owners[tokenId];\n\n        emit Transfer(owner, address(0), tokenId);\n\n        _afterTokenTransfer(owner, address(0), tokenId);\n    }\n\n    /**\n     * @dev Transfers `tokenId` from `from` to `to`.\n     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _transfer(\n        address from,\n        address to,\n        uint256 tokenId\n    ) internal virtual {\n        require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n        require(to != address(0), \"ERC721: transfer to the zero address\");\n\n        _beforeTokenTransfer(from, to, tokenId);\n\n        // Clear approvals from the previous owner\n        _approve(address(0), tokenId);\n\n        _balances[from] -= 1;\n        _balances[to] += 1;\n        _owners[tokenId] = to;\n\n        emit Transfer(from, to, tokenId);\n\n        _afterTokenTransfer(from, to, tokenId);\n    }\n\n    /**\n     * @dev Approve `to` to operate on `tokenId`\n     *\n     * Emits a {Approval} event.\n     */\n    function _approve(address to, uint256 tokenId) internal virtual {\n        _tokenApprovals[tokenId] = to;\n        emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n    }\n\n    /**\n     * @dev Approve `operator` to operate on all of `owner` tokens\n     *\n     * Emits a {ApprovalForAll} event.\n     */\n    function _setApprovalForAll(\n        address owner,\n        address operator,\n        bool approved\n    ) internal virtual {\n        require(owner != operator, \"ERC721: approve to caller\");\n        _operatorApprovals[owner][operator] = approved;\n        emit ApprovalForAll(owner, operator, approved);\n    }\n\n    /**\n     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n     * The call is not executed if the target address is not a contract.\n     *\n     * @param from address representing the previous owner of the given token ID\n     * @param to target address that will receive the tokens\n     * @param tokenId uint256 ID of the token to be transferred\n     * @param _data bytes optional data to send along with the call\n     * @return bool whether the call correctly returned the expected magic value\n     */\n    function _checkOnERC721Received(\n        address from,\n        address to,\n        uint256 tokenId,\n        bytes memory _data\n    ) private returns (bool) {\n        if (to.isContract()) {\n            try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {\n                return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n            } catch (bytes memory reason) {\n                if (reason.length == 0) {\n                    revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n                } else {\n                    assembly {\n                        revert(add(32, reason), mload(reason))\n                    }\n                }\n            }\n        } else {\n            return true;\n        }\n    }\n\n    /**\n     * @dev Hook that is called before any token transfer. This includes minting\n     * and burning.\n     *\n     * Calling conditions:\n     *\n     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n     * transferred to `to`.\n     * - When `from` is zero, `tokenId` will be minted for `to`.\n     * - When `to` is zero, ``from``'s `tokenId` will be burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _beforeTokenTransfer(\n        address from,\n        address to,\n        uint256 tokenId\n    ) internal virtual {}\n\n    /**\n     * @dev Hook that is called after any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _afterTokenTransfer(\n        address from,\n        address to,\n        uint256 tokenId\n    ) internal virtual {}\n\n    /**\n     * This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[44] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n    /**\n     * @dev Returns the token collection name.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the token collection symbol.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n     */\n    function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n    /**\n     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n     * by `operator` from `from`, this function is called.\n     *\n     * It must return its Solidity selector to confirm the token transfer.\n     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n     *\n     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n     */\n    function onERC721Received(\n        address operator,\n        address from,\n        uint256 tokenId,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n    /**\n     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n     */\n    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n     */\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n    /**\n     * @dev Returns the number of tokens in ``owner``'s account.\n     */\n    function balanceOf(address owner) external view returns (uint256 balance);\n\n    /**\n     * @dev Returns the owner of the `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function ownerOf(uint256 tokenId) external view returns (address owner);\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n     * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(\n        address from,\n        address to,\n        uint256 tokenId\n    ) external;\n\n    /**\n     * @dev Transfers `tokenId` token from `from` to `to`.\n     *\n     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 tokenId\n    ) external;\n\n    /**\n     * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n     * The approval is cleared when the token is transferred.\n     *\n     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n     *\n     * Requirements:\n     *\n     * - The caller must own the token or be an approved operator.\n     * - `tokenId` must exist.\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address to, uint256 tokenId) external;\n\n    /**\n     * @dev Returns the account approved for `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function getApproved(uint256 tokenId) external view returns (address operator);\n\n    /**\n     * @dev Approve or remove `operator` as an operator for the caller.\n     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n     *\n     * Requirements:\n     *\n     * - The `operator` cannot be the caller.\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function setApprovalForAll(address operator, bool _approved) external;\n\n    /**\n     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n     *\n     * See {setApprovalForAll}\n     */\n    function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(\n        address from,\n        address to,\n        uint256 tokenId,\n        bytes calldata data\n    ) external;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCall(target, data, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        require(isContract(target), \"Address: call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        require(isContract(target), \"Address: static call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            // Look for revert reason and bubble it up if present\n            if (returndata.length > 0) {\n                // The easiest way to bubble the revert reason is using memory via assembly\n\n                assembly {\n                    let returndata_size := mload(returndata)\n                    revert(add(32, returndata), returndata_size)\n                }\n            } else {\n                revert(errorMessage);\n            }\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n    function __Context_init() internal onlyInitializing {\n    }\n\n    function __Context_init_unchained() internal onlyInitializing {\n    }\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    /**\n     * This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n    struct Counter {\n        // This variable should never be directly accessed by users of the library: interactions must be restricted to\n        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n        // this feature: see https://github.com/ethereum/solidity/issues/4637\n        uint256 _value; // default: 0\n    }\n\n    function current(Counter storage counter) internal view returns (uint256) {\n        return counter._value;\n    }\n\n    function increment(Counter storage counter) internal {\n        unchecked {\n            counter._value += 1;\n        }\n    }\n\n    function decrement(Counter storage counter) internal {\n        uint256 value = counter._value;\n        require(value > 0, \"Counter: decrement overflow\");\n        unchecked {\n            counter._value = value - 1;\n        }\n    }\n\n    function reset(Counter storage counter) internal {\n        counter._value = 0;\n    }\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712Upgradeable is Initializable {\n    /* solhint-disable var-name-mixedcase */\n    bytes32 private _HASHED_NAME;\n    bytes32 private _HASHED_VERSION;\n    bytes32 private constant _TYPE_HASH = keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n    /* solhint-enable var-name-mixedcase */\n\n    /**\n     * @dev Initializes the domain separator and parameter caches.\n     *\n     * The meaning of `name` and `version` is specified in\n     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n     *\n     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n     * - `version`: the current major version of the signing domain.\n     *\n     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n     * contract upgrade].\n     */\n    function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n        __EIP712_init_unchained(name, version);\n    }\n\n    function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n        bytes32 hashedName = keccak256(bytes(name));\n        bytes32 hashedVersion = keccak256(bytes(version));\n        _HASHED_NAME = hashedName;\n        _HASHED_VERSION = hashedVersion;\n    }\n\n    /**\n     * @dev Returns the domain separator for the current chain.\n     */\n    function _domainSeparatorV4() internal view returns (bytes32) {\n        return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());\n    }\n\n    function _buildDomainSeparator(\n        bytes32 typeHash,\n        bytes32 nameHash,\n        bytes32 versionHash\n    ) private view returns (bytes32) {\n        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n    }\n\n    /**\n     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n     * function returns the hash of the fully encoded EIP712 message for this domain.\n     *\n     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n     *\n     * ```solidity\n     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n     *     keccak256(\"Mail(address to,string contents)\"),\n     *     mailTo,\n     *     keccak256(bytes(mailContents))\n     * )));\n     * address signer = ECDSA.recover(digest, signature);\n     * ```\n     */\n    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n        return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n    }\n\n    /**\n     * @dev The hash of the name parameter for the EIP712 domain.\n     *\n     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n     * are a concern.\n     */\n    function _EIP712NameHash() internal virtual view returns (bytes32) {\n        return _HASHED_NAME;\n    }\n\n    /**\n     * @dev The hash of the version parameter for the EIP712 domain.\n     *\n     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n     * are a concern.\n     */\n    function _EIP712VersionHash() internal virtual view returns (bytes32) {\n        return _HASHED_VERSION;\n    }\n\n    /**\n     * This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n    enum RecoverError {\n        NoError,\n        InvalidSignature,\n        InvalidSignatureLength,\n        InvalidSignatureS,\n        InvalidSignatureV\n    }\n\n    function _throwError(RecoverError error) private pure {\n        if (error == RecoverError.NoError) {\n            return; // no error: do nothing\n        } else if (error == RecoverError.InvalidSignature) {\n            revert(\"ECDSA: invalid signature\");\n        } else if (error == RecoverError.InvalidSignatureLength) {\n            revert(\"ECDSA: invalid signature length\");\n        } else if (error == RecoverError.InvalidSignatureS) {\n            revert(\"ECDSA: invalid signature 's' value\");\n        } else if (error == RecoverError.InvalidSignatureV) {\n            revert(\"ECDSA: invalid signature 'v' value\");\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature` or error string. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {toEthSignedMessageHash} on it.\n     *\n     * Documentation for signature generation:\n     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n        // Check the signature length\n        // - case 65: r,s,v signature (standard)\n        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n        if (signature.length == 65) {\n            bytes32 r;\n            bytes32 s;\n            uint8 v;\n            // ecrecover takes the signature parameters, and the only way to get them\n            // currently is to use assembly.\n            assembly {\n                r := mload(add(signature, 0x20))\n                s := mload(add(signature, 0x40))\n                v := byte(0, mload(add(signature, 0x60)))\n            }\n            return tryRecover(hash, v, r, s);\n        } else if (signature.length == 64) {\n            bytes32 r;\n            bytes32 vs;\n            // ecrecover takes the signature parameters, and the only way to get them\n            // currently is to use assembly.\n            assembly {\n                r := mload(add(signature, 0x20))\n                vs := mload(add(signature, 0x40))\n            }\n            return tryRecover(hash, r, vs);\n        } else {\n            return (address(0), RecoverError.InvalidSignatureLength);\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature`. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {toEthSignedMessageHash} on it.\n     */\n    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, signature);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n     *\n     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(\n        bytes32 hash,\n        bytes32 r,\n        bytes32 vs\n    ) internal pure returns (address, RecoverError) {\n        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n        uint8 v = uint8((uint256(vs) >> 255) + 27);\n        return tryRecover(hash, v, r, s);\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n     *\n     * _Available since v4.2._\n     */\n    function recover(\n        bytes32 hash,\n        bytes32 r,\n        bytes32 vs\n    ) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(\n        bytes32 hash,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal pure returns (address, RecoverError) {\n        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n        // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n        //\n        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n        // these malleable signatures as well.\n        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n            return (address(0), RecoverError.InvalidSignatureS);\n        }\n        if (v != 27 && v != 28) {\n            return (address(0), RecoverError.InvalidSignatureV);\n        }\n\n        // If the signature is valid (and not malleable), return the signer address\n        address signer = ecrecover(hash, v, r, s);\n        if (signer == address(0)) {\n            return (address(0), RecoverError.InvalidSignature);\n        }\n\n        return (signer, RecoverError.NoError);\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function recover(\n        bytes32 hash,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n     * produces hash corresponding to the one signed with the\n     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n     * JSON-RPC method as part of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n        // 32 is the length in bytes of hash,\n        // enforced by the type signature above\n        return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Message, created from `s`. This\n     * produces hash corresponding to the one signed with the\n     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n     * JSON-RPC method as part of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Typed Data, created from a\n     * `domainSeparator` and a `structHash`. This produces hash corresponding\n     * to the one signed with the\n     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n     * JSON-RPC method as part of EIP-712.\n     *\n     * See {recover}.\n     */\n    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n    }\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n    function __ERC165_init() internal onlyInitializing {\n    }\n\n    function __ERC165_init_unchained() internal onlyInitializing {\n    }\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IERC165Upgradeable).interfaceId;\n    }\n\n    /**\n     * This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n *     function _getImplementation() internal view returns (address) {\n *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n *     }\n *\n *     function _setImplementation(address newImplementation) internal {\n *         require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n *     }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n    struct AddressSlot {\n        address value;\n    }\n\n    struct BooleanSlot {\n        bool value;\n    }\n\n    struct Bytes32Slot {\n        bytes32 value;\n    }\n\n    struct Uint256Slot {\n        uint256 value;\n    }\n\n    /**\n     * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n     */\n    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n     */\n    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n     */\n    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n     */\n    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n        assembly {\n            r.slot := slot\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n    bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        // Inspired by OraclizeAPI's implementation - MIT licence\n        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n        if (value == 0) {\n            return \"0\";\n        }\n        uint256 temp = value;\n        uint256 digits;\n        while (temp != 0) {\n            digits++;\n            temp /= 10;\n        }\n        bytes memory buffer = new bytes(digits);\n        while (value != 0) {\n            digits -= 1;\n            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n            value /= 10;\n        }\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        if (value == 0) {\n            return \"0x00\";\n        }\n        uint256 temp = value;\n        uint256 length = 0;\n        while (temp != 0) {\n            length++;\n            temp >>= 8;\n        }\n        return toHexString(value, length);\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        bytes memory buffer = new bytes(2 * length + 2);\n        buffer[0] = \"0\";\n        buffer[1] = \"x\";\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\n            buffer[i] = _HEX_SYMBOLS[value & 0xf];\n            value >>= 4;\n        }\n        require(value == 0, \"Strings: hex length insufficient\");\n        return string(buffer);\n    }\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/interfaces/draft-IERC1822.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n    /**\n     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n     * address.\n     *\n     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n     * function revert if invoked through a proxy.\n     */\n    function proxiableUUID() external view returns (bytes32);\n}\n"
      },
      "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IBeacon.sol\";\nimport \"../Proxy.sol\";\nimport \"../ERC1967/ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.\n *\n * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't\n * conflict with the storage layout of the implementation behind the proxy.\n *\n * _Available since v3.4._\n */\ncontract BeaconProxy is Proxy, ERC1967Upgrade {\n    /**\n     * @dev Initializes the proxy with `beacon`.\n     *\n     * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This\n     * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity\n     * constructor.\n     *\n     * Requirements:\n     *\n     * - `beacon` must be a contract with the interface {IBeacon}.\n     */\n    constructor(address beacon, bytes memory data) payable {\n        _upgradeBeaconToAndCall(beacon, data, false);\n    }\n\n    /**\n     * @dev Returns the current beacon address.\n     */\n    function _beacon() internal view virtual returns (address) {\n        return _getBeacon();\n    }\n\n    /**\n     * @dev Returns the current implementation address of the associated beacon.\n     */\n    function _implementation() internal view virtual override returns (address) {\n        return IBeacon(_getBeacon()).implementation();\n    }\n\n    /**\n     * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.\n     *\n     * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon.\n     *\n     * Requirements:\n     *\n     * - `beacon` must be a contract.\n     * - The implementation returned by `beacon` must be a contract.\n     */\n    function _setBeacon(address beacon, bytes memory data) internal virtual {\n        _upgradeBeaconToAndCall(beacon, data, false);\n    }\n}\n"
      },
      "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n    /**\n     * @dev Must return an address that can be used as a delegate call target.\n     *\n     * {BeaconProxy} will check that this address is a contract.\n     */\n    function implementation() external view returns (address);\n}\n"
      },
      "@openzeppelin/contracts/proxy/Clones.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary Clones {\n    /**\n     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n     *\n     * This function uses the create opcode, which should never revert.\n     */\n    function clone(address implementation) internal returns (address instance) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n            // of the `implementation` address with the bytecode before the address.\n            mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n            // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n            mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n            instance := create(0, 0x09, 0x37)\n        }\n        require(instance != address(0), \"ERC1167: create failed\");\n    }\n\n    /**\n     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n     *\n     * This function uses the create2 opcode and a `salt` to deterministically deploy\n     * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n     * the clones cannot be deployed twice at the same address.\n     */\n    function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n            // of the `implementation` address with the bytecode before the address.\n            mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n            // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n            mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n            instance := create2(0, 0x09, 0x37, salt)\n        }\n        require(instance != address(0), \"ERC1167: create2 failed\");\n    }\n\n    /**\n     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n     */\n    function predictDeterministicAddress(\n        address implementation,\n        bytes32 salt,\n        address deployer\n    ) internal pure returns (address predicted) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let ptr := mload(0x40)\n            mstore(add(ptr, 0x38), deployer)\n            mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n            mstore(add(ptr, 0x14), implementation)\n            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n            mstore(add(ptr, 0x58), salt)\n            mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n            predicted := keccak256(add(ptr, 0x43), 0x55)\n        }\n    }\n\n    /**\n     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n     */\n    function predictDeterministicAddress(address implementation, bytes32 salt)\n        internal\n        view\n        returns (address predicted)\n    {\n        return predictDeterministicAddress(implementation, salt, address(this));\n    }\n}\n"
      },
      "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n    /**\n     * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n     *\n     * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n     * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n     */\n    constructor(address _logic, bytes memory _data) payable {\n        _upgradeToAndCall(_logic, _data, false);\n    }\n\n    /**\n     * @dev Returns the current implementation address.\n     */\n    function _implementation() internal view virtual override returns (address impl) {\n        return ERC1967Upgrade._getImplementation();\n    }\n}\n"
      },
      "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n    // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n    /**\n     * @dev Storage slot with the address of the current implementation.\n     * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n     * validated in the constructor.\n     */\n    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n    /**\n     * @dev Emitted when the implementation is upgraded.\n     */\n    event Upgraded(address indexed implementation);\n\n    /**\n     * @dev Returns the current implementation address.\n     */\n    function _getImplementation() internal view returns (address) {\n        return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new address in the EIP1967 implementation slot.\n     */\n    function _setImplementation(address newImplementation) private {\n        require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n        StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n    }\n\n    /**\n     * @dev Perform implementation upgrade\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeTo(address newImplementation) internal {\n        _setImplementation(newImplementation);\n        emit Upgraded(newImplementation);\n    }\n\n    /**\n     * @dev Perform implementation upgrade with additional setup call.\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeToAndCall(\n        address newImplementation,\n        bytes memory data,\n        bool forceCall\n    ) internal {\n        _upgradeTo(newImplementation);\n        if (data.length > 0 || forceCall) {\n            Address.functionDelegateCall(newImplementation, data);\n        }\n    }\n\n    /**\n     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeToAndCallUUPS(\n        address newImplementation,\n        bytes memory data,\n        bool forceCall\n    ) internal {\n        // Upgrades from old implementations will perform a rollback test. This test requires the new\n        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n        // this special case will break upgrade paths from old UUPS implementation to new ones.\n        if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n            _setImplementation(newImplementation);\n        } else {\n            try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n                require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n            } catch {\n                revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n            }\n            _upgradeToAndCall(newImplementation, data, forceCall);\n        }\n    }\n\n    /**\n     * @dev Storage slot with the admin of the contract.\n     * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n     * validated in the constructor.\n     */\n    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n    /**\n     * @dev Emitted when the admin account has changed.\n     */\n    event AdminChanged(address previousAdmin, address newAdmin);\n\n    /**\n     * @dev Returns the current admin.\n     */\n    function _getAdmin() internal view returns (address) {\n        return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new address in the EIP1967 admin slot.\n     */\n    function _setAdmin(address newAdmin) private {\n        require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n        StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n    }\n\n    /**\n     * @dev Changes the admin of the proxy.\n     *\n     * Emits an {AdminChanged} event.\n     */\n    function _changeAdmin(address newAdmin) internal {\n        emit AdminChanged(_getAdmin(), newAdmin);\n        _setAdmin(newAdmin);\n    }\n\n    /**\n     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n     */\n    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n    /**\n     * @dev Emitted when the beacon is upgraded.\n     */\n    event BeaconUpgraded(address indexed beacon);\n\n    /**\n     * @dev Returns the current beacon.\n     */\n    function _getBeacon() internal view returns (address) {\n        return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new beacon in the EIP1967 beacon slot.\n     */\n    function _setBeacon(address newBeacon) private {\n        require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n        require(\n            Address.isContract(IBeacon(newBeacon).implementation()),\n            \"ERC1967: beacon implementation is not a contract\"\n        );\n        StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n    }\n\n    /**\n     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n     *\n     * Emits a {BeaconUpgraded} event.\n     */\n    function _upgradeBeaconToAndCall(\n        address newBeacon,\n        bytes memory data,\n        bool forceCall\n    ) internal {\n        _setBeacon(newBeacon);\n        emit BeaconUpgraded(newBeacon);\n        if (data.length > 0 || forceCall) {\n            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/proxy/Proxy.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n    /**\n     * @dev Delegates the current call to `implementation`.\n     *\n     * This function does not return to its internal call site, it will return directly to the external caller.\n     */\n    function _delegate(address implementation) internal virtual {\n        assembly {\n            // Copy msg.data. We take full control of memory in this inline assembly\n            // block because it will not return to Solidity code. We overwrite the\n            // Solidity scratch pad at memory position 0.\n            calldatacopy(0, 0, calldatasize())\n\n            // Call the implementation.\n            // out and outsize are 0 because we don't know the size yet.\n            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n            // Copy the returned data.\n            returndatacopy(0, 0, returndatasize())\n\n            switch result\n            // delegatecall returns 0 on error.\n            case 0 {\n                revert(0, returndatasize())\n            }\n            default {\n                return(0, returndatasize())\n            }\n        }\n    }\n\n    /**\n     * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n     * and {_fallback} should delegate.\n     */\n    function _implementation() internal view virtual returns (address);\n\n    /**\n     * @dev Delegates the current call to the address returned by `_implementation()`.\n     *\n     * This function does not return to its internal call site, it will return directly to the external caller.\n     */\n    function _fallback() internal virtual {\n        _beforeFallback();\n        _delegate(_implementation());\n    }\n\n    /**\n     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n     * function in the contract matches the call data.\n     */\n    fallback() external payable virtual {\n        _fallback();\n    }\n\n    /**\n     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n     * is empty.\n     */\n    receive() external payable virtual {\n        _fallback();\n    }\n\n    /**\n     * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n     * call, or as part of the Solidity `fallback` or `receive` functions.\n     *\n     * If overridden should call `super._beforeFallback()`.\n     */\n    function _beforeFallback() internal virtual {}\n}\n"
      },
      "@openzeppelin/contracts/proxy/utils/Initializable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n *     function initialize() initializer public {\n *         __ERC20_init(\"MyToken\", \"MTK\");\n *     }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n *     function initializeV2() reinitializer(2) public {\n *         __ERC20Permit_init(\"MyToken\");\n *     }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n *     _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n    /**\n     * @dev Indicates that the contract has been initialized.\n     * @custom:oz-retyped-from bool\n     */\n    uint8 private _initialized;\n\n    /**\n     * @dev Indicates that the contract is in the process of being initialized.\n     */\n    bool private _initializing;\n\n    /**\n     * @dev Triggered when the contract has been initialized or reinitialized.\n     */\n    event Initialized(uint8 version);\n\n    /**\n     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n     * `onlyInitializing` functions can be used to initialize parent contracts.\n     *\n     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n     * constructor.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier initializer() {\n        bool isTopLevelCall = !_initializing;\n        require(\n            (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\n            \"Initializable: contract is already initialized\"\n        );\n        _initialized = 1;\n        if (isTopLevelCall) {\n            _initializing = true;\n        }\n        _;\n        if (isTopLevelCall) {\n            _initializing = false;\n            emit Initialized(1);\n        }\n    }\n\n    /**\n     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n     * used to initialize parent contracts.\n     *\n     * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n     * are added through upgrades and that require initialization.\n     *\n     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n     * cannot be nested. If one is invoked in the context of another, execution will revert.\n     *\n     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n     * a contract, executing them in the right order is up to the developer or operator.\n     *\n     * WARNING: setting the version to 255 will prevent any future reinitialization.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier reinitializer(uint8 version) {\n        require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n        _initialized = version;\n        _initializing = true;\n        _;\n        _initializing = false;\n        emit Initialized(version);\n    }\n\n    /**\n     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n     * {initializer} and {reinitializer} modifiers, directly or indirectly.\n     */\n    modifier onlyInitializing() {\n        require(_initializing, \"Initializable: contract is not initializing\");\n        _;\n    }\n\n    /**\n     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n     * through proxies.\n     *\n     * Emits an {Initialized} event the first time it is successfully executed.\n     */\n    function _disableInitializers() internal virtual {\n        require(!_initializing, \"Initializable: contract is initializing\");\n        if (_initialized < type(uint8).max) {\n            _initialized = type(uint8).max;\n            emit Initialized(type(uint8).max);\n        }\n    }\n\n    /**\n     * @dev Internal function that returns the initialized version. Returns `_initialized`\n     */\n    function _getInitializedVersion() internal view returns (uint8) {\n        return _initialized;\n    }\n\n    /**\n     * @dev Internal function that returns the initialized version. Returns `_initializing`\n     */\n    function _isInitializing() internal view returns (bool) {\n        return _initializing;\n    }\n}\n"
      },
      "@openzeppelin/contracts/security/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    uint256 private _status;\n\n    constructor() {\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be _NOT_ENTERED\n        require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        _status = _ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = _NOT_ENTERED;\n    }\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/ERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n    mapping(address => uint256) private _balances;\n\n    mapping(address => mapping(address => uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string private _name;\n    string private _symbol;\n\n    /**\n     * @dev Sets the values for {name} and {symbol}.\n     *\n     * The default value of {decimals} is 18. To select a different value for\n     * {decimals} you should overload it.\n     *\n     * All two of these values are immutable: they can only be set once during\n     * construction.\n     */\n    constructor(string memory name_, string memory symbol_) {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual override returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view virtual override returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the value {ERC20} uses, unless this function is\n     * overridden;\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view virtual override returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view virtual override returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view virtual override returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - the caller must have a balance of at least `amount`.\n     */\n    function transfer(address to, uint256 amount) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual override returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n     * `transferFrom`. This is semantically equivalent to an infinite approval.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function approve(address spender, uint256 amount) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Emits an {Approval} event indicating the updated allowance. This is not\n     * required by the EIP. See the note at the beginning of {ERC20}.\n     *\n     * NOTE: Does not update the allowance if the current allowance\n     * is the maximum `uint256`.\n     *\n     * Requirements:\n     *\n     * - `from` and `to` cannot be the zero address.\n     * - `from` must have a balance of at least `amount`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `amount`.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 amount\n    ) public virtual override returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, amount);\n        _transfer(from, to, amount);\n        return true;\n    }\n\n    /**\n     * @dev Atomically increases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, allowance(owner, spender) + addedValue);\n        return true;\n    }\n\n    /**\n     * @dev Atomically decreases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `spender` must have allowance for the caller of at least\n     * `subtractedValue`.\n     */\n    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n        address owner = _msgSender();\n        uint256 currentAllowance = allowance(owner, spender);\n        require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n        unchecked {\n            _approve(owner, spender, currentAllowance - subtractedValue);\n        }\n\n        return true;\n    }\n\n    /**\n     * @dev Moves `amount` of tokens from `from` to `to`.\n     *\n     * This internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `from` must have a balance of at least `amount`.\n     */\n    function _transfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal virtual {\n        require(from != address(0), \"ERC20: transfer from the zero address\");\n        require(to != address(0), \"ERC20: transfer to the zero address\");\n\n        _beforeTokenTransfer(from, to, amount);\n\n        uint256 fromBalance = _balances[from];\n        require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n        unchecked {\n            _balances[from] = fromBalance - amount;\n            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n            // decrementing then incrementing.\n            _balances[to] += amount;\n        }\n\n        emit Transfer(from, to, amount);\n\n        _afterTokenTransfer(from, to, amount);\n    }\n\n    /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n     * the total supply.\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     */\n    function _mint(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: mint to the zero address\");\n\n        _beforeTokenTransfer(address(0), account, amount);\n\n        _totalSupply += amount;\n        unchecked {\n            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n            _balances[account] += amount;\n        }\n        emit Transfer(address(0), account, amount);\n\n        _afterTokenTransfer(address(0), account, amount);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens from `account`, reducing the\n     * total supply.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     * - `account` must have at least `amount` tokens.\n     */\n    function _burn(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: burn from the zero address\");\n\n        _beforeTokenTransfer(account, address(0), amount);\n\n        uint256 accountBalance = _balances[account];\n        require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n        unchecked {\n            _balances[account] = accountBalance - amount;\n            // Overflow not possible: amount <= accountBalance <= totalSupply.\n            _totalSupply -= amount;\n        }\n\n        emit Transfer(account, address(0), amount);\n\n        _afterTokenTransfer(account, address(0), amount);\n    }\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n     *\n     * This internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     */\n    function _approve(\n        address owner,\n        address spender,\n        uint256 amount\n    ) internal virtual {\n        require(owner != address(0), \"ERC20: approve from the zero address\");\n        require(spender != address(0), \"ERC20: approve to the zero address\");\n\n        _allowances[owner][spender] = amount;\n        emit Approval(owner, spender, amount);\n    }\n\n    /**\n     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n     *\n     * Does not update the allowance amount in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Might emit an {Approval} event.\n     */\n    function _spendAllowance(\n        address owner,\n        address spender,\n        uint256 amount\n    ) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance != type(uint256).max) {\n            require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n            unchecked {\n                _approve(owner, spender, currentAllowance - amount);\n            }\n        }\n    }\n\n    /**\n     * @dev Hook that is called before any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * will be transferred to `to`.\n     * - when `from` is zero, `amount` tokens will be minted for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _beforeTokenTransfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal virtual {}\n\n    /**\n     * @dev Hook that is called after any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * has been transferred to `to`.\n     * - when `from` is zero, `amount` tokens have been minted for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _afterTokenTransfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal virtual {}\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.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 \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\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/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/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n     *\n     * _Available since v4.8._\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        if (success) {\n            if (returndata.length == 0) {\n                // only check isContract if the call was successful and the return data is empty\n                // otherwise we already know that it was a contract\n                require(isContract(target), \"Address: call to non-contract\");\n            }\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason or using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    function _revert(bytes memory returndata, string memory errorMessage) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert(errorMessage);\n        }\n    }\n}\n"
      },
      "@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"
      },
      "@openzeppelin/contracts/utils/math/Math.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    enum Rounding {\n        Down, // Toward negative infinity\n        Up, // Toward infinity\n        Zero // Toward zero\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds up instead\n     * of rounding down.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b - 1) / b can overflow on addition, so we distribute.\n        return a == 0 ? 0 : (a - 1) / b + 1;\n    }\n\n    /**\n     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n     * with further edits by Uniswap Labs also under MIT license.\n     */\n    function mulDiv(\n        uint256 x,\n        uint256 y,\n        uint256 denominator\n    ) internal pure returns (uint256 result) {\n        unchecked {\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n            // variables such that product = prod1 * 2^256 + prod0.\n            uint256 prod0; // Least significant 256 bits of the product\n            uint256 prod1; // Most significant 256 bits of the product\n            assembly {\n                let mm := mulmod(x, y, not(0))\n                prod0 := mul(x, y)\n                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n            }\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (prod1 == 0) {\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            require(denominator > prod1);\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [prod1 prod0].\n            uint256 remainder;\n            assembly {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                prod1 := sub(prod1, gt(remainder, prod0))\n                prod0 := sub(prod0, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n            // See https://cs.stackexchange.com/q/138556/92363.\n\n            // Does not overflow because the denominator cannot be zero at this stage in the function.\n            uint256 twos = denominator & (~denominator + 1);\n            assembly {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [prod1 prod0] by twos.\n                prod0 := div(prod0, twos)\n\n                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from prod1 into prod0.\n            prod0 |= prod1 * twos;\n\n            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv = 1 mod 2^4.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n            // in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2^8\n            inverse *= 2 - denominator * inverse; // inverse mod 2^16\n            inverse *= 2 - denominator * inverse; // inverse mod 2^32\n            inverse *= 2 - denominator * inverse; // inverse mod 2^64\n            inverse *= 2 - denominator * inverse; // inverse mod 2^128\n            inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n            // is no longer required.\n            result = prod0 * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(\n        uint256 x,\n        uint256 y,\n        uint256 denominator,\n        Rounding rounding\n    ) internal pure returns (uint256) {\n        uint256 result = mulDiv(x, y, denominator);\n        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n            result += 1;\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n     *\n     * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        if (a == 0) {\n            return 0;\n        }\n\n        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n        //\n        // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n        //\n        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n        //\n        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n        uint256 result = 1 << (log2(a) >> 1);\n\n        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n        // into the expected uint128 result.\n        unchecked {\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            return min(result, a / result);\n        }\n    }\n\n    /**\n     * @notice Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 128;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 64;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 32;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 16;\n            }\n            if (value >> 8 > 0) {\n                value >>= 8;\n                result += 8;\n            }\n            if (value >> 4 > 0) {\n                value >>= 4;\n                result += 4;\n            }\n            if (value >> 2 > 0) {\n                value >>= 2;\n                result += 2;\n            }\n            if (value >> 1 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10**64) {\n                value /= 10**64;\n                result += 64;\n            }\n            if (value >= 10**32) {\n                value /= 10**32;\n                result += 32;\n            }\n            if (value >= 10**16) {\n                value /= 10**16;\n                result += 16;\n            }\n            if (value >= 10**8) {\n                value /= 10**8;\n                result += 8;\n            }\n            if (value >= 10**4) {\n                value /= 10**4;\n                result += 4;\n            }\n            if (value >= 10**2) {\n                value /= 10**2;\n                result += 2;\n            }\n            if (value >= 10**1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 16;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 8;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 4;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 2;\n            }\n            if (value >> 8 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/StorageSlot.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n *     function _getImplementation() internal view returns (address) {\n *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n *     }\n *\n *     function _setImplementation(address newImplementation) internal {\n *         require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n *     }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n    struct AddressSlot {\n        address value;\n    }\n\n    struct BooleanSlot {\n        bool value;\n    }\n\n    struct Bytes32Slot {\n        bytes32 value;\n    }\n\n    struct Uint256Slot {\n        uint256 value;\n    }\n\n    /**\n     * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n     */\n    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n     */\n    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n     */\n    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n     */\n    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Strings.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n    uint8 private constant _ADDRESS_LENGTH = 20;\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            uint256 length = Math.log10(value) + 1;\n            string memory buffer = new string(length);\n            uint256 ptr;\n            /// @solidity memory-safe-assembly\n            assembly {\n                ptr := add(buffer, add(32, length))\n            }\n            while (true) {\n                ptr--;\n                /// @solidity memory-safe-assembly\n                assembly {\n                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n                }\n                value /= 10;\n                if (value == 0) break;\n            }\n            return buffer;\n        }\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            return toHexString(value, Math.log256(value) + 1);\n        }\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        bytes memory buffer = new bytes(2 * length + 2);\n        buffer[0] = \"0\";\n        buffer[1] = \"x\";\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\n            buffer[i] = _SYMBOLS[value & 0xf];\n            value >>= 4;\n        }\n        require(value == 0, \"Strings: hex length insufficient\");\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n     */\n    function toHexString(address addr) internal pure returns (string memory) {\n        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n *     // Add the library methods\n *     using EnumerableSet for EnumerableSet.AddressSet;\n *\n *     // Declare a set state variable\n *     EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Set type with\n    // bytes32 values.\n    // The Set implementation uses private functions, and user-facing\n    // implementations (such as AddressSet) are just wrappers around the\n    // underlying Set.\n    // This means that we can only create new EnumerableSets for types that fit\n    // in bytes32.\n\n    struct Set {\n        // Storage of set values\n        bytes32[] _values;\n        // Position of the value in the `values` array, plus 1 because index 0\n        // means a value is not in the set.\n        mapping(bytes32 => uint256) _indexes;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function _add(Set storage set, bytes32 value) private returns (bool) {\n        if (!_contains(set, value)) {\n            set._values.push(value);\n            // The value is stored at length-1, but we add 1 to all indexes\n            // and use 0 as a sentinel value\n            set._indexes[value] = set._values.length;\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function _remove(Set storage set, bytes32 value) private returns (bool) {\n        // We read and store the value's index to prevent multiple reads from the same storage slot\n        uint256 valueIndex = set._indexes[value];\n\n        if (valueIndex != 0) {\n            // Equivalent to contains(set, value)\n            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n            // the array, and then remove the last element (sometimes called as 'swap and pop').\n            // This modifies the order of the array, as noted in {at}.\n\n            uint256 toDeleteIndex = valueIndex - 1;\n            uint256 lastIndex = set._values.length - 1;\n\n            if (lastIndex != toDeleteIndex) {\n                bytes32 lastValue = set._values[lastIndex];\n\n                // Move the last value to the index where the value to delete is\n                set._values[toDeleteIndex] = lastValue;\n                // Update the index for the moved value\n                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n            }\n\n            // Delete the slot where the moved value was stored\n            set._values.pop();\n\n            // Delete the index for the deleted slot\n            delete set._indexes[value];\n\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function _contains(Set storage set, bytes32 value) private view returns (bool) {\n        return set._indexes[value] != 0;\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function _length(Set storage set) private view returns (uint256) {\n        return set._values.length;\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function _at(Set storage set, uint256 index) private view returns (bytes32) {\n        return set._values[index];\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function _values(Set storage set) private view returns (bytes32[] memory) {\n        return set._values;\n    }\n\n    // Bytes32Set\n\n    struct Bytes32Set {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _add(set._inner, value);\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _remove(set._inner, value);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n        return _contains(set._inner, value);\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(Bytes32Set storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n        return _at(set._inner, index);\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        bytes32[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // AddressSet\n\n    struct AddressSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(AddressSet storage set, address value) internal returns (bool) {\n        return _add(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(AddressSet storage set, address value) internal returns (bool) {\n        return _remove(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(AddressSet storage set, address value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(AddressSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(AddressSet storage set, uint256 index) internal view returns (address) {\n        return address(uint160(uint256(_at(set._inner, index))));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(AddressSet storage set) internal view returns (address[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        address[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // UintSet\n\n    struct UintSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(UintSet storage set, uint256 value) internal returns (bool) {\n        return _add(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(UintSet storage set, uint256 value) internal returns (bool) {\n        return _remove(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(UintSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n        return uint256(_at(set._inner, index));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(UintSet storage set) internal view returns (uint256[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        uint256[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n}\n"
      },
      "contracts/interfaces/IBrandCentral.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\ninterface IBrandCentral {\n    /// @notice Address of the contract managing list of restricted tickers\n    function claimAuction() external view returns (address);\n}"
      },
      "contracts/interfaces/IBrandNFT.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\ninterface IBrandNFT {\n    /// @notice Return the address of the minting contract\n    function brandCentral() external view returns (address);\n\n    /// @notice Utility for converting string to lowercase equivalent\n    function toLowerCase(string memory _base) external pure returns (string memory);\n\n    /// @notice Get the token ID from a brand ticker\n    function lowercaseBrandTickerToTokenId(string memory _ticker) external view returns (uint256);\n\n    /// @notice Allow a brand owner to set their image and description which will surface in NFT explorers\n    function setBrandMetadata(uint256 _tokenId, string calldata _description, string calldata _imageURI) external;\n\n    /// @notice Vanilla ERC721 transfer function\n    function transferFrom(\n        address from,\n        address to,\n        uint256 tokenId\n    ) external;\n}"
      },
      "contracts/interfaces/ICIP.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\ninterface ICIP {\n    function applyForDecryption(\n        bytes calldata _knotId,\n        address _stakehouse,\n        bytes calldata _aesPublicKey\n    ) external;\n}"
      },
      "contracts/interfaces/IGateKeeper.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\n/// @notice Required interface for gatekeeping whether a member is allowed in a Stakehouse registry, brand or anything else for that matter\ninterface IGateKeeper {\n    /// @notice Called by the Stakehose registry or Community Central before adding a member to a house or brand\n    /// @param _blsPubKey BLS public key of the KNOT being added to the Stakehouse registry or brand\n    function isMemberPermitted(bytes calldata _blsPubKey) external view returns (bool);\n}\n"
      },
      "contracts/interfaces/IGiantMevAndFeesPool.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { LSDNFactory } from \"../liquid-staking/LSDNFactory.sol\";\n\ninterface IGiantMevAndFeesPool {\n    function init(LSDNFactory _factory, address _lpDeployer, address _upgradeManager) external;\n}"
      },
      "contracts/interfaces/IGiantSavETHVaultPool.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { LSDNFactory } from \"../liquid-staking/LSDNFactory.sol\";\n\ninterface IGiantSavETHVaultPool {\n    function init(\n        LSDNFactory _factory,\n        address _lpDeployer,\n        address _feesAndMevGiantPool,\n        address _upgradeManager\n    ) external;\n}"
      },
      "contracts/interfaces/ILiquidStakingManager.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\ninterface ILiquidStakingManager {\n\n    function stakehouse() external view returns (address);\n\n    /// @param _dao address of the DAO\n    /// @param _syndicateFactory address of the syndicate factory\n    /// @param _smartWalletFactory address of the smart wallet factory\n    /// @param _lpTokenFactory LP token factory address required for deployment of savETH vault\n    /// @param _stakehouseTicker 3-5 character long name for the stakehouse to be deployed\n    function init(\n        address _dao,\n        address _syndicateFactory,\n        address _smartWalletFactory,\n        address _lpTokenFactory,\n        address _brand,\n        address _savETHVaultDeployer,\n        address _stakingFundsVaultDeployer,\n        address _optionalGatekeeperDeployer,\n        uint256 _optionalCommission,\n        bool _deployOptionalGatekeeper,\n        string calldata _stakehouseTicker\n    ) external;\n\n    /// @notice function to check valid BLS public key for LSD network\n    /// @param _blsPublicKeyOfKnot BLS public key to check validity for\n    /// @return true if BLS public key is a part of LSD network, false otherwise\n    function isBLSPublicKeyPartOfLSDNetwork(bytes calldata _blsPublicKeyOfKnot) external view returns (bool);\n\n    /// @notice function to check if BLS public key registered with the network or has been withdrawn before staking\n    /// @param _blsPublicKeyOfKnot BLS public key to check validity for\n    /// @return true if BLS public key is banned, false otherwise\n    function isBLSPublicKeyBanned(bytes calldata _blsPublicKeyOfKnot) external view returns (bool);\n}"
      },
      "contracts/interfaces/ILiquidStakingManagerChildContract.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\ninterface ILiquidStakingManagerChildContract {\n    function liquidStakingManager() external view returns (address);\n}"
      },
      "contracts/interfaces/ILPTokenInit.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\n/// @dev Interface for initializing a newly deployed LP token\ninterface ILPTokenInit {\n    function init(\n        address _deployer,\n        address _transferHookProcessor,\n        string calldata tokenSymbol,\n        string calldata tokenName\n    ) external;\n}"
      },
      "contracts/interfaces/IRepresentative.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { IDataStructures } from '@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IDataStructures.sol';\n\n/// @notice Interface to necessary to operate a representative in stakehouse protocol\ninterface IRepresentative {\n\n    /// @notice Get status about representative verification of the contract\n    /// @param _representee - representeee address\n    function isRepresentativeApproved(address _representee) external view returns (bool);\n\n    /// @notice Register validator initials for the representative (initial interaction step)\n    /// @param _representee - Representee address\n    /// @param _blsPublicKey - BLS public key of the representee (knotId)\n    /// @param _blsSignature - Signature over the SSZ DepositData container of the Representee\n    function registerValidatorInitials(\n        address _representee, bytes calldata _blsPublicKey, bytes calldata _blsSignature\n    ) external;\n\n    /// @notice Complete deposit for the representative (After initials were registered)\n    /// @param _representee - Representee address\n    /// @param _blsPublicKey - BLS validation public key\n    /// @param _ciphertext - Encryption packet for disaster recovery\n    /// @param _aesEncryptorKey - Randomly generated AES key used for BLS signing key encryption\n    /// @param _encryptionSignature - ECDSA signature used for encryption validity, issued by committee\n    /// @param _dataRoot - Root of the DepositMessage SSZ container\n    function registerDeposit(\n        address _representee,\n        bytes calldata _blsPublicKey,\n        bytes calldata _ciphertext,\n        bytes calldata _aesEncryptorKey,\n        IDataStructures.EIP712Signature calldata _encryptionSignature,\n        bytes32 _dataRoot\n    ) external payable;\n\n    /// @notice Create stakehouse on behalf of representee\n    /// @param _representee - User registering the stake for _blsPublicKey (managed by representative)\n    /// @param _blsPublicKey - BLS public key of the validator\n    /// @param _ticker - Ticker of the stakehouse to be created\n    /// @param _savETHIndexId ID of the savETH registry index that will receive savETH for the KNOT. Set to zero to create a new index owned by _user\n    /// @param _eth2Report - ETH2 data report for self-validation\n    /// @param _reportSignature - ECDSA signature used for data validity proof by committee\n    function createStakehouse(\n        address _representee,\n        bytes calldata _blsPublicKey,\n        string calldata _ticker,\n        uint256 _savETHIndexId,\n        IDataStructures.ETH2DataReport calldata _eth2Report,\n        IDataStructures.EIP712Signature calldata _reportSignature\n    ) external;\n\n    /// @notice Join the house on behalf of representee and get derivative tokens\n    /// @param _representee - User registering the stake for _blsPublicKey (managed by representative)\n    /// @param _eth2Report - ETH2 data report for self-validation\n    /// @param _stakehouse - stakehouse address to join\n    /// @param _savETHIndexId ID of the savETH registry index that will receive savETH for the KNOT. Set to zero to create a new index owned by _user\n    /// @param _blsPublicKey - BLS public key of the validator\n    /// @param _reportSignature - ECDSA signature used for data validity proof by committee\n    function joinStakehouse(\n        address _representee,\n        bytes calldata _blsPublicKey,\n        address _stakehouse,\n        uint256 _brandTokenId,\n        uint256 _savETHIndexId,\n        IDataStructures.ETH2DataReport calldata _eth2Report,\n        IDataStructures.EIP712Signature calldata _reportSignature\n    ) external;\n}\n"
      },
      "contracts/interfaces/IRestrictedTickerRegistry.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\ninterface IRestrictedTickerRegistry {\n    /// @notice Function for determining if a ticker is restricted for claiming or not\n    function isRestrictedBrandTicker(string calldata _lowerTicker) external view returns (bool);\n}"
      },
      "contracts/interfaces/ISyndicateFactory.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\ninterface ISyndicateFactory {\n\n    /// @notice Emitted when a new syndicate instance is deployed\n    event SyndicateDeployed(address indexed implementation);\n\n    /// @notice Deploy a new knot syndicate with an initial set of KNOTs registered with the syndicate\n    /// @param _contractOwner Ethereum public key that will receive management rights of the contract\n    /// @param _priorityStakingEndBlock Block number when priority sETH staking ends and anyone can stake\n    /// @param _priorityStakers Optional list of addresses that will have priority for staking sETH against each knot registered\n    /// @param _blsPubKeysForSyndicateKnots List of BLS public keys of Stakehouse protocol registered KNOTs participating in syndicate\n    function deploySyndicate(\n        address _contractOwner,\n        uint256 _priorityStakingEndBlock,\n        address[] calldata _priorityStakers,\n        bytes[] calldata _blsPubKeysForSyndicateKnots\n    ) external returns (address);\n\n    /// @notice Helper function to calculate the address of a syndicate contract before it is deployed (CREATE2)\n    /// @param _deployer Address of the account that will trigger the deployment of a syndicate contract\n    /// @param _contractOwner Address of the account that will be the initial owner for parameter management and knot expansion\n    /// @param _numberOfInitialKnots Number of initial knots that will be registered to the syndicate\n    function calculateSyndicateDeploymentAddress(\n        address _deployer,\n        address _contractOwner,\n        uint256 _numberOfInitialKnots\n    ) external view returns (address);\n\n    /// @notice Helper function to generate the CREATE2 salt required for deployment\n    /// @param _deployer Address of the account that will trigger the deployment of a syndicate contract\n    /// @param _contractOwner Address of the account that will be the initial owner for parameter management and knot expansion\n    /// @param _numberOfInitialKnots Number of initial knots that will be registered to the syndicate\n    function calculateDeploymentSalt(\n        address _deployer,\n        address _contractOwner,\n        uint256 _numberOfInitialKnots\n    ) external pure returns (bytes32);\n}\n"
      },
      "contracts/interfaces/ISyndicateInit.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\n/// @dev Interface for initializing a newly deployed Syndicate\ninterface ISyndicateInit {\n    function initialize(\n        address _contractOwner,\n        uint256 _priorityStakingEndBlock,\n        address[] memory _priorityStakers,\n        bytes[] memory _blsPubKeysForSyndicateKnots\n    ) external;\n}"
      },
      "contracts/interfaces/ITransferHookProcessor.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\ninterface ITransferHookProcessor {\n    function beforeTokenTransfer(address _from, address _to, uint256 _amount) external;\n    function afterTokenTransfer(address _from, address _to, uint256 _amount) external;\n}"
      },
      "contracts/interfaces/IWETH.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\ninterface IWETH {\n    function withdraw(uint256 amount) external;\n\n    function balanceOf(address user) view external returns(uint256);\n}"
      },
      "contracts/liquid-staking/Errors.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\ninterface Errors {\n    // common\n    error EmptyArray();\n    error InconsistentArrayLength();\n    error InvalidAmount();\n    error InvalidBalance();\n    error InvalidCaller();\n    \n    // GiantMevAndFeesPool\n    error InvalidStakingFundsVault();\n    error NoDerivativesMinted();\n    error OutsideRange();\n    error TokenMismatch();\n\n    // GiantSavETHVaultPool\n    error InvalidSavETHVault();\n    error FeesAndMevPoolCannotMatch();\n    error DETHNotReadyForWithdraw();\n    error InvalidWithdrawlBatch();\n    error NoCommonInterest();\n    error ETHStakedOrDerivativesMinted();\n}\n"
      },
      "contracts/liquid-staking/ETHPoolLPFactory.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { Strings } from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport { StakehouseAPI } from \"@blockswaplab/stakehouse-solidity-api/contracts/StakehouseAPI.sol\";\nimport { IDataStructures } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IDataStructures.sol\";\n\nimport { LPTokenFactory } from \"./LPTokenFactory.sol\";\nimport { LPToken } from \"./LPToken.sol\";\n\ninterface ILSM {\n    function isBLSPublicKeyBanned(bytes calldata _blsPublicKey) external view returns (bool);\n}\n\n/// @dev For pools accepting ETH for validator staking, this contract will manage issuing LPs for deposits\nabstract contract ETHPoolLPFactory is StakehouseAPI {\n\n    /// @notice signalize withdrawing of ETH by depositor\n    event ETHWithdrawnByDepositor(address depositor, uint256 amount);\n\n    /// @notice signalize burning of LP token\n    event LPTokenBurnt(bytes blsPublicKeyOfKnot, address token, address depositor, uint256 amount);\n\n    /// @notice signalize issuance of new LP token\n    event NewLPTokenIssued(bytes blsPublicKeyOfKnot, address token, address firstDepositor, uint256 amount);\n\n    /// @notice signalize issuance of existing LP token\n    event LPTokenMinted(bytes blsPublicKeyOfKnot, address token, address depositor, uint256 amount);\n\n    /// @dev Base name and symbol used for deploying new LP tokens per KNOT\n    string internal baseLPTokenName;\n    string internal baseLPTokenSymbol;\n\n    /// @notice count of unique LP tokens issued for ETH deposits\n    uint256 public numberOfLPTokensIssued;\n\n    /// @notice Maximum amount that can be staked per validator in WEI\n    uint256 public maxStakingAmountPerValidator;\n\n    /// @notice Minimum amount that can be staked per validator in WEI\n    uint256 public constant MIN_STAKING_AMOUNT = 0.001 ether;\n\n    /// @notice Factory for the deployment of KNOT<>LP Tokens that can be used to redeem dETH\n    LPTokenFactory public lpTokenFactory;\n\n    /// @notice LP token address deployed for a KNOT's BLS public key\n    mapping(bytes => LPToken) public lpTokenForKnot;\n\n    /// @notice KNOT BLS public key associated with the LP token\n    mapping(LPToken => bytes) public KnotAssociatedWithLPToken;\n\n    /// @notice Allow users to rotate the ETH from many LP to another in the event that a BLS key is never staked\n    /// @param _oldLPTokens Array of old LP tokens to be burnt\n    /// @param _newLPTokens Array of new LP tokens to be minted in exchange of old LP tokens\n    /// @param _amounts Array of amount of tokens to be exchanged\n    function batchRotateLPTokens(\n        LPToken[] calldata _oldLPTokens,\n        LPToken[] calldata _newLPTokens,\n        uint256[] calldata _amounts\n    ) external {\n        uint256 numOfRotations = _oldLPTokens.length;\n        require(numOfRotations > 0, \"Empty arrays\");\n        require(numOfRotations == _newLPTokens.length, \"Inconsistent arrays\");\n        require(numOfRotations == _amounts.length, \"Inconsistent arrays\");\n\n        for (uint256 i; i < numOfRotations; ++i) {\n            rotateLPTokens(\n                _oldLPTokens[i],\n                _newLPTokens[i],\n                _amounts[i]\n            );\n        }\n    }\n\n    /// @notice Allow users to rotate the ETH from one LP token to another in the event that the BLS key is never staked\n    /// @param _oldLPToken Instance of the old LP token (to be burnt)\n    /// @param _newLPToken Instane of the new LP token (to be minted)\n    /// @param _amount Amount of LP tokens to be rotated/converted from old to new\n    function rotateLPTokens(LPToken _oldLPToken, LPToken _newLPToken, uint256 _amount) public {\n        require(address(_oldLPToken) != address(0), \"Zero address\");\n        require(address(_newLPToken) != address(0), \"Zero address\");\n        require(_oldLPToken != _newLPToken, \"Incorrect rotation to same token\");\n        require(_amount >= MIN_STAKING_AMOUNT, \"Amount cannot be zero\");\n        require(_amount % MIN_STAKING_AMOUNT == 0, \"Amount not multiple of min staking\");\n        require(_amount <= _oldLPToken.balanceOf(msg.sender), \"Not enough balance\");\n        require(_oldLPToken.lastInteractedTimestamp(msg.sender) + 30 minutes < block.timestamp, \"Liquidity is still fresh\");\n        require(_amount + _newLPToken.totalSupply() <= maxStakingAmountPerValidator, \"Not enough mintable tokens\");\n\n        bytes memory blsPublicKeyOfPreviousKnot = KnotAssociatedWithLPToken[_oldLPToken];\n        bytes memory blsPublicKeyOfNewKnot = KnotAssociatedWithLPToken[_newLPToken];\n\n        require(blsPublicKeyOfPreviousKnot.length == 48, \"Incorrect BLS public key\");\n        require(blsPublicKeyOfNewKnot.length == 48, \"Incorrect BLS public key\");\n\n        require(\n            getAccountManager().blsPublicKeyToLifecycleStatus(blsPublicKeyOfPreviousKnot) == IDataStructures.LifecycleStatus.INITIALS_REGISTERED,\n            \"Lifecycle status must be one\"\n        );\n\n        require(\n            getAccountManager().blsPublicKeyToLifecycleStatus(blsPublicKeyOfNewKnot) == IDataStructures.LifecycleStatus.INITIALS_REGISTERED,\n            \"Lifecycle status must be one\"\n        );\n\n        // M-02\n        ILSM manager = ILSM(_newLPToken.liquidStakingManager());\n        require(!manager.isBLSPublicKeyBanned(blsPublicKeyOfNewKnot), \"BLS public key is banned\");\n\n        // burn old tokens and mint new ones\n        _oldLPToken.burn(msg.sender, _amount);\n        emit LPTokenBurnt(blsPublicKeyOfPreviousKnot, address(_oldLPToken), msg.sender, _amount);\n\n        _newLPToken.mint(msg.sender, _amount);\n        emit LPTokenMinted(KnotAssociatedWithLPToken[_newLPToken], address(_newLPToken), msg.sender, _amount);\n    }\n\n    /// @dev Internal business logic for processing staking deposits for single or batch deposits\n    function _depositETHForStaking(bytes calldata _blsPublicKeyOfKnot, uint256 _amount, bool _enableTransferHook) internal {\n        require(_amount >= MIN_STAKING_AMOUNT, \"Min amount not reached\");\n        require(_amount % MIN_STAKING_AMOUNT == 0, \"Amount not multiple of min staking\");\n        require(_blsPublicKeyOfKnot.length == 48, \"Invalid BLS public key\");\n\n        // LP token issued for the KNOT\n        // will be zero for a new KNOT because the mapping doesn't exist\n        LPToken lpToken = lpTokenForKnot[_blsPublicKeyOfKnot];\n        if(address(lpToken) != address(0)) {\n            // KNOT and it's LP token is already registered\n            // mint the respective LP tokens for the user\n\n            // total supply after minting the LP token must not exceed maximum staking amount per validator\n            require(lpToken.totalSupply() + _amount <= maxStakingAmountPerValidator, \"Amount exceeds the staking limit for the validator\");\n\n            // mint LP tokens for the depoistor with 1:1 ratio of LP tokens and ETH supplied\n            lpToken.mint(msg.sender, _amount);\n            emit LPTokenMinted(_blsPublicKeyOfKnot, address(lpToken), msg.sender, _amount);\n        }\n        else {\n            // check that amount doesn't exceed max staking amount per validator\n            require(_amount <= maxStakingAmountPerValidator, \"Amount exceeds the staking limit for the validator\");\n\n            // mint new LP tokens for the new KNOT\n            // add the KNOT in the mapping\n            string memory tokenNumber = Strings.toString(numberOfLPTokensIssued);\n            string memory tokenName = string(abi.encodePacked(baseLPTokenName, tokenNumber));\n            string memory tokenSymbol = string(abi.encodePacked(baseLPTokenSymbol, tokenNumber));\n\n            // deploy new LP token and optionally enable transfer notifications\n            LPToken newLPToken = _enableTransferHook ?\n                             LPToken(lpTokenFactory.deployLPToken(address(this), address(this), tokenSymbol, tokenName)) :\n                             LPToken(lpTokenFactory.deployLPToken(address(this), address(0), tokenSymbol, tokenName));\n\n            // increase the count of LP tokens\n            numberOfLPTokensIssued++;\n\n            // register the BLS Public Key with the LP token\n            lpTokenForKnot[_blsPublicKeyOfKnot] = newLPToken;\n            KnotAssociatedWithLPToken[newLPToken] = _blsPublicKeyOfKnot;\n\n            // mint LP tokens for the depoistor with 1:1 ratio of LP tokens and ETH supplied\n            newLPToken.mint(msg.sender, _amount);\n            emit NewLPTokenIssued(_blsPublicKeyOfKnot, address(newLPToken), msg.sender, _amount);\n        }\n    }\n}"
      },
      "contracts/liquid-staking/GiantLP.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { ERC20 } from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport { ITransferHookProcessor } from \"../interfaces/ITransferHookProcessor.sol\";\n\ncontract GiantLP is ERC20 {\n    uint256 constant MIN_TRANSFER_AMOUNT = 0.001 ether;\n\n    /// @notice Address of giant pool that deployed the giant LP token\n    address public pool;\n\n    /// @notice Optional address of contract that will process transfers of giant LP\n    ITransferHookProcessor public transferHookProcessor;\n\n    /// @notice Last interacted timestamp for a given address\n    mapping(address => uint256) public lastInteractedTimestamp;\n\n    constructor(\n        address _pool,\n        address _transferHookProcessor,\n        string memory _name,\n        string memory _symbol\n    ) ERC20(_name, _symbol) {\n        pool = _pool;\n        transferHookProcessor = ITransferHookProcessor(_transferHookProcessor);\n    }\n\n    function mint(address _recipient, uint256 _amount) external {\n        require(msg.sender == pool, \"Only pool\");\n        _mint(_recipient, _amount);\n    }\n\n    function burn(address _recipient, uint256 _amount) external {\n        require(msg.sender == pool, \"Only pool\");\n        _burn(_recipient, _amount);\n    }\n\n    function _beforeTokenTransfer(address _from, address _to, uint256 _amount) internal override {\n        require(_from != _to && _amount >= MIN_TRANSFER_AMOUNT, \"Transfer Error\");\n        if (address(transferHookProcessor) != address(0)) ITransferHookProcessor(transferHookProcessor).beforeTokenTransfer(_from, _to, _amount);\n    }\n\n    function _afterTokenTransfer(address _from, address _to, uint256 _amount) internal override {\n        lastInteractedTimestamp[_from] = block.timestamp;\n        lastInteractedTimestamp[_to] = block.timestamp;\n        if (address(transferHookProcessor) != address(0)) ITransferHookProcessor(transferHookProcessor).afterTokenTransfer(_from, _to, _amount);\n    }\n}"
      },
      "contracts/liquid-staking/GiantLPDeployer.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { ERC1967Proxy } from \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\";\nimport { GiantLP } from \"./GiantLP.sol\";\n\ncontract GiantLPDeployer {\n\n    event NewDeployment(address indexed instance);\n\n    /// @notice Deploy a giant LP on behalf of the LSDN factory\n    function deployToken(\n        address _pool,\n        address _transferHookProcessor,\n        string memory _name,\n        string memory _symbol\n    ) external returns (address) {\n        address newToken = address(new GiantLP(_pool, _transferHookProcessor, _name, _symbol));\n\n        emit NewDeployment(newToken);\n\n        return newToken;\n    }\n}"
      },
      "contracts/liquid-staking/GiantMevAndFeesPool.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: BUSL-1.1\n\nimport { GiantLP } from \"./GiantLP.sol\";\nimport { StakingFundsVault } from \"./StakingFundsVault.sol\";\nimport { LPToken } from \"./LPToken.sol\";\nimport { GiantPoolBase } from \"./GiantPoolBase.sol\";\nimport { SyndicateRewardsProcessor } from \"./SyndicateRewardsProcessor.sol\";\nimport { LSDNFactory } from \"./LSDNFactory.sol\";\nimport { LPToken } from \"./LPToken.sol\";\nimport { GiantLPDeployer } from \"./GiantLPDeployer.sol\";\nimport { Errors } from \"./Errors.sol\";\nimport { UUPSUpgradeable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport { OwnableUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport { MainnetConstants, GoerliConstants } from \"@blockswaplab/stakehouse-solidity-api/contracts/StakehouseAPI.sol\";\nimport { IDataStructures } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IDataStructures.sol\";\nimport { IAccountManager } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IAccountManager.sol\";\n\n/// @notice A giant pool that can provide liquidity to any liquid staking network's staking funds vault\ncontract GiantMevAndFeesPool is\n    GiantPoolBase,\n    SyndicateRewardsProcessor,\n    UUPSUpgradeable,\n    OwnableUpgradeable\n{\n    using EnumerableSet for EnumerableSet.UintSet;\n\n    error ContractPaused();\n    error ReentrancyCall();\n\n    /// @notice Emitted when a user withdraws their LSD LP token by burning their giant LP\n    event LPWithdrawn(address indexed lp, address indexed user);\n\n    /// @notice Emitted when pause or unpause is triggered\n    event Paused(bool activated);\n\n    /// @notice Total amount of LP allocated to receive pro-rata MEV and fees rewards\n    uint256 public totalLPAssociatedWithDerivativesMinted;\n\n    /// @notice Snapshotting pro-rata share of tokens for last claim by address\n    mapping(address => uint256) public lastAccumulatedLPAtLastLiquiditySize;\n\n    /// @notice Whether the contract is paused\n    bool public paused;\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() initializer {}\n\n    function init(LSDNFactory _factory, address _lpDeployer, address _upgradeManager) external virtual initializer {\n        lpTokenETH = GiantLP(GiantLPDeployer(_lpDeployer).deployToken(address(this), address(this), \"GiantETHLP\", \"gMevETH\"));\n        liquidStakingDerivativeFactory = _factory;\n        batchSize = 4 ether;\n        _transferOwnership(_upgradeManager);\n        __ReentrancyGuard_init();\n    }\n\n    /// @dev Owner based upgrades\n    function _authorizeUpgrade(address newImplementation)\n    internal\n    onlyOwner\n    override\n    {}\n\n    /// @notice Allow the contract owner to trigger pausing of core features\n    function togglePause(bool _paused) external onlyOwner {\n        paused = _paused;\n        emit Paused(_paused);\n    }\n\n    /// @notice Stake ETH against multiple BLS keys within multiple LSDNs and specify the amount of ETH being supplied for each key\n    /// @dev Uses contract balance for funding and get Staking Funds Vault LP in exchange for ETH\n    /// @param _stakingFundsVault List of mev and fees vaults being interacted with\n    /// @param _ETHTransactionAmounts ETH being attached to each savETH vault in the list\n    /// @param _blsPublicKeyOfKnots For every staking funds vault, the list of BLS keys of LSDN validators receiving funding\n    /// @param _amounts List of amounts of ETH being staked per BLS public key\n    function batchDepositETHForStaking(\n        address[] calldata _stakingFundsVault,\n        uint256[] calldata _ETHTransactionAmounts,\n        bytes[][] calldata _blsPublicKeyOfKnots,\n        uint256[][] calldata _amounts\n    ) external whenContractNotPaused nonReentrant {\n        uint256 numOfVaults = _stakingFundsVault.length;\n        if (numOfVaults == 0) revert Errors.EmptyArray();\n        if (numOfVaults != _ETHTransactionAmounts.length) revert Errors.InconsistentArrayLength();\n        if (numOfVaults != _blsPublicKeyOfKnots.length) revert Errors.InconsistentArrayLength();\n        if (numOfVaults != _amounts.length) revert Errors.InconsistentArrayLength();\n\n        updateAccumulatedETHPerLP();\n\n        for (uint256 i; i < numOfVaults; ++i) {\n            // As ETH is being deployed to a staking funds vault, it is no longer idle\n            idleETH -= _ETHTransactionAmounts[i];\n\n            if (!liquidStakingDerivativeFactory.isStakingFundsVault(_stakingFundsVault[i])) revert Errors.InvalidStakingFundsVault();\n\n            StakingFundsVault(payable(_stakingFundsVault[i])).batchDepositETHForStaking{ value: _ETHTransactionAmounts[i] }(\n                _blsPublicKeyOfKnots[i],\n                _amounts[i]\n            );\n\n            uint256 numOfPublicKeys = _blsPublicKeyOfKnots[i].length;\n            for (uint256 j; j < numOfPublicKeys; ++j) {\n                // because of withdrawal batch allocation, partial funding amounts would add too much complexity for later allocation\n                if (_amounts[i][j] != 4 ether) revert Errors.InvalidAmount();\n                _onStake(_blsPublicKeyOfKnots[i][j]);\n                isBLSPubKeyFundedByGiantPool[_blsPublicKeyOfKnots[i][j]] = true;\n            }\n        }\n    }\n\n    /// @notice Allow a giant LP to claim a % of the revenue received by the MEV and Fees Pool\n    function claimRewards(\n        address _recipient,\n        address[] calldata _stakingFundsVaults,\n        bytes[][] calldata _blsPublicKeysForKnots\n    ) external whenContractNotPaused {\n        if (totalLPAssociatedWithDerivativesMinted == 0) revert Errors.NoDerivativesMinted();\n\n        _fetchGiantPoolRewards(_stakingFundsVaults, _blsPublicKeysForKnots);\n\n        claimExistingRewards(_recipient);\n    }\n\n    /// @notice Fetch ETH rewards from staking funds vaults funded from the giant pool without sending to giant LPs\n    function fetchGiantPoolRewards(\n        address[] calldata _stakingFundsVaults,\n        bytes[][] calldata _blsPublicKeysForKnots\n    ) public whenContractNotPaused nonReentrant {\n        _fetchGiantPoolRewards(_stakingFundsVaults, _blsPublicKeysForKnots);\n        updateAccumulatedETHPerLP();\n    }\n\n    /// @notice Allow a user to claim their reward balance without fetching upstream ETH rewards (that are in syndicates)\n    function claimExistingRewards(address _recipient) public whenContractNotPaused nonReentrant {\n        updateAccumulatedETHPerLP();\n        _transferETH(\n            _recipient,\n            _distributeETHRewardsToUserForToken(\n                msg.sender,\n                address(lpTokenETH),\n                _getTotalLiquidityInActiveRangeForUser(msg.sender),\n                _recipient\n            )\n        );\n    }\n\n    /// @notice Any ETH that has not been utilized by a Staking Funds vault can be brought back into the giant pool\n    /// @param _stakingFundsVaults List of staking funds vaults this contract will contact\n    /// @param _lpTokens List of LP tokens that the giant pool holds which represents ETH in a staking funds vault\n    /// @param _amounts Amounts of LP within the giant pool being burnt\n    function bringUnusedETHBackIntoGiantPool(\n        address[] calldata _stakingFundsVaults,\n        LPToken[][] calldata _lpTokens,\n        uint256[][] calldata _amounts\n    ) external whenContractNotPaused nonReentrant {\n        uint256 numOfVaults = _stakingFundsVaults.length;\n        if (numOfVaults == 0) revert Errors.EmptyArray();\n        if (numOfVaults != _lpTokens.length) revert Errors.InconsistentArrayLength();\n        if (numOfVaults != _amounts.length) revert Errors.InconsistentArrayLength();\n\n        updateAccumulatedETHPerLP();\n\n        for (uint256 i; i < numOfVaults; ++i) {\n            StakingFundsVault vault = StakingFundsVault(payable(_stakingFundsVaults[i]));\n            if (!liquidStakingDerivativeFactory.isStakingFundsVault(address(vault))) revert Errors.InvalidStakingFundsVault();\n\n            vault.burnLPTokensForETH(_lpTokens[i], _amounts[i]);\n\n            uint256 numOfTokens = _lpTokens[i].length;\n            for (uint256 j; j < numOfTokens; ++j) {\n                // Increase the amount of ETH that's idle\n                idleETH += _amounts[i][j];\n\n                bytes memory blsPubKey = vault.KnotAssociatedWithLPToken(_lpTokens[i][j]);\n                _onBringBackETHToGiantPool(blsPubKey);\n                isBLSPubKeyFundedByGiantPool[blsPubKey] = false;\n            }\n        }\n    }\n\n    /// @notice Allow giant pool LP holders to withdraw LP tokens from LSD networks that they funded\n    /// @param _lpToken Address of the LP token that the user is withdrawing from the giant pool\n    /// @param _amount Of LP tokens user is withdrawing and also amount of giant tokens being burnt\n    function withdrawLP(\n        LPToken _lpToken,\n        uint256 _amount\n    ) external whenContractNotPaused nonReentrant {\n        // Check the token that the giant pool should own was deployed by an authenticated staking funds vault\n        address stakingFundsVault = _lpToken.deployer();\n        if (!liquidStakingDerivativeFactory.isStakingFundsVault(stakingFundsVault)) revert Errors.InvalidStakingFundsVault();\n        if (_lpToken.balanceOf(address(this)) < _amount) revert Errors.InvalidBalance();\n        if (lpTokenETH.balanceOf(msg.sender) < _amount) revert Errors.InvalidBalance();\n        if (_amount < MIN_STAKING_AMOUNT) revert Errors.InvalidAmount();\n\n        bytes memory blsPublicKey = StakingFundsVault(payable(stakingFundsVault)).KnotAssociatedWithLPToken(_lpToken);\n        if (!_isDerivativesMinted(blsPublicKey)) revert Errors.NoDerivativesMinted();\n\n        _lpToken.transfer(msg.sender, _amount);\n        lpTokenETH.burn(msg.sender, _amount);\n\n        uint256 batchId = allocatedWithdrawalBatchForBlsPubKey[blsPublicKey];\n        _reduceUserAmountFundedInBatch(batchId, msg.sender, _amount);\n\n        emit LPWithdrawn(address(_lpToken), msg.sender);\n    }\n\n    /// @notice Distribute any new ETH received to LP holders\n    function updateAccumulatedETHPerLP() public whenContractNotPaused {\n        _updateAccumulatedETHPerLP(totalLPAssociatedWithDerivativesMinted);\n    }\n\n    /// @notice Allow giant LP token to notify pool about transfers so the claimed amounts can be processed\n    function beforeTokenTransfer(address _from, address _to, uint256 _amount) external whenContractNotPaused {\n        if (msg.sender != address(lpTokenETH)) revert Errors.InvalidCaller();\n\n        updateAccumulatedETHPerLP();\n\n        // Make sure that `_from` gets total accrued before transfer as post transferred anything owed will be wiped\n        if (_from != address(0)) {\n            (uint256 activeLiquidityFrom, uint256 lpBalanceFromBefore) = _distributePendingETHRewards(_from);\n            if (lpTokenETH.balanceOf(_from) != lpBalanceFromBefore) revert ReentrancyCall();\n\n            lastAccumulatedLPAtLastLiquiditySize[_from] = accumulatedETHPerLPShare;\n            claimed[_from][msg.sender] = activeLiquidityFrom == 0 ?\n                0 : (accumulatedETHPerLPShare * (activeLiquidityFrom - _amount)) / PRECISION;\n        }\n\n        // Make sure that `_to` gets total accrued before transfer as post transferred anything owed will be wiped\n        if (_to != address(0)) {\n            (uint256 activeLiquidityTo, uint256 lpBalanceToBefore) = _distributePendingETHRewards(_to);\n            if (lpTokenETH.balanceOf(_to) != lpBalanceToBefore) revert ReentrancyCall();\n            if (lpBalanceToBefore > 0) {\n                claimed[_to][msg.sender] = (accumulatedETHPerLPShare * (activeLiquidityTo + _amount)) / PRECISION;\n            } else {\n                claimed[_to][msg.sender] = (accumulatedETHPerLPShare * _amount) / PRECISION;\n            }\n\n            lastAccumulatedLPAtLastLiquiditySize[_to] = accumulatedETHPerLPShare;\n        }\n    }\n\n    /// @notice Total rewards received by this contract from the syndicate excluding idle ETH from LP depositors\n    function totalRewardsReceived() public view override returns (uint256) {\n        return address(this).balance + totalClaimed - idleETH;\n    }\n\n    /// @notice Preview total ETH accrued by an address from Syndicate rewards\n    function previewAccumulatedETH(\n        address _user,\n        address[] calldata _stakingFundsVaults,\n        LPToken[][] calldata _lpTokens\n    ) external view returns (uint256) {\n        uint256 numOfVaults = _stakingFundsVaults.length;\n        if (numOfVaults != _lpTokens.length) revert Errors.InconsistentArrayLength();\n\n        uint256 accumulated;\n        for (uint256 i; i < numOfVaults; ++i) {\n            accumulated += StakingFundsVault(payable(_stakingFundsVaults[i])).batchPreviewAccumulatedETH(\n                address(this),\n                _lpTokens[i]\n            );\n        }\n\n        return _previewAccumulatedETH(\n            _user,\n            address(lpTokenETH),\n            _getTotalLiquidityInActiveRangeForUser(_user),\n            totalLPAssociatedWithDerivativesMinted,\n            accumulated\n        );\n    }\n\n    /// @notice Get total liquidity that is in active reward range for user\n    function getTotalLiquidityInActiveRangeForUser(address _user) external view returns (uint256) {\n        return _getTotalLiquidityInActiveRangeForUser(_user);\n    }\n\n    /// @dev Re-usable function for distributing rewards based on having an LP balance and active liquidity from minting derivatives\n    function _distributePendingETHRewards(address _receiver) internal returns (\n        uint256 activeLiquidityReceivingRewards,\n        uint256 lpTokenETHBalance\n    ) {\n        lpTokenETHBalance = lpTokenETH.balanceOf(_receiver);\n        if (lpTokenETHBalance > 0) {\n            activeLiquidityReceivingRewards = _getTotalLiquidityInActiveRangeForUser(_receiver);\n            if (activeLiquidityReceivingRewards > 0) {\n                _transferETH(\n                    _receiver,\n                    _distributeETHRewardsToUserForToken(\n                        _receiver,\n                        address(lpTokenETH),\n                        activeLiquidityReceivingRewards,\n                        _receiver\n                    )\n                );\n            }\n        }\n    }\n\n    /// @notice Allow liquid staking managers to notify the giant pool about derivatives minted for a key\n    function _onMintDerivatives(bytes calldata _blsPublicKey) internal override {\n        // use this to update active liquidity range for distributing rewards\n        if (isBLSPubKeyFundedByGiantPool[_blsPublicKey]) {\n            // Capture accumulated LP at time of minting derivatives\n            accumulatedETHPerLPAtTimeOfMintingDerivatives[_blsPublicKey] = accumulatedETHPerLPShare;\n\n            totalLPAssociatedWithDerivativesMinted += 4 ether;\n        }\n    }\n\n    /// @dev Total claimed for a user and LP token needs to be based on when derivatives were minted so that pro-rated share is not earned too early causing phantom balances\n    function _getTotalClaimedForUserAndToken(\n        address _user,\n        address _token,\n        uint256 _currentBalance\n    ) internal override view returns (uint256) {\n        uint256 claimedSoFar = claimed[_user][_token];\n\n        // Handle the case where all LP is withdrawn or some derivatives are not minted\n        if (_currentBalance == 0) revert Errors.InvalidAmount();\n\n        if (claimedSoFar > 0) {\n            claimedSoFar = (lastAccumulatedLPAtLastLiquiditySize[_user] * _currentBalance) / PRECISION;\n        } else {\n            uint256 batchId = setOfAssociatedDepositBatches[_user].at(0);\n            bytes memory blsPublicKey = allocatedBlsPubKeyForWithdrawalBatch[batchId];\n            claimedSoFar = (_currentBalance * accumulatedETHPerLPAtTimeOfMintingDerivatives[blsPublicKey]) / PRECISION;\n        }\n\n        // Either user has a claimed amount or their claimed amount needs to be based on accumulated ETH at time of minting derivatives\n        return claimedSoFar;\n    }\n\n    /// @dev Use _getTotalClaimedForUserAndToken to correctly track and save total claimed by a user for a token\n    function _increaseClaimedForUserAndToken(\n        address _user,\n        address _token,\n        uint256 _increase,\n        uint256 _balance\n    ) internal override {\n        // _getTotalClaimedForUserAndToken will factor in accumulated ETH at time of minting derivatives\n        lastAccumulatedLPAtLastLiquiditySize[_user] = accumulatedETHPerLPShare;\n        claimed[_user][_token] = _getTotalClaimedForUserAndToken(_user, _token, _balance) + _increase;\n    }\n\n    /// @dev Utility for fetching total ETH that is eligble to receive rewards for a user\n    function _getTotalLiquidityInActiveRangeForUser(address _user) internal view returns (uint256) {\n        uint256 totalLiquidityInActiveRangeForUser;\n        uint256 totalNumOfBatches = setOfAssociatedDepositBatches[_user].length();\n\n        for (uint256 i; i < totalNumOfBatches; ++i) {\n            uint256 batchId = setOfAssociatedDepositBatches[_user].at(i);\n\n            if (!_isDerivativesMinted(allocatedBlsPubKeyForWithdrawalBatch[batchId])) {\n                // Derivatives are not minted for this batch so continue as elements in enumerable set are not guaranteed any order\n                continue;\n            }\n\n            totalLiquidityInActiveRangeForUser += totalETHFundedPerBatch[_user][batchId];\n        }\n\n        return totalLiquidityInActiveRangeForUser;\n    }\n\n    /// @dev Given a BLS pub key, whether derivatives are minted\n    function _isDerivativesMinted(bytes memory _blsPubKey) internal view returns (bool) {\n        return getAccountManager().blsPublicKeyToLifecycleStatus(_blsPubKey) == IDataStructures.LifecycleStatus.TOKENS_MINTED;\n    }\n\n    /// @dev Internal business logic for fetching fees and mev rewards from specified LSD networks\n    function _fetchGiantPoolRewards(\n        address[] calldata _stakingFundsVaults,\n        bytes[][] calldata _blsPublicKeysForKnots\n    ) internal {\n        uint256 numOfVaults = _stakingFundsVaults.length;\n        if (numOfVaults == 0) revert Errors.EmptyArray();\n        if (numOfVaults != _blsPublicKeysForKnots.length) revert Errors.InconsistentArrayLength();\n        for (uint256 i; i < numOfVaults; ++i) {\n            StakingFundsVault vault = StakingFundsVault(payable(_stakingFundsVaults[i]));\n            if (!liquidStakingDerivativeFactory.isStakingFundsVault(address(vault))) revert Errors.InvalidStakingFundsVault();\n            vault.claimRewards(\n                address(this),\n                _blsPublicKeysForKnots[i]\n            );\n        }\n    }\n\n    // @dev Get the interface connected to the AccountManager smart contract\n    function getAccountManager() internal view virtual returns (IAccountManager accountManager) {\n        uint256 chainId;\n\n        assembly {\n            chainId := chainid()\n        }\n\n        if(chainId == MainnetConstants.CHAIN_ID) {\n            accountManager = IAccountManager(MainnetConstants.AccountManager);\n        }\n\n        else if (chainId == GoerliConstants.CHAIN_ID) {\n            accountManager = IAccountManager(GoerliConstants.AccountManager);\n        }\n\n        else {\n            revert('CHAIN');\n        }\n    }\n\n    function _assertContractNotPaused() internal override {\n        if (paused) revert ContractPaused();\n    }\n}"
      },
      "contracts/liquid-staking/GiantPoolBase.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: BUSL-1.1\n\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\nimport { LSDNFactory } from \"./LSDNFactory.sol\";\nimport { GiantLP } from \"./GiantLP.sol\";\nimport { LPToken } from \"./LPToken.sol\";\nimport { ITransferHookProcessor } from \"../interfaces/ITransferHookProcessor.sol\";\nimport { ETHTransferHelper } from \"../transfer/ETHTransferHelper.sol\";\n\nabstract contract GiantPoolBase is ITransferHookProcessor, ReentrancyGuardUpgradeable, ETHTransferHelper {\n\n    using EnumerableSet for EnumerableSet.UintSet;\n\n    error BelowMinimum();\n    error InvalidAmount();\n    error InvalidWithdrawal();\n    error ComeBackLater();\n    error BLSKeyStaked();\n    error BLSKeyNotStaked();\n    error ErrorWithdrawing();\n    error OnlyManager();\n    error InvalidCaller();\n    error InvalidBalance();\n    error NotEnoughIdleETH();\n    error InvalidTransfer();\n    error InvalidJump();\n    error InvalidExistingPosition();\n    error NoRecycledETH();\n    error NoFundingInSelectedBatch();\n    error BatchAllocated();\n    error UnableToDeleteRecycledBatch();\n    error NoFullBatchAvailable();\n\n    /// @notice Emitted when an account deposits Ether into the giant pool\n    event ETHDeposited(address indexed sender, uint256 amount);\n\n    /// @notice Emitted when giant LP is burnt to recover ETH\n    event LPBurnedForETH(address indexed sender, uint256 amount);\n\n    /// @notice Emitted when a deposit associates a depositor with a ticket for withdrawal\n    event WithdrawalBatchAssociatedWithUser(address indexed user, uint256 indexed batchId);\n\n    /// @notice Emitted when user updates their staked position\n    event WithdrawalBatchUpdated(address indexed user, uint256 indexed batchId, uint256 newAmount);\n\n    /// @notice Emitted when a withdrawal batch associated with a depositor is removed\n    event WithdrawalBatchRemovedFromUser(address indexed user, uint256 indexed batchId);\n\n    /// @notice Emitted when a withdrawal batch is associated with a BLS pub key\n    event WithdrawalBatchAssociatedWithBLSKey(bytes key, uint256 indexed batchId);\n\n    /// @notice Emitted when a withdrawal batch is disassociated with a BLS pub key\n    event WithdrawalBatchDisassociatedWithBLSKey(bytes key, uint256 indexed batchId);\n\n    /// @notice Emitted when a user is jumping a deposit queue because another user withdrew\n    event QueueJumped(address indexed user, uint256 indexed targetPosition, uint256 indexed existingPosition, uint256 amount);\n\n    /// @notice Minimum amount of Ether that can be deposited into the contract\n    uint256 public constant MIN_STAKING_AMOUNT = 0.001 ether;\n\n    /// @notice Size of funding offered per BLS public key\n    uint256 public batchSize;\n\n    /// @notice Total amount of ETH sat idle ready for either withdrawal or depositing into a liquid staking network\n    uint256 public idleETH;\n\n    /// @notice Historical amount of ETH received by all depositors\n    uint256 public totalETHFromLPs;\n\n    /// @notice LP token representing all ETH deposited and any ETH converted into savETH vault LP tokens from any liquid staking network\n    GiantLP public lpTokenETH;\n\n    /// @notice Address of the liquid staking derivative factory that provides a source of truth on individual networks that can be funded\n    LSDNFactory public liquidStakingDerivativeFactory;\n\n    /// @notice Number of batches of 24 ETH that have been deposited to the open pool\n    uint256 public depositBatchCount;\n\n    /// @notice Number of batches that have been deployed to a liquid staking network\n    uint256 public stakedBatchCount;\n\n    /// @notice Based on a user deposit, all the historical batch positions later used for claiming\n    mapping(address => EnumerableSet.UintSet) internal setOfAssociatedDepositBatches;\n\n    /// @notice Whether the giant pool funded the ETH for staking\n    mapping(bytes => bool) internal isBLSPubKeyFundedByGiantPool;\n\n    /// @notice For a given BLS key, allocated withdrawal batch\n    mapping(bytes => uint256) public allocatedWithdrawalBatchForBlsPubKey;\n\n    /// @notice For a given withdrawal batch, allocated BLS key\n    mapping(uint256 => bytes) public allocatedBlsPubKeyForWithdrawalBatch;\n\n    /// @notice Given a user and batch ID, total ETH contributed\n    mapping(address => mapping(uint256 => uint256)) public totalETHFundedPerBatch;\n\n    /// @notice Whenever a deposit batch ID is released by a user withdrawing, we recycle the batch ID so the gaps are filled by future depositors\n    EnumerableSet.UintSet internal setOfRecycledDepositBatches;\n\n    /// @notice For a given batch ID that has been recycled, how much ETH new depositors can fund in recycled batches\n    mapping(uint256 => uint256) public ethRecycledFromBatch;\n\n    /// @notice Track any staked batches that are recycled\n    EnumerableSet.UintSet internal setOfRecycledStakedBatches;\n\n    modifier whenContractNotPaused() {\n        _assertContractNotPaused();\n        _;\n    }\n\n    /// @notice Add ETH to the ETH LP pool at a rate of 1:1. LPs can always pull out at same rate.\n    function depositETH(uint256 _amount) external payable nonReentrant whenContractNotPaused {\n        if (_amount < MIN_STAKING_AMOUNT) revert InvalidAmount();\n        if (_amount % MIN_STAKING_AMOUNT != 0) revert InvalidAmount();\n        if (msg.value != _amount) revert InvalidAmount();\n\n        // The ETH capital has not yet been deployed to a liquid staking network\n        idleETH += msg.value;\n        totalETHFromLPs += msg.value;\n\n        // Mint giant LP at ratio of 1:1\n        lpTokenETH.mint(msg.sender, msg.value);\n\n        // If anything extra needs to be done\n        _afterDepositETH(msg.value);\n\n        emit ETHDeposited(msg.sender, msg.value);\n    }\n\n    /// @notice Withdraw ETH but only from withdrawal batches that have not been staked yet\n    /// @param _amount of LP tokens user is burning in exchange for same amount of ETH\n    function withdrawETH(\n        uint256 _amount\n    ) external nonReentrant whenContractNotPaused {\n        if (_amount == 0) revert InvalidAmount();\n        if (lpTokenETH.balanceOf(msg.sender) < _amount) revert InvalidBalance();\n        if (idleETH < _amount) revert NotEnoughIdleETH();\n\n        // Revert early if user is not part of any batches\n        uint256 totalNumOfBatches = setOfAssociatedDepositBatches[msg.sender].length();\n        if (totalNumOfBatches == 0) revert InvalidWithdrawal();\n\n        // Check how new the lpTokenETH liquidity of msg.sender\n        if (lpTokenETH.lastInteractedTimestamp(msg.sender) + 45 minutes > block.timestamp) revert ComeBackLater();\n\n        // Send the ETH\n        _withdrawETH(_amount);\n\n        // Update associated batch IDs for msg.sender\n        // Withdraw ETH from the batch added last unless it is staked in which case user must redeem dETH\n        uint256 ethLeftToWithdraw = _amount;\n        for (uint256 i = totalNumOfBatches; i > 0; --i) {\n            uint256 batchAtIndex = setOfAssociatedDepositBatches[msg.sender].at(i - 1);\n\n            if (allocatedBlsPubKeyForWithdrawalBatch[batchAtIndex].length != 0) {\n                continue;\n            }\n\n            uint256 ethFromBatch = totalETHFundedPerBatch[msg.sender][batchAtIndex];\n            uint256 amountToRecycle = ethLeftToWithdraw >= ethFromBatch ? ethFromBatch : ethLeftToWithdraw;\n            if (ethLeftToWithdraw >= ethFromBatch) {\n                ethLeftToWithdraw -= amountToRecycle;\n            } else {\n                ethLeftToWithdraw = 0;\n            }\n\n            _reduceUserAmountFundedInBatch(batchAtIndex, msg.sender, amountToRecycle);\n\n            // Recycle any batches that are less than the current deposit count so that we can fill gaps with future depositors\n            if (batchAtIndex < depositBatchCount) {\n                setOfRecycledDepositBatches.add(batchAtIndex);\n                ethRecycledFromBatch[batchAtIndex] += amountToRecycle;\n            }\n\n            // Break out of the loop when we have matched the withdrawal amounts over batches\n            if (ethLeftToWithdraw == 0) break;\n        }\n\n        // If we get out of the loop and the amount left to withdraw is not zero then there was not enough withdrawable ETH to match the withdrawal amount\n        if (ethLeftToWithdraw != 0) revert ErrorWithdrawing();\n    }\n\n    /// @notice Allow liquid staking managers to notify the giant pool about derivatives minted for a key\n    function onMintDerivatives(bytes calldata _blsPublicKey) external {\n        if (!liquidStakingDerivativeFactory.isLiquidStakingManager(msg.sender)) revert OnlyManager();\n        _onMintDerivatives(_blsPublicKey);\n    }\n\n    /// @notice Total amount of ETH an LP can withdraw on the basis of whether the ETH has been used in staking\n    function withdrawableAmountOfETH(address _user) external view returns (uint256) {\n        uint256 withdrawableAmount;\n\n        uint256 _stakedBatchCount = stakedBatchCount; // Cache\n\n        // If the user does not have an allocated batch, the withdrawable amount will return zero\n        uint256 totalNumOfBatches = setOfAssociatedDepositBatches[_user].length();\n        for (uint256 i = totalNumOfBatches; i > 0; --i) {\n            uint256 batchAtIndex = setOfAssociatedDepositBatches[_user].at(i - 1);\n\n            if (allocatedBlsPubKeyForWithdrawalBatch[batchAtIndex].length == 0) {\n                withdrawableAmount += totalETHFundedPerBatch[_user][batchAtIndex];\n            }\n        }\n\n        return withdrawableAmount;\n    }\n\n    /// @notice Get the total number of withdrawal tickets allocated to an address\n    function getSetOfAssociatedDepositBatchesSize(address _user) external view returns (uint256) {\n        return setOfAssociatedDepositBatches[_user].length();\n    }\n\n    /// @notice Get the withdrawal ticket batch ID at an index\n    function getAssociatedDepositBatchIDAtIndex(address _user, uint256 _index) external view returns (uint256) {\n        return setOfAssociatedDepositBatches[_user].at(_index);\n    }\n\n    /// @notice Get total number of recycled deposit batches\n    function getRecycledDepositBatchesSize() external view returns (uint256) {\n        return setOfRecycledDepositBatches.length();\n    }\n\n    /// @notice Get batch ID at a specific index for recycled deposit batches\n    function getRecycledDepositBatchIDAtIndex(uint256 _index) external view returns (uint256) {\n        return setOfRecycledDepositBatches.at(_index);\n    }\n\n    /// @notice Get total number of recycled staked batches\n    function getRecycledStakedBatchesSize() external view returns (uint256) {\n        return setOfRecycledStakedBatches.length();\n    }\n\n    /// @notice Get batch ID at a specific index for recycled staked batches\n    function getRecycledStakedBatchIDAtIndex(uint256 _index) external view returns (uint256) {\n        return setOfRecycledStakedBatches.at(_index);\n    }\n\n    /// @notice Allow giant LP token to notify pool about transfers so the claimed amounts can be processed\n    function afterTokenTransfer(address _from, address _to, uint256 _amount) external {\n        if (msg.sender != address(lpTokenETH)) revert InvalidCaller();\n        if (_from != address(0) && _to != address(0)) {\n            EnumerableSet.UintSet storage setOfAssociatedDepositBatchesForFrom = setOfAssociatedDepositBatches[_from];\n            uint256 amountLeftToTransfer = _amount;\n\n            // Transfer redemption rights of batches to the recipient address\n            // They may already have the rights to some batches but they will gain a larger share afterwards\n            uint256 numOfBatchesFromAddress = setOfAssociatedDepositBatchesForFrom.length();\n            for (uint256 i = numOfBatchesFromAddress; i > 0; --i) {\n                // Duplicates are avoided due to use of enumerable set\n                uint256 batchId = setOfAssociatedDepositBatchesForFrom.at(i - 1);\n                uint256 totalETHFunded = totalETHFundedPerBatch[_from][batchId];\n                if (amountLeftToTransfer >= totalETHFunded) {\n                    // Clean up the state for the 'from' account\n                    _reduceUserAmountFundedInBatch(batchId, _from, totalETHFunded);\n\n                    // Adjust how much is left to transfer\n                    amountLeftToTransfer -= totalETHFunded;\n\n                    // Add _to user to the batch\n                    _addUserToBatch(batchId, _to, totalETHFunded);\n                } else {\n                    // Adjust the _from user total funded\n                    _reduceUserAmountFundedInBatch(batchId, _from, amountLeftToTransfer);\n\n                    // Add _to user to the batch\n                    _addUserToBatch(batchId, _to, amountLeftToTransfer);\n\n                    // There will no longer be any amount left to transfer\n                    amountLeftToTransfer = 0;\n                }\n\n                // We can leave the loop once the required batches have been given to recipient\n                if (amountLeftToTransfer == 0) break;\n            }\n\n            if (amountLeftToTransfer != 0) revert InvalidTransfer();\n        }\n    }\n\n    /// @notice If another giant pool user withdraws ETH freeing up an earlier space in the queue, allow them to jump some of their funding there\n    /// @param _targetPosition Batch ID of the target batch user wants their funding associated\n    /// @param _existingPosition Batch ID of the existing batch user is transferring their funding from\n    /// @param _user Address of the user that has funded giant pool allowing others to help jump the queue\n    function jumpTheQueue(uint256 _targetPosition, uint256 _existingPosition, address _user) external {\n        // Make sure that the target is less than existing - forcing only one direction.\n        // Existing cannot be more than the deposit batch count\n        if (_targetPosition > _existingPosition) revert InvalidJump();\n        if (_existingPosition > depositBatchCount) revert InvalidExistingPosition();\n\n        // Check that the target has ETH recycled due to withdrawal\n        uint256 ethRecycled = ethRecycledFromBatch[_targetPosition];\n        if (ethRecycled == 0) revert NoRecycledETH();\n\n        // Check that the user has funding in existing batch and neither existing or target batch has been allocated\n        uint256 totalExistingFunding = totalETHFundedPerBatch[_user][_existingPosition];\n        if (totalExistingFunding == 0) revert NoFundingInSelectedBatch();\n        if (allocatedBlsPubKeyForWithdrawalBatch[_targetPosition].length != 0) revert BatchAllocated();\n        if (allocatedBlsPubKeyForWithdrawalBatch[_existingPosition].length != 0) revert BatchAllocated();\n\n        // Calculate how much can jump from existing to target\n        uint256 amountThatCanJump = totalExistingFunding > ethRecycled ? ethRecycled : totalExistingFunding;\n\n        // Adjust how much ETH from withdrawals is recycled, removing batch if it hits zero\n        ethRecycledFromBatch[_targetPosition] -= amountThatCanJump;\n        if (ethRecycledFromBatch[_targetPosition] == 0) {\n            if (!setOfRecycledDepositBatches.remove(_targetPosition)) revert UnableToDeleteRecycledBatch();\n        }\n\n        // If users existing position is less than deposit count, treat it as recycled\n        if (_existingPosition < depositBatchCount) {\n            ethRecycledFromBatch[_existingPosition] += amountThatCanJump;\n            setOfRecycledDepositBatches.add(_existingPosition);\n        }\n\n        // Reduce funding from existing position and add user funded amount to new batch\n        _reduceUserAmountFundedInBatch(_existingPosition, _user, amountThatCanJump);\n        _addUserToBatch(_targetPosition, _user, amountThatCanJump);\n\n        emit QueueJumped(_user, _targetPosition, _existingPosition, amountThatCanJump);\n    }\n\n    /// @dev Business logic for managing withdrawal of ETH\n    function _withdrawETH(uint256 _amount) internal {\n        // Burn giant tokens\n        lpTokenETH.burn(msg.sender, _amount);\n\n        // Adjust idle ETH\n        idleETH -= _amount;\n        totalETHFromLPs -= _amount;\n\n        // Send ETH to the recipient\n        _transferETH(msg.sender, _amount);\n\n        emit LPBurnedForETH(msg.sender, _amount);\n    }\n\n    /// @dev Allow an inheriting contract to have a hook for performing operations after depositing ETH\n    function _afterDepositETH(uint256 _totalDeposited) internal virtual {\n        uint256 totalToFundFromNewBatches = _totalDeposited;\n\n        while (setOfRecycledDepositBatches.length() > 0) {\n            uint256 batchId = setOfRecycledDepositBatches.at(0);\n            uint256 ethRecycled = ethRecycledFromBatch[batchId];\n            uint256 amountToAssociateWithBatch = ethRecycled >= totalToFundFromNewBatches ? totalToFundFromNewBatches : ethRecycled;\n\n            totalToFundFromNewBatches -= amountToAssociateWithBatch;\n            ethRecycledFromBatch[batchId] -= amountToAssociateWithBatch;\n            if (ethRecycledFromBatch[batchId] == 0) {\n                setOfRecycledDepositBatches.remove(batchId);\n            }\n\n            _addUserToBatch(batchId, msg.sender, amountToAssociateWithBatch);\n\n            if (totalToFundFromNewBatches == 0) return;\n        }\n\n        uint256 currentBatchNum = depositBatchCount;\n        uint256 newComputedBatchNum = totalETHFromLPs / batchSize;\n        uint256 numOfBatchesFunded = newComputedBatchNum - currentBatchNum;\n\n        if (numOfBatchesFunded == 0) {\n            _addUserToBatch(currentBatchNum, msg.sender, totalToFundFromNewBatches);\n        } else {\n            uint256 ethBeforeDeposit = totalETHFromLPs - totalToFundFromNewBatches;\n            uint256 ethLeftToAllocate = totalToFundFromNewBatches;\n\n            // User can withdraw from multiple batches later\n            uint256 ethContributedToThisBatch = batchSize - (ethBeforeDeposit % batchSize);\n            for (uint256 i = currentBatchNum; i <= newComputedBatchNum; ++i) {\n                _addUserToBatch(i, msg.sender, ethContributedToThisBatch);\n\n                ethLeftToAllocate -= ethContributedToThisBatch;\n                if (ethLeftToAllocate >= batchSize) {\n                    ethContributedToThisBatch = batchSize;\n                } else if (ethLeftToAllocate > 0) {\n                    ethContributedToThisBatch = ethLeftToAllocate;\n                } else {\n                    break;\n                }\n            }\n\n            // Move the deposit batch count forward\n            depositBatchCount = newComputedBatchNum;\n        }\n    }\n\n    /// @dev Re-usable logic for adding a user to a batch given an amount of batch funding\n    function _addUserToBatch(uint256 _batchIndex, address _user, uint256 _amount) internal {\n        totalETHFundedPerBatch[_user][_batchIndex] += _amount;\n        if (setOfAssociatedDepositBatches[_user].add(_batchIndex)) {\n            emit WithdrawalBatchAssociatedWithUser(_user, _batchIndex);\n        } else {\n            emit WithdrawalBatchUpdated(_user, _batchIndex, totalETHFundedPerBatch[_user][_batchIndex]);\n        }\n    }\n\n    /// @dev Re-usable logic for reducing amount of user funding for a given batch\n    function _reduceUserAmountFundedInBatch(uint256 _batchIndex, address _user, uint256 _amount) internal {\n        totalETHFundedPerBatch[_user][_batchIndex] -= _amount;\n        if (totalETHFundedPerBatch[_user][_batchIndex] == 0) {\n            // Remove the batch from the user and if it succeeds emit an event\n            if (setOfAssociatedDepositBatches[_user].remove(_batchIndex)) {\n                emit WithdrawalBatchRemovedFromUser(_user, _batchIndex);\n            }\n        } else {\n            emit WithdrawalBatchUpdated(_user, _batchIndex, totalETHFundedPerBatch[_user][_batchIndex]);\n        }\n    }\n\n    /// @dev Allow liquid staking managers to notify the giant pool about ETH sent to the deposit contract for a key\n    function _onStake(bytes calldata _blsPublicKey) internal virtual {\n        if (isBLSPubKeyFundedByGiantPool[_blsPublicKey]) revert BLSKeyStaked();\n\n        uint256 numOfRecycledStakedBatches = setOfRecycledStakedBatches.length();\n        for (uint256 i; i < numOfRecycledStakedBatches; ++i) {\n            uint256 batchToAllocate = setOfRecycledStakedBatches.at(i);\n            if (ethRecycledFromBatch[batchToAllocate] == 0) {\n                _allocateStakingCountToBlsKey(_blsPublicKey, batchToAllocate);\n                setOfRecycledStakedBatches.remove(batchToAllocate);\n                // Return out the function since we found a recycled batch to allocate\n                return;\n            }\n        }\n\n        // There were no recycled batches to allocate so we find a new one\n        while (stakedBatchCount < depositBatchCount) {\n            bool allocated;\n            if (ethRecycledFromBatch[stakedBatchCount] == 0) {\n                // Allocate batch to BLS key\n                _allocateStakingCountToBlsKey(_blsPublicKey, stakedBatchCount);\n                allocated = true;\n            } else {\n                // If we need to skip because the batch is not full, then put it in recycled bucket\n                setOfRecycledStakedBatches.add(stakedBatchCount);\n            }\n\n            // increment staked count post allocation\n            stakedBatchCount++;\n\n            // If we allocated a staked batch count, we can leave this method\n            if (allocated) return;\n        }\n\n        revert NoFullBatchAvailable();\n    }\n\n    /// @dev Allocate a staking count to a BLS public key for later rewards queue\n    function _allocateStakingCountToBlsKey(bytes calldata _blsPublicKey, uint256 _count) internal {\n        // Allocate redemption path for all LPs with the same deposit count\n        allocatedWithdrawalBatchForBlsPubKey[_blsPublicKey] = _count;\n        allocatedBlsPubKeyForWithdrawalBatch[_count] = _blsPublicKey;\n\n        // Log the allocation\n        emit WithdrawalBatchAssociatedWithBLSKey(_blsPublicKey, _count);\n    }\n\n    /// @dev When bringing ETH back to giant pool, free up a staked batch count\n    function _onBringBackETHToGiantPool(bytes memory _blsPublicKey) internal virtual {\n        uint256 allocatedBatch = allocatedWithdrawalBatchForBlsPubKey[_blsPublicKey];\n        if (!isBLSPubKeyFundedByGiantPool[_blsPublicKey]) revert BLSKeyNotStaked();\n\n        setOfRecycledStakedBatches.add(allocatedBatch);\n\n        delete allocatedWithdrawalBatchForBlsPubKey[_blsPublicKey];\n        delete allocatedBlsPubKeyForWithdrawalBatch[allocatedBatch];\n\n        emit WithdrawalBatchDisassociatedWithBLSKey(_blsPublicKey, allocatedBatch);\n    }\n\n    /// @notice Allow liquid staking managers to notify the giant pool about derivatives minted for a key\n    function _onMintDerivatives(bytes calldata _blsPublicKey) internal virtual {}\n\n    /// @notice Allow inheriting contract to specify checks for whether contract is paused\n    function _assertContractNotPaused() internal virtual {}\n}"
      },
      "contracts/liquid-staking/GiantSavETHVaultPool.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: BUSL-1.1\n\nimport { StakehouseAPI } from \"@blockswaplab/stakehouse-solidity-api/contracts/StakehouseAPI.sol\";\nimport { GiantLP } from \"./GiantLP.sol\";\nimport { SavETHVault } from \"./SavETHVault.sol\";\nimport { LPToken } from \"./LPToken.sol\";\nimport { GiantPoolBase } from \"./GiantPoolBase.sol\";\nimport { LSDNFactory } from \"./LSDNFactory.sol\";\nimport { Errors } from \"./Errors.sol\";\nimport { GiantLPDeployer } from \"./GiantLPDeployer.sol\";\nimport { UUPSUpgradeable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport { OwnableUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport { PausableUpgradeable } from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\nerror ContractPaused();\n\n/// @notice A giant pool that can provide protected deposit liquidity to any liquid staking network\ncontract GiantSavETHVaultPool is StakehouseAPI, GiantPoolBase, UUPSUpgradeable, OwnableUpgradeable, PausableUpgradeable {\n\n    using EnumerableSet for EnumerableSet.UintSet;\n\n    /// @notice Emitted when giant LP is burnt to receive dETH\n    event LPBurnedForDETH(address indexed savETHVaultLPToken, address indexed sender, uint256 amount);\n\n    /// @notice Associated fees and mev pool address\n    address public feesAndMevGiantPool;\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() initializer {}\n\n    function init(\n        LSDNFactory _factory,\n        address _lpDeployer,\n        address _feesAndMevGiantPool,\n        address _upgradeManager\n    ) external virtual initializer {\n        _init(_factory, _lpDeployer, _feesAndMevGiantPool, _upgradeManager);\n        __Pausable_init();\n        __ReentrancyGuard_init();\n    }\n\n    /// @dev Owner based upgrades\n    function _authorizeUpgrade(address newImplementation)\n    internal\n    onlyOwner\n    override\n    {}\n\n    /// @notice Allow the contract owner to trigger pausing of core features\n    function pause() external onlyOwner {\n        _pause();\n    }\n\n    /// @notice Allow the contract owner to trigger unpausing of core features\n    function unpause() external onlyOwner {\n        _unpause();\n    }\n\n    /// @notice Given the liquidity of the giant pool, stake ETH to receive protected deposits from many liquid staking networks (LSDNs)\n    /// @dev Take ETH from the contract balance in order to send money to the individual vaults\n    /// @param _savETHVaults List of savETH vaults that belong to individual liquid staking derivative networks\n    /// @param _ETHTransactionAmounts ETH being attached to each savETH vault in the list\n    /// @param _blsPublicKeys For every savETH vault, the list of BLS keys of LSDN validators receiving funding\n    /// @param _stakeAmounts For every savETH vault, the amount of ETH each BLS key will receive in funding\n    function batchDepositETHForStaking(\n        address[] calldata _savETHVaults,\n        uint256[] calldata _ETHTransactionAmounts,\n        bytes[][] calldata _blsPublicKeys,\n        uint256[][] calldata _stakeAmounts\n    ) public whenContractNotPaused nonReentrant {\n        uint256 numOfSavETHVaults = _savETHVaults.length;\n        if (numOfSavETHVaults == 0) revert Errors.EmptyArray();\n        if (numOfSavETHVaults != _ETHTransactionAmounts.length) revert Errors.InconsistentArrayLength();\n        if (numOfSavETHVaults != _blsPublicKeys.length) revert Errors.InconsistentArrayLength();\n        if (numOfSavETHVaults != _stakeAmounts.length) revert Errors.InconsistentArrayLength();\n\n        // For every vault specified, supply ETH from the giant pool to the savETH pool of each BLS key\n        uint256 totalNumberOfKeys;\n        for (uint256 i; i < numOfSavETHVaults; ++i) {\n            uint256 transactionAmount = _ETHTransactionAmounts[i];\n\n            // As ETH is being deployed to a savETH pool vault, it is no longer idle\n            idleETH -= transactionAmount;\n\n            if (!liquidStakingDerivativeFactory.isSavETHVault(_savETHVaults[i])) revert Errors.InvalidSavETHVault();\n\n            // Deposit ETH for staking of BLS key\n            SavETHVault(_savETHVaults[i]).batchDepositETHForStaking{ value: transactionAmount }(\n                _blsPublicKeys[i],\n                _stakeAmounts[i]\n            );\n\n            uint256 numOfPublicKeys = _blsPublicKeys[i].length;\n            for (uint256 j; j < numOfPublicKeys; ++j) {\n                // because of withdrawal batch allocation, partial funding amounts would add too much complexity for later allocation\n                if (_stakeAmounts[i][j] != 24 ether) revert Errors.InvalidAmount();\n                _onStake(_blsPublicKeys[i][j]);\n                isBLSPubKeyFundedByGiantPool[_blsPublicKeys[i][j]] = true;\n            }\n\n            totalNumberOfKeys += numOfPublicKeys;\n        }\n\n        if (feesAndMevGiantPool.balance < 4 ether * totalNumberOfKeys) revert Errors.FeesAndMevPoolCannotMatch();\n    }\n\n    /// @notice Allow a user to burn their giant LP in exchange for dETH that is ready to withdraw from a set of savETH vaults\n    /// @param _savETHVaults List of savETH vaults being interacted with\n    /// @param _lpTokens List of savETH vault LP being burnt from the giant pool in exchange for dETH\n    /// @param _amounts Amounts of giant LP the user owns which is burnt 1:1 with savETH vault LP and in turn that will give a share of dETH\n    function withdrawDETH(\n        address[] calldata _savETHVaults,\n        LPToken[][] calldata _lpTokens,\n        uint256[][] calldata _amounts\n    ) external whenContractNotPaused nonReentrant {\n        uint256 numOfVaults = _savETHVaults.length;\n        if (numOfVaults == 0) revert Errors.EmptyArray();\n        if (numOfVaults != _lpTokens.length) revert Errors.InconsistentArrayLength();\n        if (numOfVaults != _amounts.length) revert Errors.InconsistentArrayLength();\n\n        // Firstly capture current dETH balance and see how much has been deposited after the loop\n        uint256 dETHReceivedFromAllSavETHVaults = getDETH().balanceOf(address(this));\n        for (uint256 i; i < numOfVaults; ++i) {\n            SavETHVault vault = SavETHVault(_savETHVaults[i]);\n            if (!liquidStakingDerivativeFactory.isSavETHVault(address(vault))) revert Errors.InvalidSavETHVault();\n\n            // Simultaneously check the status of LP tokens held by the vault and the giant LP balance of the user\n            uint256 numOfTokens = _lpTokens[i].length;\n            for (uint256 j; j < numOfTokens; ++j) {\n                LPToken token = _lpTokens[i][j];\n                uint256 amount = _amounts[i][j];\n\n                // Check the user has enough giant LP to burn and that the pool has enough savETH vault LP\n                _assertUserHasEnoughGiantLPToClaimVaultLP(token, amount);\n\n                // Magic - check user is part of the correct withdrawal batch\n                uint256 allocatedWithdrawalBatch = allocatedWithdrawalBatchForBlsPubKey[vault.KnotAssociatedWithLPToken(token)];\n                _reduceUserAmountFundedInBatch(allocatedWithdrawalBatch, msg.sender, amount);\n\n                // Burn giant LP from user before sending them dETH\n                lpTokenETH.burn(msg.sender, amount);\n\n                emit LPBurnedForDETH(address(token), msg.sender, amount);\n            }\n\n            // Withdraw dETH from specific LSD network\n            vault.burnLPTokens(_lpTokens[i], _amounts[i]);\n        }\n\n        // Calculate how much dETH has been received from burning\n        dETHReceivedFromAllSavETHVaults = getDETH().balanceOf(address(this)) - dETHReceivedFromAllSavETHVaults;\n\n        // Send giant LP holder dETH owed\n        getDETH().transfer(msg.sender, dETHReceivedFromAllSavETHVaults);\n    }\n\n    /// @notice Any ETH that has not been utilized by a savETH vault can be brought back into the giant pool\n    /// @param _savETHVaults List of savETH vaults where ETH is staked\n    /// @param _lpTokens List of LP tokens that the giant pool holds which represents ETH in a savETH vault\n    /// @param _amounts Amounts of LP within the giant pool being burnt\n    function bringUnusedETHBackIntoGiantPool(\n        address[] calldata _savETHVaults,\n        LPToken[][] calldata _lpTokens,\n        uint256[][] calldata _amounts\n    ) external whenContractNotPaused nonReentrant {\n        uint256 numOfVaults = _savETHVaults.length;\n        if (numOfVaults == 0) revert Errors.EmptyArray();\n        if (numOfVaults != _lpTokens.length) revert Errors.InconsistentArrayLength();\n        if (numOfVaults != _amounts.length) revert Errors.InconsistentArrayLength();\n        for (uint256 i; i < numOfVaults; ++i) {\n            SavETHVault vault = SavETHVault(_savETHVaults[i]);\n            if (!liquidStakingDerivativeFactory.isSavETHVault(address(vault))) revert Errors.InvalidSavETHVault();\n\n            uint256 numOfTokens = _lpTokens[i].length;\n            for (uint256 j; j < numOfTokens; ++j) {\n                if (vault.isDETHReadyForWithdrawal(address(_lpTokens[i][j]))) revert Errors.ETHStakedOrDerivativesMinted();\n\n                // Disassociate stake count\n                bytes memory blsPubKey = vault.KnotAssociatedWithLPToken(_lpTokens[i][j]);\n                _onBringBackETHToGiantPool(blsPubKey);\n                isBLSPubKeyFundedByGiantPool[blsPubKey] = false;\n\n                // Increase the amount of ETH that's idle\n                idleETH += _amounts[i][j];\n            }\n\n            // Burn LP tokens belonging to a specific vault in order to get the vault to send ETH\n            vault.burnLPTokens(_lpTokens[i], _amounts[i]);\n        }\n    }\n\n    function beforeTokenTransfer(address _from, address _to, uint256) external {\n        // Do nothing\n    }\n\n    // For bringing back ETH to the giant pool from a savETH vault\n    receive() external payable {\n        require(liquidStakingDerivativeFactory.isSavETHVault(msg.sender), \"Only savETH vault\");\n    }\n\n    /// @dev Check the msg.sender has enough giant LP to burn and that the pool has enough savETH vault LP\n    function _assertUserHasEnoughGiantLPToClaimVaultLP(LPToken _token, uint256 _amount) internal view {\n        if (_amount < MIN_STAKING_AMOUNT) revert Errors.InvalidAmount();\n        if (_token.balanceOf(address(this)) < _amount) revert Errors.InvalidBalance();\n    }\n\n    function _assertContractNotPaused() internal override {\n        if (paused()) revert ContractPaused();\n    }\n\n    function _init(\n        LSDNFactory _factory,\n        address _lpDeployer,\n        address _feesAndMevGiantPool,\n        address _upgradeManager\n    ) internal virtual {\n        lpTokenETH = GiantLP(GiantLPDeployer(_lpDeployer).deployToken(address(this), address(this), \"GiantETHLP\", \"gETH\"));\n        liquidStakingDerivativeFactory = _factory;\n        feesAndMevGiantPool = _feesAndMevGiantPool;\n        batchSize = 24 ether;\n        _transferOwnership(_upgradeManager);\n    }\n}\n"
      },
      "contracts/liquid-staking/LiquidStakingManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { Initializable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { ReentrancyGuard } from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport { StakehouseAPI } from \"@blockswaplab/stakehouse-solidity-api/contracts/StakehouseAPI.sol\";\nimport { ITransactionRouter } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/ITransactionRouter.sol\";\nimport { IBalanceReporter } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IBalanceReporter.sol\";\nimport { IDataStructures } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IDataStructures.sol\";\nimport { IStakeHouseRegistry } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IStakeHouseRegistry.sol\";\n\nimport { SavETHVaultDeployer } from \"./SavETHVaultDeployer.sol\";\nimport { StakingFundsVaultDeployer } from \"./StakingFundsVaultDeployer.sol\";\nimport { StakingFundsVault } from \"./StakingFundsVault.sol\";\nimport { SavETHVault } from \"./SavETHVault.sol\";\nimport { LSDNFactory } from \"./LSDNFactory.sol\";\nimport { LPToken } from \"./LPToken.sol\";\nimport { LPTokenFactory } from \"./LPTokenFactory.sol\";\nimport { SyndicateFactory } from \"../syndicate/SyndicateFactory.sol\";\nimport { Syndicate } from \"../syndicate/Syndicate.sol\";\nimport { OptionalHouseGatekeeper } from \"./OptionalHouseGatekeeper.sol\";\nimport { OptionalGatekeeperFactory } from \"./OptionalGatekeeperFactory.sol\";\nimport { OwnableSmartWalletFactory } from \"../smart-wallet/OwnableSmartWalletFactory.sol\";\nimport { IOwnableSmartWalletFactory } from \"../smart-wallet/interfaces/IOwnableSmartWalletFactory.sol\";\nimport { IOwnableSmartWallet } from \"../smart-wallet/interfaces/IOwnableSmartWallet.sol\";\nimport { ISyndicateFactory } from \"../interfaces/ISyndicateFactory.sol\";\nimport { ILiquidStakingManager } from \"../interfaces/ILiquidStakingManager.sol\";\nimport { IBrandNFT } from \"../interfaces/IBrandNFT.sol\";\nimport { IBrandCentral } from \"../interfaces/IBrandCentral.sol\";\nimport { IRestrictedTickerRegistry } from \"../interfaces/IRestrictedTickerRegistry.sol\";\nimport { ICIP } from \"../interfaces/ICIP.sol\";\nimport { ETHTransferHelper } from \"../transfer/ETHTransferHelper.sol\";\n\nerror EmptyArray();\nerror ZeroAddress();\nerror OnlyEOA();\nerror InconsistentArrayLength();\nerror OnlyDAO();\nerror OnlyDAOOrNodeRunner();\nerror InvalidTickerLength();\nerror TickerAlreadyTaken();\nerror InvalidAddress();\nerror NodeRunnerNotWhitelisted();\nerror NotEnoughETHToStake();\nerror InvalidAmount();\nerror GoMintDerivatives();\nerror HouseAlreadyCreated();\nerror BLSPubKeyBanned();\nerror OnlyNodeRunner();\nerror InitialsNotRegistered();\nerror DAOKillSwitchNotActivated();\nerror OnlyCIP();\nerror NewRunnerHasASmartWallet();\nerror NodeRunnerNotPermitted();\nerror BLSKeyAlreadyRegistered();\nerror BLSKeyNotRegistered();\nerror InvalidEOA();\nerror DepositNotCompleted();\nerror InvalidCommission();\nerror NothingReceived();\n\ncontract LiquidStakingManager is ILiquidStakingManager, Initializable, ReentrancyGuard, StakehouseAPI, ETHTransferHelper {\n\n    /// @notice signalize change in status of whitelisting\n    event WhitelistingStatusChanged(address indexed dao, bool updatedStatus);\n\n    /// @notice signalize updated whitelist status of node runner\n    event NodeRunnerWhitelistingStatusChanged(address indexed nodeRunner, bool updatedStatus);\n\n    /// @notice signalize creation of a new smart wallet\n    event SmartWalletCreated(address indexed smartWallet, address indexed nodeRunner);\n\n    /// @notice signalize appointing of a representative for a smart wallet by the node runner\n    event RepresentativeAppointed(address indexed smartWallet, address indexed eoaRepresentative);\n\n    /// @notice signalize staking of a KNOT\n    event KnotStaked(bytes _blsPublicKeyOfKnot, address indexed trigerringAddress);\n\n    /// @notice signalize creation of stakehouse\n    event StakehouseCreated(string stakehouseTicker, address indexed stakehouse);\n\n    /// @notice signalize joining a stakehouse\n    event StakehouseJoined(bytes blsPubKey);\n\n    ///@notice signalize removal of representative from smart wallet\n    event RepresentativeRemoved(address indexed smartWallet, address indexed eoaRepresentative);\n\n    /// @notice signalize refund of withdrawal of 4 ETH for a BLS public key by the node runner\n    event ETHWithdrawnFromSmartWallet(address indexed associatedSmartWallet, bytes blsPublicKeyOfKnot, address nodeRunner);\n\n    /// @notice signalize that the network has updated its ticker before its house was created\n    event NetworkTickerUpdated(string newTicker);\n\n    /// @notice signalize that the node runner has claimed rewards from the syndicate\n    event NodeRunnerRewardsClaimed(address indexed nodeRunner, address indexed recipient);\n\n    /// @notice signalize that the node runner of the smart wallet has been rotated\n    event NodeRunnerOfSmartWalletRotated(address indexed wallet, address indexed oldRunner, address indexed newRunner);\n\n    /// @notice signalize banning of a node runner\n    event NodeRunnerBanned(address indexed nodeRunner);\n\n    /// @notice signalize that the dao management address has been moved\n    event UpdateDAOAddress(address indexed oldAddress, address indexed newAddress);\n\n    /// @notice signalize that the dao commission from network revenue has been updated\n    event DAOCommissionUpdated(uint256 old, uint256 newCommission);\n\n    /// @notice signalize that a new BLS public key for an LSD validator has been registered\n    event NewLSDValidatorRegistered(address indexed nodeRunner, bytes blsPublicKey);\n\n    /// @notice Address of brand NFT\n    address public brand;\n\n    /// @notice stakehouse created by the LSD network\n    address public override stakehouse;\n\n    /// @notice Fees and MEV EIP1559 distribution contract for the LSD network\n    address public syndicate;\n\n    /// @notice address of the DAO deploying the contract\n    address public dao;\n\n    /// @notice address of optional gatekeeper for admiting new knots to the house created by the network\n    OptionalHouseGatekeeper public gatekeeper;\n\n    /// @notice instance of the syndicate factory that deploys the syndicates\n    ISyndicateFactory public syndicateFactory;\n\n    /// @notice instance of the smart wallet factory that deploys the smart wallets for node runners\n    IOwnableSmartWalletFactory public smartWalletFactory;\n\n    /// @notice string name for the stakehouse 3-5 characters long\n    string public stakehouseTicker;\n\n    /// @notice DAO staking funds vault\n    StakingFundsVault public stakingFundsVault;\n\n    /// @notice SavETH vault\n    SavETHVault public savETHVault;\n\n    /// @notice Address of the factory that deployed the liquid staking manager\n    LSDNFactory public factory;\n\n    /// @notice whitelisting indicator. true for enables and false for disabled\n    bool public enableWhitelisting;\n\n    /// @notice mapping to store if a node runner is whitelisted\n    mapping(address => bool) public isNodeRunnerWhitelisted;\n\n    /// @notice EOA representative appointed for a smart wallet\n    mapping(address => address) public smartWalletRepresentative;\n\n    /// @notice Smart wallet used to deploy KNOT\n    mapping(bytes => address) public smartWalletOfKnot;\n\n    /// @notice Smart wallet issued to the Node runner. Node runner address <> Smart wallet address\n    mapping(address => address) public smartWalletOfNodeRunner;\n\n    /// @notice Node runner issued to Smart wallet. Smart wallet address <> Node runner address\n    mapping(address => address) public nodeRunnerOfSmartWallet;\n\n    /// @notice Track number of staked KNOTs of a smart wallet\n    mapping(address => uint256) public stakedKnotsOfSmartWallet;\n\n    /// @notice smart wallet <> dormant rep.\n    mapping(address => address) public smartWalletDormantRepresentative;\n\n    /// @notice Track BLS public keys that have been banned. \n    /// If banned, the BLS public key will be mapped to its respective smart wallet\n    mapping(bytes => address) public bannedBLSPublicKeys;\n\n    /// @notice Track node runner addresses that are banned.\n    /// Malicious node runners can be banned by the DAO\n    mapping(address => bool) public bannedNodeRunners;\n\n    /// @notice count of KNOTs interacted with LSD network\n    uint256 public numberOfKnots;\n\n    /// @notice Commission percentage to 5 decimal places\n    uint256 public daoCommissionPercentage;\n\n    /// @notice 100% to 5 decimal places\n    uint256 public constant MODULO = 100_00000;\n\n    /// @notice Maximum commission that can be requested from the DAO\n    uint256 public constant MAX_COMMISSION = MODULO / 2;\n\n    modifier onlyDAO() {\n        if (msg.sender != dao) revert OnlyDAO();\n        _;\n    }\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() initializer {}\n\n    /// @inheritdoc ILiquidStakingManager\n    function init(\n        address _dao,\n        address _syndicateFactory,\n        address _smartWalletFactory,\n        address _lpTokenFactory,\n        address _brand,\n        address _savETHVaultDeployer,\n        address _stakingFundsVaultDeployer,\n        address _optionalGatekeeperDeployer,\n        uint256 _optionalCommission,\n        bool _deployOptionalGatekeeper,\n        string calldata _stakehouseTicker\n    ) external virtual override initializer {\n        _init(\n            _dao,\n            _syndicateFactory,\n            _smartWalletFactory,\n            _lpTokenFactory,\n            _brand,\n            _savETHVaultDeployer,\n            _stakingFundsVaultDeployer,\n            _optionalGatekeeperDeployer,\n            _optionalCommission,\n            _deployOptionalGatekeeper,\n            _stakehouseTicker\n        );\n    }\n\n    /// @notice Allow DAO or node runner to recover the signing key of a validator\n    /// @param _safeBox Address of the safe box performing recovery\n    /// @param _nodeRunner Address of the node runner associated with a BLS key\n    /// @param _blsPublicKey BLS public key of validator requesting signing key recovery\n    /// @param _hAesPublicKey Hybrid encryption public key that can unlock multiparty computation used for recovery\n    function recoverSigningKey(\n        address _safeBox,\n        address _nodeRunner,\n        bytes calldata _blsPublicKey,\n        bytes calldata _hAesPublicKey\n    ) external nonReentrant {\n        address smartWallet = smartWalletOfNodeRunner[_nodeRunner];\n        if (smartWallet == address(0)) revert ZeroAddress();\n        if (smartWalletOfKnot[_blsPublicKey] != smartWallet) revert BLSKeyNotRegistered();\n        if (msg.sender != dao && msg.sender != _nodeRunner) revert OnlyDAOOrNodeRunner();\n        IOwnableSmartWallet(smartWallet).execute(\n            _safeBox,\n            abi.encodeWithSelector(\n                ICIP.applyForDecryption.selector,\n                _blsPublicKey,\n                stakehouse,\n                _hAesPublicKey\n            )\n        );\n    }\n\n    /// @notice Allow the rage quit of a knot from the Stakehouse protocol\n    /// @param _nodeRunner Address of the node runner that has a smart wallet associated with the BLS public key\n    /// @param _blsPublicKey BLS public key of the KNOT being rage quit\n    /// @param _balanceReport of the KNOT before rage quit\n    /// @param _signature Signature from the designated verifier over the balance report\n    function rageQuit(\n        address _nodeRunner,\n        bytes calldata _blsPublicKey,\n        IDataStructures.ETH2DataReport calldata _balanceReport,\n        IDataStructures.EIP712Signature calldata _signature\n    ) external {\n        address smartWallet = smartWalletOfNodeRunner[_nodeRunner];\n        if (smartWallet == address(0)) revert ZeroAddress();\n        if (smartWalletOfKnot[_blsPublicKey] != smartWallet) revert BLSKeyNotRegistered();\n        if (msg.sender != dao && msg.sender != _nodeRunner) revert OnlyDAOOrNodeRunner();\n        IOwnableSmartWallet(smartWallet).execute(\n            address(getTransactionRouter()),\n            abi.encodeWithSelector(\n                IBalanceReporter.rageQuitKnot.selector,\n                stakehouse,\n                _blsPublicKey,\n                _balanceReport,\n                _signature\n            )\n        );\n    }\n\n    /// @notice After kill switch has been enabled by the DAO, allow a node operator to transfer ownership of their smart wallet\n    /// @param _newOwner Address of the account that will take ownership of wallet and collateralized slot\n    function transferSmartWalletOwnership(address _newOwner) external {\n        if (dao != address(0)) revert DAOKillSwitchNotActivated();\n\n        address smartWallet = smartWalletOfNodeRunner[msg.sender];\n        if (smartWallet == address(0)) revert ZeroAddress();\n\n        IOwnableSmartWallet(smartWallet).transferOwnership(_newOwner);\n    }\n\n    /// @notice Allow the DAO to manage whether the house can received members outside LSD (if it has a deployed gatekeeper)\n    function toggleHouseGatekeeper(bool _enabled) external onlyDAO {\n        if (_enabled) {\n            IStakeHouseRegistry(stakehouse).setGateKeeper(address(gatekeeper));\n        } else {\n            IStakeHouseRegistry(stakehouse).setGateKeeper(address(0));\n        }\n    }\n\n    /// @notice For knots no longer operational, DAO can de register the knot from the syndicate\n    function deRegisterKnotFromSyndicate(bytes[] calldata _blsPublicKeys) external onlyDAO nonReentrant {\n        Syndicate(payable(syndicate)).deRegisterKnots(_blsPublicKeys);\n    }\n\n    /// @notice Allows the DAO to append to the list of knots that are part of the syndicate\n    /// @param _newBLSPublicKeyBeingRegistered List of BLS public keys being added to the syndicate\n    function registerKnotsToSyndicate(\n        bytes[] calldata _newBLSPublicKeyBeingRegistered\n    ) external onlyDAO nonReentrant {\n        Syndicate(payable(syndicate)).registerKnotsToSyndicate(_newBLSPublicKeyBeingRegistered);\n    }\n\n    /// @notice Allows the DAO to manage the syndicate activation distance based on the consensus layer activation queue\n    function updateSyndicateActivationDistanceInBlocks(uint256 _distance) external onlyDAO {\n        Syndicate(payable(syndicate)).updateActivationDistanceInBlocks(_distance);\n    }\n\n    /// @notice Configure the house that users are joining when minting derivatives only for an empty LSD network\n    function configureStakeHouse(bytes calldata _blsPublicKeyOfKnot) external onlyDAO {\n        if (numberOfKnots != 0) revert HouseAlreadyCreated();\n\n        numberOfKnots = 1;\n        stakehouse = getStakeHouseUniverse().memberKnotToStakeHouse(_blsPublicKeyOfKnot);\n        if (stakehouse == address(0)) revert ZeroAddress();\n\n        _deploySyndicateAndApproveSETH(_blsPublicKeyOfKnot, IERC20(getSlotRegistry().stakeHouseShareTokens(stakehouse)));\n    }\n\n    /// @notice Liquid staking DAO can set the description and image of the brand NFT for the network\n    function updateBrandInfo(\n        uint256 _tokenId, string calldata _description, string calldata _imageURI\n    ) external onlyDAO {\n        IBrandNFT(brand).setBrandMetadata(_tokenId, _description, _imageURI);\n    }\n\n    /// @notice Allow DAO to migrate to a new address\n    function updateDAOAddress(address _newAddress) external onlyDAO {\n        emit UpdateDAOAddress(dao, _newAddress);\n        dao = _newAddress;\n    }\n\n    /// @notice Allow DAO to take a commission of network revenue\n    function updateDAORevenueCommission(uint256 _commissionPercentage) external onlyDAO {\n        _updateDAORevenueCommission(_commissionPercentage);\n    }\n\n    /// @notice Allow the DAO to rotate the network ticker before the network house is created\n    function updateTicker(string calldata _newTicker) external onlyDAO {\n        _updateTicker(_newTicker);\n    }\n\n    /// @notice function to change whether node runner whitelisting of node runners is required by the DAO\n    /// @param _changeWhitelist boolean value. true to enable and false to disable\n    function updateWhitelisting(bool _changeWhitelist) external onlyDAO returns (bool) {\n        enableWhitelisting = _changeWhitelist;\n        emit WhitelistingStatusChanged(msg.sender, enableWhitelisting);\n\n        return enableWhitelisting;\n    }\n\n    /// @notice Function to enable/disable whitelisting of a multiple node operators\n    /// @param _nodeRunners List of node runners being whitelisted\n    /// @param isWhitelisted true if the node runner should be whitelisted. false otherwise.\n    function updateNodeRunnerWhitelistStatus(address[] calldata _nodeRunners, bool isWhitelisted) external onlyDAO {\n        for (uint256 i; i < _nodeRunners.length; ++i) {\n            isNodeRunnerWhitelisted[_nodeRunners[i]] = isWhitelisted;\n            emit NodeRunnerWhitelistingStatusChanged(_nodeRunners[i], isWhitelisted);\n        }\n    }\n\n    /// @notice Allow a node runner to rotate the EOA representative they use for their smart wallet\n    /// @dev if any KNOT is staked for a smart wallet, no rep can be appointed or updated until the derivatives are minted\n    /// @param _newRepresentative address of the new representative to be appointed\n    function rotateEOARepresentative(address _newRepresentative) external {\n        if (Address.isContract(_newRepresentative)) revert OnlyEOA();\n        if (_newRepresentative == address(0)) revert ZeroAddress();\n\n        address smartWallet = smartWalletOfNodeRunner[msg.sender];\n        if (smartWallet == address(0) && msg.sender != dao) revert OnlyDAOOrNodeRunner();\n        if (stakedKnotsOfSmartWallet[smartWallet] != 0) revert GoMintDerivatives();\n\n        // unauthorize old representative\n        _authorizeRepresentative(smartWallet, smartWalletRepresentative[smartWallet], false);\n\n        // authorize new representative\n        _authorizeRepresentative(smartWallet, _newRepresentative, true);\n    }\n\n    /// @notice Allow node runners to withdraw ETH from their smart wallet. ETH can only be withdrawn until the KNOT has not been staked.\n    /// @dev A banned node runner cannot withdraw ETH for the KNOT. \n    /// @param _blsPublicKeyOfKnot BLS public key of the KNOT for which the ETH needs to be withdrawn\n    function withdrawETHForKnot(address _recipient, bytes calldata _blsPublicKeyOfKnot) external nonReentrant {\n        if (_recipient == address(0)) revert ZeroAddress();\n        if (!isBLSPublicKeyPartOfLSDNetwork(_blsPublicKeyOfKnot)) revert BLSKeyNotRegistered();\n        if (isBLSPublicKeyBanned(_blsPublicKeyOfKnot)) revert BLSPubKeyBanned();\n\n        address associatedSmartWallet = smartWalletOfKnot[_blsPublicKeyOfKnot];\n        if (smartWalletOfNodeRunner[msg.sender] != associatedSmartWallet) revert OnlyNodeRunner();\n        if (\n            getAccountManager().blsPublicKeyToLifecycleStatus(_blsPublicKeyOfKnot) != IDataStructures.LifecycleStatus.INITIALS_REGISTERED\n        ) revert InitialsNotRegistered();\n\n        // update the mapping\n        bannedBLSPublicKeys[_blsPublicKeyOfKnot] = associatedSmartWallet;\n\n        // refund 4 ether from smart wallet to node runner's EOA\n        IOwnableSmartWallet(associatedSmartWallet).rawExecute(_recipient, \"\", 4 ether);\n\n        emit ETHWithdrawnFromSmartWallet(associatedSmartWallet, _blsPublicKeyOfKnot, msg.sender);\n    }\n\n    /// @notice In the event the node runner coordinates with the DAO to sell their wallet, allow rotation\n    /// @dev EOA representative rotation done outside this method because there may be knots currently staked etc.\n    /// @param _current address of the present node runner of the smart wallet\n    /// @param _new address of the new node runner of the smart wallet\n    function manageNodeRunnerSmartWallet(\n        address _current,\n        address _new,\n        bool _wasPreviousNodeRunnerMalicious\n    ) external onlyDAO {\n        if (_new != address(0) && _new != _current) {\n            address wallet = smartWalletOfNodeRunner[_current];\n            if (wallet == address(0)) revert ZeroAddress();\n            if (wallet.balance >= 4 ether) revert InvalidAmount();\n\n            if (smartWalletOfNodeRunner[_new] != address(0)) revert NewRunnerHasASmartWallet();\n\n            smartWalletOfNodeRunner[_new] = wallet;\n            nodeRunnerOfSmartWallet[wallet] = _new;\n\n            delete smartWalletOfNodeRunner[_current];\n\n            emit NodeRunnerOfSmartWalletRotated(wallet, _current, _new);\n        }\n\n        if (_wasPreviousNodeRunnerMalicious) {\n            bannedNodeRunners[_current] = true;\n            emit NodeRunnerBanned(_current);\n        }\n    }\n\n    /// @notice function to allow a node runner to claim ETH from the syndicate from their smart wallet\n    /// @param _recipient End recipient of ETH from syndicate rewards\n    /// @param _blsPubKeys list of BLS public keys to claim reward for\n    function claimRewardsAsNodeRunner(\n        address _recipient,\n        bytes[] calldata _blsPubKeys\n    ) external nonReentrant {\n        uint256 numOfKeys = _blsPubKeys.length;\n        if (numOfKeys == 0) revert EmptyArray();\n        if (_recipient == address(0)) revert ZeroAddress();\n\n        address smartWallet = smartWalletOfNodeRunner[msg.sender];\n        if (smartWallet == address(0)) revert ZeroAddress();\n\n        for(uint256 i; i < numOfKeys; ++i) {\n            // check that the node runner doesn't claim rewards for KNOTs from other smart wallets\n            if (smartWalletOfKnot[_blsPubKeys[i]] != smartWallet) revert OnlyNodeRunner();\n        }\n\n        // Fetch ETH accrued\n        uint256 balBefore = address(this).balance;\n        IOwnableSmartWallet(smartWallet).execute(\n            syndicate,\n            abi.encodeWithSelector(\n                Syndicate.claimAsCollateralizedSLOTOwner.selector,\n                address(this),\n                _blsPubKeys\n            )\n        );\n\n        (uint256 nodeRunnerAmount, uint256 daoAmount) = _calculateCommission(address(this).balance - balBefore);\n\n        _transferETH(_recipient, nodeRunnerAmount);\n\n        if (daoAmount > 0) _transferETH(dao, daoAmount);\n\n        emit NodeRunnerRewardsClaimed(msg.sender, _recipient);\n    }\n\n    /// @notice register a node runner to LSD by creating a new smart wallet\n    /// @param _blsPublicKeys list of BLS public keys\n    /// @param _blsSignatures list of BLS signatures\n    /// @param _eoaRepresentative EOA representative of wallet\n    function registerBLSPublicKeys(\n        bytes[] calldata _blsPublicKeys,\n        bytes[] calldata _blsSignatures,\n        address _eoaRepresentative\n    ) external payable nonReentrant {\n        uint256 len = _blsPublicKeys.length;\n        if (len == 0) revert EmptyArray();\n        if (len != _blsSignatures.length) revert InconsistentArrayLength();\n        if (msg.value != len * 4 ether) revert InvalidAmount();\n        if (Address.isContract(_eoaRepresentative)) revert OnlyEOA();\n        if (!_isNodeRunnerValid(msg.sender)) revert NodeRunnerNotPermitted();\n        if (isNodeRunnerBanned(msg.sender)) revert NodeRunnerNotPermitted();\n\n        address smartWallet = smartWalletOfNodeRunner[msg.sender];\n\n        if(smartWallet == address(0)) {\n            // create new wallet owned by liquid staking manager\n            smartWallet = smartWalletFactory.createWallet(address(this));\n            emit SmartWalletCreated(smartWallet, msg.sender);\n\n            // associate node runner with the newly created wallet\n            smartWalletOfNodeRunner[msg.sender] = smartWallet;\n            nodeRunnerOfSmartWallet[smartWallet] = msg.sender;\n\n            _authorizeRepresentative(smartWallet, _eoaRepresentative, true);\n        }\n\n        // Ensure that the node runner does not whitelist multiple EOA representatives - they can only have 1 active at a time\n        if(smartWalletRepresentative[smartWallet] != address(0)) {\n            if (smartWalletRepresentative[smartWallet] != _eoaRepresentative) revert InvalidEOA();\n        }\n\n        // transfer ETH to smart wallet\n        _transferETH(smartWallet, msg.value);\n\n        for(uint256 i; i < len; ++i) {\n            bytes calldata _blsPublicKey = _blsPublicKeys[i];\n\n            // check if the BLS public key is part of LSD network and is not banned\n            if (isBLSPublicKeyPartOfLSDNetwork(_blsPublicKey)) revert BLSKeyAlreadyRegistered();\n            if (bannedBLSPublicKeys[_blsPublicKey] != address(0)) revert BLSPubKeyBanned();\n\n            if (\n                getAccountManager().blsPublicKeyToLifecycleStatus(_blsPublicKey) != IDataStructures.LifecycleStatus.UNBEGUN\n            ) revert BLSKeyAlreadyRegistered();\n\n            // register validtor initals for each of the KNOTs\n            IOwnableSmartWallet(smartWallet).execute(\n                address(getTransactionRouter()),\n                abi.encodeWithSelector(\n                    ITransactionRouter.registerValidatorInitials.selector,\n                    smartWallet,\n                    _blsPublicKey,\n                    _blsSignatures[i]\n                )\n            );\n\n            // register the smart wallet with the BLS public key\n            smartWalletOfKnot[_blsPublicKey] = smartWallet;\n\n            emit NewLSDValidatorRegistered(msg.sender, _blsPublicKey);\n        }\n    }\n\n    /// @inheritdoc ILiquidStakingManager\n    function isBLSPublicKeyPartOfLSDNetwork(bytes calldata _blsPublicKeyOfKnot) public virtual view returns (bool) {\n        return smartWalletOfKnot[_blsPublicKeyOfKnot] != address(0);\n    }\n\n    /// @inheritdoc ILiquidStakingManager\n    function isBLSPublicKeyBanned(bytes calldata _blsPublicKeyOfKnot) public virtual view returns (bool) {\n        bool isPartOfNetwork = isBLSPublicKeyPartOfLSDNetwork(_blsPublicKeyOfKnot);\n        return !isPartOfNetwork ? true : bannedBLSPublicKeys[_blsPublicKeyOfKnot] != address(0);\n    }\n\n    /// @notice function to check if a node runner address is banned\n    /// @param _nodeRunner address of the node runner\n    /// @return true if the node runner is banned, false otherwise\n    function isNodeRunnerBanned(address _nodeRunner) public view returns (bool) {\n        return bannedNodeRunners[_nodeRunner];\n    }\n\n    /// @notice Anyone can call this to trigger staking once they have all of the required input params from BLS authentication\n    /// @param _blsPublicKeyOfKnots List of knots being staked with the Ethereum deposit contract (32 ETH sourced within the network)\n    /// @param _ciphertexts List of backed up validator operations encrypted and stored to the Ethereum blockchain\n    /// @param _aesEncryptorKeys List of public identifiers of credentials that performed the trustless backup\n    /// @param _encryptionSignatures List of EIP712 signatures attesting to the correctness of the BLS signature\n    /// @param _dataRoots List of serialized SSZ containers of the DepositData message for each validator used by Ethereum deposit contract\n    function stake(\n        bytes[] calldata _blsPublicKeyOfKnots,\n        bytes[] calldata _ciphertexts,\n        bytes[] calldata _aesEncryptorKeys,\n        IDataStructures.EIP712Signature[] calldata _encryptionSignatures,\n        bytes32[] calldata _dataRoots\n    ) external nonReentrant {\n        uint256 numOfValidators = _blsPublicKeyOfKnots.length;\n        if (numOfValidators == 0) revert EmptyArray();\n        if (numOfValidators != _ciphertexts.length) revert InconsistentArrayLength();\n        if (numOfValidators != _aesEncryptorKeys.length) revert InconsistentArrayLength();\n        if (numOfValidators != _encryptionSignatures.length) revert InconsistentArrayLength();\n        if (numOfValidators != _dataRoots.length) revert InconsistentArrayLength();\n\n        for (uint256 i; i < numOfValidators; ++i) {\n            bytes calldata blsPubKey = _blsPublicKeyOfKnots[i];\n            // check if BLS public key is registered with liquid staking derivative network and not banned\n            if (isBLSPublicKeyBanned(blsPubKey)) revert BLSPubKeyBanned();\n\n            address associatedSmartWallet = smartWalletOfKnot[blsPubKey];\n            if (associatedSmartWallet == address(0)) revert InitialsNotRegistered();\n            if (isNodeRunnerBanned(nodeRunnerOfSmartWallet[associatedSmartWallet])) revert NodeRunnerNotPermitted();\n            if (\n                getAccountManager().blsPublicKeyToLifecycleStatus(blsPubKey) != IDataStructures.LifecycleStatus.INITIALS_REGISTERED\n            ) revert InitialsNotRegistered();\n\n            // check minimum balance of smart wallet, dao staking fund vault and savETH vault\n            _assertEtherIsReadyForValidatorStaking(blsPubKey);\n\n            _stake(\n                blsPubKey,\n                _ciphertexts[i],\n                _aesEncryptorKeys[i],\n                _encryptionSignatures[i],\n                _dataRoots[i]\n            );\n\n            address representative = smartWalletRepresentative[associatedSmartWallet];\n\n            if(representative != address(0)) {\n                // unauthorize the EOA representative on the Stakehouse\n                _authorizeRepresentative(associatedSmartWallet, representative, false);\n                // make the representative dormant before unauthorizing it\n                smartWalletDormantRepresentative[associatedSmartWallet] = representative;\n            }\n        }\n    }\n\n    /// @notice Anyone can call this to trigger creating a knot which will mint derivatives once the balance has been reported\n    /// @param _blsPublicKeyOfKnots List of BLS public keys registered with the network becoming knots and minting derivatives\n    /// @param _beaconChainBalanceReports List of beacon chain balance reports\n    /// @param _reportSignatures List of attestations for the beacon chain balance reports\n    function mintDerivatives(\n        bytes[] calldata _blsPublicKeyOfKnots,\n        IDataStructures.ETH2DataReport[] calldata _beaconChainBalanceReports,\n        IDataStructures.EIP712Signature[] calldata _reportSignatures\n    ) external nonReentrant {\n        uint256 numOfKnotsToProcess = _blsPublicKeyOfKnots.length;\n        if (numOfKnotsToProcess == 0) revert EmptyArray();\n        if (numOfKnotsToProcess != _beaconChainBalanceReports.length) revert InconsistentArrayLength();\n        if (numOfKnotsToProcess != _reportSignatures.length) revert InconsistentArrayLength();\n\n        for (uint256 i; i < numOfKnotsToProcess; ++i) {\n            // check if BLS public key is registered and not banned\n            if (isBLSPublicKeyBanned(_blsPublicKeyOfKnots[i])) revert BLSPubKeyBanned();\n\n            // check that the BLS pub key has deposited lifecycle\n            if(\n                getAccountManager().blsPublicKeyToLifecycleStatus(_blsPublicKeyOfKnots[i]) != IDataStructures.LifecycleStatus.DEPOSIT_COMPLETED\n            ) revert DepositNotCompleted();\n\n            // Expand the staking funds vault shares that can claim rewards\n            stakingFundsVault.updateDerivativesMinted(_blsPublicKeyOfKnots[i]);\n\n            // Poke the giant pools in the event they need to know about the minting of derivatives they funded\n            factory.giantSavETHPool().onMintDerivatives(_blsPublicKeyOfKnots[i]);\n            factory.giantFeesAndMev().onMintDerivatives(_blsPublicKeyOfKnots[i]);\n\n            // The first knot will create the Stakehouse\n            if(numberOfKnots == 0) {\n                _createLSDNStakehouse(\n                    _blsPublicKeyOfKnots[i],\n                    _beaconChainBalanceReports[i],\n                    _reportSignatures[i]\n                );\n            }\n            else {\n                // join stakehouse\n                _joinLSDNStakehouse(\n                    _blsPublicKeyOfKnots[i],\n                    _beaconChainBalanceReports[i],\n                    _reportSignatures[i]\n                );\n            }\n\n            address smartWallet = smartWalletOfKnot[_blsPublicKeyOfKnots[i]];\n            stakedKnotsOfSmartWallet[smartWallet] -= 1;\n\n            if(stakedKnotsOfSmartWallet[smartWallet] == 0) {\n                _authorizeRepresentative(smartWallet, smartWalletDormantRepresentative[smartWallet], true);\n\n                // delete the dormant representative as it is set active\n                delete smartWalletDormantRepresentative[smartWallet];\n            }\n        }\n    }\n\n    receive() external payable {}\n\n    /// @notice Every liquid staking derivative network has a single fee recipient determined by its syndicate contract\n    /// @dev The syndicate contract is only deployed after the first KNOT to mint derivatives creates the network Stakehouse\n    /// @dev Because the syndicate contract for the LSDN is deployed with CREATE2, we can predict the fee recipient ahead of time\n    /// @dev This is important because node runners need to configure their nodes before or immediately after staking\n    function getNetworkFeeRecipient() external view returns (address) {\n        // Always 1 knot initially registered to the syndicate because we expand it one by one\n        return syndicateFactory.calculateSyndicateDeploymentAddress(\n            address(this),\n            address(this),\n            1\n        );\n    }\n\n    /// @dev Internal method for managing the initialization of the staking manager contract\n    function _init(\n        address _dao,\n        address _syndicateFactory,\n        address _smartWalletFactory,\n        address _lpTokenFactory,\n        address _brand,\n        address _savETHVaultDeployer,\n        address _stakingFundsVaultDeployer,\n        address _optionalGatekeeperDeployer,\n        uint256 _optionalCommission,\n        bool _deployOptionalGatekeeper,\n        string calldata _stakehouseTicker\n    ) internal {\n        if (_dao == address(0)) revert ZeroAddress();\n\n        brand = _brand;\n        dao = _dao;\n        syndicateFactory = ISyndicateFactory(_syndicateFactory);\n        smartWalletFactory = IOwnableSmartWalletFactory(_smartWalletFactory);\n\n        _updateTicker(_stakehouseTicker);\n\n        _updateDAORevenueCommission(_optionalCommission);\n\n        _initStakingFundsVault(_stakingFundsVaultDeployer, _lpTokenFactory);\n        _initSavETHVault(_savETHVaultDeployer, _lpTokenFactory);\n\n        factory = LSDNFactory(msg.sender);\n\n        if (_deployOptionalGatekeeper) {\n            gatekeeper = OptionalGatekeeperFactory(_optionalGatekeeperDeployer).deploy(address(this));\n            enableWhitelisting = true;\n            emit WhitelistingStatusChanged(dao, enableWhitelisting);\n        }\n    }\n\n    /// @dev function checks if a node runner is valid depending upon whitelisting status\n    /// @param _nodeRunner address of the user requesting to become node runner\n    /// @return true if eligible. reverts with message if not eligible\n    function _isNodeRunnerValid(address _nodeRunner) internal view returns (bool) {\n        return enableWhitelisting && !isNodeRunnerWhitelisted[_nodeRunner] ? false : true;\n    }\n\n    /// @dev Manage the removal and appointing of smart wallet representatives including managing state\n    function _authorizeRepresentative(\n        address _smartWallet, \n        address _eoaRepresentative, \n        bool _isEnabled\n    ) internal {\n        if(!_isEnabled && smartWalletRepresentative[_smartWallet] != address(0)) {\n\n            // authorize the EOA representative on the Stakehouse\n            IOwnableSmartWallet(_smartWallet).execute(\n                address(getTransactionRouter()),\n                abi.encodeWithSelector(\n                    ITransactionRouter.authorizeRepresentative.selector,\n                    _eoaRepresentative,\n                    _isEnabled\n                )\n            );\n\n            // delete the mapping\n            delete smartWalletRepresentative[_smartWallet];\n\n            emit RepresentativeRemoved(_smartWallet, _eoaRepresentative);\n        }\n        else if(_isEnabled && smartWalletRepresentative[_smartWallet] == address(0)) {\n\n            // authorize the EOA representative on the Stakehouse\n            IOwnableSmartWallet(_smartWallet).execute(\n                address(getTransactionRouter()),\n                abi.encodeWithSelector(\n                    ITransactionRouter.authorizeRepresentative.selector,\n                    _eoaRepresentative,\n                    _isEnabled\n                )\n            );\n\n            // store EOA to the wallet mapping\n            smartWalletRepresentative[_smartWallet] = _eoaRepresentative;\n\n            emit RepresentativeAppointed(_smartWallet, _eoaRepresentative);\n        } else {\n            revert(\"Error\");\n        }\n    }\n\n    /// @dev Internal method for doing just staking - pre-checks done outside this method to avoid stack too deep\n    function _stake(\n        bytes calldata _blsPublicKey,\n        bytes calldata _cipherText,\n        bytes calldata _aesEncryptorKey,\n        IDataStructures.EIP712Signature calldata _encryptionSignature,\n        bytes32 dataRoot\n    ) internal {\n        address smartWallet = smartWalletOfKnot[_blsPublicKey];\n\n        // send 24 ether from savETH vault to smart wallet\n        savETHVault.withdrawETHForStaking(smartWallet, 24 ether);\n\n        // send 4 ether from DAO staking funds vault\n        stakingFundsVault.withdrawETH(smartWallet, 4 ether);\n\n        // interact with transaction router using smart wallet to deposit 32 ETH\n        IOwnableSmartWallet(smartWallet).execute(\n            address(getTransactionRouter()),\n            abi.encodeWithSelector(\n                ITransactionRouter.registerValidator.selector,\n                smartWallet,\n                _blsPublicKey,\n                _cipherText,\n                _aesEncryptorKey,\n                _encryptionSignature,\n                dataRoot\n            ),\n            32 ether\n        );\n\n        // increment number of staked KNOTs in the wallet\n        stakedKnotsOfSmartWallet[smartWallet] += 1;\n\n        emit KnotStaked(_blsPublicKey, msg.sender);\n    }\n\n    /// @dev The second knot onwards will join the LSDN stakehouse and expand the registered syndicate knots\n    function _joinLSDNStakehouse(\n        bytes calldata _blsPubKey,\n        IDataStructures.ETH2DataReport calldata _beaconChainBalanceReport,\n        IDataStructures.EIP712Signature calldata _reportSignature\n    ) internal {\n        // total number of knots created with the syndicate increases\n        numberOfKnots += 1;\n\n        // The savETH will go to the savETH vault, the collateralized SLOT for syndication owned by the smart wallet\n        // sETH will also be minted in the smart wallet but will be moved out and distributed to the syndicate for claiming by the DAO\n        address associatedSmartWallet = smartWalletOfKnot[_blsPubKey];\n\n        // Join the LSDN stakehouse\n        string memory lowerTicker = IBrandNFT(brand).toLowerCase(stakehouseTicker);\n        IOwnableSmartWallet(associatedSmartWallet).execute(\n            address(getTransactionRouter()),\n            abi.encodeWithSelector(\n                ITransactionRouter.joinStakehouse.selector,\n                associatedSmartWallet,\n                _blsPubKey,\n                stakehouse,\n                IBrandNFT(brand).lowercaseBrandTickerToTokenId(lowerTicker),\n                savETHVault.indexOwnedByTheVault(),\n                _beaconChainBalanceReport,\n                _reportSignature\n            )\n        );\n\n        // Register the knot to the syndicate\n        bytes[] memory _blsPublicKeyOfKnots = new bytes[](1);\n        _blsPublicKeyOfKnots[0] = _blsPubKey;\n        Syndicate(payable(syndicate)).registerKnotsToSyndicate(_blsPublicKeyOfKnots);\n\n        // Autostake DAO sETH with the syndicate\n        _autoStakeWithSyndicate(associatedSmartWallet, _blsPubKey);\n\n        emit StakehouseJoined(_blsPubKey);\n    }\n\n    /// @dev Perform all the steps required to create the LSDN stakehouse that other knots will join\n    function _createLSDNStakehouse(\n        bytes calldata _blsPublicKeyOfKnot,\n        IDataStructures.ETH2DataReport calldata _beaconChainBalanceReport,\n        IDataStructures.EIP712Signature calldata _reportSignature\n    ) internal {\n        // create stakehouse and mint derivative for first bls key - the others are just used to create the syndicate\n        // The savETH will go to the savETH vault, the collateralized SLOT for syndication owned by the smart wallet\n        // sETH will also be minted in the smart wallet but will be moved out and distributed to the syndicate for claiming by the DAO\n        address associatedSmartWallet = smartWalletOfKnot[_blsPublicKeyOfKnot];\n        IOwnableSmartWallet(associatedSmartWallet).execute(\n            address(getTransactionRouter()),\n            abi.encodeWithSelector(\n                ITransactionRouter.createStakehouse.selector,\n                associatedSmartWallet,\n                _blsPublicKeyOfKnot,\n                stakehouseTicker,\n                savETHVault.indexOwnedByTheVault(),\n                _beaconChainBalanceReport,\n                _reportSignature\n            )\n        );\n\n        // Number of knots has increased\n        numberOfKnots += 1;\n\n        // Capture the address of the Stakehouse for future knots to join\n        stakehouse = getStakeHouseUniverse().memberKnotToStakeHouse(_blsPublicKeyOfKnot);\n        IERC20 sETH = IERC20(getSlotRegistry().stakeHouseShareTokens(stakehouse));\n\n        // Give liquid staking manager ability to manage keepers and set a house keeper if decided by the network\n        IOwnableSmartWallet(associatedSmartWallet).execute(\n            stakehouse,\n            abi.encodeWithSelector(\n                Ownable.transferOwnership.selector,\n                address(this)\n            )\n        );\n\n        IStakeHouseRegistry(stakehouse).setGateKeeper(address(gatekeeper));\n\n        // Let the liquid staking manager take ownership of the brand NFT for management\n        IOwnableSmartWallet(associatedSmartWallet).execute(\n            brand,\n            abi.encodeWithSelector(\n                IBrandNFT.transferFrom.selector,\n                associatedSmartWallet,\n                address(this),\n                IBrandNFT(brand).lowercaseBrandTickerToTokenId(IBrandNFT(brand).toLowerCase(stakehouseTicker))\n            )\n        );\n\n        // Approve any future sETH for being staked in the Syndicate\n        _deploySyndicateAndApproveSETH(_blsPublicKeyOfKnot, sETH);\n\n        // Auto-stake sETH by pulling sETH out the smart wallet and staking in the syndicate\n        _autoStakeWithSyndicate(associatedSmartWallet, _blsPublicKeyOfKnot);\n\n        emit StakehouseCreated(stakehouseTicker, stakehouse);\n    }\n\n    function _deploySyndicateAndApproveSETH(\n        bytes calldata _blsPublicKeyOfKnot,\n        IERC20 _sETH\n    ) internal {\n        // Deploy the EIP1559 transaction reward sharing contract but no priority required because sETH will be auto staked\n        address[] memory priorityStakers = new address[](0);\n        bytes[] memory initialKnots = new bytes[](1);\n        initialKnots[0] = _blsPublicKeyOfKnot;\n        syndicate = syndicateFactory.deploySyndicate(\n            address(this),\n            0,\n            priorityStakers,\n            initialKnots\n        );\n\n        // Contract approves syndicate to take sETH on behalf of the DAO\n        _sETH.approve(syndicate, (2 ** 256) - 1);\n    }\n\n    /// @dev Remove the sETH from the node runner smart wallet in order to auto-stake the sETH in the syndicate\n    function _autoStakeWithSyndicate(address _associatedSmartWallet, bytes memory _blsPubKey) internal {\n        IERC20 sETH = IERC20(getSlotRegistry().stakeHouseShareTokens(stakehouse));\n\n        uint256 stakeAmount = 12 ether;\n        IOwnableSmartWallet(_associatedSmartWallet).execute(\n            address(sETH),\n            abi.encodeWithSelector(\n                IERC20.transfer.selector,\n                address(this),\n                stakeAmount\n            )\n        );\n\n        // Create the payload for staking\n        bytes[] memory stakingKeys = new bytes[](1);\n        stakingKeys[0] = _blsPubKey;\n\n        uint256[] memory stakeAmounts = new uint256[](1);\n        stakeAmounts[0] = stakeAmount;\n\n        // Stake the sETH to be received by the LPs of the Staking Funds Vault (fees and mev)\n        Syndicate(payable(syndicate)).stake(stakingKeys, stakeAmounts, address(stakingFundsVault));\n    }\n\n    /// @dev Something that can be overriden during testing\n    function _initSavETHVault(address _savETHVaultDeployer, address _lpTokenFactory) internal virtual {\n        // Use an external deployer to reduce the size of the liquid staking manager\n        savETHVault = SavETHVault(\n            SavETHVaultDeployer(_savETHVaultDeployer).deploySavETHVault(address(this), _lpTokenFactory)\n        );\n    }\n\n    /// @dev Something that can be overriden during testing\n    function _initStakingFundsVault(address _stakingFundsVaultDeployer, address _tokenFactory) internal virtual {\n        stakingFundsVault = StakingFundsVault(\n            payable(StakingFundsVaultDeployer(_stakingFundsVaultDeployer).deployStakingFundsVault(\n                address(this),\n                _tokenFactory\n            ))\n        );\n    }\n\n    /// @dev This can be overriden to customise fee percentages\n    function _calculateCommission(uint256 _received) internal virtual view returns (uint256 _nodeRunner, uint256 _dao) {\n        if (_received == 0) revert NothingReceived();\n\n        if (daoCommissionPercentage > 0) {\n            uint256 daoAmount = (_received * daoCommissionPercentage) / MODULO;\n            uint256 rest = _received - daoAmount;\n            return (rest, daoAmount);\n        }\n\n        return (_received, 0);\n    }\n\n    /// @dev Check the savETH vault, staking funds vault and node runner smart wallet to ensure 32 ether required for staking has been achieved\n    function _assertEtherIsReadyForValidatorStaking(bytes calldata blsPubKey) internal view {\n        address associatedSmartWallet = smartWalletOfKnot[blsPubKey];\n        if (associatedSmartWallet.balance < 4 ether) revert NotEnoughETHToStake();\n\n        LPToken stakingFundsLP = stakingFundsVault.lpTokenForKnot(blsPubKey);\n        if (stakingFundsLP.totalSupply() < 4 ether) revert NotEnoughETHToStake();\n\n        LPToken savETHVaultLP = savETHVault.lpTokenForKnot(blsPubKey);\n        if (savETHVaultLP.totalSupply() < 24 ether) revert NotEnoughETHToStake();\n    }\n\n    /// @dev Internal method for dao to trigger updating commission it takes of node runner revenue\n    function _updateDAORevenueCommission(uint256 _commissionPercentage) internal {\n        if (_commissionPercentage > MAX_COMMISSION) revert InvalidCommission();\n\n        emit DAOCommissionUpdated(daoCommissionPercentage, _commissionPercentage);\n\n        daoCommissionPercentage = _commissionPercentage;\n    }\n\n    /// @dev Re-usable logic for updating LSD ticker used to mint derivatives\n    function _updateTicker(string calldata _newTicker) internal {\n        if (bytes(_newTicker).length < 3 || bytes(_newTicker).length > 5) revert InvalidTickerLength();\n        if (numberOfKnots != 0) revert HouseAlreadyCreated();\n\n        IBrandNFT brandNFT = IBrandNFT(brand);\n        string memory lowerTicker = brandNFT.toLowerCase(_newTicker);\n        if (\n            brandNFT.lowercaseBrandTickerToTokenId(lowerTicker) != 0\n        ) revert TickerAlreadyTaken();\n\n        IBrandCentral brandCentral = IBrandCentral(brandNFT.brandCentral());\n        IRestrictedTickerRegistry restrictedRegistry = IRestrictedTickerRegistry(brandCentral.claimAuction());\n\n        if (restrictedRegistry.isRestrictedBrandTicker(lowerTicker)) revert TickerAlreadyTaken();\n\n        stakehouseTicker = _newTicker;\n\n        emit NetworkTickerUpdated(_newTicker);\n    }\n}\n"
      },
      "contracts/liquid-staking/LPToken.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { Initializable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport { ERC20PermitUpgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol\";\nimport { ILPTokenInit } from \"../interfaces/ILPTokenInit.sol\";\nimport { ILiquidStakingManagerChildContract } from \"../interfaces/ILiquidStakingManagerChildContract.sol\";\nimport { ITransferHookProcessor } from \"../interfaces/ITransferHookProcessor.sol\";\n\ncontract LPToken is ILPTokenInit, ILiquidStakingManagerChildContract, Initializable, ERC20PermitUpgradeable {\n\n    uint256 constant MIN_TRANSFER_AMOUNT = 0.001 ether;\n\n    /// @notice Contract deployer that can control minting and burning but is associated with a liquid staking manager\n    address public deployer;\n\n    /// @notice Optional hook for processing transfers\n    ITransferHookProcessor transferHookProcessor;\n\n    /// @notice Whenever the address last interacted with a token\n    mapping(address => uint256) public lastInteractedTimestamp;\n\n    modifier onlyDeployer {\n        require(msg.sender == deployer, \"Only savETH vault\");\n        _;\n    }\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() initializer {}\n\n    /// @param _deployer Address of the account deploying the LP token\n    /// @param _transferHookProcessor Optional contract account that can be notified about transfer hooks\n    function init(\n        address _deployer,\n        address _transferHookProcessor,\n        string calldata _tokenSymbol,\n        string calldata _tokenName\n    ) external override initializer {\n        deployer = _deployer;\n        transferHookProcessor = ITransferHookProcessor(_transferHookProcessor);\n        __ERC20_init(_tokenName, _tokenSymbol);\n        __ERC20Permit_init(_tokenName);\n    }\n\n    /// @notice Mints a given amount of LP tokens\n    /// @dev Only savETH vault can mint\n    function mint(address _recipient, uint256 _amount) external onlyDeployer {\n        _mint(_recipient, _amount);\n    }\n\n    /// @notice Allows a LP token owner to burn their tokens\n    function burn(address _recipient, uint256 _amount) external onlyDeployer {\n        _burn(_recipient, _amount);\n    }\n\n    /// @notice In order to know the liquid staking network and manager associated with the LP token, call this\n    function liquidStakingManager() external view returns (address) {\n        return ILiquidStakingManagerChildContract(deployer).liquidStakingManager();\n    }\n\n    /// @dev If set, notify the transfer hook processor before token transfer\n    function _beforeTokenTransfer(address _from, address _to, uint256 _amount) internal override {\n        require(_amount >= MIN_TRANSFER_AMOUNT, \"Min transfer amount\");\n        require(_from != _to, \"Self transfer\");\n        if (address(transferHookProcessor) != address(0)) transferHookProcessor.beforeTokenTransfer(_from, _to, _amount);\n    }\n\n    /// @dev If set, notify the transfer hook processor after token transfer\n    function _afterTokenTransfer(address _from, address _to, uint256 _amount) internal override {\n        lastInteractedTimestamp[_from] = block.timestamp;\n        lastInteractedTimestamp[_to] = block.timestamp;\n        if (address(transferHookProcessor) != address(0)) transferHookProcessor.afterTokenTransfer(_from, _to, _amount);\n    }\n}"
      },
      "contracts/liquid-staking/LPTokenFactory.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { ILPTokenInit } from \"../interfaces/ILPTokenInit.sol\";\nimport { UpgradeableBeacon } from \"../proxy/UpgradeableBeacon.sol\";\nimport { BeaconProxy } from \"@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol\";\n\n/// @notice Contract for deploying a new LP token\ncontract LPTokenFactory {\n\n    /// @notice Emitted when a new LP token instance is deployed\n    event LPTokenDeployed(address indexed factoryCloneToken);\n\n    /// @notice Address of LP token implementation that is cloned on each LP token\n    address public lpTokenImplementation;\n\n    /// @notice Address of the implementation beacon\n    address public beacon;\n\n    /// @param _lpTokenImplementation Address of LP token implementation that is cloned on each LP token deployment\n    constructor(address _lpTokenImplementation, address _upgradeManager) {\n        require(_lpTokenImplementation != address(0), \"Address cannot be zero\");\n\n        lpTokenImplementation = _lpTokenImplementation;\n        beacon = address(new UpgradeableBeacon(lpTokenImplementation, _upgradeManager));\n    }\n\n    /// @notice Deploys a new LP token\n    /// @param _tokenSymbol Symbol of the LP token to be deployed\n    /// @param _tokenName Name of the LP token to be deployed\n    function deployLPToken(\n        address _deployer,\n        address _transferHookProcessor,\n        string calldata _tokenSymbol,\n        string calldata _tokenName\n    ) external returns (address) {\n        require(address(_deployer) != address(0), \"Zero address\");\n        require(bytes(_tokenSymbol).length != 0, \"Symbol cannot be zero\");\n        require(bytes(_tokenName).length != 0, \"Name cannot be zero\");\n\n        address newInstance = address(new BeaconProxy(\n                beacon,\n                abi.encodeCall(\n                    ILPTokenInit(payable(lpTokenImplementation)).init,\n                    (\n                        _deployer,\n                        _transferHookProcessor,\n                        _tokenSymbol,\n                        _tokenName\n                    )\n                )\n            ));\n\n        emit LPTokenDeployed(newInstance);\n\n        return newInstance;\n    }\n}"
      },
      "contracts/liquid-staking/LSDNFactory.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { Initializable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport { BeaconProxy } from \"@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol\";\nimport { ERC1967Proxy } from \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\";\nimport { UUPSUpgradeable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport { OwnableUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport { LiquidStakingManager } from \"./LiquidStakingManager.sol\";\nimport { GiantPoolBase } from \"./GiantPoolBase.sol\";\nimport { UpgradeableBeacon } from \"../proxy/UpgradeableBeacon.sol\";\nimport { IGiantSavETHVaultPool } from \"../interfaces/IGiantSavETHVaultPool.sol\";\nimport { IGiantMevAndFeesPool } from \"../interfaces/IGiantMevAndFeesPool.sol\";\n\n/// @notice Contract for deploying a new Liquid Staking Derivative Network (LSDN)\ncontract LSDNFactory is Initializable, UUPSUpgradeable, OwnableUpgradeable {\n\n    /// @notice Emitted when a new liquid staking manager is deployed\n    event LSDNDeployed(address indexed LiquidStakingManager);\n\n    /// @notice Beacon for any liquid staking manager proxies\n    address public liquidStakingManagerBeacon;\n\n    /// @notice Address of the liquid staking manager implementation that is cloned on each deployment\n    address public liquidStakingManagerImplementation;\n\n    /// @notice Address of the factory that will deploy a syndicate for the network after the first knot is created\n    address public syndicateFactory;\n\n    /// @notice Address of the factory for deploying LP tokens in exchange for ETH supplied to stake a KNOT\n    address public lpTokenFactory;\n\n    /// @notice Address of the factory for deploying smart wallets used by node runners during staking\n    address public smartWalletFactory;\n\n    /// @notice Address of brand NFT\n    address public brand;\n\n    /// @notice Address of the contract that can deploy new instances of SavETHVault\n    address public savETHVaultDeployer;\n\n    /// @notice Address of the contract that can deploy new instances of StakingFundsVault\n    address public stakingFundsVaultDeployer;\n\n    /// @notice Address of the contract that can deploy new instances of optional gatekeepers for controlling which knots can join the LSDN house\n    address public optionalGatekeeperDeployer;\n\n    /// @notice Address of associated giant protected staking pool\n    GiantPoolBase public giantSavETHPool;\n\n    /// @notice Address of giant fees and mev pool\n    GiantPoolBase public giantFeesAndMev;\n\n    /// @notice Establishes whether a given liquid staking manager address was deployed by this factory\n    mapping(address => bool) public isLiquidStakingManager;\n\n    /// @notice Establishes whether a given savETH vault belongs to a LSD network deployed by the factory\n    mapping(address => bool) public isSavETHVault;\n\n    /// @notice Establishes whether a given Staking funds vault belongs to a LSD network deployed by the factory\n    mapping(address => bool) public isStakingFundsVault;\n\n    /// @notice Initialization parameters required to deploy the LSDN factory\n    struct InitParams {\n        address _liquidStakingManagerImplementation;\n        address _syndicateFactory;\n        address _lpTokenFactory;\n        address _smartWalletFactory;\n        address _brand;\n        address _savETHVaultDeployer;\n        address _stakingFundsVaultDeployer;\n        address _optionalGatekeeperDeployer;\n        address _giantSavETHImplementation;\n        address _giantFeesAndMevImplementation;\n        address _giantLPDeployer;\n        address _upgradeManager;\n    }\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() initializer {}\n\n    /// @notice External one time function for initializing the factory\n    function init(InitParams memory _params) external initializer {\n        _init(_params);\n        _transferOwnership(_params._upgradeManager);\n    }\n\n    /// @dev Owner based upgrades\n    function _authorizeUpgrade(address newImplementation)\n    internal\n    onlyOwner\n    override\n    {}\n\n    /// @dev Internal initialization logic that can be called from mock harness contracts\n    function _init(InitParams memory _params) internal {\n        require(_params._liquidStakingManagerImplementation != address(0), \"Zero Address\");\n        require(_params._syndicateFactory != address(0), \"Zero Address\");\n        require(_params._lpTokenFactory != address(0), \"Zero Address\");\n        require(_params._smartWalletFactory != address(0), \"Zero Address\");\n        require(_params._brand != address(0), \"Zero Address\");\n        require(_params._savETHVaultDeployer != address(0), \"Zero Address\");\n        require(_params._stakingFundsVaultDeployer != address(0), \"Zero Address\");\n        require(_params._optionalGatekeeperDeployer != address(0), \"Zero Address\");\n\n        liquidStakingManagerImplementation = _params._liquidStakingManagerImplementation;\n        syndicateFactory = _params._syndicateFactory;\n        lpTokenFactory = _params._lpTokenFactory;\n        smartWalletFactory = _params._smartWalletFactory;\n        brand = _params._brand;\n        savETHVaultDeployer = _params._savETHVaultDeployer;\n        stakingFundsVaultDeployer = _params._stakingFundsVaultDeployer;\n        optionalGatekeeperDeployer = _params._optionalGatekeeperDeployer;\n\n        liquidStakingManagerBeacon = address(new UpgradeableBeacon(\n                liquidStakingManagerImplementation,\n                _params._upgradeManager\n            ));\n\n        ERC1967Proxy giantFeesAndMevProxy = new ERC1967Proxy(\n            _params._giantFeesAndMevImplementation,\n            abi.encodeCall(\n                IGiantMevAndFeesPool(_params._giantFeesAndMevImplementation).init,\n                (LSDNFactory(address(this)), _params._giantLPDeployer, _params._upgradeManager)\n            )\n        );\n        giantFeesAndMev = GiantPoolBase(address(giantFeesAndMevProxy));\n\n        ERC1967Proxy giantSavETHProxy = new ERC1967Proxy(\n            _params._giantSavETHImplementation,\n            abi.encodeCall(\n                IGiantSavETHVaultPool(_params._giantSavETHImplementation).init,\n                (LSDNFactory(address(this)), _params._giantLPDeployer, address(giantFeesAndMev), _params._upgradeManager)\n            )\n        );\n        giantSavETHPool = GiantPoolBase(address(giantSavETHProxy));\n\n    }\n\n    /// @notice Deploys a new LSDN and the liquid staking manger required to manage the network\n    /// @param _dao Address of the entity that will govern the liquid staking network\n    /// @param _stakehouseTicker Liquid staking derivative network ticker (between 3-5 chars)\n    function deployNewLiquidStakingDerivativeNetwork(\n        address _dao,\n        uint256 _optionalCommission,\n        bool _deployOptionalHouseGatekeeper,\n        string calldata _stakehouseTicker\n    ) public returns (address) {\n        // Clone a new liquid staking manager instance\n        address newInstance = _deployNewInstance(_dao, _optionalCommission, _deployOptionalHouseGatekeeper, _stakehouseTicker);\n\n        _registerLSDInstance(newInstance);\n\n        emit LSDNDeployed(newInstance);\n\n        return newInstance;\n    }\n\n    /// @dev deploy a new beacon based liquid staking manager instance\n    function _deployNewInstance(\n        address _dao,\n        uint256 _optionalCommission,\n        bool _deployOptionalHouseGatekeeper,\n        string calldata _stakehouseTicker\n    ) internal returns (address) {\n        return address(new BeaconProxy(\n                liquidStakingManagerBeacon,\n                abi.encodeCall(\n                    LiquidStakingManager(payable(liquidStakingManagerImplementation)).init,\n                    (\n                        _dao,\n                        syndicateFactory,\n                        smartWalletFactory,\n                        lpTokenFactory,\n                        brand,\n                        savETHVaultDeployer,\n                        stakingFundsVaultDeployer,\n                        optionalGatekeeperDeployer,\n                        _optionalCommission,\n                        _deployOptionalHouseGatekeeper,\n                        _stakehouseTicker\n                    )\n                )\n            ));\n    }\n\n    /// @dev Register the core contracts of an LSD network that were deployed by the factory\n    function _registerLSDInstance(address _newInstance) internal {\n        LiquidStakingManager lsdInstance = LiquidStakingManager(payable(_newInstance));\n\n        // Record that the manager was deployed by this contract\n        isLiquidStakingManager[_newInstance] = true;\n        isSavETHVault[address(lsdInstance.savETHVault())] = true;\n        isStakingFundsVault[address(lsdInstance.stakingFundsVault())] = true;\n    }\n}"
      },
      "contracts/liquid-staking/OptionalGatekeeperFactory.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { OptionalHouseGatekeeper } from \"./OptionalHouseGatekeeper.sol\";\n\ncontract OptionalGatekeeperFactory {\n\n    event NewOptionalGatekeeperDeployed(address indexed keeper, address indexed manager);\n\n    function deploy(address _liquidStakingManager) external returns (OptionalHouseGatekeeper) {\n        OptionalHouseGatekeeper newKeeper = new OptionalHouseGatekeeper(_liquidStakingManager);\n\n        emit NewOptionalGatekeeperDeployed(address(newKeeper), _liquidStakingManager);\n\n        return newKeeper;\n    }\n}"
      },
      "contracts/liquid-staking/OptionalHouseGatekeeper.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { IGateKeeper } from \"../interfaces/IGateKeeper.sol\";\nimport { ILiquidStakingManager } from \"../interfaces/ILiquidStakingManager.sol\";\n\n/// @title Liquid Staking Derivative Network Gatekeeper that only lets knots from within the network join the network house\ncontract OptionalHouseGatekeeper is IGateKeeper {\n\n    /// @notice Address of the core registry for the associated liquid staking network\n    ILiquidStakingManager public liquidStakingManager;\n\n    constructor(address _manager) {\n        liquidStakingManager = ILiquidStakingManager(_manager);\n    }\n\n    /// @notice Method called by the house before admitting a new KNOT member and giving house sETH\n    function isMemberPermitted(bytes calldata _blsPublicKeyOfKnot) external override view returns (bool) {\n        return liquidStakingManager.isBLSPublicKeyPartOfLSDNetwork(_blsPublicKeyOfKnot) && !liquidStakingManager.isBLSPublicKeyBanned(_blsPublicKeyOfKnot);\n    }\n}"
      },
      "contracts/liquid-staking/SavETHVault.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { Initializable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport { ReentrancyGuard } from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport { IDataStructures } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IDataStructures.sol\";\n\nimport { ILiquidStakingManager } from \"../interfaces/ILiquidStakingManager.sol\";\n\nimport { StakingFundsVault } from \"./StakingFundsVault.sol\";\nimport { LPToken } from \"./LPToken.sol\";\nimport { ETHPoolLPFactory } from \"./ETHPoolLPFactory.sol\";\nimport { LPTokenFactory } from \"./LPTokenFactory.sol\";\nimport { ETHTransferHelper } from \"../transfer/ETHTransferHelper.sol\";\n\ncontract SavETHVault is Initializable, ETHPoolLPFactory, ReentrancyGuard, ETHTransferHelper {\n\n    /// @notice signalize transfer of dETH to depositor\n    event DETHRedeemed(address depositor, uint256 amount);\n\n    /// @notice signalize withdrawal of ETH for staking\n    event ETHWithdrawnForStaking(address withdrawalAddress, address liquidStakingManager, uint256 amount);\n\n    /// @notice signalize deposit of dETH and isolation of KNOT in the index\n    event DETHDeposited(bytes blsPublicKeyOfKnot, uint128 dETHDeposited, uint256 lpTokensIssued);\n\n    /// @notice Liquid staking manager instance\n    ILiquidStakingManager public liquidStakingManager;\n\n    /// @notice index id of the savETH index owned by the vault\n    uint256 public indexOwnedByTheVault;\n\n    /// @notice Amount of tokens minted each time a KNOT is added to the universe. Denominated in ether due to redemption rights\n    uint256 public constant KNOT_BATCH_AMOUNT = 24 ether;\n\n    /// @notice dETH related details for a KNOT\n    /// @dev If dETH is not withdrawn, then for a non-existing dETH balance\n    /// the structure would result in zero balance even though dETH isn't withdrawn for KNOT\n    /// withdrawn parameter tracks the status of dETH for a KNOT\n    struct KnotDETHDetails {\n        uint256 savETHBalance;\n        bool withdrawn;\n    }\n\n    /// @notice dETH associated with the KNOT\n    mapping(bytes => KnotDETHDetails) public dETHForKnot;\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() initializer {}\n\n    function init(address _liquidStakingManagerAddress, LPTokenFactory _lpTokenFactory) external virtual initializer {\n        _init(_liquidStakingManagerAddress, _lpTokenFactory);\n    }\n\n    modifier onlyManager {\n        require(msg.sender == address(liquidStakingManager), \"Not the savETH vault manager\");\n        _;\n    }\n\n    /// @notice Stake ETH against multiple BLS keys and specify the amount of ETH being supplied for each key\n    /// @param _blsPublicKeyOfKnots BLS public key of the validators being staked and that are registered with the LSD network\n    /// @param _amounts Amount of ETH being supplied for the BLS public key at the same array index\n    function batchDepositETHForStaking(bytes[] calldata _blsPublicKeyOfKnots, uint256[] calldata _amounts) external payable {\n        uint256 numOfValidators = _blsPublicKeyOfKnots.length;\n        require(numOfValidators > 0, \"Empty arrays\");\n        require(numOfValidators == _amounts.length, \"Inconsistent array lengths\");\n\n        uint256 totalAmount;\n        for (uint256 i; i < numOfValidators; ++i) {\n            require(liquidStakingManager.isBLSPublicKeyBanned(_blsPublicKeyOfKnots[i]) == false, \"BLS public key is not part of LSD network\");\n            require(\n                getAccountManager().blsPublicKeyToLifecycleStatus(_blsPublicKeyOfKnots[i]) == IDataStructures.LifecycleStatus.INITIALS_REGISTERED,\n                \"Lifecycle status must be one\"\n            );\n\n            uint256 amount = _amounts[i];\n            totalAmount += amount;\n            _depositETHForStaking(_blsPublicKeyOfKnots[i], amount, false);\n        }\n\n        // Ensure that the sum of LP tokens issued equals the ETH deposited into the contract\n        require(msg.value == totalAmount, \"Invalid ETH amount attached\");\n    }\n\n    /// @notice function to allow users to deposit any amount of ETH for staking\n    /// @param _blsPublicKeyOfKnot BLS Public Key of the potential KNOT for which user is contributing\n    /// @param _amount number of ETH (input in wei) contributed by the user for staking\n    /// @return amount of ETH contributed for staking by the user\n    function depositETHForStaking(bytes calldata _blsPublicKeyOfKnot, uint256 _amount) public payable returns (uint256) {\n        require(liquidStakingManager.isBLSPublicKeyBanned(_blsPublicKeyOfKnot) == false, \"BLS public key is banned or not a part of LSD network\");\n        require(\n            getAccountManager().blsPublicKeyToLifecycleStatus(_blsPublicKeyOfKnot) == IDataStructures.LifecycleStatus.INITIALS_REGISTERED,\n            \"Lifecycle status must be one\"\n        );\n\n        require(msg.value == _amount, \"Must provide correct amount of ETH\");\n        _depositETHForStaking(_blsPublicKeyOfKnot, _amount, false);\n\n        return _amount;\n    }\n    \n    /// @notice fetch dETH required to be deposited to isolate KNOT in the index\n    /// @param _blsPublicKeyOfKnot BLS public key of the KNOT to be isolated\n    /// @return uint128 dETH amount\n    function dETHRequiredToIsolateWithdrawnKnot(bytes calldata _blsPublicKeyOfKnot) public view returns (uint128) {\n\n        KnotDETHDetails memory dETHDetails = dETHForKnot[_blsPublicKeyOfKnot];\n        require(dETHDetails.withdrawn == true, \"KNOT is already isolated\");\n\n        LPToken token = lpTokenForKnot[_blsPublicKeyOfKnot];\n        uint256 lpSharesBurned = KNOT_BATCH_AMOUNT - token.totalSupply();\n\n        uint256 dETHRequiredForIsolation = KNOT_BATCH_AMOUNT + getSavETHRegistry().dETHRewardsMintedForKnot(_blsPublicKeyOfKnot);\n\n        uint256 savETHBurnt = (dETHDetails.savETHBalance * lpSharesBurned) / KNOT_BATCH_AMOUNT;\n        uint256 currentSavETH = dETHDetails.savETHBalance - savETHBurnt;\n        uint256 currentDETH = getSavETHRegistry().savETHToDETH(currentSavETH);\n\n        return uint128(dETHRequiredForIsolation - currentDETH);\n    }\n\n    /// @notice function to allows users to deposit dETH in exchange of LP shares\n    /// @param _blsPublicKeyOfKnot BLS Public Key of the KNOT for which user is contributing\n    /// @param _amount number of dETH (input in wei) contributed by the user\n    /// @return amount of LP shares issued to the user\n    function depositDETHForStaking(bytes calldata _blsPublicKeyOfKnot, uint128 _amount) public returns (uint256) {\n        require(_amount >= uint128(0.001 ether), \"Amount must be at least 0.001 ether\");\n        \n        // only allow dETH deposits for KNOTs that have minted derivatives\n        require(\n            getAccountManager().blsPublicKeyToLifecycleStatus(_blsPublicKeyOfKnot) == IDataStructures.LifecycleStatus.TOKENS_MINTED,\n            \"Lifecycle status must be three\"\n        );\n\n        uint128 requiredDETH = dETHRequiredToIsolateWithdrawnKnot(_blsPublicKeyOfKnot);\n        require(_amount == requiredDETH, \"Amount must be equal to dETH required to isolate\");\n        require(uint128(getDETH().balanceOf(msg.sender)) >= _amount, \"Insufficient dETH balance\");\n\n        // transfer dETH from user to the pool\n        getDETH().transferFrom(msg.sender, address(this), uint256(_amount));\n        getSavETHRegistry().deposit(address(this), _amount);\n\n        getSavETHRegistry().isolateKnotFromOpenIndex(\n            liquidStakingManager.stakehouse(),\n            _blsPublicKeyOfKnot,\n            indexOwnedByTheVault\n        );\n\n        LPToken token = lpTokenForKnot[_blsPublicKeyOfKnot];\n        uint256 lpSharesBurned = KNOT_BATCH_AMOUNT - token.totalSupply();\n        // mint the previously burned LP shares\n        token.mint(msg.sender, lpSharesBurned);\n\n        KnotDETHDetails storage dETHDetails = dETHForKnot[_blsPublicKeyOfKnot];\n        // update withdrawn status to allow future withdrawals\n        dETHDetails.withdrawn = false;\n        dETHDetails.savETHBalance = 0;\n\n        emit DETHDeposited(_blsPublicKeyOfKnot, _amount, lpSharesBurned);\n\n        return lpSharesBurned;\n    }\n\n    /// @notice Burn multiple LP tokens in a batch to claim either ETH (if not staked) or dETH (if derivatives minted)\n    /// @param _blsPublicKeys List of BLS public keys that have received liquidity\n    /// @param _amounts Amount of each LP token that the user wants to burn in exchange for either ETH (if not staked) or dETH (if derivatives minted)\n    function burnLPTokensByBLS(bytes[] calldata _blsPublicKeys, uint256[] calldata _amounts) external {\n        uint256 numOfTokens = _blsPublicKeys.length;\n        require(numOfTokens > 0, \"Empty arrays\");\n        require(numOfTokens == _amounts.length, \"Inconsistent array length\");\n        for (uint256 i; i < numOfTokens; ++i) {\n            LPToken token = lpTokenForKnot[_blsPublicKeys[i]];\n            burnLPToken(token, _amounts[i]);\n        }\n    }\n\n    /// @notice Burn multiple LP tokens in a batch to claim either ETH (if not staked) or dETH (if derivatives minted)\n    /// @param _lpTokens List of LP token addresses held by the caller\n    /// @param _amounts Amount of each LP token that the user wants to burn in exchange for either ETH (if not staked) or dETH (if derivatives minted)\n    function burnLPTokens(LPToken[] calldata _lpTokens, uint256[] calldata _amounts) external {\n        uint256 numOfTokens = _lpTokens.length;\n        require(numOfTokens > 0, \"Empty arrays\");\n        require(numOfTokens == _amounts.length, \"Inconsisent array length\");\n        for (uint256 i; i < numOfTokens; ++i) {\n            burnLPToken(_lpTokens[i], _amounts[i]);\n        }\n    }\n\n    /// @notice function to allow users to burn LP token in exchange of ETH or dETH\n    /// @param _lpToken instance of LP token to be burnt\n    /// @param _amount number of LP tokens the user wants to burn\n    /// @return amount of ETH withdrawn\n    function burnLPToken(LPToken _lpToken, uint256 _amount) public nonReentrant returns (uint256) {\n        require(_amount >= MIN_STAKING_AMOUNT, \"Amount cannot be zero\");\n        require(_amount <= _lpToken.balanceOf(msg.sender), \"Not enough balance\");\n\n        // get BLS public key for the LP token\n        bytes memory blsPublicKeyOfKnot = KnotAssociatedWithLPToken[_lpToken];\n        IDataStructures.LifecycleStatus validatorStatus = getAccountManager().blsPublicKeyToLifecycleStatus(blsPublicKeyOfKnot);\n\n        require(\n            validatorStatus == IDataStructures.LifecycleStatus.INITIALS_REGISTERED ||\n            validatorStatus == IDataStructures.LifecycleStatus.TOKENS_MINTED,\n            \"Cannot burn LP tokens\"\n        );\n\n        // before burning, check the last LP token interaction and make sure its more than 30 mins old before permitting ETH withdrawals\n        bool isStaleLiquidity = _lpToken.lastInteractedTimestamp(msg.sender) + 30 minutes < block.timestamp;\n\n        // burn the amount of LP token from depositor's wallet\n        _lpToken.burn(msg.sender, _amount);\n        emit LPTokenBurnt(blsPublicKeyOfKnot, address(_lpToken), msg.sender, _amount);\n\n        if(validatorStatus == IDataStructures.LifecycleStatus.TOKENS_MINTED) {\n            // return dETH\n            // amount of dETH redeemed by user for given LP token\n            uint256 redemptionValue;\n\n            KnotDETHDetails storage dETHDetails = dETHForKnot[blsPublicKeyOfKnot];\n\n            if(!dETHDetails.withdrawn) {\n                // withdraw dETH if not done already\n\n                // get dETH balance for the KNOT\n                uint256 dETHBalance = getSavETHRegistry().knotDETHBalanceInIndex(indexOwnedByTheVault, blsPublicKeyOfKnot);\n                uint256 savETHBalance = getSavETHRegistry().dETHToSavETH(dETHBalance);\n                // This require should never fail but is there for sanity purposes\n                require(dETHBalance >= 24 ether, \"Nothing to withdraw\");\n\n                // withdraw savETH from savETH index to the savETH vault\n                // contract gets savETH and not the dETH\n                getSavETHRegistry().addKnotToOpenIndex(liquidStakingManager.stakehouse(), blsPublicKeyOfKnot, address(this));\n\n                // update mapping\n                dETHDetails.withdrawn = true;\n                dETHDetails.savETHBalance = savETHBalance;\n                dETHForKnot[blsPublicKeyOfKnot] = dETHDetails;\n            }\n\n            // redeem savETH from the vault\n            redemptionValue = (dETHDetails.savETHBalance * _amount) / 24 ether;\n\n            // withdraw dETH (after burning the savETH)\n            getSavETHRegistry().withdraw(msg.sender, uint128(redemptionValue));\n\n            uint256 dETHRedeemed = getSavETHRegistry().savETHToDETH(redemptionValue);\n\n            emit DETHRedeemed(msg.sender, dETHRedeemed);\n            return redemptionValue;\n        }\n\n        // Before allowing ETH withdrawals we check the value of isStaleLiquidity fetched before burn\n        require(isStaleLiquidity, \"Liquidity is still fresh\");\n\n        // return ETH for LifecycleStatus.INITIALS_REGISTERED\n        _transferETH(msg.sender, _amount);\n        emit ETHWithdrawnByDepositor(msg.sender, _amount);\n\n        return _amount;\n    }\n\n    /// @notice function to allow liquid staking manager to withdraw ETH for staking\n    /// @param _smartWallet address of the smart wallet that receives ETH\n    /// @param _amount amount of ETH to be withdrawn\n    /// @return amount of ETH withdrawn\n    function withdrawETHForStaking(\n        address _smartWallet,\n        uint256 _amount\n    ) public onlyManager nonReentrant returns (uint256) {\n        require(_amount >= 24 ether, \"Amount cannot be less than 24 ether\");\n        require(address(this).balance >= _amount, \"Insufficient withdrawal amount\");\n        require(_smartWallet != address(0), \"Zero address\");\n        require(_smartWallet != address(this), \"This address\");\n\n        _transferETH(_smartWallet, _amount);\n\n        emit ETHWithdrawnForStaking(_smartWallet, msg.sender, _amount);\n\n        return _amount;\n    }\n\n    /// @notice Utility function that proxies through to the liquid staking manager to check whether the BLS key ever registered with the network\n    function isBLSPublicKeyPartOfLSDNetwork(bytes calldata _blsPublicKeyOfKnot) public virtual view returns (bool) {\n        return liquidStakingManager.isBLSPublicKeyPartOfLSDNetwork(_blsPublicKeyOfKnot);\n    }\n\n    /// @notice Utility function that proxies through to the liquid staking manager to check whether the BLS key ever registered with the network but is now banned\n    function isBLSPublicKeyBanned(bytes calldata _blsPublicKeyOfKnot) public view returns (bool) {\n        return liquidStakingManager.isBLSPublicKeyBanned(_blsPublicKeyOfKnot);\n    }\n\n    /// @notice Utility function that determins whether an LP can be burned for dETH if the associated derivatives have been minted\n    function isDETHReadyForWithdrawal(address _lpTokenAddress) external view returns (bool) {\n        bytes memory blsPublicKeyOfKnot = KnotAssociatedWithLPToken[LPToken(_lpTokenAddress)];\n        IDataStructures.LifecycleStatus validatorStatus = getAccountManager().blsPublicKeyToLifecycleStatus(blsPublicKeyOfKnot);\n        return validatorStatus == IDataStructures.LifecycleStatus.TOKENS_MINTED;\n    }\n\n    /// @dev Logic required for initialization\n    function _init(address _liquidStakingManagerAddress, LPTokenFactory _lpTokenFactory) internal {\n        require(_liquidStakingManagerAddress != address(0), \"Zero address\");\n        require(address(_lpTokenFactory) != address(0), \"Zero address\");\n\n        lpTokenFactory = _lpTokenFactory;\n        liquidStakingManager = ILiquidStakingManager(_liquidStakingManagerAddress);\n\n        baseLPTokenName = \"dstETHToken_\";\n        baseLPTokenSymbol = \"dstETH_\";\n        maxStakingAmountPerValidator = 24 ether;\n\n        // create a savETH index owned by the vault\n        indexOwnedByTheVault = getSavETHRegistry().createIndex(address(this));\n    }\n}"
      },
      "contracts/liquid-staking/SavETHVaultDeployer.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { SavETHVault } from \"./SavETHVault.sol\";\nimport { LPTokenFactory } from \"./LPTokenFactory.sol\";\nimport { UpgradeableBeacon } from \"../proxy/UpgradeableBeacon.sol\";\nimport { BeaconProxy } from \"@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol\";\n\ncontract SavETHVaultDeployer {\n\n    event NewVaultDeployed(address indexed instance);\n\n    /// @notice Implementation at the time of deployment\n    address public implementation;\n\n    /// @notice Beacon referenced by each deployment of a savETH vault\n    address public beacon;\n\n    constructor(address _upgradeManager) {\n        implementation = address(new SavETHVault());\n        beacon = address(new UpgradeableBeacon(implementation, _upgradeManager));\n    }\n\n    function deploySavETHVault(address _liquidStakingManger, address _lpTokenFactory) external returns (address) {\n        address newVault = address(new BeaconProxy(\n                beacon,\n                abi.encodeCall(\n                    SavETHVault(payable(implementation)).init,\n                    (_liquidStakingManger, LPTokenFactory(_lpTokenFactory))\n                )\n            ));\n\n        emit NewVaultDeployed(newVault);\n\n        return newVault;\n    }\n}"
      },
      "contracts/liquid-staking/StakingFundsVault.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { Initializable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { ReentrancyGuard } from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport { StakehouseAPI } from \"@blockswaplab/stakehouse-solidity-api/contracts/StakehouseAPI.sol\";\nimport { IDataStructures } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IDataStructures.sol\";\n\nimport { ITransferHookProcessor } from \"../interfaces/ITransferHookProcessor.sol\";\nimport { Syndicate } from \"../syndicate/Syndicate.sol\";\nimport { ETHPoolLPFactory } from \"./ETHPoolLPFactory.sol\";\nimport { LiquidStakingManager } from \"./LiquidStakingManager.sol\";\nimport { LPTokenFactory } from \"./LPTokenFactory.sol\";\nimport { LPToken } from \"./LPToken.sol\";\nimport { SyndicateRewardsProcessor } from \"./SyndicateRewardsProcessor.sol\";\nimport { Strings } from \"@openzeppelin/contracts/utils/Strings.sol\";\n\n/// @title MEV and fees vault for a specified liquid staking network\ncontract StakingFundsVault is\n    Initializable,\n    ITransferHookProcessor,\n    StakehouseAPI,\n    ETHPoolLPFactory,\n    SyndicateRewardsProcessor,\n    ReentrancyGuard\n{\n\n    /// @notice signalize that the vault received ETH\n    event ETHDeposited(address sender, uint256 amount);\n\n    /// @notice signalize ETH withdrawal from the vault\n    event ETHWithdrawn(address receiver, address admin, uint256 amount);\n\n    /// @notice signalize ERC20 token recovery by the admin\n    event ERC20Recovered(address admin, address recipient, uint256 amount);\n\n    /// @notice signalize unwrapping of WETH in the vault\n    event WETHUnwrapped(address admin, uint256 amount);\n\n    /// @notice Emitted when an LP from another liquid staking network is migrated\n    event LPAddedForMigration(address indexed lpToken);\n\n    /// @notice Emitted when an LP token has been swapped for a new one from this vault\n    event LPMigrated(address indexed fromLPToken);\n\n    /// @notice Address of the network manager\n    LiquidStakingManager public liquidStakingNetworkManager;\n\n    /// @notice Total number of LP tokens issued in WEI\n    uint256 public totalShares;\n\n    /// @notice Total amount of ETH from LPs that has not been staked in the Ethereum deposit contract\n    uint256 public totalETHFromLPs;\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() initializer {}\n\n    /// @param _liquidStakingNetworkManager address of the liquid staking network manager\n    function init(address _liquidStakingNetworkManager, LPTokenFactory _lpTokenFactory) external virtual initializer {\n        _init(LiquidStakingManager(payable(_liquidStakingNetworkManager)), _lpTokenFactory);\n    }\n\n    modifier onlyManager() {\n        require(msg.sender == address(liquidStakingNetworkManager), \"Only network manager\");\n        _;\n    }\n\n    /// @notice Allows the liquid staking manager to notify funds vault about new derivatives minted to enable MEV claiming\n    function updateDerivativesMinted(bytes calldata _blsPublicKey) external onlyManager {\n        // update accumulated per LP before shares expand\n        updateAccumulatedETHPerLP();\n\n        // From this point onwards, we can use this variable to track ETH accrued to LP holders of this key\n        accumulatedETHPerLPAtTimeOfMintingDerivatives[_blsPublicKey] = accumulatedETHPerLPShare;\n\n        // We know 4 ETH for the KNOT came from this vault so increase the shares to get a % of vault rewards\n        totalShares += 4 ether;\n    }\n\n    /// @notice For knots that have minted derivatives, update accumulated ETH per LP\n    function updateAccumulatedETHPerLP() public {\n        _updateAccumulatedETHPerLP(totalShares);\n    }\n\n    /// @notice Batch deposit ETH for staking against multiple BLS public keys\n    /// @param _blsPublicKeyOfKnots List of BLS public keys being staked\n    /// @param _amounts Amounts of ETH being staked for each BLS public key\n    function batchDepositETHForStaking(bytes[] calldata _blsPublicKeyOfKnots, uint256[] calldata _amounts) external nonReentrant payable {\n        uint256 numOfValidators = _blsPublicKeyOfKnots.length;\n        require(numOfValidators > 0, \"Empty arrays\");\n        require(numOfValidators == _amounts.length, \"Inconsistent array lengths\");\n\n        // Track total ETH from LPs\n        totalETHFromLPs += msg.value;\n\n        // Update accrued ETH to contract per LP\n        updateAccumulatedETHPerLP();\n\n        uint256 totalAmount;\n        for (uint256 i; i < numOfValidators; ++i) {\n            require(liquidStakingNetworkManager.isBLSPublicKeyBanned(_blsPublicKeyOfKnots[i]) == false, \"BLS public key is not part of LSD network\");\n            require(\n                getAccountManager().blsPublicKeyToLifecycleStatus(_blsPublicKeyOfKnots[i]) == IDataStructures.LifecycleStatus.INITIALS_REGISTERED,\n                \"Lifecycle status must be one\"\n            );\n\n            LPToken tokenForKnot = lpTokenForKnot[_blsPublicKeyOfKnots[i]];\n            if (address(tokenForKnot) != address(0)) {\n                // Give anything owed to the user before making updates to user state\n                uint256 due = _distributeETHRewardsToUserForToken(\n                    msg.sender,\n                    address(tokenForKnot),\n                    tokenForKnot.balanceOf(msg.sender),\n                    msg.sender\n                );\n                _transferETH(msg.sender, due);\n            }\n\n            uint256 amount = _amounts[i];\n            totalAmount += amount;\n\n            _depositETHForStaking(_blsPublicKeyOfKnots[i], amount, true);\n        }\n\n        // Ensure that the sum of LP tokens issued equals the ETH deposited into the contract\n        require(msg.value == totalAmount, \"Invalid ETH amount attached\");\n    }\n\n    /// @notice Deposit ETH against a BLS public key for staking\n    /// @param _blsPublicKeyOfKnot BLS public key of validator registered by a node runner\n    /// @param _amount Amount of ETH being staked\n    function depositETHForStaking(bytes calldata _blsPublicKeyOfKnot, uint256 _amount) public nonReentrant payable returns (uint256) {\n        require(liquidStakingNetworkManager.isBLSPublicKeyBanned(_blsPublicKeyOfKnot) == false, \"BLS public key is banned or not a part of LSD network\");\n        require(\n            getAccountManager().blsPublicKeyToLifecycleStatus(_blsPublicKeyOfKnot) == IDataStructures.LifecycleStatus.INITIALS_REGISTERED,\n            \"Lifecycle status must be one\"\n        );\n\n        require(msg.value == _amount, \"Must provide correct amount of ETH\");\n\n        // Track total ETH from LPs\n        totalETHFromLPs += _amount;\n\n        // Update accrued ETH to contract per LP\n        updateAccumulatedETHPerLP();\n\n        // Give anything owed to the user before making updates to user state\n        LPToken tokenForKnot = lpTokenForKnot[_blsPublicKeyOfKnot];\n        if (address(tokenForKnot) != address(0)) {\n            uint256 due = _distributeETHRewardsToUserForToken(\n                msg.sender,\n                address(tokenForKnot),\n                tokenForKnot.balanceOf(msg.sender),\n                msg.sender\n            );\n            _transferETH(msg.sender, due);\n        }\n\n        _depositETHForStaking(_blsPublicKeyOfKnot, _amount, true);\n\n        return _amount;\n    }\n\n    /// @notice Burn a batch of LP tokens in order to get back ETH that has not been staked by BLS public key\n    /// @param _blsPublicKeys List of BLS public keys that received ETH for staking\n    /// @param _amounts List of amounts of LP tokens being burnt\n    function burnLPTokensForETHByBLS(bytes[] calldata _blsPublicKeys, uint256[] calldata _amounts) external {\n        uint256 numOfTokens = _blsPublicKeys.length;\n        require(numOfTokens > 0, \"Empty arrays\");\n        require(numOfTokens == _amounts.length, \"Inconsistent array length\");\n        for (uint256 i; i < numOfTokens; ++i) {\n            LPToken token = lpTokenForKnot[_blsPublicKeys[i]];\n            require(address(token) != address(0), \"No ETH staked for specified BLS key\");\n            burnLPForETH(token, _amounts[i]);\n        }\n    }\n\n    /// @notice Burn a batch of LP tokens in order to get back ETH that has not been staked\n    /// @param _lpTokens Address of LP tokens being burnt\n    /// @param _amounts Amount of LP tokens being burnt\n    function burnLPTokensForETH(LPToken[] calldata _lpTokens, uint256[] calldata _amounts) external {\n        uint256 numOfTokens = _lpTokens.length;\n        require(numOfTokens > 0, \"Empty arrays\");\n        require(numOfTokens == _amounts.length, \"Inconsistent array length\");\n        for (uint256 i; i < numOfTokens; ++i) {\n            burnLPForETH(_lpTokens[i], _amounts[i]);\n        }\n    }\n\n    /// @notice For a user that has deposited ETH that has not been staked, allow them to burn LP to get ETH back\n    /// @param _lpToken Address of the LP token being burnt\n    /// @param _amount Amount of LP token being burnt\n    function burnLPForETH(LPToken _lpToken, uint256 _amount) public nonReentrant {\n        require(_amount >= MIN_STAKING_AMOUNT, \"Amount cannot be zero\");\n        require(_amount <= _lpToken.balanceOf(msg.sender), \"Not enough balance\");\n        require(address(_lpToken) != address(0), \"Zero address specified\");\n\n        bytes memory blsPublicKeyOfKnot = KnotAssociatedWithLPToken[_lpToken];\n        require(\n            getAccountManager().blsPublicKeyToLifecycleStatus(blsPublicKeyOfKnot) == IDataStructures.LifecycleStatus.INITIALS_REGISTERED,\n            \"Cannot burn LP tokens\"\n        );\n        require(_lpToken.lastInteractedTimestamp(msg.sender) + 30 minutes < block.timestamp, \"Too new\");\n\n        updateAccumulatedETHPerLP();\n\n        _lpToken.burn(msg.sender, _amount);\n\n        // Track total ETH from LPs\n        totalETHFromLPs -= _amount;\n\n        _transferETH(msg.sender, _amount);\n\n        emit ETHWithdrawnByDepositor(msg.sender, _amount);\n\n        emit LPTokenBurnt(blsPublicKeyOfKnot, address(_lpToken), msg.sender, _amount);\n    }\n\n    /// @notice Any LP tokens for BLS keys that have had their derivatives minted can claim ETH from the syndicate contract\n    /// @param _blsPubKeys List of BLS public keys being processed\n    function claimRewards(\n        address _recipient,\n        bytes[] calldata _blsPubKeys\n    ) external nonReentrant {\n        // Withdraw any ETH accrued on free floating SLOT from syndicate to this contract\n        // If a partial list of BLS keys that have free floating staked are supplied, then partial funds accrued will be fetched\n        _claimFundsFromSyndicateForDistribution(\n            liquidStakingNetworkManager.syndicate(),\n            _blsPubKeys\n        );\n\n        uint256 totalToSend;\n        uint256 numOfKeys = _blsPubKeys.length;\n        for (uint256 i; i < numOfKeys; ++i) {\n            // Ensure that the BLS key has its derivatives minted\n            require(\n                getAccountManager().blsPublicKeyToLifecycleStatus(_blsPubKeys[i]) == IDataStructures.LifecycleStatus.TOKENS_MINTED,\n                \"Derivatives not minted\"\n            );\n\n            // If msg.sender has a balance for the LP token associated with the BLS key, then send them any accrued ETH\n            LPToken token = lpTokenForKnot[_blsPubKeys[i]];\n            require(address(token) != address(0), \"Invalid BLS key\");\n            totalToSend += _distributeETHRewardsToUserForToken(msg.sender, address(token), token.balanceOf(msg.sender), _recipient);\n        }\n\n        _transferETH(_recipient, totalToSend);\n    }\n\n    /// @notice function to allow admins to withdraw ETH from the vault for staking purpose\n    /// @param _wallet address of the smart wallet that receives ETH\n    /// @param _amount number of ETH withdrawn\n    /// @return number of ETH withdrawn\n    function withdrawETH(address _wallet, uint256 _amount) public onlyManager nonReentrant returns (uint256) {\n        require(_amount >= 4 ether, \"Amount cannot be less than 4 ether\");\n        require(_amount <= address(this).balance, \"Not enough ETH to withdraw\");\n        require(_wallet != address(0), \"Zero address\");\n\n        // As this tracks ETH that has not been sent to deposit contract, update it\n        totalETHFromLPs -= _amount;\n\n        // Transfer the ETH to the wallet\n        _transferETH(_wallet, _amount);\n\n        emit ETHWithdrawn(_wallet, msg.sender, _amount);\n\n        return _amount;\n    }\n\n    /// @notice LP token holders can unstake sETH and leave the LSD network by burning their LP tokens\n    /// @param _blsPublicKeys List of associated BLS public keys\n    /// @param _amount Amount of LP token from user being burnt.\n    function unstakeSyndicateSETHByBurningLP(\n        bytes[] calldata _blsPublicKeys,\n        uint256 _amount\n    ) external nonReentrant {\n        require(_blsPublicKeys.length == 1, \"One unstake at a time\");\n        require(_amount > 0, \"No amount specified\");\n\n        LPToken token = lpTokenForKnot[_blsPublicKeys[0]];\n        require(token.balanceOf(msg.sender) >= _amount, \"Not enough LP\");\n\n        // Bring ETH accrued into this contract and distribute it amongst existing LPs\n        Syndicate syndicate = Syndicate(payable(liquidStakingNetworkManager.syndicate()));\n        _claimFundsFromSyndicateForDistribution(address(syndicate), _blsPublicKeys);\n        updateAccumulatedETHPerLP();\n\n        // This will transfer rewards to user\n        token.burn(msg.sender, _amount);\n\n        // Reduce the shares in the contract\n        totalShares -= _amount;\n\n        // Unstake and send sETH to caller\n        uint256[] memory amountsForUnstaking = new uint256[](1);\n        amountsForUnstaking[0] = _amount * 3;\n        syndicate.unstake(address(this), msg.sender, _blsPublicKeys, amountsForUnstaking);\n    }\n\n    /// @notice Preview total ETH accumulated by a staking funds LP token holder associated with many KNOTs that have minted derivatives\n    function batchPreviewAccumulatedETH(address _user, LPToken[] calldata _token) external view returns (uint256) {\n        uint256 totalUnclaimed;\n        for (uint256 i; i < _token.length; ++i) {\n            bytes memory associatedBLSPublicKeyOfLpToken = KnotAssociatedWithLPToken[_token[i]];\n            if (getAccountManager().blsPublicKeyToLifecycleStatus(associatedBLSPublicKeyOfLpToken) != IDataStructures.LifecycleStatus.TOKENS_MINTED) {\n                continue;\n            }\n\n            address payable syndicate = payable(liquidStakingNetworkManager.syndicate());\n            totalUnclaimed += Syndicate(syndicate).previewUnclaimedETHAsFreeFloatingStaker(\n                address(this),\n                associatedBLSPublicKeyOfLpToken\n            );\n        }\n\n        uint256 totalAccumulated;\n        for (uint256 i; i < _token.length; ++i) {\n            totalAccumulated += _previewAccumulatedETH(\n                _user,\n                address(_token[i]),\n                _token[i].balanceOf(_user),\n                totalShares,\n                totalUnclaimed\n            );\n        }\n\n        return totalAccumulated;\n    }\n\n    /// @notice before an LP token is transferred, pay the user any unclaimed ETH rewards\n    function beforeTokenTransfer(address _from, address _to, uint256 _amount) external override {\n        address syndicate = liquidStakingNetworkManager.syndicate();\n        if (syndicate != address(0)) {\n            LPToken token = LPToken(msg.sender);\n            bytes memory blsPubKey = KnotAssociatedWithLPToken[token];\n            require(blsPubKey.length > 0, \"Invalid token\");\n\n            if (getAccountManager().blsPublicKeyToLifecycleStatus(blsPubKey) == IDataStructures.LifecycleStatus.TOKENS_MINTED) {\n                // Claim any ETH for the BLS key mapped to this token\n                bytes[] memory keys = new bytes[](1);\n                keys[0] = blsPubKey;\n                _claimFundsFromSyndicateForDistribution(syndicate, keys);\n\n                // Update the accumulated ETH per minted derivative LP share\n                updateAccumulatedETHPerLP();\n\n                // distribute any due rewards for the `from` user\n                if (_from != address(0)) {\n                    uint256 fromBalance = token.balanceOf(_from);\n\n                    _transferETH(\n                        _from,\n                        _distributeETHRewardsToUserForToken(_from, address(token), fromBalance, _from)\n                    );\n\n                    if (token.balanceOf(_from) != fromBalance) revert(\"ReentrancyCall\");\n\n                    // Ensure claimed amount is based on new balance\n                    claimed[_from][address(token)] = fromBalance == 0 ?\n                        0 : ((fromBalance - _amount) * accumulatedETHPerLPShare) / PRECISION;\n                }\n\n                // in case the new user has existing rewards - give it to them so that the after transfer hook does not wipe pending rewards\n                if (_to != address(0)) {\n                    uint256 toBalance = token.balanceOf(_to);\n\n                    _transferETH(\n                        _to,\n                        _distributeETHRewardsToUserForToken(_to, address(token), toBalance, _to)\n                    );\n\n                    if (token.balanceOf(_to) != toBalance) revert(\"ReentrancyCall\");\n\n                    claimed[_to][address(token)] = ((toBalance + _amount) * accumulatedETHPerLPShare) / PRECISION;\n                }\n            }\n        }\n    }\n\n    /// @notice After an LP token is transferred, ensure that the new account cannot claim historical rewards\n    function afterTokenTransfer(address, address _to, uint256) external override {\n        // No need to do anything here\n    }\n\n    /// @notice Claim ETH to this contract from the syndicate that was accrued by a list of actively staked validators\n    /// @param _blsPubKeys List of BLS public key identifiers of validators that have sETH staked in the syndicate for the vault\n    function claimFundsFromSyndicateForDistribution(bytes[] memory _blsPubKeys) external {\n        _claimFundsFromSyndicateForDistribution(liquidStakingNetworkManager.syndicate(), _blsPubKeys);\n    }\n\n    /// @notice Total rewards received filtering out ETH that has been deposited by LPs\n    function totalRewardsReceived() public view override returns (uint256) {\n        return address(this).balance + totalClaimed - totalETHFromLPs;\n    }\n\n    /// @notice Return the address of the liquid staking manager associated with the vault\n    function liquidStakingManager() external view returns (address) {\n        return address(liquidStakingNetworkManager);\n    }\n\n    /// @dev Claim ETH from syndicate for a list of BLS public keys for later distribution amongst LPs\n    function _claimFundsFromSyndicateForDistribution(address _syndicate, bytes[] memory _blsPubKeys) internal {\n        require(_syndicate != address(0), \"Invalid configuration\");\n\n        // Claim all of the ETH due from the syndicate for the auto-staked sETH\n        Syndicate syndicateContract = Syndicate(payable(_syndicate));\n        syndicateContract.claimAsStaker(address(this), _blsPubKeys);\n\n        updateAccumulatedETHPerLP();\n    }\n\n    /// @dev Total claimed for a user and LP token needs to be based on when derivatives were minted so that pro-rated share is not earned too early causing phantom balances\n    function _getTotalClaimedForUserAndToken(address _user, address _token, uint256 _balance) internal override view returns (uint256) {\n        uint256 claimedSoFar = claimed[_user][_token];\n        bytes memory blsPubKey = KnotAssociatedWithLPToken[LPToken(_token)];\n\n        // Either user has a claimed amount or their claimed amount needs to be based on accumulated ETH at time of minting derivatives\n        return claimedSoFar > 0 ?\n                claimedSoFar : (_balance * accumulatedETHPerLPAtTimeOfMintingDerivatives[blsPubKey]) / PRECISION;\n    }\n\n    /// @dev Use _getTotalClaimedForUserAndToken to correctly track and save total claimed by a user for a token\n    function _increaseClaimedForUserAndToken(\n        address _user,\n        address _token,\n        uint256 _increase,\n        uint256 _balance\n    ) internal override {\n        // _getTotalClaimedForUserAndToken will factor in accumulated ETH at time of minting derivatives\n        claimed[_user][_token] = _getTotalClaimedForUserAndToken(_user, _token, _balance) + _increase;\n    }\n\n    /// @dev Initialization logic\n    function _init(LiquidStakingManager _liquidStakingNetworkManager, LPTokenFactory _lpTokenFactory) internal virtual {\n        require(address(_liquidStakingNetworkManager) != address(0), \"Zero Address\");\n        require(address(_lpTokenFactory) != address(0), \"Zero Address\");\n\n        liquidStakingNetworkManager = _liquidStakingNetworkManager;\n        lpTokenFactory = _lpTokenFactory;\n\n        baseLPTokenName = \"ETHLPToken_\";\n        baseLPTokenSymbol = \"ETHLP_\";\n        maxStakingAmountPerValidator = 4 ether;\n    }\n}"
      },
      "contracts/liquid-staking/StakingFundsVaultDeployer.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { StakingFundsVault } from \"./StakingFundsVault.sol\";\nimport { LPTokenFactory } from \"./LPTokenFactory.sol\";\nimport { UpgradeableBeacon } from \"../proxy/UpgradeableBeacon.sol\";\nimport { BeaconProxy } from \"@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol\";\n\ncontract StakingFundsVaultDeployer {\n\n    event NewVaultDeployed(address indexed instance);\n\n    /// @notice Implementation at the time of deployment\n    address public implementation;\n\n    /// @notice Beacon referenced by each deployment of a staking funds vault\n    address public beacon;\n\n    constructor(address _upgradeManager) {\n        implementation = address(new StakingFundsVault());\n        beacon = address(new UpgradeableBeacon(implementation, _upgradeManager));\n    }\n\n    function deployStakingFundsVault(address _liquidStakingManager, address _tokenFactory) external returns (address) {\n        address newVault = address(new BeaconProxy(\n                beacon,\n                abi.encodeCall(\n                    StakingFundsVault(payable(implementation)).init,\n                    (_liquidStakingManager, LPTokenFactory(_tokenFactory))\n                )\n            ));\n\n        emit NewVaultDeployed(newVault);\n\n        return newVault;\n    }\n}"
      },
      "contracts/liquid-staking/SyndicateRewardsProcessor.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { ETHTransferHelper } from \"../transfer/ETHTransferHelper.sol\";\n\nerror ZeroAddress();\n\n/// @notice Allows a contract to receive rewards from a syndicate and distribute it amongst LP holders\nabstract contract SyndicateRewardsProcessor is ETHTransferHelper {\n\n    /// @notice Emitted when ETH is received by the contract and processed\n    event ETHReceived(uint256 amount);\n\n    /// @notice Emitted when ETH from syndicate is distributed to a user\n    event ETHDistributed(address indexed user, address indexed recipient, uint256 amount);\n\n    /// @notice Precision used in rewards calculations for scaling up and down\n    uint256 public constant PRECISION = 1e24;\n\n    /// @notice Total accumulated ETH per share of LP<>KNOT that has minted derivatives scaled to 'PRECISION'\n    uint256 public accumulatedETHPerLPShare;\n\n    /// @notice Total ETH claimed by all users of the contract\n    uint256 public totalClaimed;\n\n    /// @notice Last total rewards seen by the contract\n    uint256 public totalETHSeen;\n\n    /// @notice How much historical ETH had accrued to the LP tokens at time of minting derivatives of a BLS key\n    mapping(bytes => uint256) public accumulatedETHPerLPAtTimeOfMintingDerivatives;\n\n    /// @notice Total ETH claimed by a given address for a given token\n    mapping(address => mapping(address => uint256)) public claimed;\n\n    /// @dev Internal logic for previewing accumulated ETH for an LP user\n    function _previewAccumulatedETH(\n        address _sender,\n        address _token,\n        uint256 _balanceOfSender,\n        uint256 _numOfShares,\n        uint256 _unclaimedETHFromSyndicate\n    ) internal view returns (uint256) {\n        if (_balanceOfSender > 0) {\n            uint256 claim = _getTotalClaimedForUserAndToken(_sender, _token, _balanceOfSender);\n\n            uint256 received = totalRewardsReceived() + _unclaimedETHFromSyndicate;\n            uint256 unprocessed = received - totalETHSeen;\n\n            uint256 newAccumulatedETH = accumulatedETHPerLPShare + ((unprocessed * PRECISION) / _numOfShares);\n\n            return ((newAccumulatedETH * _balanceOfSender) / PRECISION) - claim;\n        }\n        return 0;\n    }\n\n    /// @dev Any due rewards from node running can be distributed to msg.sender if they have an LP balance\n    function _distributeETHRewardsToUserForToken(\n        address _user,\n        address _token,\n        uint256 _balance,\n        address _recipient\n    ) internal virtual returns (uint256) {\n        if (_recipient == address(0)) revert ZeroAddress();\n        uint256 balance = _balance;\n        uint256 due;\n        if (balance > 0) {\n            // Calculate how much ETH rewards the address is owed / due \n            due = ((accumulatedETHPerLPShare * balance) / PRECISION) - _getTotalClaimedForUserAndToken(_user, _token, balance);\n            if (due > 0) {\n                _increaseClaimedForUserAndToken(_user, _token, due, balance);\n\n                totalClaimed += due;\n\n                emit ETHDistributed(_user, _recipient, due);\n            }\n        }\n\n        return due;\n    }\n\n    /// @dev Overrideable logic for fetching the amount of tokens claimed by a user\n    function _getTotalClaimedForUserAndToken(\n        address _user,\n        address _token,\n        uint256         // Optional balance for use where needed\n    ) internal virtual view returns (uint256);\n\n    /// @dev Overrideable logic for updating the amount of tokens claimed by a user\n    function _increaseClaimedForUserAndToken(\n        address _user,\n        address _token,\n        uint256 _increase,\n        uint256             // Optional balance for use where needed\n    ) internal virtual;\n\n    /// @dev Internal logic for tracking accumulated ETH per share\n    function _updateAccumulatedETHPerLP(uint256 _numOfShares) internal {\n        if (_numOfShares > 0) {\n            uint256 received = totalRewardsReceived();\n            uint256 unprocessed = received - totalETHSeen;\n\n            if (unprocessed > 0) {\n                emit ETHReceived(unprocessed);\n\n                // accumulated ETH per minted share is scaled to avoid precision loss. it is scaled down later\n                accumulatedETHPerLPShare += (unprocessed * PRECISION) / _numOfShares;\n\n                totalETHSeen = received;\n            }\n        }\n    }\n\n    /// @notice Total rewards received by this contract from the syndicate\n    function totalRewardsReceived() public virtual view returns (uint256);\n\n    /// @notice Allow the contract to receive ETH\n    receive() external payable {}\n}"
      },
      "contracts/proxy/UpgradeableBeacon.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/// @title Beacon with upgradeable implementation\ncontract UpgradeableBeacon is IBeacon, Ownable {\n    using Address for address;\n\n    address private implementation_;\n\n    /// @notice Emitted when the implementation returned by the beacon is changed.\n    event Upgraded(address indexed implementation);\n\n    /// @param _implementation Address of the logic contract\n    constructor(address _implementation, address _owner) {\n        _setImplementation(_implementation);\n\n        transferOwnership(_owner);\n    }\n\n    /// @return current implementation address\n    function implementation() override external view returns (address) {\n        return implementation_;\n    }\n\n    /// @notice Allows an admin to change the implementation / logic address\n    /// @param _implementation Address of the new implementation\n    function updateImplementation(address _implementation) external onlyOwner {\n        _setImplementation(_implementation);\n    }\n\n    /// @dev internal method for setting the implementation making sure the supplied address is a contract\n    function _setImplementation(address _implementation) private {\n        require(_implementation != address(0), \"Invalid implementation\");\n        require(_implementation.isContract(), \"_setImplementation: Implementation address does not have a contract\");\n        implementation_ = _implementation;\n        emit Upgraded(implementation_);\n    }\n}\n\n// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/0db76e98f90550f1ebbb3dea71c7d12d5c533b5c/contracts/proxy/UpgradeableBeacon.sol\n"
      },
      "contracts/smart-wallet/interfaces/IOwnableSmartWallet.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\ninterface IOwnableSmartWalletEvents {\n    event TransferApprovalChanged(\n        address indexed from,\n        address indexed to,\n        bool status\n    );\n}\n\ninterface IOwnableSmartWallet is IOwnableSmartWalletEvents {\n    /// @dev Initialization function used instead of a constructor,\n    ///      since the intended creation method is cloning\n    function initialize(address initialOwner) external;\n\n    /// @dev Makes an arbitrary function call with value to a contract, with provided calldata\n    /// @param target Address of a contract to call\n    /// @param callData Data to pass with the call\n    /// @notice Payable. The passed value will be forwarded to the target.\n    function execute(address target, bytes memory callData)\n        external\n        payable\n        returns (bytes memory);\n\n    /// @dev Makes an arbitrary function call with value to a contract, with provided calldata and value\n    /// @param target Address of a contract to call\n    /// @param callData Data to pass with the call\n    /// @param value ETH value to pass to the target\n    /// @notice Payable. Allows the user to explicitly state the ETH value, in order to,\n    ///         e.g., pay with the contract's own balance.\n    function execute(\n        address target,\n        bytes memory callData,\n        uint256 value\n    ) external payable returns (bytes memory);\n\n    /// @notice Makes an arbitrary call to an address attaching value and optional calldata using raw .call{value}\n    /// @param target Address of the destination\n    /// @param callData Optional data to pass with the call\n    /// @param value Optional ETH value to pass to the target\n    function rawExecute(\n        address target,\n        bytes memory callData,\n        uint256 value\n    ) external payable returns (bytes memory);\n\n    /// @dev Transfers ownership from the current owner to another address\n    /// @param newOwner The address that will be the new owner\n    function transferOwnership(address newOwner) external;\n\n    /// @dev Changes authorization status for transfer approval from msg.sender to an address\n    /// @param to Address to change allowance status for\n    /// @param status The new approval status\n    function setApproval(address to, bool status) external;\n\n    /// @dev Returns whether the address 'to' can transfer a wallet from address 'from'\n    /// @param from The owner address\n    /// @param to The spender address\n    /// @notice The owner can always transfer the wallet to someone, i.e.,\n    ///         approval from an address to itself is always 'true'\n    function isTransferApproved(address from, address to)\n        external\n        view\n        returns (bool);\n\n    /// @dev Returns the current owner of the wallet\n    function owner() external view returns (address);\n}\n"
      },
      "contracts/smart-wallet/interfaces/IOwnableSmartWalletFactory.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\ninterface IOwnableSmartWalletFactoryEvents {\n    event WalletCreated(address indexed wallet, address indexed owner);\n}\n\ninterface IOwnableSmartWalletFactory is IOwnableSmartWalletFactoryEvents {\n    function createWallet() external returns (address wallet);\n\n    function createWallet(address owner) external returns (address wallet);\n\n    function walletExists(address wallet) external view returns (bool);\n}\n"
      },
      "contracts/smart-wallet/OwnableSmartWallet.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport {IOwnableSmartWallet} from \"./interfaces/IOwnableSmartWallet.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\n/// @title Ownable smart wallet\n/// @notice Ownable and transferrable smart wallet that allows the owner to\n///         interact with any contracts the same way as from an EOA. The\n///         main intended use is to make non-transferrable positions and assets\n///         liquid and usable in strategies.\n/// @notice Intended to be used with a factory and the cloning pattern.\ncontract OwnableSmartWallet is IOwnableSmartWallet, Ownable, Initializable {\n    using Address for address;\n\n    /// @dev A map from owner and spender to transfer approval. Determines whether\n    ///      the spender can transfer this wallet from the owner. Can be used\n    ///      to put this wallet in possession of a strategy (e.g., as collateral).\n    mapping(address => mapping(address => bool)) internal _isTransferApproved;\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() initializer {}\n\n    /// @inheritdoc IOwnableSmartWallet\n    function initialize(address initialOwner)\n        external\n        override\n        initializer // F: [OSW-1]\n    {\n        require(\n            initialOwner != address(0),\n            \"OwnableSmartWallet: Attempting to initialize with zero address owner\"\n        );\n        _transferOwnership(initialOwner); // F: [OSW-1]\n    }\n\n    /// @inheritdoc IOwnableSmartWallet\n    function execute(address target, bytes memory callData)\n        external\n        override\n        payable\n        onlyOwner // F: [OSW-6A]\n        returns (bytes memory)\n    {\n        return target.functionCallWithValue(callData, msg.value); // F: [OSW-6]\n    }\n\n    /// @inheritdoc IOwnableSmartWallet\n    function execute(\n        address target,\n        bytes memory callData,\n        uint256 value\n    )\n        external\n        override\n        payable\n        onlyOwner // F: [OSW-6A]\n        returns (bytes memory)\n    {\n        return target.functionCallWithValue(callData, value); // F: [OSW-6]\n    }\n\n    /// @inheritdoc IOwnableSmartWallet\n    function rawExecute(\n        address target,\n        bytes memory callData,\n        uint256 value\n    )\n    external\n    override\n    payable\n    onlyOwner\n    returns (bytes memory)\n    {\n        (bool result, bytes memory message) = target.call{value: value}(callData);\n        require(result, \"Failed to execute\");\n        return message;\n    }\n\n    /// @inheritdoc IOwnableSmartWallet\n    function owner()\n        public\n        view\n        override(IOwnableSmartWallet, Ownable)\n        returns (address)\n    {\n        return Ownable.owner(); // F: [OSW-1]\n    }\n\n    /// @inheritdoc IOwnableSmartWallet\n    function transferOwnership(address newOwner)\n        public\n        override(IOwnableSmartWallet, Ownable)\n    {\n        // Only the owner themselves or an address that is approved for transfers\n        // is authorized to do this\n        require(\n            isTransferApproved(owner(), msg.sender),\n            \"OwnableSmartWallet: Transfer is not allowed\"\n        ); // F: [OSW-4]\n\n        // Approval is revoked, in order to avoid unintended transfer allowance\n        // if this wallet ever returns to the previous owner\n        if (msg.sender != owner()) {\n            _setApproval(owner(), msg.sender, false); // F: [OSW-5]\n        }\n        _transferOwnership(newOwner); // F: [OSW-5]\n    }\n\n    /// @inheritdoc IOwnableSmartWallet\n    function setApproval(address to, bool status) external onlyOwner override {\n        require(\n            to != address(0),\n            \"OwnableSmartWallet: Approval cannot be set for zero address\"\n        ); // F: [OSW-2A]\n        _setApproval(msg.sender, to, status);\n    }\n\n    /// @dev IMPLEMENTATION: _setApproval\n    /// @param from The owner address\n    /// @param to The spender address\n    /// @param status Status of approval\n    function _setApproval(\n        address from,\n        address to,\n        bool status\n    ) internal {\n        bool statusChanged = _isTransferApproved[from][to] != status;\n        _isTransferApproved[from][to] = status; // F: [OSW-2]\n        if (statusChanged) {\n            emit TransferApprovalChanged(from, to, status); // F: [OSW-2]\n        }\n    }\n\n    /// @inheritdoc IOwnableSmartWallet\n    function isTransferApproved(address from, address to)\n        public\n        override\n        view\n        returns (bool)\n    {\n        return from == to ? true : _isTransferApproved[from][to]; // F: [OSW-2, 3]\n    }\n\n    receive() external payable {\n        // receive ETH\n    }\n}\n"
      },
      "contracts/smart-wallet/OwnableSmartWalletFactory.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\nimport {OwnableSmartWallet} from \"./OwnableSmartWallet.sol\";\nimport {IOwnableSmartWallet} from \"./interfaces/IOwnableSmartWallet.sol\";\nimport {IOwnableSmartWalletFactory} from \"./interfaces/IOwnableSmartWalletFactory.sol\";\n\n/// @title Ownable smart wallet factory\ncontract OwnableSmartWalletFactory is IOwnableSmartWalletFactory {\n\n    /// @dev Address of the contract to clone from\n    address public immutable masterWallet;\n\n    /// @dev Whether a wallet is created by this factory\n    /// @notice Can be used to verify that the address is actually\n    ///         OwnableSmartWallet and not an impersonating malicious\n    ///         account\n    mapping(address => bool) public walletExists;\n\n    constructor() {\n        masterWallet = address(new OwnableSmartWallet());\n\n        emit WalletCreated(masterWallet, address(this)); // F: [OSWF-2]\n    }\n\n    function createWallet() external returns (address wallet) {\n        wallet = _createWallet(msg.sender); // F: [OSWF-1]\n    }\n\n    function createWallet(address owner) external returns (address wallet) {\n        wallet = _createWallet(owner); // F: [OSWF-1]\n    }\n\n    function _createWallet(address owner) internal returns (address wallet) {\n        require(owner != address(0), 'Wallet cannot be address 0');\n\n        wallet = Clones.clone(masterWallet);\n        IOwnableSmartWallet(wallet).initialize(owner); // F: [OSWF-1]\n        walletExists[wallet] = true;\n\n        emit WalletCreated(wallet, owner); // F: [OSWF-1]\n    }\n}\n"
      },
      "contracts/syndicate/Syndicate.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: BUSL-1.1\n\nimport { Initializable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport { StakehouseAPI } from \"@blockswaplab/stakehouse-solidity-api/contracts/StakehouseAPI.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport { ReentrancyGuard } from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport { ISyndicateInit } from \"../interfaces/ISyndicateInit.sol\";\nimport { ETHTransferHelper } from \"../transfer/ETHTransferHelper.sol\";\nimport {\n    ZeroAddress,\n    EmptyArray,\n    InconsistentArrayLengths,\n    InvalidBLSPubKey,\n    InvalidNumberOfCollateralizedOwners,\n    KnotSlashed,\n    FreeFloatingStakeAmountTooSmall,\n    KnotIsNotRegisteredWithSyndicate,\n    NotPriorityStaker,\n    KnotIsFullyStakedWithFreeFloatingSlotTokens,\n    InvalidStakeAmount,\n    KnotIsNotAssociatedWithAStakeHouse,\n    UnableToStakeFreeFloatingSlot,\n    NothingStaked,\n    TransferFailed,\n    NotCollateralizedOwnerAtIndex,\n    InactiveKnot,\n    DuplicateArrayElements,\n    KnotIsAlreadyRegistered,\n    KnotHasAlreadyBeenDeRegistered,\n    NotKickedFromBeaconChain\n} from \"./SyndicateErrors.sol\";\n\ninterface IExtendedAccountManager {\n    function blsPublicKeyToLastState(bytes calldata _blsPublicKey) external view returns (\n        bytes memory, // BLS public key\n        bytes memory, // Withdrawal credentials\n        bool,  // Slashed\n        uint64,// Active balance\n        uint64,// Effective balance\n        uint64,// Exit epoch\n        uint64,// Activation epoch\n        uint64,// Withdrawal epoch\n        uint64 // Current checkpoint epoch\n    );\n}\n\n/// @notice Syndicate registry and funds splitter for EIP1559 execution layer transaction tips across SLOT shares\n/// @dev This contract can be extended to allow lending and borrowing of time slots for borrower to redeem any revenue generated within the specified window\ncontract Syndicate is ISyndicateInit, Initializable, Ownable, ReentrancyGuard, StakehouseAPI, ETHTransferHelper {\n\n    /// @notice Emitted when the contract is initially deployed\n    event ContractDeployed();\n\n    /// @notice Emitted when accrued ETH per SLOT share type is updated\n    event UpdateAccruedETH(uint256 unprocessed);\n\n    /// @notice Emitted when new collateralized SLOT owners for a knot prompts re-calibration\n    event CollateralizedSLOTReCalibrated(bytes BLSPubKey);\n\n    /// @notice Emitted when a new KNOT is associated with the syndicate contract\n    event KNOTRegistered(bytes BLSPubKey);\n\n    /// @notice Emitted when a KNOT is de-registered from the syndicate\n    event KnotDeRegistered(bytes BLSPubKey);\n\n    /// @notice Emitted when a priority staker is added to the syndicate\n    event PriorityStakerRegistered(address indexed staker);\n\n    /// @notice Emitted when a user stakes free floating sETH tokens\n    event Staked(bytes BLSPubKey, uint256 amount);\n\n    /// @notice Emitted when a user unstakes free floating sETH tokens\n    event UnStaked(bytes BLSPubKey, uint256 amount);\n\n    /// @notice Emitted when either an sETH staker or collateralized SLOT owner claims ETH\n    event ETHClaimed(bytes BLSPubKey, address indexed user, address recipient, uint256 claim, bool indexed isCollateralizedClaim);\n\n    /// @notice Emitted when the owner specifies a new activation distance\n    event ActivationDistanceUpdated();\n\n    /// @notice Precision used in rewards calculations for scaling up and down\n    uint256 public constant PRECISION = 1e24;\n\n    /// @notice Total accrued ETH per free floating share for new and old stakers\n    uint256 public accumulatedETHPerFreeFloatingShare;\n\n    /// @notice Total accrued ETH for all collateralized SLOT holders per knot which is then distributed based on individual balances\n    uint256 public accumulatedETHPerCollateralizedSlotPerKnot;\n\n    /// @notice Last cached highest seen balance for all collateralized shares\n    uint256 public lastSeenETHPerCollateralizedSlotPerKnot;\n\n    /// @notice Last cached highest seen balance for all free floating shares\n    uint256 public lastSeenETHPerFreeFloating;\n\n    /// @notice Total number of sETH token shares staked across all houses\n    uint256 public totalFreeFloatingShares;\n\n    /// @notice Total amount of ETH drawn down by syndicate beneficiaries regardless of SLOT type\n    uint256 public totalClaimed;\n\n    /// @notice Number of knots registered with the syndicate which can be across any house\n    uint256 public numberOfActiveKnots;\n\n    /// @notice Informational - is the knot registered to this syndicate or not - the node should point to this contract\n    mapping(bytes => bool) public isKnotRegistered;\n\n    /// @notice Block number after which if there are sETH staking slots available, it can be supplied by anyone on the market\n    uint256 public priorityStakingEndBlock;\n\n    /// @notice Syndicate deployer can highlight addresses that get priority for staking free floating house sETH up to a certain block before anyone can do it\n    mapping(address => bool) public isPriorityStaker;\n\n    /// @notice Total amount of free floating sETH staked\n    mapping(bytes => uint256) public sETHTotalStakeForKnot;\n\n    /// @notice Amount of sETH staked by user against a knot\n    mapping(bytes => mapping(address => uint256)) public sETHStakedBalanceForKnot;\n\n    /// @notice Amount of ETH claimed by user from sETH staking\n    mapping(bytes => mapping(address => uint256)) public sETHUserClaimForKnot;\n\n    /// @notice Total amount of ETH that has been allocated to the collateralized SLOT owners of a KNOT\n    mapping(bytes => uint256) public totalETHProcessedPerCollateralizedKnot;\n\n    /// @notice Total amount of ETH accrued for the collateralized SLOT owner of a KNOT\n    mapping(bytes => mapping(address => uint256)) public accruedEarningPerCollateralizedSlotOwnerOfKnot;\n\n    /// @notice Total amount of ETH claimed by the collateralized SLOT owner of a KNOT\n    mapping(bytes => mapping(address => uint256)) public claimedPerCollateralizedSlotOwnerOfKnot;\n\n    /// @notice Whether a BLS public key, that has been previously registered, is no longer part of the syndicate and its shares (free floating or SLOT) cannot earn any more rewards\n    mapping(bytes => bool) public isNoLongerPartOfSyndicate;\n\n    /// @notice Once a BLS public key is no longer part of the syndicate, the accumulated ETH per free floating SLOT share is snapshotted so historical earnings can be drawn down correctly\n    mapping(bytes => uint256) public lastAccumulatedETHPerFreeFloatingShare;\n\n    /// @notice Future activation block of a KNOT i.e. from what block they can start to accrue rewards. Enforced delay to protect against dilution\n    mapping(bytes => uint256) public activationBlock;\n\n    /// @notice List of proposers that required historical activation\n    bytes[] public proposersToActivate;\n\n    /// @notice Distance in blocks new proposers must wait before being able to receive Syndicate rewards\n    uint256 public activationDistance;\n\n    /// @notice Monotonically increasing pointer used to track which proposers have been activated\n    uint256 public activationPointer;\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() initializer {}\n\n    /// @param _contractOwner Ethereum public key that will receive management rights of the contract\n    /// @param _priorityStakingEndBlock Block number when priority sETH staking ends and anyone can stake\n    /// @param _priorityStakers Optional list of addresses that will have priority for staking sETH against each knot registered\n    /// @param _blsPubKeysForSyndicateKnots List of BLS public keys of Stakehouse protocol registered KNOTs participating in syndicate\n    function initialize(\n        address _contractOwner,\n        uint256 _priorityStakingEndBlock,\n        address[] memory _priorityStakers,\n        bytes[] memory _blsPubKeysForSyndicateKnots\n    ) external virtual override initializer {\n        _initialize(\n            _contractOwner,\n            _priorityStakingEndBlock,\n            _priorityStakers,\n            _blsPubKeysForSyndicateKnots\n        );\n    }\n\n    /// @notice Allows the contract owner to append to the list of knots that are part of the syndicate\n    /// @param _newBLSPublicKeyBeingRegistered List of BLS public keys being added to the syndicate\n    function registerKnotsToSyndicate(\n        bytes[] calldata _newBLSPublicKeyBeingRegistered\n    ) external onlyOwner {\n        // update accrued ETH per SLOT type\n        activateProposers();\n        _registerKnotsToSyndicate(_newBLSPublicKeyBeingRegistered);\n    }\n\n    /// @notice Make knot shares of a registered list of BLS public keys inactive - the action cannot be undone and no further ETH accrued\n    function deRegisterKnots(bytes[] calldata _blsPublicKeys) external onlyOwner {\n        _deRegisterKnots(_blsPublicKeys);\n    }\n\n    /// @notice Allow syndicate users to inform the contract that a beacon chain kicking has taken place -\n    /// @notice The associated SLOT shares should not continue to earn pro-rata shares\n    /// @param _blsPublicKeys List of BLS keys reported to the Stakehouse protocol\n    function informSyndicateKnotsAreKickedFromBeaconChain(bytes[] calldata _blsPublicKeys) external {\n        for (uint256 i; i < _blsPublicKeys.length; ++i) {\n            (,,bool slashed,,,,,,) = IExtendedAccountManager(address(getAccountManager())).blsPublicKeyToLastState(\n                _blsPublicKeys[i]\n            );\n\n            if (!slashed) revert NotKickedFromBeaconChain();\n        }\n\n        _deRegisterKnots(_blsPublicKeys);\n    }\n\n    /// @notice Allows the contract owner to append to the list of priority sETH stakers\n    /// @param _priorityStakers List of staker addresses eligible for sETH staking\n    function addPriorityStakers(address[] calldata _priorityStakers) external onlyOwner {\n        activateProposers();\n        _addPriorityStakers(_priorityStakers);\n    }\n\n    /// @notice Should this block be in the future, it means only those listed in the priority staker list can stake sETH\n    /// @param _endBlock Arbitrary block number after which anyone can stake up to 4 SLOT in sETH per KNOT\n    function updatePriorityStakingBlock(uint256 _endBlock) external onlyOwner {\n        activateProposers();\n        priorityStakingEndBlock = _endBlock;\n    }\n\n    /// @notice Allow syndicate owner to manage activation distance for new proposers\n    function updateActivationDistanceInBlocks(uint256 _distance) external onlyOwner {\n        activationDistance = _distance;\n        emit ActivationDistanceUpdated();\n    }\n\n    /// @notice Total number knots that registered with the syndicate\n    function numberOfRegisteredKnots() external view returns (uint256) {\n        return proposersToActivate.length;\n    }\n\n    /// @notice Total number of registered proposers that are yet to be activated\n    function totalProposersToActivate() external view returns (uint256) {\n        return proposersToActivate.length - activationPointer;\n    }\n\n    /// @notice Allow for a fixed number of proposers to be activated to start earning pro-rata ETH\n    function activateProposers() public {\n        // Snapshot historical earnings\n        if (numberOfActiveKnots > 0) {\n            updateAccruedETHPerShares();\n        }\n\n        // Retrieve number of proposers to activate capping total number that are activated\n        uint256 currentActivated = numberOfActiveKnots;\n        uint256 numToActivate = proposersToActivate.length - activationPointer;\n        numToActivate = numToActivate > 15 ? 15 : numToActivate;\n        while (numToActivate > 0) {\n            bytes memory blsPublicKey = proposersToActivate[activationPointer];\n\n            // The expectation is that everyone in the queue of proposers to activate have increasing activation block numbers\n            if (block.number < activationBlock[blsPublicKey]) {\n                break;\n            }\n\n            totalFreeFloatingShares += sETHTotalStakeForKnot[blsPublicKey];\n\n            // incoming knot collateralized SLOT holders do not get historical earnings\n            totalETHProcessedPerCollateralizedKnot[blsPublicKey] = accumulatedETHPerCollateralizedSlotPerKnot;\n\n            // incoming knot free floating SLOT holders do not get historical earnings\n            lastAccumulatedETHPerFreeFloatingShare[blsPublicKey] = accumulatedETHPerFreeFloatingShare;\n\n            numberOfActiveKnots += 1;\n            activationPointer += 1;\n            numToActivate -= 1;\n        }\n\n        if (currentActivated == 0) {\n            updateAccruedETHPerShares();\n        }\n    }\n\n    /// @notice Update accrued ETH per SLOT share without distributing ETH as users of the syndicate individually pull funds\n    function updateAccruedETHPerShares() public {\n        // Ensure there are registered KNOTs. Syndicates are deployed with at least 1 registered but this can fall to zero.\n        // Fee recipient should be re-assigned in the event that happens as any further ETH can be collected by owner\n        if (numberOfActiveKnots > 0) {\n            // All time, total ETH that was earned per slot type (free floating or collateralized)\n            uint256 totalEthPerSlotType = calculateETHForFreeFloatingOrCollateralizedHolders();\n\n            // Process free floating if there are staked shares\n            uint256 freeFloatingUnprocessed;\n            if (totalFreeFloatingShares > 0) {\n                freeFloatingUnprocessed = getUnprocessedETHForAllFreeFloatingSlot();\n                accumulatedETHPerFreeFloatingShare += _calculateNewAccumulatedETHPerFreeFloatingShare(freeFloatingUnprocessed, false);\n                lastSeenETHPerFreeFloating = totalEthPerSlotType;\n            }\n\n            uint256 collateralizedUnprocessed = ((totalEthPerSlotType - lastSeenETHPerCollateralizedSlotPerKnot) / numberOfActiveKnots);\n            accumulatedETHPerCollateralizedSlotPerKnot += collateralizedUnprocessed;\n            lastSeenETHPerCollateralizedSlotPerKnot = totalEthPerSlotType;\n\n            emit UpdateAccruedETH(freeFloatingUnprocessed + collateralizedUnprocessed);\n        }\n    }\n\n    /// @notice Stake up to 4 collateralized SLOT worth of sETH per KNOT to get a portion of syndicate rewards\n    /// @param _blsPubKeys List of BLS public keys for KNOTs registered with the syndicate\n    /// @param _sETHAmounts Per BLS public key, the total amount of sETH that will be staked (up to 4 collateralized SLOT per KNOT)\n    /// @param _onBehalfOf Allows a caller to specify an address that will be assigned stake ownership and rights to claim\n    function stake(bytes[] calldata _blsPubKeys, uint256[] calldata _sETHAmounts, address _onBehalfOf) external {\n        uint256 numOfKeys = _blsPubKeys.length;\n        if (numOfKeys == 0) revert EmptyArray();\n        if (numOfKeys != _sETHAmounts.length) revert InconsistentArrayLengths();\n        if (_onBehalfOf == address(0)) revert ZeroAddress();\n\n        // Make sure we have the latest accrued information\n        activateProposers();\n\n        for (uint256 i; i < numOfKeys; ++i) {\n            bytes memory _blsPubKey = _blsPubKeys[i];\n            uint256 _sETHAmount = _sETHAmounts[i];\n\n            if (_sETHAmount < 1 gwei) revert FreeFloatingStakeAmountTooSmall();\n            if (!isKnotRegistered[_blsPubKey]) revert KnotIsNotRegisteredWithSyndicate();\n            if (isNoLongerPartOfSyndicate[_blsPubKey]) revert KnotIsNotRegisteredWithSyndicate();\n\n            if (block.number < priorityStakingEndBlock && !isPriorityStaker[_onBehalfOf]) revert NotPriorityStaker();\n\n            uint256 totalStaked = sETHTotalStakeForKnot[_blsPubKey];\n            if (totalStaked == 12 ether) revert KnotIsFullyStakedWithFreeFloatingSlotTokens();\n\n            if (_sETHAmount + totalStaked > 12 ether) revert InvalidStakeAmount();\n\n            if (block.number > activationBlock[_blsPubKey]) {\n                // Pre activation block we cannot increase but post activation we need to instantly increase shares\n                totalFreeFloatingShares += _sETHAmount;\n            }\n\n            sETHTotalStakeForKnot[_blsPubKey] += _sETHAmount;\n            sETHStakedBalanceForKnot[_blsPubKey][_onBehalfOf] += _sETHAmount;\n            sETHUserClaimForKnot[_blsPubKey][_onBehalfOf] += (_sETHAmount * accumulatedETHPerFreeFloatingShare) / PRECISION;\n\n            (address stakeHouse,,,,,bool isActive) = getStakeHouseUniverse().stakeHouseKnotInfo(_blsPubKey);\n            if (stakeHouse == address(0)) revert KnotIsNotAssociatedWithAStakeHouse();\n            if (!isActive) revert InactiveKnot();\n\n            IERC20 sETH = IERC20(getSlotRegistry().stakeHouseShareTokens(stakeHouse));\n\n            bool transferResult = sETH.transferFrom(msg.sender, address(this), _sETHAmount);\n            if (!transferResult) revert UnableToStakeFreeFloatingSlot();\n\n            emit Staked(_blsPubKey, _sETHAmount);\n        }\n    }\n\n    /// @notice Unstake an sETH position against a particular KNOT and claim ETH on exit\n    /// @param _unclaimedETHRecipient The address that will receive any unclaimed ETH received to the syndicate\n    /// @param _sETHRecipient The address that will receive the sETH that is being unstaked\n    /// @param _blsPubKeys List of BLS public keys for KNOTs registered with the syndicate\n    /// @param _sETHAmounts Per BLS public key, the total amount of sETH that will be unstaked\n    function unstake(\n        address _unclaimedETHRecipient,\n        address _sETHRecipient,\n        bytes[] calldata _blsPubKeys,\n        uint256[] calldata _sETHAmounts\n    ) external nonReentrant {\n        uint256 numOfKeys = _blsPubKeys.length;\n        if (numOfKeys == 0) revert EmptyArray();\n        if (numOfKeys != _sETHAmounts.length) revert InconsistentArrayLengths();\n        if (_unclaimedETHRecipient == address(0)) revert ZeroAddress();\n        if (_sETHRecipient == address(0)) revert ZeroAddress();\n\n        // Claim all ETH owed before unstaking but even if nothing is owed `updateAccruedETHPerShares` will be called\n        _claimAsStaker(_unclaimedETHRecipient, _blsPubKeys);\n\n        for (uint256 i; i < numOfKeys; ++i) {\n            bytes memory _blsPubKey = _blsPubKeys[i];\n            uint256 _sETHAmount = _sETHAmounts[i];\n            if (sETHStakedBalanceForKnot[_blsPubKey][msg.sender] < _sETHAmount) revert NothingStaked();\n            if (block.number < activationBlock[_blsPubKey]) revert InactiveKnot();\n\n            (address stakeHouse,,,,,bool isActive) = getStakeHouseUniverse().stakeHouseKnotInfo(_blsPubKey);\n            IERC20 sETH = IERC20(getSlotRegistry().stakeHouseShareTokens(stakeHouse));\n\n            // Only decrease totalFreeFloatingShares in the event that the knot is still active in the syndicate\n            if (!isNoLongerPartOfSyndicate[_blsPubKey]) {\n                totalFreeFloatingShares -= _sETHAmount;\n            }\n\n            sETHTotalStakeForKnot[_blsPubKey] -= _sETHAmount;\n            sETHStakedBalanceForKnot[_blsPubKey][msg.sender] -= _sETHAmount;\n\n            uint256 accumulatedETHPerShare = _getCorrectAccumulatedETHPerFreeFloatingShareForBLSPublicKey(_blsPubKey);\n            sETHUserClaimForKnot[_blsPubKey][msg.sender] =\n                (accumulatedETHPerShare * sETHStakedBalanceForKnot[_blsPubKey][msg.sender]) / PRECISION;\n\n            // If the stakehouse lets the syndicate know the knot is no longer active, kick knot from syndicate to prevent more rewards being earned\n            if (!isNoLongerPartOfSyndicate[_blsPubKey] && !isActive) {\n                _deRegisterKnot(_blsPubKey);\n            }\n\n            bool transferResult = sETH.transfer(_sETHRecipient, _sETHAmount);\n            if (!transferResult) revert TransferFailed();\n\n            emit UnStaked(_blsPubKey, _sETHAmount);\n        }\n    }\n\n    /// @notice Claim ETH cashflow from the syndicate as an sETH staker proportional to how much the user has staked\n    /// @param _recipient Address that will receive the share of ETH funds\n    /// @param _blsPubKeys List of BLS public keys that the caller has staked against\n    function claimAsStaker(address _recipient, bytes[] calldata _blsPubKeys) public nonReentrant {\n        _claimAsStaker(_recipient, _blsPubKeys);\n    }\n\n    /// @param _blsPubKeys List of BLS public keys that the caller has staked against\n    function claimAsCollateralizedSLOTOwner(\n        address _recipient,\n        bytes[] calldata _blsPubKeys\n    ) external nonReentrant {\n        uint256 numOfKeys = _blsPubKeys.length;\n        if (numOfKeys == 0) revert EmptyArray();\n        if (_recipient == address(0)) revert ZeroAddress();\n        if (_recipient == address(this)) revert ZeroAddress();\n\n        // Make sure we have the latest accrued information for all shares\n        activateProposers();\n\n        uint256 totalToTransfer;\n        for (uint256 i; i < numOfKeys; ++i) {\n            bytes memory _blsPubKey = _blsPubKeys[i];\n            if (!isKnotRegistered[_blsPubKey]) revert KnotIsNotRegisteredWithSyndicate();\n            if (block.number < activationBlock[_blsPubKey]) revert InactiveKnot();\n\n            // process newly accrued ETH and distribute it to collateralized SLOT owners for the given knot\n            _updateCollateralizedSlotOwnersLiabilitySnapshot(_blsPubKey);\n\n            // Calculate total amount of unclaimed ETH\n            uint256 userShare = accruedEarningPerCollateralizedSlotOwnerOfKnot[_blsPubKey][msg.sender];\n\n            // This is designed to cope with falling SLOT balances i.e. when collateralized SLOT is burnt after applying penalties\n            uint256 unclaimedUserShare = userShare - claimedPerCollateralizedSlotOwnerOfKnot[_blsPubKey][msg.sender];\n\n            // Send ETH to the user if there is an unclaimed amount\n            if (unclaimedUserShare > 0) {\n                // Increase total claimed and claimed at the user level\n                totalClaimed += unclaimedUserShare;\n                claimedPerCollateralizedSlotOwnerOfKnot[_blsPubKey][msg.sender] = userShare;\n\n                // Send ETH to user\n                totalToTransfer += unclaimedUserShare;\n\n                emit ETHClaimed(\n                    _blsPubKey,\n                    msg.sender,\n                    _recipient,\n                    unclaimedUserShare,\n                    true\n                );\n            }\n        }\n\n        _transferETH(_recipient, totalToTransfer);\n    }\n\n    /// @notice For any new ETH received by the syndicate, at the knot level allocate ETH owed to each collateralized owner\n    /// @param _blsPubKey BLS public key relating to the collateralized owners that need updating\n    function updateCollateralizedSlotOwnersAccruedETH(bytes memory _blsPubKey) external {\n        activateProposers();\n        _updateCollateralizedSlotOwnersLiabilitySnapshot(_blsPubKey);\n    }\n\n    /// @notice For any new ETH received by the syndicate, at the knot level allocate ETH owed to each collateralized owner and do it for a batch of knots\n    /// @param _blsPubKeys List of BLS public keys related to the collateralized owners that need updating\n    function batchUpdateCollateralizedSlotOwnersAccruedETH(bytes[] memory _blsPubKeys) external {\n        uint256 numOfKeys = _blsPubKeys.length;\n        if (numOfKeys == 0) revert EmptyArray();\n        activateProposers();\n        for (uint256 i; i < numOfKeys; ++i) {\n            _updateCollateralizedSlotOwnersLiabilitySnapshot(_blsPubKeys[i]);\n        }\n    }\n\n    /// @notice Syndicate contract can receive ETH\n    receive() external payable {\n        // No logic here because one cannot assume that more than 21K GAS limit is forwarded\n    }\n\n    /// @notice Calculate the amount of unclaimed ETH for a given BLS publice key + free floating SLOT staker without factoring in unprocessed rewards\n    /// @param _blsPubKey BLS public key of the KNOT that is registered with the syndicate\n    /// @param _user The address of a user that has staked sETH against the BLS public key\n    function calculateUnclaimedFreeFloatingETHShare(bytes memory _blsPubKey, address _user) public view returns (uint256) {\n        // Check the user has staked sETH for the KNOT\n        uint256 stakedBal = sETHStakedBalanceForKnot[_blsPubKey][_user];\n\n        // Get the amount of ETH eligible for the user based on their staking amount\n        uint256 accumulatedETHPerShare = _getCorrectAccumulatedETHPerFreeFloatingShareForBLSPublicKey(_blsPubKey);\n        uint256 userShare = (accumulatedETHPerShare * stakedBal) / PRECISION;\n\n        // When the user is claiming ETH from the syndicate for the first time, we need to adjust for the activation\n        // This will ensure that rewards accrued before activation are not considered\n        uint256 adjustedClaimForActivation;\n        if (!isNoLongerPartOfSyndicate[_blsPubKey] && sETHUserClaimForKnot[_blsPubKey][_user] == 0) {\n            adjustedClaimForActivation = (lastAccumulatedETHPerFreeFloatingShare[_blsPubKey] * stakedBal) / PRECISION;\n        }\n\n        // Calculate how much their unclaimed share of ETH is based on total ETH claimed so far\n        return userShare - sETHUserClaimForKnot[_blsPubKey][_user] - adjustedClaimForActivation;\n    }\n\n    /// @notice Using `highestSeenBalance`, this is the amount that is separately allocated to either free floating or collateralized SLOT holders\n    function calculateETHForFreeFloatingOrCollateralizedHolders() public view returns (uint256) {\n        // Get total amount of ETH that can be drawn down by all SLOT holders associated with a knot\n        uint256 ethPerKnot = totalETHReceived();\n\n        // Get the amount of ETH eligible for free floating sETH or collateralized SLOT stakers\n        return ethPerKnot / 2;\n    }\n\n    /// @notice Preview how many proposers can be activated either manually or when the accrued ETH per shares are updated\n    function previewActivateableProposers() public view returns (uint256) {\n        uint256 index = activationPointer;\n        uint256 numToActivate = proposersToActivate.length - index;\n        numToActivate = numToActivate > 15 ? 15 : numToActivate;\n        uint256 numOfActivateable;\n        while(numToActivate > 0) {\n            bytes memory blsPublicKey = proposersToActivate[index];\n\n            if (block.number < activationBlock[blsPublicKey]) {\n                break;\n            } else {\n                numOfActivateable += 1;\n            }\n\n            index += 1;\n            numToActivate -= 1;\n        }\n\n        return numOfActivateable;\n    }\n\n    /// @notice Total free floating shares that can be activated in the next block\n    function previewTotalFreeFloatingSharesToActivate() public view returns (uint256) {\n        uint256 index = activationPointer;\n        uint256 numToActivate = proposersToActivate.length - index;\n        numToActivate = numToActivate > 15 ? 15 : numToActivate;\n        uint256 totalSharesToActivate;\n        while(numToActivate > 0) {\n            bytes memory blsPublicKey = proposersToActivate[index];\n\n            if (block.number < activationBlock[blsPublicKey]) {\n                break;\n            } else {\n                totalSharesToActivate += sETHTotalStakeForKnot[blsPublicKey];\n            }\n\n            index += 1;\n            numToActivate -= 1;\n        }\n\n        return totalSharesToActivate;\n    }\n\n    /// @notice Calculate the total unclaimed ETH across an array of BLS public keys for a free floating staker\n    function batchPreviewUnclaimedETHAsFreeFloatingStaker(\n        address _staker,\n        bytes[] calldata _blsPubKeys\n    ) external view returns (uint256) {\n        uint256 accumulated;\n        uint256 numOfKeys = _blsPubKeys.length;\n        for (uint256 i; i < numOfKeys; ++i) {\n            accumulated += previewUnclaimedETHAsFreeFloatingStaker(_staker, _blsPubKeys[i]);\n        }\n\n        return accumulated;\n    }\n\n    /// @notice Preview the amount of unclaimed ETH available for an sETH staker against a KNOT which factors in unprocessed rewards from new ETH sent to contract\n    /// @param _blsPubKey BLS public key of the KNOT that is registered with the syndicate\n    /// @param _staker The address of a user that has staked sETH against the BLS public key\n    function previewUnclaimedETHAsFreeFloatingStaker(\n        address _staker,\n        bytes calldata _blsPubKey\n    ) public view returns (uint256) {\n        uint256 currentAccumulatedETHPerFreeFloatingShare = accumulatedETHPerFreeFloatingShare;\n        uint256 updatedAccumulatedETHPerFreeFloatingShare =\n                            currentAccumulatedETHPerFreeFloatingShare + calculateNewAccumulatedETHPerFreeFloatingShare();\n\n        uint256 stakedBal = sETHStakedBalanceForKnot[_blsPubKey][_staker];\n        uint256 userShare = (updatedAccumulatedETHPerFreeFloatingShare * stakedBal) / PRECISION;\n\n        return userShare - sETHUserClaimForKnot[_blsPubKey][_staker];\n    }\n\n    /// @notice Calculate the total unclaimed ETH across an array of BLS public keys for a collateralized SLOT staker\n    function batchPreviewUnclaimedETHAsCollateralizedSlotOwner(\n        address _staker,\n        bytes[] calldata _blsPubKeys\n    ) external view returns (uint256) {\n        uint256 accumulated;\n        uint256 numOfKeys = _blsPubKeys.length;\n        for (uint256 i; i < numOfKeys; ++i) {\n            accumulated += previewUnclaimedETHAsCollateralizedSlotOwner(_staker, _blsPubKeys[i]);\n        }\n\n        return accumulated;\n    }\n\n    /// @notice Preview the amount of unclaimed ETH available for a collatearlized SLOT staker against a KNOT which factors in unprocessed rewards from new ETH sent to contract\n    /// @param _staker Address of a collateralized SLOT owner for a KNOT\n    /// @param _blsPubKey BLS public key of the KNOT that is registered with the syndicate\n    function previewUnclaimedETHAsCollateralizedSlotOwner(\n        address _staker,\n        bytes calldata _blsPubKey\n    ) public view returns (uint256) {\n        if (numberOfActiveKnots + previewActivateableProposers() == 0) return 0;\n\n        // Per collateralized SLOT per KNOT before distributing to individual collateralized owners\n        uint256 accumulatedSoFar = accumulatedETHPerCollateralizedSlotPerKnot\n                    + ((calculateETHForFreeFloatingOrCollateralizedHolders() - lastSeenETHPerCollateralizedSlotPerKnot) / (numberOfActiveKnots + previewActivateableProposers()));\n\n        uint256 unprocessedForKnot = accumulatedSoFar - totalETHProcessedPerCollateralizedKnot[_blsPubKey];\n\n        // Fetch information on what has been processed so far against the ECDSA address of the collateralized SLOT owner\n        uint256 currentAccrued = accruedEarningPerCollateralizedSlotOwnerOfKnot[_blsPubKey][_staker];\n\n        // Fetch information about the knot including total slashed amount\n        uint256 currentSlashedAmount = getSlotRegistry().currentSlashedAmountOfSLOTForKnot(_blsPubKey);\n        uint256 numberOfCollateralisedSlotOwnersForKnot = getSlotRegistry().numberOfCollateralisedSlotOwnersForKnot(_blsPubKey);\n        (address stakeHouse,,,,,) = getStakeHouseUniverse().stakeHouseKnotInfo(_blsPubKey);\n\n        // Find the collateralized SLOT owner and work out how much they're owed\n        for (uint256 i; i < numberOfCollateralisedSlotOwnersForKnot; ++i) {\n            address collateralizedOwnerAtIndex = getSlotRegistry().getCollateralisedOwnerAtIndex(_blsPubKey, i);\n            if (collateralizedOwnerAtIndex == _staker) {\n                uint256 balance = getSlotRegistry().totalUserCollateralisedSLOTBalanceForKnot(\n                    stakeHouse,\n                    collateralizedOwnerAtIndex,\n                    _blsPubKey\n                );\n\n                if (currentSlashedAmount < 4 ether) {\n                    currentAccrued +=\n                    numberOfCollateralisedSlotOwnersForKnot > 1 ? balance * unprocessedForKnot / (4 ether - currentSlashedAmount)\n                    : unprocessedForKnot;\n                }\n                break;\n            }\n        }\n\n        return currentAccrued - claimedPerCollateralizedSlotOwnerOfKnot[_blsPubKey][_staker];\n    }\n\n    /// @notice Amount of ETH per free floating share that hasn't yet been allocated to each share\n    function getUnprocessedETHForAllFreeFloatingSlot() public view returns (uint256) {\n        return calculateETHForFreeFloatingOrCollateralizedHolders() - lastSeenETHPerFreeFloating;\n    }\n\n    /// @notice Amount of ETH per collateralized share that hasn't yet been allocated to each share\n    function getUnprocessedETHForAllCollateralizedSlot() public view returns (uint256) {\n        if (numberOfActiveKnots == 0) return 0;\n        return ((calculateETHForFreeFloatingOrCollateralizedHolders() - lastSeenETHPerCollateralizedSlotPerKnot) / numberOfActiveKnots);\n    }\n\n    /// @notice New accumulated ETH per free floating share that hasn't yet been applied\n    /// @dev The return value is scaled by 1e24\n    function calculateNewAccumulatedETHPerFreeFloatingShare() public view returns (uint256) {\n        uint256 ethSinceLastUpdate = getUnprocessedETHForAllFreeFloatingSlot();\n        return _calculateNewAccumulatedETHPerFreeFloatingShare(ethSinceLastUpdate, true);\n    }\n\n    /// @notice New accumulated ETH per collateralized share per knot that hasn't yet been applied\n    function calculateNewAccumulatedETHPerCollateralizedSharePerKnot() public view returns (uint256) {\n        uint256 ethSinceLastUpdate = getUnprocessedETHForAllCollateralizedSlot();\n        return accumulatedETHPerCollateralizedSlotPerKnot + ethSinceLastUpdate;\n    }\n\n    /// @notice Total amount of ETH received by the contract\n    function totalETHReceived() public view returns (uint256) {\n        return address(this).balance + totalClaimed;\n    }\n\n    /// @dev Internal logic for initializing the syndicate contract\n    function _initialize(\n        address _contractOwner,\n        uint256 _priorityStakingEndBlock,\n        address[] memory _priorityStakers,\n        bytes[] memory _blsPubKeysForSyndicateKnots\n    ) internal {\n        // Transfer ownership from the deployer to the address specified as the owner\n        _transferOwnership(_contractOwner);\n\n        // Add the initial set of knots to the syndicate\n        _registerKnotsToSyndicate(_blsPubKeysForSyndicateKnots);\n\n        // Optionally process priority staking if the required params and array is configured\n        if (_priorityStakingEndBlock > block.number) {\n            priorityStakingEndBlock = _priorityStakingEndBlock;\n            _addPriorityStakers(_priorityStakers);\n        }\n\n        emit ContractDeployed();\n    }\n\n    /// Given an amount of ETH allocated to the collateralized SLOT owners of a KNOT, distribute this amongs the current set of collateralized owners (a dynamic set of addresses and balances)\n    function _updateCollateralizedSlotOwnersLiabilitySnapshot(bytes memory _blsPubKey) internal {\n        // Establish how much new ETH is for the new KNOT\n        uint256 unprocessedETHForCurrentKnot =\n                    accumulatedETHPerCollateralizedSlotPerKnot - totalETHProcessedPerCollateralizedKnot[_blsPubKey];\n\n        // Get information about the knot i.e. associated house and whether its active\n        (address stakeHouse,,,,,bool isActive) = getStakeHouseUniverse().stakeHouseKnotInfo(_blsPubKey);\n\n        // Assuming that there is unprocessed ETH and the knot is still part of the syndicate\n        if (unprocessedETHForCurrentKnot > 0) {\n            uint256 currentSlashedAmount = getSlotRegistry().currentSlashedAmountOfSLOTForKnot(_blsPubKey);\n\n            // Don't allocate ETH when the current slashed amount is four. Syndicate will wait until ETH is topped up to claim revenue\n            if (currentSlashedAmount < 4 ether) {\n                // This copes with increasing numbers of collateralized slot owners and also copes with SLOT that has been slashed but not topped up\n                uint256 numberOfCollateralisedSlotOwnersForKnot = getSlotRegistry().numberOfCollateralisedSlotOwnersForKnot(_blsPubKey);\n\n                if (numberOfCollateralisedSlotOwnersForKnot == 1) {\n                    // For only 1 collateralized SLOT owner, they get the full amount of unprocessed ETH for the knot\n                    address collateralizedOwnerAtIndex = getSlotRegistry().getCollateralisedOwnerAtIndex(_blsPubKey, 0);\n                    accruedEarningPerCollateralizedSlotOwnerOfKnot[_blsPubKey][collateralizedOwnerAtIndex] += unprocessedETHForCurrentKnot;\n                } else {\n                    for (uint256 i; i < numberOfCollateralisedSlotOwnersForKnot; ++i) {\n                        address collateralizedOwnerAtIndex = getSlotRegistry().getCollateralisedOwnerAtIndex(_blsPubKey, i);\n                        uint256 balance = getSlotRegistry().totalUserCollateralisedSLOTBalanceForKnot(\n                            stakeHouse,\n                            collateralizedOwnerAtIndex,\n                            _blsPubKey\n                        );\n\n                        accruedEarningPerCollateralizedSlotOwnerOfKnot[_blsPubKey][collateralizedOwnerAtIndex] +=\n                            balance * unprocessedETHForCurrentKnot / (4 ether - currentSlashedAmount);\n                    }\n                }\n\n                // record so unprocessed goes to zero\n                totalETHProcessedPerCollateralizedKnot[_blsPubKey] = accumulatedETHPerCollateralizedSlotPerKnot;\n            }\n        }\n\n        // if the knot is no longer active, no further accrual of rewards are possible snapshots are possible but ETH accrued up to that point\n        // Basically, under a rage quit or voluntary withdrawal from the beacon chain, the knot kick is auto-propagated to syndicate\n        if (!isActive && !isNoLongerPartOfSyndicate[_blsPubKey]) {\n            _deRegisterKnot(_blsPubKey);\n        }\n    }\n\n    /// @dev Business logic for calculating per free floating share how much ETH from 1559 rewards is owed\n    function _calculateNewAccumulatedETHPerFreeFloatingShare(uint256 _ethSinceLastUpdate, bool _previewFreeFloatingSharesToActivate) internal view returns (uint256) {\n        uint256 sharesToActivate = _previewFreeFloatingSharesToActivate ? previewTotalFreeFloatingSharesToActivate() : 0;\n        return (totalFreeFloatingShares + sharesToActivate) > 0 ? (_ethSinceLastUpdate * PRECISION) / (totalFreeFloatingShares + sharesToActivate) : 0;\n    }\n\n    /// @dev Business logic for adding a new set of knots to the syndicate for collecting revenue\n    function _registerKnotsToSyndicate(bytes[] memory _blsPubKeysForSyndicateKnots) internal {\n        uint256 knotsToRegister = _blsPubKeysForSyndicateKnots.length;\n        if (knotsToRegister == 0) revert EmptyArray();\n\n        for (uint256 i; i < knotsToRegister; ++i) {\n            bytes memory blsPubKey = _blsPubKeysForSyndicateKnots[i];\n\n            if (isKnotRegistered[blsPubKey]) revert KnotIsAlreadyRegistered();\n\n            // Health check - if knot is inactive or slashed, should it really be part of the syndicate?\n            // KNOTs closer to 32 effective at all times is the target\n            (address stakeHouse,,,,,bool isActive) = getStakeHouseUniverse().stakeHouseKnotInfo(blsPubKey);\n            if (!isActive) revert InactiveKnot();\n\n            if (proposersToActivate.length > 0) {\n                (address houseAddressForSyndicate,,,,,) = getStakeHouseUniverse().stakeHouseKnotInfo(proposersToActivate[0]);\n                if (houseAddressForSyndicate != stakeHouse) revert KnotIsNotAssociatedWithAStakeHouse();\n            }\n\n            uint256 numberOfCollateralisedSlotOwnersForKnot = getSlotRegistry().numberOfCollateralisedSlotOwnersForKnot(blsPubKey);\n            if (numberOfCollateralisedSlotOwnersForKnot < 1) revert InvalidNumberOfCollateralizedOwners();\n            if (getSlotRegistry().currentSlashedAmountOfSLOTForKnot(blsPubKey) != 0) revert InvalidNumberOfCollateralizedOwners();\n\n            isKnotRegistered[blsPubKey] = true;\n            activationBlock[blsPubKey] = _computeNextActivationBlock();\n            proposersToActivate.push(blsPubKey);\n            emit KNOTRegistered(blsPubKey);\n        }\n    }\n\n    /// @dev Business logic for adding priority stakers to the syndicate\n    function _addPriorityStakers(address[] memory _priorityStakers) internal {\n        uint256 numOfStakers = _priorityStakers.length;\n        if (numOfStakers == 0) revert EmptyArray();\n        for (uint256 i; i < numOfStakers; ++i) {\n            address staker = _priorityStakers[i];\n\n            if (isPriorityStaker[staker]) revert DuplicateArrayElements();\n\n            isPriorityStaker[staker] = true;\n\n            emit PriorityStakerRegistered(staker);\n        }\n    }\n\n    /// @dev Business logic for de-registering a set of knots from the syndicate and doing the required snapshots to ensure historical earnings are preserved\n    function _deRegisterKnots(bytes[] calldata _blsPublicKeys) internal {\n        uint256 numOfKeys = _blsPublicKeys.length;\n        if (numOfKeys == 0) revert EmptyArray();\n        for (uint256 i; i < numOfKeys; ++i) {\n            bytes memory blsPublicKey = _blsPublicKeys[i];\n\n            // Execute the business logic for de-registering the single knot\n            _deRegisterKnot(blsPublicKey);\n        }\n    }\n\n    /// @dev Business logic for de-registering a specific knots assuming all accrued ETH has been processed\n    function _deRegisterKnot(bytes memory _blsPublicKey) internal {\n        if (!isKnotRegistered[_blsPublicKey]) revert KnotIsNotRegisteredWithSyndicate();\n        if (isNoLongerPartOfSyndicate[_blsPublicKey]) revert KnotHasAlreadyBeenDeRegistered();\n\n        // Update global system params before doing de-registration\n        activateProposers();\n\n        // We flag that the knot is no longer part of the syndicate\n        isNoLongerPartOfSyndicate[_blsPublicKey] = true;\n\n        // Do one final snapshot of ETH owed to the collateralized SLOT owners so they can claim later\n        _updateCollateralizedSlotOwnersLiabilitySnapshot(_blsPublicKey);\n\n        // For the free floating and collateralized SLOT of the knot, snapshot the accumulated ETH per share\n        lastAccumulatedETHPerFreeFloatingShare[_blsPublicKey] = accumulatedETHPerFreeFloatingShare;\n\n        // We need to reduce `totalFreeFloatingShares` in order to avoid further ETH accruing to shares of de-registered knot\n        totalFreeFloatingShares -= sETHTotalStakeForKnot[_blsPublicKey];\n\n        // Total number of registered knots with the syndicate reduces by one\n        numberOfActiveKnots -= 1;\n\n        emit KnotDeRegistered(_blsPublicKey);\n    }\n\n    /// @dev Work out the accumulated ETH per free floating share value that must be used for distributing ETH\n    function _getCorrectAccumulatedETHPerFreeFloatingShareForBLSPublicKey(\n        bytes memory _blsPublicKey\n    ) internal view returns (uint256) {\n        if (isNoLongerPartOfSyndicate[_blsPublicKey]) {\n            return lastAccumulatedETHPerFreeFloatingShare[_blsPublicKey];\n        }\n\n        return accumulatedETHPerFreeFloatingShare;\n    }\n\n    /// @dev Business logic for allowing a free floating SLOT holder to claim their share of ETH\n    function _claimAsStaker(address _recipient, bytes[] calldata _blsPubKeys) internal {\n        uint256 numOfKeys = _blsPubKeys.length;\n        if (numOfKeys == 0) revert EmptyArray();\n        if (_recipient == address(0)) revert ZeroAddress();\n        if (_recipient == address(this)) revert ZeroAddress();\n\n        // Make sure we have the latest accrued information\n        activateProposers();\n\n        uint256 totalToTransfer;\n        for (uint256 i; i < numOfKeys; ++i) {\n            bytes memory _blsPubKey = _blsPubKeys[i];\n            if (!isKnotRegistered[_blsPubKey]) revert KnotIsNotRegisteredWithSyndicate();\n            if (block.number < activationBlock[_blsPubKey]) revert InactiveKnot();\n\n            uint256 unclaimedUserShare = calculateUnclaimedFreeFloatingETHShare(_blsPubKey, msg.sender);\n\n            // this means that user can call the funtion even if there is nothing to claim but the\n            // worst that will happen is that they will just waste gas. this is needed for unstaking\n            if (unclaimedUserShare > 0) {\n                // Increase total claimed at the contract level\n                totalClaimed += unclaimedUserShare;\n\n                // Work out which accumulated ETH per free floating share value was used\n                uint256 accumulatedETHPerShare = _getCorrectAccumulatedETHPerFreeFloatingShareForBLSPublicKey(_blsPubKey);\n\n                // Update the total ETH claimed by the free floating SLOT holder based on their share of sETH\n                sETHUserClaimForKnot[_blsPubKey][msg.sender] =\n                (accumulatedETHPerShare * sETHStakedBalanceForKnot[_blsPubKey][msg.sender]) / PRECISION;\n\n                // Calculate how much ETH to send to the user\n                totalToTransfer += unclaimedUserShare;\n\n                emit ETHClaimed(\n                    _blsPubKey,\n                    msg.sender,\n                    _recipient,\n                    unclaimedUserShare,\n                    false\n                );\n            }\n        }\n\n        _transferETH(_recipient, totalToTransfer);\n    }\n\n    function _computeNextActivationBlock() internal view returns (uint256) {\n        // As per ethereum spec, this is SLOT + 1 + 4 Epochs (4 * 32 = 128) - it is an approximation\n        uint256 activationDistance = activationDistance > 0 ? activationDistance : 1 + 128;\n        return block.number + activationDistance;\n    }\n}"
      },
      "contracts/syndicate/SyndicateErrors.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nerror ZeroAddress();\nerror EmptyArray();\nerror InconsistentArrayLengths();\nerror InvalidBLSPubKey();\nerror InvalidNumberOfCollateralizedOwners();\nerror KnotSlashed();\nerror FreeFloatingStakeAmountTooSmall();\nerror KnotIsNotRegisteredWithSyndicate();\nerror NotPriorityStaker();\nerror KnotIsFullyStakedWithFreeFloatingSlotTokens();\nerror InvalidStakeAmount();\nerror KnotIsNotAssociatedWithAStakeHouse();\nerror UnableToStakeFreeFloatingSlot();\nerror NothingStaked();\nerror TransferFailed();\nerror NotCollateralizedOwnerAtIndex();\nerror InactiveKnot();\nerror DuplicateArrayElements();\nerror KnotIsAlreadyRegistered();\nerror KnotHasAlreadyBeenDeRegistered();\nerror NotKickedFromBeaconChain();"
      },
      "contracts/syndicate/SyndicateFactory.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { Initializable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport { BeaconProxy } from \"@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol\";\nimport { ISyndicateFactory } from \"../interfaces/ISyndicateFactory.sol\";\nimport { ISyndicateInit } from \"../interfaces/ISyndicateInit.sol\";\nimport { UpgradeableBeacon } from \"../proxy/UpgradeableBeacon.sol\";\n\n/// @notice Contract for deploying a new KNOT syndicate\ncontract SyndicateFactory is ISyndicateFactory, Initializable {\n\n    /// @notice Address of syndicate implementation that is cloned on each syndicate deployment\n    address public syndicateImplementation;\n\n    address public beacon;\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() initializer {}\n\n    /// @param _syndicateImpl Address of syndicate implementation that is cloned on each syndicate deployment\n    function init(address _syndicateImpl, address _upgradeManager) external initializer {\n        _init(_syndicateImpl, _upgradeManager);\n    }\n\n    function _init(address _syndicateImpl, address _upgradeManager) internal {\n        syndicateImplementation = _syndicateImpl;\n        beacon = address(new UpgradeableBeacon(syndicateImplementation, _upgradeManager));\n    }\n\n    /// @inheritdoc ISyndicateFactory\n    function deploySyndicate(\n        address _contractOwner,\n        uint256 _priorityStakingEndBlock,\n        address[] calldata _priorityStakers,\n        bytes[] calldata _blsPubKeysForSyndicateKnots\n    ) public override returns (address) {\n        // Use CREATE2 to deploy the new instance of the syndicate\n        bytes32 salt = calculateDeploymentSalt(msg.sender, _contractOwner, _blsPubKeysForSyndicateKnots.length);\n        address newInstance = address(new BeaconProxy{salt: salt}(beacon, bytes(\"\")));\n\n        // Initialize the new syndicate instance with the params from the deployer\n        ISyndicateInit(newInstance).initialize(\n            _contractOwner,\n            _priorityStakingEndBlock,\n            _priorityStakers,\n            _blsPubKeysForSyndicateKnots\n        );\n\n        // Off chain logging of all deployed instances from this factory\n        emit SyndicateDeployed(newInstance);\n\n        return newInstance;\n    }\n\n    /// @inheritdoc ISyndicateFactory\n    function calculateSyndicateDeploymentAddress(\n        address _deployer,\n        address _contractOwner,\n        uint256 _numberOfInitialKnots\n    ) external override view returns (address) {\n        bytes32 salt = calculateDeploymentSalt(_deployer, _contractOwner, _numberOfInitialKnots);\n        return address(uint160(uint(keccak256(abi.encodePacked(\n                bytes1(0xff),\n                address(this),\n                salt,\n                keccak256(abi.encodePacked(\n                    type(BeaconProxy).creationCode,\n                    abi.encode(beacon, bytes(\"\")) // <-- abi.encode the parameters\n                ))\n            )))));\n    }\n\n    /// @inheritdoc ISyndicateFactory\n    function calculateDeploymentSalt(\n        address _deployer,\n        address _contractOwner,\n        uint256 _numberOfInitialKnots\n    ) public override pure returns (bytes32) {\n        return keccak256(abi.encode(_deployer, _contractOwner, _numberOfInitialKnots));\n    }\n}"
      },
      "contracts/testing/ExecutableMock.sol": {
        "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\ncontract ExecutableMock {\n    bytes internal _lastCallData;\n    uint256 internal _lastValue;\n\n    fallback() external payable {\n        _lastCallData = msg.data;\n        _lastValue = msg.value;\n    }\n\n    receive() external payable {\n        require(\n            msg.value > 0,\n            \"Contract was called with value but no ETH was passed\"\n        );\n    }\n\n    function getCallData() public view returns (bytes memory) {\n        return _lastCallData;\n    }\n\n    function getValue() public view returns (uint256) {\n        return _lastValue;\n    }\n}\n"
      },
      "contracts/testing/interfaces/IFactoryDependencyInjector.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\ninterface IFactoryDependencyInjector {\n    function accountMan() external view returns (address);\n\n    function txRouter() external view returns (address);\n\n    function uni() external view returns (address);\n\n    function slot() external view returns (address);\n\n    function saveETHRegistry() external view returns (address);\n\n    function dETH() external view returns (address);\n}"
      },
      "contracts/testing/liquid-staking/GiantPoolExploit.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\ncontract GiantPoolExploit {\n    address immutable owner = msg.sender;\n\n    address validStakingManager;\n\n    constructor(address validStakingManager_) {\n        validStakingManager = validStakingManager_;\n    }\n\n    function liquidStakingManager() public view returns (address) {\n        return validStakingManager;\n    }\n\n    function batchDepositETHForStaking(bytes[] calldata /*_blsPublicKeyOfKnots*/, uint256[] calldata /*_amounts*/) external payable {\n        payable(owner).transfer(address(this).balance);\n    }\n}"
      },
      "contracts/testing/liquid-staking/GiantPoolSelfTransferExploiter.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { GiantPoolBase } from \"../../../contracts/liquid-staking/GiantPoolBase.sol\";\n\ncontract GiantPoolSelfTransferExploiter {\n\n    GiantPoolBase giantPool;\n\n    function depositETH(\n        address _giantPool\n    ) external payable {\n        giantPool = GiantPoolBase(_giantPool);\n        giantPool.depositETH{value: msg.value}(msg.value);\n    }\n\n    function withdrawETH(uint256 _amount) external {\n        giantPool.withdrawETH(_amount);\n    }\n\n    receive() external payable {\n        giantPool.lpTokenETH().transfer(address(this), 0.001 ether);\n    }\n}"
      },
      "contracts/testing/liquid-staking/GiantPoolTransferExploiter.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { GiantPoolBase } from \"../../../contracts/liquid-staking/GiantPoolBase.sol\";\n\ncontract GiantPoolTransferExploiter {\n\n    GiantPoolBase giantPool;\n\n    function depositETH(\n        address _giantPool\n    ) external payable {\n        giantPool = GiantPoolBase(_giantPool);\n        giantPool.depositETH{value: msg.value}(msg.value);\n    }\n\n    function withdrawETH(uint256 _amount) external {\n        giantPool.withdrawETH(_amount);\n    }\n\n    receive() external payable {\n        giantPool.lpTokenETH().transfer(msg.sender, 0.001 ether);\n    }\n}"
      },
      "contracts/testing/liquid-staking/MockGiantMevAndFeesPool.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { GiantMevAndFeesPool } from \"../../liquid-staking/GiantMevAndFeesPool.sol\";\nimport { MockLSDNFactory } from \"../../testing/liquid-staking/MockLSDNFactory.sol\";\nimport { IAccountManager } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IAccountManager.sol\";\n\ncontract MockGiantMevAndFeesPool is GiantMevAndFeesPool {\n    function getAccountManager() internal view override returns (IAccountManager accountManager) {\n        return IAccountManager(MockLSDNFactory(address(liquidStakingDerivativeFactory)).accountMan());\n    }\n}"
      },
      "contracts/testing/liquid-staking/MockGiantSavETHVaultPool.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { IERC20 } from \"@blockswaplab/stakehouse-solidity-api/contracts/IERC20.sol\";\n\nimport { GiantSavETHVaultPool } from \"../../liquid-staking/GiantSavETHVaultPool.sol\";\nimport { GiantLP } from \"../../liquid-staking/GiantLP.sol\";\nimport { LSDNFactory } from \"../../liquid-staking/LSDNFactory.sol\";\nimport { MockLSDNFactory } from \"../../testing/liquid-staking/MockLSDNFactory.sol\";\n\ncontract MockGiantSavETHVaultPool is GiantSavETHVaultPool {\n\n    /// ----------------------\n    /// Override Solidity API\n    /// ----------------------\n\n    function getDETH() internal view override returns (IERC20 dETH) {\n        return IERC20(MockLSDNFactory(address(liquidStakingDerivativeFactory)).dETH());\n    }\n}"
      },
      "contracts/testing/liquid-staking/MockImplementationUpgrade.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\n// this contract is for testing beacon upgradeable.\n// test will try to upgrade implementation to this address, and call isNewImplementation() function.\n// if it returns true, then it means upgrade is success\ncontract MockImplementationUpgrade {\n    function isNewImplementation() external view returns (bool) {\n        return true;\n    }\n}\n"
      },
      "contracts/testing/liquid-staking/MockLiquidStakingManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { LiquidStakingManager } from \"../../liquid-staking/LiquidStakingManager.sol\";\nimport { LPTokenFactory } from \"../../liquid-staking/LPTokenFactory.sol\";\nimport { LSDNFactory } from \"../../liquid-staking/LSDNFactory.sol\";\nimport { MockSavETHVault } from \"./MockSavETHVault.sol\";\nimport { MockStakingFundsVault } from \"./MockStakingFundsVault.sol\";\nimport { SyndicateFactory } from \"../../syndicate/SyndicateFactory.sol\";\nimport { Syndicate } from \"../../syndicate/Syndicate.sol\";\nimport { MockAccountManager } from \"../stakehouse/MockAccountManager.sol\";\nimport { MockTransactionRouter } from \"../stakehouse/MockTransactionRouter.sol\";\nimport { MockStakeHouseUniverse } from \"../stakehouse/MockStakeHouseUniverse.sol\";\nimport { MockSlotRegistry } from \"../stakehouse/MockSlotRegistry.sol\";\nimport { IAccountManager } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IAccountManager.sol\";\nimport { ITransactionRouter } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/ITransactionRouter.sol\";\nimport { IStakeHouseUniverse } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IStakeHouseUniverse.sol\";\nimport { ISlotSettlementRegistry } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/ISlotSettlementRegistry.sol\";\n\nimport { IFactoryDependencyInjector } from \"../interfaces/IFactoryDependencyInjector.sol\";\n\ncontract MockLiquidStakingManager is LiquidStakingManager {\n\n    /// @dev Mock stakehouse dependencies injected from the super factory\n    address public accountMan;\n    address public txRouter;\n    address public uni;\n    address public slot;\n\n    function init(\n        address _dao,\n        address _syndicateFactory,\n        address _smartWalletFactory,\n        address _lpTokenFactory,\n        address _brand,\n        address _savETHVaultDeployer,\n        address _stakingFundsVaultDeployer,\n        address _optionalGatekeeperDeployer,\n        uint256 _optionalCommission,\n        bool _deployOptionalGatekeeper,\n        string calldata _stakehouseTicker\n    ) external override initializer {\n        IFactoryDependencyInjector superFactory = IFactoryDependencyInjector(_dao);\n        accountMan = superFactory.accountMan();\n        txRouter = superFactory.txRouter();\n        uni = superFactory.uni();\n        slot = superFactory.slot();\n\n        setFactory(address(superFactory));\n\n        _init(\n            _dao,\n            _syndicateFactory,\n            _smartWalletFactory,\n            _lpTokenFactory,\n            _brand,\n            _savETHVaultDeployer,\n            _stakingFundsVaultDeployer,\n            _optionalGatekeeperDeployer,\n            _optionalCommission,\n            _deployOptionalGatekeeper,\n            _stakehouseTicker\n        );\n    }\n\n    mapping(bytes => bool) isPartOfNetwork;\n    function setIsPartOfNetwork(bytes calldata _key, bool _isPart) external {\n        isPartOfNetwork[_key] = _isPart;\n    }\n\n    function isBLSPublicKeyPartOfLSDNetwork(bytes calldata _blsPublicKeyOfKnot) public override view returns (bool) {\n        return isPartOfNetwork[_blsPublicKeyOfKnot] || super.isBLSPublicKeyPartOfLSDNetwork(_blsPublicKeyOfKnot);\n    }\n\n    /// @dev override this to use MockSavETHVault which uses a mock solidity API from the test dependency injector\n    function _initSavETHVault(address, address _lpTokenFactory) internal override {\n        savETHVault = new MockSavETHVault();\n        MockSavETHVault(address(savETHVault)).injectDependencies(address(factory));\n        savETHVault.init(address(this), LPTokenFactory(_lpTokenFactory));\n    }\n\n    /// @dev override this to use MockStakingFundsVault which uses a mock solidity API from the test dependency injector\n    function _initStakingFundsVault(address, address _lpTokenFactory) internal override {\n        stakingFundsVault = new MockStakingFundsVault();\n        MockStakingFundsVault(payable(address(stakingFundsVault))).injectDependencies(address(factory));\n        stakingFundsVault.init(address(this), LPTokenFactory(_lpTokenFactory));\n    }\n\n    function setFactory(address _factory) public {\n        require(_factory != address(0), \"Zero factory supplied\");\n        factory = LSDNFactory(_factory);\n    }\n\n    /// ----------------------\n    /// Override Solidity API\n    /// ----------------------\n\n    function getSlotRegistry() internal view override returns (ISlotSettlementRegistry) {\n        return ISlotSettlementRegistry(slot);\n    }\n\n    function getAccountManager() internal view override returns (IAccountManager) {\n        return IAccountManager(accountMan);\n    }\n\n    function getTransactionRouter() internal view override returns (ITransactionRouter) {\n        return ITransactionRouter(txRouter);\n    }\n\n    function getStakeHouseUniverse() internal view override returns (IStakeHouseUniverse) {\n        return IStakeHouseUniverse(uni);\n    }\n}"
      },
      "contracts/testing/liquid-staking/MockLiquidStakingManagerV2.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { LiquidStakingManager } from \"../../liquid-staking/LiquidStakingManager.sol\";\nimport { LPTokenFactory } from \"../../liquid-staking/LPTokenFactory.sol\";\nimport { LSDNFactory } from \"../../liquid-staking/LSDNFactory.sol\";\nimport { MockSavETHVault } from \"./MockSavETHVault.sol\";\nimport { MockStakingFundsVault } from \"./MockStakingFundsVault.sol\";\nimport { SyndicateFactory } from \"../../syndicate/SyndicateFactory.sol\";\nimport { Syndicate } from \"../../syndicate/Syndicate.sol\";\nimport { MockAccountManager } from \"../stakehouse/MockAccountManager.sol\";\nimport { MockTransactionRouter } from \"../stakehouse/MockTransactionRouter.sol\";\nimport { MockStakeHouseUniverse } from \"../stakehouse/MockStakeHouseUniverse.sol\";\nimport { MockSlotRegistry } from \"../stakehouse/MockSlotRegistry.sol\";\nimport { IAccountManager } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IAccountManager.sol\";\nimport { ITransactionRouter } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/ITransactionRouter.sol\";\nimport { IStakeHouseUniverse } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IStakeHouseUniverse.sol\";\nimport { ISlotSettlementRegistry } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/ISlotSettlementRegistry.sol\";\n\nimport { IFactoryDependencyInjector } from \"../interfaces/IFactoryDependencyInjector.sol\";\n\ncontract MockLiquidStakingManagerV2 is LiquidStakingManager {\n\n    /// @dev Mock stakehouse dependencies injected from the super factory\n    address public accountMan;\n    address public txRouter;\n    address public uni;\n    address public slot;\n\n    function sing() external view returns (bool) {\n        return true;\n    }\n}"
      },
      "contracts/testing/liquid-staking/MockLSDNFactory.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { IFactoryDependencyInjector } from \"../interfaces/IFactoryDependencyInjector.sol\";\n\nimport { MockAccountManager } from \"../stakehouse/MockAccountManager.sol\";\nimport { MockTransactionRouter } from \"../stakehouse/MockTransactionRouter.sol\";\nimport { MockSavETHRegistry } from \"../stakehouse/MockSavETHRegistry.sol\";\nimport { MockStakeHouseUniverse } from \"../stakehouse/MockStakeHouseUniverse.sol\";\nimport { MockSlotRegistry } from \"../stakehouse/MockSlotRegistry.sol\";\nimport { MockLiquidStakingManager } from \"./MockLiquidStakingManager.sol\";\n\nimport { MockERC20 } from \"../MockERC20.sol\";\n\nimport { SyndicateFactoryMock } from \"../syndicate/SyndicateFactoryMock.sol\";\n\nimport { LSDNFactory } from \"../../../contracts/liquid-staking/LSDNFactory.sol\";\nimport { LiquidStakingManager } from \"../../../contracts/liquid-staking/LiquidStakingManager.sol\";\n\n// In the mock LSDN factory world, the mock factory is always the admin of LSDN network for ease and to allow mock stakehouse dependency injection\ncontract MockLSDNFactory is IFactoryDependencyInjector, LSDNFactory {\n\n    /// @dev Mock Stakehouse dependencies that will be injected into the LSDN networks\n    address public override accountMan;\n    address public override txRouter;\n    address public override uni;\n    address public override slot;\n    address public override saveETHRegistry;\n    address public override dETH;\n\n    constructor(InitParams memory _params) {\n        _init(_params);\n\n        // Create mock Stakehouse contract dependencies that can later be injected\n        accountMan = address(new MockAccountManager());\n        txRouter = address(new MockTransactionRouter());\n        uni = address(new MockStakeHouseUniverse());\n        slot = address(new MockSlotRegistry());\n        saveETHRegistry = address(new MockSavETHRegistry());\n\n        // notify TX router about the mock SLOT registry\n        MockTransactionRouter(txRouter).setMockSlotRegistry(MockSlotRegistry(slot));\n        MockTransactionRouter(txRouter).setMockUniverse(MockStakeHouseUniverse(uni));\n        MockTransactionRouter(txRouter).setMockBrand(_params._brand);\n\n        // msg.sender is deployer and they will get initial supply of dETH\n        dETH = address(new MockERC20(\"dToken\", \"dETH\", msg.sender));\n\n        SyndicateFactoryMock syndicateFactoryMock = new SyndicateFactoryMock(\n            accountMan,\n            txRouter,\n            uni,\n            slot\n        );\n        syndicateFactory = address(syndicateFactoryMock);\n\n        assert(syndicateFactoryMock.slot() == slot);\n    }\n\n    /// @dev Tests will call this instead of super method to ensure correct dependency injection of Stakehouse\n    function deployNewMockLiquidStakingDerivativeNetwork(\n        address,\n        bool _deployOptionalHouseGatekeeper,\n        string calldata _stakehouseTicker\n    ) external returns (address) {\n        // Make DAO this factory for dependency injection\n        return deployNewLiquidStakingDerivativeNetwork(\n            address(this),\n            0,\n            _deployOptionalHouseGatekeeper,\n            _stakehouseTicker\n        );\n    }\n\n    function deployNewMockLiquidStakingDerivativeNetworkWithCommission(\n        address,\n        uint256 _optionalCommission,\n        bool _deployOptionalHouseGatekeeper,\n        string calldata _stakehouseTicker\n    ) external returns (address) {\n        // Make DAO this factory for dependency injection\n        return deployNewLiquidStakingDerivativeNetwork(\n            address(this),\n            _optionalCommission,\n            _deployOptionalHouseGatekeeper,\n            _stakehouseTicker\n        );\n    }\n}"
      },
      "contracts/testing/liquid-staking/MockSavETHVault.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { IERC20 } from \"@blockswaplab/stakehouse-solidity-api/contracts/IERC20.sol\";\nimport { ISavETHManager } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/ISavETHManager.sol\";\nimport { IAccountManager } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IAccountManager.sol\";\nimport { SavETHVault } from \"../../liquid-staking/SavETHVault.sol\";\nimport { LPTokenFactory } from \"../../liquid-staking/LPTokenFactory.sol\";\nimport { LiquidStakingManager } from \"../../liquid-staking/LiquidStakingManager.sol\";\nimport { MockSavETHRegistry } from \"../stakehouse/MockSavETHRegistry.sol\";\nimport { MockAccountManager } from \"../stakehouse/MockAccountManager.sol\";\nimport { IFactoryDependencyInjector } from \"../interfaces/IFactoryDependencyInjector.sol\";\nimport { LPToken } from \"../../liquid-staking/LPToken.sol\";\n\ncontract MockSavETHVault is SavETHVault {\n\n    MockSavETHRegistry public saveETHRegistry;\n    MockAccountManager public accountMan;\n    IERC20 public dETHToken;\n\n    function injectDependencies(address _lsdnFactory) external {\n        IFactoryDependencyInjector dependencyInjector = IFactoryDependencyInjector(\n            _lsdnFactory\n        );\n\n        dETHToken = IERC20(dependencyInjector.dETH());\n        saveETHRegistry = MockSavETHRegistry(dependencyInjector.saveETHRegistry());\n        accountMan = MockAccountManager(dependencyInjector.accountMan());\n\n        saveETHRegistry.setDETHToken(dETHToken);\n    }\n\n    function init(address _liquidStakingManagerAddress, LPTokenFactory _lpTokenFactory) external override {\n        _init(_liquidStakingManagerAddress, _lpTokenFactory);\n    }\n\n    /// ----------------------\n    /// Override Solidity API\n    /// ----------------------\n\n    function getSavETHRegistry() internal view override returns (ISavETHManager) {\n        return ISavETHManager(address(saveETHRegistry));\n    }\n\n    function getAccountManager() internal view override returns (IAccountManager accountManager) {\n        return IAccountManager(address(accountMan));\n    }\n\n    function getDETH() internal view override returns (IERC20 dETH) {\n        return dETHToken;\n    }\n}"
      },
      "contracts/testing/liquid-staking/MockStakingFundsVault.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { IERC20 } from \"@blockswaplab/stakehouse-solidity-api/contracts/IERC20.sol\";\nimport { ISavETHManager } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/ISavETHManager.sol\";\nimport { IAccountManager } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IAccountManager.sol\";\n\nimport { LiquidStakingManager } from \"../../liquid-staking/LiquidStakingManager.sol\";\nimport { LPTokenFactory } from \"../../liquid-staking/LPTokenFactory.sol\";\nimport { LPToken } from \"../../liquid-staking/LPToken.sol\";\nimport { StakingFundsVault } from \"../../liquid-staking/StakingFundsVault.sol\";\nimport { MockSavETHRegistry } from \"../stakehouse/MockSavETHRegistry.sol\";\nimport { MockAccountManager } from \"../stakehouse/MockAccountManager.sol\";\nimport { IFactoryDependencyInjector } from \"../interfaces/IFactoryDependencyInjector.sol\";\n\ncontract MockStakingFundsVault is StakingFundsVault {\n\n    MockSavETHRegistry public saveETHRegistry;\n    MockAccountManager public accountMan;\n    IERC20 public dETHToken;\n\n    function injectDependencies(address _lsdnFactory) external {\n        IFactoryDependencyInjector dependencyInjector = IFactoryDependencyInjector(\n            _lsdnFactory\n        );\n\n        dETHToken = IERC20(dependencyInjector.dETH());\n        saveETHRegistry = MockSavETHRegistry(dependencyInjector.saveETHRegistry());\n        accountMan = MockAccountManager(dependencyInjector.accountMan());\n\n        saveETHRegistry.setDETHToken(dETHToken);\n    }\n\n    function init(address _liquidStakingManagerAddress, LPTokenFactory _tokenFactory) external override {\n        _init(LiquidStakingManager(payable(_liquidStakingManagerAddress)), _tokenFactory);\n    }\n\n    /// ----------------------\n    /// Override Solidity API\n    /// ----------------------\n\n    function getAccountManager() internal view override returns (IAccountManager accountManager) {\n        return IAccountManager(address(accountMan));\n    }\n\n}"
      },
      "contracts/testing/liquid-staking/MockToken.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { ERC20 } from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockToken is ERC20 {\n    constructor()ERC20(\"A\", \"B\") {\n        _mint(msg.sender, 10000 ether);\n    }\n}"
      },
      "contracts/testing/liquid-staking/NodeRunner.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\nimport { LiquidStakingManager } from \"../../liquid-staking/LiquidStakingManager.sol\";\nimport { TestUtils } from \"../../../test/utils/TestUtils.sol\";\ncontract NodeRunner {\n    bytes blsPublicKey1;\n    LiquidStakingManager manager;\n    TestUtils testUtils;\n    constructor(LiquidStakingManager _manager, bytes memory _blsPublicKey1, bytes memory _blsPublicKey2, address _testUtils) payable public {\n        manager = _manager;\n        blsPublicKey1 = _blsPublicKey1;\n        testUtils = TestUtils(_testUtils);\n        //register BLS Key #1\n        manager.registerBLSPublicKeys{ value: 4 ether }(\n            testUtils.getBytesArrayFromBytes(blsPublicKey1),\n            testUtils.getBytesArrayFromBytes(blsPublicKey1),\n            address(0xdeadbeef)\n        );\n        // Register BLS Key #2\n        manager.registerBLSPublicKeys{ value: 4 ether }(\n            testUtils.getBytesArrayFromBytes(_blsPublicKey2),\n            testUtils.getBytesArrayFromBytes(_blsPublicKey2),\n            address(0xdeadbeef)\n        );\n    }\n    receive() external payable {\n        testUtils.stakeSingleBlsPubKey(blsPublicKey1);\n    }\n}"
      },
      "contracts/testing/liquid-staking/NonEOARepresentative.sol": {
        "content": "interface IManager {\n    function registerBLSPublicKeys(\n        bytes[] calldata _blsPublicKeys,\n        bytes[] calldata _blsSignatures,\n        address _eoaRepresentative\n    ) external payable;\n    function withdrawETHForKnot(\n        address _recipient,\n        bytes calldata _blsPublicKeyOfKnot\n    ) external;\n}\ncontract NonEOARepresentative {\n    address manager;\n    bool state;\n    constructor(address _manager) payable {\n        bytes[] memory publicKeys = new bytes[](2);\n        publicKeys[0] = \"publicKeys1\";\n        publicKeys[1] = \"publicKeys2\";\n        bytes[] memory signature = new bytes[](2);\n        signature[0] = \"signature1\";\n        signature[1] = \"signature2\";\n        IManager(_manager).registerBLSPublicKeys{value: 8 ether}(\n            publicKeys,\n            signature,\n            address(this)\n        );\n        manager = _manager;\n    }\n    function withdraw(bytes calldata _blsPublicKeyOfKnot) external {\n        IManager(manager).withdrawETHForKnot(address(this), _blsPublicKeyOfKnot);\n    }\n    receive() external payable {\n        if(!state) {\n            state = true;\n            this.withdraw(\"publicKeys1\");\n        }\n    }\n}"
      },
      "contracts/testing/liquid-staking/RugContract.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\ncontract RugContract {\n    function receiveFund() external payable {\n    }\n    receive() external payable {}\n}"
      },
      "contracts/testing/MockERC20.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n    constructor(\n        string memory _name,\n        string memory _symbol,\n        address _initialSupplyRecipient\n    ) ERC20(_name, _symbol) {\n        uint256 initialSupply = 125_000 * 10 ** 18;\n        _mint(_initialSupplyRecipient, initialSupply);\n    }\n}\n"
      },
      "contracts/testing/stakehouse/MockAccountManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { IDataStructures } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IDataStructures.sol\";\n\ncontract MockAccountManager {\n    mapping(bytes => uint256) public lifecycleStatus;\n    function setLifecycleStatus(bytes calldata _blsKey, uint256 _status) external {\n        lifecycleStatus[_blsKey] = _status;\n    }\n\n    function blsPublicKeyToLifecycleStatus(bytes calldata _blsPubKey) external view returns (uint256) {\n        return lifecycleStatus[_blsPubKey];\n    }\n\n    /// @dev BLS public Key -> Last know state of the validator\n    mapping(bytes => IDataStructures.ETH2DataReport) public blsPublicKeyToLastState;\n    function markSlashedIsTrue(bytes calldata _blsPubKey) external {\n        blsPublicKeyToLastState[_blsPubKey].slashed = true;\n    }\n}"
      },
      "contracts/testing/stakehouse/MockBrandCentral.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { MockRestrictedTickerRegistry } from \"./MockRestrictedTickerRegistry.sol\";\n\ncontract MockBrandCentral {\n\n    MockRestrictedTickerRegistry public claimAuction;\n\n    constructor() {\n        claimAuction = new MockRestrictedTickerRegistry();\n    }\n}"
      },
      "contracts/testing/stakehouse/MockBrandNFT.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { ERC721Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport { MockBrandCentral } from \"./MockBrandCentral.sol\";\n\n/// @notice The Brand NFT of a tokenised KNOT community\ncontract MockBrandNFT is ERC721Upgradeable {\n    /// @notice lowercase brand ticker -> minted token ID\n    mapping(string => uint256) public lowercaseBrandTickerToTokenId;\n    mapping(uint256 => string) public nftDescription;\n    mapping(uint256 => string) public nftImageURI;\n\n    /// @notice total brand NFTs minted\n    uint256 public totalSupply;\n\n    MockBrandCentral public brandCentral;\n\n    constructor() {\n        brandCentral = new MockBrandCentral();\n    }\n\n    function mint(\n        string calldata _ticker,\n        bytes calldata,\n        address _recipient\n    ) external returns (uint256) {\n        require(\n            bytes(_ticker).length >= 3 && bytes(_ticker).length <= 5,\n            \"Name must be between 3 and 5 characters\"\n        );\n\n        string memory lowerCaseBrandTicker = toLowerCase(_ticker);\n        require(\n            lowercaseBrandTickerToTokenId[lowerCaseBrandTicker] == 0,\n            \"Brand name already exists\"\n        );\n\n        unchecked {\n            // unlikely to exceed ( (2 ^ 256) - 1 )\n            totalSupply += 1;\n        }\n\n        lowercaseBrandTickerToTokenId[lowerCaseBrandTicker] = totalSupply;\n\n        _mint(_recipient, totalSupply);\n\n        return totalSupply;\n    }\n\n    /// @notice Converts a string to its lowercase equivalent\n    /// @dev Only 26 chars from the English alphabet\n    /// @param _base String to convert\n    /// @return string Lowercase version of string supplied\n    function toLowerCase(string memory _base)\n        public\n        pure\n        returns (string memory)\n    {\n        bytes memory bStr = bytes(_base);\n        bytes memory bLower = new bytes(bStr.length);\n        for (uint256 i; i < bStr.length; ++i) {\n            if ((bStr[i] >= 0x41) && (bStr[i] <= 0x5A)) {\n                bLower[i] = bytes1(uint8(bStr[i]) + 32);\n            }\n        }\n        return string(bLower);\n    }\n\n    function setBrandMetadata(\n        uint256 _tokenId,\n        string memory _description,\n        string memory _imageURI\n    ) external {\n        require(_tokenId > 0 && _tokenId <= totalSupply, \"invalid token ID\");\n        nftDescription[_tokenId] = _description;\n        nftImageURI[_tokenId] = _imageURI;\n    }\n}\n"
      },
      "contracts/testing/stakehouse/MockRestrictedTickerRegistry.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\ncontract MockRestrictedTickerRegistry {\n\n    mapping(string => bool) public isRestricted;\n    function setIsRestricted(string calldata _lowerTicker, bool _isRestricted) external {\n        isRestricted[_lowerTicker] = _isRestricted;\n    }\n\n    /// @notice Function for determining if a ticker is restricted for claiming or not\n    function isRestrictedBrandTicker(string calldata _lowerTicker) external view returns (bool) {\n        return isRestricted[_lowerTicker];\n    }\n}"
      },
      "contracts/testing/stakehouse/MockSavETHRegistry.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\nimport { IERC20 } from \"@blockswaplab/stakehouse-solidity-api/contracts/IERC20.sol\";\n\npragma solidity ^0.8.18;\n\ncontract MockSavETHRegistry {\n\n    IERC20 public dETHToken;\n    function setDETHToken(IERC20 _dETH) external {\n        dETHToken = _dETH;\n    }\n\n    uint256 public indexPointer;\n    mapping(uint256 => address) public indexIdToOwner;\n    mapping(bytes => uint256) public dETHRewardsMintedForKnot;\n    function setdETHRewardsMintedForKnot(bytes memory _blsPublicKey, uint256 _amount) external {\n        dETHRewardsMintedForKnot[_blsPublicKey] = _amount;\n    }\n\n    function createIndex(address _owner) external returns (uint256) {\n        indexIdToOwner[++indexPointer] = _owner;\n        return indexPointer;\n    }\n\n    mapping(uint256 => mapping(bytes => uint256)) public balInIndex;\n    function setBalInIndex(uint256 _indexId, bytes calldata _blsKey, uint256 _bal) external {\n        balInIndex[_indexId][_blsKey] = _bal;\n    }\n\n    function knotDETHBalanceInIndex(uint256 _indexId, bytes calldata _blsKey) external view returns (uint256) {\n        return balInIndex[_indexId][_blsKey] > 0 ? balInIndex[_indexId][_blsKey] : 24 ether ;\n    }\n\n    function addKnotToOpenIndexAndWithdraw(\n        address _stakeHouse,\n        bytes calldata _blsPubKey,\n        address _receipient\n    ) external {\n\n    }\n\n    function addKnotToOpenIndex(\n        address _stakeHouse,\n        bytes calldata _blsPubKey,\n        address _receipient\n    ) external {\n\n    }\n\n    function withdraw(\n        address _recipient,\n        uint128 _amount\n    ) external {\n        dETHToken.transfer(_recipient, savETHToDETH(_amount));\n    }\n\n    function savETHToDETH(uint256 _amount) public pure returns (uint256) {\n        return _amount;\n    }\n\n    function dETHToSavETH(uint256 _amount) public pure returns (uint256) {\n        return _amount;\n    }\n\n    function deposit(address _recipient, uint128 _amount) external {\n\n    }\n\n    function isolateKnotFromOpenIndex(\n        address _stakeHouse,\n        bytes calldata _memberId,\n        uint256 _targetIndexId\n    ) external {\n\n    }\n}"
      },
      "contracts/testing/stakehouse/MockSlotRegistry.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\ncontract MockSlotRegistry {\n\n    mapping(address => mapping(address => mapping(bytes => uint256))) userCollateralisedSLOTBalanceForKnot;\n    function setUserCollateralisedSLOTBalanceForKnot(address _stakeHouse, address _user, bytes calldata _blsPublicKey, uint256 _bal) external {\n        userCollateralisedSLOTBalanceForKnot[_stakeHouse][_user][_blsPublicKey] = _bal;\n    }\n\n    /// @notice Total collateralised SLOT owned by an account for a given KNOT in a Stakehouse\n    function totalUserCollateralisedSLOTBalanceForKnot(address _stakeHouse, address _user, bytes calldata _blsPublicKey) external view returns (uint256) {\n        return userCollateralisedSLOTBalanceForKnot[_stakeHouse][_user][_blsPublicKey];\n    }\n\n    mapping(bytes => uint256) _numberOfCollateralisedSlotOwnersForKnot;\n    function setNumberOfCollateralisedSlotOwnersForKnot(bytes calldata _blsPublicKey, uint256 _numOfOwners) external {\n        _numberOfCollateralisedSlotOwnersForKnot[_blsPublicKey] = _numOfOwners;\n    }\n\n    /// @notice Total number of collateralised SLOT owners for a given KNOT\n    /// @param _blsPublicKey BLS public key of the KNOT\n    function numberOfCollateralisedSlotOwnersForKnot(bytes calldata _blsPublicKey) external view returns (uint256) {\n        return _numberOfCollateralisedSlotOwnersForKnot[_blsPublicKey] == 0 ? 1 : _numberOfCollateralisedSlotOwnersForKnot[_blsPublicKey];\n    }\n\n    mapping(bytes => mapping(uint256 => address)) collateralisedOwnerAtIndex;\n    function setCollateralisedOwnerAtIndex(bytes calldata _blsPublicKey, uint256 _index, address _owner) external {\n        collateralisedOwnerAtIndex[_blsPublicKey][_index] = _owner;\n    }\n\n    /// @notice Fetch a collateralised SLOT owner address for a specific KNOT at a specific index\n    function getCollateralisedOwnerAtIndex(bytes calldata _blsPublicKey, uint256 _index) external view returns (address) {\n        return collateralisedOwnerAtIndex[_blsPublicKey][_index];\n    }\n\n    mapping(address => address) houseToShareToken;\n    function setShareTokenForHouse(address _stakeHouse, address _sETH) external {\n        houseToShareToken[_stakeHouse] = _sETH;\n    }\n\n    /// @notice Returns the address of the sETH token for a given Stakehouse registry\n    function stakeHouseShareTokens(address _stakeHouse) external view returns (address) {\n        return houseToShareToken[_stakeHouse];\n    }\n\n    function currentSlashedAmountOfSLOTForKnot(bytes calldata) external view returns (uint256) {\n        return 0;\n    }\n}"
      },
      "contracts/testing/stakehouse/MockStakeHouseUniverse.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\ncontract MockStakeHouseUniverse {\n\n    mapping(bytes => address) associatedHouseForKnot;\n    function setAssociatedHouseForKnot(bytes calldata _blsPublicKey, address _house) external {\n        associatedHouseForKnot[_blsPublicKey] = _house;\n    }\n\n    mapping(bytes => bool) useOverride;\n    mapping(bytes => bool) isBLSKeyActive;\n    function setIsActive(bytes calldata _blsKey, bool _isActive) external {\n        useOverride[_blsKey] = true;\n        isBLSKeyActive[_blsKey] = _isActive;\n    }\n\n    function stakeHouseKnotInfo(bytes calldata _blsPublicKey) external view returns (\n        address stakeHouse,     // Address of registered StakeHouse\n        address sETHAddress,    // Address of sETH address associated with StakeHouse\n        address applicant,      // Address of ETH account that added the member to the StakeHouse\n        uint256 knotMemberIndex,// KNOT Index of the member within the StakeHouse\n        uint256 flags,          // Flags associated with the member\n        bool isActive           // Whether the member is active or knot\n    ) {\n        return (\n            associatedHouseForKnot[_blsPublicKey] != address(0) ? associatedHouseForKnot[_blsPublicKey] : address(uint160(5)) ,\n            address(0),\n            address(0),\n            0,\n            0,\n            useOverride[_blsPublicKey] ? isBLSKeyActive[_blsPublicKey] : true\n        );\n    }\n\n    function memberKnotToStakeHouse(bytes calldata _blsPublicKey) external view returns (address) {\n        return associatedHouseForKnot[_blsPublicKey];\n    }\n}"
      },
      "contracts/testing/stakehouse/MockTransactionRouter.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport { IDataStructures } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IDataStructures.sol\";\nimport { MockSlotRegistry } from \"./MockSlotRegistry.sol\";\nimport { MockStakeHouseUniverse } from \"./MockStakeHouseUniverse.sol\";\nimport { MockBrandNFT } from \"./MockBrandNFT.sol\";\nimport { StakeHouseRegistry } from \"./StakeHouseRegistry.sol\";\nimport { MockERC20 } from \"../MockERC20.sol\";\n\ncontract MockTransactionRouter {\n\n    MockSlotRegistry public mockSlotRegistry;\n    MockStakeHouseUniverse public mockUniverse;\n    MockBrandNFT public mockBrand;\n\n    function setMockSlotRegistry(MockSlotRegistry _slotRegistry) external {\n        mockSlotRegistry = _slotRegistry;\n    }\n\n    function setMockUniverse(MockStakeHouseUniverse _universe) external {\n        mockUniverse = _universe;\n    }\n\n    function setMockBrand(address _brand) external {\n        mockBrand = MockBrandNFT(_brand);\n    }\n\n    function authorizeRepresentative(\n        address,\n        bool\n    ) external {\n\n    }\n\n    function registerValidatorInitials(\n        address,\n        bytes calldata,\n        bytes calldata\n    ) external {\n\n    }\n\n    function registerValidator(\n        address,\n        bytes calldata,\n        bytes calldata,\n        bytes calldata,\n        IDataStructures.EIP712Signature calldata,\n        bytes32\n    ) external payable {\n\n    }\n\n    function createStakehouse(\n        address _user,\n        bytes calldata _blsKey,\n        string calldata _ticker,\n        uint256,\n        IDataStructures.ETH2DataReport calldata,\n        IDataStructures.EIP712Signature calldata\n    ) external {\n        address house = address(new StakeHouseRegistry());\n        MockERC20 sETH = new MockERC20(\"sETH\", \"sETH\", _user);\n\n        mockUniverse.setAssociatedHouseForKnot(_blsKey, house);\n\n        mockSlotRegistry.setShareTokenForHouse(house, address(sETH));\n\n        mockBrand.mint(_ticker, _blsKey, _user);\n    }\n\n    function joinStakehouse(\n        address _user,\n        bytes calldata _blsPublicKey,\n        address _stakehouse,\n        uint256 _brandTokenId,\n        uint256 _savETHIndexId,\n        IDataStructures.ETH2DataReport calldata _eth2Report,\n        IDataStructures.EIP712Signature calldata _reportSignature\n    ) external {\n\n    }\n}"
      },
      "contracts/testing/stakehouse/SafeBox.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { ICIP } from \"../../interfaces/ICIP.sol\";\n\ncontract SafeBox is ICIP {\n    event applyForDecryptionSuccess();\n\n    function applyForDecryption(\n        bytes calldata _knotId,\n        address _stakehouse,\n        bytes calldata _aesPublicKey\n    ) external override {\n        emit applyForDecryptionSuccess();\n    }\n}"
      },
      "contracts/testing/stakehouse/StakeHouseRegistry.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\ncontract StakeHouseRegistry {\n\n    function transferOwnership(address) external {}\n\n    address public keeper;\n    function setGateKeeper(address _keeper) external {\n        keeper = _keeper;\n    }\n\n}\n"
      },
      "contracts/testing/syndicate/SyndicateFactoryMock.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { SyndicateFactory } from \"../../../contracts/syndicate/SyndicateFactory.sol\";\nimport { IFactoryDependencyInjector } from \"../interfaces/IFactoryDependencyInjector.sol\";\nimport { SyndicateMock } from \"./SyndicateMock.sol\";\n\ncontract SyndicateFactoryMock is IFactoryDependencyInjector, SyndicateFactory {\n    /// @dev Mock Stakehouse dependencies that will be injected into the LSDN networks\n    address public override accountMan;\n    address public override txRouter;\n    address public override uni;\n    address public override slot;\n    address public override dETH;\n    address public override saveETHRegistry;\n\n    constructor(\n        address _accountMan,\n        address _txRouter,\n        address _uni,\n        address _slot\n    ) {\n        _init(address(new SyndicateMock()), msg.sender);\n\n        // Create mock Stakehouse contract dependencies that can later be injected\n        accountMan = _accountMan;\n        txRouter = _txRouter;\n        uni = _uni;\n        slot = _slot;\n    }\n\n    function deployMockSyndicate(\n        address _contractOwner,\n        uint256 _priorityStakingEndBlock,\n        address[] calldata _priorityStakers,\n        bytes[] calldata _blsPubKeysForSyndicateKnots\n    ) public returns (address) {\n        // Syndicate deployed with factory as owner first for dependency injection\n        address syn = deploySyndicate(\n            address(this),\n            _priorityStakingEndBlock,\n            _priorityStakers,\n            _blsPubKeysForSyndicateKnots\n        );\n\n        // then ownership given to address requested by test\n        SyndicateMock(payable(syn)).transferOwnership(_contractOwner);\n\n        // Address of syndicate now returned\n        return syn;\n    }\n}"
      },
      "contracts/testing/syndicate/SyndicateMock.sol": {
        "content": "pragma solidity ^0.8.18;\n\n// SPDX-License-Identifier: MIT\n\nimport { Syndicate } from \"../../syndicate/Syndicate.sol\";\nimport { MockStakeHouseUniverse } from \"../stakehouse/MockStakeHouseUniverse.sol\";\nimport { MockSlotRegistry } from \"../stakehouse/MockSlotRegistry.sol\";\nimport { MockAccountManager } from \"../stakehouse/MockAccountManager.sol\";\nimport { IStakeHouseUniverse } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IStakeHouseUniverse.sol\";\nimport { ISlotSettlementRegistry } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/ISlotSettlementRegistry.sol\";\nimport { IAccountManager } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IAccountManager.sol\";\nimport { IFactoryDependencyInjector } from \"../interfaces/IFactoryDependencyInjector.sol\";\n\n/// @dev Use the mock contract for testing the syndicate by overriding API addresses\ncontract SyndicateMock is Syndicate {\n\n    // Mock universe and slot registry allowing testing of syndicate without full stakehouse contract suite\n    address public uni;\n    address public slotReg;\n    address public accountManager;\n\n    function initialize(\n        address _contractOwner,\n        uint256 _priorityStakingEndBlock,\n        address[] memory _priorityStakers,\n        bytes[] memory _blsPubKeysForSyndicateKnots\n    ) external override initializer {\n        // Create the mock universe and slot registry\n        uni = IFactoryDependencyInjector(_contractOwner).uni();\n        slotReg = IFactoryDependencyInjector(_contractOwner).slot();\n        accountManager = IFactoryDependencyInjector(_contractOwner).accountMan();\n\n        // then initialize the underlying syndicate contract\n        _initialize(\n            _contractOwner,\n            _priorityStakingEndBlock,\n            _priorityStakers,\n            _blsPubKeysForSyndicateKnots\n        );\n    }\n\n    /// ----------------------\n    /// Override Solidity API\n    /// ----------------------\n\n    // Proxy into mock Stakehouse contracts\n\n    function getStakeHouseUniverse() internal view override returns (IStakeHouseUniverse universe) {\n        return IStakeHouseUniverse(uni);\n    }\n\n    function getSlotRegistry() internal view override returns (ISlotSettlementRegistry slotSettlementRegistry) {\n        return ISlotSettlementRegistry(slotReg);\n    }\n\n    function getAccountManager() internal view override returns (IAccountManager) {\n        return IAccountManager(accountManager);\n    }\n}"
      },
      "contracts/transfer/ETHTransferHelper.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nerror FailedToTransfer();\n\n/// @dev Contract that has the logic to take care of transferring ETH and can be overriden as needed\ncontract ETHTransferHelper {\n    function _transferETH(address _recipient, uint256 _amount) internal virtual {\n        if (_amount > 0) {\n            (bool success,) = _recipient.call{value: _amount}(\"\");\n            if (!success) revert FailedToTransfer();\n        }\n    }\n}"
      },
      "lib/forge-std/lib/ds-test/src/test.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\npragma solidity >=0.5.0;\n\ncontract DSTest {\n    event log                    (string);\n    event logs                   (bytes);\n\n    event log_address            (address);\n    event log_bytes32            (bytes32);\n    event log_int                (int);\n    event log_uint               (uint);\n    event log_bytes              (bytes);\n    event log_string             (string);\n\n    event log_named_address      (string key, address val);\n    event log_named_bytes32      (string key, bytes32 val);\n    event log_named_decimal_int  (string key, int val, uint decimals);\n    event log_named_decimal_uint (string key, uint val, uint decimals);\n    event log_named_int          (string key, int val);\n    event log_named_uint         (string key, uint val);\n    event log_named_bytes        (string key, bytes val);\n    event log_named_string       (string key, string val);\n\n    bool public IS_TEST = true;\n    bool private _failed;\n\n    address constant HEVM_ADDRESS =\n        address(bytes20(uint160(uint256(keccak256('hevm cheat code')))));\n\n    modifier mayRevert() { _; }\n    modifier testopts(string memory) { _; }\n\n    function failed() public returns (bool) {\n        if (_failed) {\n            return _failed;\n        } else {\n            bool globalFailed = false;\n            if (hasHEVMContext()) {\n                (, bytes memory retdata) = HEVM_ADDRESS.call(\n                    abi.encodePacked(\n                        bytes4(keccak256(\"load(address,bytes32)\")),\n                        abi.encode(HEVM_ADDRESS, bytes32(\"failed\"))\n                    )\n                );\n                globalFailed = abi.decode(retdata, (bool));\n            }\n            return globalFailed;\n        }\n    } \n\n    function fail() internal {\n        if (hasHEVMContext()) {\n            (bool status, ) = HEVM_ADDRESS.call(\n                abi.encodePacked(\n                    bytes4(keccak256(\"store(address,bytes32,bytes32)\")),\n                    abi.encode(HEVM_ADDRESS, bytes32(\"failed\"), bytes32(uint256(0x01)))\n                )\n            );\n            status; // Silence compiler warnings\n        }\n        _failed = true;\n    }\n\n    function hasHEVMContext() internal view returns (bool) {\n        uint256 hevmCodeSize = 0;\n        assembly {\n            hevmCodeSize := extcodesize(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D)\n        }\n        return hevmCodeSize > 0;\n    }\n\n    modifier logs_gas() {\n        uint startGas = gasleft();\n        _;\n        uint endGas = gasleft();\n        emit log_named_uint(\"gas\", startGas - endGas);\n    }\n\n    function assertTrue(bool condition) internal {\n        if (!condition) {\n            emit log(\"Error: Assertion Failed\");\n            fail();\n        }\n    }\n\n    function assertTrue(bool condition, string memory err) internal {\n        if (!condition) {\n            emit log_named_string(\"Error\", err);\n            assertTrue(condition);\n        }\n    }\n\n    function assertEq(address a, address b) internal {\n        if (a != b) {\n            emit log(\"Error: a == b not satisfied [address]\");\n            emit log_named_address(\"  Expected\", b);\n            emit log_named_address(\"    Actual\", a);\n            fail();\n        }\n    }\n    function assertEq(address a, address b, string memory err) internal {\n        if (a != b) {\n            emit log_named_string (\"Error\", err);\n            assertEq(a, b);\n        }\n    }\n\n    function assertEq(bytes32 a, bytes32 b) internal {\n        if (a != b) {\n            emit log(\"Error: a == b not satisfied [bytes32]\");\n            emit log_named_bytes32(\"  Expected\", b);\n            emit log_named_bytes32(\"    Actual\", a);\n            fail();\n        }\n    }\n    function assertEq(bytes32 a, bytes32 b, string memory err) internal {\n        if (a != b) {\n            emit log_named_string (\"Error\", err);\n            assertEq(a, b);\n        }\n    }\n    function assertEq32(bytes32 a, bytes32 b) internal {\n        assertEq(a, b);\n    }\n    function assertEq32(bytes32 a, bytes32 b, string memory err) internal {\n        assertEq(a, b, err);\n    }\n\n    function assertEq(int a, int b) internal {\n        if (a != b) {\n            emit log(\"Error: a == b not satisfied [int]\");\n            emit log_named_int(\"  Expected\", b);\n            emit log_named_int(\"    Actual\", a);\n            fail();\n        }\n    }\n    function assertEq(int a, int b, string memory err) internal {\n        if (a != b) {\n            emit log_named_string(\"Error\", err);\n            assertEq(a, b);\n        }\n    }\n    function assertEq(uint a, uint b) internal {\n        if (a != b) {\n            emit log(\"Error: a == b not satisfied [uint]\");\n            emit log_named_uint(\"  Expected\", b);\n            emit log_named_uint(\"    Actual\", a);\n            fail();\n        }\n    }\n    function assertEq(uint a, uint b, string memory err) internal {\n        if (a != b) {\n            emit log_named_string(\"Error\", err);\n            assertEq(a, b);\n        }\n    }\n    function assertEqDecimal(int a, int b, uint decimals) internal {\n        if (a != b) {\n            emit log(\"Error: a == b not satisfied [decimal int]\");\n            emit log_named_decimal_int(\"  Expected\", b, decimals);\n            emit log_named_decimal_int(\"    Actual\", a, decimals);\n            fail();\n        }\n    }\n    function assertEqDecimal(int a, int b, uint decimals, string memory err) internal {\n        if (a != b) {\n            emit log_named_string(\"Error\", err);\n            assertEqDecimal(a, b, decimals);\n        }\n    }\n    function assertEqDecimal(uint a, uint b, uint decimals) internal {\n        if (a != b) {\n            emit log(\"Error: a == b not satisfied [decimal uint]\");\n            emit log_named_decimal_uint(\"  Expected\", b, decimals);\n            emit log_named_decimal_uint(\"    Actual\", a, decimals);\n            fail();\n        }\n    }\n    function assertEqDecimal(uint a, uint b, uint decimals, string memory err) internal {\n        if (a != b) {\n            emit log_named_string(\"Error\", err);\n            assertEqDecimal(a, b, decimals);\n        }\n    }\n\n    function assertGt(uint a, uint b) internal {\n        if (a <= b) {\n            emit log(\"Error: a > b not satisfied [uint]\");\n            emit log_named_uint(\"  Value a\", a);\n            emit log_named_uint(\"  Value b\", b);\n            fail();\n        }\n    }\n    function assertGt(uint a, uint b, string memory err) internal {\n        if (a <= b) {\n            emit log_named_string(\"Error\", err);\n            assertGt(a, b);\n        }\n    }\n    function assertGt(int a, int b) internal {\n        if (a <= b) {\n            emit log(\"Error: a > b not satisfied [int]\");\n            emit log_named_int(\"  Value a\", a);\n            emit log_named_int(\"  Value b\", b);\n            fail();\n        }\n    }\n    function assertGt(int a, int b, string memory err) internal {\n        if (a <= b) {\n            emit log_named_string(\"Error\", err);\n            assertGt(a, b);\n        }\n    }\n    function assertGtDecimal(int a, int b, uint decimals) internal {\n        if (a <= b) {\n            emit log(\"Error: a > b not satisfied [decimal int]\");\n            emit log_named_decimal_int(\"  Value a\", a, decimals);\n            emit log_named_decimal_int(\"  Value b\", b, decimals);\n            fail();\n        }\n    }\n    function assertGtDecimal(int a, int b, uint decimals, string memory err) internal {\n        if (a <= b) {\n            emit log_named_string(\"Error\", err);\n            assertGtDecimal(a, b, decimals);\n        }\n    }\n    function assertGtDecimal(uint a, uint b, uint decimals) internal {\n        if (a <= b) {\n            emit log(\"Error: a > b not satisfied [decimal uint]\");\n            emit log_named_decimal_uint(\"  Value a\", a, decimals);\n            emit log_named_decimal_uint(\"  Value b\", b, decimals);\n            fail();\n        }\n    }\n    function assertGtDecimal(uint a, uint b, uint decimals, string memory err) internal {\n        if (a <= b) {\n            emit log_named_string(\"Error\", err);\n            assertGtDecimal(a, b, decimals);\n        }\n    }\n\n    function assertGe(uint a, uint b) internal {\n        if (a < b) {\n            emit log(\"Error: a >= b not satisfied [uint]\");\n            emit log_named_uint(\"  Value a\", a);\n            emit log_named_uint(\"  Value b\", b);\n            fail();\n        }\n    }\n    function assertGe(uint a, uint b, string memory err) internal {\n        if (a < b) {\n            emit log_named_string(\"Error\", err);\n            assertGe(a, b);\n        }\n    }\n    function assertGe(int a, int b) internal {\n        if (a < b) {\n            emit log(\"Error: a >= b not satisfied [int]\");\n            emit log_named_int(\"  Value a\", a);\n            emit log_named_int(\"  Value b\", b);\n            fail();\n        }\n    }\n    function assertGe(int a, int b, string memory err) internal {\n        if (a < b) {\n            emit log_named_string(\"Error\", err);\n            assertGe(a, b);\n        }\n    }\n    function assertGeDecimal(int a, int b, uint decimals) internal {\n        if (a < b) {\n            emit log(\"Error: a >= b not satisfied [decimal int]\");\n            emit log_named_decimal_int(\"  Value a\", a, decimals);\n            emit log_named_decimal_int(\"  Value b\", b, decimals);\n            fail();\n        }\n    }\n    function assertGeDecimal(int a, int b, uint decimals, string memory err) internal {\n        if (a < b) {\n            emit log_named_string(\"Error\", err);\n            assertGeDecimal(a, b, decimals);\n        }\n    }\n    function assertGeDecimal(uint a, uint b, uint decimals) internal {\n        if (a < b) {\n            emit log(\"Error: a >= b not satisfied [decimal uint]\");\n            emit log_named_decimal_uint(\"  Value a\", a, decimals);\n            emit log_named_decimal_uint(\"  Value b\", b, decimals);\n            fail();\n        }\n    }\n    function assertGeDecimal(uint a, uint b, uint decimals, string memory err) internal {\n        if (a < b) {\n            emit log_named_string(\"Error\", err);\n            assertGeDecimal(a, b, decimals);\n        }\n    }\n\n    function assertLt(uint a, uint b) internal {\n        if (a >= b) {\n            emit log(\"Error: a < b not satisfied [uint]\");\n            emit log_named_uint(\"  Value a\", a);\n            emit log_named_uint(\"  Value b\", b);\n            fail();\n        }\n    }\n    function assertLt(uint a, uint b, string memory err) internal {\n        if (a >= b) {\n            emit log_named_string(\"Error\", err);\n            assertLt(a, b);\n        }\n    }\n    function assertLt(int a, int b) internal {\n        if (a >= b) {\n            emit log(\"Error: a < b not satisfied [int]\");\n            emit log_named_int(\"  Value a\", a);\n            emit log_named_int(\"  Value b\", b);\n            fail();\n        }\n    }\n    function assertLt(int a, int b, string memory err) internal {\n        if (a >= b) {\n            emit log_named_string(\"Error\", err);\n            assertLt(a, b);\n        }\n    }\n    function assertLtDecimal(int a, int b, uint decimals) internal {\n        if (a >= b) {\n            emit log(\"Error: a < b not satisfied [decimal int]\");\n            emit log_named_decimal_int(\"  Value a\", a, decimals);\n            emit log_named_decimal_int(\"  Value b\", b, decimals);\n            fail();\n        }\n    }\n    function assertLtDecimal(int a, int b, uint decimals, string memory err) internal {\n        if (a >= b) {\n            emit log_named_string(\"Error\", err);\n            assertLtDecimal(a, b, decimals);\n        }\n    }\n    function assertLtDecimal(uint a, uint b, uint decimals) internal {\n        if (a >= b) {\n            emit log(\"Error: a < b not satisfied [decimal uint]\");\n            emit log_named_decimal_uint(\"  Value a\", a, decimals);\n            emit log_named_decimal_uint(\"  Value b\", b, decimals);\n            fail();\n        }\n    }\n    function assertLtDecimal(uint a, uint b, uint decimals, string memory err) internal {\n        if (a >= b) {\n            emit log_named_string(\"Error\", err);\n            assertLtDecimal(a, b, decimals);\n        }\n    }\n\n    function assertLe(uint a, uint b) internal {\n        if (a > b) {\n            emit log(\"Error: a <= b not satisfied [uint]\");\n            emit log_named_uint(\"  Value a\", a);\n            emit log_named_uint(\"  Value b\", b);\n            fail();\n        }\n    }\n    function assertLe(uint a, uint b, string memory err) internal {\n        if (a > b) {\n            emit log_named_string(\"Error\", err);\n            assertLe(a, b);\n        }\n    }\n    function assertLe(int a, int b) internal {\n        if (a > b) {\n            emit log(\"Error: a <= b not satisfied [int]\");\n            emit log_named_int(\"  Value a\", a);\n            emit log_named_int(\"  Value b\", b);\n            fail();\n        }\n    }\n    function assertLe(int a, int b, string memory err) internal {\n        if (a > b) {\n            emit log_named_string(\"Error\", err);\n            assertLe(a, b);\n        }\n    }\n    function assertLeDecimal(int a, int b, uint decimals) internal {\n        if (a > b) {\n            emit log(\"Error: a <= b not satisfied [decimal int]\");\n            emit log_named_decimal_int(\"  Value a\", a, decimals);\n            emit log_named_decimal_int(\"  Value b\", b, decimals);\n            fail();\n        }\n    }\n    function assertLeDecimal(int a, int b, uint decimals, string memory err) internal {\n        if (a > b) {\n            emit log_named_string(\"Error\", err);\n            assertLeDecimal(a, b, decimals);\n        }\n    }\n    function assertLeDecimal(uint a, uint b, uint decimals) internal {\n        if (a > b) {\n            emit log(\"Error: a <= b not satisfied [decimal uint]\");\n            emit log_named_decimal_uint(\"  Value a\", a, decimals);\n            emit log_named_decimal_uint(\"  Value b\", b, decimals);\n            fail();\n        }\n    }\n    function assertLeDecimal(uint a, uint b, uint decimals, string memory err) internal {\n        if (a > b) {\n            emit log_named_string(\"Error\", err);\n            assertGeDecimal(a, b, decimals);\n        }\n    }\n\n    function assertEq(string memory a, string memory b) internal {\n        if (keccak256(abi.encodePacked(a)) != keccak256(abi.encodePacked(b))) {\n            emit log(\"Error: a == b not satisfied [string]\");\n            emit log_named_string(\"  Expected\", b);\n            emit log_named_string(\"    Actual\", a);\n            fail();\n        }\n    }\n    function assertEq(string memory a, string memory b, string memory err) internal {\n        if (keccak256(abi.encodePacked(a)) != keccak256(abi.encodePacked(b))) {\n            emit log_named_string(\"Error\", err);\n            assertEq(a, b);\n        }\n    }\n\n    function checkEq0(bytes memory a, bytes memory b) internal pure returns (bool ok) {\n        ok = true;\n        if (a.length == b.length) {\n            for (uint i = 0; i < a.length; i++) {\n                if (a[i] != b[i]) {\n                    ok = false;\n                }\n            }\n        } else {\n            ok = false;\n        }\n    }\n    function assertEq0(bytes memory a, bytes memory b) internal {\n        if (!checkEq0(a, b)) {\n            emit log(\"Error: a == b not satisfied [bytes]\");\n            emit log_named_bytes(\"  Expected\", b);\n            emit log_named_bytes(\"    Actual\", a);\n            fail();\n        }\n    }\n    function assertEq0(bytes memory a, bytes memory b, string memory err) internal {\n        if (!checkEq0(a, b)) {\n            emit log_named_string(\"Error\", err);\n            assertEq0(a, b);\n        }\n    }\n}\n"
      },
      "lib/forge-std/src/console.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.22 <0.9.0;\n\nlibrary console {\n    address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);\n\n    function _sendLogPayload(bytes memory payload) private view {\n        uint256 payloadLength = payload.length;\n        address consoleAddress = CONSOLE_ADDRESS;\n        /// @solidity memory-safe-assembly\n        assembly {\n            let payloadStart := add(payload, 32)\n            let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0)\n        }\n    }\n\n    function log() internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log()\"));\n    }\n\n    function logInt(int p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(int)\", p0));\n    }\n\n    function logUint(uint p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint)\", p0));\n    }\n\n    function logString(string memory p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n    }\n\n    function logBool(bool p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n    }\n\n    function logAddress(address p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n    }\n\n    function logBytes(bytes memory p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes)\", p0));\n    }\n\n    function logBytes1(bytes1 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes1)\", p0));\n    }\n\n    function logBytes2(bytes2 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes2)\", p0));\n    }\n\n    function logBytes3(bytes3 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes3)\", p0));\n    }\n\n    function logBytes4(bytes4 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes4)\", p0));\n    }\n\n    function logBytes5(bytes5 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes5)\", p0));\n    }\n\n    function logBytes6(bytes6 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes6)\", p0));\n    }\n\n    function logBytes7(bytes7 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes7)\", p0));\n    }\n\n    function logBytes8(bytes8 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes8)\", p0));\n    }\n\n    function logBytes9(bytes9 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes9)\", p0));\n    }\n\n    function logBytes10(bytes10 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes10)\", p0));\n    }\n\n    function logBytes11(bytes11 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes11)\", p0));\n    }\n\n    function logBytes12(bytes12 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes12)\", p0));\n    }\n\n    function logBytes13(bytes13 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes13)\", p0));\n    }\n\n    function logBytes14(bytes14 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes14)\", p0));\n    }\n\n    function logBytes15(bytes15 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes15)\", p0));\n    }\n\n    function logBytes16(bytes16 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes16)\", p0));\n    }\n\n    function logBytes17(bytes17 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes17)\", p0));\n    }\n\n    function logBytes18(bytes18 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes18)\", p0));\n    }\n\n    function logBytes19(bytes19 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes19)\", p0));\n    }\n\n    function logBytes20(bytes20 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes20)\", p0));\n    }\n\n    function logBytes21(bytes21 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes21)\", p0));\n    }\n\n    function logBytes22(bytes22 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes22)\", p0));\n    }\n\n    function logBytes23(bytes23 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes23)\", p0));\n    }\n\n    function logBytes24(bytes24 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes24)\", p0));\n    }\n\n    function logBytes25(bytes25 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes25)\", p0));\n    }\n\n    function logBytes26(bytes26 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes26)\", p0));\n    }\n\n    function logBytes27(bytes27 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes27)\", p0));\n    }\n\n    function logBytes28(bytes28 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes28)\", p0));\n    }\n\n    function logBytes29(bytes29 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes29)\", p0));\n    }\n\n    function logBytes30(bytes30 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes30)\", p0));\n    }\n\n    function logBytes31(bytes31 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes31)\", p0));\n    }\n\n    function logBytes32(bytes32 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes32)\", p0));\n    }\n\n    function log(uint p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint)\", p0));\n    }\n\n    function log(string memory p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n    }\n\n    function log(bool p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n    }\n\n    function log(address p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n    }\n\n    function log(uint p0, uint p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint)\", p0, p1));\n    }\n\n    function log(uint p0, string memory p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string)\", p0, p1));\n    }\n\n    function log(uint p0, bool p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool)\", p0, p1));\n    }\n\n    function log(uint p0, address p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address)\", p0, p1));\n    }\n\n    function log(string memory p0, uint p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint)\", p0, p1));\n    }\n\n    function log(string memory p0, string memory p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string)\", p0, p1));\n    }\n\n    function log(string memory p0, bool p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool)\", p0, p1));\n    }\n\n    function log(string memory p0, address p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address)\", p0, p1));\n    }\n\n    function log(bool p0, uint p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint)\", p0, p1));\n    }\n\n    function log(bool p0, string memory p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string)\", p0, p1));\n    }\n\n    function log(bool p0, bool p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool)\", p0, p1));\n    }\n\n    function log(bool p0, address p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address)\", p0, p1));\n    }\n\n    function log(address p0, uint p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint)\", p0, p1));\n    }\n\n    function log(address p0, string memory p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string)\", p0, p1));\n    }\n\n    function log(address p0, bool p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool)\", p0, p1));\n    }\n\n    function log(address p0, address p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address)\", p0, p1));\n    }\n\n    function log(uint p0, uint p1, uint p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint)\", p0, p1, p2));\n    }\n\n    function log(uint p0, uint p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string)\", p0, p1, p2));\n    }\n\n    function log(uint p0, uint p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool)\", p0, p1, p2));\n    }\n\n    function log(uint p0, uint p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address)\", p0, p1, p2));\n    }\n\n    function log(uint p0, string memory p1, uint p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint)\", p0, p1, p2));\n    }\n\n    function log(uint p0, string memory p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string)\", p0, p1, p2));\n    }\n\n    function log(uint p0, string memory p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool)\", p0, p1, p2));\n    }\n\n    function log(uint p0, string memory p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address)\", p0, p1, p2));\n    }\n\n    function log(uint p0, bool p1, uint p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint)\", p0, p1, p2));\n    }\n\n    function log(uint p0, bool p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string)\", p0, p1, p2));\n    }\n\n    function log(uint p0, bool p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool)\", p0, p1, p2));\n    }\n\n    function log(uint p0, bool p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address)\", p0, p1, p2));\n    }\n\n    function log(uint p0, address p1, uint p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint)\", p0, p1, p2));\n    }\n\n    function log(uint p0, address p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string)\", p0, p1, p2));\n    }\n\n    function log(uint p0, address p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool)\", p0, p1, p2));\n    }\n\n    function log(uint p0, address p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, uint p1, uint p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, uint p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, uint p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, uint p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, string memory p1, uint p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, string memory p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, string memory p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, string memory p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, bool p1, uint p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, bool p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, bool p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, bool p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, address p1, uint p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, address p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, address p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, address p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address)\", p0, p1, p2));\n    }\n\n    function log(bool p0, uint p1, uint p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint)\", p0, p1, p2));\n    }\n\n    function log(bool p0, uint p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string)\", p0, p1, p2));\n    }\n\n    function log(bool p0, uint p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool)\", p0, p1, p2));\n    }\n\n    function log(bool p0, uint p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address)\", p0, p1, p2));\n    }\n\n    function log(bool p0, string memory p1, uint p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint)\", p0, p1, p2));\n    }\n\n    function log(bool p0, string memory p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string)\", p0, p1, p2));\n    }\n\n    function log(bool p0, string memory p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool)\", p0, p1, p2));\n    }\n\n    function log(bool p0, string memory p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address)\", p0, p1, p2));\n    }\n\n    function log(bool p0, bool p1, uint p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint)\", p0, p1, p2));\n    }\n\n    function log(bool p0, bool p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string)\", p0, p1, p2));\n    }\n\n    function log(bool p0, bool p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool)\", p0, p1, p2));\n    }\n\n    function log(bool p0, bool p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address)\", p0, p1, p2));\n    }\n\n    function log(bool p0, address p1, uint p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint)\", p0, p1, p2));\n    }\n\n    function log(bool p0, address p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string)\", p0, p1, p2));\n    }\n\n    function log(bool p0, address p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool)\", p0, p1, p2));\n    }\n\n    function log(bool p0, address p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address)\", p0, p1, p2));\n    }\n\n    function log(address p0, uint p1, uint p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint)\", p0, p1, p2));\n    }\n\n    function log(address p0, uint p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string)\", p0, p1, p2));\n    }\n\n    function log(address p0, uint p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool)\", p0, p1, p2));\n    }\n\n    function log(address p0, uint p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address)\", p0, p1, p2));\n    }\n\n    function log(address p0, string memory p1, uint p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint)\", p0, p1, p2));\n    }\n\n    function log(address p0, string memory p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string)\", p0, p1, p2));\n    }\n\n    function log(address p0, string memory p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool)\", p0, p1, p2));\n    }\n\n    function log(address p0, string memory p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address)\", p0, p1, p2));\n    }\n\n    function log(address p0, bool p1, uint p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint)\", p0, p1, p2));\n    }\n\n    function log(address p0, bool p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string)\", p0, p1, p2));\n    }\n\n    function log(address p0, bool p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool)\", p0, p1, p2));\n    }\n\n    function log(address p0, bool p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address)\", p0, p1, p2));\n    }\n\n    function log(address p0, address p1, uint p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint)\", p0, p1, p2));\n    }\n\n    function log(address p0, address p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string)\", p0, p1, p2));\n    }\n\n    function log(address p0, address p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool)\", p0, p1, p2));\n    }\n\n    function log(address p0, address p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address)\", p0, p1, p2));\n    }\n\n    function log(uint p0, uint p1, uint p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, uint p1, uint p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, uint p1, uint p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, uint p1, uint p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,uint,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, uint p1, string memory p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, uint p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, uint p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, uint p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, uint p1, bool p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, uint p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, uint p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, uint p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, uint p1, address p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, uint p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, uint p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, uint p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, string memory p1, uint p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, string memory p1, uint p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, string memory p1, uint p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, string memory p1, uint p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,uint,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, string memory p1, string memory p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, string memory p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, string memory p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, string memory p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, string memory p1, bool p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, string memory p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, string memory p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, string memory p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, string memory p1, address p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, string memory p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, string memory p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, string memory p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, bool p1, uint p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, bool p1, uint p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, bool p1, uint p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, bool p1, uint p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,uint,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, bool p1, string memory p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, bool p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, bool p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, bool p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, bool p1, bool p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, bool p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, bool p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, bool p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, bool p1, address p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, bool p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, bool p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, bool p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, address p1, uint p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, address p1, uint p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, address p1, uint p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, address p1, uint p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,uint,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, address p1, string memory p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, address p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, address p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, address p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, address p1, bool p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, address p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, address p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, address p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, address p1, address p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, address p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, address p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint p0, address p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint p1, uint p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint p1, uint p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint p1, uint p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint p1, uint p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,uint,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint p1, string memory p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint p1, bool p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint p1, address p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, uint p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, uint p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, uint p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, uint p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, string memory p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, bool p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, address p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, uint p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, uint p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, uint p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, uint p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, string memory p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, bool p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, address p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, uint p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, uint p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, uint p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, uint p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, string memory p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, bool p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, address p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint p1, uint p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint p1, uint p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint p1, uint p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint p1, uint p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,uint,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint p1, string memory p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint p1, bool p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint p1, address p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, uint p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, uint p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, uint p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, uint p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, string memory p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, bool p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, address p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, uint p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, uint p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, uint p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, uint p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, string memory p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, bool p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, address p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, uint p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, uint p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, uint p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, uint p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, string memory p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, bool p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, address p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint p1, uint p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint p1, uint p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint p1, uint p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint p1, uint p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,uint,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint p1, string memory p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint p1, bool p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint p1, address p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, uint p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, uint p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, uint p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, uint p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, string memory p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, bool p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, address p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, uint p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, uint p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, uint p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, uint p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, string memory p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, bool p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, address p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, uint p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, uint p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, uint p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, uint p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, string memory p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, bool p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, address p2, uint p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,uint)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,address)\", p0, p1, p2, p3));\n    }\n\n}"
      },
      "lib/forge-std/src/console2.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.22 <0.9.0;\n\n// The orignal console.sol uses `int` and `uint` for computing function selectors, but it should\n// use `int256` and `uint256`. This modified version fixes that. This version is recommended\n// over `console.sol` if you don't need compatibility with Hardhat as the logs will show up in\n// forge stack traces. If you do need compatibility with Hardhat, you must use `console.sol`.\n// Reference: https://github.com/NomicFoundation/hardhat/issues/2178\n\nlibrary console2 {\n    address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);\n\n    function _sendLogPayload(bytes memory payload) private view {\n        uint256 payloadLength = payload.length;\n        address consoleAddress = CONSOLE_ADDRESS;\n        assembly {\n            let payloadStart := add(payload, 32)\n            let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0)\n        }\n    }\n\n    function log() internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log()\"));\n    }\n\n    function logInt(int256 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(int256)\", p0));\n    }\n\n    function logUint(uint256 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256)\", p0));\n    }\n\n    function logString(string memory p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n    }\n\n    function logBool(bool p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n    }\n\n    function logAddress(address p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n    }\n\n    function logBytes(bytes memory p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes)\", p0));\n    }\n\n    function logBytes1(bytes1 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes1)\", p0));\n    }\n\n    function logBytes2(bytes2 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes2)\", p0));\n    }\n\n    function logBytes3(bytes3 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes3)\", p0));\n    }\n\n    function logBytes4(bytes4 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes4)\", p0));\n    }\n\n    function logBytes5(bytes5 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes5)\", p0));\n    }\n\n    function logBytes6(bytes6 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes6)\", p0));\n    }\n\n    function logBytes7(bytes7 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes7)\", p0));\n    }\n\n    function logBytes8(bytes8 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes8)\", p0));\n    }\n\n    function logBytes9(bytes9 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes9)\", p0));\n    }\n\n    function logBytes10(bytes10 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes10)\", p0));\n    }\n\n    function logBytes11(bytes11 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes11)\", p0));\n    }\n\n    function logBytes12(bytes12 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes12)\", p0));\n    }\n\n    function logBytes13(bytes13 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes13)\", p0));\n    }\n\n    function logBytes14(bytes14 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes14)\", p0));\n    }\n\n    function logBytes15(bytes15 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes15)\", p0));\n    }\n\n    function logBytes16(bytes16 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes16)\", p0));\n    }\n\n    function logBytes17(bytes17 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes17)\", p0));\n    }\n\n    function logBytes18(bytes18 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes18)\", p0));\n    }\n\n    function logBytes19(bytes19 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes19)\", p0));\n    }\n\n    function logBytes20(bytes20 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes20)\", p0));\n    }\n\n    function logBytes21(bytes21 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes21)\", p0));\n    }\n\n    function logBytes22(bytes22 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes22)\", p0));\n    }\n\n    function logBytes23(bytes23 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes23)\", p0));\n    }\n\n    function logBytes24(bytes24 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes24)\", p0));\n    }\n\n    function logBytes25(bytes25 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes25)\", p0));\n    }\n\n    function logBytes26(bytes26 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes26)\", p0));\n    }\n\n    function logBytes27(bytes27 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes27)\", p0));\n    }\n\n    function logBytes28(bytes28 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes28)\", p0));\n    }\n\n    function logBytes29(bytes29 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes29)\", p0));\n    }\n\n    function logBytes30(bytes30 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes30)\", p0));\n    }\n\n    function logBytes31(bytes31 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes31)\", p0));\n    }\n\n    function logBytes32(bytes32 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes32)\", p0));\n    }\n\n    function log(uint256 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256)\", p0));\n    }\n\n    function log(string memory p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n    }\n\n    function log(bool p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n    }\n\n    function log(address p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n    }\n\n    function log(uint256 p0, uint256 p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256)\", p0, p1));\n    }\n\n    function log(uint256 p0, string memory p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string)\", p0, p1));\n    }\n\n    function log(uint256 p0, bool p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool)\", p0, p1));\n    }\n\n    function log(uint256 p0, address p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address)\", p0, p1));\n    }\n\n    function log(string memory p0, uint256 p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256)\", p0, p1));\n    }\n\n    function log(string memory p0, string memory p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string)\", p0, p1));\n    }\n\n    function log(string memory p0, bool p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool)\", p0, p1));\n    }\n\n    function log(string memory p0, address p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address)\", p0, p1));\n    }\n\n    function log(bool p0, uint256 p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256)\", p0, p1));\n    }\n\n    function log(bool p0, string memory p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string)\", p0, p1));\n    }\n\n    function log(bool p0, bool p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool)\", p0, p1));\n    }\n\n    function log(bool p0, address p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address)\", p0, p1));\n    }\n\n    function log(address p0, uint256 p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256)\", p0, p1));\n    }\n\n    function log(address p0, string memory p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string)\", p0, p1));\n    }\n\n    function log(address p0, bool p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool)\", p0, p1));\n    }\n\n    function log(address p0, address p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address)\", p0, p1));\n    }\n\n    function log(uint256 p0, uint256 p1, uint256 p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, uint256 p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, uint256 p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, uint256 p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, string memory p1, uint256 p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, string memory p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, string memory p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, string memory p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, bool p1, uint256 p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, bool p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, bool p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, bool p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, address p1, uint256 p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, address p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, address p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, address p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, uint256 p1, uint256 p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, uint256 p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, uint256 p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, uint256 p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, string memory p1, uint256 p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, string memory p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, string memory p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, string memory p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, bool p1, uint256 p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, bool p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, bool p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, bool p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, address p1, uint256 p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, address p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, address p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, address p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address)\", p0, p1, p2));\n    }\n\n    function log(bool p0, uint256 p1, uint256 p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256)\", p0, p1, p2));\n    }\n\n    function log(bool p0, uint256 p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string)\", p0, p1, p2));\n    }\n\n    function log(bool p0, uint256 p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool)\", p0, p1, p2));\n    }\n\n    function log(bool p0, uint256 p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address)\", p0, p1, p2));\n    }\n\n    function log(bool p0, string memory p1, uint256 p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256)\", p0, p1, p2));\n    }\n\n    function log(bool p0, string memory p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string)\", p0, p1, p2));\n    }\n\n    function log(bool p0, string memory p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool)\", p0, p1, p2));\n    }\n\n    function log(bool p0, string memory p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address)\", p0, p1, p2));\n    }\n\n    function log(bool p0, bool p1, uint256 p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256)\", p0, p1, p2));\n    }\n\n    function log(bool p0, bool p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string)\", p0, p1, p2));\n    }\n\n    function log(bool p0, bool p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool)\", p0, p1, p2));\n    }\n\n    function log(bool p0, bool p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address)\", p0, p1, p2));\n    }\n\n    function log(bool p0, address p1, uint256 p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256)\", p0, p1, p2));\n    }\n\n    function log(bool p0, address p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string)\", p0, p1, p2));\n    }\n\n    function log(bool p0, address p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool)\", p0, p1, p2));\n    }\n\n    function log(bool p0, address p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address)\", p0, p1, p2));\n    }\n\n    function log(address p0, uint256 p1, uint256 p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256)\", p0, p1, p2));\n    }\n\n    function log(address p0, uint256 p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string)\", p0, p1, p2));\n    }\n\n    function log(address p0, uint256 p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool)\", p0, p1, p2));\n    }\n\n    function log(address p0, uint256 p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address)\", p0, p1, p2));\n    }\n\n    function log(address p0, string memory p1, uint256 p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256)\", p0, p1, p2));\n    }\n\n    function log(address p0, string memory p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string)\", p0, p1, p2));\n    }\n\n    function log(address p0, string memory p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool)\", p0, p1, p2));\n    }\n\n    function log(address p0, string memory p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address)\", p0, p1, p2));\n    }\n\n    function log(address p0, bool p1, uint256 p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256)\", p0, p1, p2));\n    }\n\n    function log(address p0, bool p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string)\", p0, p1, p2));\n    }\n\n    function log(address p0, bool p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool)\", p0, p1, p2));\n    }\n\n    function log(address p0, bool p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address)\", p0, p1, p2));\n    }\n\n    function log(address p0, address p1, uint256 p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256)\", p0, p1, p2));\n    }\n\n    function log(address p0, address p1, string memory p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string)\", p0, p1, p2));\n    }\n\n    function log(address p0, address p1, bool p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool)\", p0, p1, p2));\n    }\n\n    function log(address p0, address p1, address p2) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, uint256 p1, uint256 p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, uint256 p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, uint256 p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, uint256 p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, string memory p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, bool p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, address p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, uint256 p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, uint256 p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, uint256 p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, uint256 p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, string memory p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, bool p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, address p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, uint256 p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, uint256 p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, uint256 p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, uint256 p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, string memory p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, bool p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, address p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, uint256 p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, uint256 p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, uint256 p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, uint256 p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, string memory p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, bool p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, address p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, uint256 p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, uint256 p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, uint256 p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, uint256 p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, string memory p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, bool p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, address p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, uint256 p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, uint256 p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, uint256 p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, uint256 p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, string memory p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, bool p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, address p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, uint256 p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, uint256 p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, uint256 p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, uint256 p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, string memory p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, bool p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, address p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, uint256 p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, uint256 p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, uint256 p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, uint256 p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, string memory p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, bool p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, address p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, uint256 p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, uint256 p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, uint256 p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, uint256 p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, string memory p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, bool p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, address p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, uint256 p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, uint256 p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, uint256 p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, uint256 p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, string memory p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, bool p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, address p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, uint256 p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, uint256 p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, uint256 p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, uint256 p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, string memory p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, bool p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, address p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, uint256 p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, uint256 p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, uint256 p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, uint256 p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, string memory p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, bool p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, address p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, uint256 p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, uint256 p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, uint256 p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, uint256 p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, string memory p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, bool p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, address p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, uint256 p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, uint256 p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, uint256 p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, uint256 p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, string memory p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, bool p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, address p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, uint256 p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, uint256 p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, uint256 p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, uint256 p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, string memory p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, bool p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, address p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, uint256 p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, uint256 p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, uint256 p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, uint256 p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, string memory p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, string memory p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, string memory p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, string memory p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, bool p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, bool p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, bool p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, bool p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, address p2, uint256 p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, address p2, string memory p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, address p2, bool p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, address p2, address p3) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,address)\", p0, p1, p2, p3));\n    }\n\n}"
      },
      "lib/forge-std/src/Script.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.0 <0.9.0;\n\nimport \"./console.sol\";\nimport \"./console2.sol\";\nimport \"./StdJson.sol\";\n\nabstract contract Script {\n    bool public IS_SCRIPT = true;\n    address constant private VM_ADDRESS =\n        address(bytes20(uint160(uint256(keccak256('hevm cheat code')))));\n\n    Vm public constant vm = Vm(VM_ADDRESS);\n\n    /// @dev Compute the address a contract will be deployed at for a given deployer address and nonce\n    /// @notice adapated from Solmate implementation (https://github.com/transmissions11/solmate/blob/main/src/utils/LibRLP.sol)\n    function computeCreateAddress(address deployer, uint256 nonce) internal pure returns (address) {\n        // The integer zero is treated as an empty byte string, and as a result it only has a length prefix, 0x80, computed via 0x80 + 0.\n        // A one byte integer uses its own value as its length prefix, there is no additional \"0x80 + length\" prefix that comes before it.\n        if (nonce == 0x00)             return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd6), bytes1(0x94), deployer, bytes1(0x80))));\n        if (nonce <= 0x7f)             return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd6), bytes1(0x94), deployer, uint8(nonce))));\n\n        // Nonces greater than 1 byte all follow a consistent encoding scheme, where each value is preceded by a prefix of 0x80 + length.\n        if (nonce <= 2**8 - 1)  return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd7), bytes1(0x94), deployer, bytes1(0x81), uint8(nonce))));\n        if (nonce <= 2**16 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd8), bytes1(0x94), deployer, bytes1(0x82), uint16(nonce))));\n        if (nonce <= 2**24 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd9), bytes1(0x94), deployer, bytes1(0x83), uint24(nonce))));\n\n        // More details about RLP encoding can be found here: https://eth.wiki/fundamentals/rlp\n        // 0xda = 0xc0 (short RLP prefix) + 0x16 (length of: 0x94 ++ proxy ++ 0x84 ++ nonce)\n        // 0x94 = 0x80 + 0x14 (0x14 = the length of an address, 20 bytes, in hex)\n        // 0x84 = 0x80 + 0x04 (0x04 = the bytes length of the nonce, 4 bytes, in hex)\n        // We assume nobody can have a nonce large enough to require more than 32 bytes.\n        return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xda), bytes1(0x94), deployer, bytes1(0x84), uint32(nonce))));\n    }\n\n    function addressFromLast20Bytes(bytes32 bytesValue) internal pure returns (address) {\n        return address(uint160(uint256(bytesValue)));\n    }\n\n    function deriveRememberKey(string memory mnemonic, uint32 index) internal returns (address who, uint256 privateKey) {\n        privateKey = vm.deriveKey(mnemonic, index);\n        who = vm.rememberKey(privateKey);\n    }\n}\n"
      },
      "lib/forge-std/src/StdJson.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.0 <0.9.0;\npragma experimental ABIEncoderV2;\n\nimport \"./Vm.sol\";\n\n// Helpers for parsing keys into types.\nlibrary stdJson {\n\n    Vm private constant vm = Vm(address(uint160(uint256(keccak256(\"hevm cheat code\")))));\n\n    function parseRaw(string memory json, string memory key)\n        internal\n        returns (bytes memory)\n    {\n        return vm.parseJson(json, key);\n    }\n\n    function readUint(string memory json, string memory key)\n        internal\n        returns (uint256)\n    {\n        return abi.decode(vm.parseJson(json, key), (uint256));\n    }\n\n    function readUintArray(string memory json, string memory key)\n        internal\n        returns (uint256[] memory)\n    {\n        return abi.decode(vm.parseJson(json, key), (uint256[]));\n    }\n\n    function readInt(string memory json, string memory key)\n        internal\n        returns (int256)\n    {\n        return abi.decode(vm.parseJson(json, key), (int256));\n    }\n\n    function readIntArray(string memory json, string memory key)\n        internal\n        returns (int256[] memory)\n    {\n        return abi.decode(vm.parseJson(json, key), (int256[]));\n    }\n\n    function readBytes32(string memory json, string memory key)\n        internal\n        returns (bytes32)\n    {\n        return abi.decode(vm.parseJson(json, key), (bytes32));\n    }\n\n    function readBytes32Array(string memory json, string memory key)\n        internal\n        returns (bytes32[] memory)\n    {\n        return abi.decode(vm.parseJson(json, key), (bytes32[]));\n    }\n\n    function readString(string memory json, string memory key)\n        internal\n        returns (string memory)\n    {\n        return abi.decode(vm.parseJson(json, key), (string));\n    }\n\n    function readStringArray(string memory json, string memory key)\n        internal\n        returns (string[] memory)\n    {\n        return abi.decode(vm.parseJson(json, key), (string[]));\n    }\n\n    function readAddress(string memory json, string memory key)\n        internal\n        returns (address)\n    {\n        return abi.decode(vm.parseJson(json, key), (address));\n    }\n\n    function readAddressArray(string memory json, string memory key)\n        internal\n        returns (address[] memory)\n    {\n        return abi.decode(vm.parseJson(json, key), (address[]));\n    }\n\n    function readBool(string memory json, string memory key)\n        internal\n        returns (bool)\n    {\n        return abi.decode(vm.parseJson(json, key), (bool));\n    }\n\n    function readBoolArray(string memory json, string memory key)\n        internal\n        returns (bool[] memory)\n    {\n        return abi.decode(vm.parseJson(json, key), (bool[]));\n    }\n\n    function readBytes(string memory json, string memory key)\n        internal\n        returns (bytes memory)\n    {\n        return abi.decode(vm.parseJson(json, key), (bytes));\n    }\n\n    function readBytesArray(string memory json, string memory key)\n        internal\n        returns (bytes[] memory)\n    {\n        return abi.decode(vm.parseJson(json, key), (bytes[]));\n    }\n\n\n}\n"
      },
      "lib/forge-std/src/Test.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.0 <0.9.0;\npragma experimental ABIEncoderV2;\n\nimport \"./Script.sol\";\nimport \"lib/forge-std/lib/ds-test/src/test.sol\";\n\n// Wrappers around Cheatcodes to avoid footguns\nabstract contract Test is DSTest, Script {\n    using stdStorage for StdStorage;\n\n    uint256 internal constant UINT256_MAX =\n        115792089237316195423570985008687907853269984665640564039457584007913129639935;\n\n    StdStorage internal stdstore;\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                    STD-LOGS\n    //////////////////////////////////////////////////////////////////////////*/\n\n    event log_array(uint256[] val);\n    event log_array(int256[] val);\n    event log_array(address[] val);\n    event log_named_array(string key, uint256[] val);\n    event log_named_array(string key, int256[] val);\n    event log_named_array(string key, address[] val);\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                    STD-CHEATS\n    //////////////////////////////////////////////////////////////////////////*/\n\n    // Skip forward or rewind time by the specified number of seconds\n    function skip(uint256 time) internal {\n        vm.warp(block.timestamp + time);\n    }\n\n    function rewind(uint256 time) internal {\n        vm.warp(block.timestamp - time);\n    }\n\n    // Setup a prank from an address that has some ether\n    function hoax(address who) internal {\n        vm.deal(who, 1 << 128);\n        vm.prank(who);\n    }\n\n    function hoax(address who, uint256 give) internal {\n        vm.deal(who, give);\n        vm.prank(who);\n    }\n\n    function hoax(address who, address origin) internal {\n        vm.deal(who, 1 << 128);\n        vm.prank(who, origin);\n    }\n\n    function hoax(address who, address origin, uint256 give) internal {\n        vm.deal(who, give);\n        vm.prank(who, origin);\n    }\n\n    // Start perpetual prank from an address that has some ether\n    function startHoax(address who) internal {\n        vm.deal(who, 1 << 128);\n        vm.startPrank(who);\n    }\n\n    function startHoax(address who, uint256 give) internal {\n        vm.deal(who, give);\n        vm.startPrank(who);\n    }\n\n    // Start perpetual prank from an address that has some ether\n    // tx.origin is set to the origin parameter\n    function startHoax(address who, address origin) internal {\n        vm.deal(who, 1 << 128);\n        vm.startPrank(who, origin);\n    }\n\n    function startHoax(address who, address origin, uint256 give) internal {\n        vm.deal(who, give);\n        vm.startPrank(who, origin);\n    }\n\n    function changePrank(address who) internal {\n        vm.stopPrank();\n        vm.startPrank(who);\n    }\n\n    // creates a labeled address and the corresponding private key\n    function makeAddrAndKey(string memory name) internal returns(address addr, uint256 privateKey) {\n        privateKey = uint256(keccak256(abi.encodePacked(name)));\n        addr = vm.addr(privateKey);\n        vm.label(addr, name);\n    }\n\n    // creates a labeled address\n    function makeAddr(string memory name) internal returns(address addr) {\n        (addr,) = makeAddrAndKey(name);\n    }\n\n    // DEPRECATED: Use `deal` instead\n    function tip(address token, address to, uint256 give) internal {\n        emit log_named_string(\"WARNING\", \"Test tip(address,address,uint256): The `tip` stdcheat has been deprecated. Use `deal` instead.\");\n        stdstore\n            .target(token)\n            .sig(0x70a08231)\n            .with_key(to)\n            .checked_write(give);\n    }\n\n    // The same as Vm's `deal`\n    // Use the alternative signature for ERC20 tokens\n    function deal(address to, uint256 give) internal {\n        vm.deal(to, give);\n    }\n\n    // Set the balance of an account for any ERC20 token\n    // Use the alternative signature to update `totalSupply`\n    function deal(address token, address to, uint256 give) internal {\n        deal(token, to, give, false);\n    }\n\n    function deal(address token, address to, uint256 give, bool adjust) internal {\n        // get current balance\n        (, bytes memory balData) = token.call(abi.encodeWithSelector(0x70a08231, to));\n        uint256 prevBal = abi.decode(balData, (uint256));\n\n        // update balance\n        stdstore\n            .target(token)\n            .sig(0x70a08231)\n            .with_key(to)\n            .checked_write(give);\n\n        // update total supply\n        if(adjust){\n            (, bytes memory totSupData) = token.call(abi.encodeWithSelector(0x18160ddd));\n            uint256 totSup = abi.decode(totSupData, (uint256));\n            if(give < prevBal) {\n                totSup -= (prevBal - give);\n            } else {\n                totSup += (give - prevBal);\n            }\n            stdstore\n                .target(token)\n                .sig(0x18160ddd)\n                .checked_write(totSup);\n        }\n    }\n\n    function bound(uint256 x, uint256 min, uint256 max) internal virtual returns (uint256 result) {\n        require(min <= max, \"Test bound(uint256,uint256,uint256): Max is less than min.\");\n\n        uint256 size = max - min;\n\n        if (size == 0)\n        {\n            result = min;\n        }\n        else if (size == UINT256_MAX)\n        {\n            result = x;\n        }\n        else\n        {\n            ++size; // make `max` inclusive\n            uint256 mod = x % size;\n            result = min + mod;\n        }\n\n        emit log_named_uint(\"Bound Result\", result);\n    }\n\n    // Deploy a contract by fetching the contract bytecode from\n    // the artifacts directory\n    // e.g. `deployCode(code, abi.encode(arg1,arg2,arg3))`\n    function deployCode(string memory what, bytes memory args)\n        internal\n        returns (address addr)\n    {\n        bytes memory bytecode = abi.encodePacked(vm.getCode(what), args);\n        /// @solidity memory-safe-assembly\n        assembly {\n            addr := create(0, add(bytecode, 0x20), mload(bytecode))\n        }\n\n        require(\n            addr != address(0),\n            \"Test deployCode(string,bytes): Deployment failed.\"\n        );\n    }\n\n    function deployCode(string memory what)\n        internal\n        returns (address addr)\n    {\n        bytes memory bytecode = vm.getCode(what);\n        /// @solidity memory-safe-assembly\n        assembly {\n            addr := create(0, add(bytecode, 0x20), mload(bytecode))\n        }\n\n        require(\n            addr != address(0),\n            \"Test deployCode(string): Deployment failed.\"\n        );\n    }\n\n    /// deploy contract with value on construction\n    function deployCode(string memory what, bytes memory args, uint256 val)\n        internal\n        returns (address addr)\n    {\n        bytes memory bytecode = abi.encodePacked(vm.getCode(what), args);\n        /// @solidity memory-safe-assembly\n        assembly {\n            addr := create(val, add(bytecode, 0x20), mload(bytecode))\n        }\n\n        require(\n            addr != address(0),\n            \"Test deployCode(string,bytes,uint256): Deployment failed.\"\n        );\n    }\n\n    function deployCode(string memory what, uint256 val)\n        internal\n        returns (address addr)\n    {\n        bytes memory bytecode = vm.getCode(what);\n        /// @solidity memory-safe-assembly\n        assembly {\n            addr := create(val, add(bytecode, 0x20), mload(bytecode))\n        }\n\n        require(\n            addr != address(0),\n            \"Test deployCode(string,uint256): Deployment failed.\"\n        );\n    }\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                    STD-ASSERTIONS\n    //////////////////////////////////////////////////////////////////////////*/\n\n    function fail(string memory err) internal virtual {\n        emit log_named_string(\"Error\", err);\n        fail();\n    }\n\n    function assertFalse(bool data) internal virtual {\n        assertTrue(!data);\n    }\n\n    function assertFalse(bool data, string memory err) internal virtual {\n        assertTrue(!data, err);\n    }\n\n    function assertEq(bool a, bool b) internal {\n        if (a != b) {\n            emit log                (\"Error: a == b not satisfied [bool]\");\n            emit log_named_string   (\"  Expected\", b ? \"true\" : \"false\");\n            emit log_named_string   (\"    Actual\", a ? \"true\" : \"false\");\n            fail();\n        }\n    }\n\n    function assertEq(bool a, bool b, string memory err) internal {\n        if (a != b) {\n            emit log_named_string(\"Error\", err);\n            assertEq(a, b);\n        }\n    }\n\n    function assertEq(bytes memory a, bytes memory b) internal {\n        assertEq0(a, b);\n    }\n\n    function assertEq(bytes memory a, bytes memory b, string memory err) internal {\n        assertEq0(a, b, err);\n    }\n\n    function assertEq(uint256[] memory a, uint256[] memory b) internal {\n        if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n            emit log(\"Error: a == b not satisfied [uint[]]\");\n            emit log_named_array(\"  Expected\", b);\n            emit log_named_array(\"    Actual\", a);\n            fail();\n        }\n    }\n\n    function assertEq(int256[] memory a, int256[] memory b) internal {\n        if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n            emit log(\"Error: a == b not satisfied [int[]]\");\n            emit log_named_array(\"  Expected\", b);\n            emit log_named_array(\"    Actual\", a);\n            fail();\n        }\n    }\n\n    function assertEq(address[] memory a, address[] memory b) internal {\n        if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n            emit log(\"Error: a == b not satisfied [address[]]\");\n            emit log_named_array(\"  Expected\", b);\n            emit log_named_array(\"    Actual\", a);\n            fail();\n        }\n    }\n\n    function assertEq(uint256[] memory a, uint256[] memory b, string memory err) internal {\n        if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n            emit log_named_string(\"Error\", err);\n            assertEq(a, b);\n        }\n    }\n\n    function assertEq(int256[] memory a, int256[] memory b, string memory err) internal {\n        if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n            emit log_named_string(\"Error\", err);\n            assertEq(a, b);\n        }\n    }\n\n\n    function assertEq(address[] memory a, address[] memory b, string memory err) internal {\n        if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) {\n            emit log_named_string(\"Error\", err);\n            assertEq(a, b);\n        }\n    }\n\n    function assertEqUint(uint256 a, uint256 b) internal {\n        assertEq(uint256(a), uint256(b));\n    }\n\n    function assertApproxEqAbs(\n        uint256 a,\n        uint256 b,\n        uint256 maxDelta\n    ) internal virtual {\n        uint256 delta = stdMath.delta(a, b);\n\n        if (delta > maxDelta) {\n            emit log            (\"Error: a ~= b not satisfied [uint]\");\n            emit log_named_uint (\"  Expected\", b);\n            emit log_named_uint (\"    Actual\", a);\n            emit log_named_uint (\" Max Delta\", maxDelta);\n            emit log_named_uint (\"     Delta\", delta);\n            fail();\n        }\n    }\n\n    function assertApproxEqAbs(\n        uint256 a,\n        uint256 b,\n        uint256 maxDelta,\n        string memory err\n    ) internal virtual {\n        uint256 delta = stdMath.delta(a, b);\n\n        if (delta > maxDelta) {\n            emit log_named_string   (\"Error\", err);\n            assertApproxEqAbs(a, b, maxDelta);\n        }\n    }\n\n    function assertApproxEqAbs(\n        int256 a,\n        int256 b,\n        uint256 maxDelta\n    ) internal virtual {\n        uint256 delta = stdMath.delta(a, b);\n\n        if (delta > maxDelta) {\n            emit log            (\"Error: a ~= b not satisfied [int]\");\n            emit log_named_int  (\"  Expected\", b);\n            emit log_named_int  (\"    Actual\", a);\n            emit log_named_uint (\" Max Delta\", maxDelta);\n            emit log_named_uint (\"     Delta\", delta);\n            fail();\n        }\n    }\n\n    function assertApproxEqAbs(\n        int256 a,\n        int256 b,\n        uint256 maxDelta,\n        string memory err\n    ) internal virtual {\n        uint256 delta = stdMath.delta(a, b);\n\n        if (delta > maxDelta) {\n            emit log_named_string   (\"Error\", err);\n            assertApproxEqAbs(a, b, maxDelta);\n        }\n    }\n\n    function assertApproxEqRel(\n        uint256 a,\n        uint256 b,\n        uint256 maxPercentDelta // An 18 decimal fixed point number, where 1e18 == 100%\n    ) internal virtual {\n        if (b == 0) return assertEq(a, b); // If the expected is 0, actual must be too.\n\n        uint256 percentDelta = stdMath.percentDelta(a, b);\n\n        if (percentDelta > maxPercentDelta) {\n            emit log                    (\"Error: a ~= b not satisfied [uint]\");\n            emit log_named_uint         (\"    Expected\", b);\n            emit log_named_uint         (\"      Actual\", a);\n            emit log_named_decimal_uint (\" Max % Delta\", maxPercentDelta, 18);\n            emit log_named_decimal_uint (\"     % Delta\", percentDelta, 18);\n            fail();\n        }\n    }\n\n    function assertApproxEqRel(\n        uint256 a,\n        uint256 b,\n        uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100%\n        string memory err\n    ) internal virtual {\n        if (b == 0) return assertEq(a, b, err); // If the expected is 0, actual must be too.\n\n        uint256 percentDelta = stdMath.percentDelta(a, b);\n\n        if (percentDelta > maxPercentDelta) {\n            emit log_named_string       (\"Error\", err);\n            assertApproxEqRel(a, b, maxPercentDelta);\n        }\n    }\n\n    function assertApproxEqRel(\n        int256 a,\n        int256 b,\n        uint256 maxPercentDelta\n    ) internal virtual {\n        if (b == 0) return assertEq(a, b); // If the expected is 0, actual must be too.\n\n        uint256 percentDelta = stdMath.percentDelta(a, b);\n\n        if (percentDelta > maxPercentDelta) {\n            emit log                   (\"Error: a ~= b not satisfied [int]\");\n            emit log_named_int         (\"    Expected\", b);\n            emit log_named_int         (\"      Actual\", a);\n            emit log_named_decimal_uint(\" Max % Delta\", maxPercentDelta, 18);\n            emit log_named_decimal_uint(\"     % Delta\", percentDelta, 18);\n            fail();\n        }\n    }\n\n    function assertApproxEqRel(\n        int256 a,\n        int256 b,\n        uint256 maxPercentDelta,\n        string memory err\n    ) internal virtual {\n        if (b == 0) return assertEq(a, b); // If the expected is 0, actual must be too.\n\n        uint256 percentDelta = stdMath.percentDelta(a, b);\n\n        if (percentDelta > maxPercentDelta) {\n            emit log_named_string      (\"Error\", err);\n            assertApproxEqRel(a, b, maxPercentDelta);\n        }\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                              JSON PARSING\n    //////////////////////////////////////////////////////////////*/\n\n   // Data structures to parse Transaction objects from the broadcast artifact\n   // that conform to EIP1559. The Raw structs is what is parsed from the JSON\n   // and then converted to the one that is used by the user for better UX.\n\n   struct RawTx1559 {\n        string[] arguments;\n        address contractAddress;\n        string contractName;\n        // json value name = function\n        string functionSig;\n        bytes32 hash;\n        // json value name = tx\n        RawTx1559Detail txDetail;\n        // json value name = type\n        string opcode;\n    }\n\n    struct RawTx1559Detail {\n        AccessList[] accessList;\n        bytes data;\n        address from;\n        bytes gas;\n        bytes nonce;\n        address to;\n        bytes txType;\n        bytes value;\n    }\n\n    struct Tx1559 {\n        string[] arguments;\n        address contractAddress;\n        string contractName;\n        string functionSig;\n        bytes32 hash;\n        Tx1559Detail txDetail;\n        string opcode;\n    }\n\n    struct Tx1559Detail {\n        AccessList[] accessList;\n        bytes data;\n        address from;\n        uint256 gas;\n        uint256 nonce;\n        address to;\n        uint256 txType;\n        uint256 value;\n    }\n\n   // Data structures to parse Transaction objects from the broadcast artifact\n   // that DO NOT conform to EIP1559. The Raw structs is what is parsed from the JSON\n   // and then converted to the one that is used by the user for better UX.\n\n    struct TxLegacy{\n        string[] arguments;\n        address contractAddress;\n        string contractName;\n        string functionSig;\n        string hash;\n        string opcode;\n        TxDetailLegacy transaction;\n    }\n\n    struct TxDetailLegacy{\n        AccessList[] accessList;\n        uint256 chainId;\n        bytes data;\n        address from;\n        uint256 gas;\n        uint256 gasPrice;\n        bytes32 hash;\n        uint256 nonce;\n        bytes1 opcode;\n        bytes32 r;\n        bytes32 s;\n        uint256 txType;\n        address to;\n        uint8 v;\n        uint256 value;\n    }\n\n    struct AccessList{\n        address accessAddress;\n        bytes32[] storageKeys;\n    }\n\n    // Data structures to parse Receipt objects from the broadcast artifact.\n    // The Raw structs is what is parsed from the JSON\n    // and then converted to the one that is used by the user for better UX.\n\n    struct RawReceipt {\n        bytes32 blockHash;\n        bytes blockNumber;\n        address contractAddress;\n        bytes cumulativeGasUsed;\n        bytes effectiveGasPrice;\n        address from;\n        bytes gasUsed;\n        RawReceiptLog[] logs;\n        bytes logsBloom;\n        bytes status;\n        address to;\n        bytes32 transactionHash;\n        bytes transactionIndex;\n    }\n\n    struct Receipt {\n        bytes32 blockHash;\n        uint256 blockNumber;\n        address contractAddress;\n        uint256 cumulativeGasUsed;\n        uint256 effectiveGasPrice;\n        address from;\n        uint256 gasUsed;\n        ReceiptLog[] logs;\n        bytes logsBloom;\n        uint256 status;\n        address to;\n        bytes32 transactionHash;\n        uint256 transactionIndex;\n    }\n\n    // Data structures to parse the entire broadcast artifact, assuming the\n    // transactions conform to EIP1559.\n\n    struct EIP1559ScriptArtifact {\n        string[] libraries;\n        string path;\n        string[] pending;\n        Receipt[] receipts;\n        uint256 timestamp;\n        Tx1559[] transactions;\n        TxReturn[] txReturns;\n    }\n\n    struct RawEIP1559ScriptArtifact {\n        string[] libraries;\n        string path;\n        string[] pending;\n        RawReceipt[] receipts;\n        TxReturn[] txReturns;\n        uint256 timestamp;\n        RawTx1559[] transactions;\n    }\n\n    struct RawReceiptLog {\n        // json value = address\n        address logAddress;\n        bytes32 blockHash;\n        bytes blockNumber;\n        bytes data;\n        bytes logIndex;\n        bool removed;\n        bytes32[] topics;\n        bytes32 transactionHash;\n        bytes transactionIndex;\n        bytes transactionLogIndex;\n    }\n\n    struct ReceiptLog {\n        // json value = address\n        address logAddress;\n        bytes32 blockHash;\n        uint256 blockNumber;\n        bytes data;\n        uint256 logIndex;\n        bytes32[] topics;\n        uint256 transactionIndex;\n        uint256 transactionLogIndex;\n        bool removed;\n    }\n\n    struct TxReturn {\n        string internalType;\n        string value;\n    }\n\n\n    function readEIP1559ScriptArtifact(string memory path)\n        internal\n        returns(EIP1559ScriptArtifact memory)\n    {\n        string memory data = vm.readFile(path);\n        bytes memory parsedData = vm.parseJson(data);\n        RawEIP1559ScriptArtifact memory rawArtifact = abi.decode(parsedData, (RawEIP1559ScriptArtifact));\n        EIP1559ScriptArtifact memory artifact;\n        artifact.libraries = rawArtifact.libraries;\n        artifact.path = rawArtifact.path;\n        artifact.timestamp = rawArtifact.timestamp;\n        artifact.pending = rawArtifact.pending;\n        artifact.txReturns = rawArtifact.txReturns;\n        artifact.receipts = rawToConvertedReceipts(rawArtifact.receipts);\n        artifact.transactions = rawToConvertedEIPTx1559s(rawArtifact.transactions);\n        return artifact;\n    }\n\n    function rawToConvertedEIPTx1559s(RawTx1559[] memory rawTxs)\n        internal pure\n        returns (Tx1559[] memory)\n    {\n        Tx1559[] memory txs = new Tx1559[](rawTxs.length);\n        for (uint i; i < rawTxs.length; i++) {\n            txs[i] = rawToConvertedEIPTx1559(rawTxs[i]);\n        }\n        return txs;\n    }\n\n    function rawToConvertedEIPTx1559(RawTx1559 memory rawTx)\n        internal pure\n        returns (Tx1559 memory)\n    {\n        Tx1559 memory transaction;\n        transaction.arguments = rawTx.arguments;\n        transaction.contractName = rawTx.contractName;\n        transaction.functionSig = rawTx.functionSig;\n        transaction.hash= rawTx.hash;\n        transaction.txDetail = rawToConvertedEIP1559Detail(rawTx.txDetail);\n        transaction.opcode= rawTx.opcode;\n        return transaction;\n    }\n\n    function rawToConvertedEIP1559Detail(RawTx1559Detail memory rawDetail)\n        internal pure\n        returns (Tx1559Detail memory)\n    {\n        Tx1559Detail memory txDetail;\n        txDetail.data = rawDetail.data;\n        txDetail.from = rawDetail.from;\n        txDetail.to = rawDetail.to;\n        txDetail.nonce = bytesToUint(rawDetail.nonce);\n        txDetail.txType = bytesToUint(rawDetail.txType);\n        txDetail.value = bytesToUint(rawDetail.value);\n        txDetail.gas = bytesToUint(rawDetail.gas);\n        txDetail.accessList = rawDetail.accessList;\n        return txDetail;\n\n    }\n\n    function readTx1559s(string memory path)\n        internal\n        returns (Tx1559[] memory)\n    {\n        string memory deployData = vm.readFile(path);\n        bytes memory parsedDeployData =\n            vm.parseJson(deployData, \".transactions\");\n        RawTx1559[] memory rawTxs = abi.decode(parsedDeployData, (RawTx1559[]));\n        return rawToConvertedEIPTx1559s(rawTxs);\n    }\n\n\n    function readTx1559(string memory path, uint256 index)\n        internal\n        returns (Tx1559 memory)\n    {\n        string memory deployData = vm.readFile(path);\n        string memory key = string(abi.encodePacked(\".transactions[\",vm.toString(index), \"]\"));\n        bytes memory parsedDeployData =\n            vm.parseJson(deployData, key);\n        RawTx1559 memory rawTx = abi.decode(parsedDeployData, (RawTx1559));\n        return rawToConvertedEIPTx1559(rawTx);\n    }\n\n\n    // Analogous to readTransactions, but for receipts.\n    function readReceipts(string memory path)\n        internal\n        returns (Receipt[] memory)\n    {\n        string memory deployData = vm.readFile(path);\n        bytes memory parsedDeployData = vm.parseJson(deployData, \".receipts\");\n        RawReceipt[] memory rawReceipts = abi.decode(parsedDeployData, (RawReceipt[]));\n        return rawToConvertedReceipts(rawReceipts);\n    }\n\n    function readReceipt(string memory path, uint index)\n        internal\n        returns (Receipt memory)\n    {\n        string memory deployData = vm.readFile(path);\n        string memory key = string(abi.encodePacked(\".receipts[\",vm.toString(index), \"]\"));\n        bytes memory parsedDeployData = vm.parseJson(deployData, key);\n        RawReceipt memory rawReceipt = abi.decode(parsedDeployData, (RawReceipt));\n        return rawToConvertedReceipt(rawReceipt);\n    }\n\n    function rawToConvertedReceipts(RawReceipt[] memory rawReceipts)\n        internal pure\n        returns(Receipt[] memory)\n    {\n        Receipt[] memory receipts = new Receipt[](rawReceipts.length);\n        for (uint i; i < rawReceipts.length; i++) {\n            receipts[i] = rawToConvertedReceipt(rawReceipts[i]);\n        }\n        return receipts;\n    }\n\n    function rawToConvertedReceipt(RawReceipt memory rawReceipt)\n        internal pure\n        returns(Receipt memory)\n    {\n        Receipt memory receipt;\n        receipt.blockHash = rawReceipt.blockHash;\n        receipt.to = rawReceipt.to;\n        receipt.from = rawReceipt.from;\n        receipt.contractAddress = rawReceipt.contractAddress;\n        receipt.effectiveGasPrice = bytesToUint(rawReceipt.effectiveGasPrice);\n        receipt.cumulativeGasUsed= bytesToUint(rawReceipt.cumulativeGasUsed);\n        receipt.gasUsed = bytesToUint(rawReceipt.gasUsed);\n        receipt.status = bytesToUint(rawReceipt.status);\n        receipt.transactionIndex = bytesToUint(rawReceipt.transactionIndex);\n        receipt.blockNumber = bytesToUint(rawReceipt.blockNumber);\n        receipt.logs = rawToConvertedReceiptLogs(rawReceipt.logs);\n        receipt.logsBloom = rawReceipt.logsBloom;\n        receipt.transactionHash = rawReceipt.transactionHash;\n        return receipt;\n    }\n\n    function rawToConvertedReceiptLogs(RawReceiptLog[] memory rawLogs)\n        internal pure\n        returns (ReceiptLog[] memory)\n    {\n        ReceiptLog[] memory logs = new ReceiptLog[](rawLogs.length);\n        for (uint i; i < rawLogs.length; i++) {\n            logs[i].logAddress = rawLogs[i].logAddress;\n            logs[i].blockHash = rawLogs[i].blockHash;\n            logs[i].blockNumber = bytesToUint(rawLogs[i].blockNumber);\n            logs[i].data = rawLogs[i].data;\n            logs[i].logIndex = bytesToUint(rawLogs[i].logIndex);\n            logs[i].topics = rawLogs[i].topics;\n            logs[i].transactionIndex = bytesToUint(rawLogs[i].transactionIndex);\n            logs[i].transactionLogIndex = bytesToUint(rawLogs[i].transactionLogIndex);\n            logs[i].removed = rawLogs[i].removed;\n        }\n        return logs;\n\n    }\n\n    function bytesToUint(bytes memory b) internal pure returns (uint256){\n            uint256 number;\n            for (uint i=0; i < b.length; i++) {\n                number = number + uint(uint8(b[i]))*(2**(8*(b.length-(i+1))));\n            }\n        return number;\n    }\n\n}\n\n/*//////////////////////////////////////////////////////////////////////////\n                                STD-ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\nlibrary stdError {\n    bytes public constant assertionError = abi.encodeWithSignature(\"Panic(uint256)\", 0x01);\n    bytes public constant arithmeticError = abi.encodeWithSignature(\"Panic(uint256)\", 0x11);\n    bytes public constant divisionError = abi.encodeWithSignature(\"Panic(uint256)\", 0x12);\n    bytes public constant enumConversionError = abi.encodeWithSignature(\"Panic(uint256)\", 0x21);\n    bytes public constant encodeStorageError = abi.encodeWithSignature(\"Panic(uint256)\", 0x22);\n    bytes public constant popError = abi.encodeWithSignature(\"Panic(uint256)\", 0x31);\n    bytes public constant indexOOBError = abi.encodeWithSignature(\"Panic(uint256)\", 0x32);\n    bytes public constant memOverflowError = abi.encodeWithSignature(\"Panic(uint256)\", 0x41);\n    bytes public constant zeroVarError = abi.encodeWithSignature(\"Panic(uint256)\", 0x51);\n    // DEPRECATED: Use Vm's `expectRevert` without any arguments instead\n    bytes public constant lowLevelError = bytes(\"\"); // `0x`\n}\n\n/*//////////////////////////////////////////////////////////////////////////\n                                STD-STORAGE\n//////////////////////////////////////////////////////////////////////////*/\n\nstruct StdStorage {\n    mapping (address => mapping(bytes4 => mapping(bytes32 => uint256))) slots;\n    mapping (address => mapping(bytes4 =>  mapping(bytes32 => bool))) finds;\n\n    bytes32[] _keys;\n    bytes4 _sig;\n    uint256 _depth;\n    address _target;\n    bytes32 _set;\n}\n\nlibrary stdStorage {\n    event SlotFound(address who, bytes4 fsig, bytes32 keysHash, uint slot);\n    event WARNING_UninitedSlot(address who, uint slot);\n\n    uint256 private constant UINT256_MAX = 115792089237316195423570985008687907853269984665640564039457584007913129639935;\n    int256 private constant INT256_MAX = 57896044618658097711785492504343953926634992332820282019728792003956564819967;\n\n    Vm private constant vm_std_store = Vm(address(uint160(uint256(keccak256('hevm cheat code')))));\n\n    function sigs(\n        string memory sigStr\n    )\n        internal\n        pure\n        returns (bytes4)\n    {\n        return bytes4(keccak256(bytes(sigStr)));\n    }\n\n    /// @notice find an arbitrary storage slot given a function sig, input data, address of the contract and a value to check against\n    // slot complexity:\n    //  if flat, will be bytes32(uint256(uint));\n    //  if map, will be keccak256(abi.encode(key, uint(slot)));\n    //  if deep map, will be keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot)))));\n    //  if map struct, will be bytes32(uint256(keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot)))))) + structFieldDepth);\n    function find(\n        StdStorage storage self\n    )\n        internal\n        returns (uint256)\n    {\n        address who = self._target;\n        bytes4 fsig = self._sig;\n        uint256 field_depth = self._depth;\n        bytes32[] memory ins = self._keys;\n\n        // calldata to test against\n        if (self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]) {\n            return self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))];\n        }\n        bytes memory cald = abi.encodePacked(fsig, flatten(ins));\n        vm_std_store.record();\n        bytes32 fdat;\n        {\n            (, bytes memory rdat) = who.staticcall(cald);\n            fdat = bytesToBytes32(rdat, 32*field_depth);\n        }\n\n        (bytes32[] memory reads, ) = vm_std_store.accesses(address(who));\n        if (reads.length == 1) {\n            bytes32 curr = vm_std_store.load(who, reads[0]);\n            if (curr == bytes32(0)) {\n                emit WARNING_UninitedSlot(who, uint256(reads[0]));\n            }\n            if (fdat != curr) {\n                require(false, \"stdStorage find(StdStorage): Packed slot. This would cause dangerous overwriting and currently isn't supported.\");\n            }\n            emit SlotFound(who, fsig, keccak256(abi.encodePacked(ins, field_depth)), uint256(reads[0]));\n            self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = uint256(reads[0]);\n            self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = true;\n        } else if (reads.length > 1) {\n            for (uint256 i = 0; i < reads.length; i++) {\n                bytes32 prev = vm_std_store.load(who, reads[i]);\n                if (prev == bytes32(0)) {\n                    emit WARNING_UninitedSlot(who, uint256(reads[i]));\n                }\n                // store\n                vm_std_store.store(who, reads[i], bytes32(hex\"1337\"));\n                bool success;\n                bytes memory rdat;\n                {\n                    (success, rdat) = who.staticcall(cald);\n                    fdat = bytesToBytes32(rdat, 32*field_depth);\n                }\n\n                if (success && fdat == bytes32(hex\"1337\")) {\n                    // we found which of the slots is the actual one\n                    emit SlotFound(who, fsig, keccak256(abi.encodePacked(ins, field_depth)), uint256(reads[i]));\n                    self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = uint256(reads[i]);\n                    self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = true;\n                    vm_std_store.store(who, reads[i], prev);\n                    break;\n                }\n                vm_std_store.store(who, reads[i], prev);\n            }\n        } else {\n            require(false, \"stdStorage find(StdStorage): No storage use detected for target.\");\n        }\n\n        require(self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))], \"stdStorage find(StdStorage): Slot(s) not found.\");\n\n        delete self._target;\n        delete self._sig;\n        delete self._keys;\n        delete self._depth;\n\n        return self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))];\n    }\n\n    function target(StdStorage storage self, address _target) internal returns (StdStorage storage) {\n        self._target = _target;\n        return self;\n    }\n\n    function sig(StdStorage storage self, bytes4 _sig) internal returns (StdStorage storage) {\n        self._sig = _sig;\n        return self;\n    }\n\n    function sig(StdStorage storage self, string memory _sig) internal returns (StdStorage storage) {\n        self._sig = sigs(_sig);\n        return self;\n    }\n\n    function with_key(StdStorage storage self, address who) internal returns (StdStorage storage) {\n        self._keys.push(bytes32(uint256(uint160(who))));\n        return self;\n    }\n\n    function with_key(StdStorage storage self, uint256 amt) internal returns (StdStorage storage) {\n        self._keys.push(bytes32(amt));\n        return self;\n    }\n    function with_key(StdStorage storage self, bytes32 key) internal returns (StdStorage storage) {\n        self._keys.push(key);\n        return self;\n    }\n\n    function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage) {\n        self._depth = _depth;\n        return self;\n    }\n\n    function checked_write(StdStorage storage self, address who) internal {\n        checked_write(self, bytes32(uint256(uint160(who))));\n    }\n\n    function checked_write(StdStorage storage self, uint256 amt) internal {\n        checked_write(self, bytes32(amt));\n    }\n\n    function checked_write(StdStorage storage self, bool write) internal {\n        bytes32 t;\n        /// @solidity memory-safe-assembly\n        assembly {\n            t := write\n        }\n        checked_write(self, t);\n    }\n\n    function checked_write(\n        StdStorage storage self,\n        bytes32 set\n    ) internal {\n        address who = self._target;\n        bytes4 fsig = self._sig;\n        uint256 field_depth = self._depth;\n        bytes32[] memory ins = self._keys;\n\n        bytes memory cald = abi.encodePacked(fsig, flatten(ins));\n        if (!self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]) {\n            find(self);\n        }\n        bytes32 slot = bytes32(self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]);\n\n        bytes32 fdat;\n        {\n            (, bytes memory rdat) = who.staticcall(cald);\n            fdat = bytesToBytes32(rdat, 32*field_depth);\n        }\n        bytes32 curr = vm_std_store.load(who, slot);\n\n        if (fdat != curr) {\n            require(false, \"stdStorage find(StdStorage): Packed slot. This would cause dangerous overwriting and currently isn't supported.\");\n        }\n        vm_std_store.store(who, slot, set);\n        delete self._target;\n        delete self._sig;\n        delete self._keys;\n        delete self._depth;\n    }\n\n    function read(StdStorage storage self) private returns (bytes memory) {\n        address t = self._target;\n        uint256 s = find(self);\n        return abi.encode(vm_std_store.load(t, bytes32(s)));\n    }\n\n    function read_bytes32(StdStorage storage self) internal returns (bytes32) {\n        return abi.decode(read(self), (bytes32));\n    }\n\n\n    function read_bool(StdStorage storage self) internal returns (bool) {\n        int256 v = read_int(self);\n        if (v == 0) return false;\n        if (v == 1) return true;\n        revert(\"stdStorage read_bool(StdStorage): Cannot decode. Make sure you are reading a bool.\");\n    }\n\n    function read_address(StdStorage storage self) internal returns (address) {\n        return abi.decode(read(self), (address));\n    }\n\n    function read_uint(StdStorage storage self) internal returns (uint256) {\n        return abi.decode(read(self), (uint256));\n    }\n\n    function read_int(StdStorage storage self) internal returns (int256) {\n        return abi.decode(read(self), (int256));\n    }\n\n    function bytesToBytes32(bytes memory b, uint offset) public pure returns (bytes32) {\n        bytes32 out;\n\n        uint256 max = b.length > 32 ? 32 : b.length;\n        for (uint i = 0; i < max; i++) {\n            out |= bytes32(b[offset + i] & 0xFF) >> (i * 8);\n        }\n        return out;\n    }\n\n    function flatten(bytes32[] memory b) private pure returns (bytes memory)\n    {\n        bytes memory result = new bytes(b.length * 32);\n        for (uint256 i = 0; i < b.length; i++) {\n            bytes32 k = b[i];\n            /// @solidity memory-safe-assembly\n            assembly {\n                mstore(add(result, add(32, mul(32, i))), k)\n            }\n        }\n\n        return result;\n    }\n\n\n\n}\n\n\n/*//////////////////////////////////////////////////////////////////////////\n                                STD-MATH\n//////////////////////////////////////////////////////////////////////////*/\n\nlibrary stdMath {\n    int256 private constant INT256_MIN = -57896044618658097711785492504343953926634992332820282019728792003956564819968;\n\n    function abs(int256 a) internal pure returns (uint256) {\n        // Required or it will fail when `a = type(int256).min`\n        if (a == INT256_MIN)\n            return 57896044618658097711785492504343953926634992332820282019728792003956564819968;\n\n        return uint256(a > 0 ? a : -a);\n    }\n\n    function delta(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a > b\n            ? a - b\n            : b - a;\n    }\n\n    function delta(int256 a, int256 b) internal pure returns (uint256) {\n        // a and b are of the same sign\n        // this works thanks to two's complement, the left-most bit is the sign bit\n        if ((a ^ b) > -1) {\n            return delta(abs(a), abs(b));\n        }\n\n        // a and b are of opposite signs\n        return abs(a) + abs(b);\n    }\n\n    function percentDelta(uint256 a, uint256 b) internal pure returns (uint256) {\n        uint256 absDelta = delta(a, b);\n\n        return absDelta * 1e18 / b;\n    }\n\n    function percentDelta(int256 a, int256 b) internal pure returns (uint256) {\n        uint256 absDelta = delta(a, b);\n        uint256 absB = abs(b);\n\n        return absDelta * 1e18 / absB;\n    }\n}\n"
      },
      "lib/forge-std/src/Vm.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.6.0 <0.9.0;\npragma experimental ABIEncoderV2;\n\ninterface Vm {\n    struct Log {\n        bytes32[] topics;\n        bytes data;\n    }\n\n    // Sets block.timestamp (newTimestamp)\n    function warp(uint256) external;\n    // Sets block.height (newHeight)\n    function roll(uint256) external;\n    // Sets block.basefee (newBasefee)\n    function fee(uint256) external;\n    // Sets block.difficulty (newDifficulty)\n    function difficulty(uint256) external;\n    // Sets block.chainid\n    function chainId(uint256) external;\n    // Loads a storage slot from an address (who, slot)\n    function load(address,bytes32) external returns (bytes32);\n    // Stores a value to an address' storage slot, (who, slot, value)\n    function store(address,bytes32,bytes32) external;\n    // Signs data, (privateKey, digest) => (v, r, s)\n    function sign(uint256,bytes32) external returns (uint8,bytes32,bytes32);\n    // Gets the address for a given private key, (privateKey) => (address)\n    function addr(uint256) external returns (address);\n    // Gets the nonce of an account\n    function getNonce(address) external returns (uint64);\n    // Sets the nonce of an account; must be higher than the current nonce of the account\n    function setNonce(address, uint64) external;\n    // Performs a foreign function call via the terminal, (stringInputs) => (result)\n    function ffi(string[] calldata) external returns (bytes memory);\n    // Sets environment variables, (name, value)\n    function setEnv(string calldata, string calldata) external;\n    // Reads environment variables, (name) => (value)\n    function envBool(string calldata) external returns (bool);\n    function envUint(string calldata) external returns (uint256);\n    function envInt(string calldata) external returns (int256);\n    function envAddress(string calldata) external returns (address);\n    function envBytes32(string calldata) external returns (bytes32);\n    function envString(string calldata) external returns (string memory);\n    function envBytes(string calldata) external returns (bytes memory);\n    // Reads environment variables as arrays, (name, delim) => (value[])\n    function envBool(string calldata, string calldata) external returns (bool[] memory);\n    function envUint(string calldata, string calldata) external returns (uint256[] memory);\n    function envInt(string calldata, string calldata) external returns (int256[] memory);\n    function envAddress(string calldata, string calldata) external returns (address[] memory);\n    function envBytes32(string calldata, string calldata) external returns (bytes32[] memory);\n    function envString(string calldata, string calldata) external returns (string[] memory);\n    function envBytes(string calldata, string calldata) external returns (bytes[] memory);\n    // Sets the *next* call's msg.sender to be the input address\n    function prank(address) external;\n    // Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is called\n    function startPrank(address) external;\n    // Sets the *next* call's msg.sender to be the input address, and the tx.origin to be the second input\n    function prank(address,address) external;\n    // Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is called, and the tx.origin to be the second input\n    function startPrank(address,address) external;\n    // Resets subsequent calls' msg.sender to be `address(this)`\n    function stopPrank() external;\n    // Sets an address' balance, (who, newBalance)\n    function deal(address, uint256) external;\n    // Sets an address' code, (who, newCode)\n    function etch(address, bytes calldata) external;\n    // Expects an error on next call\n    function expectRevert(bytes calldata) external;\n    function expectRevert(bytes4) external;\n    function expectRevert() external;\n    // Records all storage reads and writes\n    function record() external;\n    // Gets all accessed reads and write slot from a recording session, for a given address\n    function accesses(address) external returns (bytes32[] memory reads, bytes32[] memory writes);\n    // Prepare an expected log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData).\n    // Call this function, then emit an event, then call a function. Internally after the call, we check if\n    // logs were emitted in the expected order with the expected topics and data (as specified by the booleans)\n    function expectEmit(bool,bool,bool,bool) external;\n    function expectEmit(bool,bool,bool,bool,address) external;\n    // Mocks a call to an address, returning specified data.\n    // Calldata can either be strict or a partial match, e.g. if you only\n    // pass a Solidity selector to the expected calldata, then the entire Solidity\n    // function will be mocked.\n    function mockCall(address,bytes calldata,bytes calldata) external;\n    // Mocks a call to an address with a specific msg.value, returning specified data.\n    // Calldata match takes precedence over msg.value in case of ambiguity.\n    function mockCall(address,uint256,bytes calldata,bytes calldata) external;\n    // Clears all mocked calls\n    function clearMockedCalls() external;\n    // Expects a call to an address with the specified calldata.\n    // Calldata can either be a strict or a partial match\n    function expectCall(address,bytes calldata) external;\n    // Expects a call to an address with the specified msg.value and calldata\n    function expectCall(address,uint256,bytes calldata) external;\n    // Gets the _creation_ bytecode from an artifact file. Takes in the relative path to the json file\n    function getCode(string calldata) external returns (bytes memory);\n    // Gets the _deployed_ bytecode from an artifact file. Takes in the relative path to the json file\n    function getDeployedCode(string calldata) external returns (bytes memory);\n    // Labels an address in call traces\n    function label(address, string calldata) external;\n    // If the condition is false, discard this run's fuzz inputs and generate new ones\n    function assume(bool) external;\n    // Sets block.coinbase (who)\n    function coinbase(address) external;\n    // Using the address that calls the test contract, has the next call (at this call depth only) create a transaction that can later be signed and sent onchain\n    function broadcast() external;\n    // Has the next call (at this call depth only) create a transaction with the address provided as the sender that can later be signed and sent onchain\n    function broadcast(address) external;\n    // Has the next call (at this call depth only) create a transaction with the private key provided as the sender that can later be signed and sent onchain\n    function broadcast(uint256) external;\n    // Using the address that calls the test contract, has all subsequent calls (at this call depth only) create transactions that can later be signed and sent onchain\n    function startBroadcast() external;\n    // Has all subsequent calls (at this call depth only) create transactions with the address provided that can later be signed and sent onchain\n    function startBroadcast(address) external;\n    // Has all subsequent calls (at this call depth only) create transactions with the private key provided that can later be signed and sent onchain\n    function startBroadcast(uint256) external;\n    // Stops collecting onchain transactions\n    function stopBroadcast() external;\n\n    // Reads the entire content of file to string, (path) => (data)\n    function readFile(string calldata) external returns (string memory);\n    // Get the path of the current project root\n    function projectRoot() external returns (string memory);\n    // Reads next line of file to string, (path) => (line)\n    function readLine(string calldata) external returns (string memory);\n    // Writes data to file, creating a file if it does not exist, and entirely replacing its contents if it does.\n    // (path, data) => ()\n    function writeFile(string calldata, string calldata) external;\n    // Writes line to file, creating a file if it does not exist.\n    // (path, data) => ()\n    function writeLine(string calldata, string calldata) external;\n    // Closes file for reading, resetting the offset and allowing to read it from beginning with readLine.\n    // (path) => ()\n    function closeFile(string calldata) external;\n    // Removes file. This cheatcode will revert in the following situations, but is not limited to just these cases:\n    // - Path points to a directory.\n    // - The file doesn't exist.\n    // - The user lacks permissions to remove the file.\n    // (path) => ()\n    function removeFile(string calldata) external;\n\n    // Convert values to a string, (value) => (stringified value)\n    function toString(address) external returns(string memory);\n    function toString(bytes calldata) external returns(string memory);\n    function toString(bytes32) external returns(string memory);\n    function toString(bool) external returns(string memory);\n    function toString(uint256) external returns(string memory);\n    function toString(int256) external returns(string memory);\n\n    // Convert values from a string, (string) => (parsed value)\n    function parseBytes(string calldata) external returns (bytes memory);\n    function parseAddress(string calldata) external returns (address);\n    function parseUint(string calldata) external returns (uint256);\n    function parseInt(string calldata) external returns (int256);\n    function parseBytes32(string calldata) external returns (bytes32);\n    function parseBool(string calldata) external returns (bool);\n\n    // Record all the transaction logs\n    function recordLogs() external;\n    // Gets all the recorded logs, () => (logs)\n    function getRecordedLogs() external returns (Log[] memory);\n    // Snapshot the current state of the evm.\n    // Returns the id of the snapshot that was created.\n    // To revert a snapshot use `revertTo`\n    function snapshot() external returns(uint256);\n    // Revert the state of the evm to a previous snapshot\n    // Takes the snapshot id to revert to.\n    // This deletes the snapshot and all snapshots taken after the given snapshot id.\n    function revertTo(uint256) external returns(bool);\n\n    // Creates a new fork with the given endpoint and block and returns the identifier of the fork\n    function createFork(string calldata,uint256) external returns(uint256);\n    // Creates a new fork with the given endpoint and the _latest_ block and returns the identifier of the fork\n    function createFork(string calldata) external returns(uint256);\n    // Creates a new fork with the given endpoint and at the block the given transaction was mined in, and replays all transaction mined in the block before the transaction\n    function createFork(string calldata, bytes32) external returns (uint256);\n    // Creates _and_ also selects a new fork with the given endpoint and block and returns the identifier of the fork\n    function createSelectFork(string calldata,uint256) external returns(uint256);\n    // Creates _and_ also selects new fork with the given endpoint and at the block the given transaction was mined in, and replays all transaction mined in the block before the transaction\n    function createSelectFork(string calldata, bytes32) external returns (uint256);\n    // Creates _and_ also selects a new fork with the given endpoint and the latest block and returns the identifier of the fork\n    function createSelectFork(string calldata) external returns(uint256);\n    // Takes a fork identifier created by `createFork` and sets the corresponding forked state as active.\n    function selectFork(uint256) external;\n    /// Returns the currently active fork\n    /// Reverts if no fork is currently active\n    function activeFork() external returns(uint256);\n    // Updates the currently active fork to given block number\n    // This is similar to `roll` but for the currently active fork\n    function rollFork(uint256) external;\n    // Updates the currently active fork to given transaction\n    // this will `rollFork` with the number of the block the transaction was mined in and replays all transaction mined before it in the block\n    function rollFork(bytes32) external;\n    // Updates the given fork to given block number\n    function rollFork(uint256 forkId, uint256 blockNumber) external;\n    // Updates the given fork to block number of the given transaction and replays all transaction mined before it in the block\n    function rollFork(uint256 forkId, bytes32 transaction) external;\n\n    // Marks that the account(s) should use persistent storage across fork swaps in a multifork setup\n    // Meaning, changes made to the state of this account will be kept when switching forks\n    function makePersistent(address) external;\n    function makePersistent(address, address) external;\n    function makePersistent(address, address, address) external;\n    function makePersistent(address[] calldata) external;\n    // Revokes persistent status from the address, previously added via `makePersistent`\n    function revokePersistent(address) external;\n    function revokePersistent(address[] calldata) external;\n    // Returns true if the account is marked as persistent\n    function isPersistent(address) external returns (bool);\n\n    // In forking mode, explicitly grant the given address cheatcode access\n    function allowCheatcodes(address) external;\n\n    // Fetches the given transaction from the active fork and executes it on the current state\n    function transact(bytes32 txHash) external;\n    // Fetches the given transaction from the given fork and executes it on the current state\n    function transact(uint256 forkId, bytes32 txHash) external;\n\n    // Returns the RPC url for the given alias\n    function rpcUrl(string calldata) external returns(string memory);\n    // Returns all rpc urls and their aliases `[alias, url][]`\n    function rpcUrls() external returns(string[2][] memory);\n\n    // Derive a private key from a provided mnenomic string (or mnenomic file path) at the derivation path m/44'/60'/0'/0/{index}\n    function deriveKey(string calldata, uint32) external returns (uint256);\n    // Derive a private key from a provided mnenomic string (or mnenomic file path) at the derivation path {path}{index}\n    function deriveKey(string calldata, string calldata, uint32) external returns (uint256);\n    // Adds a private key to the local forge wallet and returns the address\n    function rememberKey(uint256) external returns (address);\n\n    // parseJson\n\n    // Given a string of JSON, return the ABI-encoded value of provided key\n    // (stringified json, key) => (ABI-encoded data)\n    // Read the note below!\n    function parseJson(string calldata, string calldata) external returns(bytes memory);\n\n    // Given a string of JSON, return it as ABI-encoded, (stringified json, key) => (ABI-encoded data)\n    // Read the note below!\n    function parseJson(string calldata) external returns(bytes memory);\n\n    // Note:\n    // ----\n    // In case the returned value is a JSON object, it's encoded as a ABI-encoded tuple. As JSON objects\n    // don't have the notion of ordered, but tuples do, they JSON object is encoded with it's fields ordered in\n    // ALPHABETICAL ordser. That means that in order to succesfully decode the tuple, we need to define a tuple that\n    // encodes the fields in the same order, which is alphabetical. In the case of Solidity structs, they are encoded\n    // as tuples, with the attributes in the order in which they are defined.\n    // For example: json = { 'a': 1, 'b': 0xa4tb......3xs}\n    // a: uint256\n    // b: address\n    // To decode that json, we need to define a struct or a tuple as follows:\n    // struct json = { uint256 a; address b; }\n    // If we defined a json struct with the opposite order, meaning placing the address b first, it would try to\n    // decode the tuple in that order, and thus fail.\n\n}\n"
      },
      "test/utils/TestUtils.sol": {
        "content": "pragma solidity ^0.8.13;\n\n// SPDX-License-Identifier: MIT\n\nimport { Test } from \"lib/forge-std/src/Test.sol\";\n\nimport { StakingFundsVault } from \"../../contracts/liquid-staking/StakingFundsVault.sol\";\nimport { SavETHVault } from \"../../contracts/liquid-staking/SavETHVault.sol\";\nimport { MockLiquidStakingManager } from \"../../contracts/testing/liquid-staking/MockLiquidStakingManager.sol\";\nimport { MockAccountManager } from \"../../contracts/testing/stakehouse/MockAccountManager.sol\";\nimport { SyndicateMock } from \"../../contracts/testing/syndicate/SyndicateMock.sol\";\nimport { LPToken } from \"../../contracts/liquid-staking/LPToken.sol\";\nimport { LPTokenFactory } from \"../../contracts/liquid-staking/LPTokenFactory.sol\";\nimport { GiantSavETHVaultPool } from \"../../contracts/liquid-staking/GiantSavETHVaultPool.sol\";\nimport { GiantMevAndFeesPool } from \"../../contracts/liquid-staking/GiantMevAndFeesPool.sol\";\nimport { MockGiantMevAndFeesPool } from \"../../contracts/testing/liquid-staking/MockGiantMevAndFeesPool.sol\";\nimport { MockBrandNFT } from \"../../contracts/testing/stakehouse/MockBrandNFT.sol\";\nimport { MockStakeHouseUniverse } from \"../../contracts/testing/stakehouse/MockStakeHouseUniverse.sol\";\nimport { MockSlotRegistry } from \"../../contracts/testing/stakehouse/MockSlotRegistry.sol\";\nimport { MockLSDNFactory } from \"../../contracts/testing/liquid-staking/MockLSDNFactory.sol\";\nimport { LSDNFactory } from \"../../contracts/liquid-staking/LSDNFactory.sol\";\nimport { OwnableSmartWalletFactory } from \"../../contracts/smart-wallet/OwnableSmartWalletFactory.sol\";\nimport { SavETHVaultDeployer } from \"../../contracts/liquid-staking/SavETHVaultDeployer.sol\";\nimport { GiantLPDeployer } from \"../../contracts/liquid-staking/GiantLPDeployer.sol\";\nimport { StakingFundsVaultDeployer } from \"../../contracts/liquid-staking/StakingFundsVaultDeployer.sol\";\nimport { OptionalGatekeeperFactory } from \"../../contracts/liquid-staking/OptionalGatekeeperFactory.sol\";\nimport { MockSavETHVault } from \"../../contracts/testing/liquid-staking/MockSavETHVault.sol\";\nimport { MockStakingFundsVault } from \"../../contracts/testing/liquid-staking/MockStakingFundsVault.sol\";\nimport { MockGiantSavETHVaultPool } from \"../../contracts/testing/liquid-staking/MockGiantSavETHVaultPool.sol\";\nimport { IDataStructures } from \"@blockswaplab/stakehouse-contract-interfaces/contracts/interfaces/IDataStructures.sol\";\n\ncontract TestUtils is Test {\n\n    // Instances that can be shared across all test contracts\n    MockLSDNFactory factory;\n    MockLiquidStakingManager manager;\n    MockSavETHVault savETHVault;\n    MockStakingFundsVault stakingFundsVault;\n\n    // Create implementation contracts\n    MockLiquidStakingManager managerImplementation = new MockLiquidStakingManager();\n    SyndicateMock syndicateImplementation = new SyndicateMock();\n    LPToken lpTokenImplementation = new LPToken();\n\n    // Create periphery contracts\n    LPTokenFactory lpTokenFactory = new LPTokenFactory(address(lpTokenImplementation), msg.sender);\n    OwnableSmartWalletFactory smartWalletFactory = new OwnableSmartWalletFactory();\n    MockBrandNFT brand = new MockBrandNFT();\n    SavETHVaultDeployer vaultDeployer = new SavETHVaultDeployer(msg.sender);\n    StakingFundsVaultDeployer stakingFundsDeployer = new StakingFundsVaultDeployer(msg.sender);\n    OptionalGatekeeperFactory keeperDeployer = new OptionalGatekeeperFactory();\n\n    MockGiantSavETHVaultPool gSavETHVaultImplementation = new MockGiantSavETHVaultPool();\n    MockGiantMevAndFeesPool gMevImplementation = new MockGiantMevAndFeesPool();\n    GiantLPDeployer giantLPDeployer = new GiantLPDeployer();\n\n    /// Define some test BLS keys\n    bytes blsPubKeyOne = fromHex(\"94fdc9a61a34eb6a034e343f20732456443a2ed6668ede04677adc1e15d2a24500a3e05cf7ad3dc3b2f3cc13fdc12af5\");\n    bytes blsPubKeyTwo = fromHex(\"9AAdc9a61a34eb6a034e343f20732456443a2ed6668ede04677adc1e15d2a24500a3e05cf7ad3dc3b2f3cc13fdc12af5\");\n    bytes blsPubKeyThree = fromHex(\"9AAdcff61a34eb6a034e343f20732456443a2ed6668ede04677adc1e15d2a24500a3e05cf7ad3dc3b2f3cc13fdc12fff\");\n    bytes blsPubKeyFour = fromHex(\"2aBdcff61a34eb6a034e343f20732456443a2ed6668ede04677adc1e15d2a24500a3e05cf7ad3dc3b2f3cc13fdc12fff\");\n    // bytes blsPubKeyFive = fromHex(\"0xaa44b24a1498bf1a93aaca796a1eed603d6698b4fcfdc6ef653322ff703432200befa65d11211bc89815c17cd8ea260d\");\n\n    /// Define some test accounts\n    address accountOne = 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266;\n    address accountTwo = 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC;\n    address accountThree = 0xdD2FD4581271e230360230F9337D5c0430Bf44C0;\n    address accountFour = 0xbDA5747bFD65F08deb54cb465eB87D40e51B197E;\n    address accountFive = 0x2546BcD3c84621e976D8185a91A922aE77ECEc30;\n    address accountSix = 0x05a8458f59Ae37886A97B2E81127654D4f55dfFA;\n\n    address admin = 0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199;\n\n    address houseOne = 0x70997970C51812dc3A010C7d01b50e0d17dc79C8;\n    address houseTwo = 0xcd3B766CCDd6AE721141F452C550Ca635964ce71;\n\n    function getSavETHVaultFromManager(MockLiquidStakingManager _manager) public view returns (MockSavETHVault) {\n        return MockSavETHVault(address(_manager.savETHVault()));\n    }\n\n    function getStakingFundsVaultFromManager(MockLiquidStakingManager _manager) public view returns (MockStakingFundsVault) {\n        return MockStakingFundsVault(payable(address(_manager.stakingFundsVault())));\n    }\n\n    function depositIntoDefaultSavETHVault(address _user, bytes memory _blsKey, uint256 _amount) public {\n        vm.startPrank(_user);\n        savETHVault.depositETHForStaking{value: _amount}(_blsKey, _amount);\n        vm.stopPrank();\n    }\n\n    function depositIntoCustomSavETHVault(SavETHVault _savETHVault, address _user, bytes memory _blsKey, uint256 _amount) public {\n        vm.startPrank(_user);\n        vm.deal(_user, _amount);\n        _savETHVault.depositETHForStaking{value: _amount}(_blsKey, _amount);\n        vm.stopPrank();\n    }\n\n    function depositIntoDefaultStakingFundsVault(address _user, bytes memory _blsKey, uint256 _amount) public {\n        vm.startPrank(_user);\n        manager.stakingFundsVault().depositETHForStaking{value: _amount}(_blsKey, _amount);\n        vm.stopPrank();\n    }\n\n    function depositIntoCustomStakingFundsVault(StakingFundsVault _stakingFundsVault, address _user, bytes memory _blsKey, uint256 _amount) public {\n        vm.startPrank(_user);\n        vm.deal(_user, _amount);\n        _stakingFundsVault.depositETHForStaking{value: _amount}(_blsKey, _amount);\n        vm.stopPrank();\n    }\n\n    function depositStakeAndMintDerivativesForDefaultNetwork(\n        address _nodeRunner,\n        address _feesAndMevUser,\n        address _savETHUser,\n        bytes memory _blsKey\n    ) public {\n        registerSingleBLSPubKey(_nodeRunner, _blsKey, accountFour);\n        depositIntoDefaultSavETHVault(_savETHUser, _blsKey, 24 ether);\n        depositIntoDefaultStakingFundsVault(_feesAndMevUser, _blsKey, 4 ether);\n        stakeAndMintDerivativesSingleKey(_blsKey);\n    }\n\n    function depositStakeAndMintDerivativesForCustomAccountAndCustomNetwork(\n        address _nodeRunner,\n        address _feesAndMevUser,\n        address _savETHUser,\n        address user,\n        bytes memory _blsKey,\n        MockLiquidStakingManager _manager,\n        StakingFundsVault _stakingFundsVault,\n        SavETHVault _savETHVault\n    ) public {\n        registerSingleBLSPubKey(_nodeRunner, _blsKey, user, _manager);\n        depositIntoCustomSavETHVault(_savETHVault, _savETHUser, _blsKey, 24 ether);\n        depositIntoCustomStakingFundsVault(_stakingFundsVault, _feesAndMevUser, _blsKey, 4 ether);\n        stakeAndMintDerivativesSingleKey(_blsKey, _manager);\n    }\n\n    // Convert an hexadecimal character to their value\n    function fromHexChar(uint8 c) public pure returns (uint8) {\n        if (bytes1(c) >= bytes1('0') && bytes1(c) <= bytes1('9')) {\n            return c - uint8(bytes1('0'));\n        }\n        if (bytes1(c) >= bytes1('a') && bytes1(c) <= bytes1('f')) {\n            return 10 + c - uint8(bytes1('a'));\n        }\n        if (bytes1(c) >= bytes1('A') && bytes1(c) <= bytes1('F')) {\n            return 10 + c - uint8(bytes1('A'));\n        }\n        revert(\"fail\");\n    }\n\n    // Convert an hexadecimal string to raw bytes\n    function fromHex(string memory s) public pure returns (bytes memory) {\n        bytes memory ss = bytes(s);\n        require(ss.length%2 == 0); // length must be even\n        bytes memory r = new bytes(ss.length/2);\n        for (uint i=0; i<ss.length/2; ++i) {\n            r[i] = bytes1(fromHexChar(uint8(ss[2*i])) * 16 +\n                fromHexChar(uint8(ss[2*i+1])));\n        }\n        return r;\n    }\n\n    function getEmptyBytesArray() public pure returns (bytes[] memory) {\n        bytes[] memory array = new bytes[](0);\n        return array;\n    }\n\n    function getBytesArrayFromBytes(bytes memory data) public pure returns (bytes[] memory) {\n        bytes[] memory array = new bytes[](1);\n        array[0] = data;\n        return array;\n    }\n\n    function getBytesArrayFromBytes(bytes memory data, bytes memory data2) public pure returns (bytes[] memory) {\n        bytes[] memory array = new bytes[](2);\n        array[0] = data;\n        array[1] = data2;\n        return array;\n    }\n\n    function getBytesArrayFromBytes(bytes memory data, bytes memory data2, bytes memory data3) public pure returns (bytes[] memory) {\n        bytes[] memory array = new bytes[](3);\n        array[0] = data;\n        array[1] = data2;\n        array[2] = data3;\n        return array;\n    }\n\n    function getEmptyUint256Array() public pure returns (uint256[] memory) {\n        uint256[] memory array = new uint256[](0);\n        return array;\n    }\n\n    function getUint256ArrayFromValues(uint256 data) public pure returns (uint256[] memory) {\n        uint256[] memory array = new uint256[](1);\n        array[0] = data;\n        return array;\n    }\n\n    function getUint256ArrayFromValues(uint256 data, uint256 data2) public pure returns (uint256[] memory) {\n        uint256[] memory array = new uint256[](2);\n        array[0] = data;\n        array[1] = data2;\n        return array;\n    }\n\n    function getUint256ArrayFromValues(uint256 data, uint256 data2, uint256 data3) public pure returns (uint256[] memory) {\n        uint256[] memory array = new uint256[](3);\n        array[0] = data;\n        array[1] = data2;\n        array[2] = data3;\n        return array;\n    }\n\n    function getAddressArrayFromValues(address data) public pure returns (address[] memory) {\n        address[] memory array = new address[](1);\n        array[0] = data;\n        return array;\n    }\n\n    function getAddressArrayFromValues(address data, address data2) public pure returns (address[] memory) {\n        address[] memory array = new address[](2);\n        array[0] = data;\n        array[1] = data2;\n        return array;\n    }\n\n    function getFakeEIP712Signature() public view returns (IDataStructures.EIP712Signature memory, IDataStructures.EIP712Signature[] memory) {\n        IDataStructures.EIP712Signature memory sig;\n        IDataStructures.EIP712Signature[] memory sigs = new IDataStructures.EIP712Signature[](1);\n        sigs[0] = sig;\n        return (sig, sigs);\n    }\n\n    function getFakeBalanceReport() public view returns (IDataStructures.ETH2DataReport memory, IDataStructures.ETH2DataReport[] memory) {\n        IDataStructures.ETH2DataReport memory report;\n        IDataStructures.ETH2DataReport[] memory reports = new IDataStructures.ETH2DataReport[](1);\n        reports[0] = report;\n        return (report, reports);\n    }\n\n    function getRandomArrayOfBytes32() public pure returns (bytes32[] memory) {\n        bytes32[] memory roots = new bytes32[](1);\n        roots[0] = keccak256(abi.encode(\"\"));\n        return roots;\n    }\n\n    function createMockLSDNFactory() public returns (MockLSDNFactory) {\n        LSDNFactory.InitParams memory params = LSDNFactory.InitParams(\n            address(managerImplementation),\n            address(managerImplementation), // MockLSDNFactory will override the _syndicateFactory param\n            address(lpTokenFactory),\n            address(smartWalletFactory),\n            address(brand),\n            address(vaultDeployer),\n            address(stakingFundsDeployer),\n            address(keeperDeployer),\n            address(gSavETHVaultImplementation),\n            address(gMevImplementation),\n            address(giantLPDeployer),\n            accountFive\n        );\n\n        // Create LSDN factory\n        return new MockLSDNFactory(params);\n    }\n\n    function deployNewLiquidStakingNetwork(\n        MockLSDNFactory _factory,\n        address _admin,\n        bool _deployOptionalGatekeeper,\n        string memory _ticker\n    ) public returns (MockLiquidStakingManager) {\n        return MockLiquidStakingManager(payable(_factory.deployNewMockLiquidStakingDerivativeNetwork(\n                _admin,\n                _deployOptionalGatekeeper,\n                _ticker\n            )));\n    }\n\n    function deployNewLiquidStakingNetworkWithCommission(\n        MockLSDNFactory _factory,\n        uint256 _commission,\n        address _admin,\n        bool _deployOptionalGatekeeper,\n        string memory _ticker\n    ) public returns (MockLiquidStakingManager) {\n        return MockLiquidStakingManager(payable(_factory.deployNewMockLiquidStakingDerivativeNetworkWithCommission(\n                _admin,\n                _commission,\n                _deployOptionalGatekeeper,\n                _ticker\n            )));\n    }\n\n    function deployDefaultLiquidStakingNetwork(\n        MockLSDNFactory _factory,\n        address _admin\n    ) public returns (MockLiquidStakingManager) {\n        return MockLiquidStakingManager(payable(_factory.deployNewMockLiquidStakingDerivativeNetwork(\n                _admin,\n                false,\n                \"LSDN\"\n            )));\n    }\n\n    function registerSingleBLSPubKey(\n        address _nodeRunner,\n        bytes memory _blsKey,\n        address _eoaRepresentative\n    ) public {\n        vm.deal(_nodeRunner, 4 ether);\n        vm.startPrank(_nodeRunner);\n        manager.registerBLSPublicKeys{ value: 4 ether }(\n            getBytesArrayFromBytes(_blsKey),\n            getBytesArrayFromBytes(_blsKey),\n            _eoaRepresentative\n        );\n        vm.stopPrank();\n\n        // Simulate state transitions in lifecycle status to initials registered (value of 1)\n        MockAccountManager(factory.accountMan()).setLifecycleStatus(_blsKey, 1);\n\n        // set user as first collateralized owner\n        MockSlotRegistry(factory.slot()).setNumberOfCollateralisedSlotOwnersForKnot(_blsKey, 1);\n        MockSlotRegistry(factory.slot()).setCollateralisedOwnerAtIndex(\n            _blsKey,\n            0,\n            manager.smartWalletOfNodeRunner(_nodeRunner)\n        );\n    }\n\n    function registerSingleBLSPubKey(\n        address _nodeRunner,\n        bytes memory _blsKey,\n        address _eoaRepresentative,\n        MockLiquidStakingManager _manager\n    ) public {\n        vm.deal(_nodeRunner, 4 ether);\n        vm.startPrank(_nodeRunner);\n        _manager.registerBLSPublicKeys{ value: 4 ether }(\n            getBytesArrayFromBytes(_blsKey),\n            getBytesArrayFromBytes(_blsKey),\n            _eoaRepresentative\n        );\n        vm.stopPrank();\n\n        // Simulate state transitions in lifecycle status to initials registered (value of 1)\n        MockAccountManager(factory.accountMan()).setLifecycleStatus(_blsKey, 1);\n\n        // set user as first collateralized owner\n        MockSlotRegistry(factory.slot()).setNumberOfCollateralisedSlotOwnersForKnot(_blsKey, 1);\n        MockSlotRegistry(factory.slot()).setCollateralisedOwnerAtIndex(\n            _blsKey,\n            0,\n            _manager.smartWalletOfNodeRunner(_nodeRunner)\n        );\n    }\n\n    function stakeSingleBlsPubKey(\n        bytes memory _blsKey,\n        MockLiquidStakingManager _manager\n    ) public {\n        (,IDataStructures.EIP712Signature[] memory sigs) = getFakeEIP712Signature();\n        _manager.stake(\n            getBytesArrayFromBytes(_blsKey),\n            getBytesArrayFromBytes(_blsKey),\n            getBytesArrayFromBytes(_blsKey),\n            sigs,\n            getRandomArrayOfBytes32()\n        );\n    }\n\n    // https://code4rena.com/reports/2022-11-stakehouse/#m-20-smartwallet-address-is-not-guaranteed-correct-eth-may-be-lost\n    // We are checking in manager that smart wallet of KNOT is not address zero\n    function stakeSingleBlsPubKey(bytes memory _blsKey) public {\n        (,IDataStructures.EIP712Signature[] memory sigs) = getFakeEIP712Signature();\n        manager.stake(\n            getBytesArrayFromBytes(_blsKey),\n            getBytesArrayFromBytes(_blsKey),\n            getBytesArrayFromBytes(_blsKey),\n            sigs,\n            getRandomArrayOfBytes32()\n        );\n    }\n\n    function mintDerivativesSingleBlsPubKey(bytes memory _blsKey) public {\n        (,IDataStructures.ETH2DataReport[] memory reports) = getFakeBalanceReport();\n        (,IDataStructures.EIP712Signature[] memory sigs) = getFakeEIP712Signature();\n\n        MockStakeHouseUniverse(factory.uni()).setAssociatedHouseForKnot(_blsKey, manager.stakehouse());\n\n        manager.mintDerivatives(\n            getBytesArrayFromBytes(_blsKey),\n            reports,\n            sigs\n        );\n\n        // set associated house info\n        MockSlotRegistry(factory.slot()).setUserCollateralisedSLOTBalanceForKnot(\n            manager.stakehouse(),\n            MockSlotRegistry(factory.slot()).getCollateralisedOwnerAtIndex(_blsKey, 0),  // get user that registered initials\n            _blsKey,\n            4 ether\n        );\n    }\n\n    function mintDerivativesSingleBlsPubKey(\n        bytes memory _blsKey,\n        MockLiquidStakingManager _manager\n    ) public {\n        (,IDataStructures.ETH2DataReport[] memory reports) = getFakeBalanceReport();\n        (,IDataStructures.EIP712Signature[] memory sigs) = getFakeEIP712Signature();\n\n        MockStakeHouseUniverse(factory.uni()).setAssociatedHouseForKnot(_blsKey, _manager.stakehouse());\n\n        _manager.mintDerivatives(\n            getBytesArrayFromBytes(_blsKey),\n            reports,\n            sigs\n        );\n\n        // set associated house info\n        MockSlotRegistry(factory.slot()).setUserCollateralisedSLOTBalanceForKnot(\n            _manager.stakehouse(),\n            MockSlotRegistry(factory.slot()).getCollateralisedOwnerAtIndex(_blsKey, 0),  // get user that registered initials\n            _blsKey,\n            4 ether\n        );\n    }\n\n    function stakeAndMintDerivativesSingleKey(\n        bytes memory _blsKey\n    ) public {\n        // Stake the ETH with the deposit contract by spending 4 + 4 + 24 ETH from the individual pools\n        stakeSingleBlsPubKey(_blsKey);\n\n        // Simulate state transitions in lifecycle status to ETH deposited (value of 2)\n        MockAccountManager(factory.accountMan()).setLifecycleStatus(_blsKey, 2);\n\n        // Mint derivatives for the knot\n        mintDerivativesSingleBlsPubKey(_blsKey);\n\n        // Simulate state transitions in lifecycle status to derivatives minted (value of 3)\n        MockAccountManager(factory.accountMan()).setLifecycleStatus(_blsKey, 3);\n    }\n\n    function stakeAndMintDerivativesSingleKey(\n        bytes memory _blsKey,\n        MockLiquidStakingManager _manager\n    ) public {\n        // Stake the ETH with the deposit contract by spending 4 + 4 + 24 ETH from the individual pools\n        stakeSingleBlsPubKey(_blsKey, _manager);\n\n        // Simulate state transitions in lifecycle status to ETH deposited (value of 2)\n        MockAccountManager(factory.accountMan()).setLifecycleStatus(_blsKey, 2);\n\n        // Mint derivatives for the knot\n        mintDerivativesSingleBlsPubKey(_blsKey, _manager);\n\n        // Simulate state transitions in lifecycle status to derivatives minted (value of 3)\n        MockAccountManager(factory.accountMan()).setLifecycleStatus(_blsKey, 3);\n    }\n\n    function sendEIP1559RewardsToSyndicateAtAddress(uint256 _eip1559Reward, address _syndicate) public {\n        (bool success, ) = _syndicate.call{value: _eip1559Reward}(\"\");\n        assertEq(success, true);\n        assertGe(_syndicate.balance, _eip1559Reward);\n    }\n}"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}