Panic Error
Version of Hardhat
2.24.3
What happened?
eth_estimateGas Contract call: TokenERC20#openTrading From: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 To: 0xdc64a140aa3e981100a9beca4e685f962f0cf6c9 Value: 0 ETH
Error: reverted with reason string 'UniswapV2: OVERFLOW'
thread 'RUST_BACKTRACE=1 environment variable to display a backtrace
thread '
Minimal reproduction steps
- Deploy token contract with openTrading function
function openTrading(address _router) external onlyOwner {
require(!tradingOpen, "trading is already open");
uniswapV2Router = IUniswapV2Router02(_router);
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(
address(this),
uniswapV2Router.WETH()
);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
swapEnabled = true;
tradingOpen = true;
firstBlock = block.number;
}
- Run the open trading function on the ignition hardhat
Search terms
No response
Hi @billalxcode thanks for reporting this!
I tried to repro by writing an isolated test in this project, but I couldn't repro the panic: https://github.com/agostbiro/undefined-call-instruction-location
If your project is public where the panic happens, could you share that please? Or alternatively could you have a look at my repro project and let me know what to change to reproduce the panic?