-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(store): event interfaces for Store libraries (#2348)
- Loading branch information
Showing
16 changed files
with
137 additions
and
123 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,5 @@ | ||
--- | ||
"@latticexyz/store": patch | ||
--- | ||
|
||
Added interfaces for all errors that are used by `StoreCore`, which includes `FieldLayout`, `PackedCounter`, `Schema`, and `Slice`. This interfaces are inherited by `IStore`, ensuring that all possible errors are included in the `IStore` ABI for proper decoding in the frontend. |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.24; | ||
|
||
/** | ||
* @title IFieldLayoutErrors | ||
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz) | ||
* @notice This interface includes errors for the FieldLayout library. | ||
* @dev We bundle these errors in an interface (instead of at the file-level or in their corresponding libraries) so they can be inherited by IStore. | ||
* This ensures that all possible errors are included in the IStore ABI for proper decoding in the frontend. | ||
*/ | ||
interface IFieldLayoutErrors { | ||
error FieldLayout_TooManyFields(uint256 numFields, uint256 maxFields); | ||
error FieldLayout_TooManyDynamicFields(uint256 numFields, uint256 maxFields); | ||
error FieldLayout_Empty(); | ||
error FieldLayout_InvalidStaticDataLength(uint256 staticDataLength, uint256 computedStaticDataLength); | ||
error FieldLayout_StaticLengthIsZero(uint256 index); | ||
error FieldLayout_StaticLengthIsNotZero(uint256 index); | ||
error FieldLayout_StaticLengthDoesNotFitInAWord(uint256 index); | ||
} |
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,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.24; | ||
|
||
/** | ||
* @title IPackedCounterErrors | ||
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz) | ||
* @notice This interface includes errors for the PackedCounter library. | ||
* @dev We bundle these errors in an interface (instead of at the file-level or in their corresponding libraries) so they can be inherited by IStore. | ||
* This ensures that all possible errors are included in the IStore ABI for proper decoding in the frontend. | ||
*/ | ||
interface IPackedCounterErrors { | ||
error PackedCounter_InvalidLength(uint256 length); | ||
} |
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,17 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.24; | ||
|
||
/** | ||
* @title ISchemaErrors | ||
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz) | ||
* @notice This interface includes errors for the Schema library. | ||
* @dev We bundle these errors in an interface (instead of at the file-level or in their corresponding libraries) so they can be inherited by IStore. | ||
* This ensures that all possible errors are included in the IStore ABI for proper decoding in the frontend. | ||
*/ | ||
interface ISchemaErrors { | ||
/// @dev Error raised when the provided schema has an invalid length. | ||
error Schema_InvalidLength(uint256 length); | ||
|
||
/// @dev Error raised when a static type is placed after a dynamic type in a schema. | ||
error Schema_StaticTypeAfterDynamicType(); | ||
} |
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,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.24; | ||
|
||
/** | ||
* @title ISliceErrors | ||
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz) | ||
* @notice This interface includes errors for the Slice library. | ||
* @dev We bundle these errors in an interface (instead of at the file-level or in their corresponding libraries) so they can be inherited by IStore. | ||
* This ensures that all possible errors are included in the IStore ABI for proper decoding in the frontend. | ||
*/ | ||
interface ISliceErrors { | ||
error Slice_OutOfBounds(bytes data, uint256 start, uint256 end); | ||
} |
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
Oops, something went wrong.