Skip to content

Commit

Permalink
WIP: update mud
Browse files Browse the repository at this point in the history
  • Loading branch information
noyyyy committed Oct 15, 2023
1 parent 66268c1 commit 66df046
Show file tree
Hide file tree
Showing 14 changed files with 306 additions and 187 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
]
},
"devDependencies": {
"@latticexyz/cli": "2.0.0-next.8",
"@latticexyz/cli": "2.0.0-next.11",
"@typescript-eslint/eslint-plugin": "5.46.1",
"@typescript-eslint/parser": "5.46.1",
"concurrently": "^8.0.1",
Expand All @@ -45,4 +45,4 @@
"dependencies": {
"eslint-plugin-react": "7.31.11"
}
}
}
20 changes: 10 additions & 10 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
"test": "tsc --noEmit"
},
"dependencies": {
"@latticexyz/common": "2.0.0-next.8",
"@latticexyz/dev-tools": "2.0.0-next.8",
"@latticexyz/react": "2.0.0-next.8",
"@latticexyz/recs": "2.0.0-next.8",
"@latticexyz/schema-type": "2.0.0-next.8",
"@latticexyz/services": "2.0.0-next.8",
"@latticexyz/store-sync": "2.0.0-next.8",
"@latticexyz/utils": "2.0.0-next.8",
"@latticexyz/world": "2.0.0-next.8",
"@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",
"ahooks": "^3.7.8",
"antd": "^5.8.4",
"autoprefixer": "^10.4.15",
Expand All @@ -45,4 +45,4 @@
"vite": "^4.2.1",
"wait-port": "^1.0.4"
}
}
}
5 changes: 3 additions & 2 deletions packages/contracts/foundry.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[profile.default]
solc_version = "0.8.13"
solc_version = "0.8.21"
evm_version = "london"
ffi = false
fuzz_runs = 256
optimizer = true
Expand All @@ -19,7 +20,7 @@ allow_paths = [
]
extra_output_files = ["abi", "evm.bytecode"]
fs_permissions = [{ access = "read", path = "./" }]
defaultGasLimit=6000000
defaultGasLimit = 6000000

