@latticexyz/world-modules 2.0.0-main-e20633d4 → 2.0.0-main-071aadb9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/ArrayLib.sol/ArrayLib.json +255 -255
- package/out/CallboundDelegationControl.sol/CallboundDelegationControl.json +220 -220
- package/out/CallboundDelegations.sol/CallboundDelegations.json +4463 -4463
- package/out/DecodeSlice.sol/DecodeSlice.json +3250 -3250
- package/out/DelegationControl.sol/DelegationControl.json +98 -98
- package/out/EncodeArray.sol/EncodeArray.json +3345 -3345
- package/out/FieldLayout.sol/FieldLayoutInstance.json +47 -47
- package/out/FieldLayout.sol/FieldLayoutLib.json +47 -47
- package/out/Hook.sol/HookInstance.json +13 -13
- package/out/Hook.sol/HookLib.json +13 -13
- package/out/Hooks.sol/Hooks.json +3186 -3186
- package/out/IAccessManagementSystem.sol/IAccessManagementSystem.json +106 -100
- package/out/IBalanceTransferSystem.sol/IBalanceTransferSystem.json +98 -92
- package/out/IBaseWorld.sol/IBaseWorld.json +79 -79
- package/out/IBatchCallSystem.sol/IBatchCallSystem.json +92 -86
- package/out/ICoreSystem.sol/ICoreSystem.json +19 -13
- package/out/IDelegationControl.sol/IDelegationControl.json +62 -62
- package/out/IModule.sol/IModule.json +78 -78
- package/out/IModuleInstallationSystem.sol/IModuleInstallationSystem.json +52 -46
- package/out/ISystemHook.sol/ISystemHook.json +86 -86
- package/out/IUniqueEntitySystem.sol/IUniqueEntitySystem.json +13 -13
- package/out/IWorldContextConsumer.sol/IWorldContextConsumer.json +71 -71
- package/out/IWorldErrors.sol/IWorldErrors.json +152 -152
- package/out/IWorldKernel.sol/IWorldCall.json +154 -154
- package/out/IWorldKernel.sol/IWorldKernel.json +154 -154
- package/out/IWorldKernel.sol/IWorldModuleInstallation.json +154 -154
- package/out/IWorldRegistrationSystem.sol/IWorldRegistrationSystem.json +329 -323
- package/out/KeysInTable.sol/KeysInTable.json +18239 -18239
- package/out/KeysInTableHook.sol/KeysInTableHook.json +882 -882
- package/out/KeysInTableModule.sol/KeysInTableModule.json +564 -564
- package/out/KeysWithValue.sol/KeysWithValue.json +6661 -6661
- package/out/KeysWithValueHook.sol/KeysWithValueHook.json +1023 -1023
- package/out/KeysWithValueModule.sol/KeysWithValueModule.json +450 -450
- package/out/Memory.sol/Memory.json +4 -4
- package/out/Module.sol/Module.json +88 -88
- package/out/ResourceIds.sol/ResourceIds.json +1237 -1231
- package/out/Schema.sol/SchemaInstance.json +72 -72
- package/out/Schema.sol/SchemaLib.json +72 -72
- package/out/SchemaType.sol/SchemaType.json +276 -276
- package/out/Slice.sol/SliceInstance.json +4 -4
- package/out/Slice.sol/SliceLib.json +4 -4
- package/out/StandardDelegationsModule.sol/StandardDelegationsModule.json +330 -330
- package/out/Storage.sol/Storage.json +7 -7
- package/out/StoreCore.sol/StoreCore.json +101 -101
- package/out/StoreCore.sol/StoreCoreInternal.json +101 -101
- package/out/StoreHook.sol/StoreHook.json +368 -368
- package/out/StoreHooks.sol/StoreHooks.json +6042 -6042
- package/out/StoreSwitch.sol/StoreSwitch.json +13 -13
- package/out/System.sol/System.json +32 -32
- package/out/Tables.sol/Tables.json +10401 -10401
- package/out/TightCoder.sol/TightCoder.json +124 -124
- package/out/TimeboundDelegationControl.sol/TimeboundDelegationControl.json +124 -124
- package/out/TimeboundDelegations.sol/TimeboundDelegations.json +3442 -3442
- package/out/UniqueEntity.sol/UniqueEntity.json +2344 -2344
- package/out/UniqueEntityModule.sol/UniqueEntityModule.json +351 -351
- package/out/UniqueEntitySystem.sol/UniqueEntitySystem.json +98 -98
- package/out/UsedKeysIndex.sol/UsedKeysIndex.json +4568 -4562
- package/out/WorldContext.sol/WorldContextConsumer.json +376 -376
- package/out/WorldContext.sol/WorldContextProvider.json +376 -376
- package/out/WorldResourceId.sol/WorldResourceIdInstance.json +476 -476
- package/out/WorldResourceId.sol/WorldResourceIdLib.json +476 -476
- package/out/constants.sol/LayoutOffsets.json +79 -79
- package/out/constants.sol/constants.json +115 -115
- package/out/getKeysInTable.sol/getKeysInTable.json +564 -564
- package/out/getKeysWithValue.sol/getKeysWithValue.json +264 -264
- package/out/getTargetTableId.sol/getTargetTableId.json +163 -163
- package/out/getUniqueEntity.sol/getUniqueEntity.json +88 -88
- package/out/hasKey.sol/hasKey.json +130 -130
- package/out/index.sol/index.json +53 -53
- package/out/interfaces/IBaseWorld.sol/IBaseWorld.json +186 -186
- package/out/leftMask.sol/leftMask.json +31 -31
- package/out/query.sol/query.json +1154 -1154
- package/out/revertWithBytes.sol/revertWithBytes.json +15 -15
- package/out/src/Bytes.sol/Bytes.json +1338 -1338
- package/out/src/FieldLayout.sol/FieldLayoutInstance.json +698 -698
- package/out/src/FieldLayout.sol/FieldLayoutLib.json +698 -698
- package/out/src/IStore.sol/IStore.json +52 -52
- package/out/src/IWorldKernel.sol/IWorldCall.json +154 -154
- package/out/src/IWorldKernel.sol/IWorldKernel.json +154 -154
- package/out/src/IWorldKernel.sol/IWorldModuleInstallation.json +154 -154
- package/out/src/Memory.sol/Memory.json +91 -91
- package/out/src/PackedCounter.sol/PackedCounterInstance.json +929 -929
- package/out/src/PackedCounter.sol/PackedCounterLib.json +929 -929
- package/out/src/ResourceId.sol/ResourceIdInstance.json +116 -116
- package/out/src/ResourceId.sol/ResourceIdLib.json +116 -116
- package/out/src/Schema.sol/SchemaInstance.json +790 -790
- package/out/src/Schema.sol/SchemaLib.json +790 -790
- package/out/src/Slice.sol/SliceInstance.json +430 -430
- package/out/src/Slice.sol/SliceLib.json +430 -430
- package/out/src/StoreCore.sol/StoreCore.json +4473 -4473
- package/out/src/StoreCore.sol/StoreCoreInternal.json +4473 -4473
- package/out/src/StoreSwitch.sol/StoreSwitch.json +2496 -2496
- package/out/src/WorldContext.sol/WorldContextConsumer.json +376 -376
- package/out/src/WorldContext.sol/WorldContextProvider.json +376 -376
- package/out/src/WorldResourceId.sol/WorldResourceIdInstance.json +476 -476
- package/out/src/WorldResourceId.sol/WorldResourceIdLib.json +476 -476
- package/out/storeHookTypes.sol/storeHookTypes.json +115 -115
- package/out/storeResourceTypes.sol/storeResourceTypes.json +12 -12
- package/out/tables/ResourceIds.sol/ResourceIds.json +2889 -2883
- package/out/tables/Tables.sol/Tables.json +12187 -12187
- package/out/tightcoder/EncodeArray.sol/EncodeArray.json +3345 -3345
- package/out/types.sol/types.json +41 -41
- package/out/version.sol/version.json +7 -7
- package/out/world/src/IERC165.sol/IERC165.json +28 -28
- package/out/worldResourceTypes.sol/worldResourceTypes.json +53 -53
- package/package.json +8 -8
- package/src/interfaces/IBaseWorld.sol +4 -2
- package/src/modules/keysintable/tables/KeysInTable.sol +357 -163
- package/src/modules/keysintable/tables/UsedKeysIndex.sol +116 -36
- package/src/modules/keyswithvalue/tables/KeysWithValue.sol +163 -69
- package/src/modules/std-delegations/tables/CallboundDelegations.sol +87 -26
- package/src/modules/std-delegations/tables/TimeboundDelegations.sol +87 -26
- package/src/modules/uniqueentity/tables/UniqueEntity.sol +87 -26
@@ -33,12 +33,18 @@ FieldLayout constant _fieldLayout = FieldLayout.wrap(
|
|
33
33
|
);
|
34
34
|
|
35
35
|
library UsedKeysIndex {
|
36
|
-
/**
|
36
|
+
/**
|
37
|
+
* @notice Get the table values' field layout.
|
38
|
+
* @return _fieldLayout The field layout for the table.
|
39
|
+
*/
|
37
40
|
function getFieldLayout() internal pure returns (FieldLayout) {
|
38
41
|
return _fieldLayout;
|
39
42
|
}
|
40
43
|
|
41
|
-
/**
|
44
|
+
/**
|
45
|
+
* @notice Get the table's key schema.
|
46
|
+
* @return _keySchema The key schema for the table.
|
47
|
+
*/
|
42
48
|
function getKeySchema() internal pure returns (Schema) {
|
43
49
|
SchemaType[] memory _keySchema = new SchemaType[](2);
|
44
50
|
_keySchema[0] = SchemaType.BYTES32;
|
@@ -47,7 +53,10 @@ library UsedKeysIndex {
|
|
47
53
|
return SchemaLib.encode(_keySchema);
|
48
54
|
}
|
49
55
|
|
50
|
-
/**
|
56
|
+
/**
|
57
|
+
* @notice Get the table's value schema.
|
58
|
+
* @return _valueSchema The value schema for the table.
|
59
|
+
*/
|
51
60
|
function getValueSchema() internal pure returns (Schema) {
|
52
61
|
SchemaType[] memory _valueSchema = new SchemaType[](2);
|
53
62
|
_valueSchema[0] = SchemaType.BOOL;
|
@@ -56,36 +65,50 @@ library UsedKeysIndex {
|
|
56
65
|
return SchemaLib.encode(_valueSchema);
|
57
66
|
}
|
58
67
|
|
59
|
-
/**
|
68
|
+
/**
|
69
|
+
* @notice Get the table's key field names.
|
70
|
+
* @return keyNames An array of strings with the names of key fields.
|
71
|
+
*/
|
60
72
|
function getKeyNames() internal pure returns (string[] memory keyNames) {
|
61
73
|
keyNames = new string[](2);
|
62
74
|
keyNames[0] = "sourceTableId";
|
63
75
|
keyNames[1] = "keysHash";
|
64
76
|
}
|
65
77
|
|
66
|
-
/**
|
78
|
+
/**
|
79
|
+
* @notice Get the table's value field names.
|
80
|
+
* @return fieldNames An array of strings with the names of value fields.
|
81
|
+
*/
|
67
82
|
function getFieldNames() internal pure returns (string[] memory fieldNames) {
|
68
83
|
fieldNames = new string[](2);
|
69
84
|
fieldNames[0] = "has";
|
70
85
|
fieldNames[1] = "index";
|
71
86
|
}
|
72
87
|
|
73
|
-
/**
|
88
|
+
/**
|
89
|
+
* @notice Register the table with its config.
|
90
|
+
*/
|
74
91
|
function register() internal {
|
75
92
|
StoreSwitch.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
|
76
93
|
}
|
77
94
|
|
78
|
-
/**
|
95
|
+
/**
|
96
|
+
* @notice Register the table with its config.
|
97
|
+
*/
|
79
98
|
function _register() internal {
|
80
99
|
StoreCore.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
|
81
100
|
}
|
82
101
|
|
83
|
-
/**
|
102
|
+
/**
|
103
|
+
* @notice Register the table with its config (using the specified store).
|
104
|
+
*/
|
84
105
|
function register(IStore _store) internal {
|
85
106
|
_store.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
|
86
107
|
}
|
87
108
|
|
88
|
-
/**
|
109
|
+
/**
|
110
|
+
* @notice Get has.
|
111
|
+
*/
|
89
112
|
function getHas(ResourceId sourceTableId, bytes32 keysHash) internal view returns (bool has) {
|
90
113
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
91
114
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -95,7 +118,9 @@ library UsedKeysIndex {
|
|
95
118
|
return (_toBool(uint8(bytes1(_blob))));
|
96
119
|
}
|
97
120
|
|
98
|
-
/**
|
121
|
+
/**
|
122
|
+
* @notice Get has.
|
123
|
+
*/
|
99
124
|
function _getHas(ResourceId sourceTableId, bytes32 keysHash) internal view returns (bool has) {
|
100
125
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
101
126
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -105,7 +130,9 @@ library UsedKeysIndex {
|
|
105
130
|
return (_toBool(uint8(bytes1(_blob))));
|
106
131
|
}
|
107
132
|
|
108
|
-
/**
|
133
|
+
/**
|
134
|
+
* @notice Get has (using the specified store).
|
135
|
+
*/
|
109
136
|
function getHas(IStore _store, ResourceId sourceTableId, bytes32 keysHash) internal view returns (bool has) {
|
110
137
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
111
138
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -115,7 +142,9 @@ library UsedKeysIndex {
|
|
115
142
|
return (_toBool(uint8(bytes1(_blob))));
|
116
143
|
}
|
117
144
|
|
118
|
-
/**
|
145
|
+
/**
|
146
|
+
* @notice Set has.
|
147
|
+
*/
|
119
148
|
function setHas(ResourceId sourceTableId, bytes32 keysHash, bool has) internal {
|
120
149
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
121
150
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -124,7 +153,9 @@ library UsedKeysIndex {
|
|
124
153
|
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((has)), _fieldLayout);
|
125
154
|
}
|
126
155
|
|
127
|
-
/**
|
156
|
+
/**
|
157
|
+
* @notice Set has.
|
158
|
+
*/
|
128
159
|
function _setHas(ResourceId sourceTableId, bytes32 keysHash, bool has) internal {
|
129
160
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
130
161
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -133,7 +164,9 @@ library UsedKeysIndex {
|
|
133
164
|
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((has)), _fieldLayout);
|
134
165
|
}
|
135
166
|
|
136
|
-
/**
|
167
|
+
/**
|
168
|
+
* @notice Set has (using the specified store).
|
169
|
+
*/
|
137
170
|
function setHas(IStore _store, ResourceId sourceTableId, bytes32 keysHash, bool has) internal {
|
138
171
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
139
172
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -142,7 +175,9 @@ library UsedKeysIndex {
|
|
142
175
|
_store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((has)), _fieldLayout);
|
143
176
|
}
|
144
177
|
|
145
|
-
/**
|
178
|
+
/**
|
179
|
+
* @notice Get index.
|
180
|
+
*/
|
146
181
|
function getIndex(ResourceId sourceTableId, bytes32 keysHash) internal view returns (uint40 index) {
|
147
182
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
148
183
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -152,7 +187,9 @@ library UsedKeysIndex {
|
|
152
187
|
return (uint40(bytes5(_blob)));
|
153
188
|
}
|
154
189
|
|
155
|
-
/**
|
190
|
+
/**
|
191
|
+
* @notice Get index.
|
192
|
+
*/
|
156
193
|
function _getIndex(ResourceId sourceTableId, bytes32 keysHash) internal view returns (uint40 index) {
|
157
194
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
158
195
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -162,7 +199,9 @@ library UsedKeysIndex {
|
|
162
199
|
return (uint40(bytes5(_blob)));
|
163
200
|
}
|
164
201
|
|
165
|
-
/**
|
202
|
+
/**
|
203
|
+
* @notice Get index (using the specified store).
|
204
|
+
*/
|
166
205
|
function getIndex(IStore _store, ResourceId sourceTableId, bytes32 keysHash) internal view returns (uint40 index) {
|
167
206
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
168
207
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -172,7 +211,9 @@ library UsedKeysIndex {
|
|
172
211
|
return (uint40(bytes5(_blob)));
|
173
212
|
}
|
174
213
|
|
175
|
-
/**
|
214
|
+
/**
|
215
|
+
* @notice Set index.
|
216
|
+
*/
|
176
217
|
function setIndex(ResourceId sourceTableId, bytes32 keysHash, uint40 index) internal {
|
177
218
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
178
219
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -181,7 +222,9 @@ library UsedKeysIndex {
|
|
181
222
|
StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((index)), _fieldLayout);
|
182
223
|
}
|
183
224
|
|
184
|
-
/**
|
225
|
+
/**
|
226
|
+
* @notice Set index.
|
227
|
+
*/
|
185
228
|
function _setIndex(ResourceId sourceTableId, bytes32 keysHash, uint40 index) internal {
|
186
229
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
187
230
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -190,7 +233,9 @@ library UsedKeysIndex {
|
|
190
233
|
StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((index)), _fieldLayout);
|
191
234
|
}
|
192
235
|
|
193
|
-
/**
|
236
|
+
/**
|
237
|
+
* @notice Set index (using the specified store).
|
238
|
+
*/
|
194
239
|
function setIndex(IStore _store, ResourceId sourceTableId, bytes32 keysHash, uint40 index) internal {
|
195
240
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
196
241
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -199,7 +244,9 @@ library UsedKeysIndex {
|
|
199
244
|
_store.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((index)), _fieldLayout);
|
200
245
|
}
|
201
246
|
|
202
|
-
/**
|
247
|
+
/**
|
248
|
+
* @notice Get the full data.
|
249
|
+
*/
|
203
250
|
function get(ResourceId sourceTableId, bytes32 keysHash) internal view returns (bool has, uint40 index) {
|
204
251
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
205
252
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -213,7 +260,9 @@ library UsedKeysIndex {
|
|
213
260
|
return decode(_staticData, _encodedLengths, _dynamicData);
|
214
261
|
}
|
215
262
|
|
216
|
-
/**
|
263
|
+
/**
|
264
|
+
* @notice Get the full data.
|
265
|
+
*/
|
217
266
|
function _get(ResourceId sourceTableId, bytes32 keysHash) internal view returns (bool has, uint40 index) {
|
218
267
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
219
268
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -227,7 +276,9 @@ library UsedKeysIndex {
|
|
227
276
|
return decode(_staticData, _encodedLengths, _dynamicData);
|
228
277
|
}
|
229
278
|
|
230
|
-
/**
|
279
|
+
/**
|
280
|
+
* @notice Get the full data (using the specified store).
|
281
|
+
*/
|
231
282
|
function get(
|
232
283
|
IStore _store,
|
233
284
|
ResourceId sourceTableId,
|
@@ -245,7 +296,9 @@ library UsedKeysIndex {
|
|
245
296
|
return decode(_staticData, _encodedLengths, _dynamicData);
|
246
297
|
}
|
247
298
|
|
248
|
-
/**
|
299
|
+
/**
|
300
|
+
* @notice Set the full data using individual values.
|
301
|
+
*/
|
249
302
|
function set(ResourceId sourceTableId, bytes32 keysHash, bool has, uint40 index) internal {
|
250
303
|
bytes memory _staticData = encodeStatic(has, index);
|
251
304
|
|
@@ -259,7 +312,9 @@ library UsedKeysIndex {
|
|
259
312
|
StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData);
|
260
313
|
}
|
261
314
|
|
262
|
-
/**
|
315
|
+
/**
|
316
|
+
* @notice Set the full data using individual values.
|
317
|
+
*/
|
263
318
|
function _set(ResourceId sourceTableId, bytes32 keysHash, bool has, uint40 index) internal {
|
264
319
|
bytes memory _staticData = encodeStatic(has, index);
|
265
320
|
|
@@ -273,7 +328,9 @@ library UsedKeysIndex {
|
|
273
328
|
StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout);
|
274
329
|
}
|
275
330
|
|
276
|
-
/**
|
331
|
+
/**
|
332
|
+
* @notice Set the full data using individual values (using the specified store).
|
333
|
+
*/
|
277
334
|
function set(IStore _store, ResourceId sourceTableId, bytes32 keysHash, bool has, uint40 index) internal {
|
278
335
|
bytes memory _staticData = encodeStatic(has, index);
|
279
336
|
|
@@ -288,8 +345,7 @@ library UsedKeysIndex {
|
|
288
345
|
}
|
289
346
|
|
290
347
|
/**
|
291
|
-
* Decode the tightly packed blob of static data using this table's field layout
|
292
|
-
* Undefined behaviour for invalid blobs
|
348
|
+
* @notice Decode the tightly packed blob of static data using this table's field layout.
|
293
349
|
*/
|
294
350
|
function decodeStatic(bytes memory _blob) internal pure returns (bool has, uint40 index) {
|
295
351
|
has = (_toBool(uint8(Bytes.slice1(_blob, 0))));
|
@@ -298,8 +354,10 @@ library UsedKeysIndex {
|
|
298
354
|
}
|
299
355
|
|
300
356
|
/**
|
301
|
-
* Decode the tightly packed
|
302
|
-
*
|
357
|
+
* @notice Decode the tightly packed blobs using this table's field layout.
|
358
|
+
* @param _staticData Tightly packed static fields.
|
359
|
+
*
|
360
|
+
*
|
303
361
|
*/
|
304
362
|
function decode(
|
305
363
|
bytes memory _staticData,
|
@@ -309,7 +367,9 @@ library UsedKeysIndex {
|
|
309
367
|
(has, index) = decodeStatic(_staticData);
|
310
368
|
}
|
311
369
|
|
312
|
-
/**
|
370
|
+
/**
|
371
|
+
* @notice Delete all data for given keys.
|
372
|
+
*/
|
313
373
|
function deleteRecord(ResourceId sourceTableId, bytes32 keysHash) internal {
|
314
374
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
315
375
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -318,7 +378,9 @@ library UsedKeysIndex {
|
|
318
378
|
StoreSwitch.deleteRecord(_tableId, _keyTuple);
|
319
379
|
}
|
320
380
|
|
321
|
-
/**
|
381
|
+
/**
|
382
|
+
* @notice Delete all data for given keys.
|
383
|
+
*/
|
322
384
|
function _deleteRecord(ResourceId sourceTableId, bytes32 keysHash) internal {
|
323
385
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
324
386
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -327,7 +389,9 @@ library UsedKeysIndex {
|
|
327
389
|
StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout);
|
328
390
|
}
|
329
391
|
|
330
|
-
/**
|
392
|
+
/**
|
393
|
+
* @notice Delete all data for given keys (using the specified store).
|
394
|
+
*/
|
331
395
|
function deleteRecord(IStore _store, ResourceId sourceTableId, bytes32 keysHash) internal {
|
332
396
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
333
397
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -336,12 +400,20 @@ library UsedKeysIndex {
|
|
336
400
|
_store.deleteRecord(_tableId, _keyTuple);
|
337
401
|
}
|
338
402
|
|
339
|
-
/**
|
403
|
+
/**
|
404
|
+
* @notice Tightly pack static (fixed length) data using this table's schema.
|
405
|
+
* @return The static data, encoded into a sequence of bytes.
|
406
|
+
*/
|
340
407
|
function encodeStatic(bool has, uint40 index) internal pure returns (bytes memory) {
|
341
408
|
return abi.encodePacked(has, index);
|
342
409
|
}
|
343
410
|
|
344
|
-
/**
|
411
|
+
/**
|
412
|
+
* @notice Encode all of a record's fields.
|
413
|
+
* @return The static (fixed length) data, encoded into a sequence of bytes.
|
414
|
+
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
415
|
+
* @return The dyanmic (variable length) data, encoded into a sequence of bytes.
|
416
|
+
*/
|
345
417
|
function encode(bool has, uint40 index) internal pure returns (bytes memory, PackedCounter, bytes memory) {
|
346
418
|
bytes memory _staticData = encodeStatic(has, index);
|
347
419
|
|
@@ -351,7 +423,9 @@ library UsedKeysIndex {
|
|
351
423
|
return (_staticData, _encodedLengths, _dynamicData);
|
352
424
|
}
|
353
425
|
|
354
|
-
/**
|
426
|
+
/**
|
427
|
+
* @notice Encode keys as a bytes32 array using this table's field layout.
|
428
|
+
*/
|
355
429
|
function encodeKeyTuple(ResourceId sourceTableId, bytes32 keysHash) internal pure returns (bytes32[] memory) {
|
356
430
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
357
431
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -361,6 +435,12 @@ library UsedKeysIndex {
|
|
361
435
|
}
|
362
436
|
}
|
363
437
|
|
438
|
+
/**
|
439
|
+
* @notice Cast a value to a bool.
|
440
|
+
* @dev Boolean values are encoded as uint8 (1 = true, 0 = false), but Solidity doesn't allow casting between uint8 and bool.
|
441
|
+
* @param value The uint8 value to convert.
|
442
|
+
* @return result The boolean value.
|
443
|
+
*/
|
364
444
|
function _toBool(uint8 value) pure returns (bool result) {
|
365
445
|
assembly {
|
366
446
|
result := value
|