Skip to content

Error in code #7

@LudovicoPiccolo

Description

@LudovicoPiccolo

If i try to sell a crypto i see:

996341397394100562
0.996341397394100562
Enter the Contract Address of token you want to sell: 0x4d496efc21754481fe7a9f3f0f758785ade8e1d3

Balance: 9435079356.573655643061248581 SANINU

Enter amount of SANINU you want to sell: 700000

Approved: 0x59a9466c83ab9412cd96614de95937bf8572c3dc6b086c8043eda0e6ab597be9

Swapping 700000 SANINU for BNB

Traceback (most recent call last):
File "sell2.py", line 78, in
pancakeswap2_txn = contract.functions.swapExactTokensForETH(
File "/usr/local/lib/python3.8/dist-packages/web3/contract.py", line 1081, in buildTransaction
return build_transaction_for_function(
File "/usr/local/lib/python3.8/dist-packages/web3/contract.py", line 1650, in build_transaction_for_function
prepared_transaction = fill_transaction_defaults(web3, prepared_transaction)
File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.call
File "/usr/local/lib/python3.8/dist-packages/web3/_utils/transactions.py", line 102, in fill_transaction_defaults
default_val = default_getter(web3, transaction)
File "/usr/local/lib/python3.8/dist-packages/web3/_utils/transactions.py", line 66, in
'gas': lambda web3, tx: web3.eth.estimate_gas(tx),
File "/usr/local/lib/python3.8/dist-packages/web3/eth.py", line 735, in estimate_gas
return self._estimate_gas(transaction, block_identifier)
File "/usr/local/lib/python3.8/dist-packages/web3/module.py", line 57, in caller
result = w3.manager.request_blocking(method_str,
File "/usr/local/lib/python3.8/dist-packages/web3/manager.py", line 187, in request_blocking
return self.formatted_response(response,
File "/usr/local/lib/python3.8/dist-packages/web3/manager.py", line 167, in formatted_response
apply_error_formatters(error_formatters, response)
File "/usr/local/lib/python3.8/dist-packages/web3/manager.py", line 67, in apply_error_formatters
formatted_resp = pipe(response, error_formatters)
File "cytoolz/functoolz.pyx", line 667, in cytoolz.functoolz.pipe
File "cytoolz/functoolz.pyx", line 642, in cytoolz.functoolz.c_pipe
File "/usr/local/lib/python3.8/dist-packages/web3/_utils/method_formatters.py", line 569, in raise_solidity_error_on_revert
raise ContractLogicError(response['error']['message'])
web3.exceptions.ContractLogicError: execution reverted: Pancake: K

Can you help me or fix the code?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions