Closed emelyanko closed 2 years ago
Does it happen also when using the bot through telegram?
This message would normally indicate that the transfer
function of the token contract failed to execute properly. The reason can be a lot of things, it really depends on the token.
For example, it could be a scam contract (so-called "honeypot") where selling is prohibited to make the chart look green.
If you share more information about the token and the value of parameters you passed to the sell_tokens
function, I can look into it. It's probably not a bug with pancaketrade so I'm gonna close this issue but we can continue to discuss it here.
Происходит ли это также при использовании бота через Telegram?
I haven't used Telegram yet. I sell Cake("0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82")
My parameters:
net.sell_tokens(
token_address=token_address), # Cake ChecksumAddress
amount_tokens=Wei(amount), # 100,000,000,000,000,000 Wei
slippage_percent=Decimal('2'), # 2.0 Decimal
gas_price=None # or '+10.1',
)
I've changed the gas, slippage, amount parameters a lot. I used other tokens and checked their honeypot
I think the message appears when this block is accessed:
gas_limit = Wei(
int(
Decimal(func.estimateGas({"from": self.wallet, "value": Wei(0)}))
* Decimal(1.2)
)
)
I think it's because you did not approve the PancakeSwap Router v2 contract to spend your CAKE tokens.
You need to call Network.approve(token_address)
(which will make a transaction) before selling any token.
You can check if the token was already approved by calling Network.is_approved(token_address)
which makes a free call (no transaction).
If that's not the problem, then please check the following:
How did you instantiate the Network
class? Are you passing the right parameter for the wallet
argument in the constructor ? Do you have 0.1 CAKE = 100,000,000,000,000,000 Wei
in this wallet?
Network.approve(token_address) -> WORKING ! )) THANK YOU SO MUCH !!!
I can't sell tokens using Network.sell_tokens (error 'web3.exceptions.ContractLogicError: execution reverted: TransferHelper: TRANSFER_FROM_FAILED'). Buying tokens is successful.