diff --git a/contracts/script/DeployCrossChainPingPong.s.sol b/contracts/script/DeployCrossChainPingPong.s.sol deleted file mode 100644 index 07a27ae3..00000000 --- a/contracts/script/DeployCrossChainPingPong.s.sol +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.25; - -import {Script, console} from "forge-std/Script.sol"; -import {CrossChainPingPong} from "../src/CrossChainPingPong.sol"; - -contract DeployCrossChainPingPong is Script { - function setUp() public {} - - function _salt() internal pure returns (bytes32) { - return bytes32(0); - } - - function run() public { - uint256[] memory allowedChains = new uint256[](2); - allowedChains[0] = 901; - allowedChains[1] = 902; - - uint256 serverChainId = allowedChains[0]; - - vm.startBroadcast(); - - address crossChainPingPong = address(new CrossChainPingPong{salt: _salt()}(allowedChains, serverChainId)); - - vm.stopBroadcast(); - - console.log("Deployed CrossChainPingPong at address: ", crossChainPingPong); - } -} diff --git a/contracts/script/pingpong/Deploy.s.sol b/contracts/script/pingpong/Deploy.s.sol new file mode 100644 index 00000000..16fe44ec --- /dev/null +++ b/contracts/script/pingpong/Deploy.s.sol @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.25; + +import {Script, console} from "forge-std/Script.sol"; +import {CrossChainPingPong} from "../../src/pingpong/CrossChainPingPong.sol"; + +contract DeployScript is Script { + function setUp() public {} + + function run() public { + uint256[] memory allowedChains = new uint256[](2); + allowedChains[0] = 901; + allowedChains[1] = 902; + + vm.broadcast(); + uint256 serverChainId = allowedChains[0]; + CrossChainPingPong pingpong = new CrossChainPingPong{salt: "pingpong"}(allowedChains, serverChainId); + console.log("Deployed at: ", address(pingpong)); + } +} diff --git a/contracts/src/CrossChainPingPong.sol b/contracts/src/pingpong/CrossChainPingPong.sol similarity index 100% rename from contracts/src/CrossChainPingPong.sol rename to contracts/src/pingpong/CrossChainPingPong.sol diff --git a/contracts/test/CrossChainPingPong.t.sol b/contracts/test/pingpong/CrossChainPingPong.t.sol similarity index 99% rename from contracts/test/CrossChainPingPong.t.sol rename to contracts/test/pingpong/CrossChainPingPong.t.sol index 1458cc9a..fd3c6e4b 100644 --- a/contracts/test/CrossChainPingPong.t.sol +++ b/contracts/test/pingpong/CrossChainPingPong.t.sol @@ -8,7 +8,7 @@ import { CallerNotL2ToL2CrossDomainMessenger, InvalidCrossDomainSender, BallAlreadyServed -} from "../src/CrossChainPingPong.sol"; +} from "../../src/pingpong/CrossChainPingPong.sol"; import {IL2ToL2CrossDomainMessenger} from "@contracts-bedrock/L2/interfaces/IL2ToL2CrossDomainMessenger.sol"; import {Predeploys} from "@contracts-bedrock/libraries/Predeploys.sol"; diff --git a/docs/src/guides/interop/writing-contract-using-l2cdm.md b/docs/src/guides/interop/writing-contract-using-l2cdm.md index 7b2006a9..45d2dd3d 100644 --- a/docs/src/guides/interop/writing-contract-using-l2cdm.md +++ b/docs/src/guides/interop/writing-contract-using-l2cdm.md @@ -1,7 +1,7 @@ # Writing cross-chain contract using `L2ToL2CrossDomainMessenger` -This guide walks through the `CrossChainPingPong.sol` contract, focusing on high level design and steps on integrating the `L2ToL2CrossChainMessenger` contract. The source code can be found [here](https://github.com/ethereum-optimism/supersim/blob/f400984d8057fe54cfbaabee279a6a45cd41411b/contracts/src/CrossChainPingPong.sol). +This guide walks through the `CrossChainPingPong.sol` contract, focusing on high level design and steps on integrating the `L2ToL2CrossChainMessenger` contract. The source code can be found [here](https://github.com/ethereum-optimism/supersim/blob/main/contracts/src/pingpong/CrossChainPingPong.sol). - [High level overview](#high-level-overview) - [Diagram](#diagram)