-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 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,34 @@ | ||
--- | ||
"@latticexyz/cli": patch | ||
"@latticexyz/store": minor | ||
"@latticexyz/world": patch | ||
--- | ||
|
||
`StoreCore` and `IStore` now expose specific functions for `getStaticField` and `getDynamicField` in addition to the general `getField`. | ||
Using the specific functions reduces gas overhead because more optimized logic can be executed. | ||
|
||
```solidity | ||
interface IStore { | ||
/** | ||
* Get a single static field from the given tableId and key tuple, with the given value field layout. | ||
* Note: the field value is left-aligned in the returned bytes32, the rest of the word is not zeroed out. | ||
* Consumers are expected to truncate the returned value as needed. | ||
*/ | ||
function getStaticField( | ||
bytes32 tableId, | ||
bytes32[] calldata keyTuple, | ||
uint8 fieldIndex, | ||
FieldLayout fieldLayout | ||
) external view returns (bytes32); | ||
/** | ||
* Get a single dynamic field from the given tableId and key tuple at the given dynamic field index. | ||
* (Dynamic field index = field index - number of static fields) | ||
*/ | ||
function getDynamicField( | ||
bytes32 tableId, | ||
bytes32[] memory keyTuple, | ||
uint8 dynamicFieldIndex | ||
) external view returns (bytes memory); | ||
} | ||
``` |