creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\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 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(address owner, address spender) 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(address from, address to, uint256 value) external returns (bool);\n}\n"
      },
      "chainflip-eth/interfaces/IAggKeyNonceConsumer.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IShared.sol\";\nimport \"./IKeyManager.sol\";\n\n/**\n * @title    AggKeyNonceConsumer interface\n */\n\ninterface IAggKeyNonceConsumer is IShared {\n    event UpdatedKeyManager(address keyManager);\n\n    //////////////////////////////////////////////////////////////\n    //                                                          //\n    //                  State-changing functions                //\n    //                                                          //\n    //////////////////////////////////////////////////////////////\n    /**\n     * @notice  Update KeyManager reference. Used if KeyManager contract is updated\n     * @param sigData    Struct containing the signature data over the message\n     *                   to verify, signed by the aggregate key.\n     * @param keyManager New KeyManager's address\n     * @param omitChecks Allow the omission of the extra checks in a special case\n     */\n    function updateKeyManager(SigData calldata sigData, IKeyManager keyManager, bool omitChecks) external;\n\n    //////////////////////////////////////////////////////////////\n    //                                                          //\n    //                          Getters                         //\n    //                                                          //\n    //////////////////////////////////////////////////////////////\n\n    /**\n     * @notice  Get the KeyManager address/interface that's used to validate sigs\n     * @return  The KeyManager (IKeyManager)\n     */\n    function getKeyManager() external view returns (IKeyManager);\n}\n"
      },
      "chainflip-eth/interfaces/IGovernanceCommunityGuarded.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IShared.sol\";\n\n/**\n * @title    GovernanceCommunityGuarded interface\n */\n\ninterface IGovernanceCommunityGuarded is IShared {\n    event CommunityGuardDisabled(bool communityGuardDisabled);\n    event Suspended(bool suspended);\n\n    //////////////////////////////////////////////////////////////\n    //                                                          //\n    //                  State-changing functions                //\n    //                                                          //\n    //////////////////////////////////////////////////////////////\n    /**\n     * @notice  Enable Community Guard\n     */\n\n    function enableCommunityGuard() external;\n\n    /**\n     * @notice  Disable Community Guard\n     */\n    function disableCommunityGuard() external;\n\n    /**\n     * @notice  Can be used to suspend contract execution - only executable by\n     *          governance and only to be used in case of emergency.\n     */\n    function suspend() external;\n\n    /**\n     * @notice      Resume contract execution\n     */\n    function resume() external;\n\n    //////////////////////////////////////////////////////////////\n    //                                                          //\n    //                          Getters                         //\n    //                                                          //\n    //////////////////////////////////////////////////////////////\n\n    /**\n     * @notice  Get the Community Key\n     * @return  The CommunityKey\n     */\n    function getCommunityKey() external view returns (address);\n\n    /**\n     * @notice  Get the Community Guard state\n     * @return  The Community Guard state\n     */\n    function getCommunityGuardDisabled() external view returns (bool);\n\n    /**\n     * @notice  Get suspended state\n     * @return  The suspended state\n     */\n    function getSuspendedState() external view returns (bool);\n\n    /**\n     * @notice  Get governor address\n     * @return  The governor address\n     */\n    function getGovernor() external view returns (address);\n}\n"
      },
      "chainflip-eth/interfaces/IKeyManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IShared.sol\";\n\n/**\n * @title    KeyManager interface\n * @notice   The interface for functions KeyManager implements\n */\ninterface IKeyManager is IShared {\n    event AggKeySetByAggKey(Key oldAggKey, Key newAggKey);\n    event AggKeySetByGovKey(Key oldAggKey, Key newAggKey);\n    event GovKeySetByAggKey(address oldGovKey, address newGovKey);\n    event GovKeySetByGovKey(address oldGovKey, address newGovKey);\n    event CommKeySetByAggKey(address oldCommKey, address newCommKey);\n    event CommKeySetByCommKey(address oldCommKey, address newCommKey);\n    event SignatureAccepted(SigData sigData, address signer);\n    event GovernanceAction(bytes32 message);\n\n    //////////////////////////////////////////////////////////////\n    //                                                          //\n    //                  State-changing functions                //\n    //                                                          //\n    //////////////////////////////////////////////////////////////\n\n    function consumeKeyNonce(SigData memory sigData, bytes32 contractMsgHash) external;\n\n    function setAggKeyWithAggKey(SigData memory sigData, Key memory newAggKey) external;\n\n    function setAggKeyWithGovKey(Key memory newAggKey) external;\n\n    function setGovKeyWithAggKey(SigData calldata sigData, address newGovKey) external;\n\n    function setGovKeyWithGovKey(address newGovKey) external;\n\n    function setCommKeyWithAggKey(SigData calldata sigData, address newCommKey) external;\n\n    function setCommKeyWithCommKey(address newCommKey) external;\n\n    function govAction(bytes32 message) external;\n\n    //////////////////////////////////////////////////////////////\n    //                                                          //\n    //                  Non-state-changing functions            //\n    //                                                          //\n    //////////////////////////////////////////////////////////////\n\n    function getAggregateKey() external view returns (Key memory);\n\n    function getGovernanceKey() external view returns (address);\n\n    function getCommunityKey() external view returns (address);\n\n    function isNonceUsedByAggKey(uint256 nonce) external view returns (bool);\n\n    function getLastValidateTime() external view returns (uint256);\n}\n"
      },
      "chainflip-eth/interfaces/IMulticall.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IMulticall {\n    enum CallType {\n        Default,\n        FullTokenBalance,\n        FullNativeBalance,\n        CollectTokenBalance\n    }\n\n    struct Call {\n        CallType callType;\n        address target;\n        uint256 value;\n        bytes callData;\n        bytes payload;\n    }\n\n    error AlreadyRunning();\n    error CallFailed(uint256 callPosition, bytes reason);\n\n    function run(Call[] calldata calls, address tokenIn, uint256 amountIn) external payable;\n}\n"
      },
      "chainflip-eth/interfaces/IShared.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title    Shared interface\n * @notice   Holds structs needed by other interfaces\n */\ninterface IShared {\n    /**\n     * @dev  SchnorrSECP256K1 requires that each key has a public key part (x coordinate),\n     *       a parity for the y coordinate (0 if the y ordinate of the public key is even, 1\n     *       if it's odd)\n     */\n    struct Key {\n        uint256 pubKeyX;\n        uint8 pubKeyYParity;\n    }\n\n    /**\n     * @dev  Contains a signature and the nonce used to create it. Also the recovered address\n     *       to check that the signature is valid\n     */\n    struct SigData {\n        uint256 sig;\n        uint256 nonce;\n        address kTimesGAddress;\n    }\n\n    /**\n     * @param token The address of the token to be transferred\n     * @param recipient The address of the recipient of the transfer\n     * @param amount    The amount to transfer, in wei (uint)\n     */\n    struct TransferParams {\n        address token;\n        address payable recipient;\n        uint256 amount;\n    }\n\n    /**\n     * @param swapID    The unique identifier for this swap (bytes32), used for create2\n     * @param token     The token to be transferred\n     */\n    struct DeployFetchParams {\n        bytes32 swapID;\n        address token;\n    }\n\n    /**\n     * @param fetchContract   The address of the deployed Deposit contract\n     * @param token     The token to be transferred\n     */\n    struct FetchParams {\n        address payable fetchContract;\n        address token;\n    }\n}\n"
      },
      "chainflip-eth/interfaces/IVault.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IAggKeyNonceConsumer.sol\";\nimport \"./IGovernanceCommunityGuarded.sol\";\nimport \"./IMulticall.sol\";\n\n/**\n * @title    Vault interface\n * @notice   The interface for functions Vault implements\n */\ninterface IVault is IGovernanceCommunityGuarded, IAggKeyNonceConsumer {\n    event FetchedNative(address indexed sender, uint256 amount);\n\n    event TransferNativeFailed(address payable indexed recipient, uint256 amount);\n    event TransferTokenFailed(address payable indexed recipient, uint256 amount, address indexed token, bytes reason);\n\n    event SwapNative(\n        uint32 dstChain,\n        bytes dstAddress,\n        uint32 dstToken,\n        uint256 amount,\n        address indexed sender,\n        bytes cfParameters\n    );\n    event SwapToken(\n        uint32 dstChain,\n        bytes dstAddress,\n        uint32 dstToken,\n        address srcToken,\n        uint256 amount,\n        address indexed sender,\n        bytes cfParameters\n    );\n\n    /// @dev bytes parameters is not indexed because indexing a dynamic type for it to be filtered\n    ///      makes it so we won't be able to decode it unless we specifically search for it. If we want\n    ///      to filter it and decode it then we would need to have both the indexed and the non-indexed\n    ///      version in the event. That is unnecessary.\n    event XCallNative(\n        uint32 dstChain,\n        bytes dstAddress,\n        uint32 dstToken,\n        uint256 amount,\n        address indexed sender,\n        bytes message,\n        uint256 gasAmount,\n        bytes cfParameters\n    );\n    event XCallToken(\n        uint32 dstChain,\n        bytes dstAddress,\n        uint32 dstToken,\n        address srcToken,\n        uint256 amount,\n        address indexed sender,\n        bytes message,\n        uint256 gasAmount,\n        bytes cfParameters\n    );\n\n    event AddGasNative(bytes32 swapID, uint256 amount);\n    event AddGasToken(bytes32 swapID, uint256 amount, address token);\n\n    event ExecuteActionsFailed(\n        address payable indexed multicallAddress,\n        uint256 amount,\n        address indexed token,\n        bytes reason\n    );\n\n    function allBatch(\n        SigData calldata sigData,\n        DeployFetchParams[] calldata deployFetchParamsArray,\n        FetchParams[] calldata fetchParamsArray,\n        TransferParams[] calldata transferParamsArray\n    ) external;\n\n    function allBatchV2(\n        SigData calldata sigData,\n        FetchParams[] calldata fetchParamsArray,\n        TransferParams[] calldata transferParamsArray\n    ) external;\n\n    //////////////////////////////////////////////////////////////\n    //                                                          //\n    //                          Transfers                       //\n    //                                                          //\n    //////////////////////////////////////////////////////////////\n\n    function transfer(SigData calldata sigData, TransferParams calldata transferParams) external;\n\n    function transferFallback(SigData calldata sigData, TransferParams calldata transferParams) external;\n\n    function transferBatch(SigData calldata sigData, TransferParams[] calldata transferParamsArray) external;\n\n    //////////////////////////////////////////////////////////////\n    //                                                          //\n    //                        Fetch Deposits                    //\n    //                                                          //\n    //////////////////////////////////////////////////////////////\n\n    function deployAndFetchBatch(\n        SigData calldata sigData,\n        DeployFetchParams[] calldata deployFetchParamsArray\n    ) external;\n\n    function fetchBatch(SigData calldata sigData, FetchParams[] calldata fetchParamsArray) external;\n\n    //////////////////////////////////////////////////////////////\n    //                                                          //\n    //         Initiate cross-chain swaps (source chain)        //\n    //                                                          //\n    //////////////////////////////////////////////////////////////\n\n    function xSwapToken(\n        uint32 dstChain,\n        bytes calldata dstAddress,\n        uint32 dstToken,\n        IERC20 srcToken,\n        uint256 amount,\n        bytes calldata cfParameters\n    ) external;\n\n    function xSwapNative(\n        uint32 dstChain,\n        bytes calldata dstAddress,\n        uint32 dstToken,\n        bytes calldata cfParameters\n    ) external payable;\n\n    //////////////////////////////////////////////////////////////\n    //                                                          //\n    //     Initiate cross-chain call and swap (source chain)    //\n    //                                                          //\n    //////////////////////////////////////////////////////////////\n\n    function xCallNative(\n        uint32 dstChain,\n        bytes calldata dstAddress,\n        uint32 dstToken,\n        bytes calldata message,\n        uint256 gasAmount,\n        bytes calldata cfParameters\n    ) external payable;\n\n    function xCallToken(\n        uint32 dstChain,\n        bytes calldata dstAddress,\n        uint32 dstToken,\n        bytes calldata message,\n        uint256 gasAmount,\n        IERC20 srcToken,\n        uint256 amount,\n        bytes calldata cfParameters\n    ) external;\n\n    //////////////////////////////////////////////////////////////\n    //                                                          //\n    //                     Gas topups                           //\n    //                                                          //\n    //////////////////////////////////////////////////////////////\n\n    function addGasNative(bytes32 swapID) external payable;\n\n    function addGasToken(bytes32 swapID, uint256 amount, IERC20 token) external;\n\n    //////////////////////////////////////////////////////////////\n    //                                                          //\n    //      Execute cross-chain call and swap (dest. chain)     //\n    //                                                          //\n    //////////////////////////////////////////////////////////////\n\n    function executexSwapAndCall(\n        SigData calldata sigData,\n        TransferParams calldata transferParams,\n        uint32 srcChain,\n        bytes calldata srcAddress,\n        bytes calldata message\n    ) external;\n\n    //////////////////////////////////////////////////////////////\n    //                                                          //\n    //          Execute cross-chain call (dest. chain)          //\n    //                                                          //\n    //////////////////////////////////////////////////////////////\n    function executexCall(\n        SigData calldata sigData,\n        address recipient,\n        uint32 srcChain,\n        bytes calldata srcAddress,\n        bytes calldata message\n    ) external;\n\n    //////////////////////////////////////////////////////////////\n    //                                                          //\n    //                 Auxiliary chain actions                  //\n    //                                                          //\n    //////////////////////////////////////////////////////////////\n\n    function executeActions(\n        SigData calldata sigData,\n        TransferParams calldata transferParams,\n        IMulticall.Call[] calldata calls,\n        uint256 gasMulticall\n    ) external;\n\n    //////////////////////////////////////////////////////////////\n    //                                                          //\n    //                        Governance                        //\n    //                                                          //\n    //////////////////////////////////////////////////////////////\n\n    function govWithdraw(address[] calldata tokens) external;\n}\n"
      },
      "contracts/ArbCfUni.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity =0.8.24;\npragma abicoder v2;\n\nimport '../v3-periphery/contracts/interfaces/ISwapRouter.sol';\nimport '../v3-periphery/contracts/interfaces/external/IWETH9.sol';\nimport '../chainflip-eth/interfaces/IVault.sol';\n\ncontract ArbCfUni {\n   ISwapRouter constant swapRouter = ISwapRouter(0xE592427A0AEce92De3Edee1F18E0157C05861564);\n   IVault constant vault = IVault(0xF5e10380213880111522dd0efD3dbb45b9f62Bcc);\n   address constant FLIP = 0x826180541412D574cf1336d22c0C0a287822678A;\n   address constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n   receive() external payable {}\n\n   function swapTokens() external payable {\n      IWETH9(WETH).deposit{ value: msg.value }();\n      IWETH9(WETH).transfer(address(this), msg.value);\n      IWETH9(WETH).approve(address(swapRouter), msg.value);\n\n      ISwapRouter.ExactInputSingleParams memory params =\n         ISwapRouter.ExactInputSingleParams({\n            tokenIn: WETH,\n            tokenOut: FLIP,\n            fee: 3000,\n            recipient: address(this),\n            deadline: block.timestamp,\n            amountIn: msg.value,\n            amountOutMinimum: 0,\n            sqrtPriceLimitX96: 0\n         });\n\n      uint256 amountOut = swapRouter.exactInputSingle(params);\n\n      IERC20(FLIP).approve(address(vault), amountOut);\n\n      vault.xSwapToken(\n         1,\n         abi.encodePacked(msg.sender),\n         1,\n         IERC20(FLIP),\n         amountOut,\n         \"\");\n   }\n}\n"
      },
      "v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#swap\n/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface\ninterface IUniswapV3SwapCallback {\n    /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.\n    /// @dev In the implementation you must pay the pool tokens owed for the swap.\n    /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n    /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\n    /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\n    /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\n    /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\n    /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\n    /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call\n    function uniswapV3SwapCallback(\n        int256 amount0Delta,\n        int256 amount1Delta,\n        bytes calldata data\n    ) external;\n}\n"
      },
      "v3-periphery/contracts/interfaces/external/IWETH9.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.15 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\n/// @title Interface for WETH9\ninterface IWETH9 is IERC20 {\n    /// @notice Deposit ether to get wrapped ether\n    function deposit() external payable;\n\n    /// @notice Withdraw wrapped ether to get ether\n    function withdraw(uint256) external;\n}\n"
      },
      "v3-periphery/contracts/interfaces/ISwapRouter.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\npragma abicoder v2;\n\nimport '../../../v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface ISwapRouter is IUniswapV3SwapCallback {\n    struct ExactInputSingleParams {\n        address tokenIn;\n        address tokenOut;\n        uint24 fee;\n        address recipient;\n        uint256 deadline;\n        uint256 amountIn;\n        uint256 amountOutMinimum;\n        uint160 sqrtPriceLimitX96;\n    }\n\n    /// @notice Swaps `amountIn` of one token for as much as possible of another token\n    /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\n    /// @return amountOut The amount of the received token\n    function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n    struct ExactInputParams {\n        bytes path;\n        address recipient;\n        uint256 deadline;\n        uint256 amountIn;\n        uint256 amountOutMinimum;\n    }\n\n    /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n    /// @return amountOut The amount of the received token\n    function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n\n    struct ExactOutputSingleParams {\n        address tokenIn;\n        address tokenOut;\n        uint24 fee;\n        address recipient;\n        uint256 deadline;\n        uint256 amountOut;\n        uint256 amountInMaximum;\n        uint160 sqrtPriceLimitX96;\n    }\n\n    /// @notice Swaps as little as possible of one token for `amountOut` of another token\n    /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata\n    /// @return amountIn The amount of the input token\n    function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);\n\n    struct ExactOutputParams {\n        bytes path;\n        address recipient;\n        uint256 deadline;\n        uint256 amountOut;\n        uint256 amountInMaximum;\n    }\n\n    /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)\n    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata\n    /// @return amountIn The amount of the input token\n    function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);\n}\n"
      }
    },
    "settings": {
      "evmVersion": "paris",
      "optimizer": {
        "enabled": false,
        "runs": 200
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      }
    }
  }}