Skip to content
Verified contractExactMIT

Portal

Address0x0df27cd217696d74fb040d1244733ca91cc5773b
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.20

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.20+commit.a1b79de6
Language
solidity
Optimization
No
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,499,763
Creation transaction
0xf911b7e80b…9da69b25eb

contracts/portalExtra.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

interface IRouter02 {
    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }

    function exactInputSingle(ExactInputSingleParams calldata params)
        external payable returns (uint256 amountOut);
}

contract Portal {
    IRouter02 public constant router = IRouter02(0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45);
    address public constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;

    function buy(
        address tokenOut,
        uint24 fee,         // 3000
        uint256 minOut      // minimum tokens to receive (token decimals)
    ) external payable returns (uint256) {
        return router.exactInputSingle{value: msg.value}(
            IRouter02.ExactInputSingleParams({
                tokenIn: WETH,
                tokenOut: tokenOut,
                fee: fee,
                recipient: msg.sender,
                amountIn: msg.value,
                amountOutMinimum: minOut,
                sqrtPriceLimitX96: 0
            })
        );
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.