From 7183364fcfb6e6de02476d176c978778f103eef5 Mon Sep 17 00:00:00 2001 From: yonada Date: Mon, 22 Apr 2024 15:46:27 +0100 Subject: [PATCH] feat(world): worldProxy emits hello events when upgraded (#2695) --- packages/world/gas-report.json | 4 ++-- packages/world/src/WorldProxy.sol | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/world/gas-report.json b/packages/world/gas-report.json index 00ceae5dad..131e2971f3 100644 --- a/packages/world/gas-report.json +++ b/packages/world/gas-report.json @@ -285,13 +285,13 @@ "file": "test/WorldProxyFactory.t.sol", "test": "testWorldProxyFactoryGas", "name": "deploy world via WorldProxyFactory", - "gasUsed": 9032337 + "gasUsed": 9100791 }, { "file": "test/WorldProxyFactory.t.sol", "test": "testWorldProxyFactoryGas", "name": "set WorldProxy implementation", - "gasUsed": 31501 + "gasUsed": 37541 }, { "file": "test/WorldResourceId.t.sol", diff --git a/packages/world/src/WorldProxy.sol b/packages/world/src/WorldProxy.sol index 0796219ad7..2219e59709 100644 --- a/packages/world/src/WorldProxy.sol +++ b/packages/world/src/WorldProxy.sol @@ -2,9 +2,8 @@ pragma solidity >=0.8.24; import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; -import { STORE_VERSION } from "@latticexyz/store/src/version.sol"; import { IStoreEvents } from "@latticexyz/store/src/IStoreEvents.sol"; -import { WORLD_VERSION } from "./version.sol"; +import { IBaseWorld } from "./codegen/interfaces/IBaseWorld.sol"; import { IWorldEvents } from "./IWorldEvents.sol"; import { AccessControl } from "./AccessControl.sol"; import { ROOT_NAMESPACE_ID } from "./constants.sol"; @@ -32,9 +31,6 @@ contract WorldProxy is Proxy { _setImplementation(implementation); StoreCore.initialize(); - emit IStoreEvents.HelloStore(STORE_VERSION); - - emit IWorldEvents.HelloWorld(WORLD_VERSION); } /** @@ -44,6 +40,8 @@ contract WorldProxy is Proxy { StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation; emit IERC1967.Upgraded(newImplementation); + emit IStoreEvents.HelloStore(IBaseWorld(newImplementation).storeVersion()); + emit IWorldEvents.HelloWorld(IBaseWorld(newImplementation).worldVersion()); } /**