Contract 0xa3A9664532E063A9D8188B515ef7F1BcB8583bBD 3

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x008ff09ef5593cc5d027982849bdcca9b586b9ff969b4bb2600ed67e3934935dConvert Exact Et...46342462022-01-14 8:29:4114 days 2 hrs ago0x7e1d0353063f01cffa92f4a9c8a100cfe37d8264 IN  0xa3a9664532e063a9d8188b515ef7f1bcb8583bbd0.001 ETH0.00133451292 ETH
0x6a9c58f2fbbf1e12ea86cc64e0f03cb46b4d2f75048ebbc2f00362d4fa696eab0x6080604046341732022-01-14 8:24:0414 days 2 hrs ago0x7e1d0353063f01cffa92f4a9c8a100cfe37d8264 IN  Create: SwapEthDaiTool0 ETH0.009735578279 ETH
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SwapEthDaiTool

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license
/**
 *Submitted for verification at arbiscan.io on 2022-01-14
*/

// File: @uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol


pragma solidity >=0.5.0;

/// @title Callback for IUniswapV3PoolActions#swap
/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface
interface IUniswapV3SwapCallback 
{
    /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
    /// @dev In the implementation you must pay the pool tokens owed for the swap.
    /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.
    /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.
    /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
    /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
    /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call
    function uniswapV3SwapCallback
    (
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata data
    ) external;
}

// File: https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/interfaces/ISwapRouter.sol


pragma solidity >=0.7.5;
pragma abicoder v2;


/// @title Router token swapping functionality
/// @notice Functions for swapping tokens via Uniswap V3
interface ISwapRouter is IUniswapV3SwapCallback 
{
    struct ExactInputSingleParams 
    {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);

    struct ExactInputParams 
    {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);

    struct ExactOutputSingleParams 
    {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);

