creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n *     doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n *     token.safeTransferFrom(msg.sender, address(this), value);\n *     ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     *\n     * CAUTION: See Security Considerations above.\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    using Address for address;\n\n    /**\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n    }\n\n    /**\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\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        require(\n            (value == 0) || (token.allowance(address(this), spender) == 0),\n            \"SafeERC20: approve from non-zero to non-zero allowance\"\n        );\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n    }\n\n    /**\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 oldAllowance = token.allowance(address(this), spender);\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n    }\n\n    /**\n     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\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            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n        }\n    }\n\n    /**\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n     * to be set to zero before setting it to a non-zero value, such as USDT.\n     */\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n        if (!_callOptionalReturnBool(token, approvalCall)) {\n            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n            _callOptionalReturn(token, approvalCall);\n        }\n    }\n\n    /**\n     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n     * Revert on invalid signature.\n     */\n    function safePermit(\n        IERC20Permit token,\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal {\n        uint256 nonceBefore = token.nonces(owner);\n        token.permit(owner, spender, value, deadline, v, r, s);\n        uint256 nonceAfter = token.nonces(owner);\n        require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n        require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n     */\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\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 cannot use {Address-functionCall} here since this should return false\n        // and not revert is the subcall reverts.\n\n        (bool success, bytes memory returndata) = address(token).call(data);\n        return\n            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     *\n     * Furthermore, `isContract` will also return true if the target contract within\n     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n     * which only has an effect at the end of a transaction.\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(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(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n     *\n     * _Available since v4.8._\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        if (success) {\n            if (returndata.length == 0) {\n                // only check isContract if the call was successful and the return data is empty\n                // otherwise we already know that it was a contract\n                require(isContract(target), \"Address: call to non-contract\");\n            }\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason or using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    function _revert(bytes memory returndata, string memory errorMessage) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert(errorMessage);\n        }\n    }\n}\n"
      },
      "@routerprotocol/intents-core/contracts/AdapterDataProvider.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport {IAdapterDataProvider} from \"./interfaces/IAdapterDataProvider.sol\";\n\n/**\n * @title AdapterDataProvider\n * @author Router Protocol\n * @notice This contract serves as the data provider for an intent adapter based on Router\n * Cross-Chain Intent Framework.\n */\ncontract AdapterDataProvider is IAdapterDataProvider {\n    address private _owner;\n    mapping(address => bool) private _headRegistry;\n    mapping(address => bool) private _tailRegistry;\n    mapping(address => bool) private _inboundAssetRegistry;\n    mapping(address => bool) private _outboundAssetRegistry;\n\n    constructor(address __owner) {\n        _owner = __owner;\n    }\n\n    /**\n     * @inheritdoc IAdapterDataProvider\n     */\n    function owner() external view returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @inheritdoc IAdapterDataProvider\n     */\n    function setOwner(address __owner) external onlyOwner {\n        _owner = __owner;\n    }\n\n    /**\n     * @inheritdoc IAdapterDataProvider\n     */\n    function isAuthorizedPrecedingContract(\n        address precedingContract\n    ) external view returns (bool) {\n        if (precedingContract == address(0)) return true;\n        return _headRegistry[precedingContract];\n    }\n\n    /**\n     * @inheritdoc IAdapterDataProvider\n     */\n    function isAuthorizedSucceedingContract(\n        address succeedingContract\n    ) external view returns (bool) {\n        if (succeedingContract == address(0)) return true;\n        return _tailRegistry[succeedingContract];\n    }\n\n    /**\n     * @inheritdoc IAdapterDataProvider\n     */\n    function isValidInboundAsset(address asset) external view returns (bool) {\n        return _inboundAssetRegistry[asset];\n    }\n\n    /**\n     * @inheritdoc IAdapterDataProvider\n     */\n    function isValidOutboundAsset(address asset) external view returns (bool) {\n        return _outboundAssetRegistry[asset];\n    }\n\n    /**\n     * @inheritdoc IAdapterDataProvider\n     */\n    function setPrecedingContract(\n        address precedingContract,\n        bool isValid\n    ) external onlyOwner {\n        _headRegistry[precedingContract] = isValid;\n    }\n\n    /**\n     * @inheritdoc IAdapterDataProvider\n     */\n    function setSucceedingContract(\n        address succeedingContract,\n        bool isValid\n    ) external onlyOwner {\n        _tailRegistry[succeedingContract] = isValid;\n    }\n\n    /**\n     * @inheritdoc IAdapterDataProvider\n     */\n    function setInboundAsset(address asset, bool isValid) external onlyOwner {\n        _inboundAssetRegistry[asset] = isValid;\n    }\n\n    /**\n     * @inheritdoc IAdapterDataProvider\n     */\n    function setOutboundAsset(address asset, bool isValid) external onlyOwner {\n        _outboundAssetRegistry[asset] = isValid;\n    }\n\n    /**\n     * @notice modifier to ensure that only owner can call this function\n     */\n    modifier onlyOwner() {\n        _onlyOwner();\n        _;\n    }\n\n    function _onlyOwner() private view {\n        require(msg.sender == _owner, \"Only owner\");\n    }\n}\n"
      },
      "@routerprotocol/intents-core/contracts/BaseAdapter.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport {Basic} from \"./common/Basic.sol\";\nimport {Errors} from \"./utils/Errors.sol\";\nimport {ReentrancyGuard} from \"./utils/ReentrancyGuard.sol\";\nimport {AdapterDataProvider} from \"./AdapterDataProvider.sol\";\n\n/**\n * @title BaseAdapter\n * @author Router Protocol\n * @notice This contract is the base implementation of an intent adapter based on Router\n * Cross-Chain Intent Framework.\n */\nabstract contract BaseAdapter is Basic, ReentrancyGuard {\n    address private immutable _self;\n    address private immutable _native;\n    address private immutable _wnative;\n    AdapterDataProvider private immutable _adapterDataProvider;\n\n    event ExecutionEvent(string indexed adapterName, bytes data);\n    event OperationFailedRefundEvent(\n        address token,\n        address recipient,\n        uint256 amount\n    );\n    event UnsupportedOperation(\n        address token,\n        address refundAddress,\n        uint256 amount\n    );\n\n    constructor(\n        address __native,\n        address __wnative,\n        bool __deployDataProvider,\n        address __owner\n    ) {\n        _self = address(this);\n        _native = __native;\n        _wnative = __wnative;\n\n        AdapterDataProvider dataProvider;\n\n        if (__deployDataProvider)\n            dataProvider = new AdapterDataProvider(__owner);\n        else dataProvider = AdapterDataProvider(address(0));\n\n        _adapterDataProvider = dataProvider;\n    }\n\n    /**\n     * @dev function to get the address of weth\n     */\n    function wnative() public view override returns (address) {\n        return _wnative;\n    }\n\n    /**\n     * @dev function to get the address of native token\n     */\n    function native() public view override returns (address) {\n        return _native;\n    }\n\n    /**\n     * @dev function to get the AdapterDataProvider instance for this contract\n     */\n    function adapterDataProvider() public view returns (AdapterDataProvider) {\n        return _adapterDataProvider;\n    }\n\n    /**\n     * @dev Function to check whether the contract is a valid preceding contract registered in\n     * the head registry.\n     * @dev This registry governs the initiation of the adapter, exclusively listing authorized\n     * preceding adapters.\n     * @notice Only the adapters documented in this registry can invoke the current adapter,\n     * thereby guaranteeing regulated and secure execution sequences.\n     * @param precedingContract Address of preceding contract.\n     * @return true if valid, false if invalid.\n     */\n    function isAuthorizedPrecedingContract(\n        address precedingContract\n    ) public view returns (bool) {\n        return\n            _adapterDataProvider.isAuthorizedPrecedingContract(\n                precedingContract\n            );\n    }\n\n    /**\n     * @dev Function to check whether the contract is a valid succeeding contract registered in\n     * the tail registry.\n     * @dev This registry dictates the potential succeeding actions by listing adapters that\n     * may be invoked following the current one.\n     * @notice Only the adapters documented in this registry can be invoked by the current adapter,\n     * thereby guaranteeing regulated and secure execution sequences.\n     * @param succeedingContract Address of succeeding contract.\n     * @return true if valid, false if invalid.\n     */\n    function isAuthorizedSucceedingContract(\n        address succeedingContract\n    ) public view returns (bool) {\n        return\n            _adapterDataProvider.isAuthorizedSucceedingContract(\n                succeedingContract\n            );\n    }\n\n    /**\n     * @dev Function to check whether the asset is a valid inbound asset registered in the inbound\n     * asset registry.\n     * @dev This registry keeps track of all the acceptable incoming assets, ensuring that the\n     * adapter only processes predefined asset types.\n     * @param asset Address of the asset.\n     * @return true if valid, false if invalid.\n     */\n    function isValidInboundAsset(address asset) public view returns (bool) {\n        return _adapterDataProvider.isValidInboundAsset(asset);\n    }\n\n    /**\n     * @dev Function to check whether the asset is a valid outbound asset registered in the outbound\n     * asset registry.\n     * @dev It manages the types of assets that the adapter is allowed to output, thus controlling\n     * the flow’s output and maintaining consistency.\n     * @param asset Address of the asset.\n     * @return true if valid, false if invalid.\n     */\n    function isValidOutboundAsset(address asset) public view returns (bool) {\n        return _adapterDataProvider.isValidOutboundAsset(asset);\n    }\n\n    /**\n     * @dev function to get the name of the adapter\n     */\n    function name() public view virtual returns (string memory);\n\n    /**\n     * @dev function to get the address of the contract\n     */\n    function self() public view returns (address) {\n        return _self;\n    }\n}\n"
      },
      "@routerprotocol/intents-core/contracts/common/Basic.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport {TokenInterface} from \"./Interfaces.sol\";\nimport {TokenUtilsBase} from \"./TokenUtilsBase.sol\";\n\nabstract contract Basic is TokenUtilsBase {\n    function getTokenBal(address token) internal view returns (uint _amt) {\n        _amt = address(token) == native()\n            ? address(this).balance\n            : TokenInterface(token).balanceOf(address(this));\n    }\n\n    function approve(address token, address spender, uint256 amount) internal {\n        // solhint-disable-next-line no-empty-blocks\n        try TokenInterface(token).approve(spender, amount) {} catch {\n            TokenInterface(token).approve(spender, 0);\n            TokenInterface(token).approve(spender, amount);\n        }\n    }\n\n    function convertNativeToWnative(uint amount) internal {\n        TokenInterface(wnative()).deposit{value: amount}();\n    }\n\n    function convertWnativeToNative(uint amount) internal {\n        TokenInterface(wnative()).withdraw(amount);\n    }\n}\n"
      },
      "@routerprotocol/intents-core/contracts/common/Interfaces.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\ninterface TokenInterface {\n    function approve(address, uint256) external;\n\n    function transfer(address, uint) external;\n\n    function transferFrom(address, address, uint) external;\n\n    function deposit() external payable;\n\n    function withdraw(uint) external;\n\n    function balanceOf(address) external view returns (uint);\n\n    function decimals() external view returns (uint);\n}\n"
      },
      "@routerprotocol/intents-core/contracts/common/TokenUtilsBase.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport {IWETH} from \"../interfaces/IWETH.sol\";\nimport {SafeERC20, IERC20} from \"../utils/SafeERC20.sol\";\n\nabstract contract TokenUtilsBase {\n    using SafeERC20 for IERC20;\n\n    function wnative() public view virtual returns (address);\n\n    function native() public view virtual returns (address);\n\n    function approveToken(\n        address _tokenAddr,\n        address _to,\n        uint256 _amount\n    ) internal {\n        if (_tokenAddr == native()) return;\n\n        if (IERC20(_tokenAddr).allowance(address(this), _to) < _amount) {\n            IERC20(_tokenAddr).safeApprove(_to, _amount);\n        }\n    }\n\n    function pullTokensIfNeeded(\n        address _token,\n        address _from,\n        uint256 _amount\n    ) internal returns (uint256) {\n        // handle max uint amount\n        if (_amount == type(uint256).max) {\n            _amount = getBalance(_token, _from);\n        }\n\n        if (\n            _from != address(0) &&\n            _from != address(this) &&\n            _token != native() &&\n            _amount != 0\n        ) {\n            IERC20(_token).safeTransferFrom(_from, address(this), _amount);\n        }\n\n        return _amount;\n    }\n\n    function withdrawTokens(\n        address _token,\n        address _to,\n        uint256 _amount\n    ) internal returns (uint256) {\n        if (_amount == type(uint256).max) {\n            _amount = getBalance(_token, address(this));\n        }\n\n        if (_to != address(0) && _to != address(this) && _amount != 0) {\n            if (_token != native()) {\n                IERC20(_token).safeTransfer(_to, _amount);\n            } else {\n                (bool success, ) = _to.call{value: _amount}(\"\");\n                require(success, \"native send fail\");\n            }\n        }\n\n        return _amount;\n    }\n\n    function depositWnative(uint256 _amount) internal {\n        IWETH(wnative()).deposit{value: _amount}();\n    }\n\n    function withdrawWnative(uint256 _amount) internal {\n        IWETH(wnative()).withdraw(_amount);\n    }\n\n    function getBalance(\n        address _tokenAddr,\n        address _acc\n    ) internal view returns (uint256) {\n        if (_tokenAddr == native()) {\n            return _acc.balance;\n        } else {\n            return IERC20(_tokenAddr).balanceOf(_acc);\n        }\n    }\n\n    function getTokenDecimals(address _token) internal view returns (uint256) {\n        if (_token == native()) return 18;\n\n        return IERC20(_token).decimals();\n    }\n}\n"
      },
      "@routerprotocol/intents-core/contracts/interfaces/IAdapterDataProvider.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\n/**\n * @title Interface for Adapter Data Provider contract for intent adapter.\n * @author Router Protocol.\n */\n\ninterface IAdapterDataProvider {\n    /**\n     * @dev Function to get the address of owner.\n     */\n    function owner() external view returns (address);\n\n    /**\n     * @dev Function to set the address of owner.\n     * @dev This function can only be called by the owner of this contract.\n     * @param __owner Address of the new owner\n     */\n    function setOwner(address __owner) external;\n\n    /**\n     * @dev Function to check whether the contract is a valid preceding contract registered in\n     * the head registry.\n     * @dev This registry governs the initiation of the adapter, exclusively listing authorized\n     * preceding adapters.\n     * @notice Only the adapters documented in this registry can invoke the current adapter,\n     * thereby guaranteeing regulated and secure execution sequences.\n     * @param precedingContract Address of preceding contract.\n     * @return true if valid, false if invalid.\n     */\n    function isAuthorizedPrecedingContract(\n        address precedingContract\n    ) external view returns (bool);\n\n    /**\n     * @dev Function to check whether the contract is a valid succeeding contract registered in\n     * the tail registry.\n     * @dev This registry dictates the potential succeeding actions by listing adapters that\n     * may be invoked following the current one.\n     * @notice Only the adapters documented in this registry can be invoked by the current adapter,\n     * thereby guaranteeing regulated and secure execution sequences.\n     * @param succeedingContract Address of succeeding contract.\n     * @return true if valid, false if invalid.\n     */\n    function isAuthorizedSucceedingContract(\n        address succeedingContract\n    ) external view returns (bool);\n\n    /**\n     * @dev Function to check whether the asset is a valid inbound asset registered in the inbound\n     * asset registry.\n     * @dev This registry keeps track of all the acceptable incoming assets, ensuring that the\n     * adapter only processes predefined asset types.\n     * @param asset Address of the asset.\n     * @return true if valid, false if invalid.\n     */\n    function isValidInboundAsset(address asset) external view returns (bool);\n\n    /**\n     * @dev Function to check whether the asset is a valid outbound asset registered in the outbound\n     * asset registry.\n     * @dev It manages the types of assets that the adapter is allowed to output, thus controlling\n     * the flow’s output and maintaining consistency.\n     * @param asset Address of the asset.\n     * @return true if valid, false if invalid.\n     */\n    function isValidOutboundAsset(address asset) external view returns (bool);\n\n    /**\n     * @dev Function to set preceding contract (head registry) for the adapter.\n     * @dev This registry governs the initiation of the adapter, exclusively listing authorized\n     * preceding adapters.\n     * @notice Only the adapters documented in this registry can invoke the current adapter,\n     * thereby guaranteeing regulated and secure execution sequences.\n     * @param precedingContract Address of preceding contract.\n     * @param isValid Boolean value suggesting if this is a valid preceding contract.\n     */\n    function setPrecedingContract(\n        address precedingContract,\n        bool isValid\n    ) external;\n\n    /**\n     * @dev Function to set succeeding contract (tail registry) for the adapter.\n     * @dev This registry dictates the potential succeeding actions by listing adapters that\n     * may be invoked following the current one.\n     * @notice Only the adapters documented in this registry can be invoked by the current adapter,\n     * thereby guaranteeing regulated and secure execution sequences.\n     * @param succeedingContract Address of succeeding contract.\n     * @param isValid Boolean value suggesting if this is a valid succeeding contract.\n     */\n    function setSucceedingContract(\n        address succeedingContract,\n        bool isValid\n    ) external;\n\n    /**\n     * @dev Function to set inbound asset registry for the adapter.\n     * @dev This registry keeps track of all the acceptable incoming assets, ensuring that the\n     * adapter only processes predefined asset types.\n     * @param asset Address of the asset.\n     * @param isValid Boolean value suggesting if this is a valid inbound asset.\n     */\n    function setInboundAsset(address asset, bool isValid) external;\n\n    /**\n     * @dev Function to set outbound asset registry for the adapter.\n     * @dev It manages the types of assets that the adapter is allowed to output, thus controlling\n     * the flow’s output and maintaining consistency.\n     * @param asset Address of the asset.\n     * @param isValid Boolean value suggesting if this is a valid inbound asset.\n     */\n    function setOutboundAsset(address asset, bool isValid) external;\n}\n"
      },
      "@routerprotocol/intents-core/contracts/interfaces/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\ninterface IERC20 {\n    function name() external view returns (string memory);\n\n    function symbol() external view returns (string memory);\n\n    function decimals() external view returns (uint8);\n\n    function totalSupply() external view returns (uint256 supply);\n\n    function balanceOf(address _owner) external view returns (uint256 balance);\n\n    function transfer(\n        address _to,\n        uint256 _value\n    ) external returns (bool success);\n\n    function transferFrom(\n        address _from,\n        address _to,\n        uint256 _value\n    ) external returns (bool success);\n\n    function approve(\n        address _spender,\n        uint256 _value\n    ) external returns (bool success);\n\n    function allowance(\n        address _owner,\n        address _spender\n    ) external view returns (uint256 remaining);\n\n    event Approval(\n        address indexed _owner,\n        address indexed _spender,\n        uint256 _value\n    );\n}\n"
      },
      "@routerprotocol/intents-core/contracts/interfaces/IWETH.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport {IERC20} from \"../utils/SafeERC20.sol\";\n\nabstract contract IWETH {\n    function allowance(address, address) public view virtual returns (uint256);\n\n    function balanceOf(address) public view virtual returns (uint256);\n\n    function approve(address, uint256) public virtual;\n\n    function transfer(address, uint256) public virtual returns (bool);\n\n    function transferFrom(\n        address,\n        address,\n        uint256\n    ) public virtual returns (bool);\n\n    function deposit() public payable virtual;\n\n    function withdraw(uint256) public virtual;\n}\n"
      },
      "@routerprotocol/intents-core/contracts/RouterIntentEoaAdapter.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport {BaseAdapter} from \"./BaseAdapter.sol\";\nimport {EoaExecutorWithDataProvider, EoaExecutorWithoutDataProvider} from \"./utils/EoaExecutor.sol\";\n\nabstract contract RouterIntentEoaAdapterWithDataProvider is\n    BaseAdapter,\n    EoaExecutorWithDataProvider\n{\n    constructor(\n        address __native,\n        address __wnative,\n        address __owner\n    )\n        BaseAdapter(__native, __wnative, true, __owner)\n    // solhint-disable-next-line no-empty-blocks\n    {\n\n    }\n}\n\nabstract contract RouterIntentEoaAdapterWithoutDataProvider is\n    BaseAdapter,\n    EoaExecutorWithoutDataProvider\n{\n    constructor(\n        address __native,\n        address __wnative\n    )\n        BaseAdapter(__native, __wnative, false, address(0))\n    // solhint-disable-next-line no-empty-blocks\n    {\n\n    }\n}\n"
      },
      "@routerprotocol/intents-core/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nlibrary Address {\n    //insufficient balance\n    error InsufficientBalance(uint256 available, uint256 required);\n    //unable to send value, recipient may have reverted\n    error SendingValueFail();\n    //insufficient balance for call\n    error InsufficientBalanceForCall(uint256 available, uint256 required);\n    //call to non-contract\n    error NonContractCall();\n\n    function isContract(address account) internal view returns (bool) {\n        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\n        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\n        // for accounts without code, i.e. `keccak256('')`\n        bytes32 codehash;\n        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            codehash := extcodehash(account)\n        }\n        return (codehash != accountHash && codehash != 0x0);\n    }\n\n    function sendValue(address payable recipient, uint256 amount) internal {\n        uint256 balance = address(this).balance;\n        if (balance < amount) {\n            revert InsufficientBalance(balance, amount);\n        }\n\n        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        if (!(success)) {\n            revert SendingValueFail();\n        }\n    }\n\n    function functionCall(\n        address target,\n        bytes memory data\n    ) internal returns (bytes memory) {\n        return functionCall(target, data, \"Address: low-level call failed\");\n    }\n\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return _functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value\n    ) internal returns (bytes memory) {\n        return\n            functionCallWithValue(\n                target,\n                data,\n                value,\n                \"Address: low-level call with value failed\"\n            );\n    }\n\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        uint256 balance = address(this).balance;\n        if (balance < value) {\n            revert InsufficientBalanceForCall(balance, value);\n        }\n        return _functionCallWithValue(target, data, value, errorMessage);\n    }\n\n    function _functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 weiValue,\n        string memory errorMessage\n    ) private returns (bytes memory) {\n        if (!(isContract(target))) {\n            revert NonContractCall();\n        }\n\n        // solhint-disable-next-line avoid-low-level-calls\n        (bool success, bytes memory returndata) = target.call{value: weiValue}(\n            data\n        );\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"
      },
      "@routerprotocol/intents-core/contracts/utils/EoaExecutor.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nabstract contract EoaExecutorWithDataProvider {\n    /**\n     * @dev function to execute an action on an adapter used in an EOA.\n     * @param precedingAdapter Address of the preceding adapter.\n     * @param succeedingAdapter Address of the succeeding adapter.\n     * @param data inputs data.\n     * @return tokens to be refunded to user at the end of tx.\n     */\n    function execute(\n        address precedingAdapter,\n        address succeedingAdapter,\n        bytes calldata data\n    ) external payable virtual returns (address[] memory tokens);\n}\n\nabstract contract EoaExecutorWithoutDataProvider {\n    /**\n     * @dev function to execute an action on an adapter used in an EOA.\n     * @param data inputs data.\n     * @return tokens to be refunded to user at the end of tx.\n     */\n    function execute(\n        bytes calldata data\n    ) external payable virtual returns (address[] memory tokens);\n}\n"
      },
      "@routerprotocol/intents-core/contracts/utils/Errors.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.18;\n\n/**\n * @title Errors library\n * @author Router Intents Error\n * @notice Defines the error messages emitted by the contracts on Router Intents\n */\nlibrary Errors {\n    string public constant ARRAY_LENGTH_MISMATCH = \"1\"; // 'Array lengths mismatch'\n    string public constant INSUFFICIENT_NATIVE_FUNDS_PASSED = \"2\"; // 'Insufficient native tokens passed'\n    string public constant WRONG_BATCH_PROVIDED = \"3\"; // 'The targetLength, valueLength, callTypeLength, funcLength do not match in executeBatch transaction functions in batch transaction contract'\n    string public constant INVALID_CALL_TYPE = \"4\"; // 'The callType value can only be 1 (call)' and 2(delegatecall)'\n    string public constant ONLY_NITRO = \"5\"; // 'Only nitro can call this function'\n    string public constant ONLY_SELF = \"6\"; // 'Only the current contract can call this function'\n    string public constant ADAPTER_NOT_WHITELISTED = \"7\"; // 'Adapter not whitelisted'\n}\n"
      },
      "@routerprotocol/intents-core/contracts/utils/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\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    error ReentrantCall();\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        if (_status == _ENTERED) {\n            revert ReentrantCall();\n        }\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"
      },
      "@routerprotocol/intents-core/contracts/utils/SafeERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport {IERC20} from \"../interfaces/IERC20.sol\";\nimport {Address} from \"./Address.sol\";\nimport {SafeMath} from \"./SafeMath.sol\";\n\nlibrary SafeERC20 {\n    using SafeMath for uint256;\n    using Address for address;\n\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        _callOptionalReturn(\n            token,\n            abi.encodeWithSelector(token.transfer.selector, to, value)\n        );\n    }\n\n    function safeTransferFrom(\n        IERC20 token,\n        address from,\n        address to,\n        uint256 value\n    ) internal {\n        _callOptionalReturn(\n            token,\n            abi.encodeWithSelector(token.transferFrom.selector, from, to, value)\n        );\n    }\n\n    /// @dev Edited so it always first approves 0 and then the value, because of non standard tokens\n    function safeApprove(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        _callOptionalReturn(\n            token,\n            abi.encodeWithSelector(token.approve.selector, spender, 0)\n        );\n        _callOptionalReturn(\n            token,\n            abi.encodeWithSelector(token.approve.selector, spender, value)\n        );\n    }\n\n    function safeIncreaseAllowance(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        uint256 newAllowance = token.allowance(address(this), spender).add(\n            value\n        );\n        _callOptionalReturn(\n            token,\n            abi.encodeWithSelector(\n                token.approve.selector,\n                spender,\n                newAllowance\n            )\n        );\n    }\n\n    function safeDecreaseAllowance(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        uint256 newAllowance = token.allowance(address(this), spender).sub(\n            value,\n            \"SafeERC20: decreased allowance below zero\"\n        );\n        _callOptionalReturn(\n            token,\n            abi.encodeWithSelector(\n                token.approve.selector,\n                spender,\n                newAllowance\n            )\n        );\n    }\n\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        bytes memory returndata = address(token).functionCall(\n            data,\n            \"SafeERC20: low-level call failed\"\n        );\n        if (returndata.length > 0) {\n            // Return data is optional\n            // solhint-disable-next-line max-line-length\n            require(\n                abi.decode(returndata, (bool)),\n                \"SafeERC20: operation failed\"\n            );\n        }\n    }\n}\n"
      },
      "@routerprotocol/intents-core/contracts/utils/SafeMath.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nlibrary SafeMath {\n    function add(uint256 a, uint256 b) internal pure returns (uint256) {\n        uint256 c = a + b;\n        require(c >= a, \"SafeMath: addition overflow\");\n\n        return c;\n    }\n\n    function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n        return sub(a, b, \"SafeMath: subtraction overflow\");\n    }\n\n    function sub(\n        uint256 a,\n        uint256 b,\n        string memory errorMessage\n    ) internal pure returns (uint256) {\n        require(b <= a, errorMessage);\n        uint256 c = a - b;\n\n        return c;\n    }\n\n    function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n        // benefit is lost if 'b' is also tested.\n        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n        if (a == 0) {\n            return 0;\n        }\n\n        uint256 c = a * b;\n        require(c / a == b, \"SafeMath: mul overflow\");\n\n        return c;\n    }\n\n    function div(uint256 a, uint256 b) internal pure returns (uint256) {\n        return div(a, b, \"SafeMath: division by zero\");\n    }\n\n    function div(\n        uint256 a,\n        uint256 b,\n        string memory errorMessage\n    ) internal pure returns (uint256) {\n        require(b > 0, errorMessage);\n        uint256 c = a / b;\n        // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n        return c;\n    }\n\n    function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n        return mod(a, b, \"SafeMath: modulo by zero\");\n    }\n\n    function mod(\n        uint256 a,\n        uint256 b,\n        string memory errorMessage\n    ) internal pure returns (uint256) {\n        require(b != 0, errorMessage);\n        return a % b;\n    }\n}\n"
      },
      "contracts/Errors.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nlibrary Errors {\n    string public constant AMOUNT_CANNOT_BE_ZERO = \"1\";\n    string public constant RECIPIENT_CANNOT_BE_ZERO = \"2\";\n    string public constant AMOUNT_RECEIVED_CANNOT_BE_ZERO = \"3\";\n    string public constant RESTAKED_ETH_RECEIVED_AMOUNT_LESS_THAN_MIN_RETURN =\n        \"4\";\n    string public constant ONLY_EMERGENCY_OWNER = \"5\";\n    string public constant EMERGENCY_OWNER_CANNOT_BE_ZERO = \"6\";\n    string public constant WRONG_BATCH_PROVIDED = \"7\";\n    string public constant INSUFFICIENT_NATIVE_FUNDS_PASSED = \"8\";\n    string public constant ONLY_SELF = \"9\";\n    string public constant ARRAY_LENGTH_MISMATCH = \"10\";\n    string public constant INSUFFICIENT_FEE_PASSED = \"11\";\n    string public constant VOLUME_CANNOT_BE_ZERO = \"12\";\n    string public constant ONLY_NATIVE_TOKENS = \"13\";\n    string public constant ONLY_NITRO_BRIDGE = \"14\";\n    string public constant ONLY_WHITELISTED_BRIDGES = \"15\";\n    string public constant BRIDGE_ADAPTER_ADDRESS_CANNOT_BE_ZERO = \"16\";\n    string public constant MULTICALLER_ADDRESS_CANNOT_BE_ZERO = \"17\";\n    string public constant FEE_MANAGER_ADDRESS_CANNOT_BE_ZERO = \"18\";\n    string public constant SWAP_FAILED = \"19\";\n    string public constant ADAPTER_NOT_WHITELISTED = \"20\";\n    string public constant BRIDGE_TX_FAILED_ON_MULTICALL = \"21\";\n    string public constant TOKEN_PASSED_CANNOT_BE_NULL_ADDRESS = \"22\";\n    string public constant ADAPTER_ADDRESS_CANNOT_BE_ZERO = \"23\";\n    string public constant ADAPTER_TYPE_CAN_BE_EITHER_1_OR_2 = \"24\";\n    string public constant FEE_TRANSFER_FAILED = \"25\";\n    string public constant AMOUNT_LESSER_THAN_MIN_DEPOSIT = \"26\";\n    string public constant ARRAY_LENGTH_ZERO = \"27\";\n    string public constant REFUND_AMOUNT_ZERO = \"28\";\n    string public constant INVALID_RESTAKING_PROTOCOL_TYPE = \"29\";\n    string public constant INVALID_PROTOCOL_DATA = \"30\";\n    string public constant BASE_GAS_NOT_IN_RANGE = \"31\";\n    string public constant MARGINAL_GAS_PER_USER_NOT_IN_RANGE = \"32\";\n    string public constant FEE_TOO_LARGE = \"33\";\n    string public constant ZERO_DEPOSIT_FUNDS_FOR_THIS_PROTOCOL_ID = \"34\";\n    string public constant NOT_EXECUTABLE = \"35\";\n    string public constant PROTOCOL_DATA_NOT_SET = \"36\";\n    string public constant CANNOT_EXECUTE_LESSER_THAN_MIN_EXECUTABLE_BATCH =\n        \"37\";\n    string public constant MAX_FEE_PERCENTAGE_GREATER_THAN_CEILING = \"38\";\n    string public constant FUSION_TX_BUILDER_CANNOT_BE_ADDRESS_ZERO = \"39\";\n    string public constant PROTOCOL_IS_PAUSED = \"40\";\n    string public constant OPEN_OCEAN_ADDRESS_CANNOT_BE_ZERO = \"41\";\n    string public constant BRIDGE_ADDRESS_CANNOT_BE_ZERO = \"42\";\n    string public constant WNATIVE_ADDRESS_CANNOT_BE_ZERO = \"43\";\n    string public constant CHAIN_LINK_GAS_PRICE_ORACLE_ADDRESS_CANNOT_BE_ZERO =\n        \"44\";\n    string public constant STAKE_EASE_FEE_MANAGER_ADDRESS_CANNOT_BE_ZERO = \"45\";\n    string public constant PROTOCOL_GAS_PER_USER_OUT_OF_RANGE = \"46\";\n    string public constant GAS_PRICE_EXCEEDS_FAST_GAS_RANGE = \"47\";\n    string public constant AMOUNT_TO_RESTAKE_CANNOT_BE_ZERO = \"48\";\n    string public constant UNSUPPORTED_OPERATION = \"49\";\n    string public constant CANNOT_SET_ALL_DATA_FOR_PROTOCOL_AGAIN = \"50\";\n    string public constant INVALID_ASSET = \"51\";\n    string public constant CANNOT_SET_NEW_PROTOCOL_DATA_WITH_UPDATE_FUNCTION =\n        \"52\";\n    string public constant OFT_ADAPTER_NOT_FOUND = \"53\";\n}\n"
      },
      "contracts/interfaces/IFeeManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\n/**\n * @title IFeeManager\n * @author StakeEase\n * @notice Interface for FeeManager contract for StakeEase.\n */\n\ninterface IFeeManager {\n    /**\n     * @notice Function to fetch the amount of fee.\n     * @param txVolume Volume of transaction in ETH.\n     * @return fee to be deducted in ETH.\n     */\n    function getFee(uint256 txVolume) external view returns (uint256);\n}\n"
      },
      "contracts/interfaces/ILzOft.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\ninterface ILzOft {\n    /**\n     * @dev Struct representing token parameters for the OFT send() operation.\n     */\n    struct SendParam {\n        uint32 dstEid; // Destination endpoint ID.\n        bytes32 to; // Recipient address.\n        uint256 amountLD; // Amount to send in local decimals.\n        uint256 minAmountLD; // Minimum amount to send in local decimals.\n        bytes extraOptions; // Additional options supplied by the caller to be used in the LayerZero message.\n        bytes composeMsg; // The composed message for the send() operation.\n        bytes oftCmd; // The OFT command to be executed, unused in default OFT implementations.\n    }\n\n    struct MessagingFee {\n        uint256 nativeFee;\n        uint256 lzTokenFee;\n    }\n\n    struct MessagingReceipt {\n        bytes32 guid;\n        uint64 nonce;\n        MessagingFee fee;\n    }\n\n    /**\n     * @dev Struct representing OFT receipt information.\n     */\n    struct OFTReceipt {\n        uint256 amountSentLD; // Amount of tokens ACTUALLY debited from the sender in local decimals.\n        // @dev In non-default implementations, the amountReceivedLD COULD differ from this value.\n        uint256 amountReceivedLD; // Amount of tokens to be received on the remote side.\n    }\n\n    /**\n     * @notice Executes the send() operation.\n     * @param _sendParam The parameters for the send operation.\n     * @param _fee The fee information supplied by the caller.\n     *      - nativeFee: The native fee.\n     *      - lzTokenFee: The lzToken fee.\n     * @param _refundAddress The address to receive any excess funds from fees etc. on the src.\n     * @return msgReceipt The LayerZero messaging receipt from the send() operation.\n     * @return oftReceipt The OFT receipt information.\n     *\n     * @dev MessagingReceipt: LayerZero msg receipt\n     *  - guid: The unique identifier for the sent message.\n     *  - nonce: The nonce of the sent message.\n     *  - fee: The LayerZero fee incurred for the message.\n     */\n    function send(\n        SendParam calldata _sendParam,\n        MessagingFee calldata _fee,\n        address _refundAddress\n    )\n        external\n        payable\n        returns (\n            MessagingReceipt memory msgReceipt,\n            OFTReceipt memory oftReceipt\n        );\n\n    /**\n     * @notice Provides a quote for the send() operation.\n     * @param _sendParam The parameters for the send() operation.\n     * @param _payInLzToken Flag indicating whether the caller is paying in the LZ token.\n     * @return fee The calculated LayerZero messaging fee from the send() operation.\n     *\n     * @dev MessagingFee: LayerZero msg fee\n     *  - nativeFee: The native fee.\n     *  - lzTokenFee: The lzToken fee.\n     */\n    function quoteSend(\n        SendParam calldata _sendParam,\n        bool _payInLzToken\n    ) external view returns (MessagingFee memory);\n\n    function decimalConversionRate() external view returns (uint256);\n}\n"
      },
      "contracts/interfaces/IPrimeLrtPool.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\ninterface IPrimeLrtPool {\n    /**\n     * @notice View amount of primeETH to mint for given asset amount\n     * @param asset Asset address\n     * @param amount Asset amount\n     * @return primeEthAmount Amount of primeETH to mint\n     */\n    function getMintAmount(\n        address asset,\n        uint256 amount\n    ) external view returns (uint256 primeEthAmount);\n\n    /**\n     * @notice helps user stake LST to the protocol\n     * @param asset LST asset address to stake\n     * @param depositAmount LST asset amount to stake\n     * @param minPrimeETH Minimum amount of primeETH to receive\n     */\n    function depositAsset(\n        address asset,\n        uint256 depositAmount,\n        uint256 minPrimeETH,\n        string calldata referralId\n    ) external;\n\n    /// @notice gets the current limit of asset deposit\n    /// @param asset Asset address\n    /// @return currentLimit Current limit of asset deposit\n    function getAssetCurrentLimit(\n        address asset\n    ) external view returns (uint256);\n}\n"
      },
      "contracts/interfaces/IStader.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\ninterface IStader {\n    /**\n     * @notice Function to stake ETH on Stader to receive ETHx.\n     * @param _receiver Address of the recipient.\n     * @param _referralId Address of the recipient.\n     */\n    function deposit(\n        address _receiver,\n        string calldata _referralId\n    ) external payable returns (uint256);\n}\n"
      },
      "contracts/interfaces/IWETH.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\ninterface IWETH {\n    function deposit() external payable;\n\n    function withdraw(uint256 amount) external;\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(\n        address indexed owner,\n        address indexed spender,\n        uint256 value\n    );\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) 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(\n        address owner,\n        address spender\n    ) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * 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 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 value\n    ) external returns (bool);\n}\n"
      },
      "contracts/restaking/PrimeStakedAdapter.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport {IStader} from \"../interfaces/IStader.sol\";\nimport {EoaExecutorWithoutDataProvider} from \"@routerprotocol/intents-core/contracts/RouterIntentEoaAdapter.sol\";\nimport {Errors} from \"../Errors.sol\";\nimport {IERC20, SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {IPrimeLrtPool} from \"../interfaces/IPrimeLrtPool.sol\";\nimport {ILzOft} from \"../interfaces/ILzOft.sol\";\nimport {IWETH} from \"../interfaces/IWETH.sol\";\nimport {RestakingAdapterBase} from \"./RestakingAdapterBase.sol\";\n\n/**\n * @title PrimeStakedAdapter\n * @author StakeEase\n */\ncontract PrimeStakedAdapter is RestakingAdapterBase {\n    using SafeERC20 for IERC20;\n\n    string public constant PRIME_STAKED_REFERRAL_ID =\n        \"xiq55YBy1859MUYn1YCJq4Myw8P\";\n\n    IPrimeLrtPool public immutable lrtDepositPool;\n    IERC20 public immutable primeEth;\n\n    constructor(\n        address _native,\n        address _wnative,\n        address _feeManager,\n        address _lrtDepositPool,\n        address _primeEth\n    ) RestakingAdapterBase(_native, _wnative, _feeManager) {\n        lrtDepositPool = IPrimeLrtPool(_lrtDepositPool);\n        primeEth = IERC20(_primeEth);\n    }\n\n    function name() public pure override returns (string memory) {\n        return \"PrimeStakedAdapter\";\n    }\n\n    /**\n     * @inheritdoc EoaExecutorWithoutDataProvider\n     */\n    function execute(\n        bytes calldata data\n    ) external payable override returns (address[] memory) {\n        (\n            address asset,\n            address recipient,\n            uint256 amount,\n            uint256 minReceive\n        ) = parseInput(data);\n\n        bool isNativeAsset = asset == native();\n\n        if (address(this) == self()) {\n            if (isNativeAsset) amount = msg.value;\n            else {\n                IERC20(asset).safeTransferFrom(msg.sender, self(), amount);\n                amount = IERC20(asset).balanceOf(self());\n            }\n        } else if (amount == type(uint256).max) {\n            if (isNativeAsset) amount = address(this).balance;\n            else amount = IERC20(asset).balanceOf(address(this));\n        }\n\n        if (isNativeAsset) {\n            IWETH(wnative()).deposit{value: amount}();\n            asset = wnative();\n        }\n\n        require(amount != 0, Errors.AMOUNT_CANNOT_BE_ZERO);\n\n        uint256 fee = feeManager.getFee(amount);\n\n        if (fee != 0) {\n            amount = amount - fee;\n            if (isNativeAsset) payable(address(feeManager)).transfer(fee);\n            else IERC20(asset).safeTransfer(address(feeManager), fee);\n        }\n\n        return _restakeOnPrimeStaked(asset, recipient, fee, amount, minReceive);\n    }\n\n    function _restakeOnPrimeStaked(\n        address asset,\n        address recipient,\n        uint256 fee,\n        uint256 amount,\n        uint256 minReceive\n    ) internal returns (address[] memory) {\n        uint256 primeEthBalBefore = primeEth.balanceOf(address(this));\n\n        IERC20(asset).safeIncreaseAllowance(address(lrtDepositPool), amount);\n\n        lrtDepositPool.depositAsset(\n            asset,\n            amount,\n            minReceive,\n            PRIME_STAKED_REFERRAL_ID\n        );\n\n        uint256 primeEthReceived = primeEth.balanceOf(address(this)) -\n            primeEthBalBefore;\n\n        if (primeEthReceived < minReceive)\n            revert(Errors.RESTAKED_ETH_RECEIVED_AMOUNT_LESS_THAN_MIN_RETURN);\n\n        if (recipient != address(this))\n            primeEth.safeTransfer(recipient, primeEthReceived);\n\n        emit RestakingSuccessful(\n            self(),\n            recipient,\n            asset,\n            fee,\n            amount,\n            primeEthReceived\n        );\n\n        address[] memory tokens = new address[](1);\n        tokens[0] = address(primeEth);\n\n        return tokens;\n    }\n\n    function parseInput(\n        bytes memory data\n    ) internal pure returns (address, address, uint256, uint256) {\n        (\n            address asset,\n            address recipient,\n            uint256 amount,\n            uint256 minReceive\n        ) = abi.decode(data, (address, address, uint256, uint256));\n\n        return (asset, recipient, amount, minReceive);\n    }\n}\n"
      },
      "contracts/restaking/RestakingAdapterBase.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport {RouterIntentEoaAdapterWithoutDataProvider} from \"@routerprotocol/intents-core/contracts/RouterIntentEoaAdapter.sol\";\nimport {IFeeManager} from \"../interfaces/IFeeManager.sol\";\n\n/**\n * @title RestakingAdapterBase\n * @author StakeEase\n */\nabstract contract RestakingAdapterBase is\n    RouterIntentEoaAdapterWithoutDataProvider\n{\n    IFeeManager public immutable feeManager;\n\n    event RestakingSuccessful(\n        address indexed adapter,\n        address indexed recipient,\n        address stakingAsset,\n        uint256 fee,\n        uint256 amount,\n        uint256 receivedAmount\n    );\n\n    constructor(\n        address _native,\n        address _wnative,\n        address _feeManager\n    ) payable RouterIntentEoaAdapterWithoutDataProvider(_native, _wnative) {\n        feeManager = IFeeManager(_feeManager);\n    }\n\n    // solhint-disable-next-line no-empty-blocks\n    receive() external payable {}\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 1000
      },
      "evmVersion": "paris",
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "metadata": {
        "useLiteralContent": true
      },
      "libraries": {}
    }
  }}