Skip to content

Commit

Permalink
refactor(store,world,world-modules): code suggestions [N-08] (#2140)
Browse files Browse the repository at this point in the history
  • Loading branch information
yonadaaa committed Jan 18, 2024
1 parent 7b28d32 commit 37c228c
Show file tree
Hide file tree
Showing 58 changed files with 506 additions and 458 deletions.
6 changes: 6 additions & 0 deletions .changeset/happy-ants-lay.md
@@ -0,0 +1,6 @@
---
"@latticexyz/store": patch
"@latticexyz/world": patch
---

Refactored various files to specify integers in a hex base instead of decimals.
5 changes: 5 additions & 0 deletions .changeset/little-cherries-rule.md
@@ -0,0 +1,5 @@
---
"@latticexyz/world": patch
---

Made the `coreModule` variable in `WorldFactory` immutable.
5 changes: 5 additions & 0 deletions .changeset/little-cobras-yell.md
@@ -0,0 +1,5 @@
---
"@latticexyz/world": patch
---

Removed the unnecessary `extcodesize` check from the `Create2` library.
7 changes: 7 additions & 0 deletions .changeset/modern-impalas-stare.md
@@ -0,0 +1,7 @@
---
"@latticexyz/world-modules": patch
"@latticexyz/store": patch
"@latticexyz/world": patch
---

Refactored `ResourceId` to use a global Solidity `using` statement.
7 changes: 7 additions & 0 deletions .changeset/nasty-owls-sneeze.md
@@ -0,0 +1,7 @@
---
"@latticexyz/world-modules": patch
"@latticexyz/store": patch
"@latticexyz/world": patch
---

Refactored EIP165 usages to use the built-in interfaceId property instead of pre-defined constants.
7 changes: 7 additions & 0 deletions .changeset/soft-panthers-develop.md
@@ -0,0 +1,7 @@
---
"@latticexyz/world-modules": patch
"@latticexyz/store": patch
"@latticexyz/world": patch
---

Refactored various Solidity files to not explicitly initialise variables to zero.
5 changes: 5 additions & 0 deletions .changeset/spotty-balloons-itch.md
@@ -0,0 +1,5 @@
---
"@latticexyz/store": patch
---

Refactored some Store functions to use a right bit mask instead of left.
5 changes: 5 additions & 0 deletions .changeset/thin-days-sparkle.md
@@ -0,0 +1,5 @@
---
"@latticexyz/store": patch
---

Simplified a check in `Slice.getSubslice`.
5 changes: 5 additions & 0 deletions .changeset/three-llamas-sin.md
@@ -0,0 +1,5 @@
---
"@latticexyz/world": patch
---

Refactored `WorldContext` to get the world address from `WorldContextConsumerLib` instead of `StoreSwitch`.
5 changes: 5 additions & 0 deletions .changeset/weak-otters-turn.md
@@ -0,0 +1,5 @@
---
"@latticexyz/store": patch
---

Optimised the `Schema.validate` function to decrease gas use.
17 changes: 0 additions & 17 deletions docs/pages/store/reference/store-hook.mdx
@@ -1,22 +1,5 @@
[//]: # "This file is autogenerated, do not change manually"

## Constants

[Git Source](https://github.com/latticexyz/mud/blob/main/packages/store/src/IStoreHook.sol)

### STORE_HOOK_INTERFACE_ID

```solidity
bytes4 constant STORE_HOOK_INTERFACE_ID = IStoreHook.onBeforeSetRecord.selector ^
IStoreHook.onAfterSetRecord.selector ^
IStoreHook.onBeforeSpliceStaticData.selector ^
IStoreHook.onAfterSpliceStaticData.selector ^
IStoreHook.onBeforeSpliceDynamicData.selector ^
IStoreHook.onAfterSpliceDynamicData.selector ^
IStoreHook.onBeforeDeleteRecord.selector ^
IStoreHook.onAfterDeleteRecord.selector;
```

## IStoreHook

[Git Source](https://github.com/latticexyz/mud/blob/main/packages/store/src/IStoreHook.sol)
Expand Down

0 comments on commit 37c228c

Please sign in to comment.