@latticexyz/world-modules 2.0.12-type-resolutions-effc7ab1 → 2.0.12-type-resolutions-ad8cc987
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/cache/solidity-files-cache.json +1 -1
- package/package.json +9 -8
- package/src/index.sol +25 -0
- package/src/interfaces/IBaseWorld.sol +16 -0
- package/src/interfaces/IERC20System.sol +33 -0
- package/src/interfaces/IERC721System.sol +43 -0
- package/src/interfaces/IPuppetFactorySystem.sol +15 -0
- package/src/interfaces/IUniqueEntitySystem.sol +13 -0
- package/src/interfaces/IUnstable_CallWithSignatureSystem.sol +20 -0
- package/src/modules/callwithsignature/ECDSA.sol +174 -0
- package/src/modules/callwithsignature/IERC1271.sol +17 -0
- package/src/modules/callwithsignature/IUnstable_CallWithSignatureErrors.sol +9 -0
- package/src/modules/callwithsignature/SignatureChecker.sol +50 -0
- package/src/modules/callwithsignature/Unstable_CallWithSignatureModule.sol +48 -0
- package/src/modules/callwithsignature/Unstable_CallWithSignatureSystem.sol +36 -0
- package/src/modules/callwithsignature/constants.sol +10 -0
- package/src/modules/callwithsignature/getSignedMessageHash.sol +54 -0
- package/src/modules/callwithsignature/tables/CallWithSignatureNonces.sol +199 -0
- package/src/modules/callwithsignature/validateCallWithSignature.sol +31 -0
- package/src/modules/erc20-puppet/ERC20Module.sol +88 -0
- package/src/modules/erc20-puppet/ERC20System.sol +286 -0
- package/src/modules/erc20-puppet/IERC20.sol +94 -0
- package/src/modules/erc20-puppet/IERC20Errors.sol +49 -0
- package/src/modules/erc20-puppet/IERC20Events.sol +18 -0
- package/src/modules/erc20-puppet/IERC20Mintable.sol +25 -0
- package/src/modules/erc20-puppet/constants.sol +20 -0
- package/src/modules/erc20-puppet/registerERC20.sol +35 -0
- package/src/modules/erc20-puppet/tables/Allowances.sol +208 -0
- package/src/modules/erc20-puppet/tables/ERC20Metadata.sol +604 -0
- package/src/modules/erc20-puppet/tables/ERC20Registry.sol +199 -0
- package/src/modules/erc20-puppet/tables/TotalSupply.sol +184 -0
- package/src/modules/erc20-puppet/utils.sol +30 -0
- package/src/modules/erc721-puppet/ERC721Module.sol +95 -0
- package/src/modules/erc721-puppet/ERC721System.sol +531 -0
- package/src/modules/erc721-puppet/IERC721.sol +120 -0
- package/src/modules/erc721-puppet/IERC721Errors.sol +61 -0
- package/src/modules/erc721-puppet/IERC721Events.sol +23 -0
- package/src/modules/erc721-puppet/IERC721Metadata.sol +27 -0
- package/src/modules/erc721-puppet/IERC721Mintable.sol +53 -0
- package/src/modules/erc721-puppet/IERC721Receiver.sol +28 -0
- package/src/modules/erc721-puppet/constants.sol +23 -0
- package/src/modules/erc721-puppet/libraries/LibString.sol +77 -0
- package/src/modules/erc721-puppet/registerERC721.sol +37 -0
- package/src/modules/erc721-puppet/tables/ERC721Metadata.sol +703 -0
- package/src/modules/erc721-puppet/tables/ERC721Registry.sol +199 -0
- package/src/modules/erc721-puppet/tables/OperatorApproval.sol +220 -0
- package/src/modules/erc721-puppet/tables/Owners.sol +196 -0
- package/src/modules/erc721-puppet/tables/TokenApproval.sol +196 -0
- package/src/modules/erc721-puppet/tables/TokenURI.sol +450 -0
- package/src/modules/erc721-puppet/utils.sol +38 -0
- package/src/modules/keysintable/KeysInTableHook.sol +141 -0
- package/src/modules/keysintable/KeysInTableModule.sol +110 -0
- package/src/modules/keysintable/constants.sol +7 -0
- package/src/modules/keysintable/getKeysInTable.sol +81 -0
- package/src/modules/keysintable/hasKey.sol +28 -0
- package/src/modules/keysintable/query.sol +200 -0
- package/src/modules/keysintable/tables/KeysInTable.sol +1638 -0
- package/src/modules/keysintable/tables/UsedKeysIndex.sol +414 -0
- package/src/modules/keyswithvalue/KeysWithValueHook.sol +158 -0
- package/src/modules/keyswithvalue/KeysWithValueModule.sol +103 -0
- package/src/modules/keyswithvalue/constants.sol +7 -0
- package/src/modules/keyswithvalue/getKeysWithValue.sol +58 -0
- package/src/modules/keyswithvalue/getTargetTableId.sol +32 -0
- package/src/modules/keyswithvalue/tables/KeysWithValue.sol +668 -0
- package/src/modules/puppet/Puppet.sol +80 -0
- package/src/modules/puppet/PuppetDelegationControl.sol +17 -0
- package/src/modules/puppet/PuppetFactorySystem.sol +25 -0
- package/src/modules/puppet/PuppetMaster.sol +19 -0
- package/src/modules/puppet/PuppetModule.sol +64 -0
- package/src/modules/puppet/constants.sol +23 -0
- package/src/modules/puppet/createPuppet.sol +24 -0
- package/src/modules/puppet/tables/PuppetRegistry.sol +199 -0
- package/src/modules/puppet/utils.sol +10 -0
- package/src/modules/std-delegations/CallboundDelegationControl.sol +64 -0
- package/src/modules/std-delegations/StandardDelegationsModule.sol +55 -0
- package/src/modules/std-delegations/SystemboundDelegationControl.sol +54 -0
- package/src/modules/std-delegations/TimeboundDelegationControl.sol +27 -0
- package/src/modules/std-delegations/constants.sol +21 -0
- package/src/modules/std-delegations/tables/CallboundDelegations.sol +287 -0
- package/src/modules/std-delegations/tables/SystemboundDelegations.sol +256 -0
- package/src/modules/std-delegations/tables/TimeboundDelegations.sol +211 -0
- package/src/modules/tokens/tables/Balances.sol +196 -0
- package/src/modules/uniqueentity/UniqueEntityModule.sol +73 -0
- package/src/modules/uniqueentity/UniqueEntitySystem.sol +18 -0
- package/src/modules/uniqueentity/constants.sol +13 -0
- package/src/modules/uniqueentity/getUniqueEntity.sol +26 -0
- package/src/modules/uniqueentity/tables/UniqueEntity.sol +238 -0
- package/src/modules/utils/ArrayLib.sol +55 -0
- package/src/utils/AccessControlLib.sol +55 -0
- package/src/utils/SystemSwitch.sol +80 -0
@@ -0,0 +1,1638 @@
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
2
|
+
pragma solidity >=0.8.24;
|
3
|
+
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
5
|
+
|
6
|
+
// Import store internals
|
7
|
+
import { IStore } from "@latticexyz/store/src/IStore.sol";
|
8
|
+
import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol";
|
9
|
+
import { StoreCore } from "@latticexyz/store/src/StoreCore.sol";
|
10
|
+
import { Bytes } from "@latticexyz/store/src/Bytes.sol";
|
11
|
+
import { Memory } from "@latticexyz/store/src/Memory.sol";
|
12
|
+
import { SliceLib } from "@latticexyz/store/src/Slice.sol";
|
13
|
+
import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol";
|
14
|
+
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
|
15
|
+
import { Schema } from "@latticexyz/store/src/Schema.sol";
|
16
|
+
import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
|
17
|
+
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
18
|
+
|
19
|
+
// Import user types
|
20
|
+
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
21
|
+
|
22
|
+
struct KeysInTableData {
|
23
|
+
bytes32[] keys0;
|
24
|
+
bytes32[] keys1;
|
25
|
+
bytes32[] keys2;
|
26
|
+
bytes32[] keys3;
|
27
|
+
bytes32[] keys4;
|
28
|
+
}
|
29
|
+
|
30
|
+
library KeysInTable {
|
31
|
+
// Hex below is the result of `WorldResourceIdLib.encode({ namespace: "", name: "KeysInTable", typeId: RESOURCE_TABLE });`
|
32
|
+
ResourceId constant _tableId = ResourceId.wrap(0x746200000000000000000000000000004b657973496e5461626c650000000000);
|
33
|
+
|
34
|
+
FieldLayout constant _fieldLayout =
|
35
|
+
FieldLayout.wrap(0x0000000500000000000000000000000000000000000000000000000000000000);
|
36
|
+
|
37
|
+
// Hex-encoded key schema of (bytes32)
|
38
|
+
Schema constant _keySchema = Schema.wrap(0x002001005f000000000000000000000000000000000000000000000000000000);
|
39
|
+
// Hex-encoded value schema of (bytes32[], bytes32[], bytes32[], bytes32[], bytes32[])
|
40
|
+
Schema constant _valueSchema = Schema.wrap(0x00000005c1c1c1c1c10000000000000000000000000000000000000000000000);
|
41
|
+
|
42
|
+
/**
|
43
|
+
* @notice Get the table's key field names.
|
44
|
+
* @return keyNames An array of strings with the names of key fields.
|
45
|
+
*/
|
46
|
+
function getKeyNames() internal pure returns (string[] memory keyNames) {
|
47
|
+
keyNames = new string[](1);
|
48
|
+
keyNames[0] = "sourceTableId";
|
49
|
+
}
|
50
|
+
|
51
|
+
/**
|
52
|
+
* @notice Get the table's value field names.
|
53
|
+
* @return fieldNames An array of strings with the names of value fields.
|
54
|
+
*/
|
55
|
+
function getFieldNames() internal pure returns (string[] memory fieldNames) {
|
56
|
+
fieldNames = new string[](5);
|
57
|
+
fieldNames[0] = "keys0";
|
58
|
+
fieldNames[1] = "keys1";
|
59
|
+
fieldNames[2] = "keys2";
|
60
|
+
fieldNames[3] = "keys3";
|
61
|
+
fieldNames[4] = "keys4";
|
62
|
+
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
* @notice Register the table with its config.
|
66
|
+
*/
|
67
|
+
function register() internal {
|
68
|
+
StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames());
|
69
|
+
}
|
70
|
+
|
71
|
+
/**
|
72
|
+
* @notice Register the table with its config.
|
73
|
+
*/
|
74
|
+
function _register() internal {
|
75
|
+
StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames());
|
76
|
+
}
|
77
|
+
|
78
|
+
/**
|
79
|
+
* @notice Register the table with its config (using the specified store).
|
80
|
+
*/
|
81
|
+
function register(IStore _store) internal {
|
82
|
+
_store.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames());
|
83
|
+
}
|
84
|
+
|
85
|
+
/**
|
86
|
+
* @notice Get keys0.
|
87
|
+
*/
|
88
|
+
function getKeys0(ResourceId sourceTableId) internal view returns (bytes32[] memory keys0) {
|
89
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
90
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
91
|
+
|
92
|
+
bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 0);
|
93
|
+
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
94
|
+
}
|
95
|
+
|
96
|
+
/**
|
97
|
+
* @notice Get keys0.
|
98
|
+
*/
|
99
|
+
function _getKeys0(ResourceId sourceTableId) internal view returns (bytes32[] memory keys0) {
|
100
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
101
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
102
|
+
|
103
|
+
bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 0);
|
104
|
+
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
105
|
+
}
|
106
|
+
|
107
|
+
/**
|
108
|
+
* @notice Get keys0 (using the specified store).
|
109
|
+
*/
|
110
|
+
function getKeys0(IStore _store, ResourceId sourceTableId) internal view returns (bytes32[] memory keys0) {
|
111
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
112
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
113
|
+
|
114
|
+
bytes memory _blob = _store.getDynamicField(_tableId, _keyTuple, 0);
|
115
|
+
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
116
|
+
}
|
117
|
+
|
118
|
+
/**
|
119
|
+
* @notice Set keys0.
|
120
|
+
*/
|
121
|
+
function setKeys0(ResourceId sourceTableId, bytes32[] memory keys0) internal {
|
122
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
123
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
124
|
+
|
125
|
+
StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((keys0)));
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
* @notice Set keys0.
|
130
|
+
*/
|
131
|
+
function _setKeys0(ResourceId sourceTableId, bytes32[] memory keys0) internal {
|
132
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
133
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
134
|
+
|
135
|
+
StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((keys0)));
|
136
|
+
}
|
137
|
+
|
138
|
+
/**
|
139
|
+
* @notice Set keys0 (using the specified store).
|
140
|
+
*/
|
141
|
+
function setKeys0(IStore _store, ResourceId sourceTableId, bytes32[] memory keys0) internal {
|
142
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
143
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
144
|
+
|
145
|
+
_store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((keys0)));
|
146
|
+
}
|
147
|
+
|
148
|
+
/**
|
149
|
+
* @notice Get the length of keys0.
|
150
|
+
*/
|
151
|
+
function lengthKeys0(ResourceId sourceTableId) internal view returns (uint256) {
|
152
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
153
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
154
|
+
|
155
|
+
uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0);
|
156
|
+
unchecked {
|
157
|
+
return _byteLength / 32;
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
/**
|
162
|
+
* @notice Get the length of keys0.
|
163
|
+
*/
|
164
|
+
function _lengthKeys0(ResourceId sourceTableId) internal view returns (uint256) {
|
165
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
166
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
167
|
+
|
168
|
+
uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0);
|
169
|
+
unchecked {
|
170
|
+
return _byteLength / 32;
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
/**
|
175
|
+
* @notice Get the length of keys0 (using the specified store).
|
176
|
+
*/
|
177
|
+
function lengthKeys0(IStore _store, ResourceId sourceTableId) internal view returns (uint256) {
|
178
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
179
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
180
|
+
|
181
|
+
uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0);
|
182
|
+
unchecked {
|
183
|
+
return _byteLength / 32;
|
184
|
+
}
|
185
|
+
}
|
186
|
+
|
187
|
+
/**
|
188
|
+
* @notice Get an item of keys0.
|
189
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
190
|
+
*/
|
191
|
+
function getItemKeys0(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
192
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
193
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
194
|
+
|
195
|
+
unchecked {
|
196
|
+
bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32);
|
197
|
+
return (bytes32(_blob));
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
/**
|
202
|
+
* @notice Get an item of keys0.
|
203
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
204
|
+
*/
|
205
|
+
function _getItemKeys0(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
206
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
207
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
208
|
+
|
209
|
+
unchecked {
|
210
|
+
bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32);
|
211
|
+
return (bytes32(_blob));
|
212
|
+
}
|
213
|
+
}
|
214
|
+
|
215
|
+
/**
|
216
|
+
* @notice Get an item of keys0 (using the specified store).
|
217
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
218
|
+
*/
|
219
|
+
function getItemKeys0(IStore _store, ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
220
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
221
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
222
|
+
|
223
|
+
unchecked {
|
224
|
+
bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32);
|
225
|
+
return (bytes32(_blob));
|
226
|
+
}
|
227
|
+
}
|
228
|
+
|
229
|
+
/**
|
230
|
+
* @notice Push an element to keys0.
|
231
|
+
*/
|
232
|
+
function pushKeys0(ResourceId sourceTableId, bytes32 _element) internal {
|
233
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
234
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
235
|
+
|
236
|
+
StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element)));
|
237
|
+
}
|
238
|
+
|
239
|
+
/**
|
240
|
+
* @notice Push an element to keys0.
|
241
|
+
*/
|
242
|
+
function _pushKeys0(ResourceId sourceTableId, bytes32 _element) internal {
|
243
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
244
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
245
|
+
|
246
|
+
StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element)));
|
247
|
+
}
|
248
|
+
|
249
|
+
/**
|
250
|
+
* @notice Push an element to keys0 (using the specified store).
|
251
|
+
*/
|
252
|
+
function pushKeys0(IStore _store, ResourceId sourceTableId, bytes32 _element) internal {
|
253
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
254
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
255
|
+
|
256
|
+
_store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element)));
|
257
|
+
}
|
258
|
+
|
259
|
+
/**
|
260
|
+
* @notice Pop an element from keys0.
|
261
|
+
*/
|
262
|
+
function popKeys0(ResourceId sourceTableId) internal {
|
263
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
264
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
265
|
+
|
266
|
+
StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 32);
|
267
|
+
}
|
268
|
+
|
269
|
+
/**
|
270
|
+
* @notice Pop an element from keys0.
|
271
|
+
*/
|
272
|
+
function _popKeys0(ResourceId sourceTableId) internal {
|
273
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
274
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
275
|
+
|
276
|
+
StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 32);
|
277
|
+
}
|
278
|
+
|
279
|
+
/**
|
280
|
+
* @notice Pop an element from keys0 (using the specified store).
|
281
|
+
*/
|
282
|
+
function popKeys0(IStore _store, ResourceId sourceTableId) internal {
|
283
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
284
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
285
|
+
|
286
|
+
_store.popFromDynamicField(_tableId, _keyTuple, 0, 32);
|
287
|
+
}
|
288
|
+
|
289
|
+
/**
|
290
|
+
* @notice Update an element of keys0 at `_index`.
|
291
|
+
*/
|
292
|
+
function updateKeys0(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
293
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
294
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
295
|
+
|
296
|
+
unchecked {
|
297
|
+
bytes memory _encoded = abi.encodePacked((_element));
|
298
|
+
StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded);
|
299
|
+
}
|
300
|
+
}
|
301
|
+
|
302
|
+
/**
|
303
|
+
* @notice Update an element of keys0 at `_index`.
|
304
|
+
*/
|
305
|
+
function _updateKeys0(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
306
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
307
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
308
|
+
|
309
|
+
unchecked {
|
310
|
+
bytes memory _encoded = abi.encodePacked((_element));
|
311
|
+
StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded);
|
312
|
+
}
|
313
|
+
}
|
314
|
+
|
315
|
+
/**
|
316
|
+
* @notice Update an element of keys0 (using the specified store) at `_index`.
|
317
|
+
*/
|
318
|
+
function updateKeys0(IStore _store, ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
319
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
320
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
321
|
+
|
322
|
+
unchecked {
|
323
|
+
bytes memory _encoded = abi.encodePacked((_element));
|
324
|
+
_store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded);
|
325
|
+
}
|
326
|
+
}
|
327
|
+
|
328
|
+
/**
|
329
|
+
* @notice Get keys1.
|
330
|
+
*/
|
331
|
+
function getKeys1(ResourceId sourceTableId) internal view returns (bytes32[] memory keys1) {
|
332
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
333
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
334
|
+
|
335
|
+
bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 1);
|
336
|
+
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
337
|
+
}
|
338
|
+
|
339
|
+
/**
|
340
|
+
* @notice Get keys1.
|
341
|
+
*/
|
342
|
+
function _getKeys1(ResourceId sourceTableId) internal view returns (bytes32[] memory keys1) {
|
343
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
344
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
345
|
+
|
346
|
+
bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 1);
|
347
|
+
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
348
|
+
}
|
349
|
+
|
350
|
+
/**
|
351
|
+
* @notice Get keys1 (using the specified store).
|
352
|
+
*/
|
353
|
+
function getKeys1(IStore _store, ResourceId sourceTableId) internal view returns (bytes32[] memory keys1) {
|
354
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
355
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
356
|
+
|
357
|
+
bytes memory _blob = _store.getDynamicField(_tableId, _keyTuple, 1);
|
358
|
+
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
359
|
+
}
|
360
|
+
|
361
|
+
/**
|
362
|
+
* @notice Set keys1.
|
363
|
+
*/
|
364
|
+
function setKeys1(ResourceId sourceTableId, bytes32[] memory keys1) internal {
|
365
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
366
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
367
|
+
|
368
|
+
StoreSwitch.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode((keys1)));
|
369
|
+
}
|
370
|
+
|
371
|
+
/**
|
372
|
+
* @notice Set keys1.
|
373
|
+
*/
|
374
|
+
function _setKeys1(ResourceId sourceTableId, bytes32[] memory keys1) internal {
|
375
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
376
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
377
|
+
|
378
|
+
StoreCore.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode((keys1)));
|
379
|
+
}
|
380
|
+
|
381
|
+
/**
|
382
|
+
* @notice Set keys1 (using the specified store).
|
383
|
+
*/
|
384
|
+
function setKeys1(IStore _store, ResourceId sourceTableId, bytes32[] memory keys1) internal {
|
385
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
386
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
387
|
+
|
388
|
+
_store.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode((keys1)));
|
389
|
+
}
|
390
|
+
|
391
|
+
/**
|
392
|
+
* @notice Get the length of keys1.
|
393
|
+
*/
|
394
|
+
function lengthKeys1(ResourceId sourceTableId) internal view returns (uint256) {
|
395
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
396
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
397
|
+
|
398
|
+
uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 1);
|
399
|
+
unchecked {
|
400
|
+
return _byteLength / 32;
|
401
|
+
}
|
402
|
+
}
|
403
|
+
|
404
|
+
/**
|
405
|
+
* @notice Get the length of keys1.
|
406
|
+
*/
|
407
|
+
function _lengthKeys1(ResourceId sourceTableId) internal view returns (uint256) {
|
408
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
409
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
410
|
+
|
411
|
+
uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 1);
|
412
|
+
unchecked {
|
413
|
+
return _byteLength / 32;
|
414
|
+
}
|
415
|
+
}
|
416
|
+
|
417
|
+
/**
|
418
|
+
* @notice Get the length of keys1 (using the specified store).
|
419
|
+
*/
|
420
|
+
function lengthKeys1(IStore _store, ResourceId sourceTableId) internal view returns (uint256) {
|
421
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
422
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
423
|
+
|
424
|
+
uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 1);
|
425
|
+
unchecked {
|
426
|
+
return _byteLength / 32;
|
427
|
+
}
|
428
|
+
}
|
429
|
+
|
430
|
+
/**
|
431
|
+
* @notice Get an item of keys1.
|
432
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
433
|
+
*/
|
434
|
+
function getItemKeys1(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
435
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
436
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
437
|
+
|
438
|
+
unchecked {
|
439
|
+
bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 32, (_index + 1) * 32);
|
440
|
+
return (bytes32(_blob));
|
441
|
+
}
|
442
|
+
}
|
443
|
+
|
444
|
+
/**
|
445
|
+
* @notice Get an item of keys1.
|
446
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
447
|
+
*/
|
448
|
+
function _getItemKeys1(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
449
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
450
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
451
|
+
|
452
|
+
unchecked {
|
453
|
+
bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 32, (_index + 1) * 32);
|
454
|
+
return (bytes32(_blob));
|
455
|
+
}
|
456
|
+
}
|
457
|
+
|
458
|
+
/**
|
459
|
+
* @notice Get an item of keys1 (using the specified store).
|
460
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
461
|
+
*/
|
462
|
+
function getItemKeys1(IStore _store, ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
463
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
464
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
465
|
+
|
466
|
+
unchecked {
|
467
|
+
bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 32, (_index + 1) * 32);
|
468
|
+
return (bytes32(_blob));
|
469
|
+
}
|
470
|
+
}
|
471
|
+
|
472
|
+
/**
|
473
|
+
* @notice Push an element to keys1.
|
474
|
+
*/
|
475
|
+
function pushKeys1(ResourceId sourceTableId, bytes32 _element) internal {
|
476
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
477
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
478
|
+
|
479
|
+
StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element)));
|
480
|
+
}
|
481
|
+
|
482
|
+
/**
|
483
|
+
* @notice Push an element to keys1.
|
484
|
+
*/
|
485
|
+
function _pushKeys1(ResourceId sourceTableId, bytes32 _element) internal {
|
486
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
487
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
488
|
+
|
489
|
+
StoreCore.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element)));
|
490
|
+
}
|
491
|
+
|
492
|
+
/**
|
493
|
+
* @notice Push an element to keys1 (using the specified store).
|
494
|
+
*/
|
495
|
+
function pushKeys1(IStore _store, ResourceId sourceTableId, bytes32 _element) internal {
|
496
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
497
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
498
|
+
|
499
|
+
_store.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element)));
|
500
|
+
}
|
501
|
+
|
502
|
+
/**
|
503
|
+
* @notice Pop an element from keys1.
|
504
|
+
*/
|
505
|
+
function popKeys1(ResourceId sourceTableId) internal {
|
506
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
507
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
508
|
+
|
509
|
+
StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 1, 32);
|
510
|
+
}
|
511
|
+
|
512
|
+
/**
|
513
|
+
* @notice Pop an element from keys1.
|
514
|
+
*/
|
515
|
+
function _popKeys1(ResourceId sourceTableId) internal {
|
516
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
517
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
518
|
+
|
519
|
+
StoreCore.popFromDynamicField(_tableId, _keyTuple, 1, 32);
|
520
|
+
}
|
521
|
+
|
522
|
+
/**
|
523
|
+
* @notice Pop an element from keys1 (using the specified store).
|
524
|
+
*/
|
525
|
+
function popKeys1(IStore _store, ResourceId sourceTableId) internal {
|
526
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
527
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
528
|
+
|
529
|
+
_store.popFromDynamicField(_tableId, _keyTuple, 1, 32);
|
530
|
+
}
|
531
|
+
|
532
|
+
/**
|
533
|
+
* @notice Update an element of keys1 at `_index`.
|
534
|
+
*/
|
535
|
+
function updateKeys1(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
536
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
537
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
538
|
+
|
539
|
+
unchecked {
|
540
|
+
bytes memory _encoded = abi.encodePacked((_element));
|
541
|
+
StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 32), uint40(_encoded.length), _encoded);
|
542
|
+
}
|
543
|
+
}
|
544
|
+
|
545
|
+
/**
|
546
|
+
* @notice Update an element of keys1 at `_index`.
|
547
|
+
*/
|
548
|
+
function _updateKeys1(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
549
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
550
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
551
|
+
|
552
|
+
unchecked {
|
553
|
+
bytes memory _encoded = abi.encodePacked((_element));
|
554
|
+
StoreCore.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 32), uint40(_encoded.length), _encoded);
|
555
|
+
}
|
556
|
+
}
|
557
|
+
|
558
|
+
/**
|
559
|
+
* @notice Update an element of keys1 (using the specified store) at `_index`.
|
560
|
+
*/
|
561
|
+
function updateKeys1(IStore _store, ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
562
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
563
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
564
|
+
|
565
|
+
unchecked {
|
566
|
+
bytes memory _encoded = abi.encodePacked((_element));
|
567
|
+
_store.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 32), uint40(_encoded.length), _encoded);
|
568
|
+
}
|
569
|
+
}
|
570
|
+
|
571
|
+
/**
|
572
|
+
* @notice Get keys2.
|
573
|
+
*/
|
574
|
+
function getKeys2(ResourceId sourceTableId) internal view returns (bytes32[] memory keys2) {
|
575
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
576
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
577
|
+
|
578
|
+
bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 2);
|
579
|
+
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
580
|
+
}
|
581
|
+
|
582
|
+
/**
|
583
|
+
* @notice Get keys2.
|
584
|
+
*/
|
585
|
+
function _getKeys2(ResourceId sourceTableId) internal view returns (bytes32[] memory keys2) {
|
586
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
587
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
588
|
+
|
589
|
+
bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 2);
|
590
|
+
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
591
|
+
}
|
592
|
+
|
593
|
+
/**
|
594
|
+
* @notice Get keys2 (using the specified store).
|
595
|
+
*/
|
596
|
+
function getKeys2(IStore _store, ResourceId sourceTableId) internal view returns (bytes32[] memory keys2) {
|
597
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
598
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
599
|
+
|
600
|
+
bytes memory _blob = _store.getDynamicField(_tableId, _keyTuple, 2);
|
601
|
+
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
602
|
+
}
|
603
|
+
|
604
|
+
/**
|
605
|
+
* @notice Set keys2.
|
606
|
+
*/
|
607
|
+
function setKeys2(ResourceId sourceTableId, bytes32[] memory keys2) internal {
|
608
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
609
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
610
|
+
|
611
|
+
StoreSwitch.setDynamicField(_tableId, _keyTuple, 2, EncodeArray.encode((keys2)));
|
612
|
+
}
|
613
|
+
|
614
|
+
/**
|
615
|
+
* @notice Set keys2.
|
616
|
+
*/
|
617
|
+
function _setKeys2(ResourceId sourceTableId, bytes32[] memory keys2) internal {
|
618
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
619
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
620
|
+
|
621
|
+
StoreCore.setDynamicField(_tableId, _keyTuple, 2, EncodeArray.encode((keys2)));
|
622
|
+
}
|
623
|
+
|
624
|
+
/**
|
625
|
+
* @notice Set keys2 (using the specified store).
|
626
|
+
*/
|
627
|
+
function setKeys2(IStore _store, ResourceId sourceTableId, bytes32[] memory keys2) internal {
|
628
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
629
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
630
|
+
|
631
|
+
_store.setDynamicField(_tableId, _keyTuple, 2, EncodeArray.encode((keys2)));
|
632
|
+
}
|
633
|
+
|
634
|
+
/**
|
635
|
+
* @notice Get the length of keys2.
|
636
|
+
*/
|
637
|
+
function lengthKeys2(ResourceId sourceTableId) internal view returns (uint256) {
|
638
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
639
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
640
|
+
|
641
|
+
uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 2);
|
642
|
+
unchecked {
|
643
|
+
return _byteLength / 32;
|
644
|
+
}
|
645
|
+
}
|
646
|
+
|
647
|
+
/**
|
648
|
+
* @notice Get the length of keys2.
|
649
|
+
*/
|
650
|
+
function _lengthKeys2(ResourceId sourceTableId) internal view returns (uint256) {
|
651
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
652
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
653
|
+
|
654
|
+
uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 2);
|
655
|
+
unchecked {
|
656
|
+
return _byteLength / 32;
|
657
|
+
}
|
658
|
+
}
|
659
|
+
|
660
|
+
/**
|
661
|
+
* @notice Get the length of keys2 (using the specified store).
|
662
|
+
*/
|
663
|
+
function lengthKeys2(IStore _store, ResourceId sourceTableId) internal view returns (uint256) {
|
664
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
665
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
666
|
+
|
667
|
+
uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 2);
|
668
|
+
unchecked {
|
669
|
+
return _byteLength / 32;
|
670
|
+
}
|
671
|
+
}
|
672
|
+
|
673
|
+
/**
|
674
|
+
* @notice Get an item of keys2.
|
675
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
676
|
+
*/
|
677
|
+
function getItemKeys2(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
678
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
679
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
680
|
+
|
681
|
+
unchecked {
|
682
|
+
bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 2, _index * 32, (_index + 1) * 32);
|
683
|
+
return (bytes32(_blob));
|
684
|
+
}
|
685
|
+
}
|
686
|
+
|
687
|
+
/**
|
688
|
+
* @notice Get an item of keys2.
|
689
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
690
|
+
*/
|
691
|
+
function _getItemKeys2(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
692
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
693
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
694
|
+
|
695
|
+
unchecked {
|
696
|
+
bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 2, _index * 32, (_index + 1) * 32);
|
697
|
+
return (bytes32(_blob));
|
698
|
+
}
|
699
|
+
}
|
700
|
+
|
701
|
+
/**
|
702
|
+
* @notice Get an item of keys2 (using the specified store).
|
703
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
704
|
+
*/
|
705
|
+
function getItemKeys2(IStore _store, ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
706
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
707
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
708
|
+
|
709
|
+
unchecked {
|
710
|
+
bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 2, _index * 32, (_index + 1) * 32);
|
711
|
+
return (bytes32(_blob));
|
712
|
+
}
|
713
|
+
}
|
714
|
+
|
715
|
+
/**
|
716
|
+
* @notice Push an element to keys2.
|
717
|
+
*/
|
718
|
+
function pushKeys2(ResourceId sourceTableId, bytes32 _element) internal {
|
719
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
720
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
721
|
+
|
722
|
+
StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 2, abi.encodePacked((_element)));
|
723
|
+
}
|
724
|
+
|
725
|
+
/**
|
726
|
+
* @notice Push an element to keys2.
|
727
|
+
*/
|
728
|
+
function _pushKeys2(ResourceId sourceTableId, bytes32 _element) internal {
|
729
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
730
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
731
|
+
|
732
|
+
StoreCore.pushToDynamicField(_tableId, _keyTuple, 2, abi.encodePacked((_element)));
|
733
|
+
}
|
734
|
+
|
735
|
+
/**
|
736
|
+
* @notice Push an element to keys2 (using the specified store).
|
737
|
+
*/
|
738
|
+
function pushKeys2(IStore _store, ResourceId sourceTableId, bytes32 _element) internal {
|
739
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
740
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
741
|
+
|
742
|
+
_store.pushToDynamicField(_tableId, _keyTuple, 2, abi.encodePacked((_element)));
|
743
|
+
}
|
744
|
+
|
745
|
+
/**
|
746
|
+
* @notice Pop an element from keys2.
|
747
|
+
*/
|
748
|
+
function popKeys2(ResourceId sourceTableId) internal {
|
749
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
750
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
751
|
+
|
752
|
+
StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 2, 32);
|
753
|
+
}
|
754
|
+
|
755
|
+
/**
|
756
|
+
* @notice Pop an element from keys2.
|
757
|
+
*/
|
758
|
+
function _popKeys2(ResourceId sourceTableId) internal {
|
759
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
760
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
761
|
+
|
762
|
+
StoreCore.popFromDynamicField(_tableId, _keyTuple, 2, 32);
|
763
|
+
}
|
764
|
+
|
765
|
+
/**
|
766
|
+
* @notice Pop an element from keys2 (using the specified store).
|
767
|
+
*/
|
768
|
+
function popKeys2(IStore _store, ResourceId sourceTableId) internal {
|
769
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
770
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
771
|
+
|
772
|
+
_store.popFromDynamicField(_tableId, _keyTuple, 2, 32);
|
773
|
+
}
|
774
|
+
|
775
|
+
/**
|
776
|
+
* @notice Update an element of keys2 at `_index`.
|
777
|
+
*/
|
778
|
+
function updateKeys2(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
779
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
780
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
781
|
+
|
782
|
+
unchecked {
|
783
|
+
bytes memory _encoded = abi.encodePacked((_element));
|
784
|
+
StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 2, uint40(_index * 32), uint40(_encoded.length), _encoded);
|
785
|
+
}
|
786
|
+
}
|
787
|
+
|
788
|
+
/**
|
789
|
+
* @notice Update an element of keys2 at `_index`.
|
790
|
+
*/
|
791
|
+
function _updateKeys2(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
792
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
793
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
794
|
+
|
795
|
+
unchecked {
|
796
|
+
bytes memory _encoded = abi.encodePacked((_element));
|
797
|
+
StoreCore.spliceDynamicData(_tableId, _keyTuple, 2, uint40(_index * 32), uint40(_encoded.length), _encoded);
|
798
|
+
}
|
799
|
+
}
|
800
|
+
|
801
|
+
/**
|
802
|
+
* @notice Update an element of keys2 (using the specified store) at `_index`.
|
803
|
+
*/
|
804
|
+
function updateKeys2(IStore _store, ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
805
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
806
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
807
|
+
|
808
|
+
unchecked {
|
809
|
+
bytes memory _encoded = abi.encodePacked((_element));
|
810
|
+
_store.spliceDynamicData(_tableId, _keyTuple, 2, uint40(_index * 32), uint40(_encoded.length), _encoded);
|
811
|
+
}
|
812
|
+
}
|
813
|
+
|
814
|
+
/**
|
815
|
+
* @notice Get keys3.
|
816
|
+
*/
|
817
|
+
function getKeys3(ResourceId sourceTableId) internal view returns (bytes32[] memory keys3) {
|
818
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
819
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
820
|
+
|
821
|
+
bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 3);
|
822
|
+
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
823
|
+
}
|
824
|
+
|
825
|
+
/**
|
826
|
+
* @notice Get keys3.
|
827
|
+
*/
|
828
|
+
function _getKeys3(ResourceId sourceTableId) internal view returns (bytes32[] memory keys3) {
|
829
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
830
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
831
|
+
|
832
|
+
bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 3);
|
833
|
+
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
834
|
+
}
|
835
|
+
|
836
|
+
/**
|
837
|
+
* @notice Get keys3 (using the specified store).
|
838
|
+
*/
|
839
|
+
function getKeys3(IStore _store, ResourceId sourceTableId) internal view returns (bytes32[] memory keys3) {
|
840
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
841
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
842
|
+
|
843
|
+
bytes memory _blob = _store.getDynamicField(_tableId, _keyTuple, 3);
|
844
|
+
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
845
|
+
}
|
846
|
+
|
847
|
+
/**
|
848
|
+
* @notice Set keys3.
|
849
|
+
*/
|
850
|
+
function setKeys3(ResourceId sourceTableId, bytes32[] memory keys3) internal {
|
851
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
852
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
853
|
+
|
854
|
+
StoreSwitch.setDynamicField(_tableId, _keyTuple, 3, EncodeArray.encode((keys3)));
|
855
|
+
}
|
856
|
+
|
857
|
+
/**
|
858
|
+
* @notice Set keys3.
|
859
|
+
*/
|
860
|
+
function _setKeys3(ResourceId sourceTableId, bytes32[] memory keys3) internal {
|
861
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
862
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
863
|
+
|
864
|
+
StoreCore.setDynamicField(_tableId, _keyTuple, 3, EncodeArray.encode((keys3)));
|
865
|
+
}
|
866
|
+
|
867
|
+
/**
|
868
|
+
* @notice Set keys3 (using the specified store).
|
869
|
+
*/
|
870
|
+
function setKeys3(IStore _store, ResourceId sourceTableId, bytes32[] memory keys3) internal {
|
871
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
872
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
873
|
+
|
874
|
+
_store.setDynamicField(_tableId, _keyTuple, 3, EncodeArray.encode((keys3)));
|
875
|
+
}
|
876
|
+
|
877
|
+
/**
|
878
|
+
* @notice Get the length of keys3.
|
879
|
+
*/
|
880
|
+
function lengthKeys3(ResourceId sourceTableId) internal view returns (uint256) {
|
881
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
882
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
883
|
+
|
884
|
+
uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 3);
|
885
|
+
unchecked {
|
886
|
+
return _byteLength / 32;
|
887
|
+
}
|
888
|
+
}
|
889
|
+
|
890
|
+
/**
|
891
|
+
* @notice Get the length of keys3.
|
892
|
+
*/
|
893
|
+
function _lengthKeys3(ResourceId sourceTableId) internal view returns (uint256) {
|
894
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
895
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
896
|
+
|
897
|
+
uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 3);
|
898
|
+
unchecked {
|
899
|
+
return _byteLength / 32;
|
900
|
+
}
|
901
|
+
}
|
902
|
+
|
903
|
+
/**
|
904
|
+
* @notice Get the length of keys3 (using the specified store).
|
905
|
+
*/
|
906
|
+
function lengthKeys3(IStore _store, ResourceId sourceTableId) internal view returns (uint256) {
|
907
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
908
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
909
|
+
|
910
|
+
uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 3);
|
911
|
+
unchecked {
|
912
|
+
return _byteLength / 32;
|
913
|
+
}
|
914
|
+
}
|
915
|
+
|
916
|
+
/**
|
917
|
+
* @notice Get an item of keys3.
|
918
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
919
|
+
*/
|
920
|
+
function getItemKeys3(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
921
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
922
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
923
|
+
|
924
|
+
unchecked {
|
925
|
+
bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 3, _index * 32, (_index + 1) * 32);
|
926
|
+
return (bytes32(_blob));
|
927
|
+
}
|
928
|
+
}
|
929
|
+
|
930
|
+
/**
|
931
|
+
* @notice Get an item of keys3.
|
932
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
933
|
+
*/
|
934
|
+
function _getItemKeys3(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
935
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
936
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
937
|
+
|
938
|
+
unchecked {
|
939
|
+
bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 3, _index * 32, (_index + 1) * 32);
|
940
|
+
return (bytes32(_blob));
|
941
|
+
}
|
942
|
+
}
|
943
|
+
|
944
|
+
/**
|
945
|
+
* @notice Get an item of keys3 (using the specified store).
|
946
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
947
|
+
*/
|
948
|
+
function getItemKeys3(IStore _store, ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
949
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
950
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
951
|
+
|
952
|
+
unchecked {
|
953
|
+
bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 3, _index * 32, (_index + 1) * 32);
|
954
|
+
return (bytes32(_blob));
|
955
|
+
}
|
956
|
+
}
|
957
|
+
|
958
|
+
/**
|
959
|
+
* @notice Push an element to keys3.
|
960
|
+
*/
|
961
|
+
function pushKeys3(ResourceId sourceTableId, bytes32 _element) internal {
|
962
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
963
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
964
|
+
|
965
|
+
StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 3, abi.encodePacked((_element)));
|
966
|
+
}
|
967
|
+
|
968
|
+
/**
|
969
|
+
* @notice Push an element to keys3.
|
970
|
+
*/
|
971
|
+
function _pushKeys3(ResourceId sourceTableId, bytes32 _element) internal {
|
972
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
973
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
974
|
+
|
975
|
+
StoreCore.pushToDynamicField(_tableId, _keyTuple, 3, abi.encodePacked((_element)));
|
976
|
+
}
|
977
|
+
|
978
|
+
/**
|
979
|
+
* @notice Push an element to keys3 (using the specified store).
|
980
|
+
*/
|
981
|
+
function pushKeys3(IStore _store, ResourceId sourceTableId, bytes32 _element) internal {
|
982
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
983
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
984
|
+
|
985
|
+
_store.pushToDynamicField(_tableId, _keyTuple, 3, abi.encodePacked((_element)));
|
986
|
+
}
|
987
|
+
|
988
|
+
/**
|
989
|
+
* @notice Pop an element from keys3.
|
990
|
+
*/
|
991
|
+
function popKeys3(ResourceId sourceTableId) internal {
|
992
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
993
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
994
|
+
|
995
|
+
StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 3, 32);
|
996
|
+
}
|
997
|
+
|
998
|
+
/**
|
999
|
+
* @notice Pop an element from keys3.
|
1000
|
+
*/
|
1001
|
+
function _popKeys3(ResourceId sourceTableId) internal {
|
1002
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1003
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1004
|
+
|
1005
|
+
StoreCore.popFromDynamicField(_tableId, _keyTuple, 3, 32);
|
1006
|
+
}
|
1007
|
+
|
1008
|
+
/**
|
1009
|
+
* @notice Pop an element from keys3 (using the specified store).
|
1010
|
+
*/
|
1011
|
+
function popKeys3(IStore _store, ResourceId sourceTableId) internal {
|
1012
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1013
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1014
|
+
|
1015
|
+
_store.popFromDynamicField(_tableId, _keyTuple, 3, 32);
|
1016
|
+
}
|
1017
|
+
|
1018
|
+
/**
|
1019
|
+
* @notice Update an element of keys3 at `_index`.
|
1020
|
+
*/
|
1021
|
+
function updateKeys3(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
1022
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1023
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1024
|
+
|
1025
|
+
unchecked {
|
1026
|
+
bytes memory _encoded = abi.encodePacked((_element));
|
1027
|
+
StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 3, uint40(_index * 32), uint40(_encoded.length), _encoded);
|
1028
|
+
}
|
1029
|
+
}
|
1030
|
+
|
1031
|
+
/**
|
1032
|
+
* @notice Update an element of keys3 at `_index`.
|
1033
|
+
*/
|
1034
|
+
function _updateKeys3(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
1035
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1036
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1037
|
+
|
1038
|
+
unchecked {
|
1039
|
+
bytes memory _encoded = abi.encodePacked((_element));
|
1040
|
+
StoreCore.spliceDynamicData(_tableId, _keyTuple, 3, uint40(_index * 32), uint40(_encoded.length), _encoded);
|
1041
|
+
}
|
1042
|
+
}
|
1043
|
+
|
1044
|
+
/**
|
1045
|
+
* @notice Update an element of keys3 (using the specified store) at `_index`.
|
1046
|
+
*/
|
1047
|
+
function updateKeys3(IStore _store, ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
1048
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1049
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1050
|
+
|
1051
|
+
unchecked {
|
1052
|
+
bytes memory _encoded = abi.encodePacked((_element));
|
1053
|
+
_store.spliceDynamicData(_tableId, _keyTuple, 3, uint40(_index * 32), uint40(_encoded.length), _encoded);
|
1054
|
+
}
|
1055
|
+
}
|
1056
|
+
|
1057
|
+
/**
|
1058
|
+
* @notice Get keys4.
|
1059
|
+
*/
|
1060
|
+
function getKeys4(ResourceId sourceTableId) internal view returns (bytes32[] memory keys4) {
|
1061
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1062
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1063
|
+
|
1064
|
+
bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 4);
|
1065
|
+
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
1066
|
+
}
|
1067
|
+
|
1068
|
+
/**
|
1069
|
+
* @notice Get keys4.
|
1070
|
+
*/
|
1071
|
+
function _getKeys4(ResourceId sourceTableId) internal view returns (bytes32[] memory keys4) {
|
1072
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1073
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1074
|
+
|
1075
|
+
bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 4);
|
1076
|
+
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
1077
|
+
}
|
1078
|
+
|
1079
|
+
/**
|
1080
|
+
* @notice Get keys4 (using the specified store).
|
1081
|
+
*/
|
1082
|
+
function getKeys4(IStore _store, ResourceId sourceTableId) internal view returns (bytes32[] memory keys4) {
|
1083
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1084
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1085
|
+
|
1086
|
+
bytes memory _blob = _store.getDynamicField(_tableId, _keyTuple, 4);
|
1087
|
+
return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_bytes32());
|
1088
|
+
}
|
1089
|
+
|
1090
|
+
/**
|
1091
|
+
* @notice Set keys4.
|
1092
|
+
*/
|
1093
|
+
function setKeys4(ResourceId sourceTableId, bytes32[] memory keys4) internal {
|
1094
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1095
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1096
|
+
|
1097
|
+
StoreSwitch.setDynamicField(_tableId, _keyTuple, 4, EncodeArray.encode((keys4)));
|
1098
|
+
}
|
1099
|
+
|
1100
|
+
/**
|
1101
|
+
* @notice Set keys4.
|
1102
|
+
*/
|
1103
|
+
function _setKeys4(ResourceId sourceTableId, bytes32[] memory keys4) internal {
|
1104
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1105
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1106
|
+
|
1107
|
+
StoreCore.setDynamicField(_tableId, _keyTuple, 4, EncodeArray.encode((keys4)));
|
1108
|
+
}
|
1109
|
+
|
1110
|
+
/**
|
1111
|
+
* @notice Set keys4 (using the specified store).
|
1112
|
+
*/
|
1113
|
+
function setKeys4(IStore _store, ResourceId sourceTableId, bytes32[] memory keys4) internal {
|
1114
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1115
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1116
|
+
|
1117
|
+
_store.setDynamicField(_tableId, _keyTuple, 4, EncodeArray.encode((keys4)));
|
1118
|
+
}
|
1119
|
+
|
1120
|
+
/**
|
1121
|
+
* @notice Get the length of keys4.
|
1122
|
+
*/
|
1123
|
+
function lengthKeys4(ResourceId sourceTableId) internal view returns (uint256) {
|
1124
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1125
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1126
|
+
|
1127
|
+
uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 4);
|
1128
|
+
unchecked {
|
1129
|
+
return _byteLength / 32;
|
1130
|
+
}
|
1131
|
+
}
|
1132
|
+
|
1133
|
+
/**
|
1134
|
+
* @notice Get the length of keys4.
|
1135
|
+
*/
|
1136
|
+
function _lengthKeys4(ResourceId sourceTableId) internal view returns (uint256) {
|
1137
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1138
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1139
|
+
|
1140
|
+
uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 4);
|
1141
|
+
unchecked {
|
1142
|
+
return _byteLength / 32;
|
1143
|
+
}
|
1144
|
+
}
|
1145
|
+
|
1146
|
+
/**
|
1147
|
+
* @notice Get the length of keys4 (using the specified store).
|
1148
|
+
*/
|
1149
|
+
function lengthKeys4(IStore _store, ResourceId sourceTableId) internal view returns (uint256) {
|
1150
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1151
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1152
|
+
|
1153
|
+
uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 4);
|
1154
|
+
unchecked {
|
1155
|
+
return _byteLength / 32;
|
1156
|
+
}
|
1157
|
+
}
|
1158
|
+
|
1159
|
+
/**
|
1160
|
+
* @notice Get an item of keys4.
|
1161
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
1162
|
+
*/
|
1163
|
+
function getItemKeys4(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
1164
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1165
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1166
|
+
|
1167
|
+
unchecked {
|
1168
|
+
bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 4, _index * 32, (_index + 1) * 32);
|
1169
|
+
return (bytes32(_blob));
|
1170
|
+
}
|
1171
|
+
}
|
1172
|
+
|
1173
|
+
/**
|
1174
|
+
* @notice Get an item of keys4.
|
1175
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
1176
|
+
*/
|
1177
|
+
function _getItemKeys4(ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
1178
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1179
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1180
|
+
|
1181
|
+
unchecked {
|
1182
|
+
bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 4, _index * 32, (_index + 1) * 32);
|
1183
|
+
return (bytes32(_blob));
|
1184
|
+
}
|
1185
|
+
}
|
1186
|
+
|
1187
|
+
/**
|
1188
|
+
* @notice Get an item of keys4 (using the specified store).
|
1189
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
1190
|
+
*/
|
1191
|
+
function getItemKeys4(IStore _store, ResourceId sourceTableId, uint256 _index) internal view returns (bytes32) {
|
1192
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1193
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1194
|
+
|
1195
|
+
unchecked {
|
1196
|
+
bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 4, _index * 32, (_index + 1) * 32);
|
1197
|
+
return (bytes32(_blob));
|
1198
|
+
}
|
1199
|
+
}
|
1200
|
+
|
1201
|
+
/**
|
1202
|
+
* @notice Push an element to keys4.
|
1203
|
+
*/
|
1204
|
+
function pushKeys4(ResourceId sourceTableId, bytes32 _element) internal {
|
1205
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1206
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1207
|
+
|
1208
|
+
StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 4, abi.encodePacked((_element)));
|
1209
|
+
}
|
1210
|
+
|
1211
|
+
/**
|
1212
|
+
* @notice Push an element to keys4.
|
1213
|
+
*/
|
1214
|
+
function _pushKeys4(ResourceId sourceTableId, bytes32 _element) internal {
|
1215
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1216
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1217
|
+
|
1218
|
+
StoreCore.pushToDynamicField(_tableId, _keyTuple, 4, abi.encodePacked((_element)));
|
1219
|
+
}
|
1220
|
+
|
1221
|
+
/**
|
1222
|
+
* @notice Push an element to keys4 (using the specified store).
|
1223
|
+
*/
|
1224
|
+
function pushKeys4(IStore _store, ResourceId sourceTableId, bytes32 _element) internal {
|
1225
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1226
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1227
|
+
|
1228
|
+
_store.pushToDynamicField(_tableId, _keyTuple, 4, abi.encodePacked((_element)));
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
/**
|
1232
|
+
* @notice Pop an element from keys4.
|
1233
|
+
*/
|
1234
|
+
function popKeys4(ResourceId sourceTableId) internal {
|
1235
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1236
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1237
|
+
|
1238
|
+
StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 4, 32);
|
1239
|
+
}
|
1240
|
+
|
1241
|
+
/**
|
1242
|
+
* @notice Pop an element from keys4.
|
1243
|
+
*/
|
1244
|
+
function _popKeys4(ResourceId sourceTableId) internal {
|
1245
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1246
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1247
|
+
|
1248
|
+
StoreCore.popFromDynamicField(_tableId, _keyTuple, 4, 32);
|
1249
|
+
}
|
1250
|
+
|
1251
|
+
/**
|
1252
|
+
* @notice Pop an element from keys4 (using the specified store).
|
1253
|
+
*/
|
1254
|
+
function popKeys4(IStore _store, ResourceId sourceTableId) internal {
|
1255
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1256
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1257
|
+
|
1258
|
+
_store.popFromDynamicField(_tableId, _keyTuple, 4, 32);
|
1259
|
+
}
|
1260
|
+
|
1261
|
+
/**
|
1262
|
+
* @notice Update an element of keys4 at `_index`.
|
1263
|
+
*/
|
1264
|
+
function updateKeys4(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
1265
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1266
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1267
|
+
|
1268
|
+
unchecked {
|
1269
|
+
bytes memory _encoded = abi.encodePacked((_element));
|
1270
|
+
StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 4, uint40(_index * 32), uint40(_encoded.length), _encoded);
|
1271
|
+
}
|
1272
|
+
}
|
1273
|
+
|
1274
|
+
/**
|
1275
|
+
* @notice Update an element of keys4 at `_index`.
|
1276
|
+
*/
|
1277
|
+
function _updateKeys4(ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
1278
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1279
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1280
|
+
|
1281
|
+
unchecked {
|
1282
|
+
bytes memory _encoded = abi.encodePacked((_element));
|
1283
|
+
StoreCore.spliceDynamicData(_tableId, _keyTuple, 4, uint40(_index * 32), uint40(_encoded.length), _encoded);
|
1284
|
+
}
|
1285
|
+
}
|
1286
|
+
|
1287
|
+
/**
|
1288
|
+
* @notice Update an element of keys4 (using the specified store) at `_index`.
|
1289
|
+
*/
|
1290
|
+
function updateKeys4(IStore _store, ResourceId sourceTableId, uint256 _index, bytes32 _element) internal {
|
1291
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1292
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1293
|
+
|
1294
|
+
unchecked {
|
1295
|
+
bytes memory _encoded = abi.encodePacked((_element));
|
1296
|
+
_store.spliceDynamicData(_tableId, _keyTuple, 4, uint40(_index * 32), uint40(_encoded.length), _encoded);
|
1297
|
+
}
|
1298
|
+
}
|
1299
|
+
|
1300
|
+
/**
|
1301
|
+
* @notice Get the full data.
|
1302
|
+
*/
|
1303
|
+
function get(ResourceId sourceTableId) internal view returns (KeysInTableData memory _table) {
|
1304
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1305
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1306
|
+
|
1307
|
+
(bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreSwitch.getRecord(
|
1308
|
+
_tableId,
|
1309
|
+
_keyTuple,
|
1310
|
+
_fieldLayout
|
1311
|
+
);
|
1312
|
+
return decode(_staticData, _encodedLengths, _dynamicData);
|
1313
|
+
}
|
1314
|
+
|
1315
|
+
/**
|
1316
|
+
* @notice Get the full data.
|
1317
|
+
*/
|
1318
|
+
function _get(ResourceId sourceTableId) internal view returns (KeysInTableData memory _table) {
|
1319
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1320
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1321
|
+
|
1322
|
+
(bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreCore.getRecord(
|
1323
|
+
_tableId,
|
1324
|
+
_keyTuple,
|
1325
|
+
_fieldLayout
|
1326
|
+
);
|
1327
|
+
return decode(_staticData, _encodedLengths, _dynamicData);
|
1328
|
+
}
|
1329
|
+
|
1330
|
+
/**
|
1331
|
+
* @notice Get the full data (using the specified store).
|
1332
|
+
*/
|
1333
|
+
function get(IStore _store, ResourceId sourceTableId) internal view returns (KeysInTableData memory _table) {
|
1334
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1335
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1336
|
+
|
1337
|
+
(bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = _store.getRecord(
|
1338
|
+
_tableId,
|
1339
|
+
_keyTuple,
|
1340
|
+
_fieldLayout
|
1341
|
+
);
|
1342
|
+
return decode(_staticData, _encodedLengths, _dynamicData);
|
1343
|
+
}
|
1344
|
+
|
1345
|
+
/**
|
1346
|
+
* @notice Set the full data using individual values.
|
1347
|
+
*/
|
1348
|
+
function set(
|
1349
|
+
ResourceId sourceTableId,
|
1350
|
+
bytes32[] memory keys0,
|
1351
|
+
bytes32[] memory keys1,
|
1352
|
+
bytes32[] memory keys2,
|
1353
|
+
bytes32[] memory keys3,
|
1354
|
+
bytes32[] memory keys4
|
1355
|
+
) internal {
|
1356
|
+
bytes memory _staticData;
|
1357
|
+
EncodedLengths _encodedLengths = encodeLengths(keys0, keys1, keys2, keys3, keys4);
|
1358
|
+
bytes memory _dynamicData = encodeDynamic(keys0, keys1, keys2, keys3, keys4);
|
1359
|
+
|
1360
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1361
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1362
|
+
|
1363
|
+
StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData);
|
1364
|
+
}
|
1365
|
+
|
1366
|
+
/**
|
1367
|
+
* @notice Set the full data using individual values.
|
1368
|
+
*/
|
1369
|
+
function _set(
|
1370
|
+
ResourceId sourceTableId,
|
1371
|
+
bytes32[] memory keys0,
|
1372
|
+
bytes32[] memory keys1,
|
1373
|
+
bytes32[] memory keys2,
|
1374
|
+
bytes32[] memory keys3,
|
1375
|
+
bytes32[] memory keys4
|
1376
|
+
) internal {
|
1377
|
+
bytes memory _staticData;
|
1378
|
+
EncodedLengths _encodedLengths = encodeLengths(keys0, keys1, keys2, keys3, keys4);
|
1379
|
+
bytes memory _dynamicData = encodeDynamic(keys0, keys1, keys2, keys3, keys4);
|
1380
|
+
|
1381
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1382
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1383
|
+
|
1384
|
+
StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout);
|
1385
|
+
}
|
1386
|
+
|
1387
|
+
/**
|
1388
|
+
* @notice Set the full data using individual values (using the specified store).
|
1389
|
+
*/
|
1390
|
+
function set(
|
1391
|
+
IStore _store,
|
1392
|
+
ResourceId sourceTableId,
|
1393
|
+
bytes32[] memory keys0,
|
1394
|
+
bytes32[] memory keys1,
|
1395
|
+
bytes32[] memory keys2,
|
1396
|
+
bytes32[] memory keys3,
|
1397
|
+
bytes32[] memory keys4
|
1398
|
+
) internal {
|
1399
|
+
bytes memory _staticData;
|
1400
|
+
EncodedLengths _encodedLengths = encodeLengths(keys0, keys1, keys2, keys3, keys4);
|
1401
|
+
bytes memory _dynamicData = encodeDynamic(keys0, keys1, keys2, keys3, keys4);
|
1402
|
+
|
1403
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1404
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1405
|
+
|
1406
|
+
_store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData);
|
1407
|
+
}
|
1408
|
+
|
1409
|
+
/**
|
1410
|
+
* @notice Set the full data using the data struct.
|
1411
|
+
*/
|
1412
|
+
function set(ResourceId sourceTableId, KeysInTableData memory _table) internal {
|
1413
|
+
bytes memory _staticData;
|
1414
|
+
EncodedLengths _encodedLengths = encodeLengths(
|
1415
|
+
_table.keys0,
|
1416
|
+
_table.keys1,
|
1417
|
+
_table.keys2,
|
1418
|
+
_table.keys3,
|
1419
|
+
_table.keys4
|
1420
|
+
);
|
1421
|
+
bytes memory _dynamicData = encodeDynamic(_table.keys0, _table.keys1, _table.keys2, _table.keys3, _table.keys4);
|
1422
|
+
|
1423
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1424
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1425
|
+
|
1426
|
+
StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData);
|
1427
|
+
}
|
1428
|
+
|
1429
|
+
/**
|
1430
|
+
* @notice Set the full data using the data struct.
|
1431
|
+
*/
|
1432
|
+
function _set(ResourceId sourceTableId, KeysInTableData memory _table) internal {
|
1433
|
+
bytes memory _staticData;
|
1434
|
+
EncodedLengths _encodedLengths = encodeLengths(
|
1435
|
+
_table.keys0,
|
1436
|
+
_table.keys1,
|
1437
|
+
_table.keys2,
|
1438
|
+
_table.keys3,
|
1439
|
+
_table.keys4
|
1440
|
+
);
|
1441
|
+
bytes memory _dynamicData = encodeDynamic(_table.keys0, _table.keys1, _table.keys2, _table.keys3, _table.keys4);
|
1442
|
+
|
1443
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1444
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1445
|
+
|
1446
|
+
StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout);
|
1447
|
+
}
|
1448
|
+
|
1449
|
+
/**
|
1450
|
+
* @notice Set the full data using the data struct (using the specified store).
|
1451
|
+
*/
|
1452
|
+
function set(IStore _store, ResourceId sourceTableId, KeysInTableData memory _table) internal {
|
1453
|
+
bytes memory _staticData;
|
1454
|
+
EncodedLengths _encodedLengths = encodeLengths(
|
1455
|
+
_table.keys0,
|
1456
|
+
_table.keys1,
|
1457
|
+
_table.keys2,
|
1458
|
+
_table.keys3,
|
1459
|
+
_table.keys4
|
1460
|
+
);
|
1461
|
+
bytes memory _dynamicData = encodeDynamic(_table.keys0, _table.keys1, _table.keys2, _table.keys3, _table.keys4);
|
1462
|
+
|
1463
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1464
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1465
|
+
|
1466
|
+
_store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData);
|
1467
|
+
}
|
1468
|
+
|
1469
|
+
/**
|
1470
|
+
* @notice Decode the tightly packed blob of dynamic data using the encoded lengths.
|
1471
|
+
*/
|
1472
|
+
function decodeDynamic(
|
1473
|
+
EncodedLengths _encodedLengths,
|
1474
|
+
bytes memory _blob
|
1475
|
+
)
|
1476
|
+
internal
|
1477
|
+
pure
|
1478
|
+
returns (
|
1479
|
+
bytes32[] memory keys0,
|
1480
|
+
bytes32[] memory keys1,
|
1481
|
+
bytes32[] memory keys2,
|
1482
|
+
bytes32[] memory keys3,
|
1483
|
+
bytes32[] memory keys4
|
1484
|
+
)
|
1485
|
+
{
|
1486
|
+
uint256 _start;
|
1487
|
+
uint256 _end;
|
1488
|
+
unchecked {
|
1489
|
+
_end = _encodedLengths.atIndex(0);
|
1490
|
+
}
|
1491
|
+
keys0 = (SliceLib.getSubslice(_blob, _start, _end).decodeArray_bytes32());
|
1492
|
+
|
1493
|
+
_start = _end;
|
1494
|
+
unchecked {
|
1495
|
+
_end += _encodedLengths.atIndex(1);
|
1496
|
+
}
|
1497
|
+
keys1 = (SliceLib.getSubslice(_blob, _start, _end).decodeArray_bytes32());
|
1498
|
+
|
1499
|
+
_start = _end;
|
1500
|
+
unchecked {
|
1501
|
+
_end += _encodedLengths.atIndex(2);
|
1502
|
+
}
|
1503
|
+
keys2 = (SliceLib.getSubslice(_blob, _start, _end).decodeArray_bytes32());
|
1504
|
+
|
1505
|
+
_start = _end;
|
1506
|
+
unchecked {
|
1507
|
+
_end += _encodedLengths.atIndex(3);
|
1508
|
+
}
|
1509
|
+
keys3 = (SliceLib.getSubslice(_blob, _start, _end).decodeArray_bytes32());
|
1510
|
+
|
1511
|
+
_start = _end;
|
1512
|
+
unchecked {
|
1513
|
+
_end += _encodedLengths.atIndex(4);
|
1514
|
+
}
|
1515
|
+
keys4 = (SliceLib.getSubslice(_blob, _start, _end).decodeArray_bytes32());
|
1516
|
+
}
|
1517
|
+
|
1518
|
+
/**
|
1519
|
+
* @notice Decode the tightly packed blobs using this table's field layout.
|
1520
|
+
*
|
1521
|
+
* @param _encodedLengths Encoded lengths of dynamic fields.
|
1522
|
+
* @param _dynamicData Tightly packed dynamic fields.
|
1523
|
+
*/
|
1524
|
+
function decode(
|
1525
|
+
bytes memory,
|
1526
|
+
EncodedLengths _encodedLengths,
|
1527
|
+
bytes memory _dynamicData
|
1528
|
+
) internal pure returns (KeysInTableData memory _table) {
|
1529
|
+
(_table.keys0, _table.keys1, _table.keys2, _table.keys3, _table.keys4) = decodeDynamic(
|
1530
|
+
_encodedLengths,
|
1531
|
+
_dynamicData
|
1532
|
+
);
|
1533
|
+
}
|
1534
|
+
|
1535
|
+
/**
|
1536
|
+
* @notice Delete all data for given keys.
|
1537
|
+
*/
|
1538
|
+
function deleteRecord(ResourceId sourceTableId) internal {
|
1539
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1540
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1541
|
+
|
1542
|
+
StoreSwitch.deleteRecord(_tableId, _keyTuple);
|
1543
|
+
}
|
1544
|
+
|
1545
|
+
/**
|
1546
|
+
* @notice Delete all data for given keys.
|
1547
|
+
*/
|
1548
|
+
function _deleteRecord(ResourceId sourceTableId) internal {
|
1549
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1550
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1551
|
+
|
1552
|
+
StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout);
|
1553
|
+
}
|
1554
|
+
|
1555
|
+
/**
|
1556
|
+
* @notice Delete all data for given keys (using the specified store).
|
1557
|
+
*/
|
1558
|
+
function deleteRecord(IStore _store, ResourceId sourceTableId) internal {
|
1559
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1560
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1561
|
+
|
1562
|
+
_store.deleteRecord(_tableId, _keyTuple);
|
1563
|
+
}
|
1564
|
+
|
1565
|
+
/**
|
1566
|
+
* @notice Tightly pack dynamic data lengths using this table's schema.
|
1567
|
+
* @return _encodedLengths The lengths of the dynamic fields (packed into a single bytes32 value).
|
1568
|
+
*/
|
1569
|
+
function encodeLengths(
|
1570
|
+
bytes32[] memory keys0,
|
1571
|
+
bytes32[] memory keys1,
|
1572
|
+
bytes32[] memory keys2,
|
1573
|
+
bytes32[] memory keys3,
|
1574
|
+
bytes32[] memory keys4
|
1575
|
+
) internal pure returns (EncodedLengths _encodedLengths) {
|
1576
|
+
// Lengths are effectively checked during copy by 2**40 bytes exceeding gas limits
|
1577
|
+
unchecked {
|
1578
|
+
_encodedLengths = EncodedLengthsLib.pack(
|
1579
|
+
keys0.length * 32,
|
1580
|
+
keys1.length * 32,
|
1581
|
+
keys2.length * 32,
|
1582
|
+
keys3.length * 32,
|
1583
|
+
keys4.length * 32
|
1584
|
+
);
|
1585
|
+
}
|
1586
|
+
}
|
1587
|
+
|
1588
|
+
/**
|
1589
|
+
* @notice Tightly pack dynamic (variable length) data using this table's schema.
|
1590
|
+
* @return The dynamic data, encoded into a sequence of bytes.
|
1591
|
+
*/
|
1592
|
+
function encodeDynamic(
|
1593
|
+
bytes32[] memory keys0,
|
1594
|
+
bytes32[] memory keys1,
|
1595
|
+
bytes32[] memory keys2,
|
1596
|
+
bytes32[] memory keys3,
|
1597
|
+
bytes32[] memory keys4
|
1598
|
+
) internal pure returns (bytes memory) {
|
1599
|
+
return
|
1600
|
+
abi.encodePacked(
|
1601
|
+
EncodeArray.encode((keys0)),
|
1602
|
+
EncodeArray.encode((keys1)),
|
1603
|
+
EncodeArray.encode((keys2)),
|
1604
|
+
EncodeArray.encode((keys3)),
|
1605
|
+
EncodeArray.encode((keys4))
|
1606
|
+
);
|
1607
|
+
}
|
1608
|
+
|
1609
|
+
/**
|
1610
|
+
* @notice Encode all of a record's fields.
|
1611
|
+
* @return The static (fixed length) data, encoded into a sequence of bytes.
|
1612
|
+
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
1613
|
+
* @return The dynamic (variable length) data, encoded into a sequence of bytes.
|
1614
|
+
*/
|
1615
|
+
function encode(
|
1616
|
+
bytes32[] memory keys0,
|
1617
|
+
bytes32[] memory keys1,
|
1618
|
+
bytes32[] memory keys2,
|
1619
|
+
bytes32[] memory keys3,
|
1620
|
+
bytes32[] memory keys4
|
1621
|
+
) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
|
1622
|
+
bytes memory _staticData;
|
1623
|
+
EncodedLengths _encodedLengths = encodeLengths(keys0, keys1, keys2, keys3, keys4);
|
1624
|
+
bytes memory _dynamicData = encodeDynamic(keys0, keys1, keys2, keys3, keys4);
|
1625
|
+
|
1626
|
+
return (_staticData, _encodedLengths, _dynamicData);
|
1627
|
+
}
|
1628
|
+
|
1629
|
+
/**
|
1630
|
+
* @notice Encode keys as a bytes32 array using this table's field layout.
|
1631
|
+
*/
|
1632
|
+
function encodeKeyTuple(ResourceId sourceTableId) internal pure returns (bytes32[] memory) {
|
1633
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
1634
|
+
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1635
|
+
|
1636
|
+
return _keyTuple;
|
1637
|
+
}
|
1638
|
+
}
|