blockchain - I am unable to swap the token after adding liquidity to Uniswap V2 - Stack Overflow

I have deployed an ERC20 contract on the Sepolia chain and added liquidity on Uniswap V2. However, when

I have deployed an ERC20 contract on the Sepolia chain and added liquidity on Uniswap V2. However, when I tried to swap the token with ETH, the token price was not being calculated, and I was unable to complete the swap. I am attaching a screenshot for better clarification.

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

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract V2DummyToken is ERC20, Ownable {
    uint8 private _customDecimals;

    constructor(address initialOwner, uint8 decimals_)
        ERC20("V2Dummy", "V2D")
        Ownable(initialOwner)
       
    {
        _customDecimals = decimals_;
        _mint(msg.sender, 320_000_000 * 10 ** decimals());
    }

    // Override the decimals function
    function decimals() public view virtual override returns (uint8) {
        return _customDecimals;
    }

    function mint(address to, uint256 amount) public onlyOwner {
        _mint(to, amount);
    }
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744361726a4570503.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信