-
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): add StoreWrite and Store abstract contracts (#2411)
Co-authored-by: alvrs <[email protected]> Co-authored-by: Kevin Ingersoll <[email protected]>
- Loading branch information
1 parent
b0c45f8
commit 93390d8
Showing
15 changed files
with
208 additions
and
269 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,6 @@ | ||
--- | ||
"@latticexyz/store": minor | ||
"@latticexyz/world": patch | ||
--- | ||
|
||
Added an `abstract` `StoreKernel` contract, which includes all Store interfaces except for registration, and implements write methods, `protocolVersion` and initializes `StoreCore`. `Store` extends `StoreKernel` with the `IStoreRegistration` interface. `StoreData` is removed as a separate interface/contract. `World` now extends `StoreKernel` (since the registration methods are added via the `InitModule`). |
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
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
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 |
---|---|---|
@@ -1,25 +1,11 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.24; | ||
|
||
import { IStoreErrors } from "./IStoreErrors.sol"; | ||
import { IStoreData } from "./IStoreData.sol"; | ||
import { IStoreKernel } from "./IStoreKernel.sol"; | ||
import { IStoreRegistration } from "./IStoreRegistration.sol"; | ||
import { IFieldLayoutErrors } from "./IFieldLayoutErrors.sol"; | ||
import { IEncodedLengthsErrors } from "./IEncodedLengthsErrors.sol"; | ||
import { ISchemaErrors } from "./ISchemaErrors.sol"; | ||
import { ISliceErrors } from "./ISliceErrors.sol"; | ||
|
||
/** | ||
* @title IStore | ||
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz) | ||
* @notice IStore implements the error interfaces for each library that it uses. | ||
*/ | ||
interface IStore is | ||
IStoreData, | ||
IStoreRegistration, | ||
IStoreErrors, | ||
IFieldLayoutErrors, | ||
IEncodedLengthsErrors, | ||
ISchemaErrors, | ||
ISliceErrors | ||
{} | ||
interface IStore is IStoreKernel, IStoreRegistration {} |
This file was deleted.
Oops, something went wrong.
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,31 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.24; | ||
|
||
import { IStoreRead } from "./IStoreRead.sol"; | ||
import { IStoreWrite } from "./IStoreWrite.sol"; | ||
import { IStoreErrors } from "./IStoreErrors.sol"; | ||
import { IFieldLayoutErrors } from "./IFieldLayoutErrors.sol"; | ||
import { IEncodedLengthsErrors } from "./IEncodedLengthsErrors.sol"; | ||
import { ISchemaErrors } from "./ISchemaErrors.sol"; | ||
import { ISliceErrors } from "./ISliceErrors.sol"; | ||
|
||
/** | ||
* @title IStoreKernel | ||
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz) | ||
* @notice IStoreKernel includes the error interfaces for each library that it uses. | ||
*/ | ||
interface IStoreKernel is | ||
IStoreRead, | ||
IStoreWrite, | ||
IStoreErrors, | ||
IFieldLayoutErrors, | ||
IEncodedLengthsErrors, | ||
ISchemaErrors, | ||
ISliceErrors | ||
{ | ||
/** | ||
* @notice Returns the protocol version of the Store contract. | ||
* @return version The protocol version of the Store contract. | ||
*/ | ||
function storeVersion() external view returns (bytes32 version); | ||
} |
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,18 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.24; | ||
|
||
import { STORE_VERSION } from "./version.sol"; | ||
import { IStore } from "./IStore.sol"; | ||
import { StoreKernel } from "./StoreKernel.sol"; | ||
import { StoreRead } from "./StoreRead.sol"; | ||
import { StoreCore } from "./StoreCore.sol"; | ||
import { IStoreEvents } from "./IStoreEvents.sol"; | ||
|
||
/** | ||
* @title Store Contract | ||
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz) | ||
* @notice This contract integrates the core storage functionalities and provides an interface for data storage. | ||
* @dev This abstract contract initializes `StoreCore`, implements `storeVersion`, and read methods, | ||
* but not write methods. | ||
*/ | ||
abstract contract Store is IStore, StoreKernel {} |
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
Oops, something went wrong.