Reputation: 162
I am using this code piece with relevant changes https://github.com/CodeWithJoe2020/pancakeswapBot/blob/main/cakebot.py it worked with its contract. But when I try with the contract which has tax like %7 i get transaction failed error from pancakeswap.
pancakeswap2_txn = contract.functions.swapExactETHForTokens(
0, # set to 0, or specify minimum amount of tokeny you want to receive - consider decimals!!!
[spend, tokenToBuy],
sender_address,
(int(time.time()) + 30000)
).buildTransaction({
'from': sender_address,
'value': web3.toWei(0.01, 'ether'), # This is the Token(BNB) amount you want to Swap from
'gas': 159413,
'gasPrice': web3.toWei(speed, 'gwei'),
'nonce': nonce,
})
As you can see I am putting minimum 0 so in theory slippage should not matter.
Any ideas?
Upvotes: 0
Views: 657