@@ -15,7 +15,7 @@ import { IDelayedWETH } from "interfaces/dispute/IDelayedWETH.sol";
1515import { IPreimageOracle } from "interfaces/cannon/IPreimageOracle.sol " ;
1616import { IMIPS } from "interfaces/cannon/IMIPS.sol " ;
1717import { IDisputeGameFactory } from "interfaces/dispute/IDisputeGameFactory.sol " ;
18-
18+ import { IAnchorStateRegistry } from " interfaces/dispute/IAnchorStateRegistry.sol " ;
1919import { OPContractsManager } from "src/L1/OPContractsManager.sol " ;
2020import { IOptimismPortal2 } from "interfaces/L1/IOptimismPortal2.sol " ;
2121import { ISystemConfig } from "interfaces/L1/ISystemConfig.sol " ;
@@ -165,6 +165,7 @@ contract DeployImplementationsOutput is BaseDeployIO {
165165 IL1StandardBridge internal _l1StandardBridgeImpl;
166166 IOptimismMintableERC20Factory internal _optimismMintableERC20FactoryImpl;
167167 IDisputeGameFactory internal _disputeGameFactoryImpl;
168+ IAnchorStateRegistry internal _anchorStateRegistryImpl;
168169
169170 function set (bytes4 _sel , address _addr ) public {
170171 require (_addr != address (0 ), "DeployImplementationsOutput: cannot set zero address " );
@@ -181,6 +182,7 @@ contract DeployImplementationsOutput is BaseDeployIO {
181182 else if (_sel == this .l1StandardBridgeImpl.selector ) _l1StandardBridgeImpl = IL1StandardBridge (payable (_addr));
182183 else if (_sel == this .optimismMintableERC20FactoryImpl.selector ) _optimismMintableERC20FactoryImpl = IOptimismMintableERC20Factory (_addr);
183184 else if (_sel == this .disputeGameFactoryImpl.selector ) _disputeGameFactoryImpl = IDisputeGameFactory (_addr);
185+ else if (_sel == this .anchorStateRegistryImpl.selector ) _anchorStateRegistryImpl = IAnchorStateRegistry (_addr);
184186 else revert ("DeployImplementationsOutput: unknown selector " );
185187 // forgefmt: disable-end
186188 }
@@ -202,7 +204,8 @@ contract DeployImplementationsOutput is BaseDeployIO {
202204 address (this .l1ERC721BridgeImpl ()),
203205 address (this .l1StandardBridgeImpl ()),
204206 address (this .optimismMintableERC20FactoryImpl ()),
205- address (this .disputeGameFactoryImpl ())
207+ address (this .disputeGameFactoryImpl ()),
208+ address (this .anchorStateRegistryImpl ())
206209 );
207210
208211 DeployUtils.assertValidContractAddresses (Solarray.extend (addrs1, addrs2));
@@ -265,10 +268,16 @@ contract DeployImplementationsOutput is BaseDeployIO {
265268 return _disputeGameFactoryImpl;
266269 }
267270
271+ function anchorStateRegistryImpl () public view returns (IAnchorStateRegistry) {
272+ DeployUtils.assertValidContractAddress (address (_anchorStateRegistryImpl));
273+ return _anchorStateRegistryImpl;
274+ }
275+
268276 // -------- Deployment Assertions --------
269277 function assertValidDeploy (DeployImplementationsInput _dii ) public view {
270278 assertValidDelayedWETHImpl (_dii);
271279 assertValidDisputeGameFactoryImpl (_dii);
280+ assertValidAnchorStateRegistryImpl (_dii);
272281 assertValidL1CrossDomainMessengerImpl (_dii);
273282 assertValidL1ERC721BridgeImpl (_dii);
274283 assertValidL1StandardBridgeImpl (_dii);
@@ -410,6 +419,12 @@ contract DeployImplementationsOutput is BaseDeployIO {
410419
411420 require (address (factory.owner ()) == address (0 ), "DG-10 " );
412421 }
422+
423+ function assertValidAnchorStateRegistryImpl (DeployImplementationsInput) internal view {
424+ IAnchorStateRegistry registry = anchorStateRegistryImpl ();
425+
426+ DeployUtils.assertInitialized ({ _contractAddress: address (registry), _isProxy: false , _slot: 0 , _offset: 0 });
427+ }
413428}
414429
415430contract DeployImplementations is Script {
@@ -427,7 +442,7 @@ contract DeployImplementations is Script {
427442 deployPreimageOracleSingleton (_dii, _dio);
428443 deployMipsSingleton (_dii, _dio);
429444 deployDisputeGameFactoryImpl (_dii, _dio);
430-
445+ deployAnchorStateRegistryImpl (_dii, _dio);
431446 // Deploy the OP Contracts Manager with the new implementations set.
432447 deployOPContractsManager (_dii, _dio);
433448
@@ -459,6 +474,7 @@ contract DeployImplementations is Script {
459474 l1CrossDomainMessengerImpl: address (_dio.l1CrossDomainMessengerImpl ()),
460475 l1StandardBridgeImpl: address (_dio.l1StandardBridgeImpl ()),
461476 disputeGameFactoryImpl: address (_dio.disputeGameFactoryImpl ()),
477+ anchorStateRegistryImpl: address (_dio.anchorStateRegistryImpl ()),
462478 delayedWETHImpl: address (_dio.delayedWETHImpl ()),
463479 mipsImpl: address (_dio.mipsSingleton ())
464480 });
@@ -499,7 +515,6 @@ contract DeployImplementations is Script {
499515 blueprints.proxyAdmin = deployBytecode (Blueprint.blueprintDeployerBytecode (vm.getCode ("ProxyAdmin " )), salt);
500516 blueprints.l1ChugSplashProxy = deployBytecode (Blueprint.blueprintDeployerBytecode (vm.getCode ("L1ChugSplashProxy " )), salt);
501517 blueprints.resolvedDelegateProxy = deployBytecode (Blueprint.blueprintDeployerBytecode (vm.getCode ("ResolvedDelegateProxy " )), salt);
502- blueprints.anchorStateRegistry = deployBytecode (Blueprint.blueprintDeployerBytecode (vm.getCode ("AnchorStateRegistry " )), salt);
503518 (blueprints.permissionedDisputeGame1, blueprints.permissionedDisputeGame2) = deployBigBytecode (vm.getCode ("PermissionedDisputeGame " ), salt);
504519 vm.stopBroadcast ();
505520 // forgefmt: disable-end
@@ -660,7 +675,7 @@ contract DeployImplementations is Script {
660675 // | Contract | Proxied | Deployment | MCP Ready |
661676 // |-------------------------|---------|-----------------------------------|------------|
662677 // | DisputeGameFactory | Yes | Bespoke | Yes |
663- // | AnchorStateRegistry | Yes | Bespoke | No |
678+ // | AnchorStateRegistry | Yes | Bespoke | Yes |
664679 // | FaultDisputeGame | No | Bespoke | No | Not yet supported by OPCM
665680 // | PermissionedDisputeGame | No | Bespoke | No |
666681 // | DelayedWETH | Yes | Two bespoke (one per DisputeGame) | Yes *️⃣ |
@@ -677,6 +692,7 @@ contract DeployImplementations is Script {
677692 // here we deploy:
678693 //
679694 // - DisputeGameFactory (implementation)
695+ // - AnchorStateRegistry (implementation)
680696 // - OptimismPortal2 (implementation)
681697 // - DelayedWETH (implementation)
682698 // - PreimageOracle (singleton)
@@ -685,7 +701,6 @@ contract DeployImplementations is Script {
685701 // For contracts which are not MCP ready neither the Proxy nor the implementation can be shared, therefore they
686702 // are deployed by `DeployOpChain.s.sol`.
687703 // These are:
688- // - AnchorStateRegistry (proxy and implementation)
689704 // - FaultDisputeGame (not proxied)
690705 // - PermissionedDisputeGame (not proxied)
691706 // - DelayedWeth (proxies only)
@@ -839,6 +854,35 @@ contract DeployImplementations is Script {
839854 _dio.set (_dio.disputeGameFactoryImpl.selector , address (impl));
840855 }
841856
857+ function deployAnchorStateRegistryImpl (
858+ DeployImplementationsInput _dii ,
859+ DeployImplementationsOutput _dio
860+ )
861+ public
862+ virtual
863+ {
864+ string memory release = _dii.l1ContractsRelease ();
865+ string memory stdVerToml = _dii.standardVersionsToml ();
866+ string memory contractName = "anchor_state_registry " ;
867+ IAnchorStateRegistry impl;
868+
869+ address existingImplementation = getReleaseAddress (release, contractName, stdVerToml);
870+ if (existingImplementation != address (0 )) {
871+ impl = IAnchorStateRegistry (payable (existingImplementation));
872+ } else {
873+ vm.broadcast (msg .sender );
874+ impl = IAnchorStateRegistry (
875+ DeployUtils.create1 ({
876+ _name: "AnchorStateRegistry " ,
877+ _args: DeployUtils.encodeConstructor (abi.encodeCall (IAnchorStateRegistry.__constructor__, ()))
878+ })
879+ );
880+ }
881+
882+ vm.label (address (impl), "AnchorStateRegistryImpl " );
883+ _dio.set (_dio.anchorStateRegistryImpl.selector , address (impl));
884+ }
885+
842886 // -------- Utilities --------
843887
844888 function etchIOContracts () public returns (DeployImplementationsInput dii_ , DeployImplementationsOutput dio_ ) {
@@ -969,6 +1013,7 @@ contract DeployImplementationsInterop is DeployImplementations {
9691013 l1CrossDomainMessengerImpl: address (_dio.l1CrossDomainMessengerImpl ()),
9701014 l1StandardBridgeImpl: address (_dio.l1StandardBridgeImpl ()),
9711015 disputeGameFactoryImpl: address (_dio.disputeGameFactoryImpl ()),
1016+ anchorStateRegistryImpl: address (_dio.anchorStateRegistryImpl ()),
9721017 delayedWETHImpl: address (_dio.delayedWETHImpl ()),
9731018 mipsImpl: address (_dio.mipsSingleton ())
9741019 });
0 commit comments