creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts/access/Ownable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    constructor () {\n        address msgSender = _msgSender();\n        _owner = msgSender;\n        emit OwnershipTransferred(address(0), msgSender);\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n        _;\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions anymore. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby removing any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        emit OwnershipTransferred(_owner, address(0));\n        _owner = address(0);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        emit OwnershipTransferred(_owner, newOwner);\n        _owner = newOwner;\n    }\n}\n"
      },
      "@openzeppelin/contracts/security/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    uint256 private _status;\n\n    constructor () {\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and make it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        // On the first call to nonReentrant, _notEntered will be true\n        require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        _status = _ENTERED;\n\n        _;\n\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = _NOT_ENTERED;\n    }\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\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 Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `recipient`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address recipient, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `sender` to `recipient` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.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(IERC20 token, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n    }\n\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n    }\n\n    /**\n     * @dev Deprecated. This function has issues similar to the ones found in\n     * {IERC20-approve}, and its usage is discouraged.\n     *\n     * Whenever possible, use {safeIncreaseAllowance} and\n     * {safeDecreaseAllowance} instead.\n     */\n    function safeApprove(IERC20 token, address spender, uint256 value) internal {\n        // safeApprove should only be called when setting an initial allowance,\n        // or when resetting it to zero. To increase and decrease it, use\n        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n        // solhint-disable-next-line max-line-length\n        require((value == 0) || (token.allowance(address(this), spender) == 0),\n            \"SafeERC20: approve from non-zero to non-zero allowance\"\n        );\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n    }\n\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) 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(IERC20 token, address spender, uint256 value) 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    /**\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) { // Return data is optional\n            // solhint-disable-next-line max-line-length\n            require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\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    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize, which returns 0 for contracts in\n        // construction, since the code is only stored at the end of the\n        // constructor execution.\n\n        uint256 size;\n        // solhint-disable-next-line no-inline-assembly\n        assembly { size := extcodesize(account) }\n        return size > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n        (bool success, ) = recipient.call{ value: amount }(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain`call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n      return functionCall(target, data, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        require(isContract(target), \"Address: call to non-contract\");\n\n        // solhint-disable-next-line avoid-low-level-calls\n        (bool success, bytes memory returndata) = target.call{ value: value }(data);\n        return _verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n        require(isContract(target), \"Address: static call to non-contract\");\n\n        // solhint-disable-next-line avoid-low-level-calls\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return _verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\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(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n        require(isContract(target), \"Address: delegate call to non-contract\");\n\n        // solhint-disable-next-line avoid-low-level-calls\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return _verifyCallResult(success, returndata, errorMessage);\n    }\n\n    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            // Look for revert reason and bubble it up if present\n            if (returndata.length > 0) {\n                // The easiest way to bubble the revert reason is using memory via assembly\n\n                // solhint-disable-next-line no-inline-assembly\n                assembly {\n                    let returndata_size := mload(returndata)\n                    revert(add(32, returndata), returndata_size)\n                }\n            } else {\n                revert(errorMessage);\n            }\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n        return msg.data;\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712 {\n    /* solhint-disable var-name-mixedcase */\n    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n    // invalidate the cached domain separator if the chain id changes.\n    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\n    uint256 private immutable _CACHED_CHAIN_ID;\n\n    bytes32 private immutable _HASHED_NAME;\n    bytes32 private immutable _HASHED_VERSION;\n    bytes32 private immutable _TYPE_HASH;\n    /* solhint-enable var-name-mixedcase */\n\n    /**\n     * @dev Initializes the domain separator and parameter caches.\n     *\n     * The meaning of `name` and `version` is specified in\n     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n     *\n     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n     * - `version`: the current major version of the signing domain.\n     *\n     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n     * contract upgrade].\n     */\n    constructor(string memory name, string memory version) {\n        bytes32 hashedName = keccak256(bytes(name));\n        bytes32 hashedVersion = keccak256(bytes(version));\n        bytes32 typeHash = keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n        _HASHED_NAME = hashedName;\n        _HASHED_VERSION = hashedVersion;\n        _CACHED_CHAIN_ID = block.chainid;\n        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n        _TYPE_HASH = typeHash;\n    }\n\n    /**\n     * @dev Returns the domain separator for the current chain.\n     */\n    function _domainSeparatorV4() internal view returns (bytes32) {\n        if (block.chainid == _CACHED_CHAIN_ID) {\n            return _CACHED_DOMAIN_SEPARATOR;\n        } else {\n            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n        }\n    }\n\n    function _buildDomainSeparator(bytes32 typeHash, bytes32 name, bytes32 version) private view returns (bytes32) {\n        return keccak256(\n            abi.encode(\n                typeHash,\n                name,\n                version,\n                block.chainid,\n                address(this)\n            )\n        );\n    }\n\n    /**\n     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n     * function returns the hash of the fully encoded EIP712 message for this domain.\n     *\n     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n     *\n     * ```solidity\n     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n     *     keccak256(\"Mail(address to,string contents)\"),\n     *     mailTo,\n     *     keccak256(bytes(mailContents))\n     * )));\n     * address signer = ECDSA.recover(digest, signature);\n     * ```\n     */\n    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\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    /**\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        // Divide the signature in r, s and v variables\n        bytes32 r;\n        bytes32 s;\n        uint8 v;\n\n        // Check the signature length\n        // - case 65: r,s,v signature (standard)\n        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n        if (signature.length == 65) {\n            // ecrecover takes the signature parameters, and the only way to get them\n            // currently is to use assembly.\n            // solhint-disable-next-line no-inline-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        } else if (signature.length == 64) {\n            // ecrecover takes the signature parameters, and the only way to get them\n            // currently is to use assembly.\n            // solhint-disable-next-line no-inline-assembly\n            assembly {\n                let vs := mload(add(signature, 0x40))\n                r := mload(add(signature, 0x20))\n                s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\n                v := add(shr(255, vs), 27)\n            }\n        } else {\n            revert(\"ECDSA: invalid signature length\");\n        }\n\n        return recover(hash, v, r, s);\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\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 (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): 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        require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, \"ECDSA: invalid signature 's' value\");\n        require(v == 27 || v == 28, \"ECDSA: invalid signature 'v' value\");\n\n        // If the signature is valid (and not malleable), return the signer address\n        address signer = ecrecover(hash, v, r, s);\n        require(signer != address(0), \"ECDSA: invalid signature\");\n\n        return signer;\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 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"
      },
      "contracts/common/cctp/ICCTPTokenMessenger.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\n pragma solidity ^0.8.24;\n\ninterface ICCTPTokenMessenger {\n    function depositForBurn(\n        uint256 amount,\n        uint32 destinationDomain,\n        bytes32 mintRecipient,\n        address burnToken\n    ) external returns (uint64 nonce);\n\n    function depositForBurnWithCaller(\n        uint256 amount,\n        uint32 destinationDomain,\n        bytes32 mintRecipient,\n        address burnToken,\n        bytes32 destinationCaller\n    ) external returns (uint64 nonce);\n\n    function replaceDepositForBurn(\n        bytes calldata originalMessage,\n        bytes calldata originalAttestation,\n        bytes32 newDestinationCaller,\n        bytes32 newMintRecipient\n    ) external;\n\n    function handleReceiveMessage(\n        uint32 remoteDomain,\n        bytes32 sender,\n        bytes calldata messageBody\n    ) external returns (bool);\n\n    function addRemoteTokenMessenger(uint32 domain, bytes32 tokenMessenger) external;\n\n    function removeRemoteTokenMessenger(uint32 domain) external;\n\n    function addLocalMinter(address newLocalMinter) external;\n\n    function removeLocalMinter() external;\n\n    function localMessageTransmitter() external view returns (address);\n\n    function messageBodyVersion() external view returns (uint32);\n\n    function localMinter() external view returns (address);\n\n    function remoteTokenMessengers(uint32 domain) external view returns (bytes32);\n}\n"
      },
      "contracts/common/IWETH.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IWETH {\n    function deposit() external payable;\n    function transfer(address to, uint value) external returns (bool);\n    function withdraw(uint) external;\n    function approve(address guy, uint wad) external returns (bool);\n\n}"
      },
      "contracts/common/SafeAmount.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n// import \"@openzeppelin//contracts/token/ERC20/IERC20.sol\";\n\nlibrary SafeAmount {\n    using SafeERC20 for IERC20;\n\n    /**\n     @notice transfer tokens from. Incorporate fee on transfer tokens\n     @param token The token\n     @param from From address\n     @param to To address\n     @param amount The amount\n     @return result The actual amount transferred\n     */\n    function safeTransferFrom(\n        address token,\n        address from,\n        address to,\n        uint256 amount) internal returns (uint256 result) {\n        uint256 preBalance = IERC20(token).balanceOf(to);\n        IERC20(token).safeTransferFrom(from, to, amount);\n        uint256 postBalance = IERC20(token).balanceOf(to);\n        result = postBalance - preBalance;\n        require(result <= amount, \"SA: actual amount larger than transfer amount\");\n    }\n\n    /**\n     @notice Sends ETH\n     @param to The to address\n     @param value The amount\n     */\n\tfunction safeTransferETH(address to, uint256 value) internal {\n        (bool success, ) = to.call{value: value}(new bytes(0));\n        require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');\n    }\n}"
      },
      "contracts/common/signature/SigCheckable.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\n/**\n @dev Make sure to define method signatures\n */\nabstract contract SigCheckable is EIP712 {\n\n    function signerUnique(\n        bytes32 message,\n        bytes memory signature) internal view returns (address _signer) {\n        bytes32 digest;\n        (digest, _signer) = signer(message, signature);\n    }\n\n    /*\n        @dev example message;\n\n        bytes32 constant METHOD_SIG =\n            keccak256(\"WithdrawSigned(address token,address payee,uint256 amount,bytes32 salt)\");\n        bytes32 message = keccak256(abi.encode(\n          METHOD_SIG,\n          token,\n          payee,\n          amount,\n          salt\n    */\n    function signer(\n        bytes32 message,\n        bytes memory signature) internal view returns (bytes32 digest, address _signer) {\n        digest = _hashTypedDataV4(message);\n        _signer = ECDSA.recover(digest, signature);\n    }\n}"
      },
      "contracts/common/tokenReceiveable.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\n/**\n * @notice Library for handling safe token transactions including fee per transaction tokens.\n */\nabstract contract TokenReceivable is ReentrancyGuard {\n  using SafeERC20 for IERC20;\n  mapping(address => uint256) public inventory; // Amount of received tokens that are accounted for\n\n  /**\n   @notice Sync the inventory of a token based on amount changed\n   @param token The token address\n   @return amount The changed amount\n   */\n  function sync(address token) internal nonReentrant returns (uint256 amount) {\n    uint256 inv = inventory[token];\n    uint256 balance = IERC20(token).balanceOf(address(this));\n    amount = balance - inv;\n    inventory[token] = balance;\n  }\n\n  /**\n   @notice Safely sends a token out and updates the inventory\n   @param token The token address\n   @param payee The payee\n   @param amount The amount\n   */\n  function sendToken(address token, address payee, uint256 amount) internal nonReentrant {\n    inventory[token] = inventory[token] - amount;\n    IERC20(token).safeTransfer(payee, amount);\n  }\n}"
      },
      "contracts/common/WithAdmin.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract WithAdmin is Ownable {\n\taddress public admin;\n\tevent AdminSet(address admin);\n\n\tfunction setAdmin(address _admin) external onlyOwner {\n\t\tadmin = _admin;\n\t\temit AdminSet(_admin);\n\t}\n\n\tmodifier onlyAdmin() {\n\t\trequire(msg.sender == admin || msg.sender == owner(), \"WA: not admin\");\n\t\t_;\n\t}\n}"
      },
      "contracts/multiswap-contracts/CCTPFundManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport \"../common/signature/SigCheckable.sol\";\nimport \"../common/WithAdmin.sol\";\nimport \"../common/SafeAmount.sol\";\nimport \"../common/cctp/ICCTPTokenMessenger.sol\";\n\ncontract CCTPFundManager is SigCheckable, WithAdmin {\n    using SafeERC20 for IERC20;\n    address public usdcToken;\n    address public cctpTokenMessenger;\n    address public fiberRouter;\n    uint32 constant WEEK = 3600 * 24 * 7;\n    string public constant NAME = \"FUND_MANAGER\";\n    string public constant VERSION = \"000.004\";\n    mapping(address => bool) public signers;\n    mapping(bytes32 => bool) public usedSalt;\n    mapping(uint256 => TargetNetwork) public targetNetworks;\n\n    bytes32 constant WITHDRAW_SIGNED_METHOD =\n        keccak256(\n            \"WithdrawSigned(address token,address payee,uint256 amount,bytes32 salt,uint256 expiry)\"\n        );\n    bytes32 constant WITHDRAW_SIGNED_WITH_SWAP_METHOD =\n        keccak256(\n            \"withdrawSignedAndSwapRouter(address to,uint256 amountIn,uint256 minAmountOut,address foundryToken,address targetToken,address router,bytes32 salt,uint256 expiry)\"\n        );\n\n    struct TargetNetwork {\n        uint32 targetNetworkDomain;\n        address targetCCTPFundManager;\n    }\n\n    event TransferBySignature(\n        address signer,\n        address receiver,\n        address token,\n        uint256 amount\n    );\n\n    /**\n     * @dev Modifier that allows only the designated fiberRouter to execute the function.\n     * It checks if the sender is equal to the `fiberRouter` address.\n     * @notice Ensure that `fiberRouter` is set before using this modifier.\n     */\n    modifier onlyRouter() {\n        require(msg.sender == fiberRouter, \"FM: Only fiberRouter method\");\n        _;\n    }\n\n    /**\n     * @dev Contract constructor that initializes the EIP-712 domain with the specified NAME, VERSION.\n     * @notice This constructor is called only once during the deployment of the contract.\n     */\n    constructor() EIP712(NAME, VERSION) {\n        // bytes memory initData = IFerrumDeployer(msg.sender).initData();\n    }\n\n    /**\n     @dev sets the fiberRouter\n     @param _fiberRouter is the FiberRouter address\n     */\n    function setRouter(address _fiberRouter) external onlyOwner {\n        require(_fiberRouter != address(0), \"FM: fiberRouter requried\");\n        fiberRouter = _fiberRouter;\n    }\n\n    /**\n     @dev sets the signer\n     @param _signer is the address that generate signatures\n     */\n    function addSigner(address _signer) public onlyOwner {\n        require(_signer != address(0), \"Bad signer\");\n        signers[_signer] = true;\n    }\n\n    /**\n     @dev removes the signer\n     @param _signer is the address that generate signatures\n     */\n    function removeSigner(address _signer) external onlyOwner {\n        require(_signer != address(0), \"Bad signer\");\n        delete signers[_signer];\n    }\n\n    /**\n     * @notice Initializes the Cross-Chain Transfer Protocol (CCTP) parameters.\n     * @dev This function should be called by the contract owner to set the necessary parameters for CCTP.\n     * @param _cctpTokenMessenger The address of the CCTP Token Messenger contract.\n     * @param _usdcToken The address of the USDC token contract.\n     **/\n    function initCCTP(\n        address _cctpTokenMessenger,\n        address _usdcToken\n    ) external onlyOwner {\n        require(_cctpTokenMessenger != address(0), \"FR: Invalid CCTP Token Messenger address\");\n        require(_usdcToken != address(0), \"FR: Invalid USDC Token address\");\n\n        cctpTokenMessenger = _cctpTokenMessenger;\n        usdcToken = _usdcToken;\n    }\n\n    /**\n     * @notice Add a new target CCTP network.\n     * @param _chainID The target network chain ID\n     * @param _targetNetworkDomain The domain of the target network.\n     * @param _targetCCTPFundManager The fund manager address for the target network.\n     */\n    function setTargetCCTPNetwork(uint256 _chainID, uint32 _targetNetworkDomain, address _targetCCTPFundManager) external onlyOwner {\n        require(_targetNetworkDomain != 0, \"FR: Invalid Target Network Domain\");\n        require(_chainID != 0, \"FR: Invalid Target Network ChainID\");\n        require(_targetCCTPFundManager != address(0), \"FR: Invalid Target CCTP Fund Manager address\");\n\n        targetNetworks[_chainID] = TargetNetwork(_targetNetworkDomain, _targetCCTPFundManager);\n    }\n\n    /**\n     * @dev Initiates a signed token withdrawal, exclusive to the router\n     * @notice Ensure valid parameters and router setup\n     * @param token The token to withdraw\n     * @param payee Address for where to send the tokens to\n     * @param amount The amount\n     * @param salt The salt for unique tx\n     * @param expiry The expiration time for the signature\n     * @param signature The multisig validator signature\n     * @return The actual amount of tokens withdrawn\n     */\n    function withdrawSigned(\n        address token,\n        address payee,\n        uint256 amount,\n        bytes32 salt,\n        uint256 expiry,\n        bytes memory signature\n    ) external onlyRouter returns (uint256) {\n        require(token != address(0), \"FM: bad token\");\n        require(payee != address(0), \"FM: bad payee\");\n        require(salt != 0, \"FM: bad salt\");\n        require(amount != 0, \"FM: bad amount\");\n        require(block.timestamp < expiry, \"FM: signature timed out\");\n        require(expiry < block.timestamp + WEEK, \"FM: expiry too far\");\n        bytes32 message =  keccak256(\n                abi.encode(WITHDRAW_SIGNED_METHOD, token, payee, amount, salt, expiry)\n            );\n        address _signer = signerUnique(message, signature);\n\n        require(signers[_signer], \"FM: Invalid signer\");\n        require(!usedSalt[salt], \"FM: salt already used\");\n        usedSalt[salt] = true;\n        // transfer the tokens to the receiver\n        IERC20(token).safeTransfer(payee, amount);\n        emit TransferBySignature(_signer, payee, token, amount);\n        return amount;\n    }\n\n    /**\n     * @dev Initiates a signed token withdrawal with swap, exclusive to the router\n     * @notice Ensure valid parameters and router setup\n     * @param to The address to withdraw to\n     * @param amountIn The amount to be swapped in\n     * @param minAmountOut The minimum amount out from the swap\n     * @param foundryToken The token used in the Foundry\n     * @param targetToken The target token for the swap\n     * @param router The router address\n     * @param salt The salt value for the signature\n     * @param expiry The expiration time for the signature\n     * @param signature The multi-signature data\n     * @return The actual amount of tokens withdrawn from Foundry\n     */\n    function withdrawSignedAndSwapRouter(\n        address to,\n        uint256 amountIn,\n        uint256 minAmountOut,\n        address foundryToken,\n        address targetToken,\n        address router,\n        bytes32 salt,\n        uint256 expiry,\n        bytes memory signature\n    ) external onlyRouter returns (uint256) {\n        require(targetToken != address(0), \"FM: bad token\");\n        require(foundryToken != address(0), \"FM: bad token\");\n        require(to != address(0), \"FM: bad payee\");\n        require(salt != 0, \"FM: bad salt\");\n        require(amountIn != 0, \"FM: bad amount\");\n        require(minAmountOut != 0, \"FM: bad amount\");\n        require(block.timestamp < expiry, \"FM: signature timed out\");\n        require(expiry < block.timestamp + WEEK, \"FM: expiry too far\");\n\n        bytes32 message =  keccak256(\n                abi.encode(\n                    WITHDRAW_SIGNED_WITH_SWAP_METHOD,\n                    to,\n                    amountIn,\n                    minAmountOut,\n                    foundryToken,\n                    targetToken,\n                    router,\n                    salt,\n                    expiry\n                )\n            );\n        address _signer = signerUnique(message, signature);\n        require(signers[_signer], \"FM: Invalid signer\");\n        require(!usedSalt[salt], \"FM: salt already used\");\n        usedSalt[salt] = true;\n         // transfer the tokens to the receiver\n        IERC20(foundryToken).safeTransfer(msg.sender, amountIn);\n        emit TransferBySignature(_signer, msg.sender, foundryToken, amountIn);\n        return amountIn;\n    }\n\n    /**\n     * @dev Verifies details of a signed token withdrawal without executing the withdrawal\n     * @param token Token address for withdrawal\n     * @param payee Intended recipient address\n     * @param amount Amount of tokens to be withdrawn\n     * @param salt Unique identifier to prevent replay attacks\n     * @param expiry Expiration timestamp of the withdrawal signature\n     * @param signature Cryptographic signature for verification\n     * @return Digest and signer's address from the provided signature\n     */\n    function withdrawSignedVerify(\n        address token,\n        address payee,\n        uint256 amount,\n        bytes32 salt,\n        uint256 expiry,\n        bytes calldata signature\n    ) external view returns (bytes32, address) {\n        bytes32 message = keccak256(\n                abi.encode(WITHDRAW_SIGNED_METHOD, token, payee, amount, salt, expiry)\n            );\n        (bytes32 digest, address _signer) = signer(message, signature);\n        return (digest, _signer);\n    }\n\n    /**\n     * @dev Verifies details of a signed token swap withdrawal without execution\n     * @param to Recipient address on the target network\n     * @param amountIn Tokens withdrawn from Foundry\n     * @param minAmountOut The minimum tokens on the target network\n     * @param foundryToken Token withdrawn from Foundry\n     * @param targetToken Token on the target network\n     * @param router The router address\n     * @param salt Unique identifier to prevent replay attacks\n     * @param expiry Expiration timestamp of the withdrawal signature\n     * @param signature Cryptographic signature for verification\n     * @return Digest and signer's address from the provided signature\n     */\n    function withdrawSignedAndSwapRouterVerify(\n        address to,\n        uint256 amountIn,\n        uint256 minAmountOut,\n        address foundryToken,\n        address targetToken,\n        address router,\n        bytes32 salt,\n        uint256 expiry,\n        bytes calldata signature\n    ) external view returns (bytes32, address) {\n        bytes32 message =  keccak256(\n                abi.encode(\n                    WITHDRAW_SIGNED_WITH_SWAP_METHOD,\n                    to,\n                    amountIn,\n                    minAmountOut,\n                    foundryToken,\n                    targetToken,\n                    router,\n                    salt,\n                    expiry\n                )\n            );\n        (bytes32 digest, address _signer) = signer(message, signature);\n        return (digest, _signer);\n    }\n\n    /**\n     * @notice Initiates a Cross-Chain Transfer Protocol (CCTP) swap.\n     * @dev This function handles the process of approving tokens and initiating a cross-chain token burn and deposit.\n     * @param amountIn The amount of tokens to be swapped.\n     * @param token The address of the token to be swapped (must be USDC).\n     * @param targetNetwork The identifier of the target network for the swap.\n     * @return depositNonce The nonce associated with the deposit for burn transaction.\n     */\n    function swapCCTP(uint256 amountIn, address token, uint256 targetNetwork) external onlyRouter returns (uint64 depositNonce){\n        TargetNetwork memory target = targetNetworks[targetNetwork];\n        require(target.targetNetworkDomain != 0, \"FR: Target network not found\");\n        require(target.targetCCTPFundManager != address(0), \"FR: Target CCTP FundManager address not found\");\n        require(token == usdcToken, \"FR: Invalid token\");\n\n        require(IERC20(token).approve(cctpTokenMessenger, amountIn), \"Approval failed\");\n\n        depositNonce = ICCTPTokenMessenger(cctpTokenMessenger).depositForBurn(\n            amountIn,\n            target.targetNetworkDomain,\n            addressToBytes32(target.targetCCTPFundManager),\n            usdcToken\n        );\n    }     \n\n    /**\n     * @notice Converts an Ethereum address to a bytes32 representation.\n     * @dev This is useful for interacting with contracts or protocols that require addresses in bytes32 format.\n     * @param addr The address to be converted.\n     * @return The bytes32 representation of the given address.\n     */\n    function addressToBytes32(address addr) internal pure returns (bytes32) {\n        return bytes32(uint256(uint160(addr)));\n    }\n}"
      },
      "contracts/multiswap-contracts/FeeDistributor.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract FeeDistributor is EIP712, Ownable {\n    using SafeERC20 for IERC20;\n    using ECDSA for bytes32;\n    string public constant NAME = \"FEE_DISTRIBUTOR\";\n    string public constant VERSION = \"000.001\";\n    uint32 constant MINUTE = 60;\n    address public feeWallet;\n    uint256 public platformFee; // Platform fee as a fixed amount \n\n    mapping(address => bool) public signers;\n    mapping(bytes32 => bool) public usedSalt;\n\n    bytes32 constant DISTRIBUTE_FEES_TYPEHASH = keccak256(\n        \"DistributeFees(address token,address referral,uint256 referralFee,uint256 referralDiscount,uint256 sourceAmountIn,uint256 sourceAmountOut,uint256 destinationAmountIn,uint256 destinationAmountOut,bytes32 salt,uint256 expiry)\"\n    );\n\n    struct FeeDistributionData {\n        address referral;\n        uint256 referralFee; // Referral fee as a percentage\n        uint256 referralDiscount; // Referral discount as a percentage\n        uint256 sourceAmountIn;\n        uint256 sourceAmountOut;\n        uint256 destinationAmountIn;\n        uint256 destinationAmountOut;\n        bytes32 salt;\n        uint256 expiry;\n        bytes signature;\n    }\n\n    event FeesDistributed(\n        address indexed token,\n        uint256 preFeeAmount,\n        uint256 afterFeeAmount,\n        uint256 totalPlatformFee\n    );\n\n    constructor() EIP712(NAME, VERSION) {}\n\n    /**\n     @dev sets the signer\n     @param _signer is the address that generates signatures\n     */\n    function addSigner(address _signer) external onlyOwner {\n        require(_signer != address(0), \"FD: Bad signer\");\n        signers[_signer] = true;\n    }\n\n    /**\n     @dev removes the signer\n     @param _signer is the address that generates signatures\n     */\n    function removeSigner(address _signer) external onlyOwner {\n        delete signers[_signer];\n    }\n\n    /**\n     @dev sets the fee wallet\n     @param _feeWallet is the new fee wallet address\n     */\n    function setFeeWallet(address _feeWallet) external onlyOwner {\n        require(_feeWallet != address(0), \"FD: Bad fee wallet address\");\n        feeWallet = _feeWallet;\n    }\n\n    /**\n     @dev sets the platform fee\n     @param _platformFee is the new platform fee as a percentage\n     */\n    function setPlatformFee(uint256 _platformFee) external onlyOwner {\n        require(_platformFee > 0, \"FD: Platform fee must be greater than zero\");\n        platformFee = _platformFee;\n    }\n\n    function _distributeFees(\n        address token,\n        uint256 preFeeAmount,\n        FeeDistributionData memory fdd\n    ) internal returns (uint256) {\n        require(_verify(token, fdd), \"FD: Invalid signature\");\n\n        uint256 totalAmount = preFeeAmount;\n        uint256 remainingAmount = totalAmount - platformFee;\n        uint256 referralDiscountAmount = 0;\n        uint256 referralFeeAmount = 0;\n        uint256 feeWalletShare = platformFee;\n\n        // If referral is provided, calculate the referral discount and referral fee\n        if (fdd.referral != address(0)) {\n            if (fdd.referralDiscount > 0) {\n                referralDiscountAmount = (platformFee * fdd.referralDiscount) / 100;\n                feeWalletShare -= referralDiscountAmount;\n                remainingAmount += referralDiscountAmount;\n            }\n\n            if (fdd.referralFee > 0) {\n                referralFeeAmount = (feeWalletShare * fdd.referralFee) / 100;\n                feeWalletShare -= referralFeeAmount;\n                IERC20(token).safeTransfer(fdd.referral, referralFeeAmount);\n            }\n        }\n\n        // Ensure the total allocated fee does not exceed the platform fee\n        require(feeWalletShare + referralFeeAmount + referralDiscountAmount <= platformFee, \"FD: Total fee exceeds platform fee\");\n\n        // Transfer the remaining fee to the fee wallet\n        IERC20(token).safeTransfer(feeWallet, feeWalletShare);\n\n        emit FeesDistributed(token, preFeeAmount, remainingAmount, platformFee);\n\n        return remainingAmount;\n    }\n\n\n\n    function _verify(\n        address token,\n        FeeDistributionData memory fdd\n    ) private returns (bool) {\n        require(block.timestamp < fdd.expiry, \"FD: Signature timed out\");\n        require(fdd.expiry < block.timestamp + (20 * MINUTE), \"FD: Expiry too far\"); // 20 minutes probably too generous. Users should be submitting tx soon after quote on source chain\n        require(!usedSalt[fdd.salt], \"FM: Salt already used\");\n        usedSalt[fdd.salt] = true;\n\n        bytes32 structHash = keccak256(\n            abi.encode(\n                DISTRIBUTE_FEES_TYPEHASH,\n                token,\n                fdd.referral,\n                fdd.referralFee,\n                fdd.referralDiscount,\n                fdd.sourceAmountIn,\n                fdd.sourceAmountOut,\n                fdd.destinationAmountIn,\n                fdd.destinationAmountOut,\n                fdd.salt,\n                fdd.expiry\n            )\n        );\n\n        bytes32 digest = _hashTypedDataV4(structHash);\n        address signer = ECDSA.recover(digest, fdd.signature);\n        return signers[signer];\n    }\n}\n"
      },
      "contracts/multiswap-contracts/FiberRouter.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../common/tokenReceiveable.sol\";\nimport \"../common/SafeAmount.sol\";\nimport \"../common/IWETH.sol\";\nimport \"./FundManager.sol\";\nimport \"./CCTPFundManager.sol\";\nimport \"./FeeDistributor.sol\";\n\n/**\n @author The ferrum network.\n @title This is a routing contract named as FiberRouter.\n*/\ncontract FiberRouter is Ownable, TokenReceivable, FeeDistributor {\n    using SafeERC20 for IERC20;\n    address private constant NATIVE_CURRENCY = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n    address public weth;\n    address public fundManager;\n    address public cctpFundManager;\n    address payable public gasWallet;\n    mapping(bytes32 => bool) private routerAllowList;\n    mapping(uint256 => TargetNetwork) public targetNetworks;\n\n    struct SwapCrossData {\n        uint256 targetNetwork;\n        address targetToken;\n        address targetAddress;\n    }\n\n    struct TargetNetwork {\n        uint32 targetNetworkDomain;\n        address targetFundManager;\n    }\n\n    event Swap(\n        address sourceToken,\n        address targetToken,\n        uint256 sourceChainId,\n        uint256 targetChainId,\n        uint256 sourceAmount,\n        address sourceAddress,\n        address targetAddress,\n        uint256 settledAmount,\n        bytes32 withdrawalData,\n        uint256 gasAmount,\n        uint256 depositNonce\n    );\n\n    event SwapSameNetwork(\n        address sourceToken,\n        address targetToken,\n        uint256 sourceAmount,\n        uint256 settledAmount,\n        address sourceAddress,\n        address targetAddress\n    );\n    event Withdraw(\n        address token,\n        address receiver,\n        uint256 amount,\n        bytes32 salt,\n        bytes signature\n    );\n\n    event WithdrawRouter(\n        address to,\n        uint256 amountIn,\n        uint256 amountOut,\n        address foundryToken,\n        address targetToken,\n        address router,\n        bytes routerCalldata,\n        bytes32 salt,\n        bytes multiSignature\n    );\n\n    event RouterAndSelectorWhitelisted(address router, bytes4 selector);\n    event RouterAndSelectorRemoved(address router, bytes selector);\n\n    /**\n     * @notice Set the weth address\n     * @param _weth The weth address\n     */\n    function setWeth(address _weth) external onlyOwner {\n        require(_weth != address(0), \"weth address cannot be zero\");\n        weth = _weth;\n    }\n\n    /**\n     * @dev Sets the fund manager contract.\n     * @param _fundManager The fund manager\n     */\n    function setFundManager(address _fundManager) external onlyOwner {\n        require(_fundManager != address(0), \"Swap pool address cannot be zero\");\n        fundManager = _fundManager;\n    }\n\n    /**\n     * @dev Sets the fund manager contract.\n     * @param _cctpFundManager The fund manager\n     */\n    function setCCTPFundManager(address _cctpFundManager) external onlyOwner {\n        require(_cctpFundManager != address(0), \"Swap pool address cannot be zero\");\n        cctpFundManager = _cctpFundManager;\n    }\n\n    /**\n     * @dev Sets the gas wallet address.\n     * @param _gasWallet The wallet which pays for the funds on withdrawal\n     */\n    function setGasWallet(address payable _gasWallet) external onlyOwner {\n        require(\n            _gasWallet != address(0),\n            \"FR: Gas Wallet address cannot be zero\"\n        );\n        gasWallet = _gasWallet;\n    }\n\n    /**\n     * @notice Whitelists the router and selector combination\n     * @param router The router address\n     * @param selectors The selectors for the router\n     */\n    function addRouterAndSelectors(address router, bytes4[] memory selectors) external onlyOwner {\n        for (uint256 i = 0; i < selectors.length; i++) {\n            routerAllowList[_getKey(router, abi.encodePacked(selectors[i]))] = true;\n            emit RouterAndSelectorWhitelisted(router, selectors[i]);\n        }\n    }\n\n    /**\n     * @notice Removes the router and selector combination from the whitelist\n     * @param router The router address\n     * @param selector The selector for the router\n     */\n    function removeRouterAndSelector(address router, bytes calldata selector) external onlyOwner {\n        routerAllowList[_getKey(router, selector)] = false;\n        emit RouterAndSelectorRemoved(router, selector);\n    }\n\n    /**\n     * @dev Perform a same network token swap on specified router/dex\n     * @param amountIn The input amount\n     * @param minAmountOut The minimum amount out accounting for slippage\n     * @param fromToken The token to be swapped\n     * @param toToken The token to receive after the swap\n     * @param targetAddress The receiver address\n     * @param router The router address\n     * @param routerCalldata Calldata for the router\n     */\n    function swapOnSameNetwork(\n        uint256 amountIn,\n        uint256 minAmountOut,\n        address fromToken,\n        address toToken,\n        address targetAddress,\n        address router,\n        bytes memory routerCalldata\n    ) external nonReentrant {\n        // Validation checks\n        require(fromToken != address(0), \"FR: From token address cannot be zero\");\n        require(toToken != address(0), \"FR: To token address cannot be zero\");\n        require(amountIn != 0, \"FR: Amount in must be greater than zero\");\n        require(minAmountOut != 0, \"FR: Amount out must be greater than zero\");\n        require(targetAddress != address(0), \"FR: Target address cannot be zero\");\n\n        amountIn = SafeAmount.safeTransferFrom(fromToken, _msgSender(), address(this), amountIn);\n\n        // Perform the token swap\n        uint256 amountOut = _swapAndCheckSlippage(\n            targetAddress,\n            fromToken,\n            toToken,\n            amountIn,\n            minAmountOut,\n            router,\n            routerCalldata\n        );\n\n        // Emit Swap event\n        emit SwapSameNetwork(\n            fromToken,\n            toToken,\n            amountIn,\n            amountOut,\n            _msgSender(),\n            targetAddress\n        );\n    }\n\n    /**\n     * @dev Performs a swap from native currency to specified token\n     * @param minAmountOut The minimum amount of tokens expected after the swap\n     * @param toToken The token to receive after the swap\n     * @param targetAddress The receiver address for the token\n     * @param router The router address\n     * @param routerCalldata Calldata for the router\n     */\n    function swapOnSameNetworkETH(\n        uint256 minAmountOut,\n        address toToken,\n        address targetAddress,\n        address router,\n        bytes memory routerCalldata\n    ) external payable {\n        uint256 amountIn = msg.value;\n        // Validation checks\n        require(toToken != address(0), \"FR: To token address cannot be zero\");\n        require(amountIn != 0, \"FR: Amount in must be greater than zero\");\n        require(minAmountOut != 0, \"FR: Amount out must be greater than zero\");\n        require(targetAddress != address(0), \"FR: Target address cannot be zero\");\n        require(bytes(routerCalldata).length != 0, \"FR: Calldata cannot be empty\");\n\n        // Deposit ETH and get WETH\n        IWETH(weth).deposit{value: amountIn}();\n\n        uint256 amountOut = _swapAndCheckSlippage(\n            targetAddress,\n            weth,\n            toToken,\n            amountIn,\n            minAmountOut,\n            router,\n            routerCalldata\n        );\n\n        // Emit Swap event\n        emit SwapSameNetwork(\n            NATIVE_CURRENCY,\n            toToken,\n            amountIn,\n            amountOut,\n            _msgSender(),\n            targetAddress\n        );\n    }\n\n    /**\n     * @dev Initiates a token swap.\n     * @param token The token to be swapped.\n     * @param amount The amount to be swapped.\n     * @param withdrawalData Data related to the withdrawal.\n     * @param cctpType Boolean indicating whether it's a CCTP swap.\n     */\n    function swapSigned(\n        address token,\n        uint256 amount,\n        SwapCrossData memory sd,\n        bytes32 withdrawalData,\n        bool cctpType,\n        FeeDistributionData memory fd\n    ) external payable nonReentrant {\n        // Validation checks\n        require(token != address(0), \"FR: Token address cannot be zero\");\n        require(sd.targetToken != address(0), \"FR: Target token address cannot be zero\");\n        require(sd.targetNetwork != 0, \"FR: Target network is required\");\n        require(sd.targetAddress != address(0), \"FR: Target address cannot be zero\");\n        require(amount != 0, \"FR: Amount must be greater than zero\");\n        require(withdrawalData != 0, \"FR: Withdraw data cannot be empty\");\n        require(msg.value != 0, \"FR: Gas Amount must be greater than zero\");\n\n        // Transfer tokens to FiberRouter\n        amount = SafeAmount.safeTransferFrom(token, _msgSender(), address(this), amount);\n\n        // Distribute the fees\n        uint256 amountOut = _distributeFees(token, amount, fd);\n\n        // Perform the token swap based on swapCCTP flag\n        uint64 depositNonce;\n        if (cctpType) {\n            // Proceed with the CCTP swap logic\n            SafeERC20.safeTransfer(IERC20(token), cctpFundManager, amountOut);\n            depositNonce = CCTPFundManager(cctpFundManager).swapCCTP(amountOut, token, sd.targetNetwork);\n        } else {\n            // Proceed with the normal swap logic\n            SafeERC20.safeTransfer(IERC20(token), fundManager, amountOut);\n            FundManager(fundManager).swapToAddress(\n                token,\n                amount,\n                sd.targetNetwork,\n                sd.targetAddress\n            );\n        }\n\n        // Transfer the gas fee to the gasWallet\n        SafeAmount.safeTransferETH(gasWallet, msg.value);\n\n        emit Swap(\n            token,\n            sd.targetToken,\n            block.chainid,\n            sd.targetNetwork,\n            amount,\n            _msgSender(),\n            sd.targetAddress,\n            amountOut,\n            withdrawalData,\n            msg.value,\n            depositNonce // Stays zero for non-CCTP swaps\n        );\n    }\n\n    /**\n     * @dev Do a local swap and generate a cross-chain swap\n     * @param amountIn The input amount\n     * @param minAmountOut The minimum amount out after the swap\n     * @param fromToken The token to be swapped\n     * @param foundryToken The foundry token used for the swap\n     * @param router The router address\n     * @param routerCalldata The calldata for the swap\n     * @param withdrawalData Data related to the withdrawal\n     * @param cctpType Boolean indicating whether it's a CCTP swap.\n     */\n    function swapSignedAndCrossRouter(\n        uint256 amountIn,\n        uint256 minAmountOut,\n        address fromToken,\n        address foundryToken,\n        address router,\n        bytes memory routerCalldata,\n        SwapCrossData memory sd,\n        bytes32 withdrawalData,\n        bool cctpType,\n        FeeDistributionData memory fd\n    ) external payable nonReentrant {\n        require(amountIn != 0, \"FR: Amount in must be greater than zero\");\n        require(fromToken != address(0), \"FR: From token address cannot be zero\");\n        require(foundryToken != address(0), \"FR: Foundry token address cannot be zero\");\n        require(sd.targetToken != address(0), \"FR: Cross target token address cannot be zero\");\n        require(minAmountOut != 0, \"FR: Amount out must be greater than zero\");\n        require(withdrawalData != 0, \"FR: withdraw data cannot be empty\");\n        require(msg.value != 0, \"FR: Gas Amount must be greater than zero\");\n\n        uint256 _amountIn = SafeAmount.safeTransferFrom(fromToken, _msgSender(), address(this), amountIn);\n        \n        // Swap and receive tokens back to FiberRouter\n        uint256 amountOut = _swapAndCheckSlippage(\n            address(this),\n            fromToken,\n            foundryToken,\n            _amountIn,\n            minAmountOut,\n            router,\n            routerCalldata\n        );\n\n        amountOut = _distributeFees(foundryToken, amountOut, fd);\n\n        uint64 depositNonce;\n        if (cctpType) {\n            // Transfer to CCTP FundManager and initiate CCTP swap\n            SafeERC20.safeTransfer(IERC20(foundryToken), cctpFundManager, amountOut);\n            depositNonce = CCTPFundManager(cctpFundManager).swapCCTP(amountOut, foundryToken, sd.targetNetwork);\n        } else {\n            // Transfer to FundManager and update inventory\n            SafeERC20.safeTransfer(IERC20(foundryToken), fundManager, amountOut);\n            FundManager(fundManager).swapToAddress(\n                foundryToken,\n                amountOut,\n                sd.targetNetwork,\n                sd.targetAddress\n            );\n        }\n\n        // Transfer the gas fee to the gasWallet\n        SafeAmount.safeTransferETH(gasWallet, msg.value);\n\n        emit Swap(\n            fromToken,\n            sd.targetToken,\n            block.chainid,\n            sd.targetNetwork,\n            _amountIn,\n            _msgSender(),\n            sd.targetAddress,\n            amountOut,\n            withdrawalData,\n            msg.value,\n            depositNonce // Stays zero for non-CCTP swaps\n        );    \n    }\n\n    /**\n     * @dev Do a local swap with ETH as input and generate a cross-chain swap\n     * @param minAmountOut The minimum amount out after the swap\n     * @param foundryToken The foundry token used for the swap\n     * @param gasFee The gas fee being charged on withdrawal\n     * @param router The router address\n     * @param routerCalldata The calldata for the swap\n     * @param withdrawalData Data related to the withdrawal\n     * @param cctpType Boolean indicating whether it's a CCTP swap.\n     */\n    function swapSignedAndCrossRouterETH(\n        uint256 minAmountOut,\n        address foundryToken,\n        uint256 gasFee,\n        address router,\n        bytes memory routerCalldata,\n        SwapCrossData memory sd,\n        bytes32 withdrawalData,\n        bool cctpType,\n        FeeDistributionData memory fd\n    ) external payable {\n        require(msg.value - gasFee != 0, \"FR: Amount in must be greater than zero\"); // amountIn = msg.value - gasFee, but using directly here \n        require(gasFee != 0, \"FR: Gas fee must be greater than zero\");\n        require(minAmountOut != 0, \"FR: Amount out must be greater than zero\");\n        require(sd.targetToken != address(0), \"FR: Cross target token address cannot be zero\");\n        require(foundryToken != address(0), \"FR: Foundry token address cannot be zero\");\n        require(withdrawalData != 0, \"FR: Withdraw data cannot be empty\");\n\n        // Deposit ETH (excluding gas fee) for WETH and swap\n        IWETH(weth).deposit{value: msg.value - gasFee}();\n\n        uint256 amountOut = _swapAndCheckSlippage(\n            address(this),\n            weth,\n            foundryToken,\n            msg.value - gasFee,\n            minAmountOut,\n            router,\n            routerCalldata\n        );\n\n        amountOut = _distributeFees(foundryToken, amountOut, fd);\n\n        uint64 depositNonce;\n        if (cctpType) {\n            // Transfer to CCTP FundManager and initiate CCTP swap\n            SafeERC20.safeTransfer(IERC20(foundryToken), cctpFundManager, amountOut);\n            depositNonce = CCTPFundManager(cctpFundManager).swapCCTP(amountOut, foundryToken, sd.targetNetwork);\n        } else {\n            // Transfer and update pool inventory\n            SafeERC20.safeTransfer(IERC20(foundryToken), fundManager, amountOut);\n            FundManager(fundManager).swapToAddress(\n                foundryToken,\n                amountOut,\n                sd.targetNetwork,\n                sd.targetAddress\n            );\n        }\n\n        // Transfer the gas fee to the gasWallet\n        (bool success, ) = payable(gasWallet).call{value: gasFee}(\"\");\n        require(success, \"FR: Gas fee transfer failed\");\n\n        uint256 _gasFee = gasFee; // Stack too deep workaround\n        emit Swap(\n            weth,\n            sd.targetToken,\n            block.chainid,\n            sd.targetNetwork,\n            msg.value - _gasFee,\n            _msgSender(),\n            sd.targetAddress,\n            amountOut,\n            withdrawalData,\n            _gasFee,\n            depositNonce\n        );    \n    }\n\n    /**\n     * @dev Initiates a signed token withdrawal, exclusive to the router.\n     * @notice Ensure valid parameters and router setup.\n     * @param token The token to withdraw\n     * @param payee Address for where to send the tokens to\n     * @param amount The amount\n     * @param salt The salt for unique tx \n     * @param expiry The expiration time for the signature\n     * @param cctpType Type of withdrawal: true for CCTP, false for normal\n     * @param multiSignature The multisig validator signature\n     */\n    function withdrawSigned(\n        address token,\n        address payee,\n        uint256 amount,\n        bytes32 salt,\n        uint256 expiry,\n        bytes memory multiSignature,\n        bool cctpType\n    ) public virtual nonReentrant {\n        // Validate input parameters\n        require(token != address(0), \"FR: Token address cannot be zero\");\n        require(payee != address(0), \"FR: Payee address cannot be zero\");\n        require(amount != 0, \"FR: Amount must be greater than zero\");\n        require(salt > bytes32(0), \"FR: Salt must be greater than zero bytes\");\n\n        address _pool = cctpType ? cctpFundManager : fundManager;\n\n        amount = FundManager(_pool).withdrawSigned(\n            token,\n            payee,\n            amount,\n            salt,\n            expiry,\n            multiSignature\n        );\n\n        emit Withdraw(token, payee, amount, salt, multiSignature);\n    }\n\n    /**\n     * @dev Initiates a signed token withdrawal with swap through router, exclusive to the router.\n     * @notice Ensure valid parameters and router setup.\n     * @param to The address to withdraw to\n     * @param amountIn The amount to be swapped in\n     * @param minAmountOut The minimum amount out after the swap\n     * @param foundryToken The token used in the Foundry\n     * @param targetToken The target token for the swap\n     * @param router The router address\n     * @param routerCalldata The calldata for the swap\n     * @param salt The salt value for the signature\n     * @param expiry The expiration time for the signature\n     * @param cctpType Boolean indicating if swap to CCTP\n     * @param multiSignature The multi-signature data\n     */\n    function withdrawSignedAndSwapRouter(\n        address payable to,\n        uint256 amountIn,\n        uint256 minAmountOut,\n        address foundryToken,\n        address targetToken,\n        address router,\n        bytes memory routerCalldata,\n        bytes32 salt,\n        uint256 expiry,\n        bytes memory multiSignature,\n        bool cctpType\n    ) public virtual nonReentrant {\n        require(foundryToken != address(0), \"Bad Token Address\");\n        require(targetToken != address(0), \"FR: Target token address cannot be zero\");\n        require(amountIn != 0, \"Amount in must be greater than zero\");\n        require(minAmountOut != 0, \"Amount out minimum must be greater than zero\");\n        require(foundryToken != address(0), \"Bad Token Address\");\n\n        address _pool = cctpType ? cctpFundManager : fundManager;\n        \n        amountIn = FundManager(_pool).withdrawSignedAndSwapRouter(\n            to,\n            amountIn,\n            minAmountOut,\n            foundryToken,\n            targetToken,\n            router,\n            salt,\n            expiry,\n            multiSignature\n        );\n\n        uint256 amountOut = _swapAndCheckSlippage(\n            to,\n            foundryToken,\n            targetToken,\n            amountIn,\n            minAmountOut,\n            router,\n            routerCalldata\n        );\n\n        emit WithdrawRouter(\n            to,\n            amountIn,\n            amountOut,\n            foundryToken,\n            targetToken,\n            router,\n            routerCalldata,\n            salt,\n            multiSignature\n        );\n    }\n\n    /**\n     * @notice Checks if the router and selector combination is whitelisted\n     * @param router The router address\n     * @param selector The selector for the router\n     */\n    function isAllowListed(address router, bytes memory selector) public view returns (bool) {\n        return routerAllowList[_getKey(router, selector)];\n    }\n\n    /**\n     * @notice Helper function for executing token swaps through provided router\n     * @param targetAddress The recipient address to receive the swapped tokens\n     * @param fromToken The address of the input token for the swap\n     * @param toToken The address of the output token from the swap\n     * @param amountIn The exact amount of input tokens to be swapped\n     * @param minAmountOut The minimum amount of output tokens expected after the swap\n     * @param router The router address\n     * @param data The calldata for the swap\n     */\n    function _swapAndCheckSlippage(\n        address targetAddress,\n        address fromToken,\n        address toToken,\n        uint256 amountIn,\n        uint256 minAmountOut,\n        address router,\n        bytes memory data\n    ) internal returns (uint256) {\n        require(isAllowListed(router, data), \"FR: Router and selector not whitelisted\");\n        _approveAggregatorRouter(fromToken, router, amountIn);\n        uint256 balanceBefore = _getBalance(toToken, targetAddress);\n        _makeRouterCall(router, data);\n        uint256 amountOut = _getBalance(toToken, targetAddress) - balanceBefore;\n\n        require(amountOut >= minAmountOut, \"FR: Slippage check failed\");\n        // TODO for failed slippage checks: On-chain settlement. Option are:\n        // 1/ Receive USDC on dst chain\n        // 2/ ask user about updated quote\n        // 3/ get funds back on src chain\n        return amountOut;\n    }\n\n    function _getBalance(address token, address account) private view returns (uint256) {\n        return token == NATIVE_CURRENCY ? account.balance : IERC20(token).balanceOf(account);\n    }\n\n    function _approveAggregatorRouter(address token, address router, uint256 amount) private {\n        if (IERC20(token).allowance(address(this), router) != 0) {\n            IERC20(token).safeApprove(router, 0);\n        }\n        IERC20(token).safeApprove(router, amount);\n    }   \n\n    function _getKey(address router, bytes memory data) private pure returns (bytes32) {\n        bytes32 key; // Takes the shape of 0x{4byteFuncSelector}00..00{20byteRouterAddress}\n        assembly {\n            key := or(\n                and(mload(add(data, 0x20)), 0xffffffff00000000000000000000000000000000000000000000000000000000),\n                router\n            )\n        }\n        return key;\n    }\n\n    function _makeRouterCall(address router, bytes memory data) private {\n        (bool success, bytes memory returnData) = router.call(data);\n        if (!success) {\n            if (returnData.length > 0) { // Bubble up the revert reason\n                assembly {\n                    let returnDataSize := mload(returnData)\n                    revert(add(32, returnData), returnDataSize)\n                }\n            } else {\n                revert(\"FR: Call to router failed\");\n            }\n        }\n    }\n\n    function isCctp(uint256 cdPtr) public pure returns (bool cctp) {\n        assembly {\n            cctp := shr(252, calldataload(cdPtr))\n        }\n    }\n}\n"
      },
      "contracts/multiswap-contracts/FundManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport \"../common/signature/SigCheckable.sol\";\nimport \"./LiquidityManagerRole.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\ncontract FundManager is SigCheckable, LiquidityManagerRole {\n    using SafeERC20 for IERC20;\n\n    address public fiberRouter;\n    address public settlementManager;\n    uint32 constant WEEK = 3600 * 24 * 7;\n    string public constant NAME = \"FUND_MANAGER\";\n    string public constant VERSION = \"000.004\";\n    bytes32 constant WITHDRAW_SIGNED_METHOD =\n        keccak256(\n            \"WithdrawSigned(address token,address payee,uint256 amount,bytes32 salt,uint256 expiry)\"\n        );\n    bytes32 constant WITHDRAW_SIGNED_WITH_SWAP_METHOD =\n        keccak256(\n            \"withdrawSignedAndSwapRouter(address to,uint256 amountIn,uint256 minAmountOut,address foundryToken,address targetToken,address router,bytes32 salt,uint256 expiry)\"\n        );\n\n    event TransferBySignature(\n        address signer,\n        address receiver,\n        address token,\n        uint256 amount\n    );\n    event FailedWithdrawalCancelled(\n        address indexed settlementManager,\n        address indexed receiver,\n        address indexed token,\n        uint256 amount,\n        bytes32 salt\n    );\n    event BridgeLiquidityAdded(address actor, address token, uint256 amount);\n    event BridgeLiquidityRemoved(address actor, address token, uint256 amount);\n    event BridgeSwap(\n        address from,\n        address indexed token,\n        uint256 targetNetwork,\n        address targetToken,\n        address targetAddrdess,\n        uint256 amount\n    );\n\n    mapping(address => bool) public signers;\n    mapping(address => mapping(address => uint256)) private liquidities;\n    mapping(address => mapping(uint256 => address)) public allowedTargets;\n    mapping(address => bool) public isFoundryAsset;\n    mapping(bytes32=>bool) public usedSalt;\n\n    /**\n     * @dev Modifier that allows only the designated fiberRouter to execute the function.\n     * It checks if the sender is equal to the `fiberRouter` address.\n     * @notice Ensure that `fiberRouter` is set before using this modifier.\n     */\n    modifier onlyRouter() {\n        require(msg.sender == fiberRouter, \"FM: Only fiberRouter method\");\n        _;\n    }\n\n    /**\n     * @dev Modifier that allows only the designated settlementManager to execute the function.\n     * It checks if the sender is equal to the `settlementManager` address.\n     * @notice Ensure that `settlementManager` is set before using this modifier.\n     */\n    modifier onlySettlementManager() {\n        require(msg.sender == settlementManager, \"FM: Only Settlement Manager\");\n        _;\n    }\n\n    /**\n     * @dev Contract constructor that initializes the EIP-712 domain with the specified NAME, VERSION.\n     * @notice This constructor is called only once during the deployment of the contract.\n     */\n    constructor() EIP712(NAME, VERSION) {}\n\n    /**\n     *************** Owner only operations ***************\n     */\n\n    /**\n     * @dev Sets the address of settlement manager\n     * @param _settlementManager The settlement manager address\n     */\n    function setSettlementManager(address _settlementManager) external onlyOwner {\n        require(_settlementManager != address(0), \"FM: Bad settlement manager\");\n\n        settlementManager = _settlementManager;\n    }\n\n    /**\n     @dev sets the fiberRouter\n     @param _fiberRouter is the FiberRouter address\n     */\n    function setRouter(address _fiberRouter) external onlyOwner {\n        require(_fiberRouter != address(0), \"FM: fiberRouter required\");\n        fiberRouter = _fiberRouter;\n    }\n\n    /**\n     @dev sets the signer\n     @param _signer is the address that generate signatures\n     */\n    function addSigner(address _signer) public onlyOwner {\n        require(_signer != address(0), \"Bad signer\");\n        signers[_signer] = true;\n    }\n\n    /**\n     @dev removes the signer\n     @param _signer is the address that generate signatures\n     */\n    function removeSigner(address _signer) external onlyOwner {\n        require(_signer != address(0), \"Bad signer\");\n        delete signers[_signer];\n    }\n\n    /**\n     @dev sets the allowed target chain & token\n     @param token is the address of foundry token on source network\n     @param chainId target network's chain ID\n     @param targetToken target network's foundry token address\n     */\n    function allowTarget(\n        address token,\n        uint256 chainId,\n        address targetToken\n    ) external onlyAdmin {\n        require(token != address(0), \"Bad token\");\n        require(targetToken != address(0), \"Bad targetToken\");\n        require(chainId != 0, \"Bad chainId\");\n        allowedTargets[token][chainId] = targetToken;\n    }\n\n    /**\n     @dev removes the allowed target chain & token\n     @param token is the address of foundry token on source network\n     @param chainId target network's chain ID\n     */\n    function disallowTarget(address token, uint256 chainId) external onlyAdmin {\n        require(token != address(0), \"Bad token\");\n        require(chainId != 0, \"Bad chainId\");\n        delete allowedTargets[token][chainId];\n    }\n\n    /**\n     @dev sets the foundry token\n     @param token is the foundry token address\n     */\n    function addFoundryAsset(address token) external onlyAdmin {\n        require(token != address(0), \"Bad token\");\n        isFoundryAsset[token] = true;\n    }\n\n    /**\n     @dev removes the foundry token\n     @param token is the foundry token address\n     */\n    function removeFoundryAsset(address token) external onlyAdmin {\n        require(token != address(0), \"Bad token\");\n        isFoundryAsset[token] = false;\n    }\n\n    /**\n     * @dev Initiates an EVM token swap, exclusive to the router\n     * @notice Ensure valid parameters and router setup\n     * @param token The address of the token to be swapped\n     * @param amount The amount of tokens to be swapped\n     * @param targetNetwork The identifier of the target network for the swap\n     * @param targetAddress The address on the target network where the swapped tokens will be sent\n     * @return The actual amount of tokens swapped\n    */\n    function swapToAddress(\n        address token,\n        uint256 amount,\n        uint256 targetNetwork,\n        address targetAddress\n    ) external onlyRouter returns(uint256) {\n        address targetToken = allowedTargets[token][targetNetwork];\n        require(token != address(0), \"FM: bad token\");\n        require(targetNetwork != 0, \"FM: targetNetwork is requried\");\n        require(targetToken != address(0), \"FM: bad target token\");\n        require(targetAddress != address(0), \"FM: targetAddress is required\");\n        require(amount != 0, \"FM: bad amount\");\n        amount = TokenReceivable.sync(token);\n        emit BridgeSwap(\n            msg.sender,\n            token,\n            targetNetwork,\n            targetToken,\n            targetAddress,\n            amount\n        );\n        return amount;\n    }\n \n    /**\n     * @dev Initiates a signed token withdrawal, exclusive to the router\n     * @notice Ensure valid parameters and router setup\n     * @param token The token to withdraw\n     * @param payee Address for where to send the tokens to\n     * @param amount The amount\n     * @param salt The salt for unique tx\n     * @param expiry The expiration time for the signature\n     * @param signature The multisig validator signature\n     * @return The actual amount of tokens withdrawn\n     */\n    function withdrawSigned(\n        address token,\n        address payee,\n        uint256 amount,\n        bytes32 salt,\n        uint256 expiry,\n        bytes memory signature\n    ) external onlyRouter returns (uint256) {\n        require(token != address(0), \"FM: bad token\");\n        require(payee != address(0), \"FM: bad payee\");\n        require(salt != 0, \"FM: bad salt\");\n        require(amount != 0, \"FM: bad amount\");\n        require(block.timestamp < expiry, \"FM: signature timed out\");\n        require(expiry < block.timestamp + WEEK, \"FM: expiry too far\");\n        bytes32 message =  keccak256(abi.encode(WITHDRAW_SIGNED_METHOD, token, payee, amount, salt, expiry));\n        address _signer = signerUnique(message, signature);\n        require(signers[_signer], \"FM: Invalid signer\");\n        require(!usedSalt[salt], \"FM: salt already used\");\n        usedSalt[salt] = true;\n        TokenReceivable.sendToken(token, payee, amount);\n        emit TransferBySignature(_signer, payee, token, amount);\n        return amount;\n    }\n\n    /**\n     * @dev Initiates a signed token withdrawal with swap, exclusive to the router\n     * @notice Ensure valid parameters and router setup\n     * @param to The address to withdraw to\n     * @param amountIn The amount to be swapped in\n     * @param minAmountOut The minimum amount out from the swap\n     * @param foundryToken The token used in the Foundry\n     * @param targetToken The target token for the swap\n     * @param router The router address\n     * @param salt The salt value for the signature\n     * @param expiry The expiration time for the signature\n     * @param signature The multi-signature data\n     * @return The actual amount of tokens withdrawn from Foundry\n     */\n    function withdrawSignedAndSwapRouter(\n        address to,\n        uint256 amountIn,\n        uint256 minAmountOut,\n        address foundryToken,\n        address targetToken,\n        address router,\n        bytes32 salt,\n        uint256 expiry,\n        bytes memory signature\n    ) external onlyRouter returns (uint256) {\n        require(targetToken != address(0), \"FM: bad token\");\n        require(foundryToken != address(0), \"FM: bad token\");\n        require(to != address(0), \"FM: bad payee\");\n        require(salt != 0, \"FM: bad salt\");\n        require(amountIn != 0, \"FM: bad amount\");\n        require(minAmountOut != 0, \"FM: bad amount\");\n        require(block.timestamp < expiry, \"FM: signature timed out\");\n        require(expiry < block.timestamp + WEEK, \"FM: expiry too far\");\n\n        bytes32 message =  keccak256(\n                abi.encode(\n                    WITHDRAW_SIGNED_WITH_SWAP_METHOD,\n                    to,\n                    amountIn,\n                    minAmountOut,\n                    foundryToken,\n                    targetToken,\n                    router,\n                    salt,\n                    expiry\n                )\n            );\n        address _signer = signerUnique(message, signature);\n        require(signers[_signer], \"FM: Invalid signer\");\n        require(!usedSalt[salt], \"FM: salt already used\");\n        usedSalt[salt] = true;\n        TokenReceivable.sendToken(foundryToken, msg.sender, amountIn);\n        emit TransferBySignature(_signer, msg.sender, foundryToken, amountIn);\n        return amountIn;\n    }\n\n    /**\n     * @dev Verifies details of a signed token withdrawal without executing the withdrawal\n     * @param token Token address for withdrawal\n     * @param payee Intended recipient address\n     * @param amount Amount of tokens to be withdrawn\n     * @param salt Unique identifier to prevent replay attacks\n     * @param expiry Expiration timestamp of the withdrawal signature\n     * @param signature Cryptographic signature for verification\n     * @return Digest and signer's address from the provided signature\n     */\n    function withdrawSignedVerify(\n        address token,\n        address payee,\n        uint256 amount,\n        bytes32 salt,\n        uint256 expiry,\n        bytes calldata signature\n    ) external view returns (bytes32, address) {\n        bytes32 message = keccak256(\n                abi.encode(WITHDRAW_SIGNED_METHOD, token, payee, amount, salt, expiry)\n            );\n        (bytes32 digest, address _signer) = signer(message, signature);\n        return (digest, _signer);\n    }\n\n    function withdrawRouter(address token, uint256 amount, address recipient) external onlyRouter {\n        IERC20(token).transfer(recipient, amount);\n    }\n\n    /**\n     * @dev Verifies details of a signed token swap withdrawal without execution\n     * @param to Recipient address on the target network\n     * @param amountIn Tokens withdrawn from Foundry\n     * @param minAmountOut The minimum tokens on the target network\n     * @param foundryToken Token withdrawn from Foundry\n     * @param targetToken Token on the target network\n     * @param router The router address\n     * @param salt Unique identifier to prevent replay attacks\n     * @param expiry Expiration timestamp of the withdrawal signature\n     * @param signature Cryptographic signature for verification\n     * @return Digest and signer's address from the provided signature\n     */\n    function withdrawSignedAndSwapRouterVerify(\n        address to,\n        uint256 amountIn,\n        uint256 minAmountOut,\n        address foundryToken,\n        address targetToken,\n        address router,\n        bytes32 salt,\n        uint256 expiry,\n        bytes calldata signature\n    ) external view returns (bytes32, address) {\n        bytes32 message =  keccak256(\n                abi.encode(\n                    WITHDRAW_SIGNED_WITH_SWAP_METHOD,\n                    to,\n                    amountIn,\n                    minAmountOut,\n                    foundryToken,\n                    targetToken,\n                    router,\n                    salt,\n                    expiry\n                )\n            );\n        (bytes32 digest, address _signer) = signer(message, signature);\n        return (digest, _signer);\n    }\n\n    /**\n     * @dev Cancels a signed token withdrawal\n     * @param token The token to withdraw\n     * @param payee Address for where to send the tokens to\n     * @param amount The amount\n     * @param salt The salt for unique tx \n     * @param expiry The expiration time for the signature\n     * @param signature The multisig validator signature\n     */\n    function cancelFailedWithdrawSigned(\n        address token,\n        address payee,\n        uint256 amount,\n        bytes32 salt,\n        uint256 expiry,\n        bytes memory signature\n    ) external onlySettlementManager {\n        require(token != address(0), \"FM: bad token\");\n        require(payee != address(0), \"FM: bad payee\");\n        require(salt != 0, \"FM: bad salt\");\n        require(amount != 0, \"FM: bad amount\");\n        require(block.timestamp < expiry, \"FM: signature timed out\");\n        require(expiry < block.timestamp + WEEK, \"FM: expiry too far\");\n        bytes32 message =  keccak256(\n                abi.encode(WITHDRAW_SIGNED_METHOD, token, payee, amount, salt, expiry)\n            );\n        address _signer = signerUnique(message, signature);\n        \n        require(signers[_signer], \"FM: Invalid signer\");\n        require(!usedSalt[salt], \"FM: salt already used\");\n        usedSalt[salt] = true;\n\n        emit FailedWithdrawalCancelled(settlementManager, payee, token, amount, salt);\n    }\n\n    /**\n     * @dev Cancels a signed token swap withdrawal\n     * @notice Ensure valid parameters and router setup\n     * @param to The address to withdraw to\n     * @param amountIn The amount to be swapped in\n     * @param minAmountOut The minimum amount out from the swap\n     * @param foundryToken The token used in the Foundry\n     * @param targetToken The target token for the swap\n     * @param router The router address\n     * @param salt The salt value for the signature\n     * @param expiry The expiration time for the signature\n     * @param signature The multi-signature data\n     */\n    function cancelFailedwithdrawSignedAndSwapRouter(\n        address to,\n        uint256 amountIn,\n        uint256 minAmountOut,\n        address foundryToken,\n        address targetToken,\n        address router,\n        bytes32 salt,\n        uint256 expiry,\n        bytes memory signature\n    ) external onlySettlementManager {\n        require(targetToken != address(0), \"FM: bad token\");\n        require(foundryToken != address(0), \"FM: bad token\");\n        require(to != address(0), \"FM: bad payee\");\n        require(salt != 0, \"FM: bad salt\");\n        require(amountIn != 0, \"FM: bad amount\");\n        require(minAmountOut != 0, \"FM: bad amount\");\n        require(block.timestamp < expiry, \"FM: signature timed out\");\n        require(expiry < block.timestamp + WEEK, \"FM: expiry too far\");\n\n        bytes32 message =  keccak256(\n                abi.encode(\n                    WITHDRAW_SIGNED_WITH_SWAP_METHOD,\n                    to,\n                    amountIn,\n                    minAmountOut,\n                    foundryToken,\n                    targetToken,\n                    router,\n                    salt,\n                    expiry\n                )\n            );\n        address _signer = signerUnique(message, signature);\n        require(signers[_signer], \"FM: Invalid signer\");\n        require(!usedSalt[salt], \"FM: salt already used\");\n        usedSalt[salt] = true;\n\n        emit FailedWithdrawalCancelled(settlementManager, to, targetToken, amountIn, salt);\n    }\n\n    /**\n     * @dev Adds liquidity for the specified token.\n     * @param token Token address for liquidity.\n     * @param amount Amount of tokens to be added.\n     */\n    function addLiquidity(address token, uint256 amount) external {\n        require(amount != 0, \"FM: Amount must be positive\");\n        require(token != address(0), \"FM: Bad token\");\n        require(\n            isFoundryAsset[token] == true,\n            \"FM: Only foundry assets can be added\"\n        );\n        liquidities[token][msg.sender] += amount;\n        amount = SafeAmount.safeTransferFrom(\n            token,\n            msg.sender,\n            address(this),\n            amount\n        );\n        amount = TokenReceivable.sync(token);\n        emit BridgeLiquidityAdded(msg.sender, token, amount);\n    }\n\n    /**\n     * @dev Removes possible liquidity for the specified token.\n     * @param token Token address for liquidity removal.\n     * @param amount Amount of tokens to be removed.\n     * @return Actual amount of tokens removed.\n     */\n    function removeLiquidityIfPossible(address token, uint256 amount)\n        external\n        returns (uint256)\n    {\n        require(amount != 0, \"FM: Amount must be positive\");\n        require(token != address(0), \"FM: Bad token\");\n        require(\n            isFoundryAsset[token] == true,\n            \"FM: Only foundry assets can be removed\"\n        );\n        uint256 liq = liquidities[token][msg.sender];\n        require(liq >= amount, \"FM: Not enough liquidity\");\n        uint256 balance = IERC20(token).balanceOf(address(this));\n        uint256 actualLiq = balance > amount ? amount : balance;\n\n        if (actualLiq != 0) {\n            liquidities[token][msg.sender] -= actualLiq;\n            TokenReceivable.sendToken(token, msg.sender, actualLiq);\n            emit BridgeLiquidityRemoved(msg.sender, token, amount);\n        }\n        return actualLiq;\n    }\n\n    /**\n     * @dev Retrieves liquidity for the specified token and liquidity adder.\n     * @param token Token address for liquidity.\n     * @param liquidityAdder Address of the liquidity adder.\n     * @return Current liquidity amount.\n     */\n    function liquidity(address token, address liquidityAdder)\n        external\n        view\n        returns (uint256)\n    {\n        return liquidities[token][liquidityAdder];\n    }\n\n}"
      },
      "contracts/multiswap-contracts/LiquidityManagerRole.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../common/WithAdmin.sol\";\nimport \"../common/SafeAmount.sol\";\nimport \"../common/tokenReceiveable.sol\";\n\nabstract contract LiquidityManagerRole is WithAdmin, TokenReceivable {\n    using SafeERC20 for IERC20;\n    address public liquidityManager;\n    address public liquidityManagerBot;\n    address public withdrawalAddress;\n\n    event LiquidityAddedByManager(address token, uint256 amount);\n    event LiquidityRemovedByManager(address token, uint256 amount, address withdrawalAddress);\n\n  /**\n     * @dev Modifier that allows only the designated liquidity managers to execute the function.\n     * It checks if the sender is either `liquidityManager` or `liquidityManagerBot`.\n     * @notice Ensure that `liquidityManager` and `liquidityManagerBot` are set before using this modifier.\n     */\n    modifier onlyLiquidityManager() {\n        require(\n            msg.sender == liquidityManager || msg.sender == liquidityManagerBot,\n            \"FM: Only liquidity managers\"\n        );\n        _;\n    }\n\n    /**\n     * @dev Sets the addresses of liquidity managers\n     * @param _liquidityManager The primary liquidity manager address\n     * @param _liquidityManagerBot The secondary liquidity manager address\n     */\n    function setLiquidityManagers(address _liquidityManager, address _liquidityManagerBot) external onlyOwner {\n        require(_liquidityManager != address(0), \"FM: Bad liquidity manager\");\n        require(_liquidityManagerBot != address(0), \"FM: Bad liquidity manager bot\");\n\n        liquidityManager = _liquidityManager;\n        liquidityManagerBot = _liquidityManagerBot;\n    }\n\n    /**\n     * @dev Sets the address for withdrawal of liquidity\n     * @param _withdrawalAddress The liquidity withdraw address\n     */\n    function setWithdrawalAddress(address _withdrawalAddress) external onlyOwner {\n        withdrawalAddress = _withdrawalAddress;\n    }\n\n    /**\n     * @dev Adds specified liquidity for the given token\n     * @param token Token address for liquidity addition\n     * @param amount Amount of tokens to be added\n     */\n    function addLiquidityByManager(address token, uint256 amount) external onlyLiquidityManager {\n        require(amount != 0, \"FM: Amount must be positive\");\n        require(token != address(0), \"FM: Bad token\");\n        // Transfer tokens from the sender to the FundManager\n        SafeAmount.safeTransferFrom(token, msg.sender, address(this), amount);\n        // Update the inventory using sync\n        amount = TokenReceivable.sync(token);\n        emit LiquidityAddedByManager(token, amount);\n    }\n\n    /**\n     * @dev Removes specified liquidity for the given token\n     * @param token Token address for liquidity removal\n     * @param amount Amount of tokens to be removed\n     * @return Actual amount of tokens removed\n     */\n    function removeLiquidityByManager(address token, uint256 amount) external onlyLiquidityManager returns (uint256) {\n        require(amount != 0, \"FM: Amount must be positive\");\n        require(token != address(0), \"FM: Bad token\");\n        // Check the Token balance of FundManager\n        require(IERC20(token).balanceOf(address(this)) >= amount, \"FM: Insufficient balance\");\n        // Transfer tokens to the withdrawal address using sendToken\n        TokenReceivable.sendToken(token, withdrawalAddress, amount);\n        emit LiquidityRemovedByManager(token, amount, withdrawalAddress);\n        return amount;\n    }\n\n}\n"
      },
      "contracts/multiswap-contracts/MultiswapForge.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport \"./FiberRouter.sol\";\n\ncontract MultiSwapForge is FiberRouter {\n    \n    address public gasEstimationAddress;\n\n    constructor() {}\n\n    /**\n     @dev Sets address authorized to execute gas estimations\n     @param _gasEstimationAddress The gas estimation wallet\n     */\n    function setGasEstimationAddress(address _gasEstimationAddress) external onlyOwner {\n        require(\n            _gasEstimationAddress != address(0),\n            \"Gas Estimation address cannot be zero\"\n        );\n        gasEstimationAddress = _gasEstimationAddress;\n    }\n\n    // Override and revert the 'withdrawSigned' function\n    function withdrawSigned(\n        address token,\n        address payee,\n        uint256 amount,\n        bytes32 salt,\n        uint256 expiry,\n        bytes memory multiSignature,\n        bool cctpType\n    ) public override {\n        revert(\"Not Supported\");\n    }\n    // This function is only used specifically for GasEstimation & Simulation of withdrawSigned\n    function withdrawSignedForGasEstimation(\n        address token,\n        address payee,\n        uint256 amount,\n        bytes32 salt,\n        uint256 expiry,\n        bytes memory multiSignature,\n        bool cctpType\n    ) external {\n        super.withdrawSigned(\n            token,\n            payee,\n            amount,\n            salt,\n            expiry,\n            multiSignature,\n            cctpType\n        );\n\n        require(msg.sender == gasEstimationAddress, \"only authorised gas estimation address\");\n    }\n\n    // Override and revert the 'withdrawSignedAndSwapRouter function\n    function withdrawSignedAndSwapRouter(\n        address payable to,\n        uint256 amountIn,\n        uint256 minAmountOut,\n        address foundryToken,\n        address targetToken,\n        address router,\n        bytes memory routerCalldata,\n        bytes32 salt,\n        uint256 expiry,\n        bytes memory multiSignature,\n        bool cctpType\n    ) public override {\n       revert(\"Not Supported\");\n    }\n\n    // This function is only used specifically for GasEstimation & Simulation of withdrawSignedAndSwapOneInch\n    function withdrawSignedAndSwapRouterForGasEstimation(\n        address payable to,\n        uint256 amountIn,\n        uint256 minAmountOut,\n        address foundryToken,\n        address targetToken,\n        address router,\n        bytes memory routerCalldata,\n        bytes32 salt,\n        uint256 expiry,\n        bytes memory multiSignature,\n        bool cctpType\n    ) external {\n        // Call the original function from FiberRouter\n        super.withdrawSignedAndSwapRouter(\n            to,\n            amountIn,\n            minAmountOut,\n            foundryToken,\n            targetToken,\n            router,\n            routerCalldata,\n            salt,\n            expiry,\n            multiSignature,\n            cctpType\n        );\n\n        require(msg.sender == gasEstimationAddress, \"only authorised gas estimation address\");\n    }\n\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "evmVersion": "paris",
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}