@@ -51,6 +51,8 @@ contract SymbioticCoreInit is SymbioticInit, SymbioticCoreBindings {
5151 uint256 public SYMBIOTIC_CORE_MIN_OPERATOR_NETWORK_SHARES = 1000 ;
5252 uint256 public SYMBIOTIC_CORE_MAX_OPERATOR_NETWORK_SHARES = 1e18 ;
5353
54+ address public SYMBIOTIC_CORE_OWNER = address (0 );
55+
5456 SymbioticCoreConstants.Core public symbioticCore;
5557
5658 function run (
@@ -67,41 +69,31 @@ contract SymbioticCoreInit is SymbioticInit, SymbioticCoreBindings {
6769 symbioticCore = SymbioticCoreConstants.core ();
6870 }
6971
70- // override for backward compatibility (uses non-deterministic deployment)
72+ // if useExisting is true, the core is not deployed, but the addresses are returned
7173 function _initCore_SymbioticCore (
7274 bool useExisting
7375 ) internal virtual {
74- _initCore_SymbioticCore (useExisting, false );
75- }
76-
77- // if useExisting is true, the core is not deployed, but the addresses are returned
78- // if local is true, the core is deployed locally with deterministic addresses (uses cheats, requires anvil node)
79- // if local is false, the core is deployed with non-deterministic addresses (uses standard create)
80- function _initCore_SymbioticCore (bool useExisting , bool local ) internal virtual {
81- if (useExisting && ! local) {
82- // return existing core (addresses are not deterministic)
76+ if (useExisting) {
77+ // return existing core
8378 symbioticCore = SymbioticCoreConstants.core ();
84- } else if (useExisting && local) {
85- // return locally deployed core (addresses are deterministic)
86- symbioticCore = SymbioticCoreConstants.core (true );
87- } else if (! local) {
79+ } else {
8880 // non-deterministic deployment (uses standard create)
8981 ISymbioticVaultFactory vaultFactory = ISymbioticVaultFactory (
9082 deployCode (
9183 string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/VaultFactory.sol/VaultFactory.json " ),
92- abi.encode (address (this ))
84+ abi.encode (SYMBIOTIC_CORE_OWNER == address (0 ) ? address ( this ) : SYMBIOTIC_CORE_OWNER )
9385 )
9486 );
9587 ISymbioticDelegatorFactory delegatorFactory = ISymbioticDelegatorFactory (
9688 deployCode (
9789 string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/DelegatorFactory.sol/DelegatorFactory.json " ),
98- abi.encode (address (this ))
90+ abi.encode (SYMBIOTIC_CORE_OWNER == address (0 ) ? address ( this ) : SYMBIOTIC_CORE_OWNER )
9991 )
10092 );
10193 ISymbioticSlasherFactory slasherFactory = ISymbioticSlasherFactory (
10294 deployCode (
10395 string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/SlasherFactory.sol/SlasherFactory.json " ),
104- abi.encode (address (this ))
96+ abi.encode (SYMBIOTIC_CORE_OWNER == address (0 ) ? address ( this ) : SYMBIOTIC_CORE_OWNER )
10597 )
10698 );
10799 ISymbioticNetworkRegistry networkRegistry = ISymbioticNetworkRegistry (
@@ -259,207 +251,6 @@ contract SymbioticCoreInit is SymbioticInit, SymbioticCoreBindings {
259251 operatorNetworkOptInService: operatorNetworkOptInService,
260252 vaultConfigurator: vaultConfigurator
261253 });
262- } else if (local) {
263- // deterministic local deployment (uses cheats, requires anvil node)
264- symbioticCore = SymbioticCoreConstants.core (true );
265-
266- deployCodeTo (
267- string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/VaultFactory.sol/VaultFactory.json " ),
268- abi.encode (address (this )),
269- address (symbioticCore.vaultFactory)
270- );
271-
272- deployCodeTo (
273- string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/DelegatorFactory.sol/DelegatorFactory.json " ),
274- abi.encode (address (this )),
275- address (symbioticCore.delegatorFactory)
276- );
277-
278- deployCodeTo (
279- string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/SlasherFactory.sol/SlasherFactory.json " ),
280- abi.encode (address (this )),
281- address (symbioticCore.slasherFactory)
282- );
283-
284- deployCodeTo (
285- string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/NetworkRegistry.sol/NetworkRegistry.json " ),
286- abi.encode (address (this )),
287- address (symbioticCore.networkRegistry)
288- );
289-
290- deployCodeTo (
291- string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/OperatorRegistry.sol/OperatorRegistry.json " ),
292- abi.encode (address (this )),
293- address (symbioticCore.operatorRegistry)
294- );
295-
296- deployCodeTo (
297- string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/MetadataService.sol/MetadataService.json " ),
298- abi.encode (address (symbioticCore.operatorRegistry)),
299- address (symbioticCore.operatorMetadataService)
300- );
301-
302- deployCodeTo (
303- string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/MetadataService.sol/MetadataService.json " ),
304- abi.encode (address (symbioticCore.networkRegistry)),
305- address (symbioticCore.networkMetadataService)
306- );
307-
308- deployCodeTo (
309- string .concat (
310- SYMBIOTIC_CORE_PROJECT_ROOT, "out/NetworkMiddlewareService.sol/NetworkMiddlewareService.json "
311- ),
312- abi.encode (address (symbioticCore.networkRegistry)),
313- address (symbioticCore.networkMiddlewareService)
314- );
315-
316- deployCodeTo (
317- string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/OptInService.sol/OptInService.json " ),
318- abi.encode (
319- address (symbioticCore.operatorRegistry),
320- address (symbioticCore.vaultFactory),
321- "OperatorVaultOptInService "
322- ),
323- address (symbioticCore.operatorVaultOptInService)
324- );
325-
326- deployCodeTo (
327- string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/OptInService.sol/OptInService.json " ),
328- abi.encode (
329- address (symbioticCore.operatorRegistry),
330- address (symbioticCore.networkRegistry),
331- "OperatorNetworkOptInService "
332- ),
333- address (symbioticCore.operatorNetworkOptInService)
334- );
335-
336- deployCodeTo (
337- string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/Vault.sol/Vault.json " ),
338- abi.encode (
339- address (symbioticCore.delegatorFactory),
340- address (symbioticCore.slasherFactory),
341- address (symbioticCore.vaultFactory)
342- ),
343- address (bytes20 (keccak256 ("SymbioticVaultImpl " )))
344- );
345- symbioticCore.vaultFactory.whitelist (address (bytes20 (keccak256 ("SymbioticVaultImpl " ))));
346-
347- deployCodeTo (
348- string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/VaultTokenized.sol/VaultTokenized.json " ),
349- abi.encode (
350- address (symbioticCore.delegatorFactory),
351- address (symbioticCore.slasherFactory),
352- address (symbioticCore.vaultFactory)
353- ),
354- address (bytes20 (keccak256 ("SymbioticVaultTokenizedImpl " )))
355- );
356- symbioticCore.vaultFactory.whitelist (address (bytes20 (keccak256 ("SymbioticVaultTokenizedImpl " ))));
357-
358- deployCodeTo (
359- string .concat (
360- SYMBIOTIC_CORE_PROJECT_ROOT, "out/NetworkRestakeDelegator.sol/NetworkRestakeDelegator.json "
361- ),
362- abi.encode (
363- address (symbioticCore.networkRegistry),
364- address (symbioticCore.vaultFactory),
365- address (symbioticCore.operatorVaultOptInService),
366- address (symbioticCore.operatorNetworkOptInService),
367- address (symbioticCore.delegatorFactory),
368- symbioticCore.delegatorFactory.totalTypes ()
369- ),
370- address (bytes20 (keccak256 ("SymbioticNetworkRestakeDelegatorImpl " )))
371- );
372- symbioticCore.delegatorFactory.whitelist (
373- address (bytes20 (keccak256 ("SymbioticNetworkRestakeDelegatorImpl " )))
374- );
375-
376- deployCodeTo (
377- string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/FullRestakeDelegator.sol/FullRestakeDelegator.json " ),
378- abi.encode (
379- address (symbioticCore.networkRegistry),
380- address (symbioticCore.vaultFactory),
381- address (symbioticCore.operatorVaultOptInService),
382- address (symbioticCore.operatorNetworkOptInService),
383- address (symbioticCore.delegatorFactory),
384- symbioticCore.delegatorFactory.totalTypes ()
385- ),
386- address (bytes20 (keccak256 ("SymbioticFullRestakeDelegatorImpl " )))
387- );
388- symbioticCore.delegatorFactory.whitelist (address (bytes20 (keccak256 ("SymbioticFullRestakeDelegatorImpl " ))));
389-
390- deployCodeTo (
391- string .concat (
392- SYMBIOTIC_CORE_PROJECT_ROOT, "out/OperatorSpecificDelegator.sol/OperatorSpecificDelegator.json "
393- ),
394- abi.encode (
395- address (symbioticCore.operatorRegistry),
396- address (symbioticCore.networkRegistry),
397- address (symbioticCore.vaultFactory),
398- address (symbioticCore.operatorVaultOptInService),
399- address (symbioticCore.operatorNetworkOptInService),
400- address (symbioticCore.delegatorFactory),
401- symbioticCore.delegatorFactory.totalTypes ()
402- ),
403- address (bytes20 (keccak256 ("SymbioticOperatorSpecificDelegatorImpl " )))
404- );
405- symbioticCore.delegatorFactory.whitelist (
406- address (bytes20 (keccak256 ("SymbioticOperatorSpecificDelegatorImpl " )))
407- );
408-
409- deployCodeTo (
410- string .concat (
411- SYMBIOTIC_CORE_PROJECT_ROOT,
412- "out/OperatorNetworkSpecificDelegator.sol/OperatorNetworkSpecificDelegator.json "
413- ),
414- abi.encode (
415- address (symbioticCore.operatorRegistry),
416- address (symbioticCore.networkRegistry),
417- address (symbioticCore.vaultFactory),
418- address (symbioticCore.operatorVaultOptInService),
419- address (symbioticCore.operatorNetworkOptInService),
420- address (symbioticCore.delegatorFactory),
421- symbioticCore.delegatorFactory.totalTypes ()
422- ),
423- address (bytes20 (keccak256 ("SymbioticOperatorNetworkSpecificDelegatorImpl " )))
424- );
425- symbioticCore.delegatorFactory.whitelist (
426- address (bytes20 (keccak256 ("SymbioticOperatorNetworkSpecificDelegatorImpl " )))
427- );
428-
429- deployCodeTo (
430- string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/Slasher.sol/Slasher.json " ),
431- abi.encode (
432- address (symbioticCore.vaultFactory),
433- address (symbioticCore.networkMiddlewareService),
434- address (symbioticCore.slasherFactory),
435- symbioticCore.slasherFactory.totalTypes ()
436- ),
437- address (bytes20 (keccak256 ("SymbioticSlasherImpl " )))
438- );
439- symbioticCore.slasherFactory.whitelist (address (bytes20 (keccak256 ("SymbioticSlasherImpl " ))));
440-
441- deployCodeTo (
442- string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/VetoSlasher.sol/VetoSlasher.json " ),
443- abi.encode (
444- address (symbioticCore.vaultFactory),
445- address (symbioticCore.networkMiddlewareService),
446- address (symbioticCore.networkRegistry),
447- address (symbioticCore.slasherFactory),
448- symbioticCore.slasherFactory.totalTypes ()
449- ),
450- address (bytes20 (keccak256 ("SymbioticVetoSlasherImpl " )))
451- );
452- symbioticCore.slasherFactory.whitelist (address (bytes20 (keccak256 ("SymbioticVetoSlasherImpl " ))));
453-
454- deployCodeTo (
455- string .concat (SYMBIOTIC_CORE_PROJECT_ROOT, "out/VaultConfigurator.sol/VaultConfigurator.json " ),
456- abi.encode (
457- address (symbioticCore.vaultFactory),
458- address (symbioticCore.delegatorFactory),
459- address (symbioticCore.slasherFactory)
460- ),
461- address (symbioticCore.vaultConfigurator)
462- );
463254 }
464255 }
465256
0 commit comments