AutomatedSafe

Documentation for eth_defi.erc_4626.vault_protocol.lagoon.vault.AutomatedSafe Python class.

class AutomatedSafe

Bases: object

Mixin for Safe multisig wallets with TradingStrategyModuleV0 guard.

Provides transaction wrapping through the guard module, used by both full Lagoon vaults (LagoonVault) and satellite Safe-only deployments (LagoonSatelliteVault).

  • Encapsulates Safe + TradingStrategyModuleV0 interaction

  • Independent of vault contracts (no ERC-4626 dependency)

Parameters
  • web3 – Web3 connection to the chain where the Safe is deployed.

  • safe_address – Address of the Gnosis Safe multisig. Can be None for LagoonVault where it is lazily resolved from the vault contract.

  • trading_strategy_module_address – Address of the TradingStrategyModuleV0 guard module enabled on the Safe.

Attributes summary

safe

Get the underlying Safe object used as an API from safe-eth-py library.

safe_address

Get Safe multisig contract address.

safe_contract

Safe multisig as a contract.

trading_strategy_module

Get the TradingStrategyModuleV0 contract instance.

trading_strategy_module_address

Get TradingStrategyModuleV0 contract address.

trading_strategy_module_version

Get TradingStrategyModuleV0 contract ABI version.

Methods summary

__init__(web3[, safe_address, ...])

param web3

fetch_safe(address)

Create a Safe object from an address.

fetch_trading_strategy_module_version()

Perform deployed smart contract probing.

transact_via_exec_module(func_call[, value, ...])

Create a multisig transaction using a module.

transact_via_trading_strategy_module(func_call)

Create a Safe multisig transaction using TradingStrategyModuleV0.

__init__(web3, safe_address=None, trading_strategy_module_address=None)
Parameters
  • web3 (web3.main.Web3) – Web3 connection to the chain where the Safe is deployed.

  • safe_address (Optional[eth_typing.evm.HexAddress]) – Address of the Gnosis Safe multisig. Can be None for LagoonVault where it is lazily resolved from the vault contract.

  • trading_strategy_module_address (Optional[eth_typing.evm.HexAddress]) – Address of the TradingStrategyModuleV0 guard module enabled on the Safe.

fetch_safe(address)

Create a Safe object from an address.

Use safe property for cached access.

Parameters

address (Union[eth_typing.evm.HexAddress, str]) –

Return type

safe_eth.safe.safe.Safe

fetch_trading_strategy_module_version()

Perform deployed smart contract probing.

Returns

v0.1.0 or v0.1.1.

None if not TS module associated.

Return type

Optional[str]

property safe: safe_eth.safe.safe.Safe

Get the underlying Safe object used as an API from safe-eth-py library.

  • Wraps Safe contract using Gnosis’s in-house library

property safe_address: eth_typing.evm.HexAddress

Get Safe multisig contract address.

property safe_contract: web3.contract.contract.Contract

Safe multisig as a contract.

  • Interact with Safe multisig ABI

property trading_strategy_module: web3.contract.contract.Contract

Get the TradingStrategyModuleV0 contract instance.

property trading_strategy_module_address: Optional[eth_typing.evm.HexAddress]

Get TradingStrategyModuleV0 contract address.

property trading_strategy_module_version: str

Get TradingStrategyModuleV0 contract ABI version.

  • Subject to change, development in progress

transact_via_exec_module(func_call, value=0, operation=0)

Create a multisig transaction using a module.

  • Calls execTransactionFromModule on Gnosis Safe contract

  • Executes a transaction as a multisig

  • Mostly used for testing w/whitelist ignore

Warning

A special gas fix is needed, because eth_estimateGas seems to fail for these Gnosis Safe transactions.

Parameters
  • func_call (web3.contract.contract.ContractFunction) – Bound smart contract function call

  • value (int) – ETH attached to the transaction

  • operation

    Gnosis enum.

    Call = 0, DelegateCall = 1.

Return type

web3.contract.contract.ContractFunction

transact_via_trading_strategy_module(func_call, value=0, abi_version=None)

Create a Safe multisig transaction using TradingStrategyModuleV0.

Parameters
  • func_call (web3.contract.contract.ContractFunction) – Bound smart contract function call

  • value (int) – ETH value attached to the call.

  • abi_version (str) – Use specific TradingStrategyModuleV0 ABI version.

Returns

Bound Solidity function call you need to turn to a transaction

Return type

web3.contract.contract.ContractFunction