From 815495810027b37e4f2622d9f1e956ea116e58da Mon Sep 17 00:00:00 2001 From: ryo hashimoto Date: Tue, 24 Oct 2023 14:29:56 +0900 Subject: [PATCH] fix(create-mud): set store address in PostDeploy script --- examples/minimal/packages/contracts/script/PostDeploy.s.sol | 3 +++ templates/phaser/packages/contracts/script/PostDeploy.s.sol | 3 +++ templates/react/packages/contracts/script/PostDeploy.s.sol | 3 +++ templates/vanilla/packages/contracts/script/PostDeploy.s.sol | 3 +++ 4 files changed, 12 insertions(+) diff --git a/examples/minimal/packages/contracts/script/PostDeploy.s.sol b/examples/minimal/packages/contracts/script/PostDeploy.s.sol index 89907cacd1..ef80d0dde9 100644 --- a/examples/minimal/packages/contracts/script/PostDeploy.s.sol +++ b/examples/minimal/packages/contracts/script/PostDeploy.s.sol @@ -12,6 +12,9 @@ import { ChatNamespacedSystem } from "../src/systems/ChatNamespacedSystem.sol"; contract PostDeploy is Script { function run(address worldAddress) external { + // Specify a store so that you can use tables directly in PostDeploy + StoreSwitch.setStoreAddress(worldAddress); + // Load the private key from the `PRIVATE_KEY` environment variable (in .env) uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); diff --git a/templates/phaser/packages/contracts/script/PostDeploy.s.sol b/templates/phaser/packages/contracts/script/PostDeploy.s.sol index d8600bb5ed..3081e00a5d 100644 --- a/templates/phaser/packages/contracts/script/PostDeploy.s.sol +++ b/templates/phaser/packages/contracts/script/PostDeploy.s.sol @@ -7,6 +7,9 @@ import { IWorld } from "../src/codegen/world/IWorld.sol"; contract PostDeploy is Script { function run(address worldAddress) external { + // Specify a store so that you can use tables directly in PostDeploy + StoreSwitch.setStoreAddress(worldAddress); + // Load the private key from the `PRIVATE_KEY` environment variable (in .env) uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); diff --git a/templates/react/packages/contracts/script/PostDeploy.s.sol b/templates/react/packages/contracts/script/PostDeploy.s.sol index d8600bb5ed..3081e00a5d 100644 --- a/templates/react/packages/contracts/script/PostDeploy.s.sol +++ b/templates/react/packages/contracts/script/PostDeploy.s.sol @@ -7,6 +7,9 @@ import { IWorld } from "../src/codegen/world/IWorld.sol"; contract PostDeploy is Script { function run(address worldAddress) external { + // Specify a store so that you can use tables directly in PostDeploy + StoreSwitch.setStoreAddress(worldAddress); + // Load the private key from the `PRIVATE_KEY` environment variable (in .env) uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); diff --git a/templates/vanilla/packages/contracts/script/PostDeploy.s.sol b/templates/vanilla/packages/contracts/script/PostDeploy.s.sol index d8600bb5ed..3081e00a5d 100644 --- a/templates/vanilla/packages/contracts/script/PostDeploy.s.sol +++ b/templates/vanilla/packages/contracts/script/PostDeploy.s.sol @@ -7,6 +7,9 @@ import { IWorld } from "../src/codegen/world/IWorld.sol"; contract PostDeploy is Script { function run(address worldAddress) external { + // Specify a store so that you can use tables directly in PostDeploy + StoreSwitch.setStoreAddress(worldAddress); + // Load the private key from the `PRIVATE_KEY` environment variable (in .env) uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");