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条)