load_contract

Function

def load_contract(address, abi=None):
    if not abi:
        abi = load_contract_abi(address)
    if not abi:
        abi = json.load(open('./data/abi/ERC20.json'))
    return web3.eth.contract(address=address, abi=abi)

Description

  • Tries to get the ABI from cache or Blockscout

  • If nothing is found then default to ERC20

  • Return a contract object