-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from chainhackers/36-first-integrated-launch
BattleShipDeploy.s.sol #36
- Loading branch information
Showing
17 changed files
with
651 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,7 @@ out/ | |
/broadcast/*/31337/ | ||
/broadcast/**/dry-run/ | ||
|
||
broadcast | ||
|
||
# Docs | ||
docs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.13; | ||
|
||
import {Script, console2} from "forge-std/Script.sol"; | ||
import "../src/BattleShip.sol"; | ||
import "../src/verifiers/battleship_init.sol"; | ||
import "../src/verifiers/battleship_move.sol"; | ||
|
||
contract BattleShipDeploy is Script { | ||
//Goerli | ||
address constant REGISTRY = 0x15009Cbe24D1bFA83ABeCD177a5cd00B0D069AC0; | ||
address constant BACKEND = 0xb95A131ABF8c82aC9A3e9715Fb2eb1f7E2AAfcE8; | ||
|
||
function run() public { | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
address deployerAddr = vm.addr(deployerPrivateKey); | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
BattleShipInitVerifier initVerifier = new BattleShipInitVerifier(); | ||
BattleShipMoveVerifier moveVerifier = new BattleShipMoveVerifier(); | ||
|
||
BattleShip battleShip = new BattleShip( | ||
IGameRegistry(REGISTRY), | ||
BACKEND, | ||
initVerifier, | ||
moveVerifier | ||
); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.13; | ||
|
||
import {Script, console2} from "forge-std/Script.sol"; | ||
import "../src/interfaces/IGameRegistry.sol"; | ||
import "../src/GameRegistry.sol"; | ||
import "./IUpgradeable.sol"; | ||
|
||
import {ERC1967Proxy} from "../lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
|
||
contract GameRegistryUpgrade is Script { | ||
//Goerli | ||
address constant REGISTRY = 0x15009Cbe24D1bFA83ABeCD177a5cd00B0D069AC0; | ||
|
||
function run() public { | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
address deployerAddr = vm.addr(deployerPrivateKey); | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
address newGrid = address(new GameRegistry()); | ||
bytes memory data = abi.encodeCall( | ||
GameRegistry.initialize, | ||
"https://arweave.net/rip5RY1wf8gKBl5CxEAKQHG9tc09SqyMFwJDOYT8xX0/{id}"); | ||
IUpgradeable(REGISTRY).upgradeTo(newGrid); | ||
|
||
GameRegistry registry = GameRegistry(REGISTRY); | ||
assert(registry.owner() == deployerAddr); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
interface IUpgradeable { | ||
//https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/proxy/utils/UUPSUpgradeable.sol#L68 | ||
function upgradeTo(address newImplementation) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.