Execution reverted: ERC20: approve from the zero address

Good evening
Try to call a spending approval from the USDC ERC20 contract, getting the error in object

I am testing this on Polygon Mainnet via web3.py library

Here’s my code

usdc_address_proxy = w3.to_checksum_address('0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174')
with open('usdc_polygon_abi.json', mode='r') as f:
    usdc_contract_abi = json.loads(f.read())

approval_contract_usdc = w3.eth.contract(address=usdc_address_proxy, abi=usdc_contract_abi)

transaction = approval_contract_usdc.functions.approve(inchv5checksum_address, 376600000).build_transaction()
transaction.update({ 'gas' : 8000000 })
transaction.update({ 'nonce' : w3.eth.get_transaction_count('wallet_address = '0x84cc1ac7C1f8D4cBe471a6c229CBF4dC459457a7'
') })

signed_tx = w3.eth.account.sign_transaction(transaction, wallet_priv_key)
txn_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
txn_receipt = w3.eth.wait_for_transaction_receipt(txn_hash)

The code is almost working till declaration of “transaction” variable.

Please help

2 Likes

Solved.

It was just a issue of spending approval

2 Likes

thanks for letting us know.

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.