[profile.lattice-testnet]
eth_rpc_url = "https://follower.testnet-chain.linfra.xyz"
Expand Down
40 changes: 20 additions & 20 deletions packages/contracts/mud.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default mudConfig({
keySchema: {
chainId: "uint256",
},
schema: {
valueSchema: {
vrfCoordinator: "address", // set real coordinator or mock one
vrfSubId: "uint64",
vrfKeyHash: "bytes32",
Expand All @@ -116,7 +116,7 @@ export default mudConfig({
keySchema: {
index: "uint32",
},
schema: {
valueSchema: {
gameIndex: "uint32",
// creatureCounter is concatenated by 5 uint8 of which each represents the creature number of the same rarity
// higher bit the uint8 locates at, higher rarity the number represents.
Expand All @@ -134,7 +134,7 @@ export default mudConfig({
keySchema: {
index: "uint8",
},
schema: {
valueSchema: {
slotNum: "uint8",
refreshPrice: "uint8",
expPrice: "uint8",
Expand All @@ -147,7 +147,7 @@ export default mudConfig({
keySchema: {
requestId: "uint256",
},
schema: {
valueSchema: {
gameId: "uint32",
fulfilled: "bool",
},
Expand All @@ -156,7 +156,7 @@ export default mudConfig({
keySchema: {
addr: "address",
},
schema: {
valueSchema: {
roomId: "bytes32",
gameId: "uint32",
status: "PlayerStatus",
Expand All @@ -166,7 +166,7 @@ export default mudConfig({
keySchema: {
addr: "address",
},
schema: {
valueSchema: {
health: "uint8",
streakCount: "int8",
coin: "uint32",
Expand All @@ -184,7 +184,7 @@ export default mudConfig({
// uint16 index = | uint8 tier | uint8 rarity | uint8 internal_index |
index: "uint24",
},
schema: {
valueSchema: {
race: "CreatureRace",
class: "CreatureClass",
health: "uint32",
Expand All @@ -199,12 +199,12 @@ export default mudConfig({
keySchema: {
index: "uint16", // creature index
},
schema: {
valueSchema: {
uri: "string",
},
},
Hero: {
schema: {
valueSchema: {
creatureId: "uint24",
x: "uint32",
y: "uint32",
Expand All @@ -213,7 +213,7 @@ export default mudConfig({
Piece: {
// put all data into one slot of bytes32
// 8+8+32+16+192=256
schema: {
valueSchema: {
x: "uint8",
y: "uint8",
// temporarily lessen health in order to limit table value's length
Expand All @@ -227,7 +227,7 @@ export default mudConfig({
keySchema: {
index: "uint16",
},
schema: {
valueSchema: {
modification: "uint160",
trigger: "uint96",
},
Expand All @@ -236,7 +236,7 @@ export default mudConfig({
keySchema: {
count: "uint256",
},
schema: {
valueSchema: {
applyTo: "uint8",
effect: "uint24",
},
Expand All @@ -245,13 +245,13 @@ export default mudConfig({
keySchema: {
count: "uint256",
},
schema: {
valueSchema: {
applyTo: "uint8",
effect: "uint24",
},
},
WaitingRoom: {
schema: {
valueSchema: {
seatNum: "uint8",
withPassword: "bool",
createdAtBlock: "uint32",
Expand All @@ -260,15 +260,15 @@ export default mudConfig({
},
},
WaitingRoomPassword: {
schema: {
valueSchema: {
passwordHash: "bytes32",
},
},
Rank: {
keySchema: {
addr: "address",
},
schema: {
valueSchema: {
createdAtBlock: "uint32",
score: "uint32",
},
Expand All @@ -277,15 +277,15 @@ export default mudConfig({
keySchema: {
index: "uint32",
},
schema: {
valueSchema: {
players: "address[]",
},
},
Game: {
keySchema: {
index: "uint32",
},
schema: {
valueSchema: {
status: "GameStatus",
round: "uint32",
startFrom: "uint32", // current round start block timestamp
Expand All @@ -299,7 +299,7 @@ export default mudConfig({
keySchema: {
addr: "address",
},
schema: {
valueSchema: {
enemy: "address",
status: "BoardStatus",
turn: "uint32",
Expand All @@ -309,7 +309,7 @@ export default mudConfig({
},
ZkVerifier: {
keySchema: {},
schema: {
valueSchema: {
password: "address",
},
},
Expand Down
15 changes: 8 additions & 7 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
"test": "tsc --noEmit && mud test"
},
"dependencies": {
"@latticexyz/cli": "2.0.0-next.8",
"@latticexyz/schema-type": "2.0.0-next.8",
"@latticexyz/store": "2.0.0-next.8",
"@latticexyz/world": "2.0.0-next.8"
"@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"
},
"devDependencies": {
"@types/node": "^18.15.11",
Expand All @@ -34,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.8",
"solhint-plugin-mud": "2.0.0-next.8"
"solhint-config-mud": "2.0.0-next.11",
"solhint-plugin-mud": "2.0.0-next.11"
}
}
}
2 changes: 1 addition & 1 deletion packages/contracts/src/systems/PieceInitializerSystem.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import {Piece, PieceData} from "../codegen/Tables.sol";
import {EffectCache, EffectLib} from "../library/EffectLib.sol";
import {Player} from "../codegen/Tables.sol";
import {getUniqueEntity} from "@latticexyz/world/src/modules/uniqueentity/getUniqueEntity.sol";
import {getUniqueEntity} from "@latticexyz/world-modules/src/modules/uniqueentity/getUniqueEntity.sol";
import {Utils} from "../library/Utils.sol";

contract PieceInitializerSystem is System {
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/test/AutoBattleTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity >=0.8.0;

import "forge-std/Test.sol";
import {MudTest} from "@latticexyz/store/src/MudTest.sol";
import {MudTest} from "@latticexyz/world/test/MudTest.t.sol";
import {Creature, CreatureData, GameConfig, Player, ShopConfig} from "../src/codegen/Tables.sol";
import {GameRecord, Game, GameData} from "../src/codegen/Tables.sol";
import {Hero, HeroData} from "../src/codegen/Tables.sol";
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/test/MatchingTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity >=0.8.0;

import "forge-std/Test.sol";
import {MudTest} from "@latticexyz/store/src/MudTest.sol";
import {MudTest} from "@latticexyz/world/test/MudTest.t.sol";
import {Creature, CreatureData, GameConfig, Board, Player, ShopConfig} from "../src/codegen/Tables.sol";
import {GameRecord, Game, GameData} from "../src/codegen/Tables.sol";
import {Hero, HeroData} from "../src/codegen/Tables.sol";
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/test/PveTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity >=0.8.0;

import "forge-std/Test.sol";
import {MudTest} from "@latticexyz/store/src/MudTest.sol";
import {MudTest} from "@latticexyz/world/test/MudTest.t.sol";
import {Creature, CreatureData, GameConfig, Board, Player, ShopConfig} from "../src/codegen/Tables.sol";
import {GameRecord, Game, GameData} from "../src/codegen/Tables.sol";
import {Hero, HeroData} from "../src/codegen/Tables.sol";
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/test/ReadWriteStateTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity >=0.8.0;

import "forge-std/Test.sol";
import {MudTest} from "@latticexyz/store/src/MudTest.sol";
import {MudTest} from "@latticexyz/world/test/MudTest.t.sol";
import {Creature, CreatureData, GameConfig, Player, ShopConfig} from "../src/codegen/Tables.sol";
import {GameRecord, Game, GameData} from "../src/codegen/Tables.sol";
import {Hero, HeroData} from "../src/codegen/Tables.sol";
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/test/ShopTest.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import {MudTest} from "@latticexyz/store/src/MudTest.sol";
import {MudTest} from "@latticexyz/world/test/MudTest.t.sol";
import {Creature, CreatureData, GameConfig, Player, ShopConfig} from "../src/codegen/Tables.sol";
import {GameRecord, Game, GameData} from "../src/codegen/Tables.sol";
import {Hero, HeroData} from "../src/codegen/Tables.sol";
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/test/SynergyTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity >=0.8.0;

import "forge-std/Test.sol";
import {MudTest} from "@latticexyz/store/src/MudTest.sol";
import {MudTest} from "@latticexyz/world/test/MudTest.t.sol";
import {Creature, CreatureData, GameConfig, Player, ShopConfig} from "../src/codegen/Tables.sol";
import {GameRecord, Game, GameData} from "../src/codegen/Tables.sol";
import {Hero, HeroData} from "../src/codegen/Tables.sol";
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/test/ZkVerifierTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity >=0.8.0;

import "forge-std/Test.sol";
import {MudTest} from "@latticexyz/store/src/MudTest.sol";
import {MudTest} from "@latticexyz/world/test/MudTest.t.sol";
import {IWorld} from "../src/codegen/world/IWorld.sol";

contract AutoBattleSystemTest is MudTest {
Expand Down
Loading

0 comments on commit 66df046

Please sign in to comment.