@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
@@ -25,19 +25,28 @@ FieldLayout constant _fieldLayout = FieldLayout.wrap(
|
|
25
25
|
);
|
26
26
|
|
27
27
|
library UniqueEntity {
|
28
|
-
/**
|
28
|
+
/**
|
29
|
+
* @notice Get the table values' field layout.
|
30
|
+
* @return _fieldLayout The field layout for the table.
|
31
|
+
*/
|
29
32
|
function getFieldLayout() internal pure returns (FieldLayout) {
|
30
33
|
return _fieldLayout;
|
31
34
|
}
|
32
35
|
|
33
|
-
/**
|
36
|
+
/**
|
37
|
+
* @notice Get the table's key schema.
|
38
|
+
* @return _keySchema The key schema for the table.
|
39
|
+
*/
|
34
40
|
function getKeySchema() internal pure returns (Schema) {
|
35
41
|
SchemaType[] memory _keySchema = new SchemaType[](0);
|
36
42
|
|
37
43
|
return SchemaLib.encode(_keySchema);
|
38
44
|
}
|
39
45
|
|
40
|
-
/**
|
46
|
+
/**
|
47
|
+
* @notice Get the table's value schema.
|
48
|
+
* @return _valueSchema The value schema for the table.
|
49
|
+
*/
|
41
50
|
function getValueSchema() internal pure returns (Schema) {
|
42
51
|
SchemaType[] memory _valueSchema = new SchemaType[](1);
|
43
52
|
_valueSchema[0] = SchemaType.UINT256;
|
@@ -45,33 +54,47 @@ library UniqueEntity {
|
|
45
54
|
return SchemaLib.encode(_valueSchema);
|
46
55
|
}
|
47
56
|
|
48
|
-
/**
|
57
|
+
/**
|
58
|
+
* @notice Get the table's key field names.
|
59
|
+
* @return keyNames An array of strings with the names of key fields.
|
60
|
+
*/
|
49
61
|
function getKeyNames() internal pure returns (string[] memory keyNames) {
|
50
62
|
keyNames = new string[](0);
|
51
63
|
}
|
52
64
|
|
53
|
-
/**
|
65
|
+
/**
|
66
|
+
* @notice Get the table's value field names.
|
67
|
+
* @return fieldNames An array of strings with the names of value fields.
|
68
|
+
*/
|
54
69
|
function getFieldNames() internal pure returns (string[] memory fieldNames) {
|
55
70
|
fieldNames = new string[](1);
|
56
71
|
fieldNames[0] = "value";
|
57
72
|
}
|
58
73
|
|
59
|
-
/**
|
74
|
+
/**
|
75
|
+
* @notice Register the table with its config.
|
76
|
+
*/
|
60
77
|
function register(ResourceId _tableId) internal {
|
61
78
|
StoreSwitch.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
|
62
79
|
}
|
63
80
|
|
64
|
-
/**
|
81
|
+
/**
|
82
|
+
* @notice Register the table with its config.
|
83
|
+
*/
|
65
84
|
function _register(ResourceId _tableId) internal {
|
66
85
|
StoreCore.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
|
67
86
|
}
|
68
87
|
|
69
|
-
/**
|
88
|
+
/**
|
89
|
+
* @notice Register the table with its config (using the specified store).
|
90
|
+
*/
|
70
91
|
function register(IStore _store, ResourceId _tableId) internal {
|
71
92
|
_store.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
|
72
93
|
}
|
73
94
|
|
74
|
-
/**
|
95
|
+
/**
|
96
|
+
* @notice Get value.
|
97
|
+
*/
|
75
98
|
function getValue(ResourceId _tableId) internal view returns (uint256 value) {
|
76
99
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
77
100
|
|
@@ -79,7 +102,9 @@ library UniqueEntity {
|
|
79
102
|
return (uint256(bytes32(_blob)));
|
80
103
|
}
|
81
104
|
|
82
|
-
/**
|
105
|
+
/**
|
106
|
+
* @notice Get value.
|
107
|
+
*/
|
83
108
|
function _getValue(ResourceId _tableId) internal view returns (uint256 value) {
|
84
109
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
85
110
|
|
@@ -87,7 +112,9 @@ library UniqueEntity {
|
|
87
112
|
return (uint256(bytes32(_blob)));
|
88
113
|
}
|
89
114
|
|
90
|
-
/**
|
115
|
+
/**
|
116
|
+
* @notice Get value (using the specified store).
|
117
|
+
*/
|
91
118
|
function getValue(IStore _store, ResourceId _tableId) internal view returns (uint256 value) {
|
92
119
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
93
120
|
|
@@ -95,7 +122,9 @@ library UniqueEntity {
|
|
95
122
|
return (uint256(bytes32(_blob)));
|
96
123
|
}
|
97
124
|
|
98
|
-
/**
|
125
|
+
/**
|
126
|
+
* @notice Get value.
|
127
|
+
*/
|
99
128
|
function get(ResourceId _tableId) internal view returns (uint256 value) {
|
100
129
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
101
130
|
|
@@ -103,7 +132,9 @@ library UniqueEntity {
|
|
103
132
|
return (uint256(bytes32(_blob)));
|
104
133
|
}
|
105
134
|
|
106
|
-
/**
|
135
|
+
/**
|
136
|
+
* @notice Get value.
|
137
|
+
*/
|
107
138
|
function _get(ResourceId _tableId) internal view returns (uint256 value) {
|
108
139
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
109
140
|
|
@@ -111,7 +142,9 @@ library UniqueEntity {
|
|
111
142
|
return (uint256(bytes32(_blob)));
|
112
143
|
}
|
113
144
|
|
114
|
-
/**
|
145
|
+
/**
|
146
|
+
* @notice Get value (using the specified store).
|
147
|
+
*/
|
115
148
|
function get(IStore _store, ResourceId _tableId) internal view returns (uint256 value) {
|
116
149
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
117
150
|
|
@@ -119,75 +152,101 @@ library UniqueEntity {
|
|
119
152
|
return (uint256(bytes32(_blob)));
|
120
153
|
}
|
121
154
|
|
122
|
-
/**
|
155
|
+
/**
|
156
|
+
* @notice Set value.
|
157
|
+
*/
|
123
158
|
function setValue(ResourceId _tableId, uint256 value) internal {
|
124
159
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
125
160
|
|
126
161
|
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
|
127
162
|
}
|
128
163
|
|
129
|
-
/**
|
164
|
+
/**
|
165
|
+
* @notice Set value.
|
166
|
+
*/
|
130
167
|
function _setValue(ResourceId _tableId, uint256 value) internal {
|
131
168
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
132
169
|
|
133
170
|
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
|
134
171
|
}
|
135
172
|
|
136
|
-
/**
|
173
|
+
/**
|
174
|
+
* @notice Set value (using the specified store).
|
175
|
+
*/
|
137
176
|
function setValue(IStore _store, ResourceId _tableId, uint256 value) internal {
|
138
177
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
139
178
|
|
140
179
|
_store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
|
141
180
|
}
|
142
181
|
|
143
|
-
/**
|
182
|
+
/**
|
183
|
+
* @notice Set value.
|
184
|
+
*/
|
144
185
|
function set(ResourceId _tableId, uint256 value) internal {
|
145
186
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
146
187
|
|
147
188
|
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
|
148
189
|
}
|
149
190
|
|
150
|
-
/**
|
191
|
+
/**
|
192
|
+
* @notice Set value.
|
193
|
+
*/
|
151
194
|
function _set(ResourceId _tableId, uint256 value) internal {
|
152
195
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
153
196
|
|
154
197
|
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
|
155
198
|
}
|
156
199
|
|
157
|
-
/**
|
200
|
+
/**
|
201
|
+
* @notice Set value (using the specified store).
|
202
|
+
*/
|
158
203
|
function set(IStore _store, ResourceId _tableId, uint256 value) internal {
|
159
204
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
160
205
|
|
161
206
|
_store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
|
162
207
|
}
|
163
208
|
|
164
|
-
/**
|
209
|
+
/**
|
210
|
+
* @notice Delete all data for given keys.
|
211
|
+
*/
|
165
212
|
function deleteRecord(ResourceId _tableId) internal {
|
166
213
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
167
214
|
|
168
215
|
StoreSwitch.deleteRecord(_tableId, _keyTuple);
|
169
216
|
}
|
170
217
|
|
171
|
-
/**
|
218
|
+
/**
|
219
|
+
* @notice Delete all data for given keys.
|
220
|
+
*/
|
172
221
|
function _deleteRecord(ResourceId _tableId) internal {
|
173
222
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
174
223
|
|
175
224
|
StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout);
|
176
225
|
}
|
177
226
|
|
178
|
-
/**
|
227
|
+
/**
|
228
|
+
* @notice Delete all data for given keys (using the specified store).
|
229
|
+
*/
|
179
230
|
function deleteRecord(IStore _store, ResourceId _tableId) internal {
|
180
231
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
181
232
|
|
182
233
|
_store.deleteRecord(_tableId, _keyTuple);
|
183
234
|
}
|
184
235
|
|
185
|
-
/**
|
236
|
+
/**
|
237
|
+
* @notice Tightly pack static (fixed length) data using this table's schema.
|
238
|
+
* @return The static data, encoded into a sequence of bytes.
|
239
|
+
*/
|
186
240
|
function encodeStatic(uint256 value) internal pure returns (bytes memory) {
|
187
241
|
return abi.encodePacked(value);
|
188
242
|
}
|
189
243
|
|
190
|
-
/**
|
244
|
+
/**
|
245
|
+
* @notice Encode all of a record's fields.
|
246
|
+
* @return The static (fixed length) data, encoded into a sequence of bytes.
|
247
|
+
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
248
|
+
* @return The dyanmic (variable length) data, encoded into a sequence of bytes.
|
249
|
+
*/
|
191
250
|
function encode(uint256 value) internal pure returns (bytes memory, PackedCounter, bytes memory) {
|
192
251
|
bytes memory _staticData = encodeStatic(value);
|
193
252
|
|
@@ -197,7 +256,9 @@ library UniqueEntity {
|
|
197
256
|
return (_staticData, _encodedLengths, _dynamicData);
|
198
257
|
}
|
199
258
|
|
200
|
-
/**
|
259
|
+
/**
|
260
|
+
* @notice Encode keys as a bytes32 array using this table's field layout.
|
261
|
+
*/
|
201
262
|
function encodeKeyTuple() internal pure returns (bytes32[] memory) {
|
202
263
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
203
264
|
|