yes it is supposed to fix old Version problem. So why go back?
yep, correct. I Guess I need to redeploy now as this one is cooked! Thanks for all the help!
Same for me, getting an alert on Metamask.
I am currently not able to test it because not enough test bnb.
If the pair exists then maybe this works:
function setRouterAddress(address newRouter) public onlyOwner() {
IUniswapV2Router02 _newPancakeRouter = IUniswapV2Router02(newRouter);
uniswapV2Router = _newPancakeRouter;
}
If the router is not the good one this is normal
Does anyone know how to limit the liquidity removed from a smart contract
Hello, is there a function similar to this for uniswap?
hey , im having the following errors when trying to compile
āTypeError: Immutable variables can only be initialized inline or assigned directly in the constructor. uniswapV2Pair = IUniswapV2Factory(_newPancakeRouter.factory()).createPair(address(this), _newPancakeRouter.WETH()); ^-----------^ā
know what it can be? I just copy and pasted
Ok you have to remove āimmutableā keyword from uniswapV2Pair and Factory
Hi!
Thank you for this fix!
However. Iām very fresh with coding, but trying my best to learn.
How do I use this?
Should I post this after the Constructor or should I replace this code once and for all?
constructor () public {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F);
// 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;
//exclude owner and this contract from fee
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
I suggest to add before the last } of the whole code
Holy h*ll youāre fast!
Iām on my cellphone now, so I canāt get to my own code (replaced the UniswapV2 -names with Pancakes for example.).
Iāll post my code here when I get back home.
Thanks for hmthe help!
Do you mean the last-last row after everything, or this Constructor part?
Seen your many posts and you seem to be an expert. How to get in touch with you regarding projects? Thanks.
just send me a DM and I will help
I clicked on your profile but I donāt see an option for sending you a DM
I sent you a PM. Check it
Like this:
constructor () {
_rOwned[_msgSender()] = _rTotal;
IPancakeRouter02 _pancakeRouter = PancakeRouter02(0x10ED43C718714eb63d5aA57B78B54704E256024E);
// Create a Pancake pair for this new token
pancakePair = IPancakeFactory(_pancakeRouter.factory())
.createPair(address(this), _pancakeRouter.WETH());
// set the rest of the contract variables
pancakeRouter = _pancakeRouter;
// exclude owner, dev wallet, and this contract from fee
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_devAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
//New Pancakeswap router version?
//No problem, just change it!
function setRouterAddress(address newRouter) public onlyOwner() {
//Thank you FreezyEx
IPancakeRouter02 _newPancakeRouter = IPancakeRouter02(newRouter);
PancakePair = IPancakeFactory(_newPancakeRouter.factory()).createPair(address(this), _newPancakeRouter.WETH());
PancakeRouter = _newPancakeRouter;
}
Or like this:
constructor () {
_rOwned[_msgSender()] = _rTotal;
IPancakeRouter02 _pancakeRouter = PancakeRouter02(0x10ED43C718714eb63d5aA57B78B54704E256024E);
// Create a Pancake pair for this new token
pancakePair = IPancakeFactory(_pancakeRouter.factory())
.createPair(address(this), _pancakeRouter.WETH());
// set the rest of the contract variables
pancakeRouter = _pancakeRouter;
// exclude owner, dev wallet, and this contract from fee
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_devAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
All the other code here, and after final } -mark, Iāll add your code:
//New Pancakeswap router version?
//No problem, just change it!
function setRouterAddress(address newRouter) public onlyOwner() {
//Thank you FreezyEx
IPancakeRouter02 _newPancakeRouter = IPancakeRouter02(newRouter);
PancakePair = IPancakeFactory(_newPancakeRouter.factory()).createPair(address(this), _newPancakeRouter.WETH());
PancakeRouter = _newPancakeRouter;
}
The first example is fine
Thanks millions!
I need to check my code still, since those pancakeswap -corrections are causing my compiler some errors >.<
What do you think. Would it just be better to leave as UniswapRouter?
You are using Pancakeswap Interface I presume