/**
* add lets add initial liquidity
*/
function addInitialLiquidity(uint256 _tokenAmount ) external payable onlyOwner lockSwapAndLiquidify {
require(!_isInitialized,"PBULL: Method Alerady Initialised");
require(msg.value > 0, "PBULL: Native asset amount should be greater than 0");
require(_tokenAmount > 0,"PBULL: _tokenAmount should be greater than 0");
require(address(this).send(msg.value), "PBULL: Failed to transfer bnb to contract");
//disableAllFees();
//put token to contract
super._transfer(_msgSender(), address(this), _tokenAmount);
_approve( address(this), address(uniswapV2Router), _tokenAmount );
// add the liquidity
uniswapV2Router.addLiquidityETH { value: msg.value } (
address(this), //token contract address
_tokenAmount, // token amount we wish to provide liquidity for
_tokenAmount, //amountTokenMin
msg.value, //amountETHMin
_msgSender(),
(block.timestamp + 1000) //deadline
);
//enableAllFees();
_isInitialized = true;
} //end add liquidity
Jul 7, 2021, 2:11 PM
yes, i meant to a contract
Jul 7, 2021, 2:11 PM
I have another contract it works
Jul 7, 2021, 2:12 PM
i'll try on ropsten
one sec, i might be stupid
Jul 7, 2021, 2:12 PM
uniswap codes uses compiler 0.5
Jul 7, 2021, 2:12 PM
0.6 for v2
Jul 7, 2021, 2:12 PM
I use 0.7.6
Jul 7, 2021, 2:13 PM
i use 0.8.4
since when?
Jul 7, 2021, 2:28 PM
I can help
or better still post question here
Jul 7, 2021, 2:32 PM
https://kovan.etherscan.io/tx/0x3b1415a6d75875d28fe137c00747bac36229bbc8e26ba4d974c3a76924d0180f#internal
doesn't work for transfers to contract with .transfer
solidity 0.8.4
Jul 7, 2021, 2:33 PM
ok
then create an interface for it
still you need ethers or web3js
Jul 7, 2021, 2:36 PM