Hello,
I deployed my experimental smart contract on BSC testnet. Oddly, my addliquidity function does not work. I have tried several times deploying different smart contract, even copied from open-source solidity codes, but there is some problem with the function. Contract address on bsc testnet: 0x6220eC7F45d0533549dD4300Dd3F18231eEcAc55
There you can have also look at addliquidity function.
function _addLiquidity() payable public {
uint256 _amountToken = balanceOf(address(this));
uint256 _amountETH = msg.value;
_approve(address(this),address(_router),balanceOf(address(this)));
(amountToken, amountETH, liquidity) =_router.addLiquidityETH{
value: _amountETH
}
(
pancakeswapV2Pair,
_amountToken,
0,
0,
owner(),
block.timestamp+60
);
emit CreatedLiquidity (amountToken, amountETH, liquidity);
}
Can anyone help why it might not work ?