safe.simulate
Documentation for eth_defi.safe.simulate Python module.
Perform Safe transaction on forked mainnet when you do not have all the private keys.
Functions
|
Simulate Safe transaction execution on a forked mainnet using Anvil. |
- simulate_safe_execution_anvil(web3, safe_address, contract_func, gas=10000000)
Simulate Safe transaction execution on a forked mainnet using Anvil.
We use Anvil to take over Safe contract as EOA address
We construct a transaction that skips all Safe smart contract code, and just sends the transaction as EOA
TODO: Later we might want to change this to use mock Safe contract where we override
checkSignatures()as described in https://chatgpt.com/share/684f0e0d-6000-8013-be12-a9d7a0a1d751Example:
func = safe.contract.functions.enableModule(new_guard_address) tx_hash = simulate_safe_execution_anvil( web3, safe_address, func, ) assert_transaction_success_with_explanation(web3, tx_hash)
- Returns
Transaction hash.
- Parameters
web3 (web3.main.Web3) –
safe_address (Union[eth_typing.evm.HexAddress, str]) –
contract_func (web3.contract.contract.ContractFunction) –
- Return type
hexbytes.main.HexBytes