Normally I just do this on python:

token = web3.eth.contract(address=contract_address, abi=abi)
balance_in_wei = token.functions.balanceOf(wallet).call()

However, when the function isn't in the "Read Contract" tab, this code wouldn't work at all. enter image description here

The balanceOf function can be found in "Read as Proxy". enter image description here

How could I call this function as proxy in web3 py? For context, I'm trying to get my balance of USDC: https://etherscan.io/address/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48

4 Answers 4


I found your question in searching for the same issue and struggling for hours. For clear definitions the proxy contract A will point to contract B. What fixed it for me was using the ABI of the contract B and the address of contract A. Best of luck!

  • Indeed, in the case where Proxy Contracts are used you need to give Proxy Contract's ABI to initialize web3.Contract object to call functions from. This sould be the accepted answer. Commented Dec 3, 2022 at 21:36
  • saved me many hours. thank you
    – thomas.mac
    Commented Jan 18, 2023 at 1:48
  • Thanks a lot, had to sleep and wake to see this
    – Ray Zion
    Commented May 12 at 9:58

same exact way. Just pretend it's there and it should work. Instantiate the contract with the ABI that you want to call (e.g. the one with balanceOf regardless of it's actually there or not)

  • 1
    The reason why I asked this is because it doesn't work correctly. I used the token.functions.balanceOf(wallet).call() function but it's displaying zero, even though I have 10 on my wallet. This function works for all other tokens.
    – Austin
    Commented Feb 11, 2022 at 7:26
  • what's your abi?
    – thefett
    Commented Mar 29, 2022 at 12:29

I think balanceOf returns a BigNumber value that needs to be formatted for display purposes. Are you running a formatting function prior to displaying the balance? Formatting functions take a decimals argument. Standard ERC-20 tokens implement 18 decimals but the USDC contract only implements 6 decimals. So the formatter function args might need to be adjusted.

https://docs.openzeppelin.com/contracts/3.x/erc20#a-note-on-decimals https://docs.ethers.io/v5/api/utils/display-logic/#utils-formatUnits


You have to use the address of main contract and ABi of proxy contract to use main functions of these kind of smart contracts

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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