guys , i want deploy my contract on forked mainnet in local network , but i get thhis error :
*********************************************************
Error: * Deployment Failed *

"myToken" ran out of gas. Something in the constructor (ex: infinite loop) caused gas estimation to fail. Try:
* Making your contract constructor more efficient
* Setting the gas manually in your config or as a deployment parameter
* Using the solc optimizer settings in 'truffle-config.js'
* Setting a higher network block limit if you are on a
private network or test client (like ganache).
*********************************************************

and i know it's because of this line :
*********************************************************
// // Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(_uniswapV2Router.WETH(), address(this));

*********************************************************

anyone can please help to solve this .Thanks

Feb 5, 2022, 10:44 AM
what's the value of the adresses
Feb 5, 2022, 10:57 AM
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(routerAddress);
// Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());

// set the rest of the contract variables
uniswapV2Router = _uniswapV2Router;
i used uniswap address on mainnet
i want create pair for my token in Uni-Swap, in constructor , then in smart contract , add more liquidity to my token liquidity . and i am testing it with mainnet fork in local .
Feb 5, 2022, 11:50 AM

© 2024 Draquery.com All rights reserved.