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
Best Answer
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.