Testing the contract token

I'm having trouble testing the contract through sopelia
I don't know if uniswaprouter V2 supports sepolia
Because the deployment of the contract still fails
I wanted to test through goerli but the faucets don't work

I will be glad if someone helps me
When someone has time to look at my contract

1 Like

Please provide the code of the token contract you're trying to deploy and test.

1 Like

Hi, i can help you. let me know your codebase.

```// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";

// CustomToken inherits from ERC20, ERC20Burnable, ReentrancyGuard, and Ownable
contract CustomToken is ERC20, ERC20Burnable, ReentrancyGuard, Ownable {
    // Wallet addresses for marketing and development
    address public marketingWallet;
    address public developerWallet;

    // Uniswap router and pair addresses
    address public uniswapV2RouterAddress;
    IUniswapV2Router02 public uniswapV2Router;
    address public uniswapV2Pair;

    // Tax rate for transactions and total supply
    uint256 public taxRate = 5;
    uint256 public constant TOTAL_SUPPLY = 450000000000000 * 10**18;
    uint256 public minEthBeforeLiquidity = 0.05 ether;

    // Constructor to initialize the token
        string memory name,
        string memory symbol,
        address _marketingWallet,
        address _developerWallet,
        address _uniswapV2RouterAddress
    ) ERC20(name, symbol) {
        marketingWallet = _marketingWallet;
        developerWallet = _developerWallet;
        uniswapV2RouterAddress = _uniswapV2RouterAddress;

        // Initialize Uniswap router and create a pair
        uniswapV2Router = IUniswapV2Router02(uniswapV2RouterAddress);
        uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());

        // Mint the total supply to the sender
        _mint(msg.sender, TOTAL_SUPPLY);

    // Override the transfer function to include tax and distribution
    function _transfer(address sender, address recipient, uint256 amount) internal override nonReentrant {
        uint256 taxAmount = (amount * taxRate) / 100;
       uint256 marketingAmount = (taxAmount * 49) / 100;  // 49% of the tax
       uint256 liquidityAmount = (taxAmount * 50) / 100;  // 50% of the tax
       uint256 developerAmount = (taxAmount * 1) / 100;   // 1% of the tax

        // Transfer tax to marketing and developer wallets
        super._transfer(sender, marketingWallet, marketingAmount);
        super._transfer(sender, developerWallet, developerAmount);

        // Add liquidity if the contract balance is above the minimum
        if (address(this).balance >= minEthBeforeLiquidity) {

        // Transfer the remaining amount to the recipient
        uint256 sendAmount = amount - taxAmount;
        super._transfer(sender, recipient, sendAmount);

    // Function to add liquidity to Uniswap
    function addLiquidity(uint256 tokenAmount) internal onlyOwner {
        uint256 half = tokenAmount / 2;
        uint256 otherHalf = tokenAmount - half;

        uint256 balanceBeforeSwap = address(this).balance;
        uint256 ethReceived = address(this).balance - balanceBeforeSwap;

        // Add liquidity to Uniswap
        uniswapV2Router.addLiquidityETH{value: ethReceived}(address(this), otherHalf, 0, 0, address(this), block.timestamp);

    // Function to swap tokens for ETH
    function swapTokensForEth(uint256 tokenAmount) internal {
        address[] memory path = new address[](2);
        path[0] = address(this);
        path[1] = uniswapV2Router.WETH();

        // Approve the router to spend tokens
        _approve(address(this), uniswapV2RouterAddress, tokenAmount);

        // Perform the swap
        uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);

please, if someone can check it, I will be grateful

Plz share your contract codebase so that i can check.

I guess there was a net problem when you tried to deploy contract.
I deployed your contract to the goerli successfully.

1 Like

yes, I see, thank you, I want to ask if the tax test will be done?
the point is that the 2% tax for liquidity is set in such a way that the 2% tax is 1% automatically converted to eth and then sent to liquidity but only when it reaches 0.05 eth due to the gas load.