From 5240986d9a956efb71b11112ca27848c0a880a8b Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Mon, 8 Apr 2024 22:10:30 -0400 Subject: [PATCH] fix: optimism (#713) --- yearn/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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()