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:0x6b3b932c1325f7fcd93d4ceec018ea9f149c2059|verified:true|block:23742418|tx:0x63cc8246286c6ce26b9187b9a7aa52d8af0164e409cee1e814da66d32bb0494f|first_check:1762458419

Submitted on: 2025-11-06 20:47:00

Comments

Log in to comment.

No comments yet.