I’m trying to send an ERC20 token(USDC) from my ethereum wallet to other wallet, however the transfer happens from my wallet to the smart contract instead of the other wallet. Below is the code w3_client = get_web3_client(3) # ropsten infura client smart_contact_address = "0xFE724a829fdF12F7012365dB98730EEe33742ea2" # ropsten USDC # abi as per https://github.com/carver/ethtoken.py/blob/master/ethtoken/abi.py smart_contract = w3_client.eth.contract(::Listen
I’m trying to send an ERC20 token(USDC) from my ethereum wallet to other wallet, however the transfer happens from my wallet to the smart contract instead of the other wallet.
Below is the code
w3_client = get_web3_client(3) # ropsten infura client smart_contact_address = "0xFE724a829fdF12F7012365dB98730EEe33742ea2" # ropsten USDC # abi as per https://github.com/carver/ethtoken.py/blob/master/ethtoken/abi.py smart_contract = w3_client.eth.contract( address=smart_contact_address, abi=EIP20_ABI ) nonce = w3_client.eth.getTransactionCount(w3_client.toChecksumAddress(my_wallet_address)) txn_dict = smart_contract.functions.transfer( receiver_wallet_address, 1000 ).build_transaction( { "chainId": 3, "nonce": nonce, "maxFeePerGas": w3_client.eth.max_priority_fee + (2 * w3_client.eth.get_block("latest")["baseFeePerGas"]), "maxPriorityFeePerGas": w3_client.eth.max_priority_fee, "type": 2, "gas": 21584 } ) signed = w3_client.eth.account.sign_transaction(txn_dict, my_wallet_private_key) return w3_client.eth.send_raw_transaction(signed.rawTransaction)
After I execute this. It shows an error on etherscan: https://ropsten.etherscan.io/tx/0x452012fab042528c17bab06595d6e47fa635d0b027083cfbfe94c40e7313e45c
Warning! Error encountered during contract execution [execution reverted]
ERC-20 Token Transfer Error (Unable to locate corresponding Transfer Event Logs), Check with Sender.
So I wanted to understand what am I missing here?
Thanks,