creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "src/fundraising/contracts/fundraising/facets/raise/FinishRaiseFacet.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// OpenZeppelin imports\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n// Local imports - constants, encoders, events, errors, structs\nimport { RaiseConstants } from \"../../constants/RaiseConstants.sol\";\nimport { RaiseEncoder } from \"../../encoders/RaiseEncoder.sol\";\nimport { RaiseEvents } from \"../../events/RaiseEvents.sol\";\nimport { CrossChainErrors } from \"../../errors/cross-chain/CrossChainErrors.sol\";\nimport { RequestTypes } from \"../../structs/RequestTypes.sol\";\nimport { CrossChainRequestTypes } from \"../../structs/CrossChainRequestTypes.sol\";\nimport { EnumTypes } from \"../../structs/EnumTypes.sol\";\n\n// Local imports - storages\nimport { LibRaise } from \"../../libraries/storage/raise/LibRaise.sol\";\nimport { LibBadge } from \"../../libraries/storage/assets/LibBadge.sol\";\nimport { LibERC20Asset } from \"../../libraries/storage/assets/LibERC20Asset.sol\";\n\n// Local imports - services\nimport { RaiseService } from \"../../libraries/services/raise/internal/RaiseService.sol\";\nimport { AlephZeroSenderService } from \"../../libraries/services/cross-chain/aleph-zero/AlephZeroSenderService.sol\";\nimport { LayerZeroSenderService } from \"../../libraries/services/cross-chain/layer-zero/LayerZeroSenderService.sol\";\nimport { BadgeService } from \"../../libraries/services/assets/BadgeService.sol\";\nimport { ERC20AssetService } from \"../../libraries/services/assets/internal/ERC20AssetService.sol\";\nimport { EscrowService } from \"../../libraries/services/assets/EscrowService.sol\";\nimport { SignatureService } from \"../../libraries/services/utils/SignatureService.sol\";\nimport { FinishRaiseService } from \"../../libraries/services/raise/FinishRaiseService.sol\";\nimport { CreateRaiseService } from \"../../libraries/services/raise/CreateRaiseService.sol\";\n\n// Local imports - interfaces\nimport { IFinishRaiseFacet } from \"../../interfaces/raise/IFinishRaiseFacet.sol\";\n\ncontract FinishRaiseFacet is IFinishRaiseFacet {\n    /// @dev Finish raise and send cross chain message if needed to finish raise on the other chain.\n    /// @dev Events: RaiseFinished(\n    ///                 address sender,\n    ///                 string raiseId,\n    ///                 bytes32 merkleTreeRoot,\n    ///                 uint256 nonce\n    ///             )\n    /// @param _request RequestTypes.FinishRaiseRequest struct\n    /// @param _message EIP712 messages that contains request\n    /// @param _v Part of signature for message\n    /// @param _r Part of signature for message\n    /// @param _s Part of signature for message\n    /// @param _crossChainData RequestTypes.CrossChainData struct with data for cross chain communication\n    function finishRaise(\n        RequestTypes.FinishRaiseRequest calldata _request,\n        bytes32 _message,\n        uint8 _v,\n        bytes32 _r,\n        bytes32 _s,\n        CrossChainRequestTypes.CrossChainData calldata _crossChainData\n    ) external payable {\n        // tx.members\n        address sender_ = msg.sender;\n\n        // request members\n        string memory raiseId_ = _request.raiseId;\n        bytes32 merkleRoot_ = _request.merkleRoot;\n        uint256 softcap_ = RaiseService.getSoftcap(raiseId_);\n        uint256 erc20ChainId_ = LibERC20Asset.getChainId(raiseId_);\n\n        // validate request\n        FinishRaiseService.validateFinishRaiseRequest(_request, softcap_);\n\n        // EIP-712 encoding\n        bytes memory encodedMsg_ = RaiseEncoder.encodeFinishRaise(_request);\n\n        // verify message\n        SignatureService.verifyMessage(RaiseConstants.EIP712_NAME, RaiseConstants.EIP712_VERSION, keccak256(encodedMsg_), _message);\n\n        // verify signature\n        SignatureService.verifySignature(_message, _v, _r, _s);\n\n        // set merkle root and raised number\n        RaiseService.setFinishRaiseData(raiseId_, _request.raised, merkleRoot_);\n\n        if (erc20ChainId_ != block.chainid) {\n            // handle cross chain request\n            if (_crossChainData.provider == EnumTypes.CrossChainProvider.LayerZero) {\n                // send message through LayerZero\n                LayerZeroSenderService.sendCrossChainMessage(_crossChainData.data, erc20ChainId_);\n            } else if (_crossChainData.provider == EnumTypes.CrossChainProvider.AlephZero) {\n                // send message through AlephZero\n                AlephZeroSenderService.sendCrossChainMessage(_crossChainData.data, erc20ChainId_);\n            } else {\n                // revert if provider unsupported\n                revert CrossChainErrors.UnsupportedProvider();\n            }\n        }\n\n        // emit\n        if (RaiseService.isSoftcapAchieved(raiseId_)) {\n            emit RaiseEvents.RaiseFinishedSuccessfully(sender_, raiseId_, merkleRoot_);\n        } else {\n            emit RaiseEvents.RaiseFinishedUnsuccessfully(sender_, raiseId_, _request.raised, softcap_);\n        }\n    }\n\n    /// @dev Get merkle tree root\n    /// @param raiseId raise ID\n    /// @return saved merkle tree root\n    function getMerkleTreeRoot(string calldata raiseId) public view returns (bytes32) {\n        return LibRaise.getMerkleRoot(raiseId);\n    }\n}\n"
      },
      "src/fundraising/node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.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 \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.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 SafeERC20 {\n    using Address for address;\n\n    function safeTransfer(\n        IERC20 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        IERC20 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        IERC20 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        IERC20 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        IERC20 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        IERC20Permit 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(IERC20 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"
      },
      "src/fundraising/node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 amount\n    ) external returns (bool);\n}\n"
      },
      "src/fundraising/contracts/fundraising/constants/RaiseConstants.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n    \n**************************************/\n\n/// @notice Constants used in raise facet and raise encoder.\nlibrary RaiseConstants {\n    // -----------------------------------------------------------------------\n    //                              Constants\n    // -----------------------------------------------------------------------\n\n    /// @dev EIP712 name\n    bytes32 internal constant EIP712_NAME = keccak256(bytes(\"Fundraising:Raise\"));\n    /// @dev EIP712 versioning: \"release:major:minor\"\n    bytes32 internal constant EIP712_VERSION = keccak256(bytes(\"2:1:2\"));\n\n    /// @dev Typehash for create raise by startup\n    bytes32 internal constant STARTUP_CREATE_RAISE_TYPEHASH =\n        keccak256(\"CreateRaiseRequest(bytes raise,bytes raiseDetails,bytes erc20Asset,bytes baseAsset,bytes base,string badgeUri)\");\n    /// @dev Typehash for set token by an early stage startup\n    bytes32 internal constant STARTUP_SET_TOKEN_TYPEHASH = keccak256(\"SetTokenRequest(string raiseId,address token,bytes base)\");\n    /// @dev Typehash for investing into raise by investor\n    bytes32 internal constant INVESTOR_INVEST_TYPEHASH =\n        keccak256(\"InvestRequest(string raiseId,uint256 investment,uint256 maxTicketSize,bytes base)\");\n    /// @dev Typehash for register raise\n    bytes32 internal constant STARTUP_REGISTER_RAISE_TYPEHASH =\n        keccak256(\"RegisterRaiseRequest(bytes raise,bytes raiseDetails,bytes erc20Asset,bytes baseAsset,bytes crossChainBase)\");\n    /// @dev Typehash for finish raise\n    bytes32 internal constant STARTUP_FINISH_RAISE_TYPEHASH =\n        keccak256(\"FinishRaiseRequest(string raiseId,uint256 raised,bytes32 merkleTreeRoot,bytes base)\");\n    /// @dev Typehash for finish raise in receiver\n    bytes32 internal constant STARTUP_FINISH_RAISE_RECEIVER_TYPEHASH =\n        keccak256(\"FinishRaiseReceiverRequest(string raiseId,uint256 raised,bytes32 merkleTreeRoot,bytes crossChainBase)\");\n}\n"
      },
      "src/fundraising/contracts/fundraising/encoders/RaiseEncoder.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// Local imports\nimport { RaiseConstants } from \"../constants/RaiseConstants.sol\";\nimport { RequestTypes } from \"../structs/RequestTypes.sol\";\n\n/**************************************\n\n    Raise encoder\n\n**************************************/\n\n/// @notice Raise encoder for EIP712 message hash.\nlibrary RaiseEncoder {\n    /// @dev Encode create raise request data.\n    /// @param _request RequestTypes.CreateRaiseRequest struct\n    function encodeCreateRaise(RequestTypes.CreateRaiseRequest memory _request) internal pure returns (bytes memory) {\n        // encode request elements\n        bytes memory encodedRaise_ = abi.encode(_request.raise);\n        bytes memory encodedRaiseDetails_ = abi.encode(_request.raiseDetails);\n        bytes memory encodedERC20Asset_ = abi.encode(_request.erc20Asset);\n        bytes memory encodedBaseAsset_ = abi.encode(_request.baseAsset);\n        bytes memory encodedBase_ = abi.encode(_request.base);\n\n        // return encoded data\n        return\n            abi.encode(\n                RaiseConstants.STARTUP_CREATE_RAISE_TYPEHASH,\n                keccak256(encodedRaise_),\n                keccak256(encodedRaiseDetails_),\n                keccak256(encodedERC20Asset_),\n                keccak256(encodedBaseAsset_),\n                keccak256(encodedBase_),\n                keccak256(bytes(_request.badgeUri))\n            );\n    }\n\n    /// @dev Encode register raise request.\n    /// @param _request RequestTypes.RegisterRaiseRequest struct\n    /// @return Encoded message.\n    function encodeRegisterRaise(RequestTypes.RegisterRaiseRequest memory _request) internal pure returns (bytes memory) {\n        bytes memory encodedRaise_ = abi.encode(_request.raise);\n        bytes memory encodedRaiseDetails_ = abi.encode(_request.raiseDetails);\n        bytes memory encodedERC20Asset_ = abi.encode(_request.erc20Asset);\n        bytes memory encodedBaseAsset_ = abi.encode(_request.baseAsset);\n        bytes memory encodedBase_ = abi.encode(_request.crossChainBase);\n\n        return\n            abi.encode(\n                RaiseConstants.STARTUP_REGISTER_RAISE_TYPEHASH,\n                keccak256(encodedRaise_),\n                keccak256(encodedRaiseDetails_),\n                keccak256(encodedERC20Asset_),\n                keccak256(encodedBaseAsset_),\n                keccak256(encodedBase_)\n            );\n    }\n\n    /// @dev Encode finish raise request.\n    /// @param _request RequestTypes.FinishRaiseRequest struct\n    /// @return Encoded message.\n    function encodeFinishRaise(RequestTypes.FinishRaiseRequest memory _request) internal pure returns (bytes memory) {\n        bytes memory encodedBase_ = abi.encode(_request.base);\n\n        return\n            abi.encode(\n                RaiseConstants.STARTUP_FINISH_RAISE_TYPEHASH,\n                keccak256(bytes(_request.raiseId)),\n                _request.raised,\n                _request.merkleRoot,\n                keccak256(encodedBase_)\n            );\n    }\n\n    /// @dev Encode finish raise receiver request.\n    /// @param _request RequestTypes.FinishRaiseReceiverRequest struct\n    /// @return Encoded message.\n    function encodeFinishRaiseReceiver(RequestTypes.FinishRaiseReceiverRequest memory _request) internal pure returns (bytes memory) {\n        bytes memory encodedBase_ = abi.encode(_request.crossChainBase);\n\n        return\n            abi.encode(\n                RaiseConstants.STARTUP_FINISH_RAISE_RECEIVER_TYPEHASH,\n                keccak256(bytes(_request.raiseId)),\n                _request.raised,\n                _request.merkleRoot,\n                keccak256(encodedBase_)\n            );\n    }\n\n    /// @dev Encode set token request to validate the EIP712 message.\n    /// @param _request SetTokenRequest struct\n    /// @return EIP712 encoded message containing request\n    function encodeSetToken(RequestTypes.SetTokenRequest memory _request) internal pure returns (bytes memory) {\n        // base\n        bytes memory encodedBase_ = abi.encode(_request.base);\n\n        // msg\n        bytes memory encodedMsg_ = abi.encode(\n            RaiseConstants.STARTUP_SET_TOKEN_TYPEHASH,\n            keccak256(bytes(_request.raiseId)),\n            _request.token,\n            keccak256(encodedBase_)\n        );\n\n        // return\n        return encodedMsg_;\n    }\n\n    /// @dev Encode invest request to validate the EIP712 message.\n    /// @param _request InvestRequest struct\n    /// @return EIP712 encoded message containing request\n    function encodeInvest(RequestTypes.InvestRequest memory _request) internal pure returns (bytes memory) {\n        // base\n        bytes memory encodedBase_ = abi.encode(_request.base);\n\n        // msg\n        bytes memory encodedMsg_ = abi.encode(\n            RaiseConstants.INVESTOR_INVEST_TYPEHASH,\n            keccak256(bytes(_request.raiseId)),\n            _request.investment,\n            _request.maxTicketSize,\n            keccak256(encodedBase_)\n        );\n\n        // return\n        return encodedMsg_;\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/events/RaiseEvents.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// Local imports\nimport { RequestTypes } from \"../structs/RequestTypes.sol\";\nimport { StorageTypes } from \"../structs/StorageTypes.sol\";\n\n/**************************************\n\n    Raise events\n    \n**************************************/\n\n/// @dev All events connected with raises.\nlibrary RaiseEvents {\n    // -----------------------------------------------------------------------\n    //                              Raise\n    // -----------------------------------------------------------------------\n\n    event NewRaise(\n        address sender,\n        StorageTypes.Raise raise,\n        StorageTypes.RaiseDetails raiseDetails,\n        StorageTypes.ERC20Asset erc20Asset,\n        StorageTypes.BaseAsset baseAsset,\n        uint256 badgeId,\n        uint256 nonce\n    );\n    event RaiseRegistered(\n        StorageTypes.Raise raise,\n        StorageTypes.RaiseDetails raiseDetails,\n        StorageTypes.ERC20Asset erc20Asset,\n        StorageTypes.BaseAsset baseAsset,\n        uint256 nonce\n    );\n    event RaiseFinishedSuccessfully(address sender, string raiseId, bytes32 merkleTreeRoot); // 0x8e24bfdd\n    event RaiseFinishedUnsuccessfully(address sender, string raiseId, uint256 raised, uint256 softcap); // 0xb54e9804\n\n    // -----------------------------------------------------------------------\n    //                              Early Stage\n    // -----------------------------------------------------------------------\n\n    event TokenSet(address sender, string raiseId, address token);\n\n    // -----------------------------------------------------------------------\n    //                              Investing\n    // -----------------------------------------------------------------------\n\n    event NewInvestment(address sender, string raiseId, uint256 investment, bytes32 message, uint256 data);\n\n    // -----------------------------------------------------------------------\n    //                              Refund\n    // -----------------------------------------------------------------------\n\n    event InvestmentRefunded(address sender, string raiseId, uint256 amount);\n    event CollateralRefunded(address startup, string raiseId, uint256 amount);\n\n    // -----------------------------------------------------------------------\n    //                              Reclaim\n    // -----------------------------------------------------------------------\n\n    event UnsoldReclaimed(address startup, string raiseId, uint256 amount);\n}\n"
      },
      "src/fundraising/contracts/fundraising/errors/cross-chain/CrossChainErrors.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\nimport \"../../structs/EnumTypes.sol\";\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\nimport { EnumTypes } from \"../../structs/EnumTypes.sol\";\n\n/**************************************\n\n    Cross-chain errors\n    \n**************************************/\n\n/// @dev All errors used in cross chain communication\nlibrary CrossChainErrors {\n    // -----------------------------------------------------------------------\n    //                              Chain id & Provider\n    // -----------------------------------------------------------------------\n\n    error InvalidChainId(uint256 current, uint256 expected); // 0x9fba672f\n    error UnsupportedChainId(uint256 chainId); // 0xa5dab5fe\n    error ProviderChainIdMismatch(EnumTypes.CrossChainProvider provider, uint256 requestChainId, uint256 blockChainId); // 0x72c80f07\n    error UnsupportedProvider(); // 0x7f4d001d\n    error NotCrossChainRequest(); // 0x5a64c0eb\n\n    // -----------------------------------------------------------------------\n    //                              Payload\n    // -----------------------------------------------------------------------\n\n    error EmptyPayload(); // 0x2e3f1f34\n}\n"
      },
      "src/fundraising/contracts/fundraising/structs/RequestTypes.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// Local imports\nimport { CrossChainRequestTypes } from \"./CrossChainRequestTypes.sol\";\nimport { StorageTypes } from \"./StorageTypes.sol\";\n\n/// @notice Library that defines requests sent from frontend to smart contracts.\nlibrary RequestTypes {\n    // -----------------------------------------------------------------------\n    //                              Base\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct defining low level data for any request.\n    /// @param sender Address of account executing tx\n    /// @param expiry Deadline on which request expires\n    /// @param nonce Number used only once used to prevent tx reply or out of order execution\n    struct BaseRequest {\n        address sender;\n        uint256 expiry;\n        uint256 nonce;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Raise\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct used to create a raise.\n    /// @param raise Struct containing info about raise\n    /// @param raiseDetails Mapping of raise id to vested token information\n    /// @param erc20Asset Struct containing info about vested ERC20\n    /// @param baseAsset Struct containing info about asset used for investment\n    /// @param badgeUri IPFS URI that initializes equity badge for the raise\n    /// @param base Struct defining low level data for a request\n    struct CreateRaiseRequest {\n        StorageTypes.Raise raise;\n        StorageTypes.RaiseDetails raiseDetails;\n        StorageTypes.ERC20Asset erc20Asset;\n        StorageTypes.BaseAsset baseAsset;\n        string badgeUri;\n        BaseRequest base;\n    }\n\n    /// @dev Struct used to create a raise.\n    /// @param raise Struct containing info about raise\n    /// @param raiseDetails Mapping of raise id to vested token information\n    /// @param erc20Asset Struct containing info about vested ERC20\n    /// @param baseAsset Struct containing info about asset used for investment\n    /// @param crossChainBase Struct defining low level data for a cross-chain requests\n    struct RegisterRaiseRequest {\n        StorageTypes.Raise raise;\n        StorageTypes.RaiseDetails raiseDetails;\n        StorageTypes.ERC20Asset erc20Asset;\n        StorageTypes.BaseAsset baseAsset;\n        CrossChainRequestTypes.CrossChainBase crossChainBase;\n    }\n\n    /// @dev Struct Used to finish a raise.\n    /// @param raiseId Id of finished raise\n    /// @param raised Number of collected tokens\n    /// @param merkleRoot Root value of merkle tree build from investments\n    /// @param base Struct defining low level data for a request\n    struct FinishRaiseRequest {\n        string raiseId;\n        uint256 raised;\n        bytes32 merkleRoot;\n        BaseRequest base;\n    }\n\n    /// @dev Struct used to finish a raise in receiver\n    /// @param raiseId Id of finished raise\n    /// @param raised Number of collected tokens\n    /// @param merkleRoot Root value of merkle tree build from investments\n    /// @param crossChainBase Struct defining low level data for a cross-chain requests\n    struct FinishRaiseReceiverRequest {\n        string raiseId;\n        uint256 raised;\n        bytes32 merkleRoot;\n        CrossChainRequestTypes.CrossChainBase crossChainBase;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Set token\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct used to set a token for an early stage raise.\n    /// @param raiseId UUID of raise\n    /// @param token Address of ERC20\n    /// @param base Struct defining low level data for a request\n    struct SetTokenRequest {\n        string raiseId;\n        address token;\n        BaseRequest base;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Invest\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct used to invest into raise.\n    /// @param raiseId UUID of raise\n    /// @param investment Amount of base asset used to invest\n    /// @param maxTicketSize Individual limit of investment for validation\n    /// @param base Struct defining low level data for a request\n    struct InvestRequest {\n        string raiseId;\n        uint256 investment;\n        uint256 maxTicketSize;\n        BaseRequest base;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Voting\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct used to unlock milestone\n    /// @param raiseId UUID of raise\n    /// @param milestone Struct containing info about unlocked milestone\n    /// @param base Struct defining low level data for a request\n    struct UnlockMilestoneRequest {\n        string raiseId;\n        StorageTypes.Milestone milestone;\n        BaseRequest base;\n    }\n\n    /// @dev Struct used to unlock milestone for receiver\n    /// @param raiseId UUID of raise\n    /// @param milestone Struct containing info about unlocked milestone\n    /// @param crossChainBase Struct defining low level data for a cross-chain requests\n    struct UnlockMilestoneReceiverRequest {\n        string raiseId;\n        StorageTypes.Milestone milestone;\n        CrossChainRequestTypes.CrossChainBase crossChainBase;\n    }\n\n    /// @dev Struct used to submit failed repair plan\n    /// @param raiseId UUID of raise\n    /// @param base Struct defining low level data for a request\n    struct RejectRaiseRequest {\n        string raiseId;\n        BaseRequest base;\n    }\n\n    /// @dev Struct used to submit failed repair plan for receiver\n    /// @param raiseId UUID of raise\n    /// @param crossChainBase Struct defining low level data for a cross-chain request\n    struct RejectRaiseReceiverRequest {\n        string raiseId;\n        CrossChainRequestTypes.CrossChainBase crossChainBase;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Claiming\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct used to submit claiming schedule\n    /// @param raiseId UUID of raise\n    /// @param milestoneId UUID of milestone\n    /// @param claimingSchedules Array of ClaimingSchedule structs\n    /// @param base Struct defining low level data for a request\n    struct SubmitClaimingRequest {\n        string raiseId;\n        string milestoneId;\n        StorageTypes.ClaimingSchedule[] claimingSchedules;\n        BaseRequest base;\n    }\n\n    /// @dev Struct used to submit claiming schedule\n    /// @param raiseId UUID of raise\n    /// @param milestoneId UUID of milestone\n    /// @param claimingSchedules Array of ClaimingSchedule structs\n    /// @param crossChainBase Struct defining low level data for a cross-chain requests\n    struct SubmitClaimingReceiverRequest {\n        string raiseId;\n        string milestoneId;\n        StorageTypes.ClaimingSchedule[] claimingSchedules;\n        CrossChainRequestTypes.CrossChainBase crossChainBase;\n    }\n\n    /// @dev Struct used to claim tokens by investor\n    /// @param raiseId UUID of raise\n    /// @param investment Investment of msg.sender\n    /// @param proofs Merkle proofs for msg.sender\n    /// @param base Struct defining low level data for a request\n    struct InvestorClaimRequest {\n        string raiseId;\n        uint256 investment;\n        bytes32[] proofs;\n        BaseRequest base;\n    }\n\n    /// @dev Struct used to claim tokens by startup\n    /// @param raiseId UUID of raise\n    /// @param base Struct defining low level data for a request\n    struct StartupClaimRequest {\n        string raiseId;\n        BaseRequest base;\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/structs/CrossChainRequestTypes.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// Local imports - Structs\nimport { StorageTypes } from \"./StorageTypes.sol\";\nimport { EnumTypes } from \"./EnumTypes.sol\";\n\n/// @notice Library that defines requests sent from frontend to smart contracts.\nlibrary CrossChainRequestTypes {\n    // -----------------------------------------------------------------------\n    //                              Cross chain\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct containing chosen cross-chain provider and encoded data.\n    /// @param provider Cross chain provider\n    /// @param data Data encoding message in format for specific provider\n    struct CrossChainData {\n        EnumTypes.CrossChainProvider provider;\n        bytes data;\n    }\n\n    /// @dev Struct containing base for cross-chain message.\n    /// @param sender Address of sender\n    /// @param nonce Nonce of cross-chain message\n    struct CrossChainBase {\n        address sender;\n        uint256 nonce;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              LayerZero\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct containing cross chain message in LayerZero format\n    /// @param payload Encoded cross-chain call with data\n    /// @param additionalParams Additional parameters for LayerZero\n    /// @param fee Fee covering execution cost\n    struct LayerZeroData {\n        bytes payload;\n        bytes additionalParams;\n        uint256 fee;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              AlephZero\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct containing cross chain message in AlephZero format\n    /// @param nonce Cross chain nonce of tx\n    /// @param fee Unused fee if we would like to publish Bridge\n    /// @param func String name of Substrate function to call\n    /// @param args Byte-encoded cross-chain arguments for function\n    /// @param options Byte-encoded cross chain settings for Bridge tx\n    struct AlephZeroData {\n        uint256 nonce;\n        uint256 fee;\n        bytes4 func;\n        bytes args;\n        bytes options;\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/structs/EnumTypes.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/// @notice Library with core types definition.\nlibrary EnumTypes {\n    // -----------------------------------------------------------------------\n    //                              Raise\n    // -----------------------------------------------------------------------\n\n    /// @dev Definition of supported types of raises.\n    enum RaiseType {\n        Standard,\n        EarlyStage,\n        OTC\n    }\n\n    /// @dev Definition of raise statuses.\n    enum RaiseStatus {\n        RaiseCreated,\n        RaiseFailed,\n        RaiseSucceed\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Cross chain\n    // -----------------------------------------------------------------------\n\n    /// @dev Definition of supported cross chain providers.\n    enum CrossChainProvider {\n        None,\n        LayerZero,\n        AlephZero\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/storage/raise/LibRaise.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// Local imports - Structs\nimport { StorageTypes } from \"../../../structs/StorageTypes.sol\";\nimport { EnumTypes } from \"../../../structs/EnumTypes.sol\";\n\n/// @notice Library containing raise storage with getters and setters.\nlibrary LibRaise {\n    // -----------------------------------------------------------------------\n    //                              Constants\n    // -----------------------------------------------------------------------\n\n    /// @dev Raise storage pointer.\n    bytes32 internal constant RAISE_STORAGE_POSITION = keccak256(\"angelblock.fundraising.storage.raise\");\n    /// @dev Precision used in price calculation\n    uint256 internal constant PRICE_PRECISION = 10 ** 18;\n\n    // -----------------------------------------------------------------------\n    //                              Structs\n    // -----------------------------------------------------------------------\n\n    /// @dev Raise storage struct.\n    /// @param raises Mapping of raise id to particular raise struct\n    /// @param raiseDetails Mapping of raise id to vested token information\n    /// @param raiseDataCrosschains Mapping of raise id to raise state information\n    /// @param raiseStatus Status of raise\n    struct RaiseStorage {\n        mapping(string => StorageTypes.Raise) raises;\n        mapping(string => StorageTypes.RaiseDetails) raiseDetails;\n        mapping(string => StorageTypes.RaiseDataCC) raiseDataCrosschains;\n        mapping(string => EnumTypes.RaiseStatus) raiseStatus;\n    }\n\n    // diamond storage getter\n    function raiseStorage() internal pure returns (RaiseStorage storage rs) {\n        // declare position\n        bytes32 position = RAISE_STORAGE_POSITION;\n\n        // set slot to position\n        assembly {\n            rs.slot := position\n        }\n\n        // explicit return\n        return rs;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Getters / setters\n    // -----------------------------------------------------------------------\n\n    /// @dev Diamond storage getter: raise id.\n    /// @param _raiseId Requested raise id\n    /// @return Existing raise id\n    function getId(string memory _raiseId) internal view returns (string memory) {\n        // return\n        return raiseStorage().raises[_raiseId].raiseId;\n    }\n\n    /// @dev Diamond storage getter: raise type.\n    /// @param _raiseId Raise id\n    /// @return Raise type\n    function getType(string memory _raiseId) internal view returns (EnumTypes.RaiseType) {\n        // return\n        return raiseStorage().raises[_raiseId].raiseType;\n    }\n\n    /// @dev Diamond storage getter: raise owner.\n    /// @param _raiseId Raise id\n    /// @return Raise owner\n    function getOwner(string memory _raiseId) internal view returns (address) {\n        // return\n        return raiseStorage().raises[_raiseId].owner;\n    }\n\n    /// @dev Diamond storage getter: tokens per base asset.\n    /// @param _raiseId Raise id\n    /// @return Tokens per base asset\n    function getTokensPerBaseAsset(string memory _raiseId) internal view returns (uint256) {\n        // return\n        return raiseStorage().raiseDetails[_raiseId].tokensPerBaseAsset;\n    }\n\n    /// @dev Diamond storage getter: hardcap.\n    /// @param _raiseId Raise id\n    /// @return Hardcap\n    function getHardcap(string memory _raiseId) internal view returns (uint256) {\n        // return\n        return raiseStorage().raiseDetails[_raiseId].hardcap;\n    }\n\n    /// @dev Diamond storage getter: softcap.\n    /// @param _raiseId Raise id\n    /// @return Softcap\n    function getSoftcap(string memory _raiseId) internal view returns (uint256) {\n        // return\n        return raiseStorage().raiseDetails[_raiseId].softcap;\n    }\n\n    /// @dev Diamond storage getter: raise start.\n    /// @param _raiseId Raise id\n    /// @return Start date of raise\n    function getStart(string memory _raiseId) internal view returns (uint256) {\n        // return\n        return raiseStorage().raiseDetails[_raiseId].start;\n    }\n\n    /// @dev Diamond storage getter: raise end.\n    /// @param _raiseId Raise id\n    /// @return End date of raise\n    function getEnd(string memory _raiseId) internal view returns (uint256) {\n        // return\n        return raiseStorage().raiseDetails[_raiseId].end;\n    }\n\n    /// @dev Diamond storage getter: raised.\n    /// @param _raiseId Raise id\n    /// @return Raised amount\n    function getRaised(string memory _raiseId) internal view returns (uint256) {\n        // return\n        return raiseStorage().raiseDataCrosschains[_raiseId].raised;\n    }\n\n    /// @dev Diamond storage getter: merkle root.\n    /// @param _raiseId Raise id\n    /// @return Merkle root\n    function getMerkleRoot(string memory _raiseId) internal view returns (bytes32) {\n        return raiseStorage().raiseDataCrosschains[_raiseId].merkleRoot;\n    }\n\n    /// @dev Diamond storage getter: raise status.\n    /// @param _raiseId Raise id\n    /// @return Status of raise with provided id\n    function getRaiseStatus(string memory _raiseId) internal view returns (EnumTypes.RaiseStatus) {\n        return raiseStorage().raiseStatus[_raiseId];\n    }\n\n    /// @dev Diamond storage setter: set raise.\n    /// @param _raiseId Raise id\n    /// @param _raise Raise struct\n    function setRaise(string memory _raiseId, StorageTypes.Raise memory _raise) internal {\n        // set raise\n        raiseStorage().raises[_raiseId] = _raise;\n    }\n\n    /// @dev Diamond storage setter: set raise details.\n    /// @param _raiseId Raise id\n    /// @param _raiseDetails Raise details struct\n    function setRaiseDetails(string memory _raiseId, StorageTypes.RaiseDetails memory _raiseDetails) internal {\n        // set raise details\n        raiseStorage().raiseDetails[_raiseId] = _raiseDetails;\n    }\n\n    /// @dev Diamond storage setter: set raise cross-chain data.\n    /// @param _raiseId Raise id\n    /// @param _raiseDataCC Raise cross-chain data struct\n    function setRaiseDataCrosschain(string memory _raiseId, StorageTypes.RaiseDataCC memory _raiseDataCC) internal {\n        // set cross-chain raise data\n        raiseStorage().raiseDataCrosschains[_raiseId] = _raiseDataCC;\n    }\n\n    /// @dev Diamond storage setter: raise status.\n    /// @param _raiseId Raise id\n    /// @param _status Raise enum status\n    function setRaiseStatus(string memory _raiseId, EnumTypes.RaiseStatus _status) internal {\n        raiseStorage().raiseStatus[_raiseId] = _status;\n    }\n\n    /// @dev Diamond storage setter: set end.\n    /// @param _raiseId Raise id\n    /// @param _end End date of fundraising\n    function setEnd(string memory _raiseId, uint256 _end) internal {\n        // set raise end date\n        raiseStorage().raiseDetails[_raiseId].end = _end;\n    }\n\n    /// @dev Diamond storage setter: increase raised amount.\n    /// @param _raiseId Raise id\n    /// @param _amount Raised increment of amount\n    function increaseRaised(string memory _raiseId, uint256 _amount) internal {\n        raiseStorage().raiseDataCrosschains[_raiseId].raised += _amount;\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/storage/assets/LibBadge.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\nlibrary LibBadge {\n    bytes32 internal constant BADGE_STORAGE_POSITION = keccak256(\"angelblock.fundraising.badge\");\n\n    struct BaseAssetStorage {\n        mapping(string => string) badgeUris;\n    }\n\n    function badgeStorage() internal pure returns (BaseAssetStorage storage bs) {\n        bytes32 position = BADGE_STORAGE_POSITION;\n\n        assembly {\n            bs.slot := position\n        }\n\n        return bs;\n    }\n\n    function setBadgeUri(string memory _raiseId, string memory _badgeUri) internal {\n        badgeStorage().badgeUris[_raiseId] = _badgeUri;\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/storage/assets/LibERC20Asset.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// Local imports - Structs\nimport { StorageTypes } from \"../../../structs/StorageTypes.sol\";\n\n/// @dev Library containing ERC-20 asset storage with getters and setters\nlibrary LibERC20Asset {\n    // -----------------------------------------------------------------------\n    //                              Constants\n    // -----------------------------------------------------------------------\n\n    /// @dev ERC-20 asset storage pointer.\n    bytes32 internal constant ERC20_ASSET_STORAGE_POSITION = keccak256(\"angelblock.fundraising.erc20\");\n\n    // -----------------------------------------------------------------------\n    //                              Structs\n    // -----------------------------------------------------------------------\n\n    /// @dev ERC-20 asset storage struct.\n    /// @param erc20 Mapping of raise id to ERC-20 asset struct\n    struct ERC20AssetStorage {\n        mapping(string => StorageTypes.ERC20Asset) erc20;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Diamond storage\n    // -----------------------------------------------------------------------\n\n    /// @dev Function returning ERC-20 asset storage at storage pointer slot.\n    /// @return eas ERC20AssetStorage struct instance at storage pointer position\n    function erc20AssetStorage() internal pure returns (ERC20AssetStorage storage eas) {\n        // declare position\n        bytes32 position = ERC20_ASSET_STORAGE_POSITION;\n\n        // set slot to position\n        assembly {\n            eas.slot := position\n        }\n\n        // explicit return\n        return eas;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Getters / setters\n    // -----------------------------------------------------------------------\n\n    /// @dev Diamond storage getter: ERC-20 asset address.\n    /// @param _raiseId ID of the raise\n    /// @return Address of the ERC-20 asset\n    function getAddress(string memory _raiseId) internal view returns (address) {\n        return erc20AssetStorage().erc20[_raiseId].erc20;\n    }\n\n    /// @dev Diamond storage getter: ERC-20 asset chain id.\n    /// @param _raiseId ID of the raise\n    /// @return Id of the chain\n    function getChainId(string memory _raiseId) internal view returns (uint256) {\n        // return\n        return erc20AssetStorage().erc20[_raiseId].chainId;\n    }\n\n    /// @dev Diamond storage getter: ERC-20 asset vested amount.\n    /// @param _raiseId ID of the raise\n    /// @return Amount of vested ERC-20 tokens\n    function getAmount(string memory _raiseId) internal view returns (uint256) {\n        return erc20AssetStorage().erc20[_raiseId].amount;\n    }\n\n    /// @dev Diamond storage setter: ERC-20 asset\n    /// @param _raiseId ID of the raise\n    /// @param _erc20Asset StorageTypes.ERC20Asset struct\n    function setERC20Asset(string memory _raiseId, StorageTypes.ERC20Asset memory _erc20Asset) internal {\n        erc20AssetStorage().erc20[_raiseId] = _erc20Asset;\n    }\n\n    /// @dev Diamond storage setter: ERC-20 asset address.\n    /// @param _raiseId ID of the raise\n    /// @param _erc20 Address of the ERC-20 asset\n    function setERC20Address(string memory _raiseId, address _erc20) internal {\n        erc20AssetStorage().erc20[_raiseId].erc20 = _erc20;\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/services/raise/internal/RaiseService.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// Local imports - constants, encoders, events, errors, structs\nimport { RequestErrors } from \"../../../../errors/RequestErrors.sol\";\nimport { RaiseErrors } from \"../../../../errors/RaiseErrors.sol\";\nimport { CrossChainErrors } from \"../../../../errors/cross-chain/CrossChainErrors.sol\";\nimport { StorageTypes } from \"../../../../structs/StorageTypes.sol\";\nimport { EnumTypes } from \"../../../../structs/EnumTypes.sol\";\n\n// Local imports - storages\nimport { LibRaise } from \"../../../storage/raise/LibRaise.sol\";\nimport { LibERC20Asset } from \"../../../storage/assets/LibERC20Asset.sol\";\nimport { LibBaseAsset } from \"../../../storage/assets/LibBaseAsset.sol\";\nimport { LibNonce } from \"../../../storage/utils/LibNonce.sol\";\n\nlibrary RaiseService {\n    /**************************************\n\n        Create raise\n\n     **************************************/\n\n    /// @dev Set to storage all raise and assets data.\n    /// @param _raiseId ID of the raise\n    /// @param _sender Message sender\n    /// @param _nonce Used nonce\n    /// @param _raise StorageTypes.Raise struct\n    /// @param _raiseDetails StorageTypes.RaiseDetails struct\n    /// @param _erc20Asset StorageTypes.ERC20Asset struct\n    /// @param _baseAsset StorageTypes.BaseAsset struct\n    function setRaiseCreationData(\n        string memory _raiseId,\n        address _sender,\n        uint256 _nonce,\n        StorageTypes.Raise memory _raise,\n        StorageTypes.RaiseDetails memory _raiseDetails,\n        StorageTypes.ERC20Asset memory _erc20Asset,\n        StorageTypes.BaseAsset memory _baseAsset\n    ) internal {\n        // set raise to storage\n        LibRaise.setRaise(_raiseId, _raise);\n        // set raise details to storage\n        LibRaise.setRaiseDetails(_raiseId, _raiseDetails);\n        // set ERC-20 asset to storage\n        LibERC20Asset.setERC20Asset(_raiseId, _erc20Asset);\n        // set base asset to storage\n        LibBaseAsset.setBaseAsset(_raiseId, _baseAsset);\n        // set status\n        LibRaise.setRaiseStatus(_raiseId, EnumTypes.RaiseStatus.RaiseCreated);\n        // set nonce as used to storage\n        LibNonce.setNonce(_sender, _nonce);\n    }\n\n    function validateCreationRequest(\n        StorageTypes.Raise memory _raise,\n        StorageTypes.RaiseDetails memory _raiseDetails,\n        StorageTypes.ERC20Asset memory _erc20Asset,\n        address _sender,\n        uint256 _nonce\n    ) internal view {\n        if (_nonce <= LibNonce.getLastNonce(_sender)) {\n            revert RequestErrors.NonceExpired(_sender, _nonce);\n        }\n\n        // check raise id\n        if (bytes(_raise.raiseId).length == 0) {\n            revert RaiseErrors.InvalidRaiseId(_raise.raiseId);\n        }\n\n        // verify if raise does not exist\n        if (isRaiseExists(_raise.raiseId)) {\n            revert RaiseErrors.RaiseAlreadyExists(_raise.raiseId);\n        }\n\n        // check start and end date\n        if (_raiseDetails.start >= _raiseDetails.end) {\n            revert RaiseErrors.InvalidRaiseStartEnd(_raiseDetails.start, _raiseDetails.end);\n        }\n\n        // start date and end date can be in present or future\n        if (_raiseDetails.start < block.timestamp) {\n            revert RaiseErrors.StartDateInPast(_raiseDetails.start);\n        }\n\n        // check hardcap and softcap\n        if (_raiseDetails.hardcap < _raiseDetails.softcap) {\n            revert RaiseErrors.HardcapLessThanSoftcap(_raiseDetails.hardcap, _raiseDetails.softcap);\n        }\n\n        // check if tokens are vested\n        if (_erc20Asset.amount == 0) {\n            revert RaiseErrors.InvalidVestedAmount();\n        }\n\n        // validate price per token == vested / hardcap\n        if (_raiseDetails.tokensPerBaseAsset != (_erc20Asset.amount * LibRaise.PRICE_PRECISION) / _raiseDetails.hardcap) {\n            revert RaiseErrors.PriceNotMatchConfiguration(_raiseDetails.tokensPerBaseAsset, _raiseDetails.hardcap, _erc20Asset.amount);\n        }\n\n        // validate token address for Early Stage type\n        if (_raise.raiseType != EnumTypes.RaiseType.EarlyStage && _erc20Asset.erc20 == address(0)) {\n            revert RaiseErrors.InvalidTokenAddress(_erc20Asset.erc20);\n        }\n    }\n\n    /**************************************\n\n        Finish raise\n\n     **************************************/\n\n    /// @dev Set finish raise\n    /// @param _raiseId ID of the raise\n    /// @param _raised uint256 raised funds\n    /// @param _merkleRoot bytes32 merkle root\n    function setFinishRaiseData(string memory _raiseId, uint256 _raised, bytes32 _merkleRoot) internal {\n        StorageTypes.RaiseDataCC memory raiseDataCC_ = StorageTypes.RaiseDataCC({ raised: _raised, merkleRoot: _merkleRoot });\n        LibRaise.setRaiseDataCrosschain(_raiseId, raiseDataCC_);\n\n        if (isSoftcapAchieved(_raiseId)) {\n            LibRaise.setRaiseStatus(_raiseId, EnumTypes.RaiseStatus.RaiseSucceed);\n        } else {\n            LibRaise.setRaiseStatus(_raiseId, EnumTypes.RaiseStatus.RaiseFailed);\n        }\n    }\n\n    /// @dev Used for both: sender and receiver\n    /// @param _raiseId ID of the raise\n    /// @param _sender Message sender\n    /// @param _nonce Used nonce\n    function validateFinishRaiseRequest(string memory _raiseId, address _sender, uint256 _nonce) internal view {\n        if (_nonce <= LibNonce.getLastNonce(_sender)) {\n            revert RequestErrors.NonceExpired(_sender, _nonce);\n        }\n\n        if (LibRaise.getMerkleRoot(_raiseId) != 0) {\n            revert RaiseErrors.RaiseAlreadyFinished(_raiseId);\n        }\n    }\n\n    /**************************************\n\n        Sold / unsold\n\n     **************************************/\n\n    /// @dev Get amount of sold tokens.\n    /// @param _raiseId ID of raise\n    /// @return Amount of tokens to claim by investor\n    function getSold(string memory _raiseId) internal view returns (uint256) {\n        // get tokens per base asset\n        uint256 tokensPerBaseAsset_ = LibRaise.getTokensPerBaseAsset(_raiseId);\n\n        // get raised\n        uint256 raised_ = LibRaise.getRaised(_raiseId);\n\n        // calculate how much tokens are sold\n        return (tokensPerBaseAsset_ * raised_) / LibRaise.PRICE_PRECISION;\n    }\n\n    /// @dev Get amount of unsold tokens.\n    /// @param _raiseId ID of raise\n    /// @return Amount of tokens to reclaim by startup\n    function getUnsold(string memory _raiseId) internal view returns (uint256) {\n        // get all vested tokens\n        uint256 vested_ = LibERC20Asset.getAmount(_raiseId);\n\n        // get sold tokens\n        uint256 sold_ = getSold(_raiseId);\n\n        // return\n        return vested_ - sold_;\n    }\n\n    /// @dev Get amount of unsold tokens.\n    /// @param _raiseId ID of raise\n    /// @param _diff Amount of unsold base asset\n    /// @return Amount of tokens to reclaim by startup\n    function calculateUnsold(string memory _raiseId, uint256 _diff) internal view returns (uint256) {\n        // calculate how much tokens are unsold\n        return (LibRaise.getTokensPerBaseAsset(_raiseId) * _diff) / LibRaise.PRICE_PRECISION;\n    }\n\n    /**************************************\n\n        Getters\n\n     **************************************/\n\n    /// @dev Get amount of raised funds.\n    /// @param _raiseId ID of raise\n    /// @return Amount of collected funds in fundraising\n    function getRaised(string memory _raiseId) internal view returns (uint256) {\n        return LibRaise.getRaised(_raiseId);\n    }\n\n    /// @dev Get softcap limit.\n    /// @param _raiseId ID of raise\n    /// @return Softcap limit\n    function getSoftcap(string memory _raiseId) internal view returns (uint256) {\n        return LibRaise.getSoftcap(_raiseId);\n    }\n\n    /**************************************\n\n        Checks\n\n     **************************************/\n\n    /// @dev Check if raise for given id exists.\n    /// @param _raiseId ID of the raise\n    /// @return True if raise exists\n    function isRaiseExists(string memory _raiseId) internal view returns (bool) {\n        // return\n        return bytes(LibRaise.getId(_raiseId)).length != 0;\n    }\n\n    /// @dev Check if raise is active.\n    /// @param _raiseId ID of raise\n    /// @return True if investment round is ongoing\n    function isRaiseActive(string memory _raiseId) internal view returns (bool) {\n        // tx.members\n        uint256 now_ = block.timestamp;\n\n        // get raise start time\n        uint256 start_ = LibRaise.getStart(_raiseId);\n        // get raise end time\n        uint256 end_ = LibRaise.getEnd(_raiseId);\n\n        // final check\n        return start_ <= now_ && now_ <= end_;\n    }\n\n    /// @dev Validation if raise was completed.\n    /// @param _raiseId ID of raise\n    function validateCompletedRaise(string memory _raiseId) internal view {\n        // verify raise exists\n        if (!isRaiseExists(_raiseId)) {\n            revert RaiseErrors.RaiseDoesNotExists(_raiseId);\n        }\n\n        // check if raise failed already\n        if (LibRaise.getRaiseStatus(_raiseId) != EnumTypes.RaiseStatus.RaiseSucceed) {\n            revert RaiseErrors.RaiseNotSucceed(_raiseId);\n        }\n    }\n\n    /// @dev Check if softcap was achieved.\n    /// @param _raiseId ID of raise\n    /// @return True if softcap was achieved\n    function isSoftcapAchieved(string memory _raiseId) internal view returns (bool) {\n        // return\n        return LibRaise.getSoftcap(_raiseId) <= LibRaise.getRaised(_raiseId);\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/services/cross-chain/aleph-zero/AlephZeroSenderService.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// Local imports - constants, encoders, events, errors, structs\nimport { CrossChainEncoder } from \"../../../../encoders/CrossChainEncoder.sol\";\nimport { AlephZeroEvents } from \"../../../../events/cross-chain/AlephZeroEvents.sol\";\nimport { CrossChainErrors } from \"../../../../errors/cross-chain/CrossChainErrors.sol\";\nimport { AlephZeroErrors } from \"../../../../errors/cross-chain/AlephZeroErrors.sol\";\nimport { RequestTypes } from \"../../../../structs/RequestTypes.sol\";\nimport { CrossChainRequestTypes } from \"../../../../structs/CrossChainRequestTypes.sol\";\nimport { BridgeTypes } from \"../../../../structs/BridgeTypes.sol\";\n\n// Local imports - storages\nimport { LibCrossChainSubstrateConfiguration } from \"../../../storage/cross-chain/LibCrossChainSubstrateConfiguration.sol\";\n\n/// @notice Service responsible for sending cross-chain messages to AlephZero\nlibrary AlephZeroSenderService {\n    // -----------------------------------------------------------------------\n    //                              Send message\n    // -----------------------------------------------------------------------\n\n    /// @dev Send cross-chain message.\n    /// @param _crossChainData Encoded data to send\n    /// @param _bridgeChainId Destination chain bridge id\n    function sendCrossChainMessage(bytes calldata _crossChainData, uint256 _bridgeChainId) internal {\n        // decode AlephZero params\n        CrossChainRequestTypes.AlephZeroData memory azData_ = CrossChainEncoder.decodeAlephZeroData(_crossChainData);\n\n        // get destination fundraising address\n        bytes memory trustedRemote_ = LibCrossChainSubstrateConfiguration.getFundraising(_bridgeChainId);\n\n        // validate data\n        validateAlephZeroSendData(azData_, _bridgeChainId, trustedRemote_);\n\n        // emit cross-chain message\n        emit AlephZeroEvents.AlephZeroSenderEvent(\n            BridgeTypes.Target(_bridgeChainId, trustedRemote_),\n            BridgeTypes.Source(block.chainid, abi.encode(address(this))),\n            BridgeTypes.Transaction(azData_.nonce, azData_.func, azData_.args, azData_.options)\n        );\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Validation\n    // -----------------------------------------------------------------------\n\n    /// @dev Validate LayerZero data before send.\n    /// @param _azData RequestTypes.LayerZeroData struct\n    /// @param _chainId Destination chain native id\n    /// @param _trustedRemote Trusted remote on desired chain id\n    function validateAlephZeroSendData(\n        CrossChainRequestTypes.AlephZeroData memory _azData,\n        uint256 _chainId,\n        bytes memory _trustedRemote\n    ) internal view {\n        // validate if destination chain is supported\n        if (_trustedRemote.length == 0) {\n            revert CrossChainErrors.UnsupportedChainId(_chainId);\n        }\n\n        // validate if function to perform is supported\n        if (!LibCrossChainSubstrateConfiguration.getSupportedFunction(_chainId, _azData.func)) {\n            revert AlephZeroErrors.UnsupportedFunction(_chainId, _azData.func);\n        }\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/services/cross-chain/layer-zero/LayerZeroSenderService.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// LayerZero imports\nimport { ILayerZeroEndpoint } from \"layer-zero/contracts/interfaces/ILayerZeroEndpoint.sol\";\n\n// Local imports - constants, encoders, events, errors, structs\nimport { CrossChainEncoder } from \"../../../../encoders/CrossChainEncoder.sol\";\nimport { CrossChainErrors } from \"../../../../errors/cross-chain/CrossChainErrors.sol\";\nimport { LayerZeroErrors } from \"../../../../errors/cross-chain/LayerZeroErrors.sol\";\nimport { RequestTypes } from \"../../../../structs/RequestTypes.sol\";\nimport { CrossChainRequestTypes } from \"../../../../structs/CrossChainRequestTypes.sol\";\n\n// Local imports - storages\nimport { LibCrossChainEvmConfiguration } from \"../../../storage/cross-chain/LibCrossChainEvmConfiguration.sol\";\nimport { LibLayerZeroBase } from \"../../../storage/cross-chain/layer-zero/LibLayerZeroBase.sol\";\nimport { LibLayerZeroSender } from \"../../../storage/cross-chain/layer-zero/LibLayerZeroSender.sol\";\n\n/// @notice Service responsible for sending cross-chain messages through LayerZero\nlibrary LayerZeroSenderService {\n    // -----------------------------------------------------------------------\n    //                              Send message\n    // -----------------------------------------------------------------------\n\n    /// @dev Send cross-chain message.\n    /// @param _crossChainData Encoded data to send\n    /// @param _nativeChainId Destination chain native id\n    function sendCrossChainMessage(bytes calldata _crossChainData, uint256 _nativeChainId) internal {\n        // decode LayerZero params\n        CrossChainRequestTypes.LayerZeroData memory lzData_ = CrossChainEncoder.decodeLayerZeroData(_crossChainData);\n\n        // validate data\n        validateLayerZeroSendData(lzData_, _nativeChainId);\n\n        // get LayerZero chain id\n        uint16 lzChainId_ = LibLayerZeroSender.getNetwork(_nativeChainId);\n\n        // get LayerZero endpoint\n        address lzEndpoint_ = LibLayerZeroBase.getCrossChainEndpoint();\n\n        // get destination fundraising address\n        address destination_ = LibCrossChainEvmConfiguration.getFundraising(_nativeChainId);\n\n        // get address needed to potential refund\n        address payable refundAddress_ = payable(LibLayerZeroSender.getRefundAddress());\n\n        // calculate LayerZero trusted remote\n        bytes memory trustedRemote_ = abi.encodePacked(destination_, address(this));\n\n        // send cross-chain message\n        ILayerZeroEndpoint(lzEndpoint_).send{ value: lzData_.fee }(\n            lzChainId_,\n            trustedRemote_,\n            lzData_.payload,\n            refundAddress_,\n            address(0), // Parameter which will be used by LayerZero in the future when they'll have their token, right now hardcoded\n            lzData_.additionalParams\n        );\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Validation\n    // -----------------------------------------------------------------------\n\n    /// @dev Validate LayerZero data before send.\n    /// @param _lzData RequestTypes.LayerZeroData struct\n    /// @param _chainId Destination chain native id\n    function validateLayerZeroSendData(CrossChainRequestTypes.LayerZeroData memory _lzData, uint256 _chainId) internal view {\n        // validate if payload is not empty\n        if (_lzData.payload.length == 0) {\n            revert CrossChainErrors.EmptyPayload();\n        }\n\n        // validate if destination chain is supported\n        if (LibLayerZeroSender.getNetwork(_chainId) == 0) {\n            revert LayerZeroErrors.UnsupportedLayerZeroChain(_chainId);\n        }\n\n        // validate if function to perform is supported\n        bytes4 functionToCall_ = bytes4(_lzData.payload);\n        if (!LibCrossChainEvmConfiguration.getSupportedFunction(_chainId, functionToCall_)) {\n            revert LayerZeroErrors.UnsupportedFunction(_chainId, functionToCall_);\n        }\n\n        // validate if LayerZero fee is not equal 0\n        if (_lzData.fee == 0) {\n            revert LayerZeroErrors.InvalidLayerZeroFee();\n        }\n\n        // validate if sent native tokens is at least the same like LayerZero fee\n        if (msg.value < _lzData.fee) {\n            revert LayerZeroErrors.InvalidNativeSent(msg.value, _lzData.fee);\n        }\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/services/assets/BadgeService.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// OpenZeppelin\nimport { IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\n// Local imports - storages\nimport { LibAppStorage } from \"../../storage/ethereum/LibAppStorage.sol\";\nimport { LibBaseAsset } from \"../../../libraries/storage/assets/LibBaseAsset.sol\";\n\n// Local imports - interfaces\nimport { IEquityBadge } from \"../../../../interfaces/IEquityBadge.sol\";\n\nlibrary BadgeService {\n    /// @dev Mint badge.\n    /// @param _raiseId ID of raise\n    /// @param _badgeId ID of badge\n    /// @param _investment Amount of badges to mint is proportional to investment amount\n    function mintBadge(string memory _raiseId, uint256 _badgeId, uint256 _investment) internal {\n        // tx.members\n        address sender_ = msg.sender;\n\n        // get badge\n        IEquityBadge badge = LibAppStorage.getBadge();\n\n        // get base asset\n        IERC20Metadata baseAsset_ = IERC20Metadata(LibBaseAsset.getAddress(_raiseId));\n\n        // erc1155 bytes conversion\n        bytes memory data_ = abi.encode(_badgeId);\n\n        // mint equity badge\n        badge.mint(sender_, _badgeId, _investment / 10 ** baseAsset_.decimals(), data_);\n    }\n\n    /// @dev Convert raise id to badge id.\n    /// @param _raiseId ID of the raise\n    function convertRaiseToBadge(string memory _raiseId) internal pure returns (uint256) {\n        return uint256(keccak256(abi.encode(_raiseId)));\n    }\n\n    /// @dev Set URI for given badge id on the Equity Badge ERC-1155 token.\n    /// @param _badgeId ID of badge\n    /// @param _uri URI\n    function setEquityBadgeURI(uint256 _badgeId, string memory _uri) internal {\n        LibAppStorage.getBadge().setURI(_badgeId, _uri);\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/services/assets/internal/ERC20AssetService.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// OpenZeppelin imports\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n// Local imports - constants, encoders, events, errors, structs\nimport { RaiseErrors } from \"../../../../errors/RaiseErrors.sol\";\nimport { MilestoneErrors } from \"../../../../errors/MilestoneErrors.sol\";\n\n// Local imports - storages\nimport { LibERC20Asset } from \"../../../storage/assets/LibERC20Asset.sol\";\nimport { LibEscrow } from \"../../../storage/assets/LibEscrow.sol\";\nimport { LibRaise } from \"../../../storage/raise/LibRaise.sol\";\n\n// Local imports - services\nimport { RaiseService } from \"../../raise/internal/RaiseService.sol\";\n\nlibrary ERC20AssetService {\n    using SafeERC20 for IERC20;\n\n    /// @dev Collect vested ERC20 to start a raise.\n    /// @dev Validation: Requires startup to have enough ERC20 and provide allowance.\n    /// @dev Events: Transfer(address from, address to, uint256 value).\n    /// @param _token Address of ERC20\n    /// @param _sender Address of startup to withdraw ERC20 from\n    /// @param _escrow Address of cloned Escrow instance for raise\n    /// @param _amount Amount of ERC20 to collect\n    function collectVestedToken(address _token, address _sender, address _escrow, uint256 _amount) internal {\n        // tx.members\n        address self_ = address(this);\n\n        // erc20\n        IERC20 erc20_ = IERC20(_token);\n\n        // allowance check\n        uint256 allowance_ = erc20_.allowance(_sender, self_);\n\n        // validate if allowance greater or equal amount\n        if (allowance_ < _amount) {\n            revert RaiseErrors.NotEnoughAllowance(_sender, self_, allowance_);\n        }\n\n        // vest erc20\n        erc20_.safeTransferFrom(_sender, _escrow, _amount);\n    }\n\n    /// @dev Get ERC20 asset chain id.\n    /// @param _raiseId Raise id\n    /// @return ERC20Asset chain id\n    function getERC20AssetChainId(string memory _raiseId) internal view returns (uint256) {\n        return LibERC20Asset.getChainId(_raiseId);\n    }\n\n    /// @dev Validate an early stage raise.\n    /// @param _raiseId Raise id\n    function validateERC20(string memory _raiseId) internal view {\n        // get erc20\n        address erc20_ = LibERC20Asset.getAddress(_raiseId);\n\n        // check if erc20 address is set\n        if (erc20_ == address(0)) revert RaiseErrors.TokenNotSet(_raiseId);\n\n        // get escrow\n        address escrow_ = LibEscrow.getEscrow(_raiseId);\n\n        // check if erc20 is present on escrow for claiming\n        if (IERC20(erc20_).balanceOf(escrow_) == 0) {\n            revert MilestoneErrors.TokenNotOnEscrow(_raiseId);\n        }\n    }\n\n    /// @dev Check if all sold tokens are on escrow\n    /// @param _raiseId Raise id\n    function validateSoldTokensOnEscrow(string memory _raiseId) internal view {\n        // get erc20\n        address erc20_ = LibERC20Asset.getAddress(_raiseId);\n\n        // get escrow\n        address escrow_ = LibEscrow.getEscrow(_raiseId);\n\n        // get escrow balance\n        uint256 balance_ = IERC20(erc20_).balanceOf(escrow_);\n\n        // get sold tokens\n        uint256 sold_ = RaiseService.getSold(_raiseId);\n\n        // check if sold tokens are on escrow\n        if (sold_ != balance_) {\n            revert MilestoneErrors.NotEnoughTokensOnEscrow(balance_);\n        }\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/services/assets/EscrowService.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// OpenZeppelin imports\nimport { Clones } from \"@openzeppelin/contracts/proxy/Clones.sol\";\n\n// Local imports - constants, encoders, events, errors, structs\nimport { EscrowEvents } from \"../../../events/EscrowEvents.sol\";\nimport { EscrowErrors } from \"../../../errors/EscrowErrors.sol\";\nimport { LibEscrow } from \"../../storage/assets/LibEscrow.sol\";\n\n// Local imports - interfaces\nimport { Configurable } from \"../../../../utils/Configurable.sol\";\n\nlibrary EscrowService {\n    /// @dev Allows to create new Escrow contract.\n    /// @dev Events: EscrowCreated(string raiseId, address instance, address source).\n    /// @param _raiseId Id of the Raise for which Escrow will be created.\n    /// @return escrow_ Newly created Escrow contract address\n    function createEscrow(string memory _raiseId) internal returns (address escrow_) {\n        // get Escrow source address\n        address source_ = LibEscrow.getSource();\n\n        // validate if source is set\n        if (source_ == address(0)) {\n            revert EscrowErrors.SourceNotSet();\n        }\n\n        // create new Escrow - clone\n        escrow_ = Clones.clone(source_);\n\n        // configure Escrow\n        Configurable(escrow_).configure(abi.encode(address(this)));\n\n        // assing created Escrow address for given raise id\n        LibEscrow.setEscrow(_raiseId, escrow_);\n\n        // emit\n        emit EscrowEvents.EscrowCreated(_raiseId, escrow_, source_);\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/services/utils/SignatureService.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// OpenZeppelin imports\nimport { ECDSA } from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\n// Local imports - constants, encoders, events, errors, structs\nimport { SignatureConstants } from \"../../../constants/SignatureConstants.sol\";\nimport { SignatureErrors } from \"../../../errors/SignatureErrors.sol\";\nimport { AccessTypes } from \"../../../structs/AccessTypes.sol\";\n\n// Local imports - storages\nimport { LibAccessControl } from \"../../storage/utils/LibAccessControl.sol\";\n\nlibrary SignatureService {\n    // const\n    bytes32 internal constant EIP712_DOMAIN_TYPEHASH =\n        keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n    /// @dev Verify if given signature is signed by correct signer.\n    /// @param _message Hash message\n    /// @param _v Part of signature for message\n    /// @param _r Part of signature for message\n    /// @param _s Part of signature for message\n    function verifySignature(bytes32 _message, uint8 _v, bytes32 _r, bytes32 _s) internal view {\n        // signer of message\n        address signer_ = recoverSigner(_message, _v, _r, _s);\n\n        // validate signer\n        if (!LibAccessControl.hasRole(AccessTypes.SIGNER_ROLE, signer_)) {\n            revert SignatureErrors.IncorrectSigner(signer_);\n        }\n    }\n\n    /// @dev Verify EIP-712 message sent.\n    /// @param _nameHash Hash EIP-712 name\n    /// @param _versionHash Hash EIP-712 version\n    /// @param _rawMessage Hash message calculated \"on-the-fly\"\n    /// @param _message Message sent in request\n    function verifyMessage(bytes32 _nameHash, bytes32 _versionHash, bytes32 _rawMessage, bytes32 _message) internal view {\n        // build domain separator\n        bytes32 domainSeparatorV4_ = keccak256(\n            abi.encode(SignatureConstants.EIP712_DOMAIN_TYPEHASH, _nameHash, _versionHash, block.chainid, address(this))\n        );\n\n        // construct EIP712 message\n        bytes32 toVerify_ = ECDSA.toTypedDataHash(domainSeparatorV4_, _rawMessage);\n\n        // verify computation against original\n        if (toVerify_ != _message) {\n            revert SignatureErrors.InvalidMessage(toVerify_, _message);\n        }\n    }\n\n    function hashToMessage(bytes32 _nameHash, bytes32 _versionHash, bytes32 _rawMessage) internal view returns (bytes32) {\n        // return\n        return hashToMessage(_nameHash, _versionHash, _rawMessage, address(this));\n    }\n\n    function hashToMessage(\n        bytes32 _nameHash,\n        bytes32 _versionHash,\n        bytes32 _rawMessage,\n        address _contractAddress\n    ) internal view returns (bytes32) {\n        // build domain separator\n        bytes32 domainSeparatorV4_ = keccak256(abi.encode(EIP712_DOMAIN_TYPEHASH, _nameHash, _versionHash, block.chainid, _contractAddress));\n\n        // construct EIP712 message\n        return ECDSA.toTypedDataHash(domainSeparatorV4_, _rawMessage);\n    }\n\n    /// @dev Allows to return signer of the signature.\n    /// @param _data Message sent in request\n    /// @param _v Part of signature for message\n    /// @param _r Part of signature for message\n    /// @param _s Part of signature for message\n    /// @return Signer of the message\n    function recoverSigner(bytes32 _data, uint8 _v, bytes32 _r, bytes32 _s) internal pure returns (address) {\n        // recover EIP712 signer using provided vrs\n        address signer_ = ECDSA.recover(_data, _v, _r, _s);\n\n        // return signer\n        return signer_;\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/services/raise/FinishRaiseService.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// Local imports - constants, encoders, events, errors, structs\nimport { RequestErrors } from \"../../../errors/RequestErrors.sol\";\nimport { RaiseErrors } from \"../../../errors/RaiseErrors.sol\";\nimport { RequestTypes } from \"../../../structs/RequestTypes.sol\";\nimport { EnumTypes } from \"../../../structs/EnumTypes.sol\";\n\n// Local imports - storages\nimport { LibNonce } from \"../../storage/utils/LibNonce.sol\";\nimport { LibRaise } from \"../../storage/raise/LibRaise.sol\";\n\n// Local imports - services\nimport { RaiseService } from \"./internal/RaiseService.sol\";\n\nlibrary FinishRaiseService {\n    /// @dev Validate create raise request.\n    /// @param _request RequestTypes.CreateRaiseRequest struct\n    /// @param _softcap Softcap\n    function validateFinishRaiseRequest(RequestTypes.FinishRaiseRequest calldata _request, uint256 _softcap) internal view {\n        // tx.members\n        address sender_ = msg.sender;\n        uint256 now_ = block.timestamp;\n\n        // check request expiration\n        if (now_ > _request.base.expiry) {\n            revert RequestErrors.RequestExpired(sender_, _request.base.expiry);\n        }\n\n        // check request sender\n        if (sender_ != _request.base.sender) {\n            revert RequestErrors.IncorrectSender(sender_);\n        }\n\n        // check if raise exists\n        if (!RaiseService.isRaiseExists(_request.raiseId)) {\n            revert RaiseErrors.RaiseDoesNotExists(_request.raiseId);\n        }\n\n        // check if raise not finished yet\n        if (LibRaise.getRaiseStatus(_request.raiseId) != EnumTypes.RaiseStatus.RaiseCreated) {\n            revert RequestErrors.RaiseFinishedAlready(_request.raiseId);\n        }\n\n        // get end timestamp\n        uint256 endTimestamp_ = LibRaise.getEnd(_request.raiseId);\n\n        // check if finish can be done\n        if (block.timestamp < endTimestamp_) {\n            revert RequestErrors.RaiseCannotBeFinishedYet(_request.raiseId, endTimestamp_);\n        }\n\n        // validate raised amount of merkle root\n        uint256 raisedFromStorage_ = LibRaise.getRaised(_request.raiseId);\n        if (raisedFromStorage_ != _request.raised) {\n            revert RequestErrors.InvalidRaisedAmount(_request.raiseId, _request.raised, raisedFromStorage_);\n        }\n\n        // check if merkle tree is zero when it should be zero\n        bool merkleRootSet_ = _request.merkleRoot != bytes32(0); // false\n        bool softcapAchieved_ = _request.raised >= _softcap; // false\n\n        // expect:\n        // softcap achieved -> merkle root set despite cc or not\n        // softcap not achieved -> merkle root empty\n        if (!softcapAchieved_ && merkleRootSet_) {\n            revert RequestErrors.MerkleRootSet(_request.raised, _softcap, _request.merkleRoot);\n        } else if (softcapAchieved_ && !merkleRootSet_) {\n            revert RequestErrors.MerkleRootNotSet(_request.raised, _softcap, _request.merkleRoot);\n        }\n\n        // proceed with further validation\n        RaiseService.validateFinishRaiseRequest(_request.raiseId, sender_, _request.base.nonce);\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/services/raise/CreateRaiseService.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// Local imports - constants, encoders, events, errors, structs\nimport { RequestErrors } from \"../../../errors/RequestErrors.sol\";\nimport { RequestTypes } from \"../../../structs/RequestTypes.sol\";\n\n// Local imports - services\nimport { RaiseService } from \"./internal/RaiseService.sol\";\n\nlibrary CreateRaiseService {\n    /// @dev Validate create raise request.\n    /// @param _request RequestTypes.CreateRaiseRequest struct\n    function validateCreateRaiseRequest(RequestTypes.CreateRaiseRequest calldata _request) internal view {\n        // tx.members\n        address sender_ = msg.sender;\n        uint256 now_ = block.timestamp;\n\n        // check replay attack\n        uint256 nonce_ = _request.base.nonce;\n\n        // check request expiration\n        if (now_ > _request.base.expiry) {\n            revert RequestErrors.RequestExpired(sender_, _request.base.expiry);\n        }\n\n        // check request sender\n        if (sender_ != _request.base.sender) {\n            revert RequestErrors.IncorrectSender(sender_);\n        }\n\n        // check request badge uri\n        if (bytes(_request.badgeUri).length == 0) {\n            revert RequestErrors.BadgeUriEmpty();\n        }\n\n        RaiseService.validateCreationRequest(_request.raise, _request.raiseDetails, _request.erc20Asset, sender_, nonce_);\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/interfaces/raise/IFinishRaiseFacet.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// Local imports - Structs\nimport { RequestTypes } from \"../../structs/RequestTypes.sol\";\nimport { CrossChainRequestTypes } from \"../../structs/CrossChainRequestTypes.sol\";\n\ninterface IFinishRaiseFacet {\n    function finishRaise(\n        RequestTypes.FinishRaiseRequest calldata _request,\n        bytes32 _message,\n        uint8 _v,\n        bytes32 _r,\n        bytes32 _s,\n        CrossChainRequestTypes.CrossChainData calldata _crossChainData\n    ) external payable;\n}\n"
      },
      "src/fundraising/node_modules/@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.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 IERC20Permit {\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"
      },
      "src/fundraising/node_modules/@openzeppelin/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n     *\n     * _Available since v4.8._\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        if (success) {\n            if (returndata.length == 0) {\n                // only check isContract if the call was successful and the return data is empty\n                // otherwise we already know that it was a contract\n                require(isContract(target), \"Address: call to non-contract\");\n            }\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason or using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    function _revert(bytes memory returndata, string memory errorMessage) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert(errorMessage);\n        }\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/structs/StorageTypes.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// Local imports\nimport { EnumTypes } from \"./EnumTypes.sol\";\n\n/// @notice Library with core storage structs definition.\nlibrary StorageTypes {\n    // -----------------------------------------------------------------------\n    //                              Raise\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct containing main information about the raise.\n    /// @param raiseId UUID of raise\n    /// @param raiseType Type of raise\n    /// @param owner Address of startup\n    struct Raise {\n        string raiseId;\n        EnumTypes.RaiseType raiseType;\n        address owner;\n    }\n\n    /// @dev Struct containing detailed info about raise.\n    /// @param tokensPerBaseAsset Ratio of how much tokens is worth 1 unit of base asset (erc20 * precision / hardcap)\n    /// @param hardcap Max amount of base asset to collect during a raise\n    /// @param softcap Min amount of base asset to collect during a raise\n    /// @param start Start date of raise\n    /// @param end End date of raise\n    struct RaiseDetails {\n        uint256 tokensPerBaseAsset;\n        uint256 hardcap;\n        uint256 softcap;\n        uint256 start;\n        uint256 end;\n    }\n\n    /// @dev Struct containing information about the raise shared across chains.\n    /// @param raised Amount of raised base asset for fundraising\n    /// @param merkleRoot Merkle root compressing all information about investors and their investments\n    struct RaiseDataCC {\n        uint256 raised;\n        bytes32 merkleRoot;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              ERC-20 Asset\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct defining ERC20 offered by startup for investments.\n    /// @param erc20 Address of ERC20 token\n    /// @param chainId ID of network that asset exists\n    /// @param amount Total amount of ERC20 used in vesting\n    struct ERC20Asset {\n        address erc20;\n        uint256 chainId;\n        uint256 amount;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Base Asset\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct defining base asset used for investment on particular chain.\n    /// @param base Address of base asset\n    /// @param chainId ID of network that asset exists\n    struct BaseAsset {\n        address base;\n        uint256 chainId;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Investor Funds Info\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct containing info about state of investor funds.\n    /// @param invested Mapping that stores how much given address invested\n    /// @param investmentRefunded Mapping that tracks if user was refunded\n    struct InvestorFundsInfo {\n        mapping(address => uint256) invested;\n        mapping(address => bool) investmentRefunded;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Startup Funds Info\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct containing info about state of startup funds.\n    /// @param collateralRefunded Boolean describing if startup was refunded\n    /// @param reclaimed Boolean that shows if startup reclaimed unsold tokens\n    struct StartupFundsInfo {\n        bool collateralRefunded;\n        bool reclaimed;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Milestone\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct containing info about milestone and shares it's unlocking.\n    /// @param milestoneId UUID of milestone\n    /// @param milestoneNo Index of milestone (counted from 1)\n    /// @param share % of unlocked tokens (12.5% = 12.5 * 1_000_000)\n    struct Milestone {\n        string milestoneId;\n        uint256 milestoneNo;\n        uint256 share;\n    }\n\n    /// @dev Struct containing milestones and share data.\n    /// @param milestones Ordered list of unlocked milestones containing all their details\n    /// @param unlockedShares Sum of shares from all submitted milestones\n    /// @param rejectedShares Amount of shares reverted back due to failed repair plan\n    /// @param totalShares Sum of all unlocked and rejected shares (should not exceed 100%)\n    struct ShareInfo {\n        Milestone[] milestones;\n        uint256 unlockedShares;\n        uint256 rejectedShares;\n        uint256 totalShares;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Claiming\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct containing frequently used storage for claiming purposes.\n    /// @param investorClaimed Mapping that stores amount claimed of each investor\n    /// @param startupClaimed Amount of claimed assets by startup owner\n    struct ClaimingInfo {\n        mapping(address => uint256) investorClaimed;\n        uint256 startupClaimed;\n    }\n\n    /// @dev Struct containing informations about claiming schedules for investors.\n    /// @param claimingId UUID of claiming\n    /// @param milestoneId UUID of milestone\n    /// @param partialShare Share of milestone tokens which are unlocked in the given claiming\n    /// @param unlockTimestamp Timestamp on which tokens are unlocked\n    struct ClaimingSchedule {\n        string claimingId;\n        string milestoneId;\n        uint256 partialShare;\n        uint256 unlockTimestamp;\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/errors/RequestErrors.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\nimport { RequestTypes } from \"../structs/RequestTypes.sol\";\n\n/**************************************\n\n    Request errors\n\n**************************************/\n\n/// @dev All errors connected with secure communication.\nlibrary RequestErrors {\n    // -----------------------------------------------------------------------\n    //                              Request\n    // -----------------------------------------------------------------------\n\n    error RequestExpired(address sender, uint256 expiry); // 0x8a288b92\n    error NonceExpired(address sender, uint256 nonce); // 0x2b6069a9\n    error IncorrectSender(address sender); // 0x7da9057e\n    error RaiseCannotBeFinishedYet(string raiseId, uint256 endTimestamp); // 0x7ae96774\n    error BadgeUriEmpty(); // 0xb03cfc55\n    error MerkleRootSet(uint256 raised, uint256 softcap, bytes32 merkleRoot); // 0x77242f66\n    error MerkleRootNotSet(uint256 raised, uint256 softcap, bytes32 merkleRoot); // 0xfe60e7d0\n    error InvalidMerkleProofs(string raiseId, address user, uint256 investment, bytes32[] proofs, bytes32 root, bytes32 leaf); // 0xa112d454\n    error InvalidRaisedAmount(string raiseId, uint256 providedRaised, uint256 correctRaised); // 0x2d6d8be6\n    error RaiseFinishedAlready(string raiseId); // 0xdef0e29b\n}\n"
      },
      "src/fundraising/contracts/fundraising/errors/RaiseErrors.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/**************************************\n\n    Raise errors\n\n**************************************/\n\n/// @dev All errors connected with raises.\nlibrary RaiseErrors {\n    // -----------------------------------------------------------------------\n    //                              Raise Creation\n    // -----------------------------------------------------------------------\n\n    error InvalidRaiseId(string raiseId); // 0xc2f9a803\n    error InvalidRaiseStartEnd(uint256 start, uint256 end); // 0xb2fb4a1d\n    error StartDateInPast(uint256 start); // 0x28b25bae\n    error HardcapLessThanSoftcap(uint256 hardcap, uint256 softcap); // 0xa13f495f\n    error InvalidVestedAmount(); // 0x17329d67\n    error PriceNotMatchConfiguration(uint256 price, uint256 hardcap, uint256 vested); // 0x643c0fc5\n    error InvalidTokenAddress(address token); // 0x73306803\n\n    // -----------------------------------------------------------------------\n    //                              Early Stage\n    // -----------------------------------------------------------------------\n\n    error OnlyForEarlyStage(string raiseId); // 0x2e14bd97\n    error CannotForEarlyStage(string raiseId); // 0x28471ed7\n    error TokenAlreadySet(string raiseId); // 0x11f125e1\n    error TokenNotSet(string raiseId); // 0x64d2ac41\n    error OnlyForStandard(string raiseId); // 0x493e93f0\n\n    // -----------------------------------------------------------------------\n    //                                 OTC\n    // -----------------------------------------------------------------------\n\n    error CannotForOTC(string raiseId); // 0x886ebb60\n\n    // -----------------------------------------------------------------------\n    //                              Investing\n    // -----------------------------------------------------------------------\n\n    error IncorrectAmount(uint256 amount); // 0x88967d2f\n    error OwnerCannotInvest(address sender, string raiseId); // 0x44b4eea9\n    error InvestmentOverLimit(uint256 existingInvestment, uint256 newInvestment, uint256 maxTicketSize); // 0x3ebbf796\n    error InvestmentOverHardcap(uint256 existingInvestment, uint256 newInvestment, uint256 hardcap); // 0xf0152bdf\n    error NotEnoughBalanceForInvestment(address sender, uint256 investment); // 0xaff6db15\n    error NotEnoughAllowance(address sender, address spender, uint256 amount); // 0x892e7739\n\n    // -----------------------------------------------------------------------\n    //                              Raise State\n    // -----------------------------------------------------------------------\n\n    error RaiseAlreadyExists(string raiseId); // 0xa7bb9fe0\n    error RaiseDoesNotExists(string raiseId); // 0x78134459\n    error RaiseNotActive(string raiseId, uint256 currentTime); // 0x251061ff\n    error RaiseNotFailed(string raiseId); // 0x1e45b786\n    error RaiseNotSucceed(string raiseId); // 0x3925f3e4\n    error RaiseAlreadyFinished(string raiseId); // 0x0287eafc\n\n    // -----------------------------------------------------------------------\n    //                              Softcap / Hardcap\n    // -----------------------------------------------------------------------\n\n    error HardcapAchieved(string raiseId); // 0x8e144f11\n\n    // -----------------------------------------------------------------------\n    //                              Reclaim\n    // -----------------------------------------------------------------------\n\n    error NothingToReclaim(string raiseId); // 0xf803caaa\n    error AlreadyReclaimed(string raiseId); // 0x5ab9f7ef\n\n    // -----------------------------------------------------------------------\n    //                              Refund\n    // -----------------------------------------------------------------------\n\n    error UserHasNotInvested(address sender, string raiseId); // 0xf2ed8df2\n    error CallerNotStartup(address sender, string raiseId); // 0x73810657\n    error InvestorAlreadyRefunded(address sender, string raiseId); // 0x2eff5e61\n    error CollateralAlreadyRefunded(string raiseId); // 0xc4543938\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/storage/assets/LibBaseAsset.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// Local imports - Structs\nimport { StorageTypes } from \"../../../structs/StorageTypes.sol\";\n\n/// @dev Library containing base asset storage with getters and setters\nlibrary LibBaseAsset {\n    // -----------------------------------------------------------------------\n    //                              Constants\n    // -----------------------------------------------------------------------\n\n    /// @dev Base asset storage pointer.\n    bytes32 internal constant BASE_ASSET_STORAGE_POSITION = keccak256(\"angelblock.fundraising.baseAsset\");\n\n    // -----------------------------------------------------------------------\n    //                              Structs\n    // -----------------------------------------------------------------------\n\n    /// @dev Base asset storage struct.\n    /// @param base Mapping of raise id to base asset struct\n    struct BaseAssetStorage {\n        mapping(string => StorageTypes.BaseAsset) base;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Diamond storage\n    // -----------------------------------------------------------------------\n\n    /// @dev Function returning base asset storage at storage pointer slot.\n    /// @return bas BaseAssetStorage struct instance at storage pointer position\n    function baseAssetStorage() internal pure returns (BaseAssetStorage storage bas) {\n        // declare position\n        bytes32 position = BASE_ASSET_STORAGE_POSITION;\n\n        // set slot to position\n        assembly {\n            bas.slot := position\n        }\n\n        // explicit return\n        return bas;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Getters / setters\n    // -----------------------------------------------------------------------\n\n    /// @dev Diamond storage getter: Base asset address.\n    /// @param _raiseId ID of the raise\n    /// @return Address of the base asset\n    function getAddress(string memory _raiseId) internal view returns (address) {\n        // return\n        return baseAssetStorage().base[_raiseId].base;\n    }\n\n    /// @dev Diamond storage getter: Base asset chain id.\n    /// @param _raiseId ID of the raise\n    /// @return Id of the chain\n    function getChainId(string memory _raiseId) internal view returns (uint256) {\n        // return\n        return baseAssetStorage().base[_raiseId].chainId;\n    }\n\n    /// @dev Diamond storage setter: Base asset\n    /// @param _raiseId ID of the raise\n    /// @param _baseAsset StorageTypes.BaseAsset struct\n    function setBaseAsset(string memory _raiseId, StorageTypes.BaseAsset memory _baseAsset) internal {\n        // set base asset\n        baseAssetStorage().base[_raiseId] = _baseAsset;\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/storage/utils/LibNonce.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/**************************************\n\n    Nonce library\n\n    ------------------------------\n\n    Diamond storage containing nonces\n\n **************************************/\n\n/// @notice Library implementing NonceStorage and functions.\nlibrary LibNonce {\n    // -----------------------------------------------------------------------\n    //                              Storage pointer\n    // -----------------------------------------------------------------------\n\n    /// @dev Storage pointer.\n    bytes32 internal constant NONCE_STORAGE_POSITION = keccak256(\"angelblock.fundraising.nonce\");\n\n    // -----------------------------------------------------------------------\n    //                              Structs\n    // -----------------------------------------------------------------------\n\n    /// @dev Nonce diamond storage.\n    /// @param nonces Mapping of address to nonce information.\n    struct NonceStorage {\n        mapping(address => uint256) nonces;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Diamond storage\n    // -----------------------------------------------------------------------\n\n    /// @dev Function returning nonce storage at storage pointer slot.\n    /// @return ns NonceStorage struct instance at storage pointer position\n    function nonceStorage() internal pure returns (NonceStorage storage ns) {\n        // declare position\n        bytes32 position = NONCE_STORAGE_POSITION;\n\n        // set slot to position\n        assembly {\n            ns.slot := position\n        }\n\n        // explicit return\n        return ns;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Getters / setters\n    // -----------------------------------------------------------------------\n\n    /// @dev Diamond storage getter: nonce per account.\n    /// @param _account Address for which nonce should be checked\n    /// @return Current nonce of account\n    function getLastNonce(address _account) internal view returns (uint256) {\n        // return\n        return nonceStorage().nonces[_account];\n    }\n\n    /// @dev Diamond storage setter: nonce per account.\n    /// @param _account Address for which nonce should be set\n    /// @param _nonce New value for nonce\n    function setNonce(address _account, uint256 _nonce) internal {\n        // get storage\n        NonceStorage storage ns = nonceStorage();\n\n        // set nonce\n        ns.nonces[_account] = _nonce;\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/encoders/CrossChainEncoder.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// Local imports - Structs\nimport { RequestTypes } from \"../structs/RequestTypes.sol\";\nimport { CrossChainRequestTypes } from \"../structs/CrossChainRequestTypes.sol\";\n\n/**************************************\n\n    Raise encoder\n\n**************************************/\n\n/// @notice Raise encoder for EIP712 message hash.\nlibrary CrossChainEncoder {\n    /// @dev Decode request data for raise registration.\n    /// @param _payload Byte-encoded payload\n    /// @return Decoded RequestTypes.RegisterRaiseRequest struct\n    function decodeRegisterRaisePayload(\n        bytes calldata _payload\n    ) internal pure returns (RequestTypes.RegisterRaiseRequest memory, bytes32, uint8, bytes32, bytes32) {\n        // return\n        return abi.decode(_payload, (RequestTypes.RegisterRaiseRequest, bytes32, uint8, bytes32, bytes32));\n    }\n\n    /// @dev Decode request data for raise finalization.\n    /// @param _payload Byte-encoded payload\n    /// @return Decoded RequestTypes.FinishRaiseReceiverRequest struct\n    function decodeFinishRaiseReceiverPayload(\n        bytes calldata _payload\n    ) internal pure returns (RequestTypes.FinishRaiseReceiverRequest memory, bytes32, uint8, bytes32, bytes32) {\n        // return\n        return abi.decode(_payload, (RequestTypes.FinishRaiseReceiverRequest, bytes32, uint8, bytes32, bytes32));\n    }\n\n    /// @dev Decode request data for unlocking new milestone.\n    /// @param _payload Byte-encoded payload\n    /// @return Decoded RequestTypes.SubmitClaimingReceiverRequest struct\n    function decodeUnlockMilestonePayload(\n        bytes calldata _payload\n    ) internal pure returns (RequestTypes.UnlockMilestoneReceiverRequest memory, bytes32, uint8, bytes32, bytes32) {\n        // return\n        return abi.decode(_payload, (RequestTypes.UnlockMilestoneReceiverRequest, bytes32, uint8, bytes32, bytes32));\n    }\n\n    /// @dev Decode request data for submitting claiming schedule.\n    /// @param _payload Byte-encoded payload\n    /// @return Decoded RequestTypes.SubmitClaimingReceiverRequest struct\n    function decodeSubmitClaimingPayload(\n        bytes calldata _payload\n    ) internal pure returns (RequestTypes.SubmitClaimingReceiverRequest memory, bytes32, uint8, bytes32, bytes32) {\n        // return\n        return abi.decode(_payload, (RequestTypes.SubmitClaimingReceiverRequest, bytes32, uint8, bytes32, bytes32));\n    }\n\n    /// @dev Decode request data for submitting failed repair plan.\n    /// @param _payload Byte-encoded payload\n    /// @return Decoded RequestTypes.RejectRaiseReceiverRequest struct\n    function decodeRejectRaisePayload(\n        bytes calldata _payload\n    ) internal pure returns (RequestTypes.RejectRaiseReceiverRequest memory, bytes32, uint8, bytes32, bytes32) {\n        // return\n        return abi.decode(_payload, (RequestTypes.RejectRaiseReceiverRequest, bytes32, uint8, bytes32, bytes32));\n    }\n\n    /// @dev Decode LayerZero data needed to send cross-chain message\n    /// @param _crossChainData Encoded data to send\n    /// @return Decoded RequestTypes.LayerZeroData struct\n    function decodeLayerZeroData(bytes calldata _crossChainData) internal pure returns (CrossChainRequestTypes.LayerZeroData memory) {\n        // decode and return\n        return abi.decode(_crossChainData, (CrossChainRequestTypes.LayerZeroData));\n    }\n\n    /// @dev Decode AlephZero data needed to send cross-chain message\n    /// @param _crossChainData Encoded data to send\n    /// @return Decoded RequestTypes.AlephZeroData struct\n    function decodeAlephZeroData(bytes calldata _crossChainData) internal pure returns (CrossChainRequestTypes.AlephZeroData memory) {\n        // decode and return\n        return abi.decode(_crossChainData, (CrossChainRequestTypes.AlephZeroData));\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/events/cross-chain/AlephZeroEvents.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// Local imports\nimport { BridgeTypes } from \"../../structs/BridgeTypes.sol\";\n\n/**************************************\n\n    AlephZero specific events\n\n**************************************/\n\n/// @dev All events used in the A0 communication\nlibrary AlephZeroEvents {\n    /// @dev Emitted when message is correctly sent.\n    /// @param target Struct containing information about cross-chain target receiver\n    /// @param source Struct containing information about sender\n    /// @param tx Struct containing all necessary information for cross-chain transaction processing\n    event AlephZeroSenderEvent(BridgeTypes.Target target, BridgeTypes.Source source, BridgeTypes.Transaction tx);\n}\n"
      },
      "src/fundraising/contracts/fundraising/errors/cross-chain/AlephZeroErrors.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/**************************************\n\n    AlephZero errors\n    \n**************************************/\n\n/// @dev All errors used in AlephZero cross chain communication\nlibrary AlephZeroErrors {\n    // -----------------------------------------------------------------------\n    //                              Payload\n    // -----------------------------------------------------------------------\n\n    error UnsupportedFunction(uint256 chainId, bytes4 functionName); // 0x4f1e4a6d\n}\n"
      },
      "src/fundraising/contracts/fundraising/structs/BridgeTypes.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/// @notice Library that defines cross chain containers for Bridge.\nlibrary BridgeTypes {\n    // -----------------------------------------------------------------------\n    //                              Bridge\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct containing cross chain target information\n    /// @param chainId Chain id in Bridge format\n    /// @param trustedRemote Trusted cross chain receiver address\n    struct Target {\n        uint256 chainId;\n        bytes trustedRemote;\n    }\n\n    /// @dev Struct containing cross chain source information\n    /// @param srcChainId Current chain id in Bridge format\n    /// @param srcAddress Address of sender\n    struct Source {\n        uint256 srcChainId;\n        bytes srcAddress;\n    }\n\n    /// @dev Struct containing cross chain transaction\n    /// @param nonce Cross chain nonce of tx\n    /// @param func String name of Substrate function to call\n    /// @param args Byte-encoded cross-chain arguments for function\n    /// @param options Byte-encoded cross chain settings for Bridge tx\n    struct Transaction {\n        uint256 nonce;\n        bytes4 func;\n        bytes args;\n        bytes options;\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/storage/cross-chain/LibCrossChainSubstrateConfiguration.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/// @notice Library containing cross-chain Substrate configuration\nlibrary LibCrossChainSubstrateConfiguration {\n    // -----------------------------------------------------------------------\n    //                              Constants\n    // -----------------------------------------------------------------------\n\n    /// @dev Cross-chain Substrate configuration storage pointer.\n    bytes32 internal constant CC_SUBSTRATE_CONFIG_STORAGE_POSITION = keccak256(\"angelblock.cc.substrate.config\");\n\n    // -----------------------------------------------------------------------\n    //                              Structs\n    // -----------------------------------------------------------------------\n\n    /// @dev Cross-chain EVM configuration storage struct.\n    /// @param fundraisings Mapping of native chain id to fundraising address on the given chain\n    /// @param supportedFunctions Mapping of native chain id to supported function selector\n    struct SubstrateConfigurationStorage {\n        mapping(uint256 => bytes) fundraisings;\n        mapping(uint256 => mapping(bytes4 => bool)) supportedFunctions;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Diamond storage\n    // -----------------------------------------------------------------------\n\n    /// @dev Function returning cross-chain evm configuration storage at storage pointer slot.\n    /// @return scs SubstrateConfigurationStorage struct instance at storage pointer position\n    function substrateConfigurationStorage() internal pure returns (SubstrateConfigurationStorage storage scs) {\n        // declare position\n        bytes32 position = CC_SUBSTRATE_CONFIG_STORAGE_POSITION;\n\n        // set slot to position\n        assembly {\n            scs.slot := position\n        }\n\n        // explicit return\n        return scs;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Getters\n    // -----------------------------------------------------------------------\n\n    /// @dev Diamond storage getter: Fundraising address.\n    /// @param _nativeChainId ID of the chain\n    /// @return Byte-encoded address of the fundraising\n    function getFundraising(uint256 _nativeChainId) internal view returns (bytes memory) {\n        // return\n        return substrateConfigurationStorage().fundraisings[_nativeChainId];\n    }\n\n    /// @dev Diamond storage getter: Supported function.\n    /// @param _nativeChainId ID of the chain\n    /// @param _supportedFunction String name of supported of function\n    /// @return True if function is supported\n    function getSupportedFunction(uint256 _nativeChainId, bytes4 _supportedFunction) internal view returns (bool) {\n        // return\n        return substrateConfigurationStorage().supportedFunctions[_nativeChainId][_supportedFunction];\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Setters\n    // -----------------------------------------------------------------------\n\n    /// @dev Diamond storage setter: Fundraising address.\n    /// @param _nativeChainId ID of the chain\n    /// @param _fundraising Byte-encoded address of the fundraising\n    function setFundraising(uint256 _nativeChainId, bytes memory _fundraising) internal {\n        // set fundraising\n        substrateConfigurationStorage().fundraisings[_nativeChainId] = _fundraising;\n    }\n\n    /// @dev Diamond storage setter: Supported function.\n    /// @param _nativeChainId ID of the chain\n    /// @param _supportedFunction String name of supported of function\n    /// @param _isSupported Boolean if function is supported\n    function setSupportedFunction(uint256 _nativeChainId, bytes4 _supportedFunction, bool _isSupported) internal {\n        // set supported function\n        substrateConfigurationStorage().supportedFunctions[_nativeChainId][_supportedFunction] = _isSupported;\n    }\n}\n"
      },
      "src/fundraising/node_modules/layer-zero/contracts/interfaces/ILayerZeroEndpoint.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.5.0;\n\nimport \"./ILayerZeroUserApplicationConfig.sol\";\n\ninterface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig {\n    // @notice send a LayerZero message to the specified address at a LayerZero endpoint.\n    // @param _dstChainId - the destination chain identifier\n    // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains\n    // @param _payload - a custom bytes payload to send to the destination contract\n    // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address\n    // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction\n    // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination\n    function send(uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable;\n\n    // @notice used by the messaging library to publish verified payload\n    // @param _srcChainId - the source chain identifier\n    // @param _srcAddress - the source contract (as bytes) at the source chain\n    // @param _dstAddress - the address on destination chain\n    // @param _nonce - the unbound message ordering nonce\n    // @param _gasLimit - the gas limit for external contract execution\n    // @param _payload - verified payload to send to the destination contract\n    function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external;\n\n    // @notice get the inboundNonce of a receiver from a source chain which could be EVM or non-EVM chain\n    // @param _srcChainId - the source chain identifier\n    // @param _srcAddress - the source chain contract address\n    function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64);\n\n    // @notice get the outboundNonce from this source chain which, consequently, is always an EVM\n    // @param _srcAddress - the source chain contract address\n    function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64);\n\n    // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery\n    // @param _dstChainId - the destination chain identifier\n    // @param _userApplication - the user app address on this EVM chain\n    // @param _payload - the custom message to send over LayerZero\n    // @param _payInZRO - if false, user app pays the protocol fee in native token\n    // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain\n    function estimateFees(uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam) external view returns (uint nativeFee, uint zroFee);\n\n    // @notice get this Endpoint's immutable source identifier\n    function getChainId() external view returns (uint16);\n\n    // @notice the interface to retry failed message on this Endpoint destination\n    // @param _srcChainId - the source chain identifier\n    // @param _srcAddress - the source chain contract address\n    // @param _payload - the payload to be retried\n    function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external;\n\n    // @notice query if any STORED payload (message blocking) at the endpoint.\n    // @param _srcChainId - the source chain identifier\n    // @param _srcAddress - the source chain contract address\n    function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool);\n\n    // @notice query if the _libraryAddress is valid for sending msgs.\n    // @param _userApplication - the user app address on this EVM chain\n    function getSendLibraryAddress(address _userApplication) external view returns (address);\n\n    // @notice query if the _libraryAddress is valid for receiving msgs.\n    // @param _userApplication - the user app address on this EVM chain\n    function getReceiveLibraryAddress(address _userApplication) external view returns (address);\n\n    // @notice query if the non-reentrancy guard for send() is on\n    // @return true if the guard is on. false otherwise\n    function isSendingPayload() external view returns (bool);\n\n    // @notice query if the non-reentrancy guard for receive() is on\n    // @return true if the guard is on. false otherwise\n    function isReceivingPayload() external view returns (bool);\n\n    // @notice get the configuration of the LayerZero messaging library of the specified version\n    // @param _version - messaging library version\n    // @param _chainId - the chainId for the pending config change\n    // @param _userApplication - the contract address of the user application\n    // @param _configType - type of configuration. every messaging library has its own convention.\n    function getConfig(uint16 _version, uint16 _chainId, address _userApplication, uint _configType) external view returns (bytes memory);\n\n    // @notice get the send() LayerZero messaging library version\n    // @param _userApplication - the contract address of the user application\n    function getSendVersion(address _userApplication) external view returns (uint16);\n\n    // @notice get the lzReceive() LayerZero messaging library version\n    // @param _userApplication - the contract address of the user application\n    function getReceiveVersion(address _userApplication) external view returns (uint16);\n}\n"
      },
      "src/fundraising/contracts/fundraising/errors/cross-chain/LayerZeroErrors.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/**************************************\n\n    LayerZero errors\n    \n**************************************/\n\n/// @dev All errors used in LayerZero cross chain communication\nlibrary LayerZeroErrors {\n    // -----------------------------------------------------------------------\n    //                              Send\n    // -----------------------------------------------------------------------\n\n    error UnsupportedLayerZeroChain(uint256 chainId); // 0x9e90d5d0\n    error InvalidLayerZeroFee(); // 0x6142d241\n    error InvalidNativeSent(uint256 value, uint256 fee); // 0x7166d3ed\n\n    // -----------------------------------------------------------------------\n    //                              Receive\n    // -----------------------------------------------------------------------\n\n    error ChainNotSupported(uint16 chainId); // 0xec2a2f0f\n    error UntrustedRemote(bytes remote); // 0xd39d950e\n    error NonceExpired(uint16 chainId, uint256 nativeChainId, bytes srcAddress, uint64 nonce); // 0x286d7ff2\n    error UnsupportedFunction(uint256 chainId, bytes4 functionSelector); // 0x4f1e4a6d\n\n    // -----------------------------------------------------------------------\n    //                              Retry\n    // -----------------------------------------------------------------------\n\n    error MessageNotExists(uint16 srcChainId, bytes srcAddress, uint64 nonce); // 0x2e4f65fa\n    error InvalidPayload(bytes32 storedPayload, bytes32 sentPayload); // 0xca89b547\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/storage/cross-chain/LibCrossChainEvmConfiguration.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/// @notice Library containing cross-chain EVM configuration\nlibrary LibCrossChainEvmConfiguration {\n    // -----------------------------------------------------------------------\n    //                              Constants\n    // -----------------------------------------------------------------------\n\n    /// @dev Cross-chain EVM configuration storage pointer.\n    bytes32 internal constant CC_EVM_CONFIG_STORAGE_POSITION = keccak256(\"angelblock.cc.evm.config\");\n\n    // -----------------------------------------------------------------------\n    //                              Structs\n    // -----------------------------------------------------------------------\n\n    /// @dev Cross-chain EVM configuration storage struct.\n    /// @param fundraisings Mapping of native chain id to fundraising address on the given chain\n    /// @param supportedFunctions Mapping of native chain id to supported 4 byte signature of function\n    struct EvmConfigurationStorage {\n        mapping(uint256 => address) fundraisings;\n        mapping(uint256 => mapping(bytes4 => bool)) supportedFunctions;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Diamond storage\n    // -----------------------------------------------------------------------\n\n    /// @dev Function returning cross-chain evm configuration storage at storage pointer slot.\n    /// @return ecs EvmConfigurationStorage struct instance at storage pointer position\n    function evmConfigurationStorage() internal pure returns (EvmConfigurationStorage storage ecs) {\n        // declare position\n        bytes32 position = CC_EVM_CONFIG_STORAGE_POSITION;\n\n        // set slot to position\n        assembly {\n            ecs.slot := position\n        }\n\n        // explicit return\n        return ecs;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Getters\n    // -----------------------------------------------------------------------\n\n    /// @dev Diamond storage getter: Fundraising address.\n    /// @param _nativeChainId ID of the chain\n    /// @return Address of the fundraising\n    function getFundraising(uint256 _nativeChainId) internal view returns (address) {\n        // return\n        return evmConfigurationStorage().fundraisings[_nativeChainId];\n    }\n\n    /// @dev Diamond storage getter: Supported function.\n    /// @param _nativeChainId ID of the chain\n    /// @param _supportedFunctionSelector Selector of function\n    /// @return True if function is supported\n    function getSupportedFunction(uint256 _nativeChainId, bytes4 _supportedFunctionSelector) internal view returns (bool) {\n        // return\n        return evmConfigurationStorage().supportedFunctions[_nativeChainId][_supportedFunctionSelector];\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Setters\n    // -----------------------------------------------------------------------\n\n    /// @dev Diamond storage setter: Fundraising address.\n    /// @param _nativeChainId ID of the chain\n    /// @param _fundraising Address of the fundraising\n    function setFundraising(uint256 _nativeChainId, address _fundraising) internal {\n        // set fundraising\n        evmConfigurationStorage().fundraisings[_nativeChainId] = _fundraising;\n    }\n\n    /// @dev Diamond storage setter: Supported function.\n    /// @param _nativeChainId ID of the chain\n    /// @param _supportedFunctionSelector Selector of function\n    /// @param _isSupported Boolean if function is supported\n    function setSupportedFunction(uint256 _nativeChainId, bytes4 _supportedFunctionSelector, bool _isSupported) internal {\n        // set supported function\n        evmConfigurationStorage().supportedFunctions[_nativeChainId][_supportedFunctionSelector] = _isSupported;\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/storage/cross-chain/layer-zero/LibLayerZeroBase.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/// @notice Library containing investor funds info storage with getters and setters.\nlibrary LibLayerZeroBase {\n    // -----------------------------------------------------------------------\n    //                              Constants\n    // -----------------------------------------------------------------------\n\n    /// @dev LayerZero base storage pointer.\n    bytes32 internal constant CROSS_CHAIN_LAYER_ZERO_BASE_STORAGE_POSITION = keccak256(\"angelblock.cc.lz.base\");\n\n    // -----------------------------------------------------------------------\n    //                              Structs\n    // -----------------------------------------------------------------------\n\n    /// @dev LayerZero base storage struct.\n    /// @param crossChainEndpoint LayerZero endpoint address\n    struct LayerZeroBaseStorage {\n        address crossChainEndpoint;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Diamond storage\n    // -----------------------------------------------------------------------\n\n    /// @dev Function returning LayerZero base storage at storage pointer slot.\n    /// @return lzbs LayerZeroBaseStorage struct instance at storage pointer position\n    function layerZeroBaseStorage() internal pure returns (LayerZeroBaseStorage storage lzbs) {\n        // declare position\n        bytes32 position = CROSS_CHAIN_LAYER_ZERO_BASE_STORAGE_POSITION;\n\n        // set slot to position\n        assembly {\n            lzbs.slot := position\n        }\n\n        // explicit return\n        return lzbs;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Getters / setters\n    // -----------------------------------------------------------------------\n\n    /// @dev Diamond storage getter: LayerZero endpoint.\n    /// @return LayerZero endpoint address\n    function getCrossChainEndpoint() internal view returns (address) {\n        return layerZeroBaseStorage().crossChainEndpoint;\n    }\n\n    /// @dev Diamond storage setter: LayerZero endpoint.\n    /// @param _crossChainEndpoint LayerZero endpoint address\n    function setCrossChainEndpoint(address _crossChainEndpoint) internal {\n        layerZeroBaseStorage().crossChainEndpoint = _crossChainEndpoint;\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/storage/cross-chain/layer-zero/LibLayerZeroSender.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/// @notice Library containing necessary information for sending messages via LayerZero\nlibrary LibLayerZeroSender {\n    // -----------------------------------------------------------------------\n    //                              Storage pointer\n    // -----------------------------------------------------------------------\n\n    /// @dev Raise storage pointer.\n    bytes32 internal constant LZ_SENDER_STORAGE_POSITION = keccak256(\"angelblock.cc.lz.sender\");\n\n    // -----------------------------------------------------------------------\n    //                              Structs\n    // -----------------------------------------------------------------------\n\n    /// @dev LayerZero sender struct.\n    /// @param refundAddress Refund address\n    /// @param networks Mapping of native network id to LZ network id for supported networks\n    struct LayerZeroSenderStorage {\n        address refundAddress;\n        mapping(uint256 => uint16) networks;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Storage\n    // -----------------------------------------------------------------------\n\n    // diamond storage getter\n    function lzSenderStorage() internal pure returns (LayerZeroSenderStorage storage lzs) {\n        // declare position\n        bytes32 position = LZ_SENDER_STORAGE_POSITION;\n\n        // set slot to position\n        assembly {\n            lzs.slot := position\n        }\n\n        // explicit return\n        return lzs;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Getters / setters\n    // -----------------------------------------------------------------------\n\n    /// @dev Diamond storage getter: refund address.\n    /// @return Refund address\n    function getRefundAddress() internal view returns (address) {\n        // return\n        return lzSenderStorage().refundAddress;\n    }\n\n    /// @dev Diamond storage getter: network.\n    /// @param _nativeChainId Native chain id for given network\n    /// @return LayerZero network id\n    function getNetwork(uint256 _nativeChainId) internal view returns (uint16) {\n        // return\n        return lzSenderStorage().networks[_nativeChainId];\n    }\n\n    /// @dev Diamond storage setter: refund address.\n    /// @param _refundAddress New refund address for LayerZero calls\n    function setRefundAddress(address _refundAddress) internal {\n        lzSenderStorage().refundAddress = _refundAddress;\n    }\n\n    /// @dev Diamond storage setter: network.\n    /// @param _nativeChainId Native chain id\n    /// @param _layerZeroChainId Network chain id in LayerZero format\n    function setNetwork(uint256 _nativeChainId, uint16 _layerZeroChainId) internal {\n        lzSenderStorage().networks[_nativeChainId] = _layerZeroChainId;\n    }\n}\n"
      },
      "src/fundraising/node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/storage/ethereum/LibAppStorage.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// OpenZeppelin\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n// Local imports - Interfaces\nimport { IEquityBadge } from \"../../../../interfaces/IEquityBadge.sol\";\n\n/**************************************\n\n    AppStorage library\n\n    ------------------------------\n\n    A specialized version of Diamond Storage is AppStorage.\n    This pattern is used to more conveniently and easily share state variables between facets.\n\n **************************************/\n\n/// @notice AppStorage is a special type of diamond storage under slot 0.\n/// @dev AppStorage is the only diamond library (with storage) that can be imported in other diamond storages.\n/// @dev Used to mainly store addresses of contracts cross referenced across different modules.\nlibrary LibAppStorage {\n    // -----------------------------------------------------------------------\n    //                              Structs\n    // -----------------------------------------------------------------------\n\n    /// @dev App storage struct. Special type of diamond storage with no storage pointer.\n    /// @param usdt USDT token\n    /// @param equityBadge Equity badge\n    struct AppStorage {\n        bytes32 slot0; // free slot 0 that can be taken over\n        IEquityBadge equityBadge;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Diamond storage\n    // -----------------------------------------------------------------------\n\n    /// @dev Function returning app storage at 0 slot.\n    /// @return s AppStorage struct instance at 0 slot\n    function appStorage() internal pure returns (AppStorage storage s) {\n        // set slot 0 and return\n        assembly {\n            s.slot := 0\n        }\n\n        // explicit return\n        return s;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Getters\n    // -----------------------------------------------------------------------\n\n    /**************************************\n\n        Get badge\n\n     **************************************/\n\n    /// @dev Get equity badge.\n    /// @return Equity badge contract instance\n    function getBadge() internal view returns (IEquityBadge) {\n        // return\n        return appStorage().equityBadge;\n    }\n}\n"
      },
      "src/fundraising/contracts/interfaces/IEquityBadge.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\nimport { IERC1155Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol\";\n\n/**************************************\n\n    EquityBadge interface\n\n **************************************/\n\n/// @notice Equity badge interface\ninterface IEquityBadge is IERC1155Upgradeable {\n    // -----------------------------------------------------------------------\n    //                              Errors\n    // -----------------------------------------------------------------------\n\n    error BadgeTransferNotYetPossible(); // 0xab99d45e\n    error InvalidURI(uint256 badgeId); // 0x2e0740e9\n\n    // -----------------------------------------------------------------------\n    //                              Functions\n    // -----------------------------------------------------------------------\n\n    /// @dev Mint amount of ERC1155 badges to given user account.\n    /// @param _sender Address of badge recipient\n    /// @param _badgeId Number of badge (derived from project uuid)\n    /// @param _amount Quantity of badges to mint\n    /// @param _data Additional data for transfer hooks\n    function mint(address _sender, uint256 _badgeId, uint256 _amount, bytes memory _data) external;\n\n    /// @dev Set URI for badge id.\n    /// @param _badgeId Id of badge\n    /// @param _uri IPFS uri to JSON depicting badge\n    function setURI(uint256 _badgeId, string memory _uri) external;\n}\n"
      },
      "src/fundraising/contracts/fundraising/errors/MilestoneErrors.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/**************************************\n\n    Milestone errors\n\n**************************************/\n\n/// All errors connected with milestone.\nlibrary MilestoneErrors {\n    // -----------------------------------------------------------------------\n    //                              Unlock\n    // -----------------------------------------------------------------------\n\n    error InvalidMilestoneNumber(uint256 milestoneNo, uint256 milestoneCount); // 0x14dc2b26\n    error ZeroShare(uint256 milestoneNo); // 0xef647f82\n    error ShareExceedLimit(uint256 share, uint256 existing); // 0x17e013d5\n    error NotEnoughTokensOnEscrow(uint256 balance); // 0xe60fdbcf\n    error OtcMilestoneMustUnlockAllShares(); // 0x6f42ad6b\n\n    // -----------------------------------------------------------------------\n    //                              Claim\n    // -----------------------------------------------------------------------\n\n    error NoMilestoneUnlocked(string raiseId); // 0x335b87f2\n    error NoClaimingSchedule(string raiseId); // 0xcb6d4142\n    error TokenNotOnEscrow(string raiseId); // 0x35880bf8\n    error NothingToClaim(string raiseId, address account); // 0xf5709e8a\n\n    // -----------------------------------------------------------------------\n    //                              Failed repair plan\n    // -----------------------------------------------------------------------\n\n    error RaiseAlreadyRejected(string raiseId, uint256 rejected); // 0xcb1dc2af\n    error AllMilestonesUnlocked(string raiseId, uint256 unlocked); // 0x731a1b87\n\n    // -----------------------------------------------------------------------\n    //                              Claim (repair plan)\n    // -----------------------------------------------------------------------\n\n    error RaiseNotRejected(string raiseId); // 0x4e9e01f8\n\n    // -----------------------------------------------------------------------\n    //                      Submit claiming schedule\n    // -----------------------------------------------------------------------\n\n    error MilestoneNotExists(string milestoneId); // 0x269afc46\n    error ClaimingScheduleAlreadyExists(string claimingScheduleId); // 0xe8616ede\n    error UnlockedShareLimitExceeded(string milestoneId); // 0xf877f9b6\n    error SharesAlreadySubmitted(string milestoneId); // 0x8e7ee80d\n    error SubmittedSharesMustEqualMilestoneShare(string milestoneId, uint256 milestoneShare, uint256 submittedShares); // 0x2c64027e\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/storage/assets/LibEscrow.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/// @notice Library containing Escrow storage with getters and setters.\nlibrary LibEscrow {\n    // -----------------------------------------------------------------------\n    //                              Constants\n    // -----------------------------------------------------------------------\n\n    /// @dev Escrow storage pointer.\n    bytes32 internal constant ESCROW_STORAGE_POSITION = keccak256(\"angelblock.fundraising.escrow\");\n\n    // -----------------------------------------------------------------------\n    //                              Structs\n    // -----------------------------------------------------------------------\n\n    /// @dev Escrow diamond storage.\n    /// @param source Address of contract with source implementation for cloning Escrows.\n    /// @param escrows Mapping of raise id to cloned Escrow instance address.\n    struct EscrowStorage {\n        address source;\n        mapping(string => address) escrows;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Diamond storage\n    // -----------------------------------------------------------------------\n\n    /// @dev Function returning escrow storage at storage pointer slot.\n    /// @return es EscrowStorage struct instance at storage pointer position\n    function escrowStorage() internal pure returns (EscrowStorage storage es) {\n        // declare position\n        bytes32 position = ESCROW_STORAGE_POSITION;\n\n        // set slot to position\n        assembly {\n            es.slot := position\n        }\n\n        // explicit return\n        return es;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Getters / setters\n    // -----------------------------------------------------------------------\n\n    /// @dev Diamond storage getter: Escrow source address.\n    /// @return Escrow source address.\n    function getSource() internal view returns (address) {\n        return escrowStorage().source;\n    }\n\n    /// @dev Diamond storage getter: Escrow address.\n    /// @param _raiseId Id of the Raise.\n    /// @return Escrow address.\n    function getEscrow(string memory _raiseId) internal view returns (address) {\n        // get escrow address\n        return escrowStorage().escrows[_raiseId];\n    }\n\n    /// @dev Diamond storage setter: Escrow source.\n    /// @param _source Address of the source\n    function setSource(address _source) internal {\n        // set source address\n        escrowStorage().source = _source;\n    }\n\n    /// @dev Diamond storage setter: Escrow address for raise.\n    /// @param _raiseId Id of the Raise.\n    /// @param _escrow Address of the escrow\n    function setEscrow(string memory _raiseId, address _escrow) internal {\n        // set Escrow\n        escrowStorage().escrows[_raiseId] = _escrow;\n    }\n}\n"
      },
      "src/fundraising/node_modules/@openzeppelin/contracts/proxy/Clones.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary Clones {\n    /**\n     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n     *\n     * This function uses the create opcode, which should never revert.\n     */\n    function clone(address implementation) internal returns (address instance) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n            // of the `implementation` address with the bytecode before the address.\n            mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n            // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n            mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n            instance := create(0, 0x09, 0x37)\n        }\n        require(instance != address(0), \"ERC1167: create failed\");\n    }\n\n    /**\n     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n     *\n     * This function uses the create2 opcode and a `salt` to deterministically deploy\n     * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n     * the clones cannot be deployed twice at the same address.\n     */\n    function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n            // of the `implementation` address with the bytecode before the address.\n            mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n            // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n            mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n            instance := create2(0, 0x09, 0x37, salt)\n        }\n        require(instance != address(0), \"ERC1167: create2 failed\");\n    }\n\n    /**\n     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n     */\n    function predictDeterministicAddress(\n        address implementation,\n        bytes32 salt,\n        address deployer\n    ) internal pure returns (address predicted) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let ptr := mload(0x40)\n            mstore(add(ptr, 0x38), deployer)\n            mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n            mstore(add(ptr, 0x14), implementation)\n            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n            mstore(add(ptr, 0x58), salt)\n            mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n            predicted := keccak256(add(ptr, 0x43), 0x55)\n        }\n    }\n\n    /**\n     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n     */\n    function predictDeterministicAddress(address implementation, bytes32 salt)\n        internal\n        view\n        returns (address predicted)\n    {\n        return predictDeterministicAddress(implementation, salt, address(this));\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/events/EscrowEvents.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/**************************************\n\n    Escrow events\n    \n**************************************/\n\n/// @dev All events used in the Escrow functionalities\nlibrary EscrowEvents {\n    event EscrowCreated(string raiseId, address instance, address source);\n}\n"
      },
      "src/fundraising/contracts/fundraising/errors/EscrowErrors.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/**************************************\n\n    Escrow errors\n    \n**************************************/\n\n/// @dev All errors used in the Escrow functionalities\nlibrary EscrowErrors {\n    error SourceNotSet(); // 0x5646f850\n}\n"
      },
      "src/fundraising/contracts/utils/Configurable.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/// @notice This contract is an abstract configurable utility, that can be inherited in contracts needed 1-time setup.\nabstract contract Configurable {\n    // -----------------------------------------------------------------------\n    //                              Enums\n    // -----------------------------------------------------------------------\n\n    /// @dev State definition (before or after setup).\n    enum State {\n        UNCONFIGURED,\n        CONFIGURED\n    }\n\n    // -----------------------------------------------------------------------\n    //                              State variables\n    // -----------------------------------------------------------------------\n\n    /// @dev Storage of current state of contract.\n    State public state;\n\n    // -----------------------------------------------------------------------\n    //                              Events\n    // -----------------------------------------------------------------------\n\n    event Initialised(bytes args);\n    event Configured(bytes args);\n\n    // -----------------------------------------------------------------------\n    //                              Errors\n    // -----------------------------------------------------------------------\n\n    error InvalidState(State state, State expected);\n\n    // -----------------------------------------------------------------------\n    //                              Modifiers\n    // -----------------------------------------------------------------------\n\n    /// @dev Ensures contract is in correct state.\n    /// @param _state Current state of contract\n    modifier onlyInState(State _state) {\n        // check state\n        if (state != _state) {\n            revert InvalidState(state, _state);\n        }\n\n        // enter function\n        _;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              External functions\n    // -----------------------------------------------------------------------\n\n    /// @dev Function to implement in inheriting contract, that will use byte encoded args for setup.\n    /// @param _arguments Byte-encoded user-defined arguments\n    function configure(bytes calldata _arguments) external virtual;\n}\n"
      },
      "src/fundraising/node_modules/@openzeppelin/contracts/utils/cryptography/ECDSA.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n    enum RecoverError {\n        NoError,\n        InvalidSignature,\n        InvalidSignatureLength,\n        InvalidSignatureS,\n        InvalidSignatureV // Deprecated in v4.8\n    }\n\n    function _throwError(RecoverError error) private pure {\n        if (error == RecoverError.NoError) {\n            return; // no error: do nothing\n        } else if (error == RecoverError.InvalidSignature) {\n            revert(\"ECDSA: invalid signature\");\n        } else if (error == RecoverError.InvalidSignatureLength) {\n            revert(\"ECDSA: invalid signature length\");\n        } else if (error == RecoverError.InvalidSignatureS) {\n            revert(\"ECDSA: invalid signature 's' value\");\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature` or error string. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {toEthSignedMessageHash} on it.\n     *\n     * Documentation for signature generation:\n     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n        if (signature.length == 65) {\n            bytes32 r;\n            bytes32 s;\n            uint8 v;\n            // ecrecover takes the signature parameters, and the only way to get them\n            // currently is to use assembly.\n            /// @solidity memory-safe-assembly\n            assembly {\n                r := mload(add(signature, 0x20))\n                s := mload(add(signature, 0x40))\n                v := byte(0, mload(add(signature, 0x60)))\n            }\n            return tryRecover(hash, v, r, s);\n        } else {\n            return (address(0), RecoverError.InvalidSignatureLength);\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature`. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {toEthSignedMessageHash} on it.\n     */\n    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, signature);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n     *\n     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(\n        bytes32 hash,\n        bytes32 r,\n        bytes32 vs\n    ) internal pure returns (address, RecoverError) {\n        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n        uint8 v = uint8((uint256(vs) >> 255) + 27);\n        return tryRecover(hash, v, r, s);\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n     *\n     * _Available since v4.2._\n     */\n    function recover(\n        bytes32 hash,\n        bytes32 r,\n        bytes32 vs\n    ) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(\n        bytes32 hash,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal pure returns (address, RecoverError) {\n        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n        // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n        //\n        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n        // these malleable signatures as well.\n        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n            return (address(0), RecoverError.InvalidSignatureS);\n        }\n\n        // If the signature is valid (and not malleable), return the signer address\n        address signer = ecrecover(hash, v, r, s);\n        if (signer == address(0)) {\n            return (address(0), RecoverError.InvalidSignature);\n        }\n\n        return (signer, RecoverError.NoError);\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function recover(\n        bytes32 hash,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n     * produces hash corresponding to the one signed with the\n     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n     * JSON-RPC method as part of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n        // 32 is the length in bytes of hash,\n        // enforced by the type signature above\n        return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Message, created from `s`. This\n     * produces hash corresponding to the one signed with the\n     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n     * JSON-RPC method as part of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Typed Data, created from a\n     * `domainSeparator` and a `structHash`. This produces hash corresponding\n     * to the one signed with the\n     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n     * JSON-RPC method as part of EIP-712.\n     *\n     * See {recover}.\n     */\n    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n    }\n}\n"
      },
      "src/fundraising/contracts/fundraising/constants/SignatureConstants.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/// @notice Constants used in signature verification.\nlibrary SignatureConstants {\n    // -----------------------------------------------------------------------\n    //                              Constants\n    // -----------------------------------------------------------------------\n\n    /// @dev EIP-712 typehash\n    bytes32 internal constant EIP712_DOMAIN_TYPEHASH =\n        keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n}\n"
      },
      "src/fundraising/contracts/fundraising/errors/SignatureErrors.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/**************************************\n\n    Signature errors\n    \n**************************************/\n\n/// @dev All errors used in the signature verification\nlibrary SignatureErrors {\n    error IncorrectSigner(address signer); // 0x33ffff9b\n    error InvalidMessage(bytes32 verify, bytes32 message); // 0xeeba4d9c\n}\n"
      },
      "src/fundraising/contracts/fundraising/structs/AccessTypes.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n/// @notice Library containing role definition for access management.\nlibrary AccessTypes {\n    // -----------------------------------------------------------------------\n    //                              Constants\n    // -----------------------------------------------------------------------\n\n    /// @dev AngelBlock validator role\n    bytes32 internal constant SIGNER_ROLE = keccak256(\"IS SIGNER\");\n    /// @dev LayerZero receiver's admin role\n    bytes32 internal constant LZ_RECEIVER_ADMIN_ROLE = keccak256(\"LZ RECEIVER ADMIN\");\n}\n"
      },
      "src/fundraising/contracts/fundraising/libraries/storage/utils/LibAccessControl.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\n/**************************************\n\n    security-contact:\n    - security@angelblock.io\n\n    maintainers:\n    - marcin@angelblock.io\n    - piotr@angelblock.io\n    - mikolaj@angelblock.io\n    - sebastian@angelblock.io\n\n    contributors:\n    - domenico@angelblock.io\n\n**************************************/\n\n// OpenZeppelin imports\nimport { Strings } from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport { IAccessControl } from \"@openzeppelin/contracts/access/IAccessControl.sol\";\n\n/**************************************\n\n    AccessControl library\n\n    ------------------------------\n\n    Diamond storage containing access control data\n\n **************************************/\n\n/// @notice Fork of OpenZeppelin's AccessControl that fits as diamond proxy library.\nlibrary LibAccessControl {\n    // -----------------------------------------------------------------------\n    //                              Storage pointer\n    // -----------------------------------------------------------------------\n\n    /// @dev Access control storage pointer.\n    bytes32 internal constant ACCESS_CONTROL_STORAGE_POSITION = keccak256(\"angelblock.access.control\");\n\n    // -----------------------------------------------------------------------\n    //                              Constants\n    // -----------------------------------------------------------------------\n\n    /// @dev Default admin role\n    bytes32 internal constant ADMIN_ROLE = 0x00;\n\n    // -----------------------------------------------------------------------\n    //                                  Structs\n    // -----------------------------------------------------------------------\n\n    /// @dev Struct containing role settings.\n    /// @param members Mapping of addresses, that returns True if user is a member\n    /// @param adminRole Byte-encoded string of admin role for given role\n    struct RoleData {\n        mapping(address => bool) members;\n        bytes32 adminRole;\n    }\n\n    /// @dev Access control storage struct.\n    /// @param roles Mapping of byte-encoded strings of roles to RoleData struct\n    /// @param initialized Used to allow and keep track of admin to be created once\n    struct AccessControlStorage {\n        mapping(bytes32 => RoleData) roles;\n        bool initialized;\n    }\n\n    // -----------------------------------------------------------------------\n    //                                  Events\n    // -----------------------------------------------------------------------\n\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n    // -----------------------------------------------------------------------\n    //                                  Errors\n    // -----------------------------------------------------------------------\n\n    error CannotSetAdminForAdmin(); // 0x625dd4af\n    error CanOnlyRenounceSelf(); // 0x4b47a2fd\n\n    // -----------------------------------------------------------------------\n    //                                  Modifiers\n    // -----------------------------------------------------------------------\n\n    /// @dev Modifier that checks if caller has given role.\n    /// @dev Validation: Expect caller to be a member of role.\n    /// @param _role Expected role for sender to be a member of\n    modifier onlyRole(bytes32 _role) {\n        // check role\n        if (!hasRole(_role, msg.sender)) {\n            revert(\n                string(\n                    abi.encodePacked(\n                        \"AccessControl: account \",\n                        Strings.toHexString(msg.sender),\n                        \" is missing role \",\n                        Strings.toHexString(uint256(_role), 32)\n                    )\n                )\n            );\n        }\n        _;\n    }\n\n    // -----------------------------------------------------------------------\n    //                                  Diamond storage\n    // -----------------------------------------------------------------------\n\n    /// @dev Function returning access control storage at storage pointer slot.\n    /// @return acs AccessControlStorage struct instance at storage pointer position\n    function accessStorage() internal pure returns (AccessControlStorage storage acs) {\n        // declare position\n        bytes32 position = ACCESS_CONTROL_STORAGE_POSITION;\n\n        // set slot to position\n        assembly {\n            acs.slot := position\n        }\n\n        // explicit return\n        return acs;\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Getters / setters\n    // -----------------------------------------------------------------------\n\n    /// @dev Diamond storage getter: roles->hasRole(account).\n    /// @param _role Byte-encoded role\n    /// @param _account Address to check role\n    /// @return True if account is member of given role\n    function hasRole(bytes32 _role, address _account) internal view returns (bool) {\n        // return\n        return accessStorage().roles[_role].members[_account];\n    }\n\n    /// @dev Diamond storage setter: roles->setAdmin(account).\n    /// @param _account Address to become an admin\n    function createAdmin(address _account) internal {\n        // set role\n        accessStorage().roles[ADMIN_ROLE].members[_account] = true;\n    }\n\n    /// @dev Diamond storage getter: roles->getAdminRole(role).\n    /// @param _role Byte-encoded role\n    /// @return Admin role for given role\n    function getRoleAdmin(bytes32 _role) internal view returns (bytes32) {\n        // return\n        return accessStorage().roles[_role].adminRole;\n    }\n\n    /// @dev Diamond storage setter: roles->setAdminRole(role).\n    /// @dev Validation: Only main admin role can change admin role for given role.\n    /// @dev Validation: Admin role for default admin role cannot be changed.\n    /// @param _role Byte-encoded role to set admin role\n    /// @param _adminRole Byte-encoded admin role for given role\n    function setRoleAdmin(bytes32 _role, bytes32 _adminRole) internal onlyRole(ADMIN_ROLE) {\n        // accept each role except admin\n        if (_role != ADMIN_ROLE) accessStorage().roles[_role].adminRole = _adminRole;\n        else revert CannotSetAdminForAdmin();\n    }\n\n    // -----------------------------------------------------------------------\n    //                              Functions\n    // -----------------------------------------------------------------------\n\n    /**************************************\n\n        Grant role\n\n     **************************************/\n\n    /// @dev Grant role to an account.\n    /// @dev Validation: Can only be called by the admin of the role.\n    /// @dev Validation: Will not grant role if account already has a desired role.\n    /// @dev Events: RoleGranted(bytes32 role, address account, address sender).\n    /// @param _role Byte-encoded role\n    /// @param _account Address to receive a role\n    function grantRole(bytes32 _role, address _account) internal onlyRole(getRoleAdmin(_role)) {\n        // grant\n        _grantRole(_role, _account);\n    }\n\n    /**************************************\n\n        Revoke role\n\n     **************************************/\n\n    /// @dev Revoke role of account. Will not revoke role if account doesn't have it.\n    /// @dev Validation: Can only be called by the admin of the role.\n    /// @dev Events: RoleRevoked(bytes32 role, address account, address sender).\n    /// @param _role Byte-encoded role\n    /// @param _account Address of account that has role\n    function revokeRole(bytes32 _role, address _account) internal onlyRole(getRoleAdmin(_role)) {\n        // revoke\n        _revokeRole(_role, _account);\n    }\n\n    /**************************************\n\n        Renounce role\n\n     **************************************/\n\n    /// @dev Renounce role of account. Will not renounce role if account doesn't have it.\n    /// @dev Validation: Can only be called by the user that has role.\n    /// @dev Events: RoleRevoked(bytes32 role, address account, address sender).\n    /// @param _role Byte-encoded role\n    /// @param _account Address of account that has role\n    function renounceRole(bytes32 _role, address _account) internal {\n        // check sender\n        if (_account != msg.sender) {\n            revert CanOnlyRenounceSelf();\n        }\n\n        // revoke\n        _revokeRole(_role, _account);\n    }\n\n    /**************************************\n\n        Low level: grant\n\n     **************************************/\n\n    /// @dev Grant role to an account.\n    /// @dev Validation: Will not grant role if account already has a desired role.\n    /// @dev Events: RoleGranted(bytes32 role, address account, address sender).\n    /// @param _role Byte-encoded role\n    /// @param _account Address to receive a role\n    function _grantRole(bytes32 _role, address _account) private {\n        // check if not have role already\n        if (!hasRole(_role, _account)) {\n            // grant role\n            accessStorage().roles[_role].members[_account] = true;\n\n            // event\n            emit RoleGranted(_role, _account, msg.sender);\n        }\n    }\n\n    /**************************************\n\n        Low level: revoke\n\n     **************************************/\n\n    /// @dev Revoke role of an account. Will not revoke role if account doesn't have it.\n    /// @dev Events: RoleRevoked(bytes32 role, address account, address sender).\n    /// @param _role Byte-encoded role\n    /// @param _account Address of account that has role\n    function _revokeRole(bytes32 _role, address _account) private {\n        // check if have role\n        if (hasRole(_role, _account)) {\n            // revoke role\n            accessStorage().roles[_role].members[_account] = false;\n\n            // event\n            emit RoleRevoked(_role, _account, msg.sender);\n        }\n    }\n}\n"
      },
      "src/fundraising/node_modules/layer-zero/contracts/interfaces/ILayerZeroUserApplicationConfig.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.5.0;\n\ninterface ILayerZeroUserApplicationConfig {\n    // @notice set the configuration of the LayerZero messaging library of the specified version\n    // @param _version - messaging library version\n    // @param _chainId - the chainId for the pending config change\n    // @param _configType - type of configuration. every messaging library has its own convention.\n    // @param _config - configuration in the bytes. can encode arbitrary content.\n    function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external;\n\n    // @notice set the send() LayerZero messaging library version to _version\n    // @param _version - new messaging library version\n    function setSendVersion(uint16 _version) external;\n\n    // @notice set the lzReceive() LayerZero messaging library version to _version\n    // @param _version - new messaging library version\n    function setReceiveVersion(uint16 _version) external;\n\n    // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload\n    // @param _srcChainId - the chainId of the source chain\n    // @param _srcAddress - the contract address of the source contract at the source chain\n    function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external;\n}\n"
      },
      "src/fundraising/node_modules/@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155Upgradeable is IERC165Upgradeable {\n    /**\n     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n     */\n    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n    /**\n     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n     * transfers.\n     */\n    event TransferBatch(\n        address indexed operator,\n        address indexed from,\n        address indexed to,\n        uint256[] ids,\n        uint256[] values\n    );\n\n    /**\n     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n     * `approved`.\n     */\n    event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n    /**\n     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n     *\n     * If an {URI} event was emitted for `id`, the standard\n     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n     * returned by {IERC1155MetadataURI-uri}.\n     */\n    event URI(string value, uint256 indexed id);\n\n    /**\n     * @dev Returns the amount of tokens of token type `id` owned by `account`.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     */\n    function balanceOf(address account, uint256 id) external view returns (uint256);\n\n    /**\n     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n     *\n     * Requirements:\n     *\n     * - `accounts` and `ids` must have the same length.\n     */\n    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n        external\n        view\n        returns (uint256[] memory);\n\n    /**\n     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n     *\n     * Emits an {ApprovalForAll} event.\n     *\n     * Requirements:\n     *\n     * - `operator` cannot be the caller.\n     */\n    function setApprovalForAll(address operator, bool approved) external;\n\n    /**\n     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n     *\n     * See {setApprovalForAll}.\n     */\n    function isApprovedForAll(address account, address operator) external view returns (bool);\n\n    /**\n     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n     *\n     * Emits a {TransferSingle} event.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n     * - `from` must have a balance of tokens of type `id` of at least `amount`.\n     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n     * acceptance magic value.\n     */\n    function safeTransferFrom(\n        address from,\n        address to,\n        uint256 id,\n        uint256 amount,\n        bytes calldata data\n    ) external;\n\n    /**\n     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n     *\n     * Emits a {TransferBatch} event.\n     *\n     * Requirements:\n     *\n     * - `ids` and `amounts` must have the same length.\n     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n     * acceptance magic value.\n     */\n    function safeBatchTransferFrom(\n        address from,\n        address to,\n        uint256[] calldata ids,\n        uint256[] calldata amounts,\n        bytes calldata data\n    ) external;\n}\n"
      },
      "src/fundraising/node_modules/@openzeppelin/contracts/utils/Strings.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n    uint8 private constant _ADDRESS_LENGTH = 20;\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            uint256 length = Math.log10(value) + 1;\n            string memory buffer = new string(length);\n            uint256 ptr;\n            /// @solidity memory-safe-assembly\n            assembly {\n                ptr := add(buffer, add(32, length))\n            }\n            while (true) {\n                ptr--;\n                /// @solidity memory-safe-assembly\n                assembly {\n                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n                }\n                value /= 10;\n                if (value == 0) break;\n            }\n            return buffer;\n        }\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            return toHexString(value, Math.log256(value) + 1);\n        }\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        bytes memory buffer = new bytes(2 * length + 2);\n        buffer[0] = \"0\";\n        buffer[1] = \"x\";\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\n            buffer[i] = _SYMBOLS[value & 0xf];\n            value >>= 4;\n        }\n        require(value == 0, \"Strings: hex length insufficient\");\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n     */\n    function toHexString(address addr) internal pure returns (string memory) {\n        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n    }\n}\n"
      },
      "src/fundraising/node_modules/@openzeppelin/contracts/access/IAccessControl.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n    /**\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n     *\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n     * {RoleAdminChanged} not being emitted signaling this.\n     *\n     * _Available since v3.1._\n     */\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n    /**\n     * @dev Emitted when `account` is granted `role`.\n     *\n     * `sender` is the account that originated the contract call, an admin role\n     * bearer except when using {AccessControl-_setupRole}.\n     */\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Emitted when `account` is revoked `role`.\n     *\n     * `sender` is the account that originated the contract call:\n     *   - if using `revokeRole`, it is the admin role bearer\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\n     */\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) external view returns (bool);\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function grantRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function revokeRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `account`.\n     */\n    function renounceRole(bytes32 role, address account) external;\n}\n"
      },
      "src/fundraising/node_modules/@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
      },
      "src/fundraising/node_modules/@openzeppelin/contracts/utils/math/Math.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    enum Rounding {\n        Down, // Toward negative infinity\n        Up, // Toward infinity\n        Zero // Toward zero\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds up instead\n     * of rounding down.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b - 1) / b can overflow on addition, so we distribute.\n        return a == 0 ? 0 : (a - 1) / b + 1;\n    }\n\n    /**\n     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n     * with further edits by Uniswap Labs also under MIT license.\n     */\n    function mulDiv(\n        uint256 x,\n        uint256 y,\n        uint256 denominator\n    ) internal pure returns (uint256 result) {\n        unchecked {\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n            // variables such that product = prod1 * 2^256 + prod0.\n            uint256 prod0; // Least significant 256 bits of the product\n            uint256 prod1; // Most significant 256 bits of the product\n            assembly {\n                let mm := mulmod(x, y, not(0))\n                prod0 := mul(x, y)\n                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n            }\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (prod1 == 0) {\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            require(denominator > prod1);\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [prod1 prod0].\n            uint256 remainder;\n            assembly {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                prod1 := sub(prod1, gt(remainder, prod0))\n                prod0 := sub(prod0, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n            // See https://cs.stackexchange.com/q/138556/92363.\n\n            // Does not overflow because the denominator cannot be zero at this stage in the function.\n            uint256 twos = denominator & (~denominator + 1);\n            assembly {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [prod1 prod0] by twos.\n                prod0 := div(prod0, twos)\n\n                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from prod1 into prod0.\n            prod0 |= prod1 * twos;\n\n            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv = 1 mod 2^4.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n            // in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2^8\n            inverse *= 2 - denominator * inverse; // inverse mod 2^16\n            inverse *= 2 - denominator * inverse; // inverse mod 2^32\n            inverse *= 2 - denominator * inverse; // inverse mod 2^64\n            inverse *= 2 - denominator * inverse; // inverse mod 2^128\n            inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n            // is no longer required.\n            result = prod0 * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(\n        uint256 x,\n        uint256 y,\n        uint256 denominator,\n        Rounding rounding\n    ) internal pure returns (uint256) {\n        uint256 result = mulDiv(x, y, denominator);\n        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n            result += 1;\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n     *\n     * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        if (a == 0) {\n            return 0;\n        }\n\n        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n        //\n        // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n        //\n        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n        //\n        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n        uint256 result = 1 << (log2(a) >> 1);\n\n        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n        // into the expected uint128 result.\n        unchecked {\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            return min(result, a / result);\n        }\n    }\n\n    /**\n     * @notice Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 128;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 64;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 32;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 16;\n            }\n            if (value >> 8 > 0) {\n                value >>= 8;\n                result += 8;\n            }\n            if (value >> 4 > 0) {\n                value >>= 4;\n                result += 4;\n            }\n            if (value >> 2 > 0) {\n                value >>= 2;\n                result += 2;\n            }\n            if (value >> 1 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10**64) {\n                value /= 10**64;\n                result += 64;\n            }\n            if (value >= 10**32) {\n                value /= 10**32;\n                result += 32;\n            }\n            if (value >= 10**16) {\n                value /= 10**16;\n                result += 16;\n            }\n            if (value >= 10**8) {\n                value /= 10**8;\n                result += 8;\n            }\n            if (value >= 10**4) {\n                value /= 10**4;\n                result += 4;\n            }\n            if (value >= 10**2) {\n                value /= 10**2;\n                result += 2;\n            }\n            if (value >= 10**1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 16;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 8;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 4;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 2;\n            }\n            if (value >> 8 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n        }\n    }\n}\n"
      }
    },
    "settings": {
      "remappings": [
        "@openzeppelin/=src/fundraising/node_modules/@openzeppelin/",
        "ds-test/=src/fundraising/node_modules/ds-test/src/",
        "forge-std/=src/fundraising/node_modules/forge-std/src/",
        "layer-zero/=src/fundraising/node_modules/layer-zero/",
        "murky/=src/fundraising/node_modules/murky/",
        "stringutils/=node_modules/stringutils/src/",
        "permit2/=node_modules/permit2/src/",
        "base58-solidity/=src/fundraising/node_modules/base58-solidity/",
        "ethereum-xcm-v3/=src/fundraising/node_modules/ethereum-xcm-v3/",
        "hardhat/=src/fundraising/node_modules/hardhat/",
        "openzeppelin-contracts/=src/fundraising/node_modules/murky/lib/openzeppelin-contracts/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200,
        "details": {
          "yul": false
        }
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "ipfs",
        "appendCBOR": true
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "abi"
          ]
        }
      },
      "evmVersion": "paris",
      "viaIR": true,
      "libraries": {}
    }
  }}