0

I try send transaction but i get error. https://bscscan.com/tx/0x3e716bc5d0500e8284de39c809a0251d07b0b3648591bf09fbafbb4dea633a34

I use web3.py

tx_params = {
            'from': wallet,
            'gas': 650000,
            'value': 0,
            'nonce': w3.eth.getTransactionCount(wallet)
        }

print(tx_params)

function = router.functions.swapExactTokensForTokens(
    int(7 * 1e18),
    int(5 * 1e18),
    [Web3.toChecksumAddress('0xe9e7cea3dedca5984780bafc599bd69add087d56'),
    Web3.toChecksumAddress('0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c'),
    Web3.toChecksumAddress('0xe9e7cea3dedca5984780bafc599bd69add087d56')],
    wallet,
    int(time.time()) + 10 * 60)

transaction = function.buildTransaction(tx_params)
signed_txn = w3.eth.account.sign_transaction(
    transaction, private_key=private_key
)

txn_hash = w3.eth.send_raw_transaction(signed_txn.rawTransaction)

Tell me please, how can i solve my problem with error 'Insufficient input amount, i have 0.07bnb and 46usd in wallet

1
  • can you help me? telegram @artem15510 Jun 2, 2021 at 19:45

1 Answer 1

1

You are trying to swap 7 BUSD to 5 BUSD, which makes no sense. Try actually swapping to another token instead of the same token.

5
  • but i want swap BUSD-BNB-BUSD
    – Vlad
    May 26, 2021 at 13:22
  • Can I ask why you want to essentially pay BUSD and get less BUSD? There is no problem in your code, however the Pancake router contract doesn't allow such thing, so you will never get it to work.
    – bru53001
    May 26, 2021 at 14:02
  • I want to create volume, i want do buy and sell operations, and i hope that it is possible in one transaction to protect yourself from manipulation
    – Vlad
    May 26, 2021 at 14:04
  • For example, i want buy 5 tokens and sell 5 token in one pair
    – Vlad
    May 26, 2021 at 14:05
  • I want get equal BUSD, i pay 7 and i get 7, i set min_output 5 but it is not important
    – Vlad
    May 26, 2021 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.