I'm pulling the USDC ABI from etherscan and then passing it in to web3
erc20_dict = { 'USDC': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' } url = f'https://api.etherscan.io/api?module=contract&action=getabi&address={contract_address}&apikey={apikey}' ret = requests.get(url) ABI = ret.json()['result'] contract = w3.eth.contract(address=w3.toChecksumAddress(erc20_dict['USDC']), abi=ABI) print(contract.functions.decimals().call()) but am getting the following error:
web3.exceptions.ABIFunctionNotFound: ("The function 'decimals' was not found in this contract's abi. ", 'Are you sure you provided the correct contract abi?') Is there a reason why the USDC ABI on etherscan doesn't contain the decimals function? I want to use this function generically to pull ABI for tokens/contracts so using the generic erc20 ABI isn't the best solution. Any ideas? Thanks!