MegaSwapRouter02

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


import "./MegaSwapRouter01.sol";
contract MegaSwapRouter02 is MegaSwapRouter01 {
    constructor(address _factory, address _WETH) MegaSwapRouter01(_factory,_WETH) {}
    function swapExactTokensForTokens(uint amountIn, uint minOut, address tokenIn, address tokenOut, address to) external {
        emit SwapTokensExecuted(msg.sender, tokenIn, tokenOut, amountIn, minOut, to);
    }
    event SwapTokensExecuted(address indexed sender, address tokenIn, address 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:0x63d1372e61e93ce3592eff109a6d47c84db7d756|verified:true|block:23742171|tx:0x625d4a969db24bfb878901016e7baf220400e3605fd08034a4252100db2dff23|first_check:1762459068

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

Comments

Log in to comment.

No comments yet.