creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGasService.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport { IUpgradable } from '../interfaces/IUpgradable.sol';\n\n/**\n * @title IAxelarGasService Interface\n * @notice This is an interface for the AxelarGasService contract which manages gas payments\n * and refunds for cross-chain communication on the Axelar network.\n * @dev This interface inherits IUpgradable\n */\ninterface IAxelarGasService is IUpgradable {\n    error NothingReceived();\n    error InvalidAddress();\n    error NotCollector();\n    error InvalidAmounts();\n\n    event GasPaidForContractCall(\n        address indexed sourceAddress,\n        string destinationChain,\n        string destinationAddress,\n        bytes32 indexed payloadHash,\n        address gasToken,\n        uint256 gasFeeAmount,\n        address refundAddress\n    );\n\n    event GasPaidForContractCallWithToken(\n        address indexed sourceAddress,\n        string destinationChain,\n        string destinationAddress,\n        bytes32 indexed payloadHash,\n        string symbol,\n        uint256 amount,\n        address gasToken,\n        uint256 gasFeeAmount,\n        address refundAddress\n    );\n\n    event NativeGasPaidForContractCall(\n        address indexed sourceAddress,\n        string destinationChain,\n        string destinationAddress,\n        bytes32 indexed payloadHash,\n        uint256 gasFeeAmount,\n        address refundAddress\n    );\n\n    event NativeGasPaidForContractCallWithToken(\n        address indexed sourceAddress,\n        string destinationChain,\n        string destinationAddress,\n        bytes32 indexed payloadHash,\n        string symbol,\n        uint256 amount,\n        uint256 gasFeeAmount,\n        address refundAddress\n    );\n\n    event GasPaidForExpressCall(\n        address indexed sourceAddress,\n        string destinationChain,\n        string destinationAddress,\n        bytes32 indexed payloadHash,\n        address gasToken,\n        uint256 gasFeeAmount,\n        address refundAddress\n    );\n\n    event GasPaidForExpressCallWithToken(\n        address indexed sourceAddress,\n        string destinationChain,\n        string destinationAddress,\n        bytes32 indexed payloadHash,\n        string symbol,\n        uint256 amount,\n        address gasToken,\n        uint256 gasFeeAmount,\n        address refundAddress\n    );\n\n    event NativeGasPaidForExpressCall(\n        address indexed sourceAddress,\n        string destinationChain,\n        string destinationAddress,\n        bytes32 indexed payloadHash,\n        uint256 gasFeeAmount,\n        address refundAddress\n    );\n\n    event NativeGasPaidForExpressCallWithToken(\n        address indexed sourceAddress,\n        string destinationChain,\n        string destinationAddress,\n        bytes32 indexed payloadHash,\n        string symbol,\n        uint256 amount,\n        uint256 gasFeeAmount,\n        address refundAddress\n    );\n\n    event GasAdded(\n        bytes32 indexed txHash,\n        uint256 indexed logIndex,\n        address gasToken,\n        uint256 gasFeeAmount,\n        address refundAddress\n    );\n\n    event NativeGasAdded(bytes32 indexed txHash, uint256 indexed logIndex, uint256 gasFeeAmount, address refundAddress);\n\n    event ExpressGasAdded(\n        bytes32 indexed txHash,\n        uint256 indexed logIndex,\n        address gasToken,\n        uint256 gasFeeAmount,\n        address refundAddress\n    );\n\n    event NativeExpressGasAdded(\n        bytes32 indexed txHash,\n        uint256 indexed logIndex,\n        uint256 gasFeeAmount,\n        address refundAddress\n    );\n\n    event Refunded(\n        bytes32 indexed txHash,\n        uint256 indexed logIndex,\n        address payable receiver,\n        address token,\n        uint256 amount\n    );\n\n    /**\n     * @notice Pay for gas using ERC20 tokens for a contract call on a destination chain.\n     * @dev This function is called on the source chain before calling the gateway to execute a remote contract.\n     * @param sender The address making the payment\n     * @param destinationChain The target chain where the contract call will be made\n     * @param destinationAddress The target address on the destination chain\n     * @param payload Data payload for the contract call\n     * @param gasToken The address of the ERC20 token used to pay for gas\n     * @param gasFeeAmount The amount of tokens to pay for gas\n     * @param refundAddress The address where refunds, if any, should be sent\n     */\n    function payGasForContractCall(\n        address sender,\n        string calldata destinationChain,\n        string calldata destinationAddress,\n        bytes calldata payload,\n        address gasToken,\n        uint256 gasFeeAmount,\n        address refundAddress\n    ) external;\n\n    /**\n     * @notice Pay for gas using ERC20 tokens for a contract call with tokens on a destination chain.\n     * @dev This function is called on the source chain before calling the gateway to execute a remote contract.\n     * @param sender The address making the payment\n     * @param destinationChain The target chain where the contract call with tokens will be made\n     * @param destinationAddress The target address on the destination chain\n     * @param payload Data payload for the contract call with tokens\n     * @param symbol The symbol of the token to be sent with the call\n     * @param amount The amount of tokens to be sent with the call\n     * @param gasToken The address of the ERC20 token used to pay for gas\n     * @param gasFeeAmount The amount of tokens to pay for gas\n     * @param refundAddress The address where refunds, if any, should be sent\n     */\n    function payGasForContractCallWithToken(\n        address sender,\n        string calldata destinationChain,\n        string calldata destinationAddress,\n        bytes calldata payload,\n        string calldata symbol,\n        uint256 amount,\n        address gasToken,\n        uint256 gasFeeAmount,\n        address refundAddress\n    ) external;\n\n    /**\n     * @notice Pay for gas using native currency for a contract call on a destination chain.\n     * @dev This function is called on the source chain before calling the gateway to execute a remote contract.\n     * @param sender The address making the payment\n     * @param destinationChain The target chain where the contract call will be made\n     * @param destinationAddress The target address on the destination chain\n     * @param payload Data payload for the contract call\n     * @param refundAddress The address where refunds, if any, should be sent\n     */\n    function payNativeGasForContractCall(\n        address sender,\n        string calldata destinationChain,\n        string calldata destinationAddress,\n        bytes calldata payload,\n        address refundAddress\n    ) external payable;\n\n    /**\n     * @notice Pay for gas using native currency for a contract call with tokens on a destination chain.\n     * @dev This function is called on the source chain before calling the gateway to execute a remote contract.\n     * @param sender The address making the payment\n     * @param destinationChain The target chain where the contract call with tokens will be made\n     * @param destinationAddress The target address on the destination chain\n     * @param payload Data payload for the contract call with tokens\n     * @param symbol The symbol of the token to be sent with the call\n     * @param amount The amount of tokens to be sent with the call\n     * @param refundAddress The address where refunds, if any, should be sent\n     */\n    function payNativeGasForContractCallWithToken(\n        address sender,\n        string calldata destinationChain,\n        string calldata destinationAddress,\n        bytes calldata payload,\n        string calldata symbol,\n        uint256 amount,\n        address refundAddress\n    ) external payable;\n\n    /**\n     * @notice Pay for gas using ERC20 tokens for an express contract call on a destination chain.\n     * @dev This function is called on the source chain before calling the gateway to express execute a remote contract.\n     * @param sender The address making the payment\n     * @param destinationChain The target chain where the contract call will be made\n     * @param destinationAddress The target address on the destination chain\n     * @param payload Data payload for the contract call\n     * @param gasToken The address of the ERC20 token used to pay for gas\n     * @param gasFeeAmount The amount of tokens to pay for gas\n     * @param refundAddress The address where refunds, if any, should be sent\n     */\n    function payGasForExpressCall(\n        address sender,\n        string calldata destinationChain,\n        string calldata destinationAddress,\n        bytes calldata payload,\n        address gasToken,\n        uint256 gasFeeAmount,\n        address refundAddress\n    ) external;\n\n    /**\n     * @notice Pay for gas using ERC20 tokens for an express contract call with tokens on a destination chain.\n     * @dev This function is called on the source chain before calling the gateway to express execute a remote contract.\n     * @param sender The address making the payment\n     * @param destinationChain The target chain where the contract call with tokens will be made\n     * @param destinationAddress The target address on the destination chain\n     * @param payload Data payload for the contract call with tokens\n     * @param symbol The symbol of the token to be sent with the call\n     * @param amount The amount of tokens to be sent with the call\n     * @param gasToken The address of the ERC20 token used to pay for gas\n     * @param gasFeeAmount The amount of tokens to pay for gas\n     * @param refundAddress The address where refunds, if any, should be sent\n     */\n    function payGasForExpressCallWithToken(\n        address sender,\n        string calldata destinationChain,\n        string calldata destinationAddress,\n        bytes calldata payload,\n        string calldata symbol,\n        uint256 amount,\n        address gasToken,\n        uint256 gasFeeAmount,\n        address refundAddress\n    ) external;\n\n    /**\n     * @notice Pay for gas using native currency for an express contract call on a destination chain.\n     * @dev This function is called on the source chain before calling the gateway to express execute a remote contract.\n     * @param sender The address making the payment\n     * @param destinationChain The target chain where the contract call will be made\n     * @param destinationAddress The target address on the destination chain\n     * @param payload Data payload for the contract call\n     * @param refundAddress The address where refunds, if any, should be sent\n     */\n    function payNativeGasForExpressCall(\n        address sender,\n        string calldata destinationChain,\n        string calldata destinationAddress,\n        bytes calldata payload,\n        address refundAddress\n    ) external payable;\n\n    /**\n     * @notice Pay for gas using native currency for an express contract call with tokens on a destination chain.\n     * @dev This function is called on the source chain before calling the gateway to express execute a remote contract.\n     * @param sender The address making the payment\n     * @param destinationChain The target chain where the contract call with tokens will be made\n     * @param destinationAddress The target address on the destination chain\n     * @param payload Data payload for the contract call with tokens\n     * @param symbol The symbol of the token to be sent with the call\n     * @param amount The amount of tokens to be sent with the call\n     * @param refundAddress The address where refunds, if any, should be sent\n     */\n    function payNativeGasForExpressCallWithToken(\n        address sender,\n        string calldata destinationChain,\n        string calldata destinationAddress,\n        bytes calldata payload,\n        string calldata symbol,\n        uint256 amount,\n        address refundAddress\n    ) external payable;\n\n    /**\n     * @notice Add additional gas payment using ERC20 tokens after initiating a cross-chain call.\n     * @dev This function can be called on the source chain after calling the gateway to execute a remote contract.\n     * @param txHash The transaction hash of the cross-chain call\n     * @param logIndex The log index for the cross-chain call\n     * @param gasToken The ERC20 token address used to add gas\n     * @param gasFeeAmount The amount of tokens to add as gas\n     * @param refundAddress The address where refunds, if any, should be sent\n     */\n    function addGas(\n        bytes32 txHash,\n        uint256 logIndex,\n        address gasToken,\n        uint256 gasFeeAmount,\n        address refundAddress\n    ) external;\n\n    /**\n     * @notice Add additional gas payment using native currency after initiating a cross-chain call.\n     * @dev This function can be called on the source chain after calling the gateway to execute a remote contract.\n     * @param txHash The transaction hash of the cross-chain call\n     * @param logIndex The log index for the cross-chain call\n     * @param refundAddress The address where refunds, if any, should be sent\n     */\n    function addNativeGas(\n        bytes32 txHash,\n        uint256 logIndex,\n        address refundAddress\n    ) external payable;\n\n    /**\n     * @notice Add additional gas payment using ERC20 tokens after initiating an express cross-chain call.\n     * @dev This function can be called on the source chain after calling the gateway to express execute a remote contract.\n     * @param txHash The transaction hash of the cross-chain call\n     * @param logIndex The log index for the cross-chain call\n     * @param gasToken The ERC20 token address used to add gas\n     * @param gasFeeAmount The amount of tokens to add as gas\n     * @param refundAddress The address where refunds, if any, should be sent\n     */\n    function addExpressGas(\n        bytes32 txHash,\n        uint256 logIndex,\n        address gasToken,\n        uint256 gasFeeAmount,\n        address refundAddress\n    ) external;\n\n    /**\n     * @notice Add additional gas payment using native currency after initiating an express cross-chain call.\n     * @dev This function can be called on the source chain after calling the gateway to express execute a remote contract.\n     * @param txHash The transaction hash of the cross-chain call\n     * @param logIndex The log index for the cross-chain call\n     * @param refundAddress The address where refunds, if any, should be sent\n     */\n    function addNativeExpressGas(\n        bytes32 txHash,\n        uint256 logIndex,\n        address refundAddress\n    ) external payable;\n\n    /**\n     * @notice Allows the gasCollector to collect accumulated fees from the contract.\n     * @dev Use address(0) as the token address for native currency.\n     * @param receiver The address to receive the collected fees\n     * @param tokens Array of token addresses to be collected\n     * @param amounts Array of amounts to be collected for each respective token address\n     */\n    function collectFees(\n        address payable receiver,\n        address[] calldata tokens,\n        uint256[] calldata amounts\n    ) external;\n\n    /**\n     * @notice Refunds gas payment to the receiver in relation to a specific cross-chain transaction.\n     * @dev Only callable by the gasCollector.\n     * @dev Use address(0) as the token address to refund native currency.\n     * @param txHash The transaction hash of the cross-chain call\n     * @param logIndex The log index for the cross-chain call\n     * @param receiver The address to receive the refund\n     * @param token The token address to be refunded\n     * @param amount The amount to refund\n     */\n    function refund(\n        bytes32 txHash,\n        uint256 logIndex,\n        address payable receiver,\n        address token,\n        uint256 amount\n    ) external;\n\n    /**\n     * @notice Returns the address of the designated gas collector.\n     * @return address of the gas collector\n     */\n    function gasCollector() external returns (address);\n}\n"
      },
      "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGateway.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport { IGovernable } from './IGovernable.sol';\nimport { IImplementation } from './IImplementation.sol';\n\ninterface IAxelarGateway is IImplementation, IGovernable {\n    /**********\\\n    |* Errors *|\n    \\**********/\n\n    error NotSelf();\n    error InvalidCodeHash();\n    error SetupFailed();\n    error InvalidAuthModule();\n    error InvalidTokenDeployer();\n    error InvalidAmount();\n    error InvalidChainId();\n    error InvalidCommands();\n    error TokenDoesNotExist(string symbol);\n    error TokenAlreadyExists(string symbol);\n    error TokenDeployFailed(string symbol);\n    error TokenContractDoesNotExist(address token);\n    error BurnFailed(string symbol);\n    error MintFailed(string symbol);\n    error InvalidSetMintLimitsParams();\n    error ExceedMintLimit(string symbol);\n\n    /**********\\\n    |* Events *|\n    \\**********/\n\n    event TokenSent(\n        address indexed sender,\n        string destinationChain,\n        string destinationAddress,\n        string symbol,\n        uint256 amount\n    );\n\n    event ContractCall(\n        address indexed sender,\n        string destinationChain,\n        string destinationContractAddress,\n        bytes32 indexed payloadHash,\n        bytes payload\n    );\n\n    event ContractCallWithToken(\n        address indexed sender,\n        string destinationChain,\n        string destinationContractAddress,\n        bytes32 indexed payloadHash,\n        bytes payload,\n        string symbol,\n        uint256 amount\n    );\n\n    event Executed(bytes32 indexed commandId);\n\n    event TokenDeployed(string symbol, address tokenAddresses);\n\n    event ContractCallApproved(\n        bytes32 indexed commandId,\n        string sourceChain,\n        string sourceAddress,\n        address indexed contractAddress,\n        bytes32 indexed payloadHash,\n        bytes32 sourceTxHash,\n        uint256 sourceEventIndex\n    );\n\n    event ContractCallApprovedWithMint(\n        bytes32 indexed commandId,\n        string sourceChain,\n        string sourceAddress,\n        address indexed contractAddress,\n        bytes32 indexed payloadHash,\n        string symbol,\n        uint256 amount,\n        bytes32 sourceTxHash,\n        uint256 sourceEventIndex\n    );\n\n    event ContractCallExecuted(bytes32 indexed commandId);\n\n    event TokenMintLimitUpdated(string symbol, uint256 limit);\n\n    event OperatorshipTransferred(bytes newOperatorsData);\n\n    event Upgraded(address indexed implementation);\n\n    /********************\\\n    |* Public Functions *|\n    \\********************/\n\n    function sendToken(\n        string calldata destinationChain,\n        string calldata destinationAddress,\n        string calldata symbol,\n        uint256 amount\n    ) external;\n\n    function callContract(\n        string calldata destinationChain,\n        string calldata contractAddress,\n        bytes calldata payload\n    ) external;\n\n    function callContractWithToken(\n        string calldata destinationChain,\n        string calldata contractAddress,\n        bytes calldata payload,\n        string calldata symbol,\n        uint256 amount\n    ) external;\n\n    function isContractCallApproved(\n        bytes32 commandId,\n        string calldata sourceChain,\n        string calldata sourceAddress,\n        address contractAddress,\n        bytes32 payloadHash\n    ) external view returns (bool);\n\n    function isContractCallAndMintApproved(\n        bytes32 commandId,\n        string calldata sourceChain,\n        string calldata sourceAddress,\n        address contractAddress,\n        bytes32 payloadHash,\n        string calldata symbol,\n        uint256 amount\n    ) external view returns (bool);\n\n    function validateContractCall(\n        bytes32 commandId,\n        string calldata sourceChain,\n        string calldata sourceAddress,\n        bytes32 payloadHash\n    ) external returns (bool);\n\n    function validateContractCallAndMint(\n        bytes32 commandId,\n        string calldata sourceChain,\n        string calldata sourceAddress,\n        bytes32 payloadHash,\n        string calldata symbol,\n        uint256 amount\n    ) external returns (bool);\n\n    /***********\\\n    |* Getters *|\n    \\***********/\n\n    function authModule() external view returns (address);\n\n    function tokenDeployer() external view returns (address);\n\n    function tokenMintLimit(string memory symbol) external view returns (uint256);\n\n    function tokenMintAmount(string memory symbol) external view returns (uint256);\n\n    function allTokensFrozen() external view returns (bool);\n\n    function implementation() external view returns (address);\n\n    function tokenAddresses(string memory symbol) external view returns (address);\n\n    function tokenFrozen(string memory symbol) external view returns (bool);\n\n    function isCommandExecuted(bytes32 commandId) external view returns (bool);\n\n    /************************\\\n    |* Governance Functions *|\n    \\************************/\n\n    function setTokenMintLimits(string[] calldata symbols, uint256[] calldata limits) external;\n\n    function upgrade(\n        address newImplementation,\n        bytes32 newImplementationCodeHash,\n        bytes calldata setupParams\n    ) external;\n\n    /**********************\\\n    |* External Functions *|\n    \\**********************/\n\n    function execute(bytes calldata input) external;\n}\n"
      },
      "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IContractIdentifier.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n// General interface for upgradable contracts\ninterface IContractIdentifier {\n    /**\n     * @notice Returns the contract ID. It can be used as a check during upgrades.\n     * @dev Meant to be overridden in derived contracts.\n     * @return bytes32 The contract ID\n     */\n    function contractId() external pure returns (bytes32);\n}\n"
      },
      "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IGovernable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @title IGovernable Interface\n * @notice This is an interface used by the AxelarGateway contract to manage governance and mint limiter roles.\n */\ninterface IGovernable {\n    error NotGovernance();\n    error NotMintLimiter();\n    error InvalidGovernance();\n    error InvalidMintLimiter();\n\n    event GovernanceTransferred(address indexed previousGovernance, address indexed newGovernance);\n    event MintLimiterTransferred(address indexed previousGovernance, address indexed newGovernance);\n\n    /**\n     * @notice Returns the governance address.\n     * @return address of the governance\n     */\n    function governance() external view returns (address);\n\n    /**\n     * @notice Returns the mint limiter address.\n     * @return address of the mint limiter\n     */\n    function mintLimiter() external view returns (address);\n\n    /**\n     * @notice Transfer the governance role to another address.\n     * @param newGovernance The new governance address\n     */\n    function transferGovernance(address newGovernance) external;\n\n    /**\n     * @notice Transfer the mint limiter role to another address.\n     * @param newGovernance The new mint limiter address\n     */\n    function transferMintLimiter(address newGovernance) external;\n}\n"
      },
      "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IImplementation.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport { IContractIdentifier } from './IContractIdentifier.sol';\n\ninterface IImplementation is IContractIdentifier {\n    error NotProxy();\n\n    function setup(bytes calldata data) external;\n}\n"
      },
      "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IOwnable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @title IOwnable Interface\n * @notice IOwnable is an interface that abstracts the implementation of a\n * contract with ownership control features. It's commonly used in upgradable\n * contracts and includes the functionality to get current owner, transfer\n * ownership, and propose and accept ownership.\n */\ninterface IOwnable {\n    error NotOwner();\n    error InvalidOwner();\n    error InvalidOwnerAddress();\n\n    event OwnershipTransferStarted(address indexed newOwner);\n    event OwnershipTransferred(address indexed newOwner);\n\n    /**\n     * @notice Returns the current owner of the contract.\n     * @return address The address of the current owner\n     */\n    function owner() external view returns (address);\n\n    /**\n     * @notice Returns the address of the pending owner of the contract.\n     * @return address The address of the pending owner\n     */\n    function pendingOwner() external view returns (address);\n\n    /**\n     * @notice Transfers ownership of the contract to a new address\n     * @param newOwner The address to transfer ownership to\n     */\n    function transferOwnership(address newOwner) external;\n\n    /**\n     * @notice Proposes to transfer the contract's ownership to a new address.\n     * The new owner needs to accept the ownership explicitly.\n     * @param newOwner The address to transfer ownership to\n     */\n    function proposeOwnership(address newOwner) external;\n\n    /**\n     * @notice Transfers ownership to the pending owner.\n     * @dev Can only be called by the pending owner\n     */\n    function acceptOwnership() external;\n}\n"
      },
      "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IUpgradable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport { IOwnable } from './IOwnable.sol';\nimport { IImplementation } from './IImplementation.sol';\n\n// General interface for upgradable contracts\ninterface IUpgradable is IOwnable, IImplementation {\n    error InvalidCodeHash();\n    error InvalidImplementation();\n    error SetupFailed();\n\n    event Upgraded(address indexed newImplementation);\n\n    function implementation() external view returns (address);\n\n    function upgrade(\n        address newImplementation,\n        bytes32 newImplementationCodeHash,\n        bytes calldata params\n    ) external;\n}\n"
      },
      "@connext/interfaces/core/IConnext.sol": {
        "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport {ExecuteArgs, TransferInfo, DestinationTransferStatus} from \"../libraries/LibConnextStorage.sol\";\nimport {TokenId} from \"../libraries/TokenId.sol\";\n\ninterface IConnext {\n\n  // ============ BRIDGE ==============\n\n  function xcall(\n    uint32 _destination,\n    address _to,\n    address _asset,\n    address _delegate,\n    uint256 _amount,\n    uint256 _slippage,\n    bytes calldata _callData\n  ) external payable returns (bytes32);\n\n  function xcallIntoLocal(\n    uint32 _destination,\n    address _to,\n    address _asset,\n    address _delegate,\n    uint256 _amount,\n    uint256 _slippage,\n    bytes calldata _callData\n  ) external payable returns (bytes32);\n\n  function execute(ExecuteArgs calldata _args) external returns (bytes32 transferId);\n\n  function forceUpdateSlippage(TransferInfo calldata _params, uint256 _slippage) external;\n\n  function forceReceiveLocal(TransferInfo calldata _params) external;\n\n  function bumpTransfer(bytes32 _transferId) external payable;\n\n  function routedTransfers(bytes32 _transferId) external view returns (address[] memory);\n\n  function transferStatus(bytes32 _transferId) external view returns (DestinationTransferStatus);\n\n  function remote(uint32 _domain) external view returns (address);\n\n  function domain() external view returns (uint256);\n\n  function nonce() external view returns (uint256);\n\n  function approvedSequencers(address _sequencer) external view returns (bool);\n\n  function xAppConnectionManager() external view returns (address);\n\n  // ============ ROUTERS ==============\n\n  function LIQUIDITY_FEE_NUMERATOR() external view returns (uint256);\n\n  function LIQUIDITY_FEE_DENOMINATOR() external view returns (uint256);\n\n  function getRouterApproval(address _router) external view returns (bool);\n\n  function getRouterRecipient(address _router) external view returns (address);\n\n  function getRouterOwner(address _router) external view returns (address);\n\n  function getProposedRouterOwner(address _router) external view returns (address);\n\n  function getProposedRouterOwnerTimestamp(address _router) external view returns (uint256);\n\n  function maxRoutersPerTransfer() external view returns (uint256);\n\n  function routerBalances(address _router, address _asset) external view returns (uint256);\n\n  function getRouterApprovalForPortal(address _router) external view returns (bool);\n\n  function initializeRouter(address _owner, address _recipient) external;\n\n  function setRouterRecipient(address _router, address _recipient) external;\n\n  function proposeRouterOwner(address _router, address _proposed) external;\n\n  function acceptProposedRouterOwner(address _router) external;\n\n  function addRouterLiquidityFor(\n    uint256 _amount,\n    address _local,\n    address _router\n  ) external payable;\n\n  function addRouterLiquidity(uint256 _amount, address _local) external payable;\n\n  function removeRouterLiquidityFor(\n    TokenId memory _canonical,\n    uint256 _amount,\n    address payable _to,\n    address _router\n  ) external;\n\n  function removeRouterLiquidity(TokenId memory _canonical, uint256 _amount, address payable _to) external;\n}\n"
      },
      "@connext/interfaces/core/IXReceiver.sol": {
        "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IXReceiver {\n  function xReceive(\n    bytes32 _transferId,\n    uint256 _amount,\n    address _asset,\n    address _originSender,\n    uint32 _origin,\n    bytes memory _callData\n  ) external returns (bytes memory);\n}\n"
      },
      "@connext/interfaces/libraries/LibConnextStorage.sol": {
        "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\n/**\n * @notice Enum representing status of destination transfer\n * @dev Status is only assigned on the destination domain, will always be \"none\" for the\n * origin domains\n * @return uint - Index of value in enum\n */\nenum DestinationTransferStatus {\n  None, // 0\n  Reconciled, // 1\n  Executed, // 2\n  Completed // 3 - executed + reconciled\n}\n\n/**\n * @notice These are the parameters that will remain constant between the\n * two chains. They are supplied on `xcall` and should be asserted on `execute`\n * @property to - The account that receives funds, in the event of a crosschain call,\n * will receive funds if the call fails.\n *\n * @param originDomain - The originating domain (i.e. where `xcall` is called)\n * @param destinationDomain - The final domain (i.e. where `execute` / `reconcile` are called)\\\n * @param canonicalDomain - The canonical domain of the asset you are bridging\n * @param to - The address you are sending funds (and potentially data) to\n * @param delegate - An address who can execute txs on behalf of `to`, in addition to allowing relayers\n * @param receiveLocal - If true, will use the local asset on the destination instead of adopted.\n * @param callData - The data to execute on the receiving chain. If no crosschain call is needed, then leave empty.\n * @param slippage - Slippage user is willing to accept from original amount in expressed in BPS (i.e. if\n * a user takes 1% slippage, this is expressed as 1_000)\n * @param originSender - The msg.sender of the xcall\n * @param bridgedAmt - The amount sent over the bridge (after potential AMM on xcall)\n * @param normalizedIn - The amount sent to `xcall`, normalized to 18 decimals\n * @param nonce - The nonce on the origin domain used to ensure the transferIds are unique\n * @param canonicalId - The unique identifier of the canonical token corresponding to bridge assets\n */\nstruct TransferInfo {\n  uint32 originDomain;\n  uint32 destinationDomain;\n  uint32 canonicalDomain;\n  address to;\n  address delegate;\n  bool receiveLocal;\n  bytes callData;\n  uint256 slippage;\n  address originSender;\n  uint256 bridgedAmt;\n  uint256 normalizedIn;\n  uint256 nonce;\n  bytes32 canonicalId;\n}\n\n/**\n * @notice\n * @param params - The TransferInfo. These are consistent across sending and receiving chains.\n * @param routers - The routers who you are sending the funds on behalf of.\n * @param routerSignatures - Signatures belonging to the routers indicating permission to use funds\n * for the signed transfer ID.\n * @param sequencer - The sequencer who assigned the router path to this transfer.\n * @param sequencerSignature - Signature produced by the sequencer for path assignment accountability\n * for the path that was signed.\n */\nstruct ExecuteArgs {\n  TransferInfo params;\n  address[] routers;\n  bytes[] routerSignatures;\n  address sequencer;\n  bytes sequencerSignature;\n}"
      },
      "@connext/interfaces/libraries/TokenId.sol": {
        "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity ^0.8.17;\n\n// ============= Structs =============\n\n// Tokens are identified by a TokenId:\n// domain - 4 byte chain ID of the chain from which the token originates\n// id - 32 byte identifier of the token address on the origin chain, in that chain's address format\nstruct TokenId {\n  uint32 domain;\n  bytes32 id;\n}\n"
      },
      "@hyperlane-xyz/core/contracts/interfaces/hooks/IPostDispatchHook.sol": {
        "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity >=0.8.0;\n\n/*@@@@@@@       @@@@@@@@@\n @@@@@@@@@       @@@@@@@@@\n  @@@@@@@@@       @@@@@@@@@\n   @@@@@@@@@       @@@@@@@@@\n    @@@@@@@@@@@@@@@@@@@@@@@@@\n     @@@@@  HYPERLANE  @@@@@@@\n    @@@@@@@@@@@@@@@@@@@@@@@@@\n   @@@@@@@@@       @@@@@@@@@\n  @@@@@@@@@       @@@@@@@@@\n @@@@@@@@@       @@@@@@@@@\n@@@@@@@@@       @@@@@@@@*/\n\ninterface IPostDispatchHook {\n    enum Types {\n        UNUSED,\n        ROUTING,\n        AGGREGATION,\n        MERKLE_TREE,\n        INTERCHAIN_GAS_PAYMASTER,\n        FALLBACK_ROUTING,\n        ID_AUTH_ISM,\n        PAUSABLE,\n        PROTOCOL_FEE\n    }\n\n    /**\n     * @notice Returns an enum that represents the type of hook\n     */\n    function hookType() external view returns (uint8);\n\n    /**\n     * @notice Returns whether the hook supports metadata\n     * @param metadata metadata\n     * @return Whether the hook supports metadata\n     */\n    function supportsMetadata(\n        bytes calldata metadata\n    ) external view returns (bool);\n\n    /**\n     * @notice Post action after a message is dispatched via the Mailbox\n     * @param metadata The metadata required for the hook\n     * @param message The message passed from the Mailbox.dispatch() call\n     */\n    function postDispatch(\n        bytes calldata metadata,\n        bytes calldata message\n    ) external payable;\n\n    /**\n     * @notice Compute the payment required by the postDispatch call\n     * @param metadata The metadata required for the hook\n     * @param message The message passed from the Mailbox.dispatch() call\n     * @return Quoted payment for the postDispatch call\n     */\n    function quoteDispatch(\n        bytes calldata metadata,\n        bytes calldata message\n    ) external view returns (uint256);\n}\n"
      },
      "@hyperlane-xyz/core/contracts/interfaces/IInterchainSecurityModule.sol": {
        "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity >=0.6.11;\n\ninterface IInterchainSecurityModule {\n    enum Types {\n        UNUSED,\n        ROUTING,\n        AGGREGATION,\n        LEGACY_MULTISIG,\n        MERKLE_ROOT_MULTISIG,\n        MESSAGE_ID_MULTISIG,\n        NULL, // used with relayer carrying no metadata\n        CCIP_READ\n    }\n\n    /**\n     * @notice Returns an enum that represents the type of security model\n     * encoded by this ISM.\n     * @dev Relayers infer how to fetch and format metadata.\n     */\n    function moduleType() external view returns (uint8);\n\n    /**\n     * @notice Defines a security model responsible for verifying interchain\n     * messages based on the provided metadata.\n     * @param _metadata Off-chain metadata provided by a relayer, specific to\n     * the security model encoded by the module (e.g. validator signatures)\n     * @param _message Hyperlane encoded interchain message\n     * @return True if the message was verified\n     */\n    function verify(\n        bytes calldata _metadata,\n        bytes calldata _message\n    ) external returns (bool);\n}\n\ninterface ISpecifiesInterchainSecurityModule {\n    function interchainSecurityModule()\n        external\n        view\n        returns (IInterchainSecurityModule);\n}\n"
      },
      "@hyperlane-xyz/core/contracts/interfaces/IMailbox.sol": {
        "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity >=0.8.0;\n\nimport {IInterchainSecurityModule} from \"./IInterchainSecurityModule.sol\";\nimport {IPostDispatchHook} from \"./hooks/IPostDispatchHook.sol\";\n\ninterface IMailbox {\n    // ============ Events ============\n    /**\n     * @notice Emitted when a new message is dispatched via Hyperlane\n     * @param sender The address that dispatched the message\n     * @param destination The destination domain of the message\n     * @param recipient The message recipient address on `destination`\n     * @param message Raw bytes of message\n     */\n    event Dispatch(\n        address indexed sender,\n        uint32 indexed destination,\n        bytes32 indexed recipient,\n        bytes message\n    );\n\n    /**\n     * @notice Emitted when a new message is dispatched via Hyperlane\n     * @param messageId The unique message identifier\n     */\n    event DispatchId(bytes32 indexed messageId);\n\n    /**\n     * @notice Emitted when a Hyperlane message is processed\n     * @param messageId The unique message identifier\n     */\n    event ProcessId(bytes32 indexed messageId);\n\n    /**\n     * @notice Emitted when a Hyperlane message is delivered\n     * @param origin The origin domain of the message\n     * @param sender The message sender address on `origin`\n     * @param recipient The address that handled the message\n     */\n    event Process(\n        uint32 indexed origin,\n        bytes32 indexed sender,\n        address indexed recipient\n    );\n\n    function localDomain() external view returns (uint32);\n\n    function delivered(bytes32 messageId) external view returns (bool);\n\n    function defaultIsm() external view returns (IInterchainSecurityModule);\n\n    function defaultHook() external view returns (IPostDispatchHook);\n\n    function requiredHook() external view returns (IPostDispatchHook);\n\n    function latestDispatchedId() external view returns (bytes32);\n\n    function dispatch(\n        uint32 destinationDomain,\n        bytes32 recipientAddress,\n        bytes calldata messageBody\n    ) external payable returns (bytes32 messageId);\n\n    function quoteDispatch(\n        uint32 destinationDomain,\n        bytes32 recipientAddress,\n        bytes calldata messageBody\n    ) external view returns (uint256 fee);\n\n    function dispatch(\n        uint32 destinationDomain,\n        bytes32 recipientAddress,\n        bytes calldata body,\n        bytes calldata defaultHookMetadata\n    ) external payable returns (bytes32 messageId);\n\n    function quoteDispatch(\n        uint32 destinationDomain,\n        bytes32 recipientAddress,\n        bytes calldata messageBody,\n        bytes calldata defaultHookMetadata\n    ) external view returns (uint256 fee);\n\n    function dispatch(\n        uint32 destinationDomain,\n        bytes32 recipientAddress,\n        bytes calldata body,\n        bytes calldata customHookMetadata,\n        IPostDispatchHook customHook\n    ) external payable returns (bytes32 messageId);\n\n    function quoteDispatch(\n        uint32 destinationDomain,\n        bytes32 recipientAddress,\n        bytes calldata messageBody,\n        bytes calldata customHookMetadata,\n        IPostDispatchHook customHook\n    ) external view returns (uint256 fee);\n\n    function process(\n        bytes calldata metadata,\n        bytes calldata message\n    ) external payable;\n\n    function recipientIsm(\n        address recipient\n    ) external view returns (IInterchainSecurityModule module);\n}\n"
      },
      "@hyperlane-xyz/core/contracts/libs/TypeCasts.sol": {
        "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity >=0.6.11;\n\nlibrary TypeCasts {\n    // alignment preserving cast\n    function addressToBytes32(address _addr) internal pure returns (bytes32) {\n        return bytes32(uint256(uint160(_addr)));\n    }\n\n    // alignment preserving cast\n    function bytes32ToAddress(bytes32 _buf) internal pure returns (address) {\n        return address(uint160(uint256(_buf)));\n    }\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.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/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 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    /**\n     * @dev 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/IERC1820RegistryUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1820Registry.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC1820RegistryUpgradeable.sol\";\n"
      },
      "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\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 * 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) || (!AddressUpgradeable.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 Returns the highest version that has been initialized. See {reinitializer}.\n     */\n    function _getInitializedVersion() internal view returns (uint8) {\n        return _initialized;\n    }\n\n    /**\n     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n     */\n    function _isInitializing() internal view returns (bool) {\n        return _initializing;\n    }\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/IERC20Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 amount\n    ) external returns (bool);\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n    using AddressUpgradeable for address;\n\n    function safeTransfer(\n        IERC20Upgradeable token,\n        address to,\n        uint256 value\n    ) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n    }\n\n    function safeTransferFrom(\n        IERC20Upgradeable token,\n        address from,\n        address to,\n        uint256 value\n    ) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n    }\n\n    /**\n     * @dev Deprecated. This function has issues similar to the ones found in\n     * {IERC20-approve}, and its usage is discouraged.\n     *\n     * Whenever possible, use {safeIncreaseAllowance} and\n     * {safeDecreaseAllowance} instead.\n     */\n    function safeApprove(\n        IERC20Upgradeable token,\n        address spender,\n        uint256 value\n    ) internal {\n        // safeApprove should only be called when setting an initial allowance,\n        // or when resetting it to zero. To increase and decrease it, use\n        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n        require(\n            (value == 0) || (token.allowance(address(this), spender) == 0),\n            \"SafeERC20: approve from non-zero to non-zero allowance\"\n        );\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n    }\n\n    function safeIncreaseAllowance(\n        IERC20Upgradeable token,\n        address spender,\n        uint256 value\n    ) internal {\n        uint256 newAllowance = token.allowance(address(this), spender) + value;\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n    }\n\n    function safeDecreaseAllowance(\n        IERC20Upgradeable token,\n        address spender,\n        uint256 value\n    ) internal {\n        unchecked {\n            uint256 oldAllowance = token.allowance(address(this), spender);\n            require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n            uint256 newAllowance = oldAllowance - value;\n            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n        }\n    }\n\n    function safePermit(\n        IERC20PermitUpgradeable token,\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal {\n        uint256 nonceBefore = token.nonces(owner);\n        token.permit(owner, spender, value, deadline, v, r, s);\n        uint256 nonceAfter = token.nonces(owner);\n        require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     */\n    function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n        if (returndata.length > 0) {\n            // Return data is optional\n            require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/token/ERC777/IERC777RecipientUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.\n *\n * Accounts can be notified of {IERC777} tokens being sent to them by having a\n * contract implement this interface (contract holders can be their own\n * implementer) and registering it on the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\n *\n * See {IERC1820Registry} and {ERC1820Implementer}.\n */\ninterface IERC777RecipientUpgradeable {\n    /**\n     * @dev Called by an {IERC777} token contract whenever tokens are being\n     * moved or created into a registered account (`to`). The type of operation\n     * is conveyed by `from` being the zero address or not.\n     *\n     * This call occurs _after_ the token contract's state is updated, so\n     * {IERC777-balanceOf}, etc., can be used to query the post-operation state.\n     *\n     * This function may revert to prevent the operation from being executed.\n     */\n    function tokensReceived(\n        address operator,\n        address from,\n        address to,\n        uint256 amount,\n        bytes calldata userData,\n        bytes calldata operatorData\n    ) external;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/token/ERC777/IERC777Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC777/IERC777.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777Token standard as defined in the EIP.\n *\n * This contract uses the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let\n * token holders and recipients react to token movements by using setting implementers\n * for the associated interfaces in said registry. See {IERC1820Registry} and\n * {ERC1820Implementer}.\n */\ninterface IERC777Upgradeable {\n    /**\n     * @dev Emitted when `amount` tokens are created by `operator` and assigned to `to`.\n     *\n     * Note that some additional user `data` and `operatorData` can be logged in the event.\n     */\n    event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);\n\n    /**\n     * @dev Emitted when `operator` destroys `amount` tokens from `account`.\n     *\n     * Note that some additional user `data` and `operatorData` can be logged in the event.\n     */\n    event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);\n\n    /**\n     * @dev Emitted when `operator` is made operator for `tokenHolder`.\n     */\n    event AuthorizedOperator(address indexed operator, address indexed tokenHolder);\n\n    /**\n     * @dev Emitted when `operator` is revoked its operator status for `tokenHolder`.\n     */\n    event RevokedOperator(address indexed operator, address indexed tokenHolder);\n\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, usually a shorter version of the\n     * name.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the smallest part of the token that is not divisible. This\n     * means all token operations (creation, movement and destruction) must have\n     * amounts that are a multiple of this number.\n     *\n     * For most token contracts, this value will equal 1.\n     */\n    function granularity() external view returns (uint256);\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 an account (`owner`).\n     */\n    function balanceOf(address owner) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `recipient`.\n     *\n     * If send or receive hooks are registered for the caller and `recipient`,\n     * the corresponding functions will be called with `data` and empty\n     * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n     *\n     * Emits a {Sent} event.\n     *\n     * Requirements\n     *\n     * - the caller must have at least `amount` tokens.\n     * - `recipient` cannot be the zero address.\n     * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n     * interface.\n     */\n    function send(\n        address recipient,\n        uint256 amount,\n        bytes calldata data\n    ) external;\n\n    /**\n     * @dev Destroys `amount` tokens from the caller's account, reducing the\n     * total supply.\n     *\n     * If a send hook is registered for the caller, the corresponding function\n     * will be called with `data` and empty `operatorData`. See {IERC777Sender}.\n     *\n     * Emits a {Burned} event.\n     *\n     * Requirements\n     *\n     * - the caller must have at least `amount` tokens.\n     */\n    function burn(uint256 amount, bytes calldata data) external;\n\n    /**\n     * @dev Returns true if an account is an operator of `tokenHolder`.\n     * Operators can send and burn tokens on behalf of their owners. All\n     * accounts are their own operator.\n     *\n     * See {operatorSend} and {operatorBurn}.\n     */\n    function isOperatorFor(address operator, address tokenHolder) external view returns (bool);\n\n    /**\n     * @dev Make an account an operator of the caller.\n     *\n     * See {isOperatorFor}.\n     *\n     * Emits an {AuthorizedOperator} event.\n     *\n     * Requirements\n     *\n     * - `operator` cannot be calling address.\n     */\n    function authorizeOperator(address operator) external;\n\n    /**\n     * @dev Revoke an account's operator status for the caller.\n     *\n     * See {isOperatorFor} and {defaultOperators}.\n     *\n     * Emits a {RevokedOperator} event.\n     *\n     * Requirements\n     *\n     * - `operator` cannot be calling address.\n     */\n    function revokeOperator(address operator) external;\n\n    /**\n     * @dev Returns the list of default operators. These accounts are operators\n     * for all token holders, even if {authorizeOperator} was never called on\n     * them.\n     *\n     * This list is immutable, but individual holders may revoke these via\n     * {revokeOperator}, in which case {isOperatorFor} will return false.\n     */\n    function defaultOperators() external view returns (address[] memory);\n\n    /**\n     * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must\n     * be an operator of `sender`.\n     *\n     * If send or receive hooks are registered for `sender` and `recipient`,\n     * the corresponding functions will be called with `data` and\n     * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.\n     *\n     * Emits a {Sent} event.\n     *\n     * Requirements\n     *\n     * - `sender` cannot be the zero address.\n     * - `sender` must have at least `amount` tokens.\n     * - the caller must be an operator for `sender`.\n     * - `recipient` cannot be the zero address.\n     * - if `recipient` is a contract, it must implement the {IERC777Recipient}\n     * interface.\n     */\n    function operatorSend(\n        address sender,\n        address recipient,\n        uint256 amount,\n        bytes calldata data,\n        bytes calldata operatorData\n    ) external;\n\n    /**\n     * @dev Destroys `amount` tokens from `account`, reducing the total supply.\n     * The caller must be an operator of `account`.\n     *\n     * If a send hook is registered for `account`, the corresponding function\n     * will be called with `data` and `operatorData`. See {IERC777Sender}.\n     *\n     * Emits a {Burned} event.\n     *\n     * Requirements\n     *\n     * - `account` cannot be the zero address.\n     * - `account` must have at least `amount` tokens.\n     * - the caller must be an operator for `account`.\n     */\n    function operatorBurn(\n        address account,\n        uint256 amount,\n        bytes calldata data,\n        bytes calldata operatorData\n    ) external;\n\n    event Sent(\n        address indexed operator,\n        address indexed from,\n        address indexed to,\n        uint256 amount,\n        bytes data,\n        bytes operatorData\n    );\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.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 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 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 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-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     * @dev 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/IERC1820RegistryUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/introspection/IERC1820Registry.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the global ERC1820 Registry, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register\n * implementers for interfaces in this registry, as well as query support.\n *\n * Implementers may be shared by multiple accounts, and can also implement more\n * than a single interface for each account. Contracts can implement interfaces\n * for themselves, but externally-owned accounts (EOA) must delegate this to a\n * contract.\n *\n * {IERC165} interfaces can also be queried via the registry.\n *\n * For an in-depth explanation and source code analysis, see the EIP text.\n */\ninterface IERC1820RegistryUpgradeable {\n    event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer);\n\n    event ManagerChanged(address indexed account, address indexed newManager);\n\n    /**\n     * @dev Sets `newManager` as the manager for `account`. A manager of an\n     * account is able to set interface implementers for it.\n     *\n     * By default, each account is its own manager. Passing a value of `0x0` in\n     * `newManager` will reset the manager to this initial state.\n     *\n     * Emits a {ManagerChanged} event.\n     *\n     * Requirements:\n     *\n     * - the caller must be the current manager for `account`.\n     */\n    function setManager(address account, address newManager) external;\n\n    /**\n     * @dev Returns the manager for `account`.\n     *\n     * See {setManager}.\n     */\n    function getManager(address account) external view returns (address);\n\n    /**\n     * @dev Sets the `implementer` contract as ``account``'s implementer for\n     * `interfaceHash`.\n     *\n     * `account` being the zero address is an alias for the caller's address.\n     * The zero address can also be used in `implementer` to remove an old one.\n     *\n     * See {interfaceHash} to learn how these are created.\n     *\n     * Emits an {InterfaceImplementerSet} event.\n     *\n     * Requirements:\n     *\n     * - the caller must be the current manager for `account`.\n     * - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not\n     * end in 28 zeroes).\n     * - `implementer` must implement {IERC1820Implementer} and return true when\n     * queried for support, unless `implementer` is the caller. See\n     * {IERC1820Implementer-canImplementInterfaceForAddress}.\n     */\n    function setInterfaceImplementer(\n        address account,\n        bytes32 _interfaceHash,\n        address implementer\n    ) external;\n\n    /**\n     * @dev Returns the implementer of `interfaceHash` for `account`. If no such\n     * implementer is registered, returns the zero address.\n     *\n     * If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28\n     * zeroes), `account` will be queried for support of it.\n     *\n     * `account` being the zero address is an alias for the caller's address.\n     */\n    function getInterfaceImplementer(address account, bytes32 _interfaceHash) external view returns (address);\n\n    /**\n     * @dev Returns the interface hash for an `interfaceName`, as defined in the\n     * corresponding\n     * https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP].\n     */\n    function interfaceHash(string calldata interfaceName) external pure returns (bytes32);\n\n    /**\n     * @notice Updates the cache with whether the contract implements an ERC165 interface or not.\n     * @param account Address of the contract for which to update the cache.\n     * @param interfaceId ERC165 interface for which to update the cache.\n     */\n    function updateERC165Cache(address account, bytes4 interfaceId) external;\n\n    /**\n     * @notice Checks whether a contract implements an ERC165 interface or not.\n     * If the result is not cached a direct lookup on the contract address is performed.\n     * If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling\n     * {updateERC165Cache} with the contract address.\n     * @param account Address of the contract to check.\n     * @param interfaceId ERC165 interface to check.\n     * @return True if `account` implements `interfaceId`, false otherwise.\n     */\n    function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool);\n\n    /**\n     * @notice Checks whether a contract implements an ERC165 interface or not without using or updating the cache.\n     * @param account Address of the contract to check.\n     * @param interfaceId ERC165 interface to check.\n     * @return True if `account` implements `interfaceId`, false otherwise.\n     */\n    function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool);\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.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 EnumerableSetUpgradeable {\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Set type with\n    // bytes32 values.\n    // The Set implementation uses private functions, and user-facing\n    // implementations (such as AddressSet) are just wrappers around the\n    // underlying Set.\n    // This means that we can only create new EnumerableSets for types that fit\n    // in bytes32.\n\n    struct Set {\n        // Storage of set values\n        bytes32[] _values;\n        // 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"
      },
      "@openzeppelin/contracts/access/Ownable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling 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/IERC777Recipient.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC777Recipient.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC777/IERC777Recipient.sol\";\n"
      },
      "@openzeppelin/contracts/security/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == _ENTERED;\n    }\n}\n"
      },
      "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.\n *\n * Accounts can be notified of {IERC777} tokens being sent to them by having a\n * contract implement this interface (contract holders can be their own\n * implementer) and registering it on the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\n *\n * See {IERC1820Registry} and {ERC1820Implementer}.\n */\ninterface IERC777Recipient {\n    /**\n     * @dev Called by an {IERC777} token contract whenever tokens are being\n     * moved or created into a registered account (`to`). The type of operation\n     * is conveyed by `from` being the zero address or not.\n     *\n     * This call occurs _after_ the token contract's state is updated, so\n     * {IERC777-balanceOf}, etc., can be used to query the post-operation state.\n     *\n     * This function may revert to prevent the operation from being executed.\n     */\n    function tokensReceived(\n        address operator,\n        address from,\n        address to,\n        uint256 amount,\n        bytes calldata userData,\n        bytes calldata operatorData\n    ) external;\n}\n"
      },
      "@openzeppelin/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (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    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/math/Math.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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 256, 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 << 3) < value ? 1 : 0);\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/math/SignedMath.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n    /**\n     * @dev Returns the largest of two signed numbers.\n     */\n    function max(int256 a, int256 b) internal pure returns (int256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two signed numbers.\n     */\n    function min(int256 a, int256 b) internal pure returns (int256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two signed numbers without overflow.\n     * The result is rounded towards zero.\n     */\n    function average(int256 a, int256 b) internal pure returns (int256) {\n        // Formula from the book \"Hacker's Delight\"\n        int256 x = (a & b) + ((a ^ b) >> 1);\n        return x + (int256(uint256(x) >> 255) & (a ^ b));\n    }\n\n    /**\n     * @dev Returns the absolute unsigned value of a signed value.\n     */\n    function abs(int256 n) internal pure returns (uint256) {\n        unchecked {\n            // must be unchecked in order to support `n = type(int256).min`\n            return uint256(n >= 0 ? n : -n);\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Strings.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.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 `int256` to its ASCII `string` decimal representation.\n     */\n    function toString(int256 value) internal pure returns (string memory) {\n        return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\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    /**\n     * @dev Returns true if the two strings are equal.\n     */\n    function equal(string memory a, string memory b) internal pure returns (bool) {\n        return keccak256(bytes(a)) == keccak256(bytes(b));\n    }\n}\n"
      },
      "contracts/adapters/Adapter.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { IAdapter } from \"../interfaces/IAdapter.sol\";\n\nabstract contract Adapter is IAdapter {\n    mapping(uint256 => mapping(uint256 => bytes32)) private _hashes;\n\n    /// @inheritdoc IAdapter\n    function getHash(uint256 domain, uint256 id) public view returns (bytes32) {\n        return _hashes[domain][id];\n    }\n\n    function _storeHashes(uint256 domain, uint256[] memory ids, bytes32[] memory hashes) internal {\n        for (uint256 i = 0; i < ids.length; ) {\n            _storeHash(domain, ids[i], hashes[i]);\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    function _storeHash(uint256 domain, uint256 id, bytes32 hash) internal {\n        bytes32 currentHash = _hashes[domain][id];\n        if (currentHash != hash) {\n            _hashes[domain][id] = hash;\n            emit HashStored(id, hash);\n        }\n    }\n}\n"
      },
      "contracts/adapters/Axelar/AxelarReporter.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport { Strings } from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport { IAxelarGateway } from \"@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGateway.sol\";\nimport { IAxelarGasService } from \"@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGasService.sol\";\nimport { Reporter } from \"../Reporter.sol\";\n\ncontract AxelarReporter is Reporter, Ownable {\n    using Strings for uint256;\n\n    string public constant PROVIDER = \"axelar\";\n    bytes32 private constant NULL_STRING = keccak256(\"\");\n    IAxelarGateway public immutable AXELAR_GATEWAY;\n    IAxelarGasService public immutable AXELAR_GAS_SERVICE;\n\n    mapping(uint256 => string) public chainNames;\n\n    error ChainIdNotSupported(uint256 chainId);\n\n    event ChainNameSet(uint256 indexed chainId, string indexed chainName);\n\n    constructor(\n        address headerStorage,\n        address yaho,\n        address axelarGateway,\n        address axelarGasService\n    ) Reporter(headerStorage, yaho) {\n        AXELAR_GATEWAY = IAxelarGateway(axelarGateway);\n        AXELAR_GAS_SERVICE = IAxelarGasService(axelarGasService);\n    }\n\n    function setChainNameByChainId(uint256 chainId, string calldata chainName) external onlyOwner {\n        chainNames[chainId] = chainName;\n        emit ChainNameSet(chainId, chainName);\n    }\n\n    function _dispatch(\n        uint256 targetChainId,\n        address adapter,\n        uint256[] memory ids,\n        bytes32[] memory hashes\n    ) internal override returns (bytes32) {\n        string memory targetChainName = chainNames[targetChainId];\n        if (keccak256(abi.encode(targetChainName)) == NULL_STRING) revert ChainIdNotSupported(targetChainId);\n\n        string memory sAdapter = uint256(uint160(adapter)).toHexString(20);\n        bytes memory payload = abi.encode(ids, hashes);\n\n        if (msg.value > 0) {\n            AXELAR_GAS_SERVICE.payNativeGasForContractCall{ value: msg.value }(\n                address(this),\n                targetChainName,\n                sAdapter,\n                payload,\n                msg.sender\n            );\n        }\n\n        AXELAR_GATEWAY.callContract(targetChainName, sAdapter, payload);\n        return bytes32(0);\n    }\n}\n"
      },
      "contracts/adapters/BlockHashAdapter.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { RLPReader } from \"solidity-rlp/contracts/RLPReader.sol\";\nimport { Adapter } from \"./Adapter.sol\";\nimport { IBlockHashAdapter } from \"../interfaces/IBlockHashAdapter.sol\";\n\nabstract contract BlockHashAdapter is IBlockHashAdapter, Adapter {\n    using RLPReader for RLPReader.RLPItem;\n\n    /// @inheritdoc IBlockHashAdapter\n    function proveAncestralBlockHashes(uint256 chainId, bytes[] memory blockHeaders) external {\n        for (uint256 i = 0; i < blockHeaders.length; i++) {\n            RLPReader.RLPItem memory blockHeaderRLP = RLPReader.toRlpItem(blockHeaders[i]);\n\n            if (!blockHeaderRLP.isList()) revert InvalidBlockHeaderRLP();\n\n            RLPReader.RLPItem[] memory blockHeaderContent = blockHeaderRLP.toList();\n\n            // A block header should have between 15 and 17 elements (baseFee and withdrawalsRoot have been added later)\n            if (blockHeaderContent.length < 15 || blockHeaderContent.length > 17)\n                revert InvalidBlockHeaderLength(blockHeaderContent.length);\n\n            bytes32 blockParent = bytes32(blockHeaderContent[0].toUint());\n            uint256 blockNumber = uint256(blockHeaderContent[8].toUint());\n\n            bytes32 blockHash = keccak256(blockHeaders[i]);\n            bytes32 storedBlockHash = getHash(chainId, blockNumber);\n\n            if (blockHash != storedBlockHash) revert ConflictingBlockHeader(blockNumber, blockHash, storedBlockHash);\n\n            _storeHash(chainId, blockNumber - 1, blockParent);\n        }\n    }\n}\n"
      },
      "contracts/adapters/Connext/ConnextAdapter.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport { IXReceiver } from \"@connext/interfaces/core/IXReceiver.sol\";\nimport { BlockHashAdapter } from \"../BlockHashAdapter.sol\";\n\ncontract ConnextAdapter is BlockHashAdapter, Ownable, IXReceiver {\n    string public constant PROVIDER = \"connext\";\n    address public immutable CONNEXT;\n\n    mapping(uint32 => address) public enabledReporters;\n    mapping(uint32 => uint256) public chainIds;\n\n    error UnauthorizedConnextReceive();\n\n    event ReporterSet(uint256 indexed chainId, uint32 indexed domainId, address indexed reporter);\n\n    constructor(address connext) {\n        CONNEXT = connext;\n    }\n\n    function setReporterByChain(uint256 chainId, uint32 domainId, address reporter) external onlyOwner {\n        enabledReporters[domainId] = reporter;\n        chainIds[domainId] = chainId;\n        emit ReporterSet(chainId, domainId, reporter);\n    }\n\n    function xReceive(\n        bytes32 /* transferId_ */,\n        uint256 /* amount_ */,\n        address /* asset_ */,\n        address originSender,\n        uint32 origin,\n        bytes memory callData\n    ) external returns (bytes memory) {\n        if (msg.sender != CONNEXT || enabledReporters[origin] != originSender) revert UnauthorizedConnextReceive();\n        uint256 sourceChainId = chainIds[origin];\n        (uint256[] memory ids, bytes32[] memory hashes) = abi.decode(callData, (uint256[], bytes32[]));\n        _storeHashes(sourceChainId, ids, hashes);\n        return \"\";\n    }\n}\n"
      },
      "contracts/adapters/Connext/ConnextReporter.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport { IConnext } from \"@connext/interfaces/core/IConnext.sol\";\nimport { Reporter } from \"../Reporter.sol\";\n\ncontract ConnextReporter is Reporter, Ownable {\n    string public constant PROVIDER = \"connext\";\n    IConnext public immutable CONNEXT;\n\n    mapping(uint256 => uint32) public domainIds;\n\n    error DomainIdNotAvailable();\n\n    event DomainIdSet(uint256 indexed chainId, uint32 indexed domainId);\n    event ConnextTransfer(bytes32 transferId);\n\n    constructor(address headerStorage, address yaho, address connext) Reporter(headerStorage, yaho) {\n        CONNEXT = IConnext(connext);\n    }\n\n    function setDomainIdByChainId(uint256 chainId, uint32 domainId) external onlyOwner {\n        domainIds[chainId] = domainId;\n        emit DomainIdSet(chainId, domainId);\n    }\n\n    function _dispatch(\n        uint256 targetChainId,\n        address adapter,\n        uint256[] memory ids,\n        bytes32[] memory hashes\n    ) internal override returns (bytes32) {\n        uint32 targetDomainId = domainIds[targetChainId];\n        if (targetDomainId == 0) revert DomainIdNotAvailable();\n        bytes memory payload = abi.encode(ids, hashes);\n        bytes32 transferId = CONNEXT.xcall{ value: msg.value }(\n            targetDomainId, // _destination: Domain ID of the destination chain\n            adapter, // _to: address of the target contract\n            address(0), // _asset: use address zero for 0-value transfers\n            msg.sender, // _delegate: address that can revert or forceLocal on destination\n            0, // _amount: 0 because no funds are being transferred\n            0, // _slippage: can be anything between 0-10000 because no funds are being transferred\n            payload // _callData: the encoded calldata to send\n        );\n        emit ConnextTransfer(transferId);\n\n        return bytes32(0);\n    }\n}\n"
      },
      "contracts/adapters/DendrETH/DendrETHAdapter.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { ILightClient, LightClientUpdate } from \"./interfaces/IDendrETH.sol\";\nimport { SSZ } from \"../Telepathy/libraries/SimpleSerialize.sol\";\nimport { BlockHashAdapter } from \"../BlockHashAdapter.sol\";\n\ncontract DendrETHAdapter is BlockHashAdapter {\n    uint256 public immutable SOURCE_CHAIN_ID;\n    address public immutable DENDRETH;\n\n    error InvalidUpdate();\n    error BlockHeaderNotAvailable(uint256 slot);\n    error InvalidBlockNumberProof();\n    error InvalidBlockHashProof();\n\n    constructor(uint256 sourceChainId, address dendreth) {\n        SOURCE_CHAIN_ID = sourceChainId;\n        DENDRETH = dendreth;\n    }\n\n    /// @notice Stores the block header for a given block only if it exists\n    //          in the DendrETH Light Client for the SOURCE_CHAIN_ID.\n    function storeBlockHeader(\n        uint64 slot,\n        uint256 blockNumber,\n        bytes32[] calldata blockNumberProof,\n        bytes32 blockHash,\n        bytes32[] calldata blockHashProof\n    ) external {\n        ILightClient lightClient = ILightClient(DENDRETH);\n\n        uint256 currentIndex = lightClient.currentIndex();\n        uint256 i = currentIndex;\n        bool found = false;\n\n        do {\n            if (slot == lightClient.optimisticSlots(i)) {\n                found = true;\n                break;\n            }\n            if (i == 0) {\n                i = 32;\n            }\n            i--;\n        } while (i != currentIndex);\n\n        if (!found) {\n            revert BlockHeaderNotAvailable(slot);\n        }\n\n        bytes32 blockHeaderRoot = lightClient.optimisticHeaders(i);\n\n        if (!SSZ.verifyBlockNumber(blockNumber, blockNumberProof, blockHeaderRoot)) {\n            revert InvalidBlockNumberProof();\n        }\n\n        if (!SSZ.verifyBlockHash(blockHash, blockHashProof, blockHeaderRoot)) {\n            revert InvalidBlockHashProof();\n        }\n\n        _storeHash(SOURCE_CHAIN_ID, blockNumber, blockHash);\n    }\n\n    /// @notice Updates DendrETH Light client and stores the given block\n    //          for the update\n    function storeBlockHeader(\n        uint64 slot,\n        uint256 blockNumber,\n        bytes32[] calldata blockNumberProof,\n        bytes32 blockHash,\n        bytes32[] calldata blockHashProof,\n        LightClientUpdate calldata update\n    ) external {\n        ILightClient lightClient = ILightClient(DENDRETH);\n\n        lightClient.light_client_update(update);\n\n        if (lightClient.optimisticHeaderSlot() != slot) {\n            revert InvalidUpdate();\n        }\n\n        bytes32 blockHeaderRoot = lightClient.optimisticHeaderRoot();\n\n        if (!SSZ.verifyBlockNumber(blockNumber, blockNumberProof, blockHeaderRoot)) {\n            revert InvalidBlockNumberProof();\n        }\n\n        if (!SSZ.verifyBlockHash(blockHash, blockHashProof, blockHeaderRoot)) {\n            revert InvalidBlockHashProof();\n        }\n\n        _storeHash(SOURCE_CHAIN_ID, blockNumber, blockHash);\n    }\n}\n"
      },
      "contracts/adapters/DendrETH/interfaces/IDendrETH.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity 0.8.20;\n\nstruct LightClientUpdate {\n    bytes32 attestedHeaderRoot;\n    uint256 attestedHeaderSlot;\n    bytes32 finalizedHeaderRoot;\n    bytes32 finalizedExecutionStateRoot;\n    uint256[2] a;\n    uint256[2][2] b;\n    uint256[2] c;\n}\n\ninterface ILightClient {\n    function currentIndex() external view returns (uint256);\n\n    function optimisticHeaders(uint256 index) external view returns (bytes32);\n\n    function optimisticHeaderRoot() external view returns (bytes32);\n\n    function optimisticSlots(uint256 index) external view returns (uint256);\n\n    function optimisticHeaderSlot() external view returns (uint256);\n\n    function light_client_update(LightClientUpdate calldata update) external;\n}\n"
      },
      "contracts/adapters/Hyperlane/HyperlaneReporter.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport { IMailbox } from \"@hyperlane-xyz/core/contracts/interfaces/IMailbox.sol\";\nimport { TypeCasts } from \"@hyperlane-xyz/core/contracts/libs/TypeCasts.sol\";\nimport { Reporter } from \"../Reporter.sol\";\n\ncontract HyperlaneReporter is Reporter, Ownable {\n    using TypeCasts for address;\n\n    string public constant PROVIDER = \"hyperlane\";\n    IMailbox public immutable HYPERLANE_MAILBOX;\n\n    mapping(uint256 => uint32) public domains;\n\n    error DomainNotAvailable();\n\n    event DomainSet(uint256 indexed chainId, uint32 indexed domain);\n\n    constructor(address headerStorage, address yaho, address hyperlaneMailbox) Reporter(headerStorage, yaho) {\n        HYPERLANE_MAILBOX = IMailbox(hyperlaneMailbox);\n    }\n\n    function setDomainByChainId(uint256 chainId, uint32 domain) external onlyOwner {\n        domains[chainId] = domain;\n        emit DomainSet(chainId, domain);\n    }\n\n    function _dispatch(\n        uint256 targetChainId,\n        address adapter,\n        uint256[] memory ids,\n        bytes32[] memory hashes\n    ) internal override returns (bytes32) {\n        uint32 targetDomain = domains[targetChainId];\n        if (targetDomain == 0) revert DomainNotAvailable();\n        bytes memory payload = abi.encode(ids, hashes);\n        HYPERLANE_MAILBOX.dispatch{ value: msg.value }(targetDomain, adapter.addressToBytes32(), payload);\n\n        return bytes32(0);\n    }\n}\n"
      },
      "contracts/adapters/PNetwork/PNetworkAdapter.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport { IERC777Recipient } from \"@openzeppelin/contracts/interfaces/IERC777Recipient.sol\";\nimport { IERC1820RegistryUpgradeable } from \"@openzeppelin/contracts-upgradeable/interfaces/IERC1820RegistryUpgradeable.sol\";\nimport { BlockHashAdapter } from \"../BlockHashAdapter.sol\";\n\ncontract PNetworkAdapter is BlockHashAdapter, Ownable {\n    string public constant PROVIDER = \"pnetwork\";\n\n    address public immutable VAULT;\n    address public immutable TOKEN;\n    IERC1820RegistryUpgradeable private constant ERC1820 =\n        IERC1820RegistryUpgradeable(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);\n    bytes32 private constant TOKENS_RECIPIENT_INTERFACE_HASH = keccak256(\"ERC777TokensRecipient\");\n\n    mapping(bytes4 => address) public enabledReporters;\n    mapping(bytes4 => uint256) public chainIds;\n\n    error InvalidSender(address sender, address expected);\n    error InvalidToken(address token, address expected);\n    error UnauthorizedPNetworkReceive();\n\n    event ReporterSet(uint256 indexed chainId, bytes4 indexed networkId, address indexed reporter);\n\n    modifier onlySupportedToken(address _tokenAddress) {\n        if (_tokenAddress != TOKEN) revert InvalidToken(_tokenAddress, TOKEN);\n        _;\n    }\n\n    constructor(address pNetworkVault, address pNetworkToken) {\n        VAULT = pNetworkVault;\n        TOKEN = pNetworkToken;\n        ERC1820.setInterfaceImplementer(address(this), TOKENS_RECIPIENT_INTERFACE_HASH, address(this));\n    }\n\n    // Implement the ERC777TokensRecipient interface\n    function tokensReceived(\n        address,\n        address from,\n        address,\n        uint256,\n        bytes calldata data,\n        bytes calldata\n    ) external onlySupportedToken(msg.sender) {\n        if (from != VAULT) revert InvalidSender(from, VAULT);\n        (, bytes memory userData, bytes4 networkId, address sender) = abi.decode(\n            data,\n            (bytes1, bytes, bytes4, address)\n        );\n        if (enabledReporters[networkId] != sender) revert UnauthorizedPNetworkReceive();\n        (uint256[] memory ids, bytes32[] memory hashes) = abi.decode(userData, (uint256[], bytes32[]));\n        _storeHashes(chainIds[networkId], ids, hashes);\n    }\n\n    function setReporterByChain(uint256 chainId, bytes4 networkId, address reporter) external onlyOwner {\n        enabledReporters[networkId] = reporter;\n        chainIds[networkId] = chainId;\n        emit ReporterSet(chainId, networkId, reporter);\n    }\n}\n"
      },
      "contracts/adapters/PNetwork/test/MockVault.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\n// NOTE: This special version of the pTokens-erc20-vault is for ETH mainnet, and includes custom\n// logic to handle ETHPNT<->PNT fungibility, as well as custom logic to handle GALA tokens after\n// they upgraded from v1 to v2.\n\npragma solidity ^0.8.20;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC777/IERC777Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC777/IERC777RecipientUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC1820RegistryUpgradeable.sol\";\n\ncontract MockVault is Initializable, IERC777RecipientUpgradeable {\n    using SafeERC20Upgradeable for IERC20Upgradeable;\n    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;\n\n    IERC1820RegistryUpgradeable private constant _erc1820 =\n        IERC1820RegistryUpgradeable(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);\n    bytes32 private constant TOKENS_RECIPIENT_INTERFACE_HASH = keccak256(\"ERC777TokensRecipient\");\n    bytes32 private constant Erc777Token_INTERFACE_HASH = keccak256(\"ERC777Token\");\n    EnumerableSetUpgradeable.AddressSet private supportedTokens;\n    bytes4 public ORIGIN_CHAIN_ID;\n\n    event PegIn(\n        address _tokenAddress,\n        address _tokenSender,\n        uint256 _tokenAmount,\n        string _destinationAddress,\n        bytes _userData,\n        bytes4 _originChainId,\n        bytes4 _destinationChainId\n    );\n\n    function initialize(address[] memory _tokensToSupport, bytes4 _originChainId) public initializer {\n        for (uint256 i = 0; i < _tokensToSupport.length; i++) {\n            supportedTokens.add(_tokensToSupport[i]);\n        }\n        _erc1820.setInterfaceImplementer(address(this), TOKENS_RECIPIENT_INTERFACE_HASH, address(this));\n        ORIGIN_CHAIN_ID = _originChainId;\n    }\n\n    modifier onlySupportedTokens(address _tokenAddress) {\n        require(supportedTokens.contains(_tokenAddress), \"Token at supplied address is NOT supported!\");\n        _;\n    }\n\n    function pegIn(\n        uint256 _tokenAmount,\n        address _tokenAddress,\n        string calldata _destinationAddress,\n        bytes4 _destinationChainId\n    ) external returns (bool) {\n        return pegIn(_tokenAmount, _tokenAddress, _destinationAddress, \"\", _destinationChainId);\n    }\n\n    function pegIn(\n        uint256 _tokenAmount,\n        address _tokenAddress,\n        string memory _destinationAddress,\n        bytes memory _userData,\n        bytes4 _destinationChainId\n    ) public onlySupportedTokens(_tokenAddress) returns (bool) {\n        require(_tokenAmount > 0, \"Token amount must be greater than zero!\");\n        IERC20Upgradeable(_tokenAddress).safeTransferFrom(msg.sender, address(this), _tokenAmount);\n\n        require(_tokenAddress != address(0), \"`_tokenAddress` is set to zero address!\");\n\n        emit PegIn(\n            _tokenAddress,\n            msg.sender,\n            _tokenAmount,\n            _destinationAddress,\n            _userData,\n            ORIGIN_CHAIN_ID,\n            _destinationChainId\n        );\n\n        return true;\n    }\n\n    /**\n     * @dev Implementation of IERC777Recipient.\n     */\n    function tokensReceived(\n        address /*operator*/,\n        address from,\n        address to,\n        uint256 amount,\n        bytes calldata userData,\n        bytes calldata /*operatorData*/\n    ) external override onlySupportedTokens(msg.sender) {\n        require(to == address(this), \"Token receiver is not this contract\");\n        if (userData.length > 0) {\n            require(amount > 0, \"Token amount must be greater than zero!\");\n            (bytes32 tag, string memory _destinationAddress, bytes4 _destinationChainId) = abi.decode(\n                userData,\n                (bytes32, string, bytes4)\n            );\n            require(tag == keccak256(\"ERC777-pegIn\"), \"Invalid tag for automatic pegIn on ERC777 send\");\n            emit PegIn(msg.sender, from, amount, _destinationAddress, userData, ORIGIN_CHAIN_ID, _destinationChainId);\n        }\n    }\n\n    function pegOut(\n        address payable _tokenRecipient,\n        address _tokenAddress,\n        uint256 _tokenAmount,\n        bytes calldata _userData\n    ) external returns (bool success) {\n        return pegOutTokens(_tokenAddress, _tokenRecipient, _tokenAmount, _userData);\n    }\n\n    function pegOutTokens(\n        address _tokenAddress,\n        address _tokenRecipient,\n        uint256 _tokenAmount,\n        bytes memory _userData\n    ) internal returns (bool success) {\n        if (tokenIsErc777(_tokenAddress)) {\n            // NOTE: This is an ERC777 token, so let's use its `send` function so that hooks are called...\n            IERC777Upgradeable(_tokenAddress).send(_tokenRecipient, _tokenAmount, _userData);\n        } else {\n            // NOTE: Otherwise, we use standard ERC20 transfer function instead.\n            IERC20Upgradeable(_tokenAddress).safeTransfer(_tokenRecipient, _tokenAmount);\n        }\n        return true;\n    }\n\n    function tokenIsErc777(address _tokenAddress) internal view returns (bool) {\n        return _erc1820.getInterfaceImplementer(_tokenAddress, Erc777Token_INTERFACE_HASH) != address(0);\n    }\n\n    receive() external payable {}\n\n    function changeOriginChainId(bytes4 _newOriginChainId) public returns (bool success) {\n        ORIGIN_CHAIN_ID = _newOriginChainId;\n        return true;\n    }\n}\n"
      },
      "contracts/adapters/Reporter.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { IHeaderStorage } from \"../interfaces/IHeaderStorage.sol\";\nimport { IReporter } from \"../interfaces/IReporter.sol\";\nimport { IAdapter } from \"../interfaces/IAdapter.sol\";\n\nabstract contract Reporter is IReporter {\n    address public immutable HEADER_STORAGE;\n    address public immutable YAHO;\n\n    modifier onlyYaho() {\n        if (msg.sender != YAHO) revert NotYaho(msg.sender, YAHO);\n        _;\n    }\n\n    constructor(address headerStorage, address yaho) {\n        HEADER_STORAGE = headerStorage;\n        YAHO = yaho;\n    }\n\n    /// @inheritdoc IReporter\n    function dispatchBlocks(\n        uint256 targetChainId,\n        IAdapter adapter,\n        uint256[] memory blockNumbers\n    ) external payable returns (bytes32) {\n        bytes32[] memory blockHeaders = IHeaderStorage(HEADER_STORAGE).storeBlockHeaders(blockNumbers);\n        for (uint256 i = 0; i < blockNumbers.length; ) {\n            emit BlockDispatched(targetChainId, adapter, blockNumbers[i], blockHeaders[i]);\n            unchecked {\n                ++i;\n            }\n        }\n        return _dispatch(targetChainId, address(adapter), blockNumbers, blockHeaders);\n    }\n\n    /// @inheritdoc IReporter\n    function dispatchMessages(\n        uint256 targetChainId,\n        IAdapter adapter,\n        uint256[] memory messageIds,\n        bytes32[] memory messageHashes\n    ) external payable onlyYaho returns (bytes32) {\n        for (uint256 i = 0; i < messageIds.length; ) {\n            emit MessageDispatched(targetChainId, adapter, messageIds[i], messageHashes[i]);\n            unchecked {\n                ++i;\n            }\n        }\n        return _dispatch(targetChainId, address(adapter), messageIds, messageHashes);\n    }\n\n    function _dispatch(\n        uint256 targetChainId,\n        address adapter,\n        uint256[] memory ids,\n        bytes32[] memory hashes\n    ) internal virtual returns (bytes32);\n}\n"
      },
      "contracts/adapters/Telepathy/libraries/SimpleSerialize.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nlibrary SSZ {\n    // G-indicies for the BeaconBlockHeader -> bodyRoot -> executionPayload -> {blockNumber, blockHash}\n    uint256 internal constant EXECUTION_PAYLOAD_BLOCK_NUMBER_INDEX = 3222;\n    uint256 internal constant EXECUTION_PAYLOAD_BLOCK_HASH_INDEX = 3228;\n\n    function toLittleEndian(uint256 _v) internal pure returns (bytes32) {\n        _v =\n            ((_v & 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >> 8) |\n            ((_v & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF) << 8);\n        _v =\n            ((_v & 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> 16) |\n            ((_v & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) << 16);\n        _v =\n            ((_v & 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >> 32) |\n            ((_v & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) << 32);\n        _v =\n            ((_v & 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >> 64) |\n            ((_v & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) << 64);\n        _v = (_v >> 128) | (_v << 128);\n        return bytes32(_v);\n    }\n\n    function restoreMerkleRoot(\n        bytes32 _leaf,\n        uint256 _index,\n        bytes32[] memory _branch\n    ) internal pure returns (bytes32) {\n        require(2 ** (_branch.length + 1) > _index, \"incorrect branch length or index size\");\n        bytes32 value = _leaf;\n        uint256 i = 0;\n        while (_index != 1) {\n            if (_index % 2 == 1) {\n                value = sha256(bytes.concat(_branch[i], value));\n            } else {\n                value = sha256(bytes.concat(value, _branch[i]));\n            }\n            _index /= 2;\n            i++;\n        }\n        return value;\n    }\n\n    function isValidMerkleBranch(\n        bytes32 _leaf,\n        uint256 _index,\n        bytes32[] memory _branch,\n        bytes32 _root\n    ) internal pure returns (bool) {\n        bytes32 restoredMerkleRoot = restoreMerkleRoot(_leaf, _index, _branch);\n        return _root == restoredMerkleRoot;\n    }\n\n    function verifyBlockNumber(\n        uint256 _blockNumber,\n        bytes32[] memory _blockNumberProof,\n        bytes32 _headerRoot\n    ) internal pure returns (bool) {\n        return\n            isValidMerkleBranch(\n                toLittleEndian(_blockNumber),\n                EXECUTION_PAYLOAD_BLOCK_NUMBER_INDEX,\n                _blockNumberProof,\n                _headerRoot\n            );\n    }\n\n    function verifyBlockHash(\n        bytes32 _blockHash,\n        bytes32[] memory _blockHashProof,\n        bytes32 _headerRoot\n    ) internal pure returns (bool) {\n        return isValidMerkleBranch(_blockHash, EXECUTION_PAYLOAD_BLOCK_HASH_INDEX, _blockHashProof, _headerRoot);\n    }\n}\n"
      },
      "contracts/Hashi.sol": {
        "content": "/*\n                  ███▄▄▄                               ,▄▄███▄\n                  ████▀`                      ,╓▄▄▄████████████▄\n                  ███▌             ,╓▄▄▄▄█████████▀▀▀▀▀▀╙└`\n                  ███▌       ▀▀▀▀▀▀▀▀▀▀╙└└-  ████L\n                  ███▌                      ████`               ╓██▄\n                  ███▌    ╓▄    ╓╓╓╓╓╓╓╓╓╓╓████▄╓╓╓╓╓╓╓╓╓╓╓╓╓╓▄███████▄\n                  ███▌  ▄█████▄ ▀▀▀▀▀▀▀▀▀▀████▀▀▀▀▀▀██▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n         ███████████████████████_       ▄███▀        ██µ\n                 ▐███▌                ,███▀           ▀██µ\n                 ████▌               ▄███▌,           ▄████▄\n                ▐████▌             ▄██▀████▀▀▀▀▀▀▀▀▀▀█████▀███▄\n               ,█████▌          ,▄██▀_ ▓███          ▐███_  ▀████▄▄\n               ██████▌,       ▄██▀_    ▓███          ▐███_    ▀███████▄-\n              ███▀███▌▀███▄  ╙\"        ▓███▄▄▄▄▄▄▄▄▄▄▄███_      `▀███└\n             ▄██^ ███▌  ^████▄         ▓███▀▀▀▀▀▀▀▀▀▀▀███_         `\n            ▄██_  ███▌    ╙███         ▓██▀          └▀▀_        ▄,\n           ██▀    ███▌      ▀└ ▐███▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄████▄µ\n          ██^     ███▌         ▐███▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀██████▀\n        ╓█▀       ███▌         ▐███⌐      µ          ╓          ▐███\n        ▀         ███▌         ▐███⌐      ███▄▄▄▄▄▄▄████▄       ▐███\n                  ███▌         ▐███⌐      ████▀▀▀▀▀▀▀████▀      ▐███\n                  ███▌         ▐███⌐      ███▌      J███M       ▐███\n                  ███▌         ▐███⌐      ███▌      J███M       ▐███\n                  ███▌         ▐███⌐      ████▄▄▄▄▄▄████M       ▐███\n                  ███▌         ▐███⌐      ███▌      ▐███M       ▐███\n                  ███▌         ▐███⌐      ███▌       ▀▀_        ████\n                  ███▌         ▐███⌐      ▀▀_             ▀▀▀███████\n                  ███^         ▐███_                          ▐██▀▀　\n\n                                           Made with ❤️ by Gnosis Guild\n*/\n// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { IAdapter } from \"./interfaces/IAdapter.sol\";\nimport { IHashi } from \"./interfaces/IHashi.sol\";\n\ncontract Hashi is IHashi {\n    /// @inheritdoc IHashi\n    function checkHashWithThresholdFromAdapters(\n        uint256 domain,\n        uint256 id,\n        uint256 threshold,\n        IAdapter[] calldata adapters\n    ) external view returns (bool) {\n        if (threshold > adapters.length || threshold == 0) revert InvalidThreshold(threshold, adapters.length);\n        bytes32[] memory hashes = getHashesFromAdapters(domain, id, adapters);\n\n        for (uint256 i = 0; i < hashes.length; ) {\n            if (i > hashes.length - threshold) break;\n\n            bytes32 baseHash = hashes[i];\n            if (baseHash == bytes32(0)) {\n                unchecked {\n                    ++i;\n                }\n                continue;\n            }\n\n            uint256 num = 0;\n            for (uint256 j = i; j < hashes.length; ) {\n                if (baseHash == hashes[j]) {\n                    unchecked {\n                        ++num;\n                    }\n                    if (num == threshold) return true;\n                }\n                unchecked {\n                    ++j;\n                }\n            }\n\n            unchecked {\n                ++i;\n            }\n        }\n        return false;\n    }\n\n    /// @inheritdoc IHashi\n    function getHashFromAdapter(uint256 domain, uint256 id, IAdapter adapter) external view returns (bytes32) {\n        return adapter.getHash(domain, id);\n    }\n\n    /// @inheritdoc IHashi\n    function getHashesFromAdapters(\n        uint256 domain,\n        uint256 id,\n        IAdapter[] calldata adapters\n    ) public view returns (bytes32[] memory) {\n        if (adapters.length == 0) revert NoAdaptersGiven();\n        bytes32[] memory hashes = new bytes32[](adapters.length);\n        for (uint256 i = 0; i < adapters.length; ) {\n            hashes[i] = adapters[i].getHash(domain, id);\n            unchecked {\n                ++i;\n            }\n        }\n        return hashes;\n    }\n\n    /// @inheritdoc IHashi\n    function getHash(uint256 domain, uint256 id, IAdapter[] calldata adapters) external view returns (bytes32 hash) {\n        if (adapters.length == 0) revert NoAdaptersGiven();\n        bytes32[] memory hashes = getHashesFromAdapters(domain, id, adapters);\n        hash = hashes[0];\n        if (hash == bytes32(0)) revert HashNotAvailableInAdapter(adapters[0]);\n        for (uint256 i = 1; i < hashes.length; ) {\n            if (hashes[i] == bytes32(0)) revert HashNotAvailableInAdapter(adapters[i]);\n            if (hash != hashes[i]) revert AdaptersDisagree(adapters[i - 1], adapters[i]);\n            unchecked {\n                ++i;\n            }\n        }\n    }\n}\n"
      },
      "contracts/interfaces/IAdapter.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title IAdapter\n */\ninterface IAdapter {\n    error ConflictingBlockHeader(uint256 blockNumber, bytes32 blockHash, bytes32 storedBlockHash);\n    error InvalidBlockHeaderLength(uint256 length);\n    error InvalidBlockHeaderRLP();\n\n    /**\n     * @dev Emitted when a hash is stored.\n     * @param id - The ID of the stored hash.\n     * @param hash - The stored hash as bytes32 values.\n     */\n    event HashStored(uint256 indexed id, bytes32 indexed hash);\n\n    /**\n     * @dev Returns the hash for a given ID.\n     * @param domain - Identifier for the domain to query.\n     * @param id - Identifier for the ID to query.\n     * @return hash Bytes32 hash for the given ID on the given domain.\n     * @notice MUST return bytes32(0) if the hash is not present.\n     */\n    function getHash(uint256 domain, uint256 id) external view returns (bytes32 hash);\n}\n"
      },
      "contracts/interfaces/IBlockHashAdapter.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport { IAdapter } from \"./IAdapter.sol\";\n\n/**\n * @title IBlockHashAdapter\n */\ninterface IBlockHashAdapter is IAdapter {\n    /**\n     * @dev Proves and stores valid ancestral block hashes for a given chain ID.\n     * @param chainId - The ID of the chain to prove block hashes for.\n     * @param blockHeaders - The RLP encoded block headers to prove the hashes for.\n     * @notice Block headers should be ordered by descending block number and should start with a known block header.\n     */\n    function proveAncestralBlockHashes(uint256 chainId, bytes[] memory blockHeaders) external;\n}\n"
      },
      "contracts/interfaces/IGiriGiriBashi.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport { IAdapter } from \"./IAdapter.sol\";\nimport { IHashi } from \"./IHashi.sol\";\nimport { IShuSho } from \"./IShuSho.sol\";\n\n/**\n * @title IGiriGiriBashi\n */\ninterface IGiriGiriBashi is IShuSho {\n    struct Challenge {\n        address payable challenger; // account that raised the challenge.\n        uint256 timestamp; // timestamp when the challenge was created.\n        uint256 bond; // bond paid by the challenger.\n    }\n\n    struct Settings {\n        bool quarantined; // whether or not the adapter has been quarantined.\n        uint256 minimumBond; // amount that must be bonded alongside a challenge.\n        uint256 startId; // earliest id that the adapter could have stored.\n        uint256 idDepth; // how far behind the current head can this adapter safely report. 0 equals infinite.\n        uint256 timeout; // grace period in which the adapter must report on an in-range id after being challenged.\n    }\n\n    error AdaptersCannotContainChallengedAdapter(IAdapter[] adapters, IAdapter adapter);\n    error AdapterHasNotYetTimedOut(IAdapter adapter);\n    error AdapterNotQuarantined(IAdapter adapter);\n    error AlreadyQuarantined(IAdapter adapter);\n    error CannotProveNoConfidence(uint256 domain, uint256 id, IAdapter[] adapters);\n    error ChallengeNotFound(bytes32 challengeId, uint256 domain, uint256 id, IAdapter adapter);\n    error ChallengeRangeAlreadySet(uint256 domain);\n    error CountMustBeZero(uint256 domain);\n    error DuplicateChallenge(bytes32 challengeId, uint256 domain, uint256 id, IAdapter adapter);\n    error NoConfidenceRequired();\n    error NotEnoughValue(IAdapter adapter, uint256 value);\n    error OutOfRange(IAdapter adapter, uint256 id);\n    error UnequalArrayLengths();\n\n    /**\n     * @dev Emitted when the bond recipient address is set.\n     * @param bondRecipient - The new bond recipient address as an Ethereum address.\n     */\n    event BondRecipientSet(address payable bondRecipient);\n\n    /**\n     * @dev Emitted when a challenge is created.\n     * @param challengeId - The unique identifier for the challenge.\n     * @param domain - The domain associated with the challenge.\n     * @param id - The identifier associated with the challenge.\n     * @param adapter - The adapter address associated with the challenge.\n     * @param challenger - The address of the challenger.\n     * @param timestamp - The timestamp when the challenge was created.\n     * @param bond - The bond amount associated with the challenge.\n     */\n    event ChallengeCreated(\n        bytes32 challengeId,\n        uint256 indexed domain,\n        uint256 id,\n        IAdapter indexed adapter,\n        address indexed challenger,\n        uint256 timestamp,\n        uint256 bond\n    );\n\n    /**\n     * @dev Emitted when the challenge range is updated.\n     * @param domain - The domain associated with the updated challenge range.\n     * @param range - The new challenge range as a Uint256 identifier.\n     */\n    event ChallengeRangeUpdated(uint256 domain, uint256 range);\n\n    /**\n     * @dev Emitted when a challenge is resolved.\n     * @param challengeId - The unique identifier for the resolved challenge.\n     * @param domain - The domain associated with the resolved challenge.\n     * @param id - The identifier associated with the resolved challenge.\n     * @param adapter - The adapter address associated with the resolved challenge.\n     * @param challenger - The address of the challenger.\n     * @param bond - The bond amount associated with the resolved challenge.\n     * @param challengeSuccessful - A boolean indicating whether the challenge was successful.\n     */\n    event ChallengeResolved(\n        bytes32 challengeId,\n        uint256 indexed domain,\n        uint256 id,\n        IAdapter indexed adapter,\n        address indexed challenger,\n        uint256 bond,\n        bool challengeSuccessful\n    );\n\n    /**\n     * @dev Emitted when a new head is updated.\n     * @param domain - The domain associated with the new head.\n     * @param head - The new head as a Uint256 identifier.\n     */\n    event NewHead(uint256 domain, uint256 head);\n\n    /**\n     * @dev Emitted when a declaration of no confidence is made for a specific domain.\n     * @param domain - The domain associated with the declaration.\n     */\n    event NoConfidenceDeclared(uint256 domain);\n\n    /**\n     * @dev Emitted when settings are initialized for a specific domain and adapter.\n     * @param domain - The domain associated with the initialized settings.\n     * @param adapter - The adapter address associated with the initialized settings.\n     * @param settings - The initialized settings object.\n     */\n    event SettingsInitialized(uint256 domain, IAdapter adapter, Settings settings);\n\n    /**\n     * @dev Challenges the adapter to provide a response. If the adapter fails, it can be quarantined.\n     * @param domain - The Uint256 identifier for the domain.\n     * @param id - The Uint256 identifier for the challenge.\n     * @param adapter - The address of the adapter to challenge.\n     * @notice Caller must pay a minimum bond to issue the challenge. This bond should be high enough to cover the gas costs for successfully completing the challenge.\n     */\n    function challengeAdapter(uint256 domain, uint256 id, IAdapter adapter) external payable;\n\n    /**\n     * @dev Show that enough adapters disagree that they could not make a threshold if the remainder all agree with one.\n     * @param domain - The Uint256 identifier for the domain.\n     * @param id - The Uint256 identifier.\n     * @param adapters - An array of adapter instances.\n     */\n    function declareNoConfidence(uint256 domain, uint256 id, IAdapter[] memory adapters) external;\n\n    /**\n     * @dev Disables a set of adapters for a given domain.\n     * @param domain - The Uint256 identifier for the domain.\n     * @param adapters - An array of adapter instances to be disabled.\n     */\n    function disableAdapters(uint256 domain, IAdapter[] memory adapters) external;\n\n    /**\n     * @dev Enables a set of adapters for a given domain with specific settings.\n     * @param domain - The Uint256 identifier for the domain.\n     * @param adapters - An array of adapter instances.\n     * @param settings - An array of settings, corresponding to each adapter.\n     */\n    function enableAdapters(uint256 domain, IAdapter[] memory adapters, Settings[] memory settings) external;\n\n    /**\n     * @dev Get the current challenge given a challengeId.\n     * @param challengeId - The Bytes32 identifier for the challenge.\n     * @return challenge - Challenge indicating the challenge parameters.\n     */\n    function getChallenge(bytes32 challengeId) external view returns (Challenge memory);\n\n    /**\n     * @dev Gets the challenge ID for a given domain, ID, and adapter.\n     * @param domain - The Uint256 identifier for the domain.\n     * @param id - The Uint256 identifier.\n     * @param adapter - The adapter instance.\n     * @return The computed challenge ID as a bytes32 hash.\n     */\n    function getChallengeId(uint256 domain, uint256 id, IAdapter adapter) external pure returns (bytes32);\n\n    /**\n     * @dev Get how far beyond the current highestId can be challenged.\n     * @param domain - The Uint256 identifier for the domain.\n     * @return range - Uint256 indicating the challenge range.\n     */\n    function getChallengeRange(uint256 domain) external view returns (uint256);\n\n    /**\n     * @dev Returns the hash agreed upon by a threshold of the enabled adapters.\n     * @param domain - Uint256 identifier for the domain to query.\n     * @param id - Uint256 identifier to query.\n     * @return hash - Bytes32 hash agreed upon by a threshold of the adapters for the given domain.\n     * @notice Reverts if no threshold is not reached.\n     * @notice Reverts if no adapters are set for the given domain.\n     */\n    function getThresholdHash(uint256 domain, uint256 id) external returns (bytes32);\n\n    /**\n     * @dev Returns the hash unanimously agreed upon by ALL of the enabled adapters.\n     * @param domain - Uint256 identifier for the domain to query.\n     * @param id - Uint256 identifier to query.\n     * @return hash - Bytes32 hash agreed upon by the adapters for the given domain.\n     * @notice Reverts if adapters disagree.\n     * @notice Revert if the adapters do not yet have the hash for the given ID.\n     * @notice Reverts if no adapters are set for the given domain.\n     */\n    function getUnanimousHash(uint256 domain, uint256 id) external returns (bytes32);\n\n    /**\n     * @dev Returns the hash unanimously agreed upon by all of the given adapters.\n     * @param domain - Uint256 identifier for the domain to query.\n     * @param adapters - Array of adapter addresses to query.\n     * @param id - Uint256 identifier to query.\n     * @return hash - Bytes32 hash agreed upon by the adapters for the given domain.\n     * @notice Adapters must be in numerical order from smallest to largest and contain no duplicates.\n     * @notice Reverts if adapters are out of order or contain duplicates.\n     * @notice Reverts if adapters disagree.\n     * @notice Revert if the adapters do not yet have the hash for the given ID.\n     * @notice Reverts if no adapters are set for the given domain.\n     */\n    function getHash(uint256 domain, uint256 id, IAdapter[] memory adapters) external returns (bytes32);\n\n    /**\n     * @dev Returns the highest id reported for a given id\n     * @param domain - Uint256 identifier for the domain to query.\n     * @return id - Uint256 indicating the highest id reported.\n     */\n    function getHead(uint256 domain) external view returns (uint256);\n\n    /**\n     * @dev Get the current settings for a given adapter.\n     * @param domain - Uint256 identifier for the domain to query.\n     * @param adapter - The adapter.\n     * @return settings - The Settings for the given adapter.\n     */\n    function getSettings(uint256 domain, IAdapter adapter) external view returns (Settings memory);\n\n    /**\n     * @dev Replaces the quarantined adapters for a given domain with new adapters and settings.\n     * @param domain - The Uint256 identifier for the domain.\n     * @param currentAdapters - An array of current adapter instances to be replaced.\n     * @param newAdapters - An array of new adapter instances to replace the current ones.\n     * @param settings - An array of settings corresponding to the new adapters.\n     */\n    function replaceQuarantinedAdapters(\n        uint256 domain,\n        IAdapter[] memory currentAdapters,\n        IAdapter[] memory newAdapters,\n        Settings[] memory settings\n    ) external;\n\n    /**\n     * @dev Resolves a challenge by comparing results from a specific adapter with others.\n     * @param domain - The Uint256 identifier for the domain.\n     * @param id - The Uint256 identifier.\n     * @param adapter - The adapter instance for comparison.\n     * @param adapters - An array of adapter instances for comparison.\n     * @return A boolean indicating the success of the challenge resolution.\n     */\n    function resolveChallenge(\n        uint256 domain,\n        uint256 id,\n        IAdapter adapter,\n        IAdapter[] memory adapters\n    ) external returns (bool);\n\n    /**\n     * @dev Sets the bond recipient address for payments.\n     * @param bondRecipient - The address where bond payments should be sent.\n     */\n    function setBondRecipient(address payable bondRecipient) external;\n\n    /**\n     * @dev Sets the challenge range for a specific domain.\n     * @param domain - The Uint256 identifier for the domain.\n     * @param range - The Uint256 range to set for the given domain.\n     */\n    function setChallengeRange(uint256 domain, uint256 range) external;\n\n    /**\n     * @dev Sets the threshold for a specific domain.\n     * @param domain - The Uint256 identifier for the domain.\n     * @param threshold - The Uint256 threshold to set for the given domain.\n     */\n    function setThreshold(uint256 domain, uint256 threshold) external;\n}\n"
      },
      "contracts/interfaces/IHashi.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport { IAdapter } from \"./IAdapter.sol\";\n\n/**\n * @title IHashi\n */\ninterface IHashi {\n    error AdaptersDisagree(IAdapter adapterOne, IAdapter adapterTwo);\n    error HashNotAvailableInAdapter(IAdapter adapter);\n    error InvalidThreshold(uint256 threshold, uint256 maxThreshold);\n    error NoAdaptersGiven();\n\n    /**\n     * @dev Checks whether the threshold is reached for a message given a set of adapters.\n     * @param domain - ID of the domain to query.\n     * @param id - ID for which to return hash.\n     * @param threshold - Threshold to use.\n     * @param adapters - Array of addresses for the adapters to query.\n     * @notice If the threshold is 1, it will always return true.\n     * @return result A boolean indicating if a threshold for a given message has been reached.\n     */\n    function checkHashWithThresholdFromAdapters(\n        uint256 domain,\n        uint256 id,\n        uint256 threshold,\n        IAdapter[] calldata adapters\n    ) external view returns (bool);\n\n    /**\n     * @dev Returns the hash stored by a given adapter for a given ID.\n     * @param domain - ID of the domain to query.\n     * @param id - ID for which to return a hash.\n     * @param adapter - Address of the adapter to query.\n     * @return hash stored by the given adapter for the given ID.\n     */\n    function getHashFromAdapter(uint256 domain, uint256 id, IAdapter adapter) external view returns (bytes32);\n\n    /**\n     * @dev Returns the hashes for a given ID stored by a given set of adapters.\n     * @param domain - The ID of the domain to query.\n     * @param id - The ID for which to return hashes.\n     * @param adapters - An array of addresses for the adapters to query.\n     * @return hashes An array of hashes stored by the given adapters for the specified ID.\n     */\n    function getHashesFromAdapters(\n        uint256 domain,\n        uint256 id,\n        IAdapter[] calldata adapters\n    ) external view returns (bytes32[] memory);\n\n    /**\n     * @dev Returns the hash unanimously agreed upon by a given set of adapters.\n     * @param domain - The ID of the domain to query.\n     * @param id - The ID for which to return a hash.\n     * @param adapters - An array of addresses for the adapters to query.\n     * @return hash agreed on by the given set of adapters.\n     * @notice MUST revert if adapters disagree on the hash or if an adapter does not report.\n     */\n    function getHash(uint256 domain, uint256 id, IAdapter[] calldata adapters) external view returns (bytes32);\n}\n"
      },
      "contracts/interfaces/IHeaderStorage.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title IHeaderStorage\n */\ninterface IHeaderStorage {\n    error HeaderOutOfRange(uint256 blockNumber);\n\n    /**\n     * @dev Emitted when a block header is stored.\n     * @param blockNumber - The block number associated with the stored header.\n     * @param blockHeader - The stored block header as a bytes32 value.\n     */\n    event HeaderStored(uint256 indexed blockNumber, bytes32 indexed blockHeader);\n\n    /**\n     * @dev Retrieves the stored block header for a specific block number.\n     * @param blockNumber - The block number as a uint256 value.\n     * @return The block header as a bytes32 value.\n     */\n    function headers(uint256 blockNumber) external view returns (bytes32);\n\n    /**\n     * @dev Stores and returns the header for the given block.\n     * @param blockNumber - Block number.\n     * @return blockHeader - Block header stored.\n     * @notice Reverts if the given block header was not previously stored and is now out of range.\n     */\n    function storeBlockHeader(uint256 blockNumber) external returns (bytes32);\n\n    /**\n     * @dev Stores and returns the header for an array of given blocks.\n     * @param blockNumbers - Array of block numbers.\n     * @return blockHeaders - Array of block headers stored.\n     * @notice Reverts if the given block header was not previously stored and is now out of range.\n     */\n    function storeBlockHeaders(uint256[] memory blockNumbers) external returns (bytes32[] memory);\n}\n"
      },
      "contracts/interfaces/IJushin.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport { IAdapter } from \"./IAdapter.sol\";\n\n/**\n * @title IJushin\n */\ninterface IJushin {\n    /**\n     * @dev Handles the incoming message from a specified chain.\n     * @param messageId - The unique identifier of the message.\n     * @param sourceChainId - The ID of the origin chain from which the message originates.\n     * @param sender - The address of the sender of the message on the origin chain.\n     * @param threshold - The minimum number of adapters required to have stored the same message.\n     * @param data - The data contained in the message, in bytes.\n     * @param adapters - An array of `IAdapter` contracts.\n     * @return result bytes at the user's choice\n     */\n    function onMessage(\n        uint256 messageId,\n        uint256 sourceChainId,\n        address sender,\n        uint256 threshold,\n        IAdapter[] calldata adapters,\n        bytes calldata data\n    ) external returns (bytes memory);\n}\n"
      },
      "contracts/interfaces/IMessage.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport { IReporter } from \"./IReporter.sol\";\nimport { IAdapter } from \"./IAdapter.sol\";\n\nstruct Message {\n    uint256 nonce;\n    uint256 targetChainId;\n    uint256 threshold;\n    address sender;\n    address receiver;\n    bytes data;\n    IReporter[] reporters;\n    IAdapter[] adapters;\n}\n"
      },
      "contracts/interfaces/IMessageHashCalculator.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport { Message } from \"./IMessage.sol\";\n\n/**\n * @title IMessageHashCalculator\n */\ninterface IMessageHashCalculator {\n    /**\n     * @dev Calculates and returns the hash of a given message.\n     * @param message - The `Message` structure containing various fields to be hashed.\n     * @return hash The keccak256 hash of the message, represented as a 32-byte hexadecimal string.\n     */\n    function calculateMessageHash(Message memory message) external pure returns (bytes32);\n}\n"
      },
      "contracts/interfaces/IMessageIdCalculator.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title IMessageIdCalculator\n */\ninterface IMessageIdCalculator {\n    /**\n     * @dev Calculates and returns a unique identifier (ID) for a message.\n     *\n     * @param sourceChainId - The ID of the chain from which the message originates.\n     * @param dispatcherAddress - The address of the dispatcher sending the message.\n     * @param messageHash - The keccak256 hash of the message, represented as a 32-byte hexadecimal string.\n     * @return messageId The unique identifier for the message, calculated based on the input parameters.\n     */\n    function calculateMessageId(\n        uint256 sourceChainId,\n        address dispatcherAddress,\n        bytes32 messageHash\n    ) external pure returns (uint256);\n}\n"
      },
      "contracts/interfaces/IReporter.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport { IAdapter } from \"./IAdapter.sol\";\n\ninterface IReporter {\n    error NotYaho(address sender, address expectedYaho);\n\n    /**\n     * @dev Emitted when a block is dispatched to another chain.\n     * @param targetChainId - The target chain's identifier associated with the dispatched block.\n     * @param adapter - The adapter address associated with the dispatched block.\n     * @param blockNumber - The block number associated with the dispatched block.\n     * @param blockHeader - The dispatched block header as a bytes32 value.\n     */\n    event BlockDispatched(\n        uint256 indexed targetChainId,\n        IAdapter adapter,\n        uint256 indexed blockNumber,\n        bytes32 blockHeader\n    );\n\n    /**\n     * @dev Emitted when a message is dispatched to another chain.\n     * @param targetChainId - The target chain's identifier associated with the dispatched message.\n     * @param adapter - The adapter address associated with the dispatched message.\n     * @param messageId - The message identifier associated with the dispatched message.\n     * @param messageHash - The dispatched message hash as a bytes32 value.\n     */\n    event MessageDispatched(\n        uint256 indexed targetChainId,\n        IAdapter adapter,\n        uint256 indexed messageId,\n        bytes32 messageHash\n    );\n\n    /**\n     * @dev Dispatches blocks to a given adapter on the target chaib.\n     * @param targetChainId - The target chain's Uint256 identifier.\n     * @param adapter - The adapter instance to use.\n     * @param blockNumbers - An array of Uint256 block numbers to dispatch.\n     * @notice blockNumbers must include block numbers that are greater than or equal to (currentBlock - 256) due to EVM limitations.\n     * @return result - The result returned by the adapter as bytes.\n     */\n    function dispatchBlocks(\n        uint256 targetChainId,\n        IAdapter adapter,\n        uint256[] memory blockNumbers\n    ) external payable returns (bytes32);\n\n    /**\n     * @dev Dispatches messages to a target chain using the specified adapter.\n     * @param targetChainId - The target chain's Uint256 identifier.\n     * @param adapter - The adapter instance to use.\n     * @param messageIds - An array of Uint256 message identifiers.\n     * @param messageHashes - An array of bytes32 message hashes.\n     * @notice This function can be called only by Yaho\n     * @return result - The result returned by the adapter as bytes.\n     */\n    function dispatchMessages(\n        uint256 targetChainId,\n        IAdapter adapter,\n        uint256[] memory messageIds,\n        bytes32[] memory messageHashes\n    ) external payable returns (bytes32);\n}\n"
      },
      "contracts/interfaces/IShoyuBashi.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport { IHashi } from \"./IHashi.sol\";\nimport { IAdapter } from \"./IAdapter.sol\";\nimport { IShuSho } from \"./IShuSho.sol\";\n\n/**\n * @title IShoyuBashi\n */\ninterface IShoyuBashi is IShuSho {\n    /**\n     * @dev Disables the given adapters for a given domain.\n     * @param domain - Uint256 identifier for the domain for which to set adapters.\n     * @param adapters - Array of adapter addresses.\n     * @notice Only callable by the owner of this contract.\n     * @notice Reverts if adapters are out of order or contain duplicates.\n     */\n    function disableAdapters(uint256 domain, IAdapter[] memory adapters) external;\n\n    /**\n     * @dev Enables the given adapters for a given domain.\n     * @param domain - Uint256 identifier for the domain for which to set adapters.\n     * @param adapters - Array of adapter addresses.\n     * @param threshold - Uint256 threshold to set for the given domain.\n     * @notice Only callable by the owner of this contract.\n     * @notice Reverts if adapters are out of order, contain duplicates or if the threshold is not higher than half the count of the adapters\n     */\n    function enableAdapters(uint256 domain, IAdapter[] memory adapters, uint256 threshold) external;\n\n    /**\n     * @dev Returns the hash unanimously agreed upon by ALL of the enabled adapters.\n     * @param domain - Uint256 identifier for the domain to query.\n     * @param id - Uint256 identifier to query.\n     * @return Bytes32 hash agreed upon by the adapters for the given domain.\n     * @notice Revert if the adapters do not yet have the hash for the given ID.\n     * @notice Reverts if adapters disagree.\n     * @notice Reverts if no adapters are set for the given domain.\n     */\n    function getUnanimousHash(uint256 domain, uint256 id) external view returns (bytes32);\n\n    /**\n     * @dev Returns the hash agreed upon by a threshold of the enabled adapters.\n     * @param domain - Uint256 identifier for the domain to query.\n     * @param id - Uint256 identifier to query.\n     * @return Bytes32 hash agreed upon by a threshold of the adapters for the given domain.\n     * @notice Reverts if the threshold is not reached.\n     * @notice Reverts if no adapters are set for the given domain.\n     */\n    function getThresholdHash(uint256 domain, uint256 id) external view returns (bytes32);\n\n    /**\n     * @dev Returns the hash unanimously agreed upon by all of the given adapters.\n     * @param domain - Uint256 identifier for the domain to query.\n     * @param adapters - Array of adapter addresses to query.\n     * @param id - Uint256 identifier to query.\n     * @return Bytes32 hash agreed upon by the adapters for the given domain.\n     * @notice adapters must be in numerical order from smallest to largest and contain no duplicates.\n     * @notice Reverts if adapters are out of order or contain duplicates.\n     * @notice Reverts if adapters disagree.\n     * @notice Revert if the adapters do not yet have the hash for the given ID.\n     * @notice Reverts if no adapters are set for the given domain.\n     */\n    function getHash(uint256 domain, uint256 id, IAdapter[] memory adapters) external view returns (bytes32);\n\n    /**\n     * @dev Sets the threshold of adapters required for a given domain.\n     * @param domain - Uint256 identifier for the domain for which to set the threshold.\n     * @param threshold - Uint256 threshold to set for the given domain.\n     * @notice Only callable by the owner of this contract.\n     * @notice Reverts if the threshold is already set to the given value.\n     */\n    function setThreshold(uint256 domain, uint256 threshold) external;\n\n    /**\n     * @dev Sets the address of the IHashi contract.\n     * @param hashi - Address of the hashi contract.\n     * @notice Only callable by the owner of this contract.\n     */\n    function setHashi(IHashi hashi) external;\n}\n"
      },
      "contracts/interfaces/IShuSho.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport { IHashi } from \"./IHashi.sol\";\nimport { IAdapter } from \"./IAdapter.sol\";\n\n/**\n * @title IShuSho\n */\ninterface IShuSho {\n    struct Domain {\n        uint256 threshold;\n        uint256 count;\n    }\n\n    struct Link {\n        IAdapter previous;\n        IAdapter next;\n    }\n\n    error AdapterNotEnabled(IAdapter adapter);\n    error AdapterAlreadyEnabled(IAdapter adapter);\n    error CountCannotBeZero();\n    error DuplicateHashiAddress(IHashi hashi);\n    error DuplicateOrOutOfOrderAdapters(IAdapter adapterOne, IAdapter adapterTwo);\n    error DuplicateThreshold(uint256 threshold);\n    error InvalidAdapter(IAdapter adapter);\n    error InvalidThreshold(uint256 threshold);\n    error NoAdaptersEnabled(uint256 domain);\n    error NoAdaptersGiven();\n    error ThresholdNotMet();\n\n    /**\n     * @dev Emitted when adapters are disabled for a specific domain.\n     * @param domain - The domain associated with the disabled adapters.\n     * @param adapters - An array of disabled adapter addresses associated with this event.\n     */\n    event AdaptersDisabled(uint256 indexed domain, IAdapter[] adapters);\n\n    /**\n     * @dev Emitted when adapters are enabled for a specific domain.\n     * @param domain - The domain associated with the enabled adapters.\n     * @param adapters - An array of enabled adapter addresses associated with this event.\n     */\n    event AdaptersEnabled(uint256 indexed domain, IAdapter[] adapters);\n\n    /**\n     * @dev Emitted when the address of the IHashi contract is set.\n     * @param hashi - The address of the IHashi contract associated with this event.\n     */\n    event HashiSet(IHashi indexed hashi);\n\n    /**\n     * @dev Emitted when initialization occurs with the owner's address and the IHashi contract address.\n     * @param owner - The address of the owner associated with this event.\n     * @param hashi - The address of the IHashi contract associated with this event.\n     */\n    event Init(address indexed owner, IHashi indexed hashi);\n\n    /**\n     * @dev Emitted when the threshold is set for a specific domain.\n     * @param domain - The domain associated with the set threshold.\n     * @param threshold - The new threshold value associated with this event.\n     */\n    event ThresholdSet(uint256 domain, uint256 threshold);\n\n    /**\n     * @dev Checks the order and validity of adapters for a given domain.\n     * @param domain - The Uint256 identifier for the domain.\n     * @param _adapters - An array of adapter instances.\n     */\n    function checkAdapterOrderAndValidity(uint256 domain, IAdapter[] memory _adapters) external view;\n\n    /**\n     * @dev Get the previous and the next adapter given a domain and an adapter.\n     * @param domain - Uint256 identifier for the domain.\n     * @param adapter - IAdapter value for the adapter.\n     * @return link - The Link struct containing the previous and the next adapter.\n     */\n    function getAdapterLink(uint256 domain, IAdapter adapter) external view returns (Link memory);\n\n    /**\n     * @dev Returns an array of enabled adapters for a given domain.\n     * @param domain - Uint256 identifier for the domain for which to list adapters.\n     * @return adapters - The adapters for a given domain.\n     */\n    function getAdapters(uint256 domain) external view returns (IAdapter[] memory);\n\n    /**\n     * @dev Get the current configuration for a given domain.\n     * @param domain - Uint256 identifier for the domain.\n     * @return domain - The Domain struct containing the current configuration for a given domain.\n     */\n    function getDomain(uint256 domain) external view returns (Domain memory);\n\n    /**\n     * @dev Returns the threshold and count for a given domain.\n     * @param domain - Uint256 identifier for the domain.\n     * @return threshold - Uint256 adapters threshold for the given domain.\n     * @return count - Uint256 adapters count for the given domain.\n     * @notice If the threshold for a domain has not been set, or is explicitly set to 0, this function will return a threshold equal to the adapters count for the given domain.\n     */\n    function getThresholdAndCount(uint256 domain) external view returns (uint256, uint256);\n\n    /**\n     * @dev Returns the address of the specified Hashi.\n     * @return hashi - The Hashi address.\n     */\n    function hashi() external view returns (IHashi);\n}\n"
      },
      "contracts/interfaces/IYaho.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport { IMessageHashCalculator } from \"./IMessageHashCalculator.sol\";\nimport { IMessageIdCalculator } from \"./IMessageIdCalculator.sol\";\nimport { Message } from \"./IMessage.sol\";\nimport { IReporter } from \"./IReporter.sol\";\nimport { IAdapter } from \"./IAdapter.sol\";\n\n/**\n * @title IYaho\n */\ninterface IYaho is IMessageHashCalculator, IMessageIdCalculator {\n    error NoMessagesGiven();\n    error NoMessageIdsGiven();\n    error NoReportersGiven();\n    error NoAdaptersGiven();\n    error UnequalArrayLengths(uint256 arrayOne, uint256 arrayTwo);\n    error MessageHashNotFound(uint256 messageId);\n    error InvalidMessage(Message message);\n    error InvalidThreshold(uint256 threshold, uint256 maxThreshold);\n\n    /**\n     * @dev Emitted when a message is dispatched with its associated message ID and message struct.\n     * @param messageId - The message ID associated with the dispatched message.\n     * @param message - The message struct associated with this event.\n     */\n    event MessageDispatched(uint256 indexed messageId, Message message);\n\n    /**\n     * @dev Dispatches a message to a specified chain with a set of validation parameters without calling the reporters. It just write in storage a commitment of message. In order to dispatch it to the reporters, you must then invoke `relayMessagesToAdapters`\n     * @param targetChainId - The ID of the target chain to which the message is being sent.\n     * @param threshold - The minimum number of adapters required to have stored the same message.\n     * @param receiver - The address of the receiver on the target chain.\n     * @param data - The data being sent in the message, represented as a byte array.\n     * @param reporters - An array of `IReporter` contracts (not actively used in this step).\n     * @param adapters - An array of `IAdapter` contracts (for later validation use).\n     * @return messageId A unique identifier for the dispatched message, used for tracking and subsequent validation.\n     * @notice If you plan to use an Adapter that does not have a corresponding Reporter (such as an adapter that uses a light client), you need to specify only the adapter and use address(0) as the reporter, since the adapter will verify the MessageDispatched event emitted by Yaho.\n     *\n     */\n    function dispatchMessage(\n        uint256 targetChainId,\n        uint256 threshold,\n        address receiver,\n        bytes calldata data,\n        IReporter[] calldata reporters,\n        IAdapter[] calldata adapters\n    ) external returns (uint256);\n\n    /**\n     * @dev Dispatches a message to a specified chain with a set of validation parameters and calls the reporters.\n     * @param targetChainId - The ID of the target chain to which the message is being sent.\n     * @param threshold - The minimum number of adapters required to have stored the same message.\n     * @param receiver - The address of the receiver on the target chain.\n     * @param data - The data being sent in the message, represented as a byte array.\n     * @param reporters - An array of `IReporter` contracts (not actively used in this step).\n     * @param adapters - An array of `IAdapter` contracts (for later validation use).\n     * @return (messageId, result) A unique identifier for the dispatched message and an array of byte arrays, where each element is the result of dispatching a respective message to the corresponding Reporter.\n     * @notice If you plan to use an Adapter that does not have a corresponding Reporter (such as an adapter that uses a light client), you need to specify only the adapter and use address(0) as the reporter, since the adapter will verify the MessageDispatched event emitted by Yaho.\n     */\n    function dispatchMessageToAdapters(\n        uint256 targetChainId,\n        uint256 threshold,\n        address receiver,\n        bytes calldata data,\n        IReporter[] calldata reporters,\n        IAdapter[] calldata adapters\n    ) external payable returns (uint256, bytes32[] memory);\n\n    /**\n     * @dev Dispatches an array of messages to specified chains and calls the reporters.\n     * @param targetChainId - The ID of the target chain for all messages.\n     * @param thresholds - An array of minimum validation thresholds required for each message.\n     * @param receivers - An array of addresses for the receivers on the target chain, one for each message.\n     * @param data - An array of data payloads for each message, represented as byte arrays.\n     * @param reporters - An array of `IReporter` contracts for reporting the status of each message.\n     * @param adapters - An array of `IAdapter` contracts used for the validation of each message.\n     * @return (messageIds, result) An array of unique identifiers for the dispatched messages and an array of bytes32 arrays, where each element is the result of dispatching a respective message to the corresponding Reporter.\n     * @notice If you plan to use an Adapter that does not have a corresponding Reporter (such as an adapter that uses a light client), you need to specify only the adapter and use address(0) as the reporter, since the adapter will verify the MessageDispatched event emitted by Yaho.\n     */\n    function dispatchMessagesToAdapters(\n        uint256 targetChainId,\n        uint256[] calldata thresholds,\n        address[] calldata receivers,\n        bytes[] calldata data,\n        IReporter[] calldata reporters,\n        IAdapter[] calldata adapters\n    ) external payable returns (uint256[] memory, bytes32[] memory);\n\n    /**\n     * @dev Retrieves the hash of a pending message that was dispatched via `dispatchMessage` but has not yet been relayed to adapters using `relayingMessagesToAdapters`.\n     * @param messageId - The unique identifier of the message for which the hash is being retrieved.\n     * @return messageHash The hash of the pending message if it exists.\n     */\n    function getPendingMessageHash(uint256 messageId) external view returns (bytes32);\n\n    /**\n     * @dev Relays an array of messages to their respective adapters. In order to be able to aggregate messages within the reporter, it's mandatory that all messages have the same targetChainId, reporters and adapters.\n     * @param messages - An array of `Message` structures to be relayed to the adapters.\n     * @return result An array of bytes32 arrays, where each element is the result of dispatching a respective all messages to the corresponding Reporter.\n     */\n    function relayMessagesToAdapters(Message[] calldata messages) external payable returns (bytes32[] memory);\n}\n"
      },
      "contracts/interfaces/IYaru.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport { Message } from \"./IMessage.sol\";\nimport { IMessageHashCalculator } from \"./IMessageHashCalculator.sol\";\nimport { IMessageIdCalculator } from \"./IMessageIdCalculator.sol\";\n\n/**\n * @title IYaru\n */\ninterface IYaru is IMessageHashCalculator, IMessageIdCalculator {\n    error CallFailed();\n    error InvalidToChainId(uint256 chainId, uint256 expectedChainId);\n    error MessageIdAlreadyExecuted(uint256 messageId);\n    error ThresholdNotMet();\n\n    /**\n     * @dev Emitted when a message is executed with its associated message ID and message object.\n     * @param messageId - The message ID associated with the executed message.\n     * @param message - The message object associated with this event.\n     */\n    event MessageExecuted(uint256 indexed messageId, Message message);\n\n    /**\n     * @dev Executes a batch of messages and returns the results if the threshold for a single message has been reached\n     * @param messages - An array of `Message` structures\n     * @return result An array of byte arrays, where each byte array is the result of executing a respective message from the input.\n     */\n    function executeMessages(Message[] calldata messages) external returns (bytes[] memory);\n}\n"
      },
      "contracts/ownable/ShoyuBashi.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { ShuSo } from \"./ShuSo.sol\";\nimport { IAdapter } from \"../interfaces/IAdapter.sol\";\nimport { IShoyuBashi } from \"../interfaces/IShoyuBashi.sol\";\nimport { IHashi } from \"../interfaces/IHashi.sol\";\n\ncontract ShoyuBashi is IShoyuBashi, ShuSo {\n    constructor(address _owner, address _hashi) ShuSo(_owner, _hashi) {} // solhint-disable no-empty-blocks\n\n    /// @inheritdoc IShoyuBashi\n    function setThreshold(uint256 domain, uint256 threshold) external {\n        _setThreshold(domain, threshold);\n    }\n\n    /// @inheritdoc IShoyuBashi\n    function enableAdapters(uint256 domain, IAdapter[] memory adapters, uint256 threshold) external {\n        _enableAdapters(domain, adapters, threshold);\n    }\n\n    /// @inheritdoc IShoyuBashi\n    function disableAdapters(uint256 domain, IAdapter[] memory adapters) external {\n        _disableAdapters(domain, adapters);\n    }\n\n    /// @inheritdoc IShoyuBashi\n    function getUnanimousHash(uint256 domain, uint256 id) external view returns (bytes32) {\n        return _getUnanimousHash(domain, id);\n    }\n\n    /// @inheritdoc IShoyuBashi\n    function getThresholdHash(uint256 domain, uint256 id) external view returns (bytes32) {\n        return _getThresholdHash(domain, id);\n    }\n\n    /// @inheritdoc IShoyuBashi\n    function getHash(uint256 domain, uint256 id, IAdapter[] memory adapters) external view returns (bytes32) {\n        return _getHash(domain, id, adapters);\n    }\n\n    /// @inheritdoc IShoyuBashi\n    function setHashi(IHashi _hashi) external {\n        _setHashi(_hashi);\n    }\n}\n"
      },
      "contracts/ownable/ShuSo.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { OwnableUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport { IAdapter } from \"../interfaces/IAdapter.sol\";\nimport { IHashi } from \"../interfaces/IHashi.sol\";\nimport { IShuSho } from \"../interfaces/IShuSho.sol\";\n\nabstract contract ShuSo is IShuSho, OwnableUpgradeable {\n    IAdapter internal constant LIST_END = IAdapter(address(0x1));\n\n    IHashi public hashi;\n    mapping(uint256 => mapping(IAdapter => Link)) private _adapters;\n    mapping(uint256 => Domain) private _domains;\n\n    constructor(address _owner, address _hashi) {\n        bytes memory initParams = abi.encode(_owner, _hashi);\n        init(initParams);\n    }\n\n    function init(bytes memory initParams) public initializer {\n        (address _owner, IHashi _hashi) = abi.decode(initParams, (address, IHashi));\n        __Ownable_init();\n        _setHashi(_hashi);\n        transferOwnership(_owner);\n        emit Init(_owner, _hashi);\n    }\n\n    /// @inheritdoc IShuSho\n    function checkAdapterOrderAndValidity(uint256 domain, IAdapter[] memory adapters) public view {\n        for (uint256 i = 0; i < adapters.length; i++) {\n            IAdapter adapter = adapters[i];\n            if (i > 0 && adapter <= adapters[i - 1]) revert DuplicateOrOutOfOrderAdapters(adapter, adapters[i - 1]);\n            if (_adapters[domain][adapter].next == IAdapter(address(0))) revert InvalidAdapter(adapter);\n        }\n    }\n\n    /// @inheritdoc IShuSho\n    function getAdapterLink(uint256 domain, IAdapter adapter) external view returns (Link memory) {\n        return _adapters[domain][adapter];\n    }\n\n    /// @inheritdoc IShuSho\n    function getAdapters(uint256 domain) public view returns (IAdapter[] memory) {\n        IAdapter[] memory adapters = new IAdapter[](_domains[domain].count);\n        IAdapter currentAdapter = _adapters[domain][LIST_END].next;\n        for (uint256 i = 0; i < adapters.length; i++) {\n            adapters[i] = currentAdapter;\n            currentAdapter = _adapters[domain][currentAdapter].next;\n        }\n        return adapters;\n    }\n\n    /// @inheritdoc IShuSho\n    function getDomain(uint256 domain) external view returns (Domain memory) {\n        return _domains[domain];\n    }\n\n    /// @inheritdoc IShuSho\n    function getThresholdAndCount(uint256 domain_) public view returns (uint256, uint256) {\n        Domain storage domain = _domains[domain_];\n        uint256 threshold = domain.threshold;\n        uint256 count = domain.count;\n        if (threshold == 0) threshold = count;\n        return (threshold, count);\n    }\n\n    /**\n     * @dev Disables the given adapters for a given domain.\n     * @param domain - Uint256 identifier for the domain for which to set adapters.\n     * @param adapters - Array of adapter addresses.\n     * @notice Reverts if adapters are out of order or contain duplicates.\n     * @notice Only callable by the owner of this contract.\n     */\n    function _disableAdapters(uint256 domain, IAdapter[] memory adapters) internal onlyOwner {\n        if (_domains[domain].count == 0) revert NoAdaptersEnabled(domain);\n        if (adapters.length == 0) revert NoAdaptersGiven();\n        for (uint256 i = 0; i < adapters.length; i++) {\n            IAdapter adapter = adapters[i];\n            if (adapter == IAdapter(address(0)) || adapter == LIST_END) revert InvalidAdapter(adapter);\n            Link memory current = _adapters[domain][adapter];\n            if (current.next == IAdapter(address(0))) revert AdapterNotEnabled(adapter);\n            IAdapter next = current.next;\n            IAdapter previous = current.previous;\n            _adapters[domain][next].previous = previous;\n            _adapters[domain][previous].next = next;\n            delete _adapters[domain][adapter].next;\n            delete _adapters[domain][adapter].previous;\n            _domains[domain].count--;\n        }\n        emit AdaptersDisabled(domain, adapters);\n    }\n\n    /**\n     * @dev Enables the given adapters for a given domain.\n     * @param domain - Uint256 identifier for the domain for which to set adapters.\n     * @param adapters - Array of adapter addresses.\n     * @param threshold - Uint256 threshold to set for the given domain.\n     * @notice Reverts if adapters are out of order, contain duplicates or if the threshold is not higher than half the count of the adapters\n     * @notice Only callable by the owner of this contract.\n     */\n    function _enableAdapters(uint256 domain, IAdapter[] memory adapters, uint256 threshold) internal onlyOwner {\n        if (_adapters[domain][LIST_END].next == IAdapter(address(0))) {\n            _adapters[domain][LIST_END].next = LIST_END;\n            _adapters[domain][LIST_END].previous = LIST_END;\n        }\n        if (adapters.length == 0) revert NoAdaptersGiven();\n        for (uint256 i = 0; i < adapters.length; i++) {\n            IAdapter adapter = adapters[i];\n            if (adapter == IAdapter(address(0)) || adapter == LIST_END) revert InvalidAdapter(adapter);\n            if (_adapters[domain][adapter].next != IAdapter(address(0))) revert AdapterAlreadyEnabled(adapter);\n            IAdapter previous = _adapters[domain][LIST_END].previous;\n            _adapters[domain][previous].next = adapter;\n            _adapters[domain][adapter].previous = previous;\n            _adapters[domain][LIST_END].previous = adapter;\n            _adapters[domain][adapter].next = LIST_END;\n            _domains[domain].count++;\n        }\n        if (threshold < (_domains[domain].count / 2) + 1) revert InvalidThreshold(threshold);\n        _domains[domain].threshold = threshold;\n        emit AdaptersEnabled(domain, adapters);\n    }\n\n    /**\n     * @dev Returns the hash unanimously agreed upon by all of the given adapters.\n     * @param domain - Uint256 identifier for the domain to query.\n     * @param id - Uint256 identifier to query.\n     * @param adapters - Array of adapter addresses to query.\n     * @return hash - Bytes32 hash agreed upon by the adapters for the given domain.\n     * @notice adapters must be in numerical order from smallest to largest and contain no duplicates.\n     * @notice Reverts if adapters are out of order or contain duplicates.\n     * @notice Reverts if adapters disagree.\n     * @notice Revert if the adapters do not yet have the hash for the given ID.\n     * @notice Reverts if no adapters are set for the given domain.\n     */\n    function _getHash(uint256 domain, uint256 id, IAdapter[] memory adapters) internal view returns (bytes32) {\n        (uint256 threshold, uint256 count) = getThresholdAndCount(domain);\n        if (adapters.length == 0) revert NoAdaptersGiven();\n        if (count == 0) revert NoAdaptersEnabled(domain);\n        if (adapters.length < threshold) revert ThresholdNotMet();\n        checkAdapterOrderAndValidity(domain, adapters);\n        return hashi.getHash(domain, id, adapters);\n    }\n\n    /**\n     * @dev Returns the hash agreed upon by a threshold of the enabled adapters.\n     * @param domain - Uint256 identifier for the domain to query.\n     * @param id - Uint256 identifier to query.\n     * @return hash - Bytes32 hash agreed upon by a threshold of the adapters for the given domain.\n     * @notice If the threshold is set to 1, the function will return the hash of the first adapter in the list.\n     * @notice Reverts if no threshold is not reached.\n     * @notice Reverts if no adapters are set for the given domain.\n     */\n    function _getThresholdHash(uint256 domain, uint256 id) internal view returns (bytes32 hash) {\n        IAdapter[] memory adapters = getAdapters(domain);\n        (uint256 threshold, uint256 count) = getThresholdAndCount(domain);\n        if (count == 0) revert NoAdaptersEnabled(domain);\n        if (adapters.length < threshold) revert ThresholdNotMet();\n\n        bytes32[] memory hashes = new bytes32[](adapters.length);\n        for (uint256 i = 0; i < adapters.length; i++) {\n            hashes[i] = adapters[i].getHash(domain, id);\n        }\n\n        for (uint256 i = 0; i < hashes.length; i++) {\n            if (i > hashes.length - threshold) break;\n\n            bytes32 baseHash = hashes[i];\n            if (baseHash == bytes32(0)) continue;\n\n            uint256 num = 0;\n            for (uint256 j = i; j < hashes.length; j++) {\n                if (baseHash == hashes[j]) {\n                    num++;\n                    if (num == threshold) return hashes[i];\n                }\n            }\n        }\n        revert ThresholdNotMet();\n    }\n\n    /**\n     * @dev Returns the hash unanimously agreed upon by ALL of the enabled adapters.\n     * @param domain - Uint256 identifier for the domain to query.\n     * @param id - Uint256 identifier to query.\n     * @return hash - Bytes32 hash agreed upon by the adapters for the given domain.\n     * @notice Reverts if adapters disagree.\n     * @notice Revert if the adapters do not yet have the hash for the given ID.\n     * @notice Reverts if no adapters are set for the given domain.\n     */\n    function _getUnanimousHash(uint256 domain, uint256 id) internal view returns (bytes32 hash) {\n        IAdapter[] memory adapters = getAdapters(domain);\n        (uint256 threshold, uint256 count) = getThresholdAndCount(domain);\n        if (count == 0) revert NoAdaptersEnabled(domain);\n        if (adapters.length < threshold) revert ThresholdNotMet();\n        return hashi.getHash(domain, id, adapters);\n    }\n\n    /**\n     * @dev Sets the address of the IHashi contract.\n     * @param _hashi - Address of the hashi contract.\n     * @notice Only callable by the owner of this contract.\n     */\n    function _setHashi(IHashi _hashi) internal onlyOwner {\n        if (hashi == _hashi) revert DuplicateHashiAddress(_hashi);\n        hashi = _hashi;\n        emit HashiSet(hashi);\n    }\n\n    /**\n     * @dev Sets the threshold of adapters required for a given domain.\n     * @param domain - Uint256 identifier for the domain for which to set the threshold.\n     * @param threshold - Uint256 threshold to set for the given domain.\n     * @notice Only callable by the owner of this contract.\n     * @notice Reverts if threshold is already set to the given value.\n     */\n    function _setThreshold(uint256 domain, uint256 threshold) internal onlyOwner {\n        uint256 count = _domains[domain].count;\n        if (count == 0) revert CountCannotBeZero();\n        if (threshold < (count / 2) + 1) revert InvalidThreshold(threshold);\n        if (_domains[domain].threshold == threshold) revert DuplicateThreshold(threshold);\n        _domains[domain].threshold = threshold;\n        emit ThresholdSet(domain, threshold);\n    }\n}\n"
      },
      "contracts/test/PingPong.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { IJushin } from \"../interfaces/IJushin.sol\";\nimport { IAdapter } from \"../interfaces/IAdapter.sol\";\n\ncontract PingPong is IJushin {\n    uint256 public count;\n\n    event Pong(uint256 count);\n\n    function ping() external {\n        count++;\n        emit Pong(count);\n    }\n\n    function onMessage(\n        uint256,\n        uint256,\n        address,\n        uint256,\n        IAdapter[] calldata,\n        bytes calldata\n    ) external returns (bytes memory) {\n        count++;\n        emit Pong(count);\n        return abi.encode(0);\n    }\n}\n"
      },
      "contracts/utils/MessageHashCalculator.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { IMessageHashCalculator } from \"../interfaces/IMessageHashCalculator.sol\";\nimport { Message } from \"../interfaces/IMessage.sol\";\n\ncontract MessageHashCalculator is IMessageHashCalculator {\n    /// @inheritdoc IMessageHashCalculator\n    function calculateMessageHash(Message memory message) public pure returns (bytes32) {\n        return keccak256(abi.encode(message));\n    }\n}\n"
      },
      "contracts/utils/MessageIdCalculator.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { IMessageIdCalculator } from \"../interfaces/IMessageIdCalculator.sol\";\n\ncontract MessageIdCalculator is IMessageIdCalculator {\n    /// @inheritdoc IMessageIdCalculator\n    function calculateMessageId(\n        uint256 sourceChainId,\n        address dispatcherAddress,\n        bytes32 messageHash\n    ) public pure returns (uint256) {\n        return uint256(keccak256(abi.encode(sourceChainId, dispatcherAddress, messageHash)));\n    }\n}\n"
      },
      "contracts/Yaho.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { MessageIdCalculator } from \"./utils/MessageIdCalculator.sol\";\nimport { MessageHashCalculator } from \"./utils/MessageHashCalculator.sol\";\nimport { IYaho } from \"./interfaces/IYaho.sol\";\nimport { IReporter } from \"./interfaces/IReporter.sol\";\nimport { Message } from \"./interfaces/IMessage.sol\";\nimport { IAdapter } from \"./interfaces/IAdapter.sol\";\n\ncontract Yaho is IYaho, MessageIdCalculator, MessageHashCalculator {\n    mapping(uint256 => bytes32) private _pendingMessageHashes;\n    uint256 public currentNonce;\n\n    /// @inheritdoc IYaho\n    function dispatchMessage(\n        uint256 targetChainId,\n        uint256 threshold,\n        address receiver,\n        bytes calldata data,\n        IReporter[] calldata reporters,\n        IAdapter[] calldata adapters\n    ) external returns (uint256) {\n        _checkReportersAndAdapters(threshold, reporters, adapters);\n        (uint256 messageId, bytes32 messageHash) = _dispatchMessage(\n            targetChainId,\n            threshold,\n            receiver,\n            data,\n            reporters,\n            adapters\n        );\n        _pendingMessageHashes[messageId] = messageHash;\n        return messageId;\n    }\n\n    /// @inheritdoc IYaho\n    function dispatchMessageToAdapters(\n        uint256 targetChainId,\n        uint256 threshold,\n        address receiver,\n        bytes calldata data,\n        IReporter[] calldata reporters,\n        IAdapter[] calldata adapters\n    ) external payable returns (uint256, bytes32[] memory) {\n        _checkReportersAndAdapters(threshold, reporters, adapters);\n        (uint256 messageId, bytes32 messageHash) = _dispatchMessage(\n            targetChainId,\n            threshold,\n            receiver,\n            data,\n            reporters,\n            adapters\n        );\n        bytes32[] memory reportersReceipts = _dispatchMessageToAdapters(\n            targetChainId,\n            messageId,\n            messageHash,\n            reporters,\n            adapters\n        );\n        return (messageId, reportersReceipts);\n    }\n\n    /// @inheritdoc IYaho\n    function dispatchMessagesToAdapters(\n        uint256 targetChainId,\n        uint256[] calldata thresholds,\n        address[] calldata receivers,\n        bytes[] calldata data,\n        IReporter[] calldata reporters,\n        IAdapter[] calldata adapters\n    ) external payable returns (uint256[] memory, bytes32[] memory) {\n        if (thresholds.length != receivers.length) revert UnequalArrayLengths(thresholds.length, receivers.length);\n        if (thresholds.length != data.length) revert UnequalArrayLengths(thresholds.length, data.length);\n\n        uint256[] memory messageIds = new uint256[](receivers.length);\n        bytes32[] memory messageHashes = new bytes32[](receivers.length);\n        for (uint256 i = 0; i < receivers.length; ) {\n            _checkReportersAndAdapters(thresholds[i], reporters, adapters);\n            (messageIds[i], messageHashes[i]) = _dispatchMessage(\n                targetChainId,\n                thresholds[i],\n                receivers[i],\n                data[i],\n                reporters,\n                adapters\n            );\n            unchecked {\n                ++i;\n            }\n        }\n\n        bytes32[] memory reportersReceipts = new bytes32[](reporters.length);\n        reportersReceipts = _dispatchMessagesToAdapters(targetChainId, messageIds, messageHashes, reporters, adapters);\n        return (messageIds, reportersReceipts);\n    }\n\n    /// @inheritdoc IYaho\n    function getPendingMessageHash(uint256 messageId) external view returns (bytes32) {\n        return _pendingMessageHashes[messageId];\n    }\n\n    /// @inheritdoc IYaho\n    function relayMessagesToAdapters(Message[] calldata messages) external payable returns (bytes32[] memory) {\n        if (messages.length == 0) revert NoMessagesGiven();\n\n        bytes32 expectedParams = keccak256(\n            abi.encode(messages[0].targetChainId, messages[0].reporters, messages[0].adapters)\n        );\n\n        bytes32[] memory messageHashes = new bytes32[](messages.length);\n        uint256[] memory messageIds = new uint256[](messages.length);\n        for (uint256 i = 0; i < messages.length; i++) {\n            Message memory message = messages[i];\n            if (\n                i > 0 &&\n                expectedParams != keccak256(abi.encode(message.targetChainId, message.reporters, message.adapters))\n            ) revert InvalidMessage(message);\n            uint256 messageId = calculateMessageId(block.chainid, address(this), calculateMessageHash(message));\n            bytes32 messageHash = _pendingMessageHashes[messageId];\n            if (messageHash == bytes32(0)) revert MessageHashNotFound(messageId);\n            messageHashes[i] = messageHash;\n            messageIds[i] = messageId;\n            delete _pendingMessageHashes[messageId];\n        }\n\n        return\n            _dispatchMessagesToAdapters(\n                messages[0].targetChainId,\n                messageIds,\n                messageHashes,\n                messages[0].reporters,\n                messages[0].adapters\n            );\n    }\n\n    function _checkReportersAndAdapters(\n        uint256 threshold,\n        IReporter[] calldata reporters,\n        IAdapter[] calldata adapters\n    ) internal pure {\n        if (reporters.length == 0) revert NoReportersGiven();\n        if (adapters.length == 0) revert NoAdaptersGiven();\n        if (reporters.length != adapters.length) revert UnequalArrayLengths(reporters.length, adapters.length);\n        if (threshold > reporters.length || threshold == 0) revert InvalidThreshold(threshold, reporters.length);\n    }\n\n    function _dispatchMessage(\n        uint256 targetChainId,\n        uint256 threshold,\n        address receiver,\n        bytes calldata data,\n        IReporter[] calldata reporters,\n        IAdapter[] calldata adapters\n    ) internal returns (uint256, bytes32) {\n        address sender = msg.sender;\n        Message memory message = Message(\n            currentNonce,\n            targetChainId,\n            threshold,\n            sender,\n            receiver,\n            data,\n            reporters,\n            adapters\n        );\n        bytes32 messageHash = calculateMessageHash(message);\n        uint256 messageId = calculateMessageId(block.chainid, address(this), messageHash);\n        unchecked {\n            ++currentNonce;\n        }\n        emit MessageDispatched(messageId, message);\n        return (messageId, messageHash);\n    }\n\n    function _dispatchMessageToAdapters(\n        uint256 targetChainId,\n        uint256 messageId,\n        bytes32 messageHash,\n        IReporter[] memory reporters,\n        IAdapter[] memory adapters\n    ) internal returns (bytes32[] memory) {\n        uint256[] memory messageIds = new uint256[](1);\n        bytes32[] memory messageHashes = new bytes32[](1);\n        messageIds[0] = messageId;\n        messageHashes[0] = messageHash;\n        return _dispatchMessagesToAdapters(targetChainId, messageIds, messageHashes, reporters, adapters);\n    }\n\n    function _dispatchMessagesToAdapters(\n        uint256 targetChainId,\n        uint256[] memory messageIds,\n        bytes32[] memory messageHashes,\n        IReporter[] memory reporters,\n        IAdapter[] memory adapters\n    ) internal returns (bytes32[] memory) {\n        bytes32[] memory reportersReceipts = new bytes32[](reporters.length);\n\n        for (uint256 i = 0; i < reporters.length; ) {\n            IReporter reporter = reporters[i];\n            if (address(reporter) != address(0)) {\n                reportersReceipts[i] = reporter.dispatchMessages(targetChainId, adapters[i], messageIds, messageHashes);\n            }\n            unchecked {\n                ++i;\n            }\n        }\n\n        return reportersReceipts;\n    }\n}\n"
      },
      "contracts/Yaru.sol": {
        "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { ReentrancyGuard } from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport { IYaru } from \"./interfaces/IYaru.sol\";\nimport { IHashi, IAdapter } from \"./interfaces/IHashi.sol\";\nimport { Message } from \"./interfaces/IMessage.sol\";\nimport { MessageIdCalculator } from \"./utils/MessageIdCalculator.sol\";\nimport { MessageHashCalculator } from \"./utils/MessageHashCalculator.sol\";\nimport { IJushin } from \"./interfaces/IJushin.sol\";\n\ncontract Yaru is IYaru, MessageIdCalculator, MessageHashCalculator, ReentrancyGuard {\n    address public immutable HASHI;\n    address public immutable YAHO;\n    uint256 public immutable SOURCE_CHAIN_ID;\n\n    mapping(uint256 => bool) public executed;\n\n    constructor(address hashi, address yaho_, uint256 sourceChainId) {\n        HASHI = hashi;\n        YAHO = yaho_;\n        SOURCE_CHAIN_ID = sourceChainId;\n    }\n\n    /// @inheritdoc IYaru\n    function executeMessages(Message[] calldata messages) external nonReentrant returns (bytes[] memory) {\n        bytes[] memory returnDatas = new bytes[](messages.length);\n        for (uint256 i = 0; i < messages.length; ) {\n            Message memory message = messages[i];\n\n            bytes32 messageHash = calculateMessageHash(message);\n            uint256 messageId = calculateMessageId(SOURCE_CHAIN_ID, YAHO, messageHash);\n\n            if (message.targetChainId != block.chainid) revert InvalidToChainId(message.targetChainId, block.chainid);\n\n            if (executed[messageId]) revert MessageIdAlreadyExecuted(messageId);\n            executed[messageId] = true;\n\n            if (\n                !IHashi(HASHI).checkHashWithThresholdFromAdapters(\n                    SOURCE_CHAIN_ID,\n                    messageId,\n                    message.threshold,\n                    message.adapters\n                )\n            ) revert ThresholdNotMet();\n\n            try\n                IJushin(message.receiver).onMessage(\n                    messageId,\n                    SOURCE_CHAIN_ID,\n                    message.sender,\n                    message.threshold,\n                    message.adapters,\n                    message.data\n                )\n            returns (bytes memory returnData) {\n                returnDatas[i] = returnData;\n            } catch {\n                revert CallFailed();\n            }\n\n            emit MessageExecuted(messageId, message);\n\n            unchecked {\n                ++i;\n            }\n        }\n        return returnDatas;\n    }\n}\n"
      },
      "solidity-rlp/contracts/RLPReader.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\n\n/*\n * @author Hamdi Allam hamdi.allam97@gmail.com\n * Please reach out with any questions or concerns\n */\npragma solidity >=0.5.10 <0.9.0;\n\nlibrary RLPReader {\n    uint8 constant STRING_SHORT_START = 0x80;\n    uint8 constant STRING_LONG_START = 0xb8;\n    uint8 constant LIST_SHORT_START = 0xc0;\n    uint8 constant LIST_LONG_START = 0xf8;\n    uint8 constant WORD_SIZE = 32;\n\n    struct RLPItem {\n        uint256 len;\n        uint256 memPtr;\n    }\n\n    struct Iterator {\n        RLPItem item; // Item that's being iterated over.\n        uint256 nextPtr; // Position of the next item in the list.\n    }\n\n    /*\n     * @dev Returns the next element in the iteration. Reverts if it has not next element.\n     * @param self The iterator.\n     * @return The next element in the iteration.\n     */\n    function next(Iterator memory self) internal pure returns (RLPItem memory) {\n        require(hasNext(self));\n\n        uint256 ptr = self.nextPtr;\n        uint256 itemLength = _itemLength(ptr);\n        self.nextPtr = ptr + itemLength;\n\n        return RLPItem(itemLength, ptr);\n    }\n\n    /*\n     * @dev Returns true if the iteration has more elements.\n     * @param self The iterator.\n     * @return true if the iteration has more elements.\n     */\n    function hasNext(Iterator memory self) internal pure returns (bool) {\n        RLPItem memory item = self.item;\n        return self.nextPtr < item.memPtr + item.len;\n    }\n\n    /*\n     * @param item RLP encoded bytes\n     */\n    function toRlpItem(bytes memory item) internal pure returns (RLPItem memory) {\n        uint256 memPtr;\n        assembly {\n            memPtr := add(item, 0x20)\n        }\n\n        return RLPItem(item.length, memPtr);\n    }\n\n    /*\n     * @dev Create an iterator. Reverts if item is not a list.\n     * @param self The RLP item.\n     * @return An 'Iterator' over the item.\n     */\n    function iterator(RLPItem memory self) internal pure returns (Iterator memory) {\n        require(isList(self));\n\n        uint256 ptr = self.memPtr + _payloadOffset(self.memPtr);\n        return Iterator(self, ptr);\n    }\n\n    /*\n     * @param the RLP item.\n     */\n    function rlpLen(RLPItem memory item) internal pure returns (uint256) {\n        return item.len;\n    }\n\n    /*\n     * @param the RLP item.\n     * @return (memPtr, len) pair: location of the item's payload in memory.\n     */\n    function payloadLocation(RLPItem memory item) internal pure returns (uint256, uint256) {\n        uint256 offset = _payloadOffset(item.memPtr);\n        uint256 memPtr = item.memPtr + offset;\n        uint256 len = item.len - offset; // data length\n        return (memPtr, len);\n    }\n\n    /*\n     * @param the RLP item.\n     */\n    function payloadLen(RLPItem memory item) internal pure returns (uint256) {\n        (, uint256 len) = payloadLocation(item);\n        return len;\n    }\n\n    /*\n     * @param the RLP item containing the encoded list.\n     */\n    function toList(RLPItem memory item) internal pure returns (RLPItem[] memory) {\n        require(isList(item));\n\n        uint256 items = numItems(item);\n        RLPItem[] memory result = new RLPItem[](items);\n\n        uint256 memPtr = item.memPtr + _payloadOffset(item.memPtr);\n        uint256 dataLen;\n        for (uint256 i = 0; i < items; i++) {\n            dataLen = _itemLength(memPtr);\n            result[i] = RLPItem(dataLen, memPtr);\n            memPtr = memPtr + dataLen;\n        }\n\n        return result;\n    }\n\n    // @return indicator whether encoded payload is a list. negate this function call for isData.\n    function isList(RLPItem memory item) internal pure returns (bool) {\n        if (item.len == 0) return false;\n\n        uint8 byte0;\n        uint256 memPtr = item.memPtr;\n        assembly {\n            byte0 := byte(0, mload(memPtr))\n        }\n\n        if (byte0 < LIST_SHORT_START) return false;\n        return true;\n    }\n\n    /*\n     * @dev A cheaper version of keccak256(toRlpBytes(item)) that avoids copying memory.\n     * @return keccak256 hash of RLP encoded bytes.\n     */\n    function rlpBytesKeccak256(RLPItem memory item) internal pure returns (bytes32) {\n        uint256 ptr = item.memPtr;\n        uint256 len = item.len;\n        bytes32 result;\n        assembly {\n            result := keccak256(ptr, len)\n        }\n        return result;\n    }\n\n    /*\n     * @dev A cheaper version of keccak256(toBytes(item)) that avoids copying memory.\n     * @return keccak256 hash of the item payload.\n     */\n    function payloadKeccak256(RLPItem memory item) internal pure returns (bytes32) {\n        (uint256 memPtr, uint256 len) = payloadLocation(item);\n        bytes32 result;\n        assembly {\n            result := keccak256(memPtr, len)\n        }\n        return result;\n    }\n\n    /** RLPItem conversions into data types **/\n\n    // @returns raw rlp encoding in bytes\n    function toRlpBytes(RLPItem memory item) internal pure returns (bytes memory) {\n        bytes memory result = new bytes(item.len);\n        if (result.length == 0) return result;\n\n        uint256 ptr;\n        assembly {\n            ptr := add(0x20, result)\n        }\n\n        copy(item.memPtr, ptr, item.len);\n        return result;\n    }\n\n    // any non-zero byte except \"0x80\" is considered true\n    function toBoolean(RLPItem memory item) internal pure returns (bool) {\n        require(item.len == 1);\n        uint256 result;\n        uint256 memPtr = item.memPtr;\n        assembly {\n            result := byte(0, mload(memPtr))\n        }\n\n        // SEE Github Issue #5.\n        // Summary: Most commonly used RLP libraries (i.e Geth) will encode\n        // \"0\" as \"0x80\" instead of as \"0\". We handle this edge case explicitly\n        // here.\n        if (result == 0 || result == STRING_SHORT_START) {\n            return false;\n        } else {\n            return true;\n        }\n    }\n\n    function toAddress(RLPItem memory item) internal pure returns (address) {\n        // 1 byte for the length prefix\n        require(item.len == 21);\n\n        return address(uint160(toUint(item)));\n    }\n\n    function toUint(RLPItem memory item) internal pure returns (uint256) {\n        require(item.len > 0 && item.len <= 33);\n\n        (uint256 memPtr, uint256 len) = payloadLocation(item);\n\n        uint256 result;\n        assembly {\n            result := mload(memPtr)\n\n            // shift to the correct location if neccesary\n            if lt(len, 32) {\n                result := div(result, exp(256, sub(32, len)))\n            }\n        }\n\n        return result;\n    }\n\n    // enforces 32 byte length\n    function toUintStrict(RLPItem memory item) internal pure returns (uint256) {\n        // one byte prefix\n        require(item.len == 33);\n\n        uint256 result;\n        uint256 memPtr = item.memPtr + 1;\n        assembly {\n            result := mload(memPtr)\n        }\n\n        return result;\n    }\n\n    function toBytes(RLPItem memory item) internal pure returns (bytes memory) {\n        require(item.len > 0);\n\n        (uint256 memPtr, uint256 len) = payloadLocation(item);\n        bytes memory result = new bytes(len);\n\n        uint256 destPtr;\n        assembly {\n            destPtr := add(0x20, result)\n        }\n\n        copy(memPtr, destPtr, len);\n        return result;\n    }\n\n    /*\n     * Private Helpers\n     */\n\n    // @return number of payload items inside an encoded list.\n    function numItems(RLPItem memory item) private pure returns (uint256) {\n        if (item.len == 0) return 0;\n\n        uint256 count = 0;\n        uint256 currPtr = item.memPtr + _payloadOffset(item.memPtr);\n        uint256 endPtr = item.memPtr + item.len;\n        while (currPtr < endPtr) {\n            currPtr = currPtr + _itemLength(currPtr); // skip over an item\n            count++;\n        }\n\n        return count;\n    }\n\n    // @return entire rlp item byte length\n    function _itemLength(uint256 memPtr) private pure returns (uint256) {\n        uint256 itemLen;\n        uint256 byte0;\n        assembly {\n            byte0 := byte(0, mload(memPtr))\n        }\n\n        if (byte0 < STRING_SHORT_START) {\n            itemLen = 1;\n        } else if (byte0 < STRING_LONG_START) {\n            itemLen = byte0 - STRING_SHORT_START + 1;\n        } else if (byte0 < LIST_SHORT_START) {\n            assembly {\n                let byteLen := sub(byte0, 0xb7) // # of bytes the actual length is\n                memPtr := add(memPtr, 1) // skip over the first byte\n\n                /* 32 byte word size */\n                let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to get the len\n                itemLen := add(dataLen, add(byteLen, 1))\n            }\n        } else if (byte0 < LIST_LONG_START) {\n            itemLen = byte0 - LIST_SHORT_START + 1;\n        } else {\n            assembly {\n                let byteLen := sub(byte0, 0xf7)\n                memPtr := add(memPtr, 1)\n\n                let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to the correct length\n                itemLen := add(dataLen, add(byteLen, 1))\n            }\n        }\n\n        return itemLen;\n    }\n\n    // @return number of bytes until the data\n    function _payloadOffset(uint256 memPtr) private pure returns (uint256) {\n        uint256 byte0;\n        assembly {\n            byte0 := byte(0, mload(memPtr))\n        }\n\n        if (byte0 < STRING_SHORT_START) {\n            return 0;\n        } else if (byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LONG_START)) {\n            return 1;\n        } else if (byte0 < LIST_SHORT_START) {\n            // being explicit\n            return byte0 - (STRING_LONG_START - 1) + 1;\n        } else {\n            return byte0 - (LIST_LONG_START - 1) + 1;\n        }\n    }\n\n    /*\n     * @param src Pointer to source\n     * @param dest Pointer to destination\n     * @param len Amount of memory to copy from the source\n     */\n    function copy(uint256 src, uint256 dest, uint256 len) private pure {\n        if (len == 0) return;\n\n        // copy as many word sizes as possible\n        for (; len >= WORD_SIZE; len -= WORD_SIZE) {\n            assembly {\n                mstore(dest, mload(src))\n            }\n\n            src += WORD_SIZE;\n            dest += WORD_SIZE;\n        }\n\n        if (len > 0) {\n            // left over bytes. Mask is used to remove unwanted bytes from the word\n            uint256 mask = 256**(WORD_SIZE - len) - 1;\n            assembly {\n                let srcpart := and(mload(src), not(mask)) // zero out src\n                let destpart := and(mload(dest), mask) // retrieve the bytes\n                mstore(dest, or(destpart, srcpart))\n            }\n        }\n    }\n}\n"
      }
    },
    "settings": {
      "viaIR": true,
      "optimizer": {
        "enabled": true,
        "runs": 10000
      },
      "evmVersion": "paris",
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}