From b0e5a1770d8972ca34b42c8bdabd74ac17ef4716 Mon Sep 17 00:00:00 2001 From: Noy <59097122+noyyyy@users.noreply.github.com> Date: Fri, 1 Dec 2023 01:40:00 +0800 Subject: [PATCH 1/2] build: update mud to next14 --- package.json | 4 +- packages/client/package.json | 20 +- packages/contracts/package.json | 16 +- .../contracts/script/ConfigInitializer.sol | 4 +- .../contracts/script/CreatureInitializer.sol | 13 +- .../contracts/script/EffectInitializer.sol | 54 ++-- packages/contracts/script/PostDeploy.s.sol | 5 +- .../contracts/src/systems/RandomSystem.sol | 10 +- packages/contracts/test/AutoBattleTest.t.sol | 31 +- packages/contracts/test/MatchingTest.t.sol | 14 +- packages/contracts/test/PveTest.t.sol | 4 + .../contracts/test/ReadWriteStateTest.t.sol | 10 +- packages/contracts/test/ShopTest.t.sol | 33 +- packages/contracts/test/SynergyTest.t.sol | 87 +++--- packages/contracts/test/TestCommon.t.sol | 38 +-- packages/contracts/worlds.json | 2 +- pnpm-lock.yaml | 289 ++++++++++-------- 17 files changed, 327 insertions(+), 307 deletions(-) diff --git a/package.json b/package.json index 498943e..cdaf887 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ ] }, "devDependencies": { - "@latticexyz/cli": "2.0.0-next.11", + "@latticexyz/cli": "2.0.0-next.14", "@typescript-eslint/eslint-plugin": "5.46.1", "@typescript-eslint/parser": "5.46.1", "concurrently": "^8.0.1", @@ -45,4 +45,4 @@ "dependencies": { "eslint-plugin-react": "7.31.11" } -} \ No newline at end of file +} diff --git a/packages/client/package.json b/packages/client/package.json index 1046245..aface07 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -11,15 +11,15 @@ "test": "tsc --noEmit" }, "dependencies": { - "@latticexyz/common": "2.0.0-next.11", - "@latticexyz/dev-tools": "2.0.0-next.11", - "@latticexyz/react": "2.0.0-next.11", - "@latticexyz/recs": "2.0.0-next.11", - "@latticexyz/schema-type": "2.0.0-next.11", - "@latticexyz/services": "2.0.0-next.11", - "@latticexyz/store-sync": "2.0.0-next.11", - "@latticexyz/utils": "2.0.0-next.11", - "@latticexyz/world": "2.0.0-next.11", + "@latticexyz/common": "2.0.0-next.14", + "@latticexyz/dev-tools": "2.0.0-next.14", + "@latticexyz/react": "2.0.0-next.14", + "@latticexyz/recs": "2.0.0-next.14", + "@latticexyz/schema-type": "2.0.0-next.14", + "@latticexyz/services": "2.0.0-next.14", + "@latticexyz/store-sync": "2.0.0-next.14", + "@latticexyz/utils": "2.0.0-next.14", + "@latticexyz/world": "2.0.0-next.14", "ahooks": "^3.7.8", "antd": "^5.8.4", "autoprefixer": "^10.4.15", @@ -45,4 +45,4 @@ "vite": "^4.2.1", "wait-port": "^1.0.4" } -} \ No newline at end of file +} diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 38f2059..3f6db96 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -22,11 +22,11 @@ "test": "tsc --noEmit && mud test" }, "dependencies": { - "@latticexyz/cli": "2.0.0-next.11", - "@latticexyz/schema-type": "2.0.0-next.11", - "@latticexyz/store": "2.0.0-next.11", - "@latticexyz/world": "2.0.0-next.11", - "@latticexyz/world-modules": "2.0.0-next.11" + "@latticexyz/cli": "2.0.0-next.14", + "@latticexyz/schema-type": "2.0.0-next.14", + "@latticexyz/store": "2.0.0-next.14", + "@latticexyz/world": "2.0.0-next.14", + "@latticexyz/world-modules": "2.0.0-next.14" }, "devDependencies": { "@types/node": "^18.15.11", @@ -35,7 +35,7 @@ "prettier": "^2.6.2", "prettier-plugin-solidity": "^1.0.0-beta.19", "solhint": "^3.3.7", - "solhint-config-mud": "2.0.0-next.11", - "solhint-plugin-mud": "2.0.0-next.11" + "solhint-config-mud": "2.0.0-next.14", + "solhint-plugin-mud": "2.0.0-next.14" } -} \ No newline at end of file +} diff --git a/packages/contracts/script/ConfigInitializer.sol b/packages/contracts/script/ConfigInitializer.sol index 0555fc1..d621787 100644 --- a/packages/contracts/script/ConfigInitializer.sol +++ b/packages/contracts/script/ConfigInitializer.sol @@ -4,9 +4,11 @@ pragma solidity >=0.8.0; import {console} from "forge-std/console.sol"; import {IWorld} from "../src/codegen/world/IWorld.sol"; import {GameConfig, ShopConfig} from "../src/codegen/index.sol"; +import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol"; library ConfigInitializer { function initGameConfig(IWorld _world) internal { + StoreSwitch.setStoreAddress(address(_world)); uint8[] memory expUpgrade = new uint8[](8); expUpgrade[0] = 1; expUpgrade[1] = 1; @@ -18,7 +20,6 @@ library ConfigInitializer { expUpgrade[7] = 56; GameConfig.set( - _world, 0, // GameConfig key 0, // game index 0, // creature index @@ -46,7 +47,6 @@ library ConfigInitializer { rarityRate[9] = 0x071f19160f; // 7 31 25 22 15 ShopConfig.set( - _world, 0, 5, // slot num 2, // refresh price diff --git a/packages/contracts/script/CreatureInitializer.sol b/packages/contracts/script/CreatureInitializer.sol index 15b0f4a..94f25cd 100644 --- a/packages/contracts/script/CreatureInitializer.sol +++ b/packages/contracts/script/CreatureInitializer.sol @@ -8,11 +8,11 @@ import {CreatureRace, CreatureClass} from "../src/codegen/common.sol"; library CreatureInitializer { // creature internal index start from 1 - function _increCreatureCounter(IWorld _world, uint256 _rarity) private returns (uint256 current) { - uint256 counter = GameConfig.getCreatureCounter(_world, 0); + function _increCreatureCounter(uint256 _rarity) private returns (uint256 current) { + uint256 counter = GameConfig.getCreatureCounter(0); counter += 1 << ((_rarity - 1) * 8); current = uint8(counter >> ((_rarity - 1) * 8)); - GameConfig.setCreatureCounter(_world, 0, uint40(counter)); + GameConfig.setCreatureCounter(0, uint40(counter)); } function _genCreatureIndex(uint256 _tier, uint256 _rarity, uint256 _index) private pure returns (uint24 index) { @@ -32,9 +32,8 @@ library CreatureInitializer { uint32 _movement, string memory _uri ) private { - uint256 internalIndex = _increCreatureCounter(_world, _rarity); + uint256 internalIndex = _increCreatureCounter(_rarity); Creature.set( - _world, _genCreatureIndex(0, _rarity, internalIndex), _race, _class, @@ -46,7 +45,6 @@ library CreatureInitializer { _movement ); Creature.set( - _world, _genCreatureIndex(1, _rarity, internalIndex), _race, _class, @@ -58,7 +56,6 @@ library CreatureInitializer { _movement ); Creature.set( - _world, _genCreatureIndex(2, _rarity, internalIndex), _race, _class, @@ -69,7 +66,7 @@ library CreatureInitializer { _speed, _movement ); - CreatureUri.set(_world, uint16(_genCreatureIndex(0, _rarity, internalIndex)), _uri); + CreatureUri.set(uint16(_genCreatureIndex(0, _rarity, internalIndex)), _uri); } function init(IWorld _world) internal { diff --git a/packages/contracts/script/EffectInitializer.sol b/packages/contracts/script/EffectInitializer.sol index 026de11..d656ec3 100644 --- a/packages/contracts/script/EffectInitializer.sol +++ b/packages/contracts/script/EffectInitializer.sol @@ -17,39 +17,38 @@ library EffectInitializer { function _initSynergy(IWorld _world) private { // race synergy // orc: + max health 100/300 - RaceSynergyEffect.set(_world, 0x000200, 0, 0x8080_ff); - RaceSynergyEffect.set(_world, 0x000400, 0, 0x8081_ff); + RaceSynergyEffect.set(0x000200, 0, 0x8080_ff); + RaceSynergyEffect.set(0x000400, 0, 0x8081_ff); // god: + attack 20% - RaceSynergyEffect.set(_world, 0x020000, 0, 0x8082_ff); + RaceSynergyEffect.set(0x020000, 0, 0x8082_ff); // pandaren: + evasion 20/30 - RaceSynergyEffect.set(_world, 0x000020, 0, 0x8083_ff); - RaceSynergyEffect.set(_world, 0x000040, 0, 0x8084_ff); + RaceSynergyEffect.set(0x000020, 0, 0x8083_ff); + RaceSynergyEffect.set(0x000040, 0, 0x8084_ff); // human: + dmg_reduction 10/20 when at least one ally is around - RaceSynergyEffect.set(_world, 0x002000, 0, 0x0c80_ff); - RaceSynergyEffect.set(_world, 0x004000, 0, 0x0c81_ff); + RaceSynergyEffect.set(0x002000, 0, 0x0c80_ff); + RaceSynergyEffect.set(0x004000, 0, 0x0c81_ff); // troll: + 10% attack the enemy twice - RaceSynergyEffect.set(_world, 0x000002, 0, 0x1c80_ff); + RaceSynergyEffect.set(0x000002, 0, 0x1c80_ff); // class synergy // mage: - enemy defense 20%/40% - ClassSynergyEffect.set(_world, 0x020000, 1, 0x8100_ff); - ClassSynergyEffect.set(_world, 0x040000, 1, 0x8101_ff); + ClassSynergyEffect.set(0x020000, 1, 0x8100_ff); + ClassSynergyEffect.set(0x040000, 1, 0x8101_ff); // warrior: + defense 5/10 - ClassSynergyEffect.set(_world, 0x002000, 0, 0x8102_ff); - ClassSynergyEffect.set(_world, 0x004000, 0, 0x8103_ff); + ClassSynergyEffect.set(0x002000, 0, 0x8102_ff); + ClassSynergyEffect.set(0x004000, 0, 0x8103_ff); // knight: + immunity 10 - ClassSynergyEffect.set(_world, 0x000002, 0, 0x8104_ff); + ClassSynergyEffect.set(0x000002, 0, 0x8104_ff); // assassin: + crit 10/20 - ClassSynergyEffect.set(_world, 0x000200, 0, 0x8105_ff); - ClassSynergyEffect.set(_world, 0x000400, 0, 0x8106_ff); + ClassSynergyEffect.set(0x000200, 0, 0x8105_ff); + ClassSynergyEffect.set(0x000400, 0, 0x8106_ff); // warlock: + 10% stun enemy for 1 turn on attack - ClassSynergyEffect.set(_world, 0x000020, 0, 0x1d00_ff); + ClassSynergyEffect.set(0x000020, 0, 0x1d00_ff); } function _initEffects(IWorld _world) private { // index = binary(1_0000_0_001000_0000) = 0x8080 _newEffect( - _world, true, EventType.NONE, false, @@ -60,7 +59,6 @@ library EffectInitializer { ); // index = binary(1_0000_0_001000_0001) = 0x8081 _newEffect( - _world, true, EventType.NONE, false, @@ -71,7 +69,6 @@ library EffectInitializer { ); // index = binary(1_0000_0_001000_0002) = 0x8082 _newEffect( - _world, true, EventType.NONE, false, @@ -82,7 +79,6 @@ library EffectInitializer { ); // index = binary(1_0000_0_001000_0003) = 0x8083 _newEffect( - _world, true, EventType.NONE, false, @@ -93,7 +89,6 @@ library EffectInitializer { ); // index = binary(1_0000_0_001000_0004) = 0x8084 _newEffect( - _world, true, EventType.NONE, false, @@ -104,7 +99,6 @@ library EffectInitializer { ); // index = binary(1_0000_0_010000_0000) = 0x8100 _newEffect( - _world, true, EventType.NONE, false, @@ -115,7 +109,6 @@ library EffectInitializer { ); // index = binary(1_0000_0_010000_0001) = 0x8101 _newEffect( - _world, true, EventType.NONE, false, @@ -126,7 +119,6 @@ library EffectInitializer { ); // index = binary(1_0000_0_010000_0002) = 0x8102 _newEffect( - _world, true, EventType.NONE, false, @@ -137,7 +129,6 @@ library EffectInitializer { ); // index = binary(1_0000_0_010000_0003) = 0x8103 _newEffect( - _world, true, EventType.NONE, false, @@ -148,7 +139,6 @@ library EffectInitializer { ); // index = binary(1_0000_0_010000_0004) = 0x8104 _newEffect( - _world, true, EventType.NONE, false, @@ -159,7 +149,6 @@ library EffectInitializer { ); // index = binary(1_0000_0_010000_0005) = 0x8105 _newEffect( - _world, true, EventType.NONE, false, @@ -170,7 +159,6 @@ library EffectInitializer { ); // index = binary(1_0000_0_010000_0006) = 0x8106 _newEffect( - _world, true, EventType.NONE, false, @@ -181,7 +169,6 @@ library EffectInitializer { ); // index = binary(1_0000_0_000100_0000) = 0x8040 _newEffect( - _world, true, EventType.NONE, false, @@ -192,7 +179,6 @@ library EffectInitializer { ); // index = binary(1_0000_0_000100_0001) = 0x8041 _newEffect( - _world, true, EventType.NONE, false, @@ -203,7 +189,6 @@ library EffectInitializer { ); // index = binary(1_0000_0_000100_0002) = 0x8042 _newEffect( - _world, true, EventType.NONE, false, @@ -217,7 +202,6 @@ library EffectInitializer { // class synergy // index = binary(0_0011_1_010000_0000) = 0x1d00 _newEffect( - _world, false, EventType.ON_ATTACK, true, @@ -231,7 +215,6 @@ library EffectInitializer { // race synergy // index = binary(0_0011_1_001000_0000) = 0x1c80 _newEffect( - _world, false, EventType.ON_ATTACK, true, @@ -247,7 +230,6 @@ library EffectInitializer { // with event ON_START // index = binary(0_0001_1_001000_0000) = 0x0c80 _newEffect( - _world, false, EventType.ON_START, true, @@ -260,7 +242,6 @@ library EffectInitializer { ); // index = binary(0_0001_1_001000_0001) = 0x0c81 _newEffect( - _world, false, EventType.ON_START, true, @@ -311,7 +292,6 @@ library EffectInitializer { } function _newEffect( - IWorld _world, bool _withModifier, EventType _eventType, bool _direct, @@ -330,7 +310,7 @@ library EffectInitializer { index <<= 4; index += _internalIndex & 0x0f; - Effect.set(_world, index, EffectData(_modifier, _trigger)); + Effect.set(index, EffectData(_modifier, _trigger)); } function _newModifier( diff --git a/packages/contracts/script/PostDeploy.s.sol b/packages/contracts/script/PostDeploy.s.sol index 58d48a4..cb7b16f 100644 --- a/packages/contracts/script/PostDeploy.s.sol +++ b/packages/contracts/script/PostDeploy.s.sol @@ -14,8 +14,11 @@ import {EffectInitializer} from "./EffectInitializer.sol"; import {ZkVerifier} from "../src/codegen/index.sol"; import {Groth16Verifier} from "../src/zkVerifier/Verifier.sol"; +import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol"; + contract PostDeploy is Script { function run(address worldAddress) external { + StoreSwitch.setStoreAddress(worldAddress); // Load the private key from the `PRIVATE_KEY` environment variable (in .env) uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); @@ -25,7 +28,7 @@ contract PostDeploy is Script { // ------------------ EXAMPLES ------------------ Groth16Verifier verifier = new Groth16Verifier(); - ZkVerifier.set(IWorld(worldAddress), address(verifier)); + ZkVerifier.set(address(verifier)); ConfigInitializer.initGameConfig(IWorld(worldAddress)); diff --git a/packages/contracts/src/systems/RandomSystem.sol b/packages/contracts/src/systems/RandomSystem.sol index 75915e2..bbcea1f 100644 --- a/packages/contracts/src/systems/RandomSystem.sol +++ b/packages/contracts/src/systems/RandomSystem.sol @@ -49,16 +49,16 @@ contract RandomSystem is System, VRFConsumerBaseV2Interface { * @notice so you should pass world address as args */ function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual { - require(!VrfRequest.getFulfilled(IStore(_world()), requestId), "request Id fulfilled"); + require(!VrfRequest.getFulfilled(requestId), "request Id fulfilled"); // get gameId - uint32 gameId = VrfRequest.getGameId(IStore(_world()), requestId); + uint32 gameId = VrfRequest.getGameId(requestId); // set random number to game - Game.setGlobalRandomNumber(IStore(_world()), gameId, randomWords[0]); + Game.setGlobalRandomNumber(gameId, randomWords[0]); // set vrf request as fulfilled - VrfRequest.setFulfilled(IStore(_world()), requestId, true); + VrfRequest.setFulfilled(requestId, true); } /** @@ -66,7 +66,7 @@ contract RandomSystem is System, VRFConsumerBaseV2Interface { * @notice so use msg.sender rather _msgSender() */ function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external { - address vrfCoordinator = NetworkConfig.getVrfCoordinator(IStore(_world()), block.chainid); + address vrfCoordinator = NetworkConfig.getVrfCoordinator(block.chainid); if (msg.sender != vrfCoordinator) { revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator); diff --git a/packages/contracts/test/AutoBattleTest.t.sol b/packages/contracts/test/AutoBattleTest.t.sol index 9aadc82..6edd6e7 100644 --- a/packages/contracts/test/AutoBattleTest.t.sol +++ b/packages/contracts/test/AutoBattleTest.t.sol @@ -13,6 +13,7 @@ import {GameStatus} from "src/codegen/common.sol"; import {Utils} from "../src/library/Utils.sol"; import {TestCommon} from "./TestCommon.t.sol"; +import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol"; contract AutoBattleSystemTest is MudTest { IWorld public world; @@ -20,29 +21,31 @@ contract AutoBattleSystemTest is MudTest { function setUp() public override { super.setUp(); world = IWorld(worldAddress); + StoreSwitch.setStoreAddress(worldAddress); + TestCommon.normalStart(vm, world); } function testMerge() public { // set price for refreshing hero to 0 - TestCommon.setRefreshPrice(vm, world, 0); + TestCommon.setRefreshPrice(vm, 0); // fund 10 coin - TestCommon.setPlayerCoin(vm, world, address(1), 10); + TestCommon.setPlayerCoin(vm, address(1), 10); // set player tier to 3 - TestCommon.setPlayerTier(vm, world, address(1), 3); + TestCommon.setPlayerTier(vm, address(1), 3); // set the first hero to 2 in case of affecting merge test - TestCommon.setHero(vm, world, Player.getItemHeroes(world, address(1), 0), 2, 0, 0); + TestCommon.setHero(vm, Player.getItemHeroes(address(1), 0), 2, 0, 0); vm.startPrank(address(1)); uint256 num; - uint8 slotNum = ShopConfig.getSlotNum(world, 0); + uint8 slotNum = ShopConfig.getSlotNum(0); while (num < 3) { world.buyRefreshHero(); for (uint256 i; i < slotNum; ++i) { - uint64 hero = Player.getItemHeroAltar(world, address(1), i); + uint64 hero = Player.getItemHeroAltar(address(1), i); if (hero == 1) { world.buyHero(i); - console.log("hero num on board %d", Player.lengthHeroes(world, address(1))); + console.log("hero num on board %d", Player.lengthHeroes(address(1))); ++num; if (num == 1) { world.placeToBoard(0, 1, uint32(2 + num)); @@ -52,7 +55,7 @@ contract AutoBattleSystemTest is MudTest { } } vm.stopPrank(); - assertEq(1, Utils.getHeroTier(Player.getItemInventory(world, address(1), 0))); + assertEq(1, Utils.getHeroTier(Player.getItemInventory(address(1), 0))); } function testAutoBattle() public { @@ -63,17 +66,17 @@ contract AutoBattleSystemTest is MudTest { // set block.timestamp to current+100s would make it success vm.warp(block.timestamp + 100); world.tick(0, address(1)); - console.log("ally piece id %d", uint256(Board.getItemPieces(world, address(1), 0))); - console.log("enemy piece id %d", uint256(Board.getItemEnemyPieces(world, address(1), 0))); - PieceData memory piece = Piece.get(world, bytes32(uint256(1))); + console.log("ally piece id %d", uint256(Board.getItemPieces(address(1), 0))); + console.log("enemy piece id %d", uint256(Board.getItemEnemyPieces(address(1), 0))); + PieceData memory piece = Piece.get(bytes32(uint256(1))); console.log("piece 1 cur health %d, x %d, y %d", piece.health, piece.x, piece.y); - piece = Piece.get(world, bytes32(uint256(3))); + piece = Piece.get(bytes32(uint256(3))); console.log("piece 3 cur health %d, x %d, y %d", piece.health, piece.x, piece.y); world.tick(0, address(1)); - piece = Piece.get(world, bytes32(uint256(1))); + piece = Piece.get(bytes32(uint256(1))); console.log("piece 1 cur health %d, x %d, y %d", piece.health, piece.x, piece.y); - piece = Piece.get(world, bytes32(uint256(3))); + piece = Piece.get(bytes32(uint256(3))); console.log("piece 3 cur health %d, x %d, y %d", piece.health, piece.x, piece.y); } } diff --git a/packages/contracts/test/MatchingTest.t.sol b/packages/contracts/test/MatchingTest.t.sol index 8e9047a..67ae326 100644 --- a/packages/contracts/test/MatchingTest.t.sol +++ b/packages/contracts/test/MatchingTest.t.sol @@ -9,6 +9,7 @@ import {Hero, HeroData} from "../src/codegen/index.sol"; import {Piece, PieceData} from "../src/codegen/index.sol"; import {IWorld} from "../src/codegen/world/IWorld.sol"; import {GameStatus} from "../src/codegen/common.sol"; +import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol"; contract MatchingTest is MudTest { IWorld public world; @@ -16,6 +17,7 @@ contract MatchingTest is MudTest { function setUp() public override { super.setUp(); world = IWorld(worldAddress); + StoreSwitch.setStoreAddress(worldAddress); vm.startPrank(address(1)); world.createRoom(bytes32("12345"), 3, bytes32(0)); @@ -42,7 +44,7 @@ contract MatchingTest is MudTest { vm.startPrank(address(2)); world.surrender(); - assertEq(GameRecord.getItem(world, 0, 2), address(3)); + assertEq(GameRecord.getItem(0, 2), address(3)); world.createRoom(bytes32("12345"), 3, bytes32(0)); vm.stopPrank(); @@ -55,12 +57,12 @@ contract MatchingTest is MudTest { vm.stopPrank(); // check game - GameData memory game = Game.get(world, 1); + GameData memory game = Game.get(1); assertEq(uint256(game.status), uint256(GameStatus.PREPARING)); // check player coin and exp - assertEq(Player.getCoin(world, address(1)), 1); - assertEq(Player.getExp(world, address(1)), 0); + assertEq(Player.getCoin(address(1)), 1); + assertEq(Player.getExp(address(1)), 0); } function testSelectOpponent() public { @@ -81,10 +83,10 @@ contract MatchingTest is MudTest { } function _printEnemy() private { - address[] memory players = Game.getPlayers(world, 0); + address[] memory players = Game.getPlayers(0); console.log("players [%d, %d, %d]", uint160(players[0]), uint160(players[1]), uint160(players[2])); for (uint256 i = 1; i < 4; ++i) { - console.log("enemy of %d is %d", i, uint160(Board.getEnemy(world, address(uint160(i))))); + console.log("enemy of %d is %d", i, uint160(Board.getEnemy(address(uint160(i))))); } } } diff --git a/packages/contracts/test/PveTest.t.sol b/packages/contracts/test/PveTest.t.sol index d6f4999..5103db1 100644 --- a/packages/contracts/test/PveTest.t.sol +++ b/packages/contracts/test/PveTest.t.sol @@ -10,6 +10,8 @@ import {Piece, PieceData} from "../src/codegen/index.sol"; import {IWorld} from "../src/codegen/world/IWorld.sol"; import {GameStatus} from "../src/codegen/common.sol"; +import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol"; + contract PveTest is MudTest { IWorld public world; @@ -19,6 +21,8 @@ contract PveTest is MudTest { worldAddress = abi.decode(vm.parseJson(vm.readFile("deploys/31337/latest.json"), ".worldAddress"), (address)); world = IWorld(worldAddress); + + StoreSwitch.setStoreAddress(worldAddress); } function testSinglePlay() public { diff --git a/packages/contracts/test/ReadWriteStateTest.t.sol b/packages/contracts/test/ReadWriteStateTest.t.sol index 4d72f62..c8d0d6d 100644 --- a/packages/contracts/test/ReadWriteStateTest.t.sol +++ b/packages/contracts/test/ReadWriteStateTest.t.sol @@ -9,6 +9,7 @@ import {Hero, HeroData} from "../src/codegen/index.sol"; import {Piece, PieceData} from "../src/codegen/index.sol"; import {IWorld} from "../src/codegen/world/IWorld.sol"; import {GameStatus} from "../src/codegen/common.sol"; +import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol"; contract ReadWriteStateTest is MudTest { IWorld public world; @@ -16,6 +17,7 @@ contract ReadWriteStateTest is MudTest { function setUp() public override { super.setUp(); world = IWorld(worldAddress); + StoreSwitch.setStoreAddress(worldAddress); uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); @@ -25,23 +27,23 @@ contract ReadWriteStateTest is MudTest { function testWriteState() public { for (uint256 i; i < 10; ++i) { - Piece.setHealth(world, bytes32(uint256(1)), 100); + Piece.setHealth(bytes32(uint256(1)), 100); } } function testReadState1() public { for (uint256 i; i < 10; ++i) { - uint32 health = Piece.getHealth(world, bytes32(uint256(1))); + uint32 health = Piece.getHealth(bytes32(uint256(1))); } } function testReadState2() public { - Piece.getHealth(world, bytes32(uint256(1))); + Piece.getHealth(bytes32(uint256(1))); // Piece.getX(world, bytes32(uint256(1))); // Piece.getY(world, bytes32(uint256(1))); } function testReadState3() public { - Piece.get(world, bytes32(uint256(1))); + Piece.get(bytes32(uint256(1))); } } diff --git a/packages/contracts/test/ShopTest.t.sol b/packages/contracts/test/ShopTest.t.sol index 87919f8..4d389e0 100644 --- a/packages/contracts/test/ShopTest.t.sol +++ b/packages/contracts/test/ShopTest.t.sol @@ -11,6 +11,7 @@ import {GameStatus} from "../src/codegen/common.sol"; import {console2} from "forge-std/console2.sol"; import {TestCommon} from "./TestCommon.t.sol"; +import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol"; contract ShopSystemTest is MudTest { IWorld public world; @@ -26,6 +27,8 @@ contract ShopSystemTest is MudTest { worldAddress = abi.decode(vm.parseJson(vm.readFile("deploys/31337/latest.json"), ".worldAddress"), (address)); world = IWorld(worldAddress); + StoreSwitch.setStoreAddress(worldAddress); + bytes32 roomId = bytes32("12345"); vm.prank(_player1); @@ -39,27 +42,27 @@ contract ShopSystemTest is MudTest { vm.stopPrank(); // console2.logBytes(abi.encode(Player.getHeroAltar(_player1))); - _player1InitAltar = Player.getHeroAltar(world, _player1); - _player2InitAltar = Player.getHeroAltar(world, _player2); + _player1InitAltar = Player.getHeroAltar(_player1); + _player2InitAltar = Player.getHeroAltar(_player2); uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); // Start broadcasting transactions from the deployer account vm.startBroadcast(deployerPrivateKey); // set player1's coin to 2 - Player.setCoin(world, _player1, 2); + Player.setCoin(_player1, 2); vm.stopBroadcast(); } function testBuyHeroOne() public { // first slot not empty - uint64 hero = Player.getItemHeroAltar(world, _player1, 0); + uint64 hero = Player.getItemHeroAltar(_player1, 0); assertEq(hero != 0, true); vm.prank(_player1); world.buyHero(0); // slot should be empty after bought - assertEq(Player.getItemHeroAltar(world, _player1, 0), 0); + assertEq(Player.getItemHeroAltar(_player1, 0), 0); // inventory one should be equal to bought one - assertEq(Player.getItemInventory(world, _player1, 0), hero); + assertEq(Player.getItemInventory(_player1, 0), hero); } function testBuyHeroTwoFail() public { @@ -73,30 +76,30 @@ contract ShopSystemTest is MudTest { function testBuyDifferentTwoHero() public { // set player1's coin to 2 - TestCommon.setPlayerCoin(vm, world, _player1, 2); + TestCommon.setPlayerCoin(vm, _player1, 2); - uint64 heroOne = Player.getItemHeroAltar(world, _player1, 0); - uint64 heroTwo = Player.getItemHeroAltar(world, _player1, 1); + uint64 heroOne = Player.getItemHeroAltar(_player1, 0); + uint64 heroTwo = Player.getItemHeroAltar(_player1, 1); vm.startPrank(_player1); world.buyHero(0); world.buyHero(1); vm.stopPrank(); - assertEq(Player.getItemInventory(world, _player1, 0), heroOne); - assertEq(Player.getItemInventory(world, _player1, 1), heroTwo); + assertEq(Player.getItemInventory(_player1, 0), heroOne); + assertEq(Player.getItemInventory(_player1, 1), heroTwo); } function testPlaceBackHeroToSpecificSlot(uint256 slotSeed) public { // set player1's coin to 2 - TestCommon.setPlayerCoin(vm, world, _player1, 2); + TestCommon.setPlayerCoin(vm, _player1, 2); vm.startPrank(_player1); // buy hero world.buyHero(0); world.buyHero(1); - uint64 heroOne = Player.getItemInventory(world, _player1, 0); - uint64 heroTwo = Player.getItemInventory(world, _player2, 1); + uint64 heroOne = Player.getItemInventory(_player1, 0); + uint64 heroTwo = Player.getItemInventory(_player2, 1); // place hero to board world.placeToBoard(0, 0, 1); @@ -105,6 +108,6 @@ contract ShopSystemTest is MudTest { // world.placeBackInventory(0); world.placeBackInventoryAndSwap(0, 2); - assertEq(Player.getItemInventory(world, _player1, 2), heroOne); + assertEq(Player.getItemInventory(_player1, 2), heroOne); } } diff --git a/packages/contracts/test/SynergyTest.t.sol b/packages/contracts/test/SynergyTest.t.sol index 63dc18b..d54c713 100644 --- a/packages/contracts/test/SynergyTest.t.sol +++ b/packages/contracts/test/SynergyTest.t.sol @@ -14,67 +14,70 @@ import {Utils} from "../src/library/Utils.sol"; import {TestCommon} from "./TestCommon.t.sol"; +import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol"; + contract SynergyTest is MudTest { IWorld public world; function setUp() public override { super.setUp(); world = IWorld(worldAddress); + StoreSwitch.setStoreAddress(worldAddress); TestCommon.normalStart(vm, world); } function testOrcWarriorAndMage() public { - TestCommon.setHero(vm, world, Player.getItemHeroes(world, address(1), 0), 0x000002, /* Axe */ 0, 0); - TestCommon.setHero(vm, world, bytes32(hex"ffff"), 0x000103, /* Jugguernaut */ 0, 1); - TestCommon.setHero(vm, world, bytes32(hex"eeee"), 0x000104, /* Witch Doctor */ 0, 2); - TestCommon.setHero(vm, world, bytes32(hex"dddd"), 0x000301, /* Disruptor */ 0, 3); - TestCommon.pushPlayerHero(vm, world, address(1), bytes32(hex"ffff")); - // TestCommon.pushPlayerHero(vm, world, address(1), bytes32(hex"eeee")); - // TestCommon.pushPlayerHero(vm, world, address(1), bytes32(hex"dddd")); - - TestCommon.setHero(vm, world, Player.getItemHeroes(world, address(2), 0), 0x000202, /* Storm Spirit */ 0, 0); - TestCommon.setHero(vm, world, bytes32(hex"cccc"), 0x000003, /* Cristal Maiden */ 0, 1); - TestCommon.pushPlayerHero(vm, world, address(2), bytes32(hex"cccc")); + TestCommon.setHero(vm, Player.getItemHeroes(address(1), 0), 0x000002, /* Axe */ 0, 0); + TestCommon.setHero(vm, bytes32(hex"ffff"), 0x000103, /* Jugguernaut */ 0, 1); + TestCommon.setHero(vm, bytes32(hex"eeee"), 0x000104, /* Witch Doctor */ 0, 2); + TestCommon.setHero(vm, bytes32(hex"dddd"), 0x000301, /* Disruptor */ 0, 3); + TestCommon.pushPlayerHero(vm, address(1), bytes32(hex"ffff")); + // TestCommon.pushPlayerHero(vm, address(1), bytes32(hex"eeee")); + // TestCommon.pushPlayerHero(vm, address(1), bytes32(hex"dddd")); + + TestCommon.setHero(vm, Player.getItemHeroes(address(2), 0), 0x000202, /* Storm Spirit */ 0, 0); + TestCommon.setHero(vm, bytes32(hex"cccc"), 0x000003, /* Cristal Maiden */ 0, 1); + TestCommon.pushPlayerHero(vm, address(2), bytes32(hex"cccc")); vm.warp(block.timestamp + 100); world.tick(0, address(1)); - PieceData memory piece = Piece.get(world, bytes32(uint256(1))); + PieceData memory piece = Piece.get(bytes32(uint256(1))); console.log( "piece 1 cur HP %d, initial HP %d effects %x", piece.health, - Creature.getHealth(world, piece.creatureId), + Creature.getHealth(piece.creatureId), piece.effects ); - piece = Piece.get(world, bytes32(hex"ffff")); + piece = Piece.get(bytes32(hex"ffff")); console.log( "piece 0xffff cur HP %d, initial HP %d, effects %x", piece.health, - Creature.getHealth(world, piece.creatureId), + Creature.getHealth(piece.creatureId), piece.effects ); // world.tick(0, address(1)); - // piece = Piece.get(world, bytes32(uint256(1))); + // piece = Piece.get(bytes32(uint256(1))); // console.log("piece 1 cur health %d, effects %x", piece.health, piece.effects); - // piece = Piece.get(world, bytes32(hex"ffff")); + // piece = Piece.get(bytes32(hex"ffff")); // console.log("piece 0xffff cur health %d, effects %x", piece.health, piece.effects); } function testPandarenAssassinAndWarlock() public { - TestCommon.setHero(vm, world, Player.getItemHeroes(world, address(1), 0), 0x000102, /* Brewmaster */ 3, 0); - TestCommon.setHero(vm, world, bytes32(hex"ffff"), 0x000201, /* Ember Spirit */ 3, 1); - TestCommon.setHero(vm, world, bytes32(hex"eeee"), 0x000202, /* Storm Spirit */ 3, 2); - TestCommon.setHero(vm, world, bytes32(hex"dddd"), 0x000203, /* Earth Spirit */ 3, 3); - TestCommon.pushPlayerHero(vm, world, address(1), bytes32(hex"ffff")); - // TestCommon.pushPlayerHero(vm, world, address(1), bytes32(hex"eeee")); - // TestCommon.pushPlayerHero(vm, world, address(1), bytes32(hex"dddd")); - - TestCommon.setCreatureSpeed(vm, world, 0x000104, 10); - TestCommon.setCreatureSpeed(vm, world, 0x000301, 11); - TestCommon.setHero(vm, world, Player.getItemHeroes(world, address(2), 0), 0x000104, /* Witch Doctor */ 0, 0); - TestCommon.setHero(vm, world, bytes32(hex"cccc"), 0x000301, /* Disruptor */ 0, 1); - TestCommon.pushPlayerHero(vm, world, address(2), bytes32(hex"cccc")); + TestCommon.setHero(vm, Player.getItemHeroes(address(1), 0), 0x000102, /* Brewmaster */ 3, 0); + TestCommon.setHero(vm, bytes32(hex"ffff"), 0x000201, /* Ember Spirit */ 3, 1); + TestCommon.setHero(vm, bytes32(hex"eeee"), 0x000202, /* Storm Spirit */ 3, 2); + TestCommon.setHero(vm, bytes32(hex"dddd"), 0x000203, /* Earth Spirit */ 3, 3); + TestCommon.pushPlayerHero(vm, address(1), bytes32(hex"ffff")); + // TestCommon.pushPlayerHero(vm, address(1), bytes32(hex"eeee")); + // TestCommon.pushPlayerHero(vm, address(1), bytes32(hex"dddd")); + + TestCommon.setCreatureSpeed(vm, 0x000104, 10); + TestCommon.setCreatureSpeed(vm, 0x000301, 11); + TestCommon.setHero(vm, Player.getItemHeroes(address(2), 0), 0x000104, /* Witch Doctor */ 0, 0); + TestCommon.setHero(vm, bytes32(hex"cccc"), 0x000301, /* Disruptor */ 0, 1); + TestCommon.pushPlayerHero(vm, address(2), bytes32(hex"cccc")); vm.warp(block.timestamp + 100); // init pieces @@ -86,18 +89,18 @@ contract SynergyTest is MudTest { } function testHumanAndTroll() public { - TestCommon.setHero(vm, world, Player.getItemHeroes(world, address(1), 0), 0x000204, /* Omniknight */ 3, 0); - TestCommon.setHero(vm, world, bytes32(hex"ffff"), 0x000003, /* Crystal Maiden */ 2, 1); - TestCommon.setHero(vm, world, bytes32(hex"eeee"), 0x000205, /* Lina */ 0, 2); - TestCommon.setHero(vm, world, bytes32(hex"dddd"), 0x000302, /* Kunkka */ 0, 3); - TestCommon.pushPlayerHero(vm, world, address(1), bytes32(hex"ffff")); - // TestCommon.pushPlayerHero(vm, world, address(1), bytes32(hex"eeee")); - // TestCommon.pushPlayerHero(vm, world, address(1), bytes32(hex"dddd")); - - TestCommon.setCreatureSpeed(vm, world, 0x000401, 10); - TestCommon.setHero(vm, world, Player.getItemHeroes(world, address(2), 0), 0x000401, /* Huskar */ 1, 0); - TestCommon.setHero(vm, world, bytes32(hex"cccc"), 0x000101, /* Dazzle */ 0, 1); - TestCommon.pushPlayerHero(vm, world, address(2), bytes32(hex"cccc")); + TestCommon.setHero(vm, Player.getItemHeroes(address(1), 0), 0x000204, /* Omniknight */ 3, 0); + TestCommon.setHero(vm, bytes32(hex"ffff"), 0x000003, /* Crystal Maiden */ 2, 1); + TestCommon.setHero(vm, bytes32(hex"eeee"), 0x000205, /* Lina */ 0, 2); + TestCommon.setHero(vm, bytes32(hex"dddd"), 0x000302, /* Kunkka */ 0, 3); + TestCommon.pushPlayerHero(vm, address(1), bytes32(hex"ffff")); + // TestCommon.pushPlayerHero(vm, address(1), bytes32(hex"eeee")); + // TestCommon.pushPlayerHero(vm, address(1), bytes32(hex"dddd")); + + TestCommon.setCreatureSpeed(vm, 0x000401, 10); + TestCommon.setHero(vm, Player.getItemHeroes(address(2), 0), 0x000401, /* Huskar */ 1, 0); + TestCommon.setHero(vm, bytes32(hex"cccc"), 0x000101, /* Dazzle */ 0, 1); + TestCommon.pushPlayerHero(vm, address(2), bytes32(hex"cccc")); vm.warp(block.timestamp + 100); // init pieces diff --git a/packages/contracts/test/TestCommon.t.sol b/packages/contracts/test/TestCommon.t.sol index 4710a52..64208ac 100644 --- a/packages/contracts/test/TestCommon.t.sol +++ b/packages/contracts/test/TestCommon.t.sol @@ -27,9 +27,9 @@ library TestCommon { // buy and place hero vm.startPrank(address(1)); - uint256 slotNum = ShopConfig.getSlotNum(world, 0); + uint256 slotNum = ShopConfig.getSlotNum(0); for (uint256 i; i < slotNum; ++i) { - uint256 hero = Player.getItemHeroAltar(world, address(1), i); + uint256 hero = Player.getItemHeroAltar(address(1), i); uint256 tier = Utils.getHeroTier(hero); if (tier == 0) { world.buyHero(i); @@ -41,7 +41,7 @@ library TestCommon { vm.startPrank(address(2)); for (uint256 i; i < slotNum; ++i) { - uint64 hero = Player.getItemHeroAltar(world, address(2), i); + uint64 hero = Player.getItemHeroAltar(address(2), i); uint256 tier = Utils.getHeroTier(hero); if (tier == 0) { world.buyHero(i); @@ -52,51 +52,51 @@ library TestCommon { vm.stopPrank(); } - function setCreatureSpeed(Vm vm, IWorld world, uint24 creatureId, uint32 speed) internal { + function setCreatureSpeed(Vm vm, uint24 creatureId, uint32 speed) internal { startPrankDeployer(vm); - Creature.setSpeed(world, creatureId, speed); + Creature.setSpeed(creatureId, speed); vm.stopPrank(); } - function setHero(Vm vm, IWorld world, bytes32 heroId, uint24 creatureId, uint8 x, uint8 y) internal { + function setHero(Vm vm, bytes32 heroId, uint24 creatureId, uint8 x, uint8 y) internal { startPrankDeployer(vm); - Hero.set(world, heroId, creatureId, x, y); + Hero.set(heroId, creatureId, x, y); vm.stopPrank(); } - function setPlayerHero(Vm vm, IWorld world, address player, uint256 index, bytes32 heroId) internal { + function setPlayerHero(Vm vm, address player, uint256 index, bytes32 heroId) internal { startPrankDeployer(vm); - Player.updateHeroes(world, player, index, heroId); + Player.updateHeroes(player, index, heroId); vm.stopPrank(); } - function pushPlayerHero(Vm vm, IWorld world, address player, bytes32 heroId) internal { + function pushPlayerHero(Vm vm, address player, bytes32 heroId) internal { startPrankDeployer(vm); - Player.pushHeroes(world, player, heroId); + Player.pushHeroes(player, heroId); vm.stopPrank(); } - function popPlayerHero(Vm vm, IWorld world, address player) internal { + function popPlayerHero(Vm vm, address player) internal { startPrankDeployer(vm); - Player.popHeroes(world, player); + Player.popHeroes(player); vm.stopPrank(); } - function setPlayerCoin(Vm vm, IWorld world, address player, uint32 coin) internal { + function setPlayerCoin(Vm vm, address player, uint32 coin) internal { startPrankDeployer(vm); - Player.setCoin(world, player, coin); + Player.setCoin(player, coin); vm.stopPrank(); } - function setRefreshPrice(Vm vm, IWorld world, uint8 price) internal { + function setRefreshPrice(Vm vm, uint8 price) internal { startPrankDeployer(vm); - ShopConfig.setRefreshPrice(world, 0, price); + ShopConfig.setRefreshPrice(0, price); vm.stopPrank(); } - function setPlayerTier(Vm vm, IWorld world, address player, uint8 tier) internal { + function setPlayerTier(Vm vm, address player, uint8 tier) internal { startPrankDeployer(vm); - Player.setTier(world, player, tier); + Player.setTier(player, tier); vm.stopPrank(); } diff --git a/packages/contracts/worlds.json b/packages/contracts/worlds.json index 349ca16..db60c37 100644 --- a/packages/contracts/worlds.json +++ b/packages/contracts/worlds.json @@ -4,7 +4,7 @@ "blockNumber": 25021637 }, "31337": { - "address": "0x5FbDB2315678afecb367f032d93F642f64180aa3" + "address": "0x6e9474e9c83676b9a71133ff96db43e7aa0a4342" }, "421613": { "address": "0x0CfAA708Da4599be2cd5eE40304223b7618558f3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aaaa08f..968adb0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,8 +13,8 @@ importers: version: 7.31.11(eslint@8.29.0) devDependencies: '@latticexyz/cli': - specifier: 2.0.0-next.11 - version: 2.0.0-next.11(google-protobuf@3.21.2) + specifier: 2.0.0-next.14 + version: 2.0.0-next.14(google-protobuf@3.21.2) '@typescript-eslint/eslint-plugin': specifier: 5.46.1 version: 5.46.1(@typescript-eslint/parser@5.46.1)(eslint@8.29.0)(typescript@5.1.6) @@ -49,32 +49,32 @@ importers: packages/client: dependencies: '@latticexyz/common': - specifier: 2.0.0-next.11 - version: 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) + specifier: 2.0.0-next.14 + version: 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) '@latticexyz/dev-tools': - specifier: 2.0.0-next.11 - version: 2.0.0-next.11(@latticexyz/common@2.0.0-next.11)(@latticexyz/recs@2.0.0-next.11)(@latticexyz/store-sync@2.0.0-next.11)(@latticexyz/store@2.0.0-next.11)(@latticexyz/utils@2.0.0-next.11)(@latticexyz/world@2.0.0-next.11)(@types/react@18.2.6)(typescript@5.1.6)(zod@3.21.4) + specifier: 2.0.0-next.14 + version: 2.0.0-next.14(@latticexyz/common@2.0.0-next.14)(@latticexyz/recs@2.0.0-next.14)(@latticexyz/store-sync@2.0.0-next.14)(@latticexyz/store@2.0.0-next.14)(@latticexyz/utils@2.0.0-next.14)(@latticexyz/world@2.0.0-next.14)(@types/react@18.2.6)(typescript@5.1.6)(zod@3.21.4) '@latticexyz/react': - specifier: 2.0.0-next.11 - version: 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) + specifier: 2.0.0-next.14 + version: 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) '@latticexyz/recs': - specifier: 2.0.0-next.11 - version: 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) + specifier: 2.0.0-next.14 + version: 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) '@latticexyz/schema-type': - specifier: 2.0.0-next.11 - version: 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) + specifier: 2.0.0-next.14 + version: 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) '@latticexyz/services': - specifier: 2.0.0-next.11 - version: 2.0.0-next.11(google-protobuf@3.21.2) + specifier: 2.0.0-next.14 + version: 2.0.0-next.14(google-protobuf@3.21.2) '@latticexyz/store-sync': - specifier: 2.0.0-next.11 - version: 2.0.0-next.11(typescript@5.1.6) + specifier: 2.0.0-next.14 + version: 2.0.0-next.14(@types/react@18.2.6)(react@18.2.0)(typescript@5.1.6) '@latticexyz/utils': - specifier: 2.0.0-next.11 - version: 2.0.0-next.11 + specifier: 2.0.0-next.14 + version: 2.0.0-next.14 '@latticexyz/world': - specifier: 2.0.0-next.11 - version: 2.0.0-next.11(typescript@5.1.6) + specifier: 2.0.0-next.14 + version: 2.0.0-next.14(typescript@5.1.6) ahooks: specifier: ^3.7.8 version: 3.7.8(react@18.2.0) @@ -146,20 +146,20 @@ importers: packages/contracts: dependencies: '@latticexyz/cli': - specifier: 2.0.0-next.11 - version: 2.0.0-next.11(google-protobuf@3.21.2) + specifier: 2.0.0-next.14 + version: 2.0.0-next.14(google-protobuf@3.21.2) '@latticexyz/schema-type': - specifier: 2.0.0-next.11 - version: 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) + specifier: 2.0.0-next.14 + version: 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) '@latticexyz/store': - specifier: 2.0.0-next.11 - version: 2.0.0-next.11(typescript@5.1.6) + specifier: 2.0.0-next.14 + version: 2.0.0-next.14(typescript@5.1.6) '@latticexyz/world': - specifier: 2.0.0-next.11 - version: 2.0.0-next.11(typescript@5.1.6) + specifier: 2.0.0-next.14 + version: 2.0.0-next.14(typescript@5.1.6) '@latticexyz/world-modules': - specifier: 2.0.0-next.11 - version: 2.0.0-next.11(typescript@5.1.6) + specifier: 2.0.0-next.14 + version: 2.0.0-next.14(typescript@5.1.6) devDependencies: '@types/node': specifier: ^18.15.11 @@ -180,11 +180,11 @@ importers: specifier: ^3.3.7 version: 3.3.7 solhint-config-mud: - specifier: 2.0.0-next.11 - version: 2.0.0-next.11 + specifier: 2.0.0-next.14 + version: 2.0.0-next.14 solhint-plugin-mud: - specifier: 2.0.0-next.11 - version: 2.0.0-next.11 + specifier: 2.0.0-next.14 + version: 2.0.0-next.14 packages/indexer: {} @@ -1045,19 +1045,22 @@ packages: '@jridgewell/resolve-uri': 3.1.1 '@jridgewell/sourcemap-codec': 1.4.15 - /@latticexyz/abi-ts@2.0.0-next.11: - resolution: {integrity: sha512-0mDvCt+/40c7KS7fFc5U0FLHI4jlle10uaxCYrwkZGLv0SNJvI9h6OdHB/4Z3xH/bz6FoDI60ZVawJYgmWLeVA==} + /@latticexyz/abi-ts@2.0.0-next.14: + resolution: {integrity: sha512-qF1nZXMNsTWUTlqyq+sepsqknL9y3lymax3eCLxRvGUC/y0wL+93eels5EQRr99k/NMDfZPfqR+gqOgfvMPJAA==} hasBin: true dependencies: chalk: 5.3.0 + debug: 4.3.4 execa: 7.2.0 glob: 8.1.0 yargs: 17.7.2 + transitivePeerDependencies: + - supports-color - /@latticexyz/block-logs-stream@2.0.0-next.11(typescript@5.1.6)(zod@3.21.4): - resolution: {integrity: sha512-kYENhh7ZRwlfdHsXXJKt2Ezl95diE09QXCowT/YkjJVp10c8vPHRJgknfJ0asJTOyp+hXlonIeOcx6HuvdhykQ==} + /@latticexyz/block-logs-stream@2.0.0-next.14(typescript@5.1.6)(zod@3.21.4): + resolution: {integrity: sha512-8j74Cd0mpp6t7UIFiSawb5arzQ/pO74xzEIAb6o42zzhVfU3gjYCICcfQttJTrDEi6uyj5VBmK8QJ6oGiepF5A==} dependencies: - '@latticexyz/common': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/common': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) abitype: 0.9.8(typescript@5.1.6)(zod@3.21.4) debug: 4.3.4 rxjs: 7.5.5 @@ -1070,27 +1073,28 @@ packages: - zod dev: false - /@latticexyz/cli@2.0.0-next.11(google-protobuf@3.21.2): - resolution: {integrity: sha512-/Ja4uIo+fKzSAlF/fgjyuPRSSOxZRYK7Sj2Frzd33+VahuCy0qx9r1HxX+wXVg1XG2qFR5ljXISyd6P14ke9CA==} + /@latticexyz/cli@2.0.0-next.14(google-protobuf@3.21.2): + resolution: {integrity: sha512-Rcgb4Jv6PCgT1CR/KhjkpXVimx9wA7x/7qr0UMaK2Y+uwDurcnw8y5tKQyo2zGiMf1UhIv5AYNkkMARVDTrhxg==} hasBin: true dependencies: '@ethersproject/abi': 5.7.0 '@ethersproject/providers': 5.7.2 '@improbable-eng/grpc-web': 0.15.0(google-protobuf@3.21.2) '@improbable-eng/grpc-web-node-http-transport': 0.15.0(@improbable-eng/grpc-web@0.15.0) - '@latticexyz/abi-ts': 2.0.0-next.11 - '@latticexyz/common': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/config': 2.0.0-next.11(typescript@5.1.6) - '@latticexyz/gas-report': 2.0.0-next.11 - '@latticexyz/protocol-parser': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/schema-type': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/services': 2.0.0-next.11(google-protobuf@3.21.2) - '@latticexyz/store': 2.0.0-next.11(typescript@5.1.6) - '@latticexyz/utils': 2.0.0-next.11 - '@latticexyz/world': 2.0.0-next.11(typescript@5.1.6) - '@latticexyz/world-modules': 2.0.0-next.11(typescript@5.1.6) + '@latticexyz/abi-ts': 2.0.0-next.14 + '@latticexyz/common': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/config': 2.0.0-next.14(typescript@5.1.6) + '@latticexyz/gas-report': 2.0.0-next.14 + '@latticexyz/protocol-parser': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/schema-type': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/services': 2.0.0-next.14(google-protobuf@3.21.2) + '@latticexyz/store': 2.0.0-next.14(typescript@5.1.6) + '@latticexyz/utils': 2.0.0-next.14 + '@latticexyz/world': 2.0.0-next.14(typescript@5.1.6) + '@latticexyz/world-modules': 2.0.0-next.14(typescript@5.1.6) chalk: 5.3.0 chokidar: 3.5.3 + debug: 4.3.4 dotenv: 16.3.1 ejs: 3.1.9 ethers: 5.7.2 @@ -1098,7 +1102,9 @@ packages: glob: 8.1.0 nice-grpc-web: 2.0.2(google-protobuf@3.21.2) openurl: 1.1.1 + p-retry: 5.1.2 path: 0.12.7 + rxjs: 7.5.5 throttle-debounce: 5.0.0 typescript: 5.1.6 viem: 1.14.0(typescript@5.1.6)(zod@3.21.4) @@ -1111,14 +1117,14 @@ packages: - supports-color - utf-8-validate - /@latticexyz/common@2.0.0-next.11(typescript@5.1.6)(zod@3.21.4): - resolution: {integrity: sha512-zQ52aqjwZE3ZlS67RcTtR7qSJbM7vSKHabmF05ZXa79/+Koc1AE2X+d3odA64zwvg7Cn56PXiUcNI85NVk2Nyw==} + /@latticexyz/common@2.0.0-next.14(typescript@5.1.6)(zod@3.21.4): + resolution: {integrity: sha512-sNEz6WLmyirUkmywS6X8of2CnKZRcPNb4izVfHK/vkGueaUHiRe2Kujf5B3+LxjxcmTMERoBTEdqov/QelKlSQ==} dependencies: - '@latticexyz/schema-type': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/schema-type': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) '@solidity-parser/parser': 0.16.1 - chalk: 5.3.0 debug: 4.3.4 execa: 7.2.0 + p-queue: 7.4.1 p-retry: 5.1.2 prettier: 2.8.8 prettier-plugin-solidity: 1.1.3(prettier@2.8.8) @@ -1130,15 +1136,14 @@ packages: - utf-8-validate - zod - /@latticexyz/config@2.0.0-next.11(typescript@5.1.6): - resolution: {integrity: sha512-fsqfOSCsRcQFly4xKWOeS2Jti1UJF23e6XVvlv5ps2+yPg01XG9Wnns1ow3HbA0scfa4FfGN/CuYxCkVb020TA==} + /@latticexyz/config@2.0.0-next.14(typescript@5.1.6): + resolution: {integrity: sha512-bcMWrbxakD3kpDJdE0KStDaOOiPJQbraDb2qkkliCLXKvFc1fTMRqWYV53sGZAmFz/3ygaR0/2dVWe5HWyNNbQ==} dependencies: - '@latticexyz/common': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/schema-type': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - chalk: 5.3.0 + '@latticexyz/common': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/schema-type': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) esbuild: 0.17.19 - ethers: 5.7.2 find-up: 6.3.0 + viem: 1.14.0(typescript@5.1.6)(zod@3.21.4) zod: 3.21.4 zod-validation-error: 1.3.1(zod@3.21.4) transitivePeerDependencies: @@ -1147,23 +1152,24 @@ packages: - typescript - utf-8-validate - /@latticexyz/dev-tools@2.0.0-next.11(@latticexyz/common@2.0.0-next.11)(@latticexyz/recs@2.0.0-next.11)(@latticexyz/store-sync@2.0.0-next.11)(@latticexyz/store@2.0.0-next.11)(@latticexyz/utils@2.0.0-next.11)(@latticexyz/world@2.0.0-next.11)(@types/react@18.2.6)(typescript@5.1.6)(zod@3.21.4): - resolution: {integrity: sha512-bVB8//QBcElO/J0jhzjpaTpC5bm8FVTticfKf1J4rg4Buvnb/dbwS3IUCbVMxU9Sw7hsC5uojcsqlxqiyX8Ohw==} + /@latticexyz/dev-tools@2.0.0-next.14(@latticexyz/common@2.0.0-next.14)(@latticexyz/recs@2.0.0-next.14)(@latticexyz/store-sync@2.0.0-next.14)(@latticexyz/store@2.0.0-next.14)(@latticexyz/utils@2.0.0-next.14)(@latticexyz/world@2.0.0-next.14)(@types/react@18.2.6)(typescript@5.1.6)(zod@3.21.4): + resolution: {integrity: sha512-TCr6BQnlO8IzOH5+HkvmYDqcuvQGBOLbPI7FLh0b1bTyt6xmK5DANbN4k2pr4HOFTXnKIC/mg4ekN7f7JQl/Qg==} peerDependencies: - '@latticexyz/common': 2.0.0-next.11 - '@latticexyz/recs': 2.0.0-next.11 - '@latticexyz/store': 2.0.0-next.11 - '@latticexyz/store-sync': 2.0.0-next.11 - '@latticexyz/utils': 2.0.0-next.11 - '@latticexyz/world': 2.0.0-next.11 - dependencies: - '@latticexyz/common': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/react': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/recs': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/store': 2.0.0-next.11(typescript@5.1.6) - '@latticexyz/store-sync': 2.0.0-next.11(typescript@5.1.6) - '@latticexyz/utils': 2.0.0-next.11 - '@latticexyz/world': 2.0.0-next.11(typescript@5.1.6) + '@latticexyz/common': 2.0.0-next.14 + '@latticexyz/recs': 2.0.0-next.14 + '@latticexyz/store': 2.0.0-next.14 + '@latticexyz/store-sync': 2.0.0-next.14 + '@latticexyz/utils': 2.0.0-next.14 + '@latticexyz/world': 2.0.0-next.14 + dependencies: + '@latticexyz/common': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/react': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/recs': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/schema-type': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/store': 2.0.0-next.14(typescript@5.1.6) + '@latticexyz/store-sync': 2.0.0-next.14(@types/react@18.2.6)(react@18.2.0)(typescript@5.1.6) + '@latticexyz/utils': 2.0.0-next.14 + '@latticexyz/world': 2.0.0-next.14(typescript@5.1.6) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) react-router-dom: 6.14.2(react-dom@18.2.0)(react@18.2.0) @@ -1182,8 +1188,8 @@ packages: - zod dev: false - /@latticexyz/gas-report@2.0.0-next.11: - resolution: {integrity: sha512-mc8O9d9P87bk8z0QHZFbJAoS+w1w+JdmHAHxmaSVOQW7uRUiQED/+ERX2PierXQFswsuVnGY4Ag+CtMv1qh2+A==} + /@latticexyz/gas-report@2.0.0-next.14: + resolution: {integrity: sha512-aMcgwhSHZGGP5nCMO0duOFD5Ig6iaNVIGa/9B8X1tHqzrDqI39Fvp6vOq0v8t5lsrLD6f8BTJTHt/jr3RBpDAw==} hasBin: true dependencies: chalk: 5.3.0 @@ -1194,11 +1200,11 @@ packages: table: 6.8.1 yargs: 17.7.2 - /@latticexyz/protocol-parser@2.0.0-next.11(typescript@5.1.6)(zod@3.21.4): - resolution: {integrity: sha512-xl/+oN6AjbN67D/9qB3yJ0rnS4ziLhncAIj9duOlXjluK0dcw4UZtSEdmKqIxPvZ+QhKnJP6nqrhQEQHD8aAfA==} + /@latticexyz/protocol-parser@2.0.0-next.14(typescript@5.1.6)(zod@3.21.4): + resolution: {integrity: sha512-cpZYGi2iRjaH6qddIKop88m3zL7Hj1BSQvhougE1ZiX9JRzyr7XbtbHrHIR1nMRppxItFfHf9ZF1kC3DXx8uCA==} dependencies: - '@latticexyz/common': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/schema-type': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/common': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/schema-type': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) abitype: 0.9.8(typescript@5.1.6)(zod@3.21.4) viem: 1.14.0(typescript@5.1.6)(zod@3.21.4) transitivePeerDependencies: @@ -1208,11 +1214,11 @@ packages: - utf-8-validate - zod - /@latticexyz/react@2.0.0-next.11(typescript@5.1.6)(zod@3.21.4): - resolution: {integrity: sha512-GsKQNz09AKrJ394a12Rx3ZGUx9rr2hb4yloa1KbxBZgmsDppKyq5Y6H90SrcEQ+99SwIIDkVJTS6J7GJ+ElLTA==} + /@latticexyz/react@2.0.0-next.14(typescript@5.1.6)(zod@3.21.4): + resolution: {integrity: sha512-C7Aq++1AyI+X8XmmhV1dRtNkneZix34lDSS/NZNunwDC2KfmJBTF0uD+7IxKF0D0+E08WgXSLnOYnKEJzs7h3A==} dependencies: - '@latticexyz/recs': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/store': 2.0.0-next.11(typescript@5.1.6) + '@latticexyz/recs': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/store': 2.0.0-next.14(typescript@5.1.6) fast-deep-equal: 3.1.3 mobx: 6.10.0 react: 18.2.0 @@ -1225,11 +1231,11 @@ packages: - zod dev: false - /@latticexyz/recs@2.0.0-next.11(typescript@5.1.6)(zod@3.21.4): - resolution: {integrity: sha512-juJqfUsBkTitFa4Z1KJNE3m8i/dikl/OYLqNKXPl9J8EGSEvs24uKnoMzXoCnDBTOFRx6HzazCQ1NVOC5LB21A==} + /@latticexyz/recs@2.0.0-next.14(typescript@5.1.6)(zod@3.21.4): + resolution: {integrity: sha512-3kMqhFn5cUxwJQ75u/KR4q6x1rJI2nafXdDewOgZeyyTL3n1Pi9cwI9qhOLrXqlWs2xnSMh1hrtMTiMY2H2esw==} dependencies: - '@latticexyz/schema-type': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/utils': 2.0.0-next.11 + '@latticexyz/schema-type': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/utils': 2.0.0-next.14 mobx: 6.10.0 rxjs: 7.5.5 transitivePeerDependencies: @@ -1239,8 +1245,8 @@ packages: - zod dev: false - /@latticexyz/schema-type@2.0.0-next.11(typescript@5.1.6)(zod@3.21.4): - resolution: {integrity: sha512-HRFysd537W7yAuGYPC6c+89uSaH3PeKSxCWZCKT1OGhi6tu/2QYR+QqOuNrP4E+0A5n8lwQiYs9xbc/4/wLZfA==} + /@latticexyz/schema-type@2.0.0-next.14(typescript@5.1.6)(zod@3.21.4): + resolution: {integrity: sha512-+XAu+lnhYnwm4bRzo2yFyqcHz1aLuot44uqNcfL/9kyDLHIsrWm5QUI6t8g/HhpnNMPZ9oaNLsWLEVM0xL7htg==} dependencies: abitype: 0.9.8(typescript@5.1.6)(zod@3.21.4) viem: 1.14.0(typescript@5.1.6)(zod@3.21.4) @@ -1250,8 +1256,8 @@ packages: - utf-8-validate - zod - /@latticexyz/services@2.0.0-next.11(google-protobuf@3.21.2): - resolution: {integrity: sha512-5q0VuSio3UVQx/E32c6vQQvpOEB50+lfTl9LXJO8n7ftKrxDSd7NnXc5P7dCAQQzoeKWv9NucPMcO6jmoICNMA==} + /@latticexyz/services@2.0.0-next.14(google-protobuf@3.21.2): + resolution: {integrity: sha512-xuHsSFlaL8+fkMxlOQ6vp0KoW9zXsd3EfswV8jwdQ2JP2HOmnpbJVDEyAGPfynNfNfXCdCYB0cv70WueXrRPAQ==} dependencies: long: 5.2.3 nice-grpc-common: 2.0.2 @@ -1260,16 +1266,16 @@ packages: transitivePeerDependencies: - google-protobuf - /@latticexyz/store-sync@2.0.0-next.11(typescript@5.1.6): - resolution: {integrity: sha512-yht0mBygIC4g4EPwM9smTRLwQb2s+SEJRZ7If20edNDUD2NpWCR/iWsdGqZu7WX9nUNli/B+UhdKq1hWR4z3ug==} + /@latticexyz/store-sync@2.0.0-next.14(@types/react@18.2.6)(react@18.2.0)(typescript@5.1.6): + resolution: {integrity: sha512-A83F6JU3zIQ8bduRKcTbOACkxMQaoN17MaSrlkbSoojht+3udHQhjbXUWJFuFb7Ks0ZuinSBKkTMsPjN2hkbbw==} dependencies: - '@latticexyz/block-logs-stream': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/common': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/protocol-parser': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/recs': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/schema-type': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/store': 2.0.0-next.11(typescript@5.1.6) - '@latticexyz/world': 2.0.0-next.11(typescript@5.1.6) + '@latticexyz/block-logs-stream': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/common': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/protocol-parser': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/recs': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/schema-type': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/store': 2.0.0-next.14(typescript@5.1.6) + '@latticexyz/world': 2.0.0-next.14(typescript@5.1.6) '@trpc/client': 10.34.0(@trpc/server@10.34.0) '@trpc/server': 10.34.0 debug: 4.3.4 @@ -1281,6 +1287,7 @@ packages: superjson: 1.13.1 viem: 1.14.0(typescript@5.1.6)(zod@3.21.4) zod: 3.21.4 + zustand: 4.4.1(@types/react@18.2.6)(react@18.2.0) transitivePeerDependencies: - '@aws-sdk/client-rds-data' - '@cloudflare/workers-types' @@ -1290,27 +1297,31 @@ packages: - '@planetscale/database' - '@types/better-sqlite3' - '@types/pg' + - '@types/react' - '@types/sql.js' - '@vercel/postgres' - better-sqlite3 - bufferutil - bun-types + - immer - knex - mysql2 - pg + - react - sqlite3 - supports-color - typescript - utf-8-validate dev: false - /@latticexyz/store@2.0.0-next.11(typescript@5.1.6): - resolution: {integrity: sha512-JYH4TA4tYNOaij8etTPt+wGapEokHDzcXxO+FTc+t2GMDrFJLXFXz9ao70c5jHYjjR2a+uKRVslewksCjjP6NQ==} + /@latticexyz/store@2.0.0-next.14(typescript@5.1.6): + resolution: {integrity: sha512-k3fBGLEZZMSwHqf2OCqTOgCB8jcQKIvEC0bTYj95uB6CYGDeQPH5jaeNo/Agw4+zshdt7n8W0C2SdDtGweJ5LQ==} dependencies: - '@latticexyz/common': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/config': 2.0.0-next.11(typescript@5.1.6) - '@latticexyz/schema-type': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/common': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/config': 2.0.0-next.14(typescript@5.1.6) + '@latticexyz/schema-type': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) abitype: 0.9.8(typescript@5.1.6)(zod@3.21.4) + viem: 1.14.0(typescript@5.1.6)(zod@3.21.4) zod: 3.21.4 transitivePeerDependencies: - bufferutil @@ -1318,25 +1329,21 @@ packages: - typescript - utf-8-validate - /@latticexyz/utils@2.0.0-next.11: - resolution: {integrity: sha512-Yn3X+2e4xz9ZPKpn6icv2inuFcfmnf1zcuQRsIjEdANmxtkimu7RMWViheJ0xA6FYhklskiNaMt9l4wY6s0EMg==} + /@latticexyz/utils@2.0.0-next.14: + resolution: {integrity: sha512-g9kJ6rcyV2qoX5uF573lPbBtWaqMS4yxxCFqDgJ3j0YxilR1ldxL2A+xbiB/ELch/3xpy/+Zfvcvq0UIU03Rcg==} dependencies: - ethers: 5.7.2 mobx: 6.10.0 proxy-deep: 3.1.1 rxjs: 7.5.5 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - /@latticexyz/world-modules@2.0.0-next.11(typescript@5.1.6): - resolution: {integrity: sha512-mnuB3fCorn85oaWavAVkk4GLWPirCK1N8UxoP0s5c7ImJJkVcqoVDZBpR9Q6jrJc29PLiprnZ8T7qu0HMFOyOg==} + /@latticexyz/world-modules@2.0.0-next.14(typescript@5.1.6): + resolution: {integrity: sha512-DRpw7jA1EQS2OBK3eVzr7VnvOYdlxgMnt05R/izg3h/zuibblFFpPD8mOL6P6o8yIS8cS0nHp+LnzESlv6CgLg==} dependencies: - '@latticexyz/common': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/config': 2.0.0-next.11(typescript@5.1.6) - '@latticexyz/schema-type': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/store': 2.0.0-next.11(typescript@5.1.6) - '@latticexyz/world': 2.0.0-next.11(typescript@5.1.6) + '@latticexyz/common': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/config': 2.0.0-next.14(typescript@5.1.6) + '@latticexyz/schema-type': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/store': 2.0.0-next.14(typescript@5.1.6) + '@latticexyz/world': 2.0.0-next.14(typescript@5.1.6) zod: 3.21.4 transitivePeerDependencies: - bufferutil @@ -1344,13 +1351,15 @@ packages: - typescript - utf-8-validate - /@latticexyz/world@2.0.0-next.11(typescript@5.1.6): - resolution: {integrity: sha512-8SqW9nVM0UbrqZ1YGZz0ODHxXL5nd4Cz1m9JzIpo3iYzU1uc/sTdG62QkuXHai/6jr4UjRjWfPjb9rozqPuaMg==} + /@latticexyz/world@2.0.0-next.14(typescript@5.1.6): + resolution: {integrity: sha512-X1V5PU/knk/4iMbN5i7jr+zmK6R4/ZfER/p6szQyVBIA8jgerxH9WQTWSOO7mVWPko8iYAGHmZRYtzpEtOzajg==} dependencies: - '@latticexyz/common': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/config': 2.0.0-next.11(typescript@5.1.6) - '@latticexyz/schema-type': 2.0.0-next.11(typescript@5.1.6)(zod@3.21.4) - '@latticexyz/store': 2.0.0-next.11(typescript@5.1.6) + '@latticexyz/common': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/config': 2.0.0-next.14(typescript@5.1.6) + '@latticexyz/schema-type': 2.0.0-next.14(typescript@5.1.6)(zod@3.21.4) + '@latticexyz/store': 2.0.0-next.14(typescript@5.1.6) + abitype: 0.9.8(typescript@5.1.6)(zod@3.21.4) + viem: 1.14.0(typescript@5.1.6)(zod@3.21.4) zod: 3.21.4 transitivePeerDependencies: - bufferutil @@ -2955,6 +2964,9 @@ packages: - bufferutil - utf-8-validate + /eventemitter3@5.0.1: + resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} + /execa@7.2.0: resolution: {integrity: sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==} engines: {node: ^14.18.0 || ^16.14.0 || >=18.0.0} @@ -4041,6 +4053,13 @@ packages: aggregate-error: 3.1.0 dev: true + /p-queue@7.4.1: + resolution: {integrity: sha512-vRpMXmIkYF2/1hLBKisKeVYJZ8S2tZ0zEAmIJgdVKP2nq0nh4qCdf8bgw+ZgKrkh71AOCaqzwbJJk1WtdcF3VA==} + engines: {node: '>=12'} + dependencies: + eventemitter3: 5.0.1 + p-timeout: 5.1.0 + /p-retry@5.1.2: resolution: {integrity: sha512-couX95waDu98NfNZV+i/iLt+fdVxmI7CbrrdC2uDWfPdUAApyxT4wmDlyOtR5KtTDmkDO0zDScDjDou9YHhd9g==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -4048,6 +4067,10 @@ packages: '@types/retry': 0.12.1 retry: 0.13.1 + /p-timeout@5.1.0: + resolution: {integrity: sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==} + engines: {node: '>=12'} + /parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -5207,12 +5230,12 @@ packages: is-fullwidth-code-point: 4.0.0 dev: true - /solhint-config-mud@2.0.0-next.11: - resolution: {integrity: sha512-Y7oSY+KOvfhCaW5Yimd6hogC52xY3K3qnEjazw+8VsTInqr+aJ33U7ec6x/J1fU/CV0RH8mhphzkVJONOQsi6g==} + /solhint-config-mud@2.0.0-next.14: + resolution: {integrity: sha512-KX6HAutN8DDiAc6JeUPv09H1RGU+al8rnBwED+18DAvXDmfS8jJKq6XA4lMq7qd7PBMlzkD7+G2KW8vgQM1DlQ==} dev: true - /solhint-plugin-mud@2.0.0-next.11: - resolution: {integrity: sha512-CqZ4NWrfy3Kct77g6EHDiCEW+FlHi4omUH73fplBn5kDBNyBBunRmPc098J1BFywconEqj11oV99apIEkxPAdA==} + /solhint-plugin-mud@2.0.0-next.14: + resolution: {integrity: sha512-MJ19xePAPHBcVqzyEZuYTzOM/eEWZ0/ev+lEOQec8hw7vRPHQR8VISHLZtOYVgfPahwYlPRO8hB5SsqzDsa9CA==} dependencies: '@solidity-parser/parser': 0.16.1 dev: true From cfdf7cf64bb26906b8a83edf8f8a6e2f8abb1752 Mon Sep 17 00:00:00 2001 From: Noy <59097122+noyyyy@users.noreply.github.com> Date: Fri, 1 Dec 2023 14:13:59 +0800 Subject: [PATCH 2/2] refactor: delete unnecessary storeswitch --- packages/contracts/test/AutoBattleTest.t.sol | 2 -- packages/contracts/test/MatchingTest.t.sol | 2 -- packages/contracts/test/PveTest.t.sol | 4 ---- packages/contracts/test/ReadWriteStateTest.t.sol | 2 -- packages/contracts/test/ShopTest.t.sol | 7 ++----- packages/contracts/test/SynergyTest.t.sol | 3 --- 6 files changed, 2 insertions(+), 18 deletions(-) diff --git a/packages/contracts/test/AutoBattleTest.t.sol b/packages/contracts/test/AutoBattleTest.t.sol index 6edd6e7..2900274 100644 --- a/packages/contracts/test/AutoBattleTest.t.sol +++ b/packages/contracts/test/AutoBattleTest.t.sol @@ -13,7 +13,6 @@ import {GameStatus} from "src/codegen/common.sol"; import {Utils} from "../src/library/Utils.sol"; import {TestCommon} from "./TestCommon.t.sol"; -import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol"; contract AutoBattleSystemTest is MudTest { IWorld public world; @@ -21,7 +20,6 @@ contract AutoBattleSystemTest is MudTest { function setUp() public override { super.setUp(); world = IWorld(worldAddress); - StoreSwitch.setStoreAddress(worldAddress); TestCommon.normalStart(vm, world); } diff --git a/packages/contracts/test/MatchingTest.t.sol b/packages/contracts/test/MatchingTest.t.sol index 67ae326..730882e 100644 --- a/packages/contracts/test/MatchingTest.t.sol +++ b/packages/contracts/test/MatchingTest.t.sol @@ -9,7 +9,6 @@ import {Hero, HeroData} from "../src/codegen/index.sol"; import {Piece, PieceData} from "../src/codegen/index.sol"; import {IWorld} from "../src/codegen/world/IWorld.sol"; import {GameStatus} from "../src/codegen/common.sol"; -import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol"; contract MatchingTest is MudTest { IWorld public world; @@ -17,7 +16,6 @@ contract MatchingTest is MudTest { function setUp() public override { super.setUp(); world = IWorld(worldAddress); - StoreSwitch.setStoreAddress(worldAddress); vm.startPrank(address(1)); world.createRoom(bytes32("12345"), 3, bytes32(0)); diff --git a/packages/contracts/test/PveTest.t.sol b/packages/contracts/test/PveTest.t.sol index 5103db1..d6f4999 100644 --- a/packages/contracts/test/PveTest.t.sol +++ b/packages/contracts/test/PveTest.t.sol @@ -10,8 +10,6 @@ import {Piece, PieceData} from "../src/codegen/index.sol"; import {IWorld} from "../src/codegen/world/IWorld.sol"; import {GameStatus} from "../src/codegen/common.sol"; -import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol"; - contract PveTest is MudTest { IWorld public world; @@ -21,8 +19,6 @@ contract PveTest is MudTest { worldAddress = abi.decode(vm.parseJson(vm.readFile("deploys/31337/latest.json"), ".worldAddress"), (address)); world = IWorld(worldAddress); - - StoreSwitch.setStoreAddress(worldAddress); } function testSinglePlay() public { diff --git a/packages/contracts/test/ReadWriteStateTest.t.sol b/packages/contracts/test/ReadWriteStateTest.t.sol index c8d0d6d..c398dc0 100644 --- a/packages/contracts/test/ReadWriteStateTest.t.sol +++ b/packages/contracts/test/ReadWriteStateTest.t.sol @@ -9,7 +9,6 @@ import {Hero, HeroData} from "../src/codegen/index.sol"; import {Piece, PieceData} from "../src/codegen/index.sol"; import {IWorld} from "../src/codegen/world/IWorld.sol"; import {GameStatus} from "../src/codegen/common.sol"; -import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol"; contract ReadWriteStateTest is MudTest { IWorld public world; @@ -17,7 +16,6 @@ contract ReadWriteStateTest is MudTest { function setUp() public override { super.setUp(); world = IWorld(worldAddress); - StoreSwitch.setStoreAddress(worldAddress); uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); diff --git a/packages/contracts/test/ShopTest.t.sol b/packages/contracts/test/ShopTest.t.sol index 4d389e0..bcbf1c7 100644 --- a/packages/contracts/test/ShopTest.t.sol +++ b/packages/contracts/test/ShopTest.t.sol @@ -11,7 +11,6 @@ import {GameStatus} from "../src/codegen/common.sol"; import {console2} from "forge-std/console2.sol"; import {TestCommon} from "./TestCommon.t.sol"; -import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol"; contract ShopSystemTest is MudTest { IWorld public world; @@ -23,12 +22,10 @@ contract ShopSystemTest is MudTest { uint64[] _player2InitAltar; function setUp() public override { - // super.setUp(); - worldAddress = abi.decode(vm.parseJson(vm.readFile("deploys/31337/latest.json"), ".worldAddress"), (address)); + super.setUp(); + // worldAddress = abi.decode(vm.parseJson(vm.readFile("deploys/31337/latest.json"), ".worldAddress"), (address)); world = IWorld(worldAddress); - StoreSwitch.setStoreAddress(worldAddress); - bytes32 roomId = bytes32("12345"); vm.prank(_player1); diff --git a/packages/contracts/test/SynergyTest.t.sol b/packages/contracts/test/SynergyTest.t.sol index d54c713..3c9ce30 100644 --- a/packages/contracts/test/SynergyTest.t.sol +++ b/packages/contracts/test/SynergyTest.t.sol @@ -14,15 +14,12 @@ import {Utils} from "../src/library/Utils.sol"; import {TestCommon} from "./TestCommon.t.sol"; -import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol"; - contract SynergyTest is MudTest { IWorld public world; function setUp() public override { super.setUp(); world = IWorld(worldAddress); - StoreSwitch.setStoreAddress(worldAddress); TestCommon.normalStart(vm, world); }