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’savatarandtargetmust 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_rawis deliberately a lower-level raw-unit argument. Public deployment callers normally usedeploy_automated_lagoon_vault()orLagoonConfig, which accept a human-readableDecimaland perform the token-decimal conversion.Noneselects the legacy unlimited allowlist call; zero is a valid strict cap. Every enabled cap also requires a positive cooldown;lagoon_settlement_cooldowndefaults to 24 hours.- Parameters
vault (Optional[web3.contract.contract.Contract]) – The stock Lagoon v0.5 vault paired with
safeandmodule.Noneis accepted only on satellite chains, where no Lagoon settlement selectors or settlement safety controls are configured.underlying_token_address (Optional[eth_typing.evm.HexAddress]) – Address returned by the Lagoon vault’s
asset()function. It is also used for Hypercore whitelisting whenvaultisNone. The onchain Lagoon configuration call verifies that this address matches the vault.lagoon_pending_silo_address (Optional[eth_typing.evm.HexAddress]) – Stock Lagoon v0.5 pending-deposit Silo whose underlying-token decrease measures the deposit side of a settlement. The onchain configuration call verifies that the Silo has approved the vault to pull the asset.
lagoon_max_settlement_amount_raw (Optional[int]) – Maximum gross asset-manager settlement in the underlying ERC-20’s smallest units. This is a safety limit, not a partial-settlement size. Gross settlement is
Silo decrease + vault increasefor one asset-managerperformCall()transaction.Nonepreserves the unlimited legacy policy;0enables a zero-movement-only policy.lagoon_settlement_cooldown (int) – Minimum seconds between non-zero capped asset-manager settlements. Defaults to 24 hours. A repeated non-zero call inside this window reverts during atomic post-call validation; empty and direct Safe governance transactions remain available.
web3 (web3.main.Web3) –
safe (safe_eth.safe.safe.Safe) –
deployer (eth_defi.hotwallet.HotWallet) –
owner (eth_typing.evm.HexAddress) –
asset_managers (Union[list[eth_typing.evm.HexAddress], tuple[eth_typing.evm.HexAddress, ...]]) –
module (web3.contract.contract.Contract) –
broadcast_func (Callable[[web3.contract.contract.ContractFunction], hexbytes.main.HexBytes]) –
any_asset (bool) –
uniswap_v2 (Optional[eth_defi.uniswap_v2.deployment.UniswapV2Deployment]) –
uniswap_v3 (Optional[eth_defi.uniswap_v3.deployment.UniswapV3Deployment]) –
aave_v3 (Optional[eth_defi.aave_v3.deployment.AaveV3Deployment]) –
erc_4626_vaults (Optional[list[eth_defi.erc_4626.vault.ERC4626Vault]]) –
cowswap (bool) –
velora (bool) –
gmx_deployment (Optional[eth_defi.gmx.whitelist.GMXDeployment]) –
lighter_deployment (Optional[eth_defi.lighter.deployment.LighterDeployment]) –
cctp_deployment (Optional[eth_defi.cctp.whitelist.CCTPDeployment]) –
hypercore_vaults (Optional[list[eth_typing.evm.HexAddress | str]]) –
assets (Optional[list[eth_typing.evm.HexAddress | str]]) –
- Returns
List of
WhitelistEntryrecording everything that was whitelisted.- Return type
list[eth_defi.erc_4626.vault_protocol.lagoon.deployment.WhitelistEntry]