diff --git a/eth_defi/hotwallet.py b/eth_defi/hotwallet.py index a1d7d79a..4c41c073 100644 --- a/eth_defi/hotwallet.py +++ b/eth_defi/hotwallet.py @@ -386,13 +386,14 @@ def transact_and_broadcast_with_contract( """Transacts with a contract, broadcasts transaction. - Shorthand method - - Build a transaction and signs it + - Build a contract function call transaction and signs it - Always use a correct manually managed nonce Example: .. code-block:: python + deployer = HotWallet.from_private_key(os.environ["PRIVATE_KEY"]) bound_func = module.functions.whitelistUniswapV3Router(uniswap_v3.swap_router.address, "Allow Uniswap v3") tx_hash = deployer.transact_and_broadcast_with_contract(bound_func) diff --git a/eth_defi/lagoon/deployment.py b/eth_defi/lagoon/deployment.py index 62d89c5a..79e2a9a5 100644 --- a/eth_defi/lagoon/deployment.py +++ b/eth_defi/lagoon/deployment.py @@ -355,7 +355,7 @@ def deploy_safe_trading_strategy_module( def setup_guard( web3: Web3, safe: Safe, - deployer: LocalAccount, + deployer: HotWallet, owner: HexAddress, asset_manager: HexAddress, vault: Contract, @@ -366,7 +366,7 @@ def setup_guard( uniswap_v3: UniswapV3Deployment = None, ): - assert isinstance(deployer, HotWallet) + assert isinstance(deployer, HotWallet), f"Got: {deployer}" assert type(owner) == str assert isinstance(module, Contract) assert isinstance(vault, Contract) diff --git a/eth_defi/safe/safe_compat.py b/eth_defi/safe/safe_compat.py index e375be94..334393a7 100644 --- a/eth_defi/safe/safe_compat.py +++ b/eth_defi/safe/safe_compat.py @@ -3,13 +3,21 @@ from safe_eth.eth import EthereumClient +from eth_defi.provider.mev_blocker import MEVBlockerProvider + + def create_safe_ethereum_client(web3: Web3) -> EthereumClient: """Safe library wants to use its own funny client. - Translate Web3 endpoints to EthereumClient """ - # TODO: Handle MEVProvider provider = web3.provider - url = provider.endpoint_uri + + if isinstance(provider, MEVBlockerProvider): + # EthereumClient() does not understand about Base sequencer, + # MEVBlocker, etc. + url = provider.call_endpoint_uri + else: + url = provider.endpoint_uri return EthereumClient(url) \ No newline at end of file