@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
@@ -41,12 +41,18 @@ struct KeysInTableData {
|
|
41
41
|
}
|
42
42
|
|
43
43
|
library KeysInTable {
|
44
|
-
/**
|
44
|
+
/**
|
45
|
+
* @notice Get the table values' field layout.
|
46
|
+
* @return _fieldLayout The field layout for the table.
|
47
|
+
*/
|
45
48
|
function getFieldLayout() internal pure returns (FieldLayout) {
|
46
49
|
return _fieldLayout;
|
47
50
|
}
|
48
51
|
|
49
|
-
/**
|
52
|
+
/**
|
53
|
+
* @notice Get the table's key schema.
|
54
|
+
* @return _keySchema The key schema for the table.
|
55
|
+
*/
|
50
56
|
function getKeySchema() internal pure returns (Schema) {
|
51
57
|
SchemaType[] memory _keySchema = new SchemaType[](1);
|
52
58
|
_keySchema[0] = SchemaType.BYTES32;
|
@@ -54,7 +60,10 @@ library KeysInTable {
|
|
54
60
|
return SchemaLib.encode(_keySchema);
|
55
61
|
}
|
56
62
|
|
57
|
-
/**
|
63
|
+
/**
|
64
|
+
* @notice Get the table's value schema.
|
65
|
+
* @return _valueSchema The value schema for the table.
|
66
|
+
*/
|
58
67
|
function getValueSchema() internal pure returns (Schema) {
|
59
68
|
SchemaType[] memory _valueSchema = new SchemaType[](5);
|
60
69
|
_valueSchema[0] = SchemaType.BYTES32_ARRAY;
|
@@ -66,13 +75,19 @@ library KeysInTable {
|
|
66
75
|
return SchemaLib.encode(_valueSchema);
|
67
76
|
}
|
68
77
|
|
69
|
-
/**
|
78
|
+
/**
|
79
|
+
* @notice Get the table's key field names.
|
80
|
+
* @return keyNames An array of strings with the names of key fields.
|
81
|
+
*/
|
70
82
|
function getKeyNames() internal pure returns (string[] memory keyNames) {
|
71
83
|
keyNames = new string[](1);
|
72
84
|
keyNames[0] = "sourceTableId";
|
73
85
|
}
|
74
86
|
|
75
|
-
/**
|
87
|
+
/**
|
88
|
+
* @notice Get the table's value field names.
|
89
|
+
* @return fieldNames An array of strings with the names of value fields.
|
90
|
+
*/
|
76
91
|
function getFieldNames() internal pure returns (string[] memory fieldNames) {
|
77
92
|
fieldNames = new string[](5);
|
78
93
|
fieldNames[0] = "keys0";
|
@@ -82,22 +97,30 @@ library KeysInTable {
|
|
82
97
|
fieldNames[4] = "keys4";
|
83
98
|
}
|
84
99
|
|
85
|
-
/**
|
100
|
+
/**
|
101
|
+
* @notice Register the table with its config.
|
102
|
+
*/
|
86
103
|
function register() internal {
|
87
104
|
StoreSwitch.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
|
88
105
|
}
|
89
106
|
|
90
|
-
/**
|
107
|
+
/**
|
108
|
+
* @notice Register the table with its config.
|
109
|
+
*/
|
91
110
|
function _register() internal {
|
92
111
|
StoreCore.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
|
93
112
|
}
|
94
113
|
|
95
|
-
/**
|
114
|
+
/**
|
115
|
+
* @notice Register the table with its config (using the specified store).
|
116
|
+
*/
|
96
117
|
function register(IStore _store) internal {
|
97
118
|
_store.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
|
98
119
|
}
|
99
120
|
|
100
|
-
/**
|
121
|
+
/**
|
122
|
+
* @notice Get keys0.
|
123
|
+
*/
|
101
124
|
function getKeys0(ResourceId sourceTableId) internal view returns (bytes32[] memory keys0) {
|
102
125
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
103
126
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -106,7 +129,9 @@ library KeysInTable {
|
|
106
129
|
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
107
130
|
}
|
108
131
|
|
109
|
-
/**
|
132
|
+
/**
|
133
|
+
* @notice Get keys0.
|
134
|
+
*/
|
110
135
|
function _getKeys0(ResourceId sourceTableId) internal view returns (bytes32[] memory keys0) {
|
111
136
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
112
137
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -115,7 +140,9 @@ library KeysInTable {
|
|
115
140
|
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
116
141
|
}
|
117
142
|
|
118
|
-
/**
|
143
|
+
/**
|
144
|
+
* @notice Get keys0 (using the specified store).
|
145
|
+
*/
|
119
146
|
function getKeys0(IStore _store, ResourceId sourceTableId) internal view returns (bytes32[] memory keys0) {
|
120
147
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
121
148
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -124,7 +151,9 @@ library KeysInTable {
|
|
124
151
|
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
125
152
|
}
|
126
153
|
|
127
|
-
/**
|
154
|
+
/**
|
155
|
+
* @notice Set keys0.
|
156
|
+
*/
|
128
157
|
function setKeys0(ResourceId sourceTableId, bytes32[] memory keys0) internal {
|
129
158
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
130
159
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -132,7 +161,9 @@ library KeysInTable {
|
|
132
161
|
StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((keys0)));
|
133
162
|
}
|
134
163
|
|
135
|
-
/**
|
164
|
+
/**
|
165
|
+
* @notice Set keys0.
|
166
|
+
*/
|
136
167
|
function _setKeys0(ResourceId sourceTableId, bytes32[] memory keys0) internal {
|
137
168
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
138
169
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -140,7 +171,9 @@ library KeysInTable {
|
|
140
171
|
StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((keys0)));
|
141
172
|
}
|
142
173
|
|
143
|
-
/**
|
174
|
+
/**
|
175
|
+
* @notice Set keys0 (using the specified store).
|
176
|
+
*/
|
144
177
|
function setKeys0(IStore _store, ResourceId sourceTableId, bytes32[] memory keys0) internal {
|
145
178
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
146
179
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -148,7 +181,9 @@ library KeysInTable {
|
|
148
181
|
_store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((keys0)));
|
149
182
|
}
|
150
183
|
|
151
|
-
/**
|
184
|
+
/**
|
185
|
+
* @notice Get the length of keys0.
|
186
|
+
*/
|
152
187
|
function lengthKeys0(ResourceId sourceTableId) internal view returns (uint256) {
|
153
188
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
154
189
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -159,7 +194,9 @@ library KeysInTable {
|
|
159
194
|
}
|
160
195
|
}
|
161
196
|
|
162
|
-
/**
|
197
|
+
/**
|
198
|
+
* @notice Get the length of keys0.
|
199
|
+
*/
|
163
200
|
function _lengthKeys0(ResourceId sourceTableId) internal view returns (uint256) {
|
164
201
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
165
202
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -170,7 +207,9 @@ library KeysInTable {
|
|
170
207
|
}
|
171
208
|
}
|
172
209
|
|
173
|
-
/**
|
210
|
+
/**
|
211
|
+
* @notice Get the length of keys0 (using the specified store).
|
212
|
+
*/
|
174
213
|
function lengthKeys0(IStore _store, ResourceId sourceTableId) internal view returns (uint256) {
|
175
214
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
176
215
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -182,8 +221,8 @@ library KeysInTable {
|
|
182
221
|
}
|
183
222
|
|
184
223
|
/**
|
185
|
-
* Get an item of keys0
|
186
|
-
*
|
224
|
+
* @notice Get an item of keys0.
|
225
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
187
226
|
*/
|
188
227
|
function getItemKeys0(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
189
228
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -196,8 +235,8 @@ library KeysInTable {
|
|
196
235
|
}
|
197
236
|
|
198
237
|
/**
|
199
|
-
* Get an item of keys0
|
200
|
-
*
|
238
|
+
* @notice Get an item of keys0.
|
239
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
201
240
|
*/
|
202
241
|
function _getItemKeys0(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
203
242
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -210,8 +249,8 @@ library KeysInTable {
|
|
210
249
|
}
|
211
250
|
|
212
251
|
/**
|
213
|
-
* Get an item of keys0 (using the specified store)
|
214
|
-
*
|
252
|
+
* @notice Get an item of keys0 (using the specified store).
|
253
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
215
254
|
*/
|
216
255
|
function getItemKeys0(IStore _store, ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
217
256
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -223,7 +262,9 @@ library KeysInTable {
|
|
223
262
|
}
|
224
263
|
}
|
225
264
|
|
226
|
-
/**
|
265
|
+
/**
|
266
|
+
* @notice Push an element to keys0.
|
267
|
+
*/
|
227
268
|
function pushKeys0(ResourceId sourceTableId, bytes32 _element) internal {
|
228
269
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
229
270
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -231,7 +272,9 @@ library KeysInTable {
|
|
231
272
|
StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element)));
|
232
273
|
}
|
233
274
|
|
234
|
-
/**
|
275
|
+
/**
|
276
|
+
* @notice Push an element to keys0.
|
277
|
+
*/
|
235
278
|
function _pushKeys0(ResourceId sourceTableId, bytes32 _element) internal {
|
236
279
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
237
280
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -239,7 +282,9 @@ library KeysInTable {
|
|
239
282
|
StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element)));
|
240
283
|
}
|
241
284
|
|
242
|
-
/**
|
285
|
+
/**
|
286
|
+
* @notice Push an element to keys0 (using the specified store).
|
287
|
+
*/
|
243
288
|
function pushKeys0(IStore _store, ResourceId sourceTableId, bytes32 _element) internal {
|
244
289
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
245
290
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -247,7 +292,9 @@ library KeysInTable {
|
|
247
292
|
_store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element)));
|
248
293
|
}
|
249
294
|
|
250
|
-
/**
|
295
|
+
/**
|
296
|
+
* @notice Pop an element from keys0.
|
297
|
+
*/
|
251
298
|
function popKeys0(ResourceId sourceTableId) internal {
|
252
299
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
253
300
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -255,7 +302,9 @@ library KeysInTable {
|
|
255
302
|
StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 32);
|
256
303
|
}
|
257
304
|
|
258
|
-
/**
|
305
|
+
/**
|
306
|
+
* @notice Pop an element from keys0.
|
307
|
+
*/
|
259
308
|
function _popKeys0(ResourceId sourceTableId) internal {
|
260
309
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
261
310
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -263,7 +312,9 @@ library KeysInTable {
|
|
263
312
|
StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 32);
|
264
313
|
}
|
265
314
|
|
266
|
-
/**
|
315
|
+
/**
|
316
|
+
* @notice Pop an element from keys0 (using the specified store).
|
317
|
+
*/
|
267
318
|
function popKeys0(IStore _store, ResourceId sourceTableId) internal {
|
268
319
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
269
320
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -272,8 +323,7 @@ library KeysInTable {
|
|
272
323
|
}
|
273
324
|
|
274
325
|
/**
|
275
|
-
* Update an element of keys0 at `_index
|
276
|
-
* (checked only to prevent modifying other tables; can corrupt own data if index overflows)
|
326
|
+
* @notice Update an element of keys0 at `_index`.
|
277
327
|
*/
|
278
328
|
function updateKeys0(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
279
329
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -286,8 +336,7 @@ library KeysInTable {
|
|
286
336
|
}
|
287
337
|
|
288
338
|
/**
|
289
|
-
* Update an element of keys0 at `_index
|
290
|
-
* (checked only to prevent modifying other tables; can corrupt own data if index overflows)
|
339
|
+
* @notice Update an element of keys0 at `_index`.
|
291
340
|
*/
|
292
341
|
function _updateKeys0(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
293
342
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -300,8 +349,7 @@ library KeysInTable {
|
|
300
349
|
}
|
301
350
|
|
302
351
|
/**
|
303
|
-
* Update an element of keys0 (using the specified store) at `_index
|
304
|
-
* (checked only to prevent modifying other tables; can corrupt own data if index overflows)
|
352
|
+
* @notice Update an element of keys0 (using the specified store) at `_index`.
|
305
353
|
*/
|
306
354
|
function updateKeys0(IStore _store, ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
307
355
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -313,7 +361,9 @@ library KeysInTable {
|
|
313
361
|
}
|
314
362
|
}
|
315
363
|
|
316
|
-
/**
|
364
|
+
/**
|
365
|
+
* @notice Get keys1.
|
366
|
+
*/
|
317
367
|
function getKeys1(ResourceId sourceTableId) internal view returns (bytes32[] memory keys1) {
|
318
368
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
319
369
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -322,7 +372,9 @@ library KeysInTable {
|
|
322
372
|
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
323
373
|
}
|
324
374
|
|
325
|
-
/**
|
375
|
+
/**
|
376
|
+
* @notice Get keys1.
|
377
|
+
*/
|
326
378
|
function _getKeys1(ResourceId sourceTableId) internal view returns (bytes32[] memory keys1) {
|
327
379
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
328
380
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -331,7 +383,9 @@ library KeysInTable {
|
|
331
383
|
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
332
384
|
}
|
333
385
|
|
334
|
-
/**
|
386
|
+
/**
|
387
|
+
* @notice Get keys1 (using the specified store).
|
388
|
+
*/
|
335
389
|
function getKeys1(IStore _store, ResourceId sourceTableId) internal view returns (bytes32[] memory keys1) {
|
336
390
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
337
391
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -340,7 +394,9 @@ library KeysInTable {
|
|
340
394
|
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
341
395
|
}
|
342
396
|
|
343
|
-
/**
|
397
|
+
/**
|
398
|
+
* @notice Set keys1.
|
399
|
+
*/
|
344
400
|
function setKeys1(ResourceId sourceTableId, bytes32[] memory keys1) internal {
|
345
401
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
346
402
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -348,7 +404,9 @@ library KeysInTable {
|
|
348
404
|
StoreSwitch.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode((keys1)));
|
349
405
|
}
|
350
406
|
|
351
|
-
/**
|
407
|
+
/**
|
408
|
+
* @notice Set keys1.
|
409
|
+
*/
|
352
410
|
function _setKeys1(ResourceId sourceTableId, bytes32[] memory keys1) internal {
|
353
411
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
354
412
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -356,7 +414,9 @@ library KeysInTable {
|
|
356
414
|
StoreCore.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode((keys1)));
|
357
415
|
}
|
358
416
|
|
359
|
-
/**
|
417
|
+
/**
|
418
|
+
* @notice Set keys1 (using the specified store).
|
419
|
+
*/
|
360
420
|
function setKeys1(IStore _store, ResourceId sourceTableId, bytes32[] memory keys1) internal {
|
361
421
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
362
422
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -364,7 +424,9 @@ library KeysInTable {
|
|
364
424
|
_store.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode((keys1)));
|
365
425
|
}
|
366
426
|
|
367
|
-
/**
|
427
|
+
/**
|
428
|
+
* @notice Get the length of keys1.
|
429
|
+
*/
|
368
430
|
function lengthKeys1(ResourceId sourceTableId) internal view returns (uint256) {
|
369
431
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
370
432
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -375,7 +437,9 @@ library KeysInTable {
|
|
375
437
|
}
|
376
438
|
}
|
377
439
|
|
378
|
-
/**
|
440
|
+
/**
|
441
|
+
* @notice Get the length of keys1.
|
442
|
+
*/
|
379
443
|
function _lengthKeys1(ResourceId sourceTableId) internal view returns (uint256) {
|
380
444
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
381
445
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -386,7 +450,9 @@ library KeysInTable {
|
|
386
450
|
}
|
387
451
|
}
|
388
452
|
|
389
|
-
/**
|
453
|
+
/**
|
454
|
+
* @notice Get the length of keys1 (using the specified store).
|
455
|
+
*/
|
390
456
|
function lengthKeys1(IStore _store, ResourceId sourceTableId) internal view returns (uint256) {
|
391
457
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
392
458
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -398,8 +464,8 @@ library KeysInTable {
|
|
398
464
|
}
|
399
465
|
|
400
466
|
/**
|
401
|
-
* Get an item of keys1
|
402
|
-
*
|
467
|
+
* @notice Get an item of keys1.
|
468
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
403
469
|
*/
|
404
470
|
function getItemKeys1(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
405
471
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -412,8 +478,8 @@ library KeysInTable {
|
|
412
478
|
}
|
413
479
|
|
414
480
|
/**
|
415
|
-
* Get an item of keys1
|
416
|
-
*
|
481
|
+
* @notice Get an item of keys1.
|
482
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
417
483
|
*/
|
418
484
|
function _getItemKeys1(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
419
485
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -426,8 +492,8 @@ library KeysInTable {
|
|
426
492
|
}
|
427
493
|
|
428
494
|
/**
|
429
|
-
* Get an item of keys1 (using the specified store)
|
430
|
-
*
|
495
|
+
* @notice Get an item of keys1 (using the specified store).
|
496
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
431
497
|
*/
|
432
498
|
function getItemKeys1(IStore _store, ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
433
499
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -439,7 +505,9 @@ library KeysInTable {
|
|
439
505
|
}
|
440
506
|
}
|
441
507
|
|
442
|
-
/**
|
508
|
+
/**
|
509
|
+
* @notice Push an element to keys1.
|
510
|
+
*/
|
443
511
|
function pushKeys1(ResourceId sourceTableId, bytes32 _element) internal {
|
444
512
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
445
513
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -447,7 +515,9 @@ library KeysInTable {
|
|
447
515
|
StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element)));
|
448
516
|
}
|
449
517
|
|
450
|
-
/**
|
518
|
+
/**
|
519
|
+
* @notice Push an element to keys1.
|
520
|
+
*/
|
451
521
|
function _pushKeys1(ResourceId sourceTableId, bytes32 _element) internal {
|
452
522
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
453
523
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -455,7 +525,9 @@ library KeysInTable {
|
|
455
525
|
StoreCore.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element)));
|
456
526
|
}
|
457
527
|
|
458
|
-
/**
|
528
|
+
/**
|
529
|
+
* @notice Push an element to keys1 (using the specified store).
|
530
|
+
*/
|
459
531
|
function pushKeys1(IStore _store, ResourceId sourceTableId, bytes32 _element) internal {
|
460
532
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
461
533
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -463,7 +535,9 @@ library KeysInTable {
|
|
463
535
|
_store.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element)));
|
464
536
|
}
|
465
537
|
|
466
|
-
/**
|
538
|
+
/**
|
539
|
+
* @notice Pop an element from keys1.
|
540
|
+
*/
|
467
541
|
function popKeys1(ResourceId sourceTableId) internal {
|
468
542
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
469
543
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -471,7 +545,9 @@ library KeysInTable {
|
|
471
545
|
StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 1, 32);
|
472
546
|
}
|
473
547
|
|
474
|
-
/**
|
548
|
+
/**
|
549
|
+
* @notice Pop an element from keys1.
|
550
|
+
*/
|
475
551
|
function _popKeys1(ResourceId sourceTableId) internal {
|
476
552
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
477
553
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -479,7 +555,9 @@ library KeysInTable {
|
|
479
555
|
StoreCore.popFromDynamicField(_tableId, _keyTuple, 1, 32);
|
480
556
|
}
|
481
557
|
|
482
|
-
/**
|
558
|
+
/**
|
559
|
+
* @notice Pop an element from keys1 (using the specified store).
|
560
|
+
*/
|
483
561
|
function popKeys1(IStore _store, ResourceId sourceTableId) internal {
|
484
562
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
485
563
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -488,8 +566,7 @@ library KeysInTable {
|
|
488
566
|
}
|
489
567
|
|
490
568
|
/**
|
491
|
-
* Update an element of keys1 at `_index
|
492
|
-
* (checked only to prevent modifying other tables; can corrupt own data if index overflows)
|
569
|
+
* @notice Update an element of keys1 at `_index`.
|
493
570
|
*/
|
494
571
|
function updateKeys1(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
495
572
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -502,8 +579,7 @@ library KeysInTable {
|
|
502
579
|
}
|
503
580
|
|
504
581
|
/**
|
505
|
-
* Update an element of keys1 at `_index
|
506
|
-
* (checked only to prevent modifying other tables; can corrupt own data if index overflows)
|
582
|
+
* @notice Update an element of keys1 at `_index`.
|
507
583
|
*/
|
508
584
|
function _updateKeys1(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
509
585
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -516,8 +592,7 @@ library KeysInTable {
|
|
516
592
|
}
|
517
593
|
|
518
594
|
/**
|
519
|
-
* Update an element of keys1 (using the specified store) at `_index
|
520
|
-
* (checked only to prevent modifying other tables; can corrupt own data if index overflows)
|
595
|
+
* @notice Update an element of keys1 (using the specified store) at `_index`.
|
521
596
|
*/
|
522
597
|
function updateKeys1(IStore _store, ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
523
598
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -529,7 +604,9 @@ library KeysInTable {
|
|
529
604
|
}
|
530
605
|
}
|
531
606
|
|
532
|
-
/**
|
607
|
+
/**
|
608
|
+
* @notice Get keys2.
|
609
|
+
*/
|
533
610
|
function getKeys2(ResourceId sourceTableId) internal view returns (bytes32[] memory keys2) {
|
534
611
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
535
612
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -538,7 +615,9 @@ library KeysInTable {
|
|
538
615
|
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
539
616
|
}
|
540
617
|
|
541
|
-
/**
|
618
|
+
/**
|
619
|
+
* @notice Get keys2.
|
620
|
+
*/
|
542
621
|
function _getKeys2(ResourceId sourceTableId) internal view returns (bytes32[] memory keys2) {
|
543
622
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
544
623
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -547,7 +626,9 @@ library KeysInTable {
|
|
547
626
|
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
548
627
|
}
|
549
628
|
|
550
|
-
/**
|
629
|
+
/**
|
630
|
+
* @notice Get keys2 (using the specified store).
|
631
|
+
*/
|
551
632
|
function getKeys2(IStore _store, ResourceId sourceTableId) internal view returns (bytes32[] memory keys2) {
|
552
633
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
553
634
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -556,7 +637,9 @@ library KeysInTable {
|
|
556
637
|
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
557
638
|
}
|
558
639
|
|
559
|
-
/**
|
640
|
+
/**
|
641
|
+
* @notice Set keys2.
|
642
|
+
*/
|
560
643
|
function setKeys2(ResourceId sourceTableId, bytes32[] memory keys2) internal {
|
561
644
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
562
645
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -564,7 +647,9 @@ library KeysInTable {
|
|
564
647
|
StoreSwitch.setDynamicField(_tableId, _keyTuple, 2, EncodeArray.encode((keys2)));
|
565
648
|
}
|
566
649
|
|
567
|
-
/**
|
650
|
+
/**
|
651
|
+
* @notice Set keys2.
|
652
|
+
*/
|
568
653
|
function _setKeys2(ResourceId sourceTableId, bytes32[] memory keys2) internal {
|
569
654
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
570
655
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -572,7 +657,9 @@ library KeysInTable {
|
|
572
657
|
StoreCore.setDynamicField(_tableId, _keyTuple, 2, EncodeArray.encode((keys2)));
|
573
658
|
}
|
574
659
|
|
575
|
-
/**
|
660
|
+
/**
|
661
|
+
* @notice Set keys2 (using the specified store).
|
662
|
+
*/
|
576
663
|
function setKeys2(IStore _store, ResourceId sourceTableId, bytes32[] memory keys2) internal {
|
577
664
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
578
665
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -580,7 +667,9 @@ library KeysInTable {
|
|
580
667
|
_store.setDynamicField(_tableId, _keyTuple, 2, EncodeArray.encode((keys2)));
|
581
668
|
}
|
582
669
|
|
583
|
-
/**
|
670
|
+
/**
|
671
|
+
* @notice Get the length of keys2.
|
672
|
+
*/
|
584
673
|
function lengthKeys2(ResourceId sourceTableId) internal view returns (uint256) {
|
585
674
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
586
675
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -591,7 +680,9 @@ library KeysInTable {
|
|
591
680
|
}
|
592
681
|
}
|
593
682
|
|
594
|
-
/**
|
683
|
+
/**
|
684
|
+
* @notice Get the length of keys2.
|
685
|
+
*/
|
595
686
|
function _lengthKeys2(ResourceId sourceTableId) internal view returns (uint256) {
|
596
687
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
597
688
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -602,7 +693,9 @@ library KeysInTable {
|
|
602
693
|
}
|
603
694
|
}
|
604
695
|
|
605
|
-
/**
|
696
|
+
/**
|
697
|
+
* @notice Get the length of keys2 (using the specified store).
|
698
|
+
*/
|
606
699
|
function lengthKeys2(IStore _store, ResourceId sourceTableId) internal view returns (uint256) {
|
607
700
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
608
701
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -614,8 +707,8 @@ library KeysInTable {
|
|
614
707
|
}
|
615
708
|
|
616
709
|
/**
|
617
|
-
* Get an item of keys2
|
618
|
-
*
|
710
|
+
* @notice Get an item of keys2.
|
711
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
619
712
|
*/
|
620
713
|
function getItemKeys2(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
621
714
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -628,8 +721,8 @@ library KeysInTable {
|
|
628
721
|
}
|
629
722
|
|
630
723
|
/**
|
631
|
-
* Get an item of keys2
|
632
|
-
*
|
724
|
+
* @notice Get an item of keys2.
|
725
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
633
726
|
*/
|
634
727
|
function _getItemKeys2(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
635
728
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -642,8 +735,8 @@ library KeysInTable {
|
|
642
735
|
}
|
643
736
|
|
644
737
|
/**
|
645
|
-
* Get an item of keys2 (using the specified store)
|
646
|
-
*
|
738
|
+
* @notice Get an item of keys2 (using the specified store).
|
739
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
647
740
|
*/
|
648
741
|
function getItemKeys2(IStore _store, ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
649
742
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -655,7 +748,9 @@ library KeysInTable {
|
|
655
748
|
}
|
656
749
|
}
|
657
750
|
|
658
|
-
/**
|
751
|
+
/**
|
752
|
+
* @notice Push an element to keys2.
|
753
|
+
*/
|
659
754
|
function pushKeys2(ResourceId sourceTableId, bytes32 _element) internal {
|
660
755
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
661
756
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -663,7 +758,9 @@ library KeysInTable {
|
|
663
758
|
StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 2, abi.encodePacked((_element)));
|
664
759
|
}
|
665
760
|
|
666
|
-
/**
|
761
|
+
/**
|
762
|
+
* @notice Push an element to keys2.
|
763
|
+
*/
|
667
764
|
function _pushKeys2(ResourceId sourceTableId, bytes32 _element) internal {
|
668
765
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
669
766
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -671,7 +768,9 @@ library KeysInTable {
|
|
671
768
|
StoreCore.pushToDynamicField(_tableId, _keyTuple, 2, abi.encodePacked((_element)));
|
672
769
|
}
|
673
770
|
|
674
|
-
/**
|
771
|
+
/**
|
772
|
+
* @notice Push an element to keys2 (using the specified store).
|
773
|
+
*/
|
675
774
|
function pushKeys2(IStore _store, ResourceId sourceTableId, bytes32 _element) internal {
|
676
775
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
677
776
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -679,7 +778,9 @@ library KeysInTable {
|
|
679
778
|
_store.pushToDynamicField(_tableId, _keyTuple, 2, abi.encodePacked((_element)));
|
680
779
|
}
|
681
780
|
|
682
|
-
/**
|
781
|
+
/**
|
782
|
+
* @notice Pop an element from keys2.
|
783
|
+
*/
|
683
784
|
function popKeys2(ResourceId sourceTableId) internal {
|
684
785
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
685
786
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -687,7 +788,9 @@ library KeysInTable {
|
|
687
788
|
StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 2, 32);
|
688
789
|
}
|
689
790
|
|
690
|
-
/**
|
791
|
+
/**
|
792
|
+
* @notice Pop an element from keys2.
|
793
|
+
*/
|
691
794
|
function _popKeys2(ResourceId sourceTableId) internal {
|
692
795
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
693
796
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -695,7 +798,9 @@ library KeysInTable {
|
|
695
798
|
StoreCore.popFromDynamicField(_tableId, _keyTuple, 2, 32);
|
696
799
|
}
|
697
800
|
|
698
|
-
/**
|
801
|
+
/**
|
802
|
+
* @notice Pop an element from keys2 (using the specified store).
|
803
|
+
*/
|
699
804
|
function popKeys2(IStore _store, ResourceId sourceTableId) internal {
|
700
805
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
701
806
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -704,8 +809,7 @@ library KeysInTable {
|
|
704
809
|
}
|
705
810
|
|
706
811
|
/**
|
707
|
-
* Update an element of keys2 at `_index
|
708
|
-
* (checked only to prevent modifying other tables; can corrupt own data if index overflows)
|
812
|
+
* @notice Update an element of keys2 at `_index`.
|
709
813
|
*/
|
710
814
|
function updateKeys2(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
711
815
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -718,8 +822,7 @@ library KeysInTable {
|
|
718
822
|
}
|
719
823
|
|
720
824
|
/**
|
721
|
-
* Update an element of keys2 at `_index
|
722
|
-
* (checked only to prevent modifying other tables; can corrupt own data if index overflows)
|
825
|
+
* @notice Update an element of keys2 at `_index`.
|
723
826
|
*/
|
724
827
|
function _updateKeys2(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
725
828
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -732,8 +835,7 @@ library KeysInTable {
|
|
732
835
|
}
|
733
836
|
|
734
837
|
/**
|
735
|
-
* Update an element of keys2 (using the specified store) at `_index
|
736
|
-
* (checked only to prevent modifying other tables; can corrupt own data if index overflows)
|
838
|
+
* @notice Update an element of keys2 (using the specified store) at `_index`.
|
737
839
|
*/
|
738
840
|
function updateKeys2(IStore _store, ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
739
841
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -745,7 +847,9 @@ library KeysInTable {
|
|
745
847
|
}
|
746
848
|
}
|
747
849
|
|
748
|
-
/**
|
850
|
+
/**
|
851
|
+
* @notice Get keys3.
|
852
|
+
*/
|
749
853
|
function getKeys3(ResourceId sourceTableId) internal view returns (bytes32[] memory keys3) {
|
750
854
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
751
855
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -754,7 +858,9 @@ library KeysInTable {
|
|
754
858
|
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
755
859
|
}
|
756
860
|
|
757
|
-
/**
|
861
|
+
/**
|
862
|
+
* @notice Get keys3.
|
863
|
+
*/
|
758
864
|
function _getKeys3(ResourceId sourceTableId) internal view returns (bytes32[] memory keys3) {
|
759
865
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
760
866
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -763,7 +869,9 @@ library KeysInTable {
|
|
763
869
|
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
764
870
|
}
|
765
871
|
|
766
|
-
/**
|
872
|
+
/**
|
873
|
+
* @notice Get keys3 (using the specified store).
|
874
|
+
*/
|
767
875
|
function getKeys3(IStore _store, ResourceId sourceTableId) internal view returns (bytes32[] memory keys3) {
|
768
876
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
769
877
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -772,7 +880,9 @@ library KeysInTable {
|
|
772
880
|
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
773
881
|
}
|
774
882
|
|
775
|
-
/**
|
883
|
+
/**
|
884
|
+
* @notice Set keys3.
|
885
|
+
*/
|
776
886
|
function setKeys3(ResourceId sourceTableId, bytes32[] memory keys3) internal {
|
777
887
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
778
888
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -780,7 +890,9 @@ library KeysInTable {
|
|
780
890
|
StoreSwitch.setDynamicField(_tableId, _keyTuple, 3, EncodeArray.encode((keys3)));
|
781
891
|
}
|
782
892
|
|
783
|
-
/**
|
893
|
+
/**
|
894
|
+
* @notice Set keys3.
|
895
|
+
*/
|
784
896
|
function _setKeys3(ResourceId sourceTableId, bytes32[] memory keys3) internal {
|
785
897
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
786
898
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -788,7 +900,9 @@ library KeysInTable {
|
|
788
900
|
StoreCore.setDynamicField(_tableId, _keyTuple, 3, EncodeArray.encode((keys3)));
|
789
901
|
}
|
790
902
|
|
791
|
-
/**
|
903
|
+
/**
|
904
|
+
* @notice Set keys3 (using the specified store).
|
905
|
+
*/
|
792
906
|
function setKeys3(IStore _store, ResourceId sourceTableId, bytes32[] memory keys3) internal {
|
793
907
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
794
908
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -796,7 +910,9 @@ library KeysInTable {
|
|
796
910
|
_store.setDynamicField(_tableId, _keyTuple, 3, EncodeArray.encode((keys3)));
|
797
911
|
}
|
798
912
|
|
799
|
-
/**
|
913
|
+
/**
|
914
|
+
* @notice Get the length of keys3.
|
915
|
+
*/
|
800
916
|
function lengthKeys3(ResourceId sourceTableId) internal view returns (uint256) {
|
801
917
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
802
918
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -807,7 +923,9 @@ library KeysInTable {
|
|
807
923
|
}
|
808
924
|
}
|
809
925
|
|
810
|
-
/**
|
926
|
+
/**
|
927
|
+
* @notice Get the length of keys3.
|
928
|
+
*/
|
811
929
|
function _lengthKeys3(ResourceId sourceTableId) internal view returns (uint256) {
|
812
930
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
813
931
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -818,7 +936,9 @@ library KeysInTable {
|
|
818
936
|
}
|
819
937
|
}
|
820
938
|
|
821
|
-
/**
|
939
|
+
/**
|
940
|
+
* @notice Get the length of keys3 (using the specified store).
|
941
|
+
*/
|
822
942
|
function lengthKeys3(IStore _store, ResourceId sourceTableId) internal view returns (uint256) {
|
823
943
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
824
944
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -830,8 +950,8 @@ library KeysInTable {
|
|
830
950
|
}
|
831
951
|
|
832
952
|
/**
|
833
|
-
* Get an item of keys3
|
834
|
-
*
|
953
|
+
* @notice Get an item of keys3.
|
954
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
835
955
|
*/
|
836
956
|
function getItemKeys3(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
837
957
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -844,8 +964,8 @@ library KeysInTable {
|
|
844
964
|
}
|
845
965
|
|
846
966
|
/**
|
847
|
-
* Get an item of keys3
|
848
|
-
*
|
967
|
+
* @notice Get an item of keys3.
|
968
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
849
969
|
*/
|
850
970
|
function _getItemKeys3(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
851
971
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -858,8 +978,8 @@ library KeysInTable {
|
|
858
978
|
}
|
859
979
|
|
860
980
|
/**
|
861
|
-
* Get an item of keys3 (using the specified store)
|
862
|
-
*
|
981
|
+
* @notice Get an item of keys3 (using the specified store).
|
982
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
863
983
|
*/
|
864
984
|
function getItemKeys3(IStore _store, ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
865
985
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -871,7 +991,9 @@ library KeysInTable {
|
|
871
991
|
}
|
872
992
|
}
|
873
993
|
|
874
|
-
/**
|
994
|
+
/**
|
995
|
+
* @notice Push an element to keys3.
|
996
|
+
*/
|
875
997
|
function pushKeys3(ResourceId sourceTableId, bytes32 _element) internal {
|
876
998
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
877
999
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -879,7 +1001,9 @@ library KeysInTable {
|
|
879
1001
|
StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 3, abi.encodePacked((_element)));
|
880
1002
|
}
|
881
1003
|
|
882
|
-
/**
|
1004
|
+
/**
|
1005
|
+
* @notice Push an element to keys3.
|
1006
|
+
*/
|
883
1007
|
function _pushKeys3(ResourceId sourceTableId, bytes32 _element) internal {
|
884
1008
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
885
1009
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -887,7 +1011,9 @@ library KeysInTable {
|
|
887
1011
|
StoreCore.pushToDynamicField(_tableId, _keyTuple, 3, abi.encodePacked((_element)));
|
888
1012
|
}
|
889
1013
|
|
890
|
-
/**
|
1014
|
+
/**
|
1015
|
+
* @notice Push an element to keys3 (using the specified store).
|
1016
|
+
*/
|
891
1017
|
function pushKeys3(IStore _store, ResourceId sourceTableId, bytes32 _element) internal {
|
892
1018
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
893
1019
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -895,7 +1021,9 @@ library KeysInTable {
|
|
895
1021
|
_store.pushToDynamicField(_tableId, _keyTuple, 3, abi.encodePacked((_element)));
|
896
1022
|
}
|
897
1023
|
|
898
|
-
/**
|
1024
|
+
/**
|
1025
|
+
* @notice Pop an element from keys3.
|
1026
|
+
*/
|
899
1027
|
function popKeys3(ResourceId sourceTableId) internal {
|
900
1028
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
901
1029
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -903,7 +1031,9 @@ library KeysInTable {
|
|
903
1031
|
StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 3, 32);
|
904
1032
|
}
|
905
1033
|
|
906
|
-
/**
|
1034
|
+
/**
|
1035
|
+
* @notice Pop an element from keys3.
|
1036
|
+
*/
|
907
1037
|
function _popKeys3(ResourceId sourceTableId) internal {
|
908
1038
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
909
1039
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -911,7 +1041,9 @@ library KeysInTable {
|
|
911
1041
|
StoreCore.popFromDynamicField(_tableId, _keyTuple, 3, 32);
|
912
1042
|
}
|
913
1043
|
|
914
|
-
/**
|
1044
|
+
/**
|
1045
|
+
* @notice Pop an element from keys3 (using the specified store).
|
1046
|
+
*/
|
915
1047
|
function popKeys3(IStore _store, ResourceId sourceTableId) internal {
|
916
1048
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
917
1049
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -920,8 +1052,7 @@ library KeysInTable {
|
|
920
1052
|
}
|
921
1053
|
|
922
1054
|
/**
|
923
|
-
* Update an element of keys3 at `_index
|
924
|
-
* (checked only to prevent modifying other tables; can corrupt own data if index overflows)
|
1055
|
+
* @notice Update an element of keys3 at `_index`.
|
925
1056
|
*/
|
926
1057
|
function updateKeys3(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
927
1058
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -934,8 +1065,7 @@ library KeysInTable {
|
|
934
1065
|
}
|
935
1066
|
|
936
1067
|
/**
|
937
|
-
* Update an element of keys3 at `_index
|
938
|
-
* (checked only to prevent modifying other tables; can corrupt own data if index overflows)
|
1068
|
+
* @notice Update an element of keys3 at `_index`.
|
939
1069
|
*/
|
940
1070
|
function _updateKeys3(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
941
1071
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -948,8 +1078,7 @@ library KeysInTable {
|
|
948
1078
|
}
|
949
1079
|
|
950
1080
|
/**
|
951
|
-
* Update an element of keys3 (using the specified store) at `_index
|
952
|
-
* (checked only to prevent modifying other tables; can corrupt own data if index overflows)
|
1081
|
+
* @notice Update an element of keys3 (using the specified store) at `_index`.
|
953
1082
|
*/
|
954
1083
|
function updateKeys3(IStore _store, ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
955
1084
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -961,7 +1090,9 @@ library KeysInTable {
|
|
961
1090
|
}
|
962
1091
|
}
|
963
1092
|
|
964
|
-
/**
|
1093
|
+
/**
|
1094
|
+
* @notice Get keys4.
|
1095
|
+
*/
|
965
1096
|
function getKeys4(ResourceId sourceTableId) internal view returns (bytes32[] memory keys4) {
|
966
1097
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
967
1098
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -970,7 +1101,9 @@ library KeysInTable {
|
|
970
1101
|
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
971
1102
|
}
|
972
1103
|
|
973
|
-
/**
|
1104
|
+
/**
|
1105
|
+
* @notice Get keys4.
|
1106
|
+
*/
|
974
1107
|
function _getKeys4(ResourceId sourceTableId) internal view returns (bytes32[] memory keys4) {
|
975
1108
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
976
1109
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -979,7 +1112,9 @@ library KeysInTable {
|
|
979
1112
|
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
980
1113
|
}
|
981
1114
|
|
982
|
-
/**
|
1115
|
+
/**
|
1116
|
+
* @notice Get keys4 (using the specified store).
|
1117
|
+
*/
|
983
1118
|
function getKeys4(IStore _store, ResourceId sourceTableId) internal view returns (bytes32[] memory keys4) {
|
984
1119
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
985
1120
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -988,7 +1123,9 @@ library KeysInTable {
|
|
988
1123
|
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
989
1124
|
}
|
990
1125
|
|
991
|
-
/**
|
1126
|
+
/**
|
1127
|
+
* @notice Set keys4.
|
1128
|
+
*/
|
992
1129
|
function setKeys4(ResourceId sourceTableId, bytes32[] memory keys4) internal {
|
993
1130
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
994
1131
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -996,7 +1133,9 @@ library KeysInTable {
|
|
996
1133
|
StoreSwitch.setDynamicField(_tableId, _keyTuple, 4, EncodeArray.encode((keys4)));
|
997
1134
|
}
|
998
1135
|
|
999
|
-
/**
|
1136
|
+
/**
|
1137
|
+
* @notice Set keys4.
|
1138
|
+
*/
|
1000
1139
|
function _setKeys4(ResourceId sourceTableId, bytes32[] memory keys4) internal {
|
1001
1140
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1002
1141
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1004,7 +1143,9 @@ library KeysInTable {
|
|
1004
1143
|
StoreCore.setDynamicField(_tableId, _keyTuple, 4, EncodeArray.encode((keys4)));
|
1005
1144
|
}
|
1006
1145
|
|
1007
|
-
/**
|
1146
|
+
/**
|
1147
|
+
* @notice Set keys4 (using the specified store).
|
1148
|
+
*/
|
1008
1149
|
function setKeys4(IStore _store, ResourceId sourceTableId, bytes32[] memory keys4) internal {
|
1009
1150
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1010
1151
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1012,7 +1153,9 @@ library KeysInTable {
|
|
1012
1153
|
_store.setDynamicField(_tableId, _keyTuple, 4, EncodeArray.encode((keys4)));
|
1013
1154
|
}
|
1014
1155
|
|
1015
|
-
/**
|
1156
|
+
/**
|
1157
|
+
* @notice Get the length of keys4.
|
1158
|
+
*/
|
1016
1159
|
function lengthKeys4(ResourceId sourceTableId) internal view returns (uint256) {
|
1017
1160
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1018
1161
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1023,7 +1166,9 @@ library KeysInTable {
|
|
1023
1166
|
}
|
1024
1167
|
}
|
1025
1168
|
|
1026
|
-
/**
|
1169
|
+
/**
|
1170
|
+
* @notice Get the length of keys4.
|
1171
|
+
*/
|
1027
1172
|
function _lengthKeys4(ResourceId sourceTableId) internal view returns (uint256) {
|
1028
1173
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1029
1174
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1034,7 +1179,9 @@ library KeysInTable {
|
|
1034
1179
|
}
|
1035
1180
|
}
|
1036
1181
|
|
1037
|
-
/**
|
1182
|
+
/**
|
1183
|
+
* @notice Get the length of keys4 (using the specified store).
|
1184
|
+
*/
|
1038
1185
|
function lengthKeys4(IStore _store, ResourceId sourceTableId) internal view returns (uint256) {
|
1039
1186
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1040
1187
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1046,8 +1193,8 @@ library KeysInTable {
|
|
1046
1193
|
}
|
1047
1194
|
|
1048
1195
|
/**
|
1049
|
-
* Get an item of keys4
|
1050
|
-
*
|
1196
|
+
* @notice Get an item of keys4.
|
1197
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
1051
1198
|
*/
|
1052
1199
|
function getItemKeys4(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
1053
1200
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -1060,8 +1207,8 @@ library KeysInTable {
|
|
1060
1207
|
}
|
1061
1208
|
|
1062
1209
|
/**
|
1063
|
-
* Get an item of keys4
|
1064
|
-
*
|
1210
|
+
* @notice Get an item of keys4.
|
1211
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
1065
1212
|
*/
|
1066
1213
|
function _getItemKeys4(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
1067
1214
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -1074,8 +1221,8 @@ library KeysInTable {
|
|
1074
1221
|
}
|
1075
1222
|
|
1076
1223
|
/**
|
1077
|
-
* Get an item of keys4 (using the specified store)
|
1078
|
-
*
|
1224
|
+
* @notice Get an item of keys4 (using the specified store).
|
1225
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
1079
1226
|
*/
|
1080
1227
|
function getItemKeys4(IStore _store, ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
1081
1228
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -1087,7 +1234,9 @@ library KeysInTable {
|
|
1087
1234
|
}
|
1088
1235
|
}
|
1089
1236
|
|
1090
|
-
/**
|
1237
|
+
/**
|
1238
|
+
* @notice Push an element to keys4.
|
1239
|
+
*/
|
1091
1240
|
function pushKeys4(ResourceId sourceTableId, bytes32 _element) internal {
|
1092
1241
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1093
1242
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1095,7 +1244,9 @@ library KeysInTable {
|
|
1095
1244
|
StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 4, abi.encodePacked((_element)));
|
1096
1245
|
}
|
1097
1246
|
|
1098
|
-
/**
|
1247
|
+
/**
|
1248
|
+
* @notice Push an element to keys4.
|
1249
|
+
*/
|
1099
1250
|
function _pushKeys4(ResourceId sourceTableId, bytes32 _element) internal {
|
1100
1251
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1101
1252
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1103,7 +1254,9 @@ library KeysInTable {
|
|
1103
1254
|
StoreCore.pushToDynamicField(_tableId, _keyTuple, 4, abi.encodePacked((_element)));
|
1104
1255
|
}
|
1105
1256
|
|
1106
|
-
/**
|
1257
|
+
/**
|
1258
|
+
* @notice Push an element to keys4 (using the specified store).
|
1259
|
+
*/
|
1107
1260
|
function pushKeys4(IStore _store, ResourceId sourceTableId, bytes32 _element) internal {
|
1108
1261
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1109
1262
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1111,7 +1264,9 @@ library KeysInTable {
|
|
1111
1264
|
_store.pushToDynamicField(_tableId, _keyTuple, 4, abi.encodePacked((_element)));
|
1112
1265
|
}
|
1113
1266
|
|
1114
|
-
/**
|
1267
|
+
/**
|
1268
|
+
* @notice Pop an element from keys4.
|
1269
|
+
*/
|
1115
1270
|
function popKeys4(ResourceId sourceTableId) internal {
|
1116
1271
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1117
1272
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1119,7 +1274,9 @@ library KeysInTable {
|
|
1119
1274
|
StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 4, 32);
|
1120
1275
|
}
|
1121
1276
|
|
1122
|
-
/**
|
1277
|
+
/**
|
1278
|
+
* @notice Pop an element from keys4.
|
1279
|
+
*/
|
1123
1280
|
function _popKeys4(ResourceId sourceTableId) internal {
|
1124
1281
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1125
1282
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1127,7 +1284,9 @@ library KeysInTable {
|
|
1127
1284
|
StoreCore.popFromDynamicField(_tableId, _keyTuple, 4, 32);
|
1128
1285
|
}
|
1129
1286
|
|
1130
|
-
/**
|
1287
|
+
/**
|
1288
|
+
* @notice Pop an element from keys4 (using the specified store).
|
1289
|
+
*/
|
1131
1290
|
function popKeys4(IStore _store, ResourceId sourceTableId) internal {
|
1132
1291
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1133
1292
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1136,8 +1295,7 @@ library KeysInTable {
|
|
1136
1295
|
}
|
1137
1296
|
|
1138
1297
|
/**
|
1139
|
-
* Update an element of keys4 at `_index
|
1140
|
-
* (checked only to prevent modifying other tables; can corrupt own data if index overflows)
|
1298
|
+
* @notice Update an element of keys4 at `_index`.
|
1141
1299
|
*/
|
1142
1300
|
function updateKeys4(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
1143
1301
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -1150,8 +1308,7 @@ library KeysInTable {
|
|
1150
1308
|
}
|
1151
1309
|
|
1152
1310
|
/**
|
1153
|
-
* Update an element of keys4 at `_index
|
1154
|
-
* (checked only to prevent modifying other tables; can corrupt own data if index overflows)
|
1311
|
+
* @notice Update an element of keys4 at `_index`.
|
1155
1312
|
*/
|
1156
1313
|
function _updateKeys4(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
1157
1314
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -1164,8 +1321,7 @@ library KeysInTable {
|
|
1164
1321
|
}
|
1165
1322
|
|
1166
1323
|
/**
|
1167
|
-
* Update an element of keys4 (using the specified store) at `_index
|
1168
|
-
* (checked only to prevent modifying other tables; can corrupt own data if index overflows)
|
1324
|
+
* @notice Update an element of keys4 (using the specified store) at `_index`.
|
1169
1325
|
*/
|
1170
1326
|
function updateKeys4(IStore _store, ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
1171
1327
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -1177,7 +1333,9 @@ library KeysInTable {
|
|
1177
1333
|
}
|
1178
1334
|
}
|
1179
1335
|
|
1180
|
-
/**
|
1336
|
+
/**
|
1337
|
+
* @notice Get the full data.
|
1338
|
+
*/
|
1181
1339
|
function get(ResourceId sourceTableId) internal view returns (KeysInTableData memory _table) {
|
1182
1340
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1183
1341
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1190,7 +1348,9 @@ library KeysInTable {
|
|
1190
1348
|
return decode(_staticData, _encodedLengths, _dynamicData);
|
1191
1349
|
}
|
1192
1350
|
|
1193
|
-
/**
|
1351
|
+
/**
|
1352
|
+
* @notice Get the full data.
|
1353
|
+
*/
|
1194
1354
|
function _get(ResourceId sourceTableId) internal view returns (KeysInTableData memory _table) {
|
1195
1355
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1196
1356
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1203,7 +1363,9 @@ library KeysInTable {
|
|
1203
1363
|
return decode(_staticData, _encodedLengths, _dynamicData);
|
1204
1364
|
}
|
1205
1365
|
|
1206
|
-
/**
|
1366
|
+
/**
|
1367
|
+
* @notice Get the full data (using the specified store).
|
1368
|
+
*/
|
1207
1369
|
function get(IStore _store, ResourceId sourceTableId) internal view returns (KeysInTableData memory _table) {
|
1208
1370
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1209
1371
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1216,7 +1378,9 @@ library KeysInTable {
|
|
1216
1378
|
return decode(_staticData, _encodedLengths, _dynamicData);
|
1217
1379
|
}
|
1218
1380
|
|
1219
|
-
/**
|
1381
|
+
/**
|
1382
|
+
* @notice Set the full data using individual values.
|
1383
|
+
*/
|
1220
1384
|
function set(
|
1221
1385
|
ResourceId sourceTableId,
|
1222
1386
|
bytes32[] memory keys0,
|
@@ -1235,7 +1399,9 @@ library KeysInTable {
|
|
1235
1399
|
StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData);
|
1236
1400
|
}
|
1237
1401
|
|
1238
|
-
/**
|
1402
|
+
/**
|
1403
|
+
* @notice Set the full data using individual values.
|
1404
|
+
*/
|
1239
1405
|
function _set(
|
1240
1406
|
ResourceId sourceTableId,
|
1241
1407
|
bytes32[] memory keys0,
|
@@ -1254,7 +1420,9 @@ library KeysInTable {
|
|
1254
1420
|
StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout);
|
1255
1421
|
}
|
1256
1422
|
|
1257
|
-
/**
|
1423
|
+
/**
|
1424
|
+
* @notice Set the full data using individual values (using the specified store).
|
1425
|
+
*/
|
1258
1426
|
function set(
|
1259
1427
|
IStore _store,
|
1260
1428
|
ResourceId sourceTableId,
|
@@ -1274,7 +1442,9 @@ library KeysInTable {
|
|
1274
1442
|
_store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData);
|
1275
1443
|
}
|
1276
1444
|
|
1277
|
-
/**
|
1445
|
+
/**
|
1446
|
+
* @notice Set the full data using the data struct.
|
1447
|
+
*/
|
1278
1448
|
function set(ResourceId sourceTableId, KeysInTableData memory _table) internal {
|
1279
1449
|
bytes memory _staticData;
|
1280
1450
|
PackedCounter _encodedLengths = encodeLengths(_table.keys0, _table.keys1, _table.keys2, _table.keys3, _table.keys4);
|
@@ -1286,7 +1456,9 @@ library KeysInTable {
|
|
1286
1456
|
StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData);
|
1287
1457
|
}
|
1288
1458
|
|
1289
|
-
/**
|
1459
|
+
/**
|
1460
|
+
* @notice Set the full data using the data struct.
|
1461
|
+
*/
|
1290
1462
|
function _set(ResourceId sourceTableId, KeysInTableData memory _table) internal {
|
1291
1463
|
bytes memory _staticData;
|
1292
1464
|
PackedCounter _encodedLengths = encodeLengths(_table.keys0, _table.keys1, _table.keys2, _table.keys3, _table.keys4);
|
@@ -1298,7 +1470,9 @@ library KeysInTable {
|
|
1298
1470
|
StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout);
|
1299
1471
|
}
|
1300
1472
|
|
1301
|
-
/**
|
1473
|
+
/**
|
1474
|
+
* @notice Set the full data using the data struct (using the specified store).
|
1475
|
+
*/
|
1302
1476
|
function set(IStore _store, ResourceId sourceTableId, KeysInTableData memory _table) internal {
|
1303
1477
|
bytes memory _staticData;
|
1304
1478
|
PackedCounter _encodedLengths = encodeLengths(_table.keys0, _table.keys1, _table.keys2, _table.keys3, _table.keys4);
|
@@ -1311,8 +1485,7 @@ library KeysInTable {
|
|
1311
1485
|
}
|
1312
1486
|
|
1313
1487
|
/**
|
1314
|
-
* Decode the tightly packed blob of
|
1315
|
-
* Undefined behaviour for invalid blobs
|
1488
|
+
* @notice Decode the tightly packed blob of dynamic data using the encoded lengths.
|
1316
1489
|
*/
|
1317
1490
|
function decodeDynamic(
|
1318
1491
|
PackedCounter _encodedLengths,
|
@@ -1361,8 +1534,10 @@ library KeysInTable {
|
|
1361
1534
|
}
|
1362
1535
|
|
1363
1536
|
/**
|
1364
|
-
* Decode the tightly packed
|
1365
|
-
*
|
1537
|
+
* @notice Decode the tightly packed blobs using this table's field layout.
|
1538
|
+
*
|
1539
|
+
* @param _encodedLengths Encoded lengths of dynamic fields.
|
1540
|
+
* @param _dynamicData Tightly packed dynamic fields.
|
1366
1541
|
*/
|
1367
1542
|
function decode(
|
1368
1543
|
bytes memory,
|
@@ -1375,7 +1550,9 @@ library KeysInTable {
|
|
1375
1550
|
);
|
1376
1551
|
}
|
1377
1552
|
|
1378
|
-
/**
|
1553
|
+
/**
|
1554
|
+
* @notice Delete all data for given keys.
|
1555
|
+
*/
|
1379
1556
|
function deleteRecord(ResourceId sourceTableId) internal {
|
1380
1557
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1381
1558
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1383,7 +1560,9 @@ library KeysInTable {
|
|
1383
1560
|
StoreSwitch.deleteRecord(_tableId, _keyTuple);
|
1384
1561
|
}
|
1385
1562
|
|
1386
|
-
/**
|
1563
|
+
/**
|
1564
|
+
* @notice Delete all data for given keys.
|
1565
|
+
*/
|
1387
1566
|
function _deleteRecord(ResourceId sourceTableId) internal {
|
1388
1567
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1389
1568
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1391,7 +1570,9 @@ library KeysInTable {
|
|
1391
1570
|
StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout);
|
1392
1571
|
}
|
1393
1572
|
|
1394
|
-
/**
|
1573
|
+
/**
|
1574
|
+
* @notice Delete all data for given keys (using the specified store).
|
1575
|
+
*/
|
1395
1576
|
function deleteRecord(IStore _store, ResourceId sourceTableId) internal {
|
1396
1577
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1397
1578
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
@@ -1399,7 +1580,10 @@ library KeysInTable {
|
|
1399
1580
|
_store.deleteRecord(_tableId, _keyTuple);
|
1400
1581
|
}
|
1401
1582
|
|
1402
|
-
/**
|
1583
|
+
/**
|
1584
|
+
* @notice Tightly pack dynamic data lengths using this table's schema.
|
1585
|
+
* @return _encodedLengths The lengths of the dynamic fields (packed into a single bytes32 value).
|
1586
|
+
*/
|
1403
1587
|
function encodeLengths(
|
1404
1588
|
bytes32[] memory keys0,
|
1405
1589
|
bytes32[] memory keys1,
|
@@ -1419,7 +1603,10 @@ library KeysInTable {
|
|
1419
1603
|
}
|
1420
1604
|
}
|
1421
1605
|
|
1422
|
-
/**
|
1606
|
+
/**
|
1607
|
+
* @notice Tightly pack dynamic (variable length) data using this table's schema.
|
1608
|
+
* @return The dynamic data, encoded into a sequence of bytes.
|
1609
|
+
*/
|
1423
1610
|
function encodeDynamic(
|
1424
1611
|
bytes32[] memory keys0,
|
1425
1612
|
bytes32[] memory keys1,
|
@@ -1437,7 +1624,12 @@ library KeysInTable {
|
|
1437
1624
|
);
|
1438
1625
|
}
|
1439
1626
|
|
1440
|
-
/**
|
1627
|
+
/**
|
1628
|
+
* @notice Encode all of a record's fields.
|
1629
|
+
* @return The static (fixed length) data, encoded into a sequence of bytes.
|
1630
|
+
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
1631
|
+
* @return The dyanmic (variable length) data, encoded into a sequence of bytes.
|
1632
|
+
*/
|
1441
1633
|
function encode(
|
1442
1634
|
bytes32[] memory keys0,
|
1443
1635
|
bytes32[] memory keys1,
|
@@ -1452,7 +1644,9 @@ library KeysInTable {
|
|
1452
1644
|
return (_staticData, _encodedLengths, _dynamicData);
|
1453
1645
|
}
|
1454
1646
|
|
1455
|
-
/**
|
1647
|
+
/**
|
1648
|
+
* @notice Encode keys as a bytes32 array using this table's field layout.
|
1649
|
+
*/
|
1456
1650
|
function encodeKeyTuple(ResourceId sourceTableId) internal pure returns (bytes32[] memory) {
|
1457
1651
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1458
1652
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|