diff --git a/yearn/__init__.py b/yearn/__init__.py index f32a2dbd8..1c5b54b88 100644 --- a/yearn/__init__.py +++ b/yearn/__init__.py @@ -1,5 +1,6 @@ -from brownie import network +from brownie import network, chain, web3 +from web3.middleware.geth_poa import geth_poa_middleware from yearn.logs import setup_logging from yearn.sentry import setup_sentry @@ -11,10 +12,16 @@ # If ypm db is not yet initialized, force eth-util extended version import eth_portfolio._db.entities + from y import Network from yearn._setup import (customize_ypricemagic, force_init_problematic_contracts) from yearn.middleware.middleware import setup_middleware + # needed for base and opti + + if chain.id == Network.Optimism: + web3.middleware_onion.inject(geth_poa_middleware, layer=0) + setup_middleware() force_init_problematic_contracts() customize_ypricemagic()