    struct ExactOutputParams 
    {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}

// File: contracts/swapEthDaiArbirum.sol

pragma solidity =0.7.6;


interface IUniswapRouter is ISwapRouter 
{
    function refundETH() 
        external 
        payable;
}

contract SwapEthDaiTool 
{
  // Kovan Addresses
  IUniswapRouter public constant uniswapRouter = IUniswapRouter(0xE592427A0AEce92De3Edee1F18E0157C05861564);
  // address private constant multiDaiKovan = 0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa;
  // address private constant WETH9 = 0xd0A1E359811322d97991E03f863a0C30C2cF029C;

  // Arbitrum Addresses
  address private constant dai = 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1;
  address private constant WETH9 = 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1;

  function convertExactEthToDai(uint256 _amountOutMinimum) 
    public 
    payable 
  {
    require(msg.value > 0, "Must pass non 0 ETH amount");

    uint256 deadline = block.timestamp + 15; // using 'now' for convenience, for mainnet pass deadline from frontend!
    address tokenIn = WETH9;
    address tokenOut = dai;
    uint24 fee = 3000;
    address recipient = msg.sender;
    uint256 amountIn = msg.value;
    uint160 sqrtPriceLimitX96 = 0;
    
    ISwapRouter.ExactInputSingleParams memory params = ISwapRouter.ExactInputSingleParams
    (
        tokenIn,
        tokenOut,
        fee,
        recipient,
        deadline,
        amountIn,
        _amountOutMinimum,
        sqrtPriceLimitX96
    );
    
    uniswapRouter.exactInputSingle{ value: msg.value }(params);
    uniswapRouter.refundETH();
    
    // refund leftover ETH to user
    (bool success,) = msg.sender.call{ value: address(this).balance }("");
    require(success, "refund failed");
  }
  
  // important to receive ETH
  receive() 
    payable 
    external 
  {
      convertExactEthToDai(1);
  }
}

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_amountOutMinimum","type":"uint256"}],"name":"convertExactEthToDai","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"uniswapRouter","outputs":[{"internalType":"contract IUniswapRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b506103fc806100206000396000f3fe60806040526004361061002d5760003560e01c8063735de9f714610043578063d0bb996d1461006e5761003e565b3661003e5761003c600161007c565b005b600080fd5b34801561004f57600080fd5b506100586102a0565b60405161006591906102eb565b60405180910390f35b61003c61007c3660046102b8565b600034116100a55760405162461bcd60e51b815260040161009c906102ff565b60405180910390fd5b60408051610100810182527382af49447d8a07e3bd95bd0d56f35241523fbab180825273da10009cbd5d07dd0cecc66161fc93d7c9000da160208301819052610bb88385018190523360608501819052600f4201608086018190523460a0870181905260c08701899052600060e08801819052975163414bf38960e01b8152919795969495939492939092909173e592427a0aece92de3edee1f18e0157c058615649063414bf38990859061015e90859060040161035d565b6020604051808303818588803b15801561017757600080fd5b505af115801561018b573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906101b091906102d0565b5073e592427a0aece92de3edee1f18e0157c058615646001600160a01b03166312210e8a6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561020057600080fd5b505af1158015610214573d6000803e3d6000fd5b505050506000336001600160a01b031647604051610231906102e8565b60006040518083038185875af1925050503d806000811461026e576040519150601f19603f3d011682016040523d82523d6000602084013e610273565b606091505b50509050806102945760405162461bcd60e51b815260040161009c90610336565b50505050505050505050565b73e592427a0aece92de3edee1f18e0157c0586156481565b6000602082840312156102c9578081fd5b5035919050565b6000602082840312156102e1578081fd5b5051919050565b90565b6001600160a01b0391909116815260200190565b6020808252601a908201527f4d7573742070617373206e6f6e20302045544820616d6f756e74000000000000604082015260600190565b6020808252600d908201526c1c99599d5b990819985a5b1959609a1b604082015260600190565b81516001600160a01b03908116825260208084015182169083015260408084015162ffffff16908301526060808401518216908301526080808401519083015260a0838101519083015260c0808401519083015260e0928301511691810191909152610100019056fea2646970667358221220a1a1f56d3ee14b703f18c9122a3c90e37830bb5c99ad5fd3021a5a3eaed7037964736f6c63430007060033

Deployed ByteCode Sourcemap

4346:1649:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;5963:23;5984:1;5963:20;:23::i;:::-;4346:1649;;;;;4399:105;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;4870:1002;;;;;;:::i;:::-;4985:1;4973:9;:13;4965:52;;;;-1:-1:-1;;;4965:52:0;;;;;;;:::i;:::-;;;;;;;;;5393:212;;;;;;;;4821:42;5393:212;;;4741:42;5393:212;;;;;;5217:4;5393:212;;;;;;5248:10;5393:212;;;;;;5063:2;5045:15;:20;5393:212;;;;;;5284:9;5393:212;;;;;;;;;;;;5026:16;5393:212;;;;;;5618:58;;-1:-1:-1;;;5618:58:0;;5045:20;;4821:42;;4741;;5217:4;;5248:10;;5284:9;;5026:16;;4461:42;;5618:30;;5284:9;;5618:58;;5393:212;;5618:58;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;4461:42;-1:-1:-1;;;;;5683:23:0;;:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5758:12;5775:10;-1:-1:-1;;;;;5775:15:0;5799:21;5775:51;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5757:69;;;5841:7;5833:33;;;;-1:-1:-1;;;5833:33:0;;;;;;;:::i;:::-;4870:1002;;;;;;;;;;:::o;4399:105::-;4461:42;4399:105;:::o;14:190:1:-;;126:2;114:9;105:7;101:23;97:32;94:2;;;147:6;139;132:22;94:2;-1:-1:-1;175:23:1;;84:120;-1:-1:-1;84:120:1:o;209:194::-;;332:2;320:9;311:7;307:23;303:32;300:2;;;353:6;345;338:22;300:2;-1:-1:-1;381:16:1;;290:113;-1:-1:-1;290:113:1:o;408:205::-;608:3;599:14::o;618:225::-;-1:-1:-1;;;;;804:32:1;;;;786:51;;774:2;759:18;;741:102::o;848:350::-;1050:2;1032:21;;;1089:2;1069:18;;;1062:30;1128:28;1123:2;1108:18;;1101:56;1189:2;1174:18;;1022:176::o;1203:337::-;1405:2;1387:21;;;1444:2;1424:18;;;1417:30;-1:-1:-1;;;1478:2:1;1463:18;;1456:43;1531:2;1516:18;;1377:163::o;1545:791::-;1828:13;;-1:-1:-1;;;;;1824:22:1;;;1806:41;;1907:4;1895:17;;;1889:24;1885:33;;1863:20;;;1856:63;1979:4;1967:17;;;1961:24;1987:8;1957:39;1935:20;;;1928:69;2057:4;2045:17;;;2039:24;2035:33;;2013:20;;;2006:63;2125:4;2113:17;;;2107:24;2085:20;;;2078:54;1786:3;2176:17;;;2170:24;2148:20;;;2141:54;2251:4;2239:17;;;2233:24;2211:20;;;2204:54;2318:4;2306:17;;;2300:24;2296:33;2274:20;;;2267:63;;;;1755:3;1740:19;;1722:614::o

Swarm Source

ipfs://a1a1f56d3ee14b703f18c9122a3c90e37830bb5c99ad5fd3021a5a3eaed70379
Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.