Can't send transaction using web3

Viewed 518

I'm trying to send a transaction via fantom networkusing this code. This code for for me on polygon network but for some reason it doesn't work on fantom network. This token contract has transfer and transferFrom and none of them works with my code.

Token contract: https://ftmscan.com/address/0x667afbb7d558c3dfd20fabd295d31221dab9dbc2#code

def sendToken(_from, _to, _balance, _from_privet):
transaction = contract.functions.transferFrom(_from,str(_to), w3.toWei(_balance, 'ether')) \
    .buildTransaction({'chainId': 250,
                       'gas': 585901,
                       'nonce': w3.eth.getTransactionCount(_from)})
signed_txn = w3.eth.account.signTransaction(transaction, private_key=_from_privet)
try:
    tx_hash = w3.eth.sendRawTransaction(signed_txn.rawTransaction)
    recipt_hash = w3.eth.wait_for_transaction_receipt(binascii.hexlify(tx_hash).decode())
    print(binascii.hexlify(tx_hash).decode())

but for some reason transaction fail and I couldn't understand why. There is hash for this transaction. 0x9a87a2db4776dab986f18cd0e7f832ecdcaa48793be740c79c0f0b1a128f28b5 enter image description here

0 Answers
Related