-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(store,world): move around interfaces and base contracts (#1602)
- Loading branch information
Showing
15 changed files
with
306 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
"@latticexyz/store": major | ||
"@latticexyz/world": minor | ||
--- | ||
|
||
- Moves Store events into its own `IStoreEvents` interface | ||
- Moves Store interfaces to their own files | ||
- Adds a `StoreData` abstract contract to initialize a Store and expose the Store version | ||
|
||
If you're using MUD out of the box, you won't have to make any changes. You will only need to update if you're using any of the base Store interfaces. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.21; | ||
|
||
import { IStoreRead } from "./IStoreRead.sol"; | ||
import { IStoreWrite } from "./IStoreWrite.sol"; | ||
|
||
/** | ||
* The IStoreData interface includes methods for reading and writing table values. | ||
* These methods are frequently invoked during runtime, so it is essential to prioritize | ||
* optimizing their gas cost | ||
*/ | ||
interface IStoreData is IStoreRead, IStoreWrite { | ||
event HelloStore(bytes32 indexed storeVersion); | ||
|
||
function storeVersion() external view returns (bytes32); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.21; | ||
|
||
import { ResourceId } from "./ResourceId.sol"; | ||
import { PackedCounter } from "./PackedCounter.sol"; | ||
|
||
interface IStoreEvents { | ||
event Store_SetRecord( | ||
ResourceId indexed tableId, | ||
bytes32[] keyTuple, | ||
bytes staticData, | ||
PackedCounter encodedLengths, | ||
bytes dynamicData | ||
); | ||
event Store_SpliceStaticData(ResourceId indexed tableId, bytes32[] keyTuple, uint48 start, bytes data); | ||
event Store_SpliceDynamicData( | ||
ResourceId indexed tableId, | ||
bytes32[] keyTuple, | ||
uint48 start, | ||
uint40 deleteCount, | ||
PackedCounter encodedLengths, | ||
bytes data | ||
); | ||
event Store_DeleteRecord(ResourceId indexed tableId, bytes32[] keyTuple); | ||
} |
Oops, something went wrong.