setup_guard

Documentation for eth_defi.erc_4626.vault_protocol.lagoon.deployment.setup_guard function.

setup_guard(*, web3, safe, deployer, owner, asset_managers, vault, module, broadcast_func, any_asset=False, uniswap_v2=None, uniswap_v3=None, aave_v3=None, erc_4626_vaults=None, cowswap=False, velora=False, gmx_deployment=None, lighter_deployment=None, cctp_deployment=None, hypercore_vaults=None, hack_sleep=20.0, assets=None, multicall_chunk_size=40, underlying_token_address=None, lagoon_pending_silo_address=None, lagoon_max_settlement_amount_raw=None, lagoon_settlement_cooldown=86400)

Set up a TradingStrategyModuleV0 guard for its paired Lagoon vault and Safe.

This function applies the onchain policy after the module has been deployed and enabled on the Safe. The deployment topology is one Lagoon vault, one Safe, and one TradingStrategyModuleV0; the module’s avatar and target must both be the supplied Safe.

Lagoon settlement safety requires an execution-aware module because it compares token balances before and after the Safe call in the same atomic transaction. A standalone GuardV0.validateCall() can perform only the pre-call half and must never be used to configure this guarantee. This function verifies the module/Safe pairing before broadcasting any policy transactions whenever a limit is requested.

lagoon_max_settlement_amount_raw is deliberately a lower-level raw-unit argument. Public deployment callers normally use deploy_automated_lagoon_vault() or LagoonConfig, which accept a human-readable Decimal and perform the token-decimal conversion. None selects the legacy unlimited allowlist call; zero is a valid strict cap. Every enabled cap also requires a positive cooldown; lagoon_settlement_cooldown defaults to 24 hours.

Parameters
Returns

List of WhitelistEntry recording everything that was whitelisted.

Return type

list[eth_defi.erc_4626.vault_protocol.lagoon.deployment.WhitelistEntry]