deploy_safe_trading_strategy_module
Documentation for eth_defi.erc_4626.vault_protocol.lagoon.deployment.deploy_safe_trading_strategy_module function.
- deploy_safe_trading_strategy_module(web3, deployer, safe, use_forge=False, etherscan_api_key=None, verifier=None, verifier_url=None, enable_on_safe=True, uniswap_v2=None, uniswap_v3=None, cowswap=False, velora=False, gmx_deployment=None, lighter_deployment=None, lagoon=True, redemption_recovery=False)
Deploy TradingStrategyModuleV0 for Safe and Lagoon.
On HyperEVM chains, automatically enables big blocks only for the TradingStrategyModuleV0 deployment (~5.4M gas). Library deployments (CowSwapLib, GmxLib, HypercoreVaultLib, VeloraLib) fit in small blocks and are deployed without toggling.
This function only deploys and links the execution module. When
lagoonis true it linksLagoonLib, making settlement-safety calls available, but it does not know the vault, underlying asset, Silo or desired amount and therefore does not configure a limit. Usedeploy_automated_lagoon_vault()for the public human-readable API, or callsetup_guard()with raw token units in lower-level integrations.Lagoon Safes must have no fallback handler. This prevents a lower-level caller from attaching the execution module to a Safe with an unnecessary second authentication surface.
- Parameters
web3 (web3.main.Web3) – Connection for the chain receiving the deployment or policy transactions.
deployer (Union[eth_account.signers.local.LocalAccount, eth_defi.hotwallet.HotWallet]) – Deployer account. When a
HotWalletis passed, nonces are managed internally (avoids stale RPC nonce reads on load-balanced public endpoints).safe (safe_eth.safe.safe.Safe) – Custody Safe to pair with the execution module.
use_forge (bool) – Must be False: this module needs dynamic library linking through the precompiled ABI path. True raises NotImplementedError because
forge createdoes not support that linking path.etherscan_api_key (Optional[str]) – Optional explorer credential for source verification; never include it in reports.
verifier (Optional[Literal['etherscan', 'blockscout', 'sourcify', 'oklink']]) – Explorer verification backend used by the selected deployment tool.
verifier_url (Optional[str]) – Custom verification API endpoint when the chain needs one.
enable_on_safe (bool) – Automatically enable this module on the Safe multisig. Must be 1-of-1 deployer address multisig.
uniswap_v2 (Optional[eth_defi.uniswap_v2.deployment.UniswapV2Deployment]) – Select deployment/linking of Uniswap V2 validation. Router permissions are configured later by
setup_guard().uniswap_v3 (Optional[eth_defi.uniswap_v3.deployment.UniswapV3Deployment]) – Select deployment/linking of Uniswap V3 validation. This does not whitelist its router.
cowswap (bool) – Deploy and link CoW Swap validation;
setup_guard()configures its permissions separately.velora (bool) – Deploy and link Velora validation; this function does not grant swap permissions.
gmx_deployment (Optional[eth_defi.gmx.whitelist.GMXDeployment]) – Select GMX validation-library deployment/linking; Guard contract and market permissions are configured separately.
lighter_deployment (Optional[eth_defi.lighter.deployment.LighterDeployment]) – Select Lighter validation-library deployment/linking; this function does not configure Guard permissions.
lagoon (bool) – Deploy and link
LagoonLib. Satellite modules without a Lagoon vault link the zero address and fail closed on Lagoon calls.redemption_recovery (bool) – Deploy and link public redemption-recovery validation. Enable only when at least one reviewed descriptor supplies a fee cap. Existing modules without this library must be redeployed, not granted an unchecked call.
- Returns
TradingStrategyModuleV0 instance
- Return type
web3.contract.contract.Contract