@@ -183,15 +183,19 @@ def handle(self, *args, **options):
183183 self .stdout .write (
184184 self .style .SUCCESS (f"Task { task .name } was already created" )
185185 )
186+ self ._setup_safe_contracts ()
186187
188+ def _setup_safe_contracts (self ):
187189 self .stdout .write (self .style .SUCCESS ("Setting up Safe Contract Addresses" ))
188190 ethereum_client = get_auto_ethereum_client ()
189191 ethereum_network = ethereum_client .get_network ()
190192 if ethereum_network in MASTER_COPIES :
191193 self .stdout .write (
192194 self .style .SUCCESS (f"Setting up { ethereum_network .name } safe addresses" )
193195 )
194- self ._setup_safe_singleton_addresses (MASTER_COPIES [ethereum_network ])
196+ self ._setup_safe_singleton_addresses (
197+ MASTER_COPIES [ethereum_network ], settings .FORCE_SETUP_SAFE_CONTRACTS
198+ )
195199
196200 else :
197201 self .stdout .write (
@@ -226,7 +230,9 @@ def handle(self, *args, **options):
226230 )
227231
228232 def _setup_safe_singleton_addresses (
229- self , safe_singleton_addresses : Sequence [tuple [str , int , str ]]
233+ self ,
234+ safe_singleton_addresses : Sequence [tuple [str , int , str ]],
235+ force_setup_safe_contracts : bool = True ,
230236 ):
231237 for address , initial_block_number , version in safe_singleton_addresses :
232238 safe_singleton_address , _ = SafeMasterCopy .objects .get_or_create (
@@ -238,7 +244,7 @@ def _setup_safe_singleton_addresses(
238244 "l2" : version .endswith ("+L2" ),
239245 },
240246 )
241- if (
247+ if force_setup_safe_contracts and (
242248 safe_singleton_address .version != version
243249 or safe_singleton_address .initial_block_number != initial_block_number
244250 ):
0 commit comments