MegaSwapRouter01

Description:

ERC20 token contract with Factory capabilities. Standard implementation for fungible tokens on Ethereum.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "contracts/interfaces/IERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;


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);
}
"
    },
    "contracts/libraries/TransferHelper.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;


library TransferHelper {
    function safeTransfer(address token, address to, uint value) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TRANSFER_FAILED');
    }
    function safeTransferFrom(address token, address from, address to, uint value) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TRANSFER_FROM_FAILED');
    }
    function safeApprove(address token, address to, uint value) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'APPROVE_FAILED');
    }
}
"
    },
    "contracts/periphery/MegaSwapRouter01.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;


import "../libraries/TransferHelper.sol";
import "../interfaces/IERC20.sol";
contract MegaSwapRouter01 {
    address public immutable factory;
    address public immutable WETH;
    constructor(address _factory, address _WETH){ factory = _factory; WETH=_WETH; }
    receive() external payable {}
    function swapExactETHForTokens(uint minOut, address tokenOut, address to) external payable {
        require(tokenOut != address(0) && to != address(0), "bad");
        emit SwapExecuted(msg.sender, tokenOut, msg.value, minOut, to);
    }
    event SwapExecuted(address indexed sender, address indexed tokenOut, uint amountIn, uint minOut, address to);
}
"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 500
    },
    "evmVersion": "paris",
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    }
  }
}}

Tags:
ERC20, Token, Factory|addr:0xd408243bc309de0f8fc888fcfb1ea857ca42f2b9|verified:true|block:23742170|tx:0x5011302e4cb3541b77f403b8d2422085aa0caf2e11a520c06c61a87943e35ab2|first_check:1762459037

Submitted on: 2025-11-06 20:57:18

Comments

Log in to comment.

No comments yet.