@latticexyz/world-modules 2.0.0-main-c714e5d1 → 2.0.0-main-94d7f1ee
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/AccessControl.sol/AccessControl.abi.json +1 -0
- package/out/AccessControl.sol/AccessControl.json +1651 -0
- package/out/ArrayLib.sol/ArrayLib.json +477 -477
- package/out/Balances.sol/Balances.abi.json +1 -0
- package/out/Balances.sol/Balances.json +13002 -0
- package/out/CallboundDelegationControl.sol/CallboundDelegationControl.json +350 -350
- package/out/CallboundDelegations.sol/CallboundDelegations.json +4497 -4497
- package/out/DelegationControl.sol/DelegationControl.json +135 -135
- package/out/FunctionSelectors.sol/FunctionSelectors.abi.json +1 -0
- package/out/FunctionSelectors.sol/FunctionSelectors.json +17874 -0
- package/out/Hooks.sol/Hooks.json +45 -45
- package/out/IAccessManagementSystem.sol/IAccessManagementSystem.json +14 -14
- package/out/IBalanceTransferSystem.sol/IBalanceTransferSystem.json +15 -15
- package/out/IBaseWorld.sol/IBaseWorld.json +81 -81
- package/out/IBatchCallSystem.sol/IBatchCallSystem.json +15 -15
- package/out/IDelegationControl.sol/IDelegationControl.json +7 -7
- package/out/ISystemHook.sol/ISystemHook.json +12 -12
- package/out/IUniqueEntitySystem.sol/IUniqueEntitySystem.json +25 -25
- package/out/IWorldErrors.sol/IWorldErrors.json +19 -19
- package/out/IWorldKernel.sol/IWorldCall.json +10 -10
- package/out/IWorldKernel.sol/IWorldKernel.json +10 -10
- package/out/IWorldKernel.sol/IWorldModuleInstallation.json +10 -10
- package/out/IWorldRegistrationSystem.sol/IWorldRegistrationSystem.json +39 -39
- package/out/KeysInTable.sol/KeysInTable.json +18190 -18190
- package/out/KeysInTableHook.sol/KeysInTableHook.json +1407 -1407
- package/out/KeysInTableModule.sol/KeysInTableModule.json +838 -838
- package/out/KeysWithValue.sol/KeysWithValue.json +6631 -6631
- package/out/KeysWithValueHook.sol/KeysWithValueHook.json +1557 -1557
- package/out/KeysWithValueModule.sol/KeysWithValueModule.json +650 -650
- package/out/Module.sol/Module.json +119 -119
- package/out/NamespaceOwner.sol/NamespaceOwner.abi.json +1 -0
- package/out/NamespaceOwner.sol/NamespaceOwner.json +13016 -0
- package/out/ResourceAccess.sol/ResourceAccess.abi.json +1 -0
- package/out/ResourceAccess.sol/ResourceAccess.json +17296 -0
- package/out/ResourceIds.sol/ResourceIds.json +45 -45
- package/out/Schema.sol/SchemaInstance.json +30 -30
- package/out/Schema.sol/SchemaLib.json +30 -30
- package/out/SchemaType.sol/SchemaType.json +729 -729
- package/out/StandardDelegationsModule.sol/StandardDelegationsModule.json +448 -448
- package/out/StoreHook.sol/StoreHook.json +639 -639
- package/out/StoreHooks.sol/StoreHooks.json +45 -45
- package/out/System.sol/System.json +32 -32
- package/out/SystemHooks.sol/SystemHooks.abi.json +1 -0
- package/out/SystemHooks.sol/SystemHooks.json +32460 -0
- package/out/SystemSwitch.sol/SystemSwitch.abi.json +1 -0
- package/out/SystemSwitch.sol/SystemSwitch.json +2879 -0
- package/out/Systems.sol/Systems.abi.json +1 -0
- package/out/Systems.sol/Systems.json +18508 -0
- package/out/Tables.sol/Tables.json +73 -73
- package/out/TimeboundDelegationControl.sol/TimeboundDelegationControl.json +183 -183
- package/out/TimeboundDelegations.sol/TimeboundDelegations.json +3474 -3474
- package/out/UniqueEntity.sol/UniqueEntity.json +2345 -2345
- package/out/UniqueEntityModule.sol/UniqueEntityModule.json +482 -482
- package/out/UniqueEntitySystem.sol/UniqueEntitySystem.json +128 -128
- package/out/UsedKeysIndex.sol/UsedKeysIndex.json +4590 -4590
- package/out/WorldContext.sol/WorldContextConsumer.json +14 -14
- package/out/WorldContext.sol/WorldContextConsumerLib.json +14 -14
- package/out/WorldContext.sol/WorldContextProviderLib.json +14 -14
- package/out/WorldResourceId.sol/WorldResourceIdInstance.json +103 -103
- package/out/WorldResourceId.sol/WorldResourceIdLib.json +103 -103
- package/out/constants.sol/constants.json +194 -194
- package/out/getKeysInTable.sol/getKeysInTable.json +918 -918
- package/out/getKeysWithValue.sol/getKeysWithValue.json +431 -431
- package/out/getTargetTableId.sol/getTargetTableId.json +272 -272
- package/out/getUniqueEntity.sol/getUniqueEntity.json +389 -240
- package/out/hasKey.sol/hasKey.json +215 -215
- package/out/index.sol/index.json +73 -73
- package/out/interfaces/IBaseWorld.sol/IBaseWorld.json +171 -171
- package/out/query.sol/query.json +1892 -1892
- package/out/revertWithBytes.sol/revertWithBytes.json +52 -52
- package/out/src/Bytes.sol/Bytes.json +3766 -3766
- package/out/src/FieldLayout.sol/FieldLayoutInstance.json +1204 -1204
- package/out/src/FieldLayout.sol/FieldLayoutLib.json +1204 -1204
- package/out/src/Hook.sol/HookInstance.abi.json +1 -0
- package/out/src/Hook.sol/HookInstance.json +2823 -0
- package/out/src/Hook.sol/HookLib.abi.json +1 -0
- package/out/src/Hook.sol/HookLib.json +2823 -0
- package/out/src/IStore.sol/IStore.json +73 -73
- package/out/src/ISystemHook.sol/ISystemHook.abi.json +67 -0
- package/out/src/ISystemHook.sol/ISystemHook.abi.json.d.ts +68 -0
- package/out/src/ISystemHook.sol/ISystemHook.json +852 -0
- package/out/src/IWorldErrors.sol/IWorldErrors.abi.json +189 -0
- package/out/src/IWorldErrors.sol/IWorldErrors.abi.json.d.ts +190 -0
- package/out/src/IWorldErrors.sol/IWorldErrors.json +1463 -0
- package/out/src/IWorldKernel.sol/IWorldCall.json +258 -258
- package/out/src/IWorldKernel.sol/IWorldKernel.json +258 -258
- package/out/src/IWorldKernel.sol/IWorldModuleInstallation.json +258 -258
- package/out/src/Memory.sol/Memory.json +242 -242
- package/out/src/PackedCounter.sol/PackedCounterInstance.json +1633 -1633
- package/out/src/PackedCounter.sol/PackedCounterLib.json +1633 -1633
- package/out/src/ResourceId.sol/ResourceIdInstance.json +206 -206
- package/out/src/ResourceId.sol/ResourceIdLib.json +206 -206
- package/out/src/Schema.sol/SchemaInstance.json +1351 -1351
- package/out/src/Schema.sol/SchemaLib.json +1351 -1351
- package/out/src/Slice.sol/SliceInstance.json +802 -802
- package/out/src/Slice.sol/SliceLib.json +802 -802
- package/out/src/StoreCore.sol/StoreCore.json +7412 -7412
- package/out/src/StoreCore.sol/StoreCoreInternal.json +7412 -7412
- package/out/src/StoreSwitch.sol/StoreSwitch.json +4064 -4064
- package/out/src/WorldContext.sol/WorldContextConsumer.json +805 -805
- package/out/src/WorldContext.sol/WorldContextConsumerLib.json +807 -807
- package/out/src/WorldContext.sol/WorldContextProviderLib.json +807 -807
- package/out/src/WorldResourceId.sol/WorldResourceIdInstance.json +809 -809
- package/out/src/WorldResourceId.sol/WorldResourceIdLib.json +809 -809
- package/out/storeHookTypes.sol/storeHookTypes.json +204 -204
- package/out/storeResourceTypes.sol/storeResourceTypes.json +23 -23
- package/out/systemHookTypes.sol/systemHookTypes.json +270 -0
- package/out/tables/ResourceIds.sol/ResourceIds.json +2922 -2922
- package/out/tables/Tables.sol/Tables.json +12189 -12189
- package/out/tightcoder/EncodeArray.sol/EncodeArray.json +6883 -6883
- package/out/types.sol/types.json +71 -71
- package/out/worldResourceTypes.sol/worldResourceTypes.json +92 -92
- package/package.json +8 -8
- package/src/modules/uniqueentity/getUniqueEntity.sol +5 -3
- package/src/utils/SystemSwitch.sol +82 -0
@@ -10,40 +10,40 @@
|
|
10
10
|
},
|
11
11
|
"ast": {
|
12
12
|
"absolutePath": "/home/runner/work/mud/mud/packages/world/src/worldResourceTypes.sol",
|
13
|
-
"id":
|
13
|
+
"id": 26741,
|
14
14
|
"exportedSymbols": {
|
15
15
|
"MASK_RESOURCE_MODULE": [
|
16
|
-
|
16
|
+
26734
|
17
17
|
],
|
18
18
|
"MASK_RESOURCE_NAMESPACE": [
|
19
|
-
|
19
|
+
26728
|
20
20
|
],
|
21
21
|
"MASK_RESOURCE_SYSTEM": [
|
22
|
-
|
22
|
+
26740
|
23
23
|
],
|
24
24
|
"RESOURCE_MODULE": [
|
25
|
-
|
25
|
+
26719
|
26
26
|
],
|
27
27
|
"RESOURCE_NAMESPACE": [
|
28
|
-
|
28
|
+
26716
|
29
29
|
],
|
30
30
|
"RESOURCE_OFFCHAIN_TABLE": [
|
31
|
-
|
31
|
+
39186
|
32
32
|
],
|
33
33
|
"RESOURCE_SYSTEM": [
|
34
|
-
|
34
|
+
26722
|
35
35
|
],
|
36
36
|
"RESOURCE_TABLE": [
|
37
|
-
|
37
|
+
39182
|
38
38
|
]
|
39
39
|
},
|
40
40
|
"nodeType": "SourceUnit",
|
41
|
-
"src": "32:1200:
|
41
|
+
"src": "32:1200:53",
|
42
42
|
"nodes": [
|
43
43
|
{
|
44
|
-
"id":
|
44
|
+
"id": 26709,
|
45
45
|
"nodeType": "PragmaDirective",
|
46
|
-
"src": "32:25:
|
46
|
+
"src": "32:25:53",
|
47
47
|
"nodes": [],
|
48
48
|
"literals": [
|
49
49
|
"solidity",
|
@@ -53,36 +53,36 @@
|
|
53
53
|
]
|
54
54
|
},
|
55
55
|
{
|
56
|
-
"id":
|
56
|
+
"id": 26712,
|
57
57
|
"nodeType": "ImportDirective",
|
58
|
-
"src": "59:103:
|
58
|
+
"src": "59:103:53",
|
59
59
|
"nodes": [],
|
60
60
|
"absolutePath": "node_modules/@latticexyz/store/src/storeResourceTypes.sol",
|
61
61
|
"file": "@latticexyz/store/src/storeResourceTypes.sol",
|
62
62
|
"nameLocation": "-1:-1:-1",
|
63
|
-
"scope":
|
64
|
-
"sourceUnit":
|
63
|
+
"scope": 26741,
|
64
|
+
"sourceUnit": 39187,
|
65
65
|
"symbolAliases": [
|
66
66
|
{
|
67
67
|
"foreign": {
|
68
|
-
"id":
|
68
|
+
"id": 26710,
|
69
69
|
"name": "RESOURCE_TABLE",
|
70
70
|
"nodeType": "Identifier",
|
71
71
|
"overloadedDeclarations": [],
|
72
|
-
"referencedDeclaration":
|
73
|
-
"src": "68:14:
|
72
|
+
"referencedDeclaration": 39182,
|
73
|
+
"src": "68:14:53",
|
74
74
|
"typeDescriptions": {}
|
75
75
|
},
|
76
76
|
"nameLocation": "-1:-1:-1"
|
77
77
|
},
|
78
78
|
{
|
79
79
|
"foreign": {
|
80
|
-
"id":
|
80
|
+
"id": 26711,
|
81
81
|
"name": "RESOURCE_OFFCHAIN_TABLE",
|
82
82
|
"nodeType": "Identifier",
|
83
83
|
"overloadedDeclarations": [],
|
84
|
-
"referencedDeclaration":
|
85
|
-
"src": "84:23:
|
84
|
+
"referencedDeclaration": 39186,
|
85
|
+
"src": "84:23:53",
|
86
86
|
"typeDescriptions": {}
|
87
87
|
},
|
88
88
|
"nameLocation": "-1:-1:-1"
|
@@ -91,15 +91,15 @@
|
|
91
91
|
"unitAlias": ""
|
92
92
|
},
|
93
93
|
{
|
94
|
-
"id":
|
94
|
+
"id": 26716,
|
95
95
|
"nodeType": "VariableDeclaration",
|
96
|
-
"src": "541:41:
|
96
|
+
"src": "541:41:53",
|
97
97
|
"nodes": [],
|
98
98
|
"constant": true,
|
99
99
|
"mutability": "constant",
|
100
100
|
"name": "RESOURCE_NAMESPACE",
|
101
|
-
"nameLocation": "557:18:
|
102
|
-
"scope":
|
101
|
+
"nameLocation": "557:18:53",
|
102
|
+
"scope": 26741,
|
103
103
|
"stateVariable": false,
|
104
104
|
"storageLocation": "default",
|
105
105
|
"typeDescriptions": {
|
@@ -107,10 +107,10 @@
|
|
107
107
|
"typeString": "bytes2"
|
108
108
|
},
|
109
109
|
"typeName": {
|
110
|
-
"id":
|
110
|
+
"id": 26714,
|
111
111
|
"name": "bytes2",
|
112
112
|
"nodeType": "ElementaryTypeName",
|
113
|
-
"src": "541:6:
|
113
|
+
"src": "541:6:53",
|
114
114
|
"typeDescriptions": {
|
115
115
|
"typeIdentifier": "t_bytes2",
|
116
116
|
"typeString": "bytes2"
|
@@ -118,14 +118,14 @@
|
|
118
118
|
},
|
119
119
|
"value": {
|
120
120
|
"hexValue": "6e73",
|
121
|
-
"id":
|
121
|
+
"id": 26715,
|
122
122
|
"isConstant": false,
|
123
123
|
"isLValue": false,
|
124
124
|
"isPure": true,
|
125
125
|
"kind": "string",
|
126
126
|
"lValueRequested": false,
|
127
127
|
"nodeType": "Literal",
|
128
|
-
"src": "578:4:
|
128
|
+
"src": "578:4:53",
|
129
129
|
"typeDescriptions": {
|
130
130
|
"typeIdentifier": "t_stringliteral_a2988854b91401f98206dff94028e22dce27feb5fbfdc2843bbe299db9660d49",
|
131
131
|
"typeString": "literal_string \"ns\""
|
@@ -135,15 +135,15 @@
|
|
135
135
|
"visibility": "internal"
|
136
136
|
},
|
137
137
|
{
|
138
|
-
"id":
|
138
|
+
"id": 26719,
|
139
139
|
"nodeType": "VariableDeclaration",
|
140
|
-
"src": "806:38:
|
140
|
+
"src": "806:38:53",
|
141
141
|
"nodes": [],
|
142
142
|
"constant": true,
|
143
143
|
"mutability": "constant",
|
144
144
|
"name": "RESOURCE_MODULE",
|
145
|
-
"nameLocation": "822:15:
|
146
|
-
"scope":
|
145
|
+
"nameLocation": "822:15:53",
|
146
|
+
"scope": 26741,
|
147
147
|
"stateVariable": false,
|
148
148
|
"storageLocation": "default",
|
149
149
|
"typeDescriptions": {
|
@@ -151,10 +151,10 @@
|
|
151
151
|
"typeString": "bytes2"
|
152
152
|
},
|
153
153
|
"typeName": {
|
154
|
-
"id":
|
154
|
+
"id": 26717,
|
155
155
|
"name": "bytes2",
|
156
156
|
"nodeType": "ElementaryTypeName",
|
157
|
-
"src": "806:6:
|
157
|
+
"src": "806:6:53",
|
158
158
|
"typeDescriptions": {
|
159
159
|
"typeIdentifier": "t_bytes2",
|
160
160
|
"typeString": "bytes2"
|
@@ -162,14 +162,14 @@
|
|
162
162
|
},
|
163
163
|
"value": {
|
164
164
|
"hexValue": "6d64",
|
165
|
-
"id":
|
165
|
+
"id": 26718,
|
166
166
|
"isConstant": false,
|
167
167
|
"isLValue": false,
|
168
168
|
"isPure": true,
|
169
169
|
"kind": "string",
|
170
170
|
"lValueRequested": false,
|
171
171
|
"nodeType": "Literal",
|
172
|
-
"src": "840:4:
|
172
|
+
"src": "840:4:53",
|
173
173
|
"typeDescriptions": {
|
174
174
|
"typeIdentifier": "t_stringliteral_1804a342ec28d0404df931f0fdb61c4c892bdd286e963437dcbd8dd87399412c",
|
175
175
|
"typeString": "literal_string \"md\""
|
@@ -179,15 +179,15 @@
|
|
179
179
|
"visibility": "internal"
|
180
180
|
},
|
181
181
|
{
|
182
|
-
"id":
|
182
|
+
"id": 26722,
|
183
183
|
"nodeType": "VariableDeclaration",
|
184
|
-
"src": "929:38:
|
184
|
+
"src": "929:38:53",
|
185
185
|
"nodes": [],
|
186
186
|
"constant": true,
|
187
187
|
"mutability": "constant",
|
188
188
|
"name": "RESOURCE_SYSTEM",
|
189
|
-
"nameLocation": "945:15:
|
190
|
-
"scope":
|
189
|
+
"nameLocation": "945:15:53",
|
190
|
+
"scope": 26741,
|
191
191
|
"stateVariable": false,
|
192
192
|
"storageLocation": "default",
|
193
193
|
"typeDescriptions": {
|
@@ -195,10 +195,10 @@
|
|
195
195
|
"typeString": "bytes2"
|
196
196
|
},
|
197
197
|
"typeName": {
|
198
|
-
"id":
|
198
|
+
"id": 26720,
|
199
199
|
"name": "bytes2",
|
200
200
|
"nodeType": "ElementaryTypeName",
|
201
|
-
"src": "929:6:
|
201
|
+
"src": "929:6:53",
|
202
202
|
"typeDescriptions": {
|
203
203
|
"typeIdentifier": "t_bytes2",
|
204
204
|
"typeString": "bytes2"
|
@@ -206,14 +206,14 @@
|
|
206
206
|
},
|
207
207
|
"value": {
|
208
208
|
"hexValue": "7379",
|
209
|
-
"id":
|
209
|
+
"id": 26721,
|
210
210
|
"isConstant": false,
|
211
211
|
"isLValue": false,
|
212
212
|
"isPure": true,
|
213
213
|
"kind": "string",
|
214
214
|
"lValueRequested": false,
|
215
215
|
"nodeType": "Literal",
|
216
|
-
"src": "963:4:
|
216
|
+
"src": "963:4:53",
|
217
217
|
"typeDescriptions": {
|
218
218
|
"typeIdentifier": "t_stringliteral_4ba644d4d5fba50020e3397332b128744e5de794270f776b66b08f8fbb5d0357",
|
219
219
|
"typeString": "literal_string \"sy\""
|
@@ -223,15 +223,15 @@
|
|
223
223
|
"visibility": "internal"
|
224
224
|
},
|
225
225
|
{
|
226
|
-
"id":
|
226
|
+
"id": 26728,
|
227
227
|
"nodeType": "VariableDeclaration",
|
228
|
-
"src": "1028:70:
|
228
|
+
"src": "1028:70:53",
|
229
229
|
"nodes": [],
|
230
230
|
"constant": true,
|
231
231
|
"mutability": "constant",
|
232
232
|
"name": "MASK_RESOURCE_NAMESPACE",
|
233
|
-
"nameLocation": "1045:23:
|
234
|
-
"scope":
|
233
|
+
"nameLocation": "1045:23:53",
|
234
|
+
"scope": 26741,
|
235
235
|
"stateVariable": false,
|
236
236
|
"storageLocation": "default",
|
237
237
|
"typeDescriptions": {
|
@@ -239,10 +239,10 @@
|
|
239
239
|
"typeString": "bytes32"
|
240
240
|
},
|
241
241
|
"typeName": {
|
242
|
-
"id":
|
242
|
+
"id": 26723,
|
243
243
|
"name": "bytes32",
|
244
244
|
"nodeType": "ElementaryTypeName",
|
245
|
-
"src": "1028:7:
|
245
|
+
"src": "1028:7:53",
|
246
246
|
"typeDescriptions": {
|
247
247
|
"typeIdentifier": "t_bytes32",
|
248
248
|
"typeString": "bytes32"
|
@@ -251,12 +251,12 @@
|
|
251
251
|
"value": {
|
252
252
|
"arguments": [
|
253
253
|
{
|
254
|
-
"id":
|
254
|
+
"id": 26726,
|
255
255
|
"name": "RESOURCE_NAMESPACE",
|
256
256
|
"nodeType": "Identifier",
|
257
257
|
"overloadedDeclarations": [],
|
258
|
-
"referencedDeclaration":
|
259
|
-
"src": "1079:18:
|
258
|
+
"referencedDeclaration": 26716,
|
259
|
+
"src": "1079:18:53",
|
260
260
|
"typeDescriptions": {
|
261
261
|
"typeIdentifier": "t_bytes2",
|
262
262
|
"typeString": "bytes2"
|
@@ -270,26 +270,26 @@
|
|
270
270
|
"typeString": "bytes2"
|
271
271
|
}
|
272
272
|
],
|
273
|
-
"id":
|
273
|
+
"id": 26725,
|
274
274
|
"isConstant": false,
|
275
275
|
"isLValue": false,
|
276
276
|
"isPure": true,
|
277
277
|
"lValueRequested": false,
|
278
278
|
"nodeType": "ElementaryTypeNameExpression",
|
279
|
-
"src": "1071:7:
|
279
|
+
"src": "1071:7:53",
|
280
280
|
"typeDescriptions": {
|
281
281
|
"typeIdentifier": "t_type$_t_bytes32_$",
|
282
282
|
"typeString": "type(bytes32)"
|
283
283
|
},
|
284
284
|
"typeName": {
|
285
|
-
"id":
|
285
|
+
"id": 26724,
|
286
286
|
"name": "bytes32",
|
287
287
|
"nodeType": "ElementaryTypeName",
|
288
|
-
"src": "1071:7:
|
288
|
+
"src": "1071:7:53",
|
289
289
|
"typeDescriptions": {}
|
290
290
|
}
|
291
291
|
},
|
292
|
-
"id":
|
292
|
+
"id": 26727,
|
293
293
|
"isConstant": false,
|
294
294
|
"isLValue": false,
|
295
295
|
"isPure": true,
|
@@ -298,7 +298,7 @@
|
|
298
298
|
"nameLocations": [],
|
299
299
|
"names": [],
|
300
300
|
"nodeType": "FunctionCall",
|
301
|
-
"src": "1071:27:
|
301
|
+
"src": "1071:27:53",
|
302
302
|
"tryCall": false,
|
303
303
|
"typeDescriptions": {
|
304
304
|
"typeIdentifier": "t_bytes32",
|
@@ -308,15 +308,15 @@
|
|
308
308
|
"visibility": "internal"
|
309
309
|
},
|
310
310
|
{
|
311
|
-
"id":
|
311
|
+
"id": 26734,
|
312
312
|
"nodeType": "VariableDeclaration",
|
313
|
-
"src": "1100:64:
|
313
|
+
"src": "1100:64:53",
|
314
314
|
"nodes": [],
|
315
315
|
"constant": true,
|
316
316
|
"mutability": "constant",
|
317
317
|
"name": "MASK_RESOURCE_MODULE",
|
318
|
-
"nameLocation": "1117:20:
|
319
|
-
"scope":
|
318
|
+
"nameLocation": "1117:20:53",
|
319
|
+
"scope": 26741,
|
320
320
|
"stateVariable": false,
|
321
321
|
"storageLocation": "default",
|
322
322
|
"typeDescriptions": {
|
@@ -324,10 +324,10 @@
|
|
324
324
|
"typeString": "bytes32"
|
325
325
|
},
|
326
326
|
"typeName": {
|
327
|
-
"id":
|
327
|
+
"id": 26729,
|
328
328
|
"name": "bytes32",
|
329
329
|
"nodeType": "ElementaryTypeName",
|
330
|
-
"src": "1100:7:
|
330
|
+
"src": "1100:7:53",
|
331
331
|
"typeDescriptions": {
|
332
332
|
"typeIdentifier": "t_bytes32",
|
333
333
|
"typeString": "bytes32"
|
@@ -336,12 +336,12 @@
|
|
336
336
|
"value": {
|
337
337
|
"arguments": [
|
338
338
|
{
|
339
|
-
"id":
|
339
|
+
"id": 26732,
|
340
340
|
"name": "RESOURCE_MODULE",
|
341
341
|
"nodeType": "Identifier",
|
342
342
|
"overloadedDeclarations": [],
|
343
|
-
"referencedDeclaration":
|
344
|
-
"src": "1148:15:
|
343
|
+
"referencedDeclaration": 26719,
|
344
|
+
"src": "1148:15:53",
|
345
345
|
"typeDescriptions": {
|
346
346
|
"typeIdentifier": "t_bytes2",
|
347
347
|
"typeString": "bytes2"
|
@@ -355,26 +355,26 @@
|
|
355
355
|
"typeString": "bytes2"
|
356
356
|
}
|
357
357
|
],
|
358
|
-
"id":
|
358
|
+
"id": 26731,
|
359
359
|
"isConstant": false,
|
360
360
|
"isLValue": false,
|
361
361
|
"isPure": true,
|
362
362
|
"lValueRequested": false,
|
363
363
|
"nodeType": "ElementaryTypeNameExpression",
|
364
|
-
"src": "1140:7:
|
364
|
+
"src": "1140:7:53",
|
365
365
|
"typeDescriptions": {
|
366
366
|
"typeIdentifier": "t_type$_t_bytes32_$",
|
367
367
|
"typeString": "type(bytes32)"
|
368
368
|
},
|
369
369
|
"typeName": {
|
370
|
-
"id":
|
370
|
+
"id": 26730,
|
371
371
|
"name": "bytes32",
|
372
372
|
"nodeType": "ElementaryTypeName",
|
373
|
-
"src": "1140:7:
|
373
|
+
"src": "1140:7:53",
|
374
374
|
"typeDescriptions": {}
|
375
375
|
}
|
376
376
|
},
|
377
|
-
"id":
|
377
|
+
"id": 26733,
|
378
378
|
"isConstant": false,
|
379
379
|
"isLValue": false,
|
380
380
|
"isPure": true,
|
@@ -383,7 +383,7 @@
|
|
383
383
|
"nameLocations": [],
|
384
384
|
"names": [],
|
385
385
|
"nodeType": "FunctionCall",
|
386
|
-
"src": "1140:24:
|
386
|
+
"src": "1140:24:53",
|
387
387
|
"tryCall": false,
|
388
388
|
"typeDescriptions": {
|
389
389
|
"typeIdentifier": "t_bytes32",
|
@@ -393,15 +393,15 @@
|
|
393
393
|
"visibility": "internal"
|
394
394
|
},
|
395
395
|
{
|
396
|
-
"id":
|
396
|
+
"id": 26740,
|
397
397
|
"nodeType": "VariableDeclaration",
|
398
|
-
"src": "1166:64:
|
398
|
+
"src": "1166:64:53",
|
399
399
|
"nodes": [],
|
400
400
|
"constant": true,
|
401
401
|
"mutability": "constant",
|
402
402
|
"name": "MASK_RESOURCE_SYSTEM",
|
403
|
-
"nameLocation": "1183:20:
|
404
|
-
"scope":
|
403
|
+
"nameLocation": "1183:20:53",
|
404
|
+
"scope": 26741,
|
405
405
|
"stateVariable": false,
|
406
406
|
"storageLocation": "default",
|
407
407
|
"typeDescriptions": {
|
@@ -409,10 +409,10 @@
|
|
409
409
|
"typeString": "bytes32"
|
410
410
|
},
|
411
411
|
"typeName": {
|
412
|
-
"id":
|
412
|
+
"id": 26735,
|
413
413
|
"name": "bytes32",
|
414
414
|
"nodeType": "ElementaryTypeName",
|
415
|
-
"src": "1166:7:
|
415
|
+
"src": "1166:7:53",
|
416
416
|
"typeDescriptions": {
|
417
417
|
"typeIdentifier": "t_bytes32",
|
418
418
|
"typeString": "bytes32"
|
@@ -421,12 +421,12 @@
|
|
421
421
|
"value": {
|
422
422
|
"arguments": [
|
423
423
|
{
|
424
|
-
"id":
|
424
|
+
"id": 26738,
|
425
425
|
"name": "RESOURCE_SYSTEM",
|
426
426
|
"nodeType": "Identifier",
|
427
427
|
"overloadedDeclarations": [],
|
428
|
-
"referencedDeclaration":
|
429
|
-
"src": "1214:15:
|
428
|
+
"referencedDeclaration": 26722,
|
429
|
+
"src": "1214:15:53",
|
430
430
|
"typeDescriptions": {
|
431
431
|
"typeIdentifier": "t_bytes2",
|
432
432
|
"typeString": "bytes2"
|
@@ -440,26 +440,26 @@
|
|
440
440
|
"typeString": "bytes2"
|
441
441
|
}
|
442
442
|
],
|
443
|
-
"id":
|
443
|
+
"id": 26737,
|
444
444
|
"isConstant": false,
|
445
445
|
"isLValue": false,
|
446
446
|
"isPure": true,
|
447
447
|
"lValueRequested": false,
|
448
448
|
"nodeType": "ElementaryTypeNameExpression",
|
449
|
-
"src": "1206:7:
|
449
|
+
"src": "1206:7:53",
|
450
450
|
"typeDescriptions": {
|
451
451
|
"typeIdentifier": "t_type$_t_bytes32_$",
|
452
452
|
"typeString": "type(bytes32)"
|
453
453
|
},
|
454
454
|
"typeName": {
|
455
|
-
"id":
|
455
|
+
"id": 26736,
|
456
456
|
"name": "bytes32",
|
457
457
|
"nodeType": "ElementaryTypeName",
|
458
|
-
"src": "1206:7:
|
458
|
+
"src": "1206:7:53",
|
459
459
|
"typeDescriptions": {}
|
460
460
|
}
|
461
461
|
},
|
462
|
-
"id":
|
462
|
+
"id": 26739,
|
463
463
|
"isConstant": false,
|
464
464
|
"isLValue": false,
|
465
465
|
"isPure": true,
|
@@ -468,7 +468,7 @@
|
|
468
468
|
"nameLocations": [],
|
469
469
|
"names": [],
|
470
470
|
"nodeType": "FunctionCall",
|
471
|
-
"src": "1206:24:
|
471
|
+
"src": "1206:24:53",
|
472
472
|
"tryCall": false,
|
473
473
|
"typeDescriptions": {
|
474
474
|
"typeIdentifier": "t_bytes32",
|
@@ -480,5 +480,5 @@
|
|
480
480
|
],
|
481
481
|
"license": "MIT"
|
482
482
|
},
|
483
|
-
"id":
|
483
|
+
"id": 53
|
484
484
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@latticexyz/world-modules",
|
3
|
-
"version": "2.0.0-main-
|
3
|
+
"version": "2.0.0-main-94d7f1ee",
|
4
4
|
"description": "World modules",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -15,11 +15,11 @@
|
|
15
15
|
},
|
16
16
|
"dependencies": {
|
17
17
|
"zod": "^3.21.4",
|
18
|
-
"@latticexyz/common": "2.0.0-main-
|
19
|
-
"@latticexyz/config": "2.0.0-main-
|
20
|
-
"@latticexyz/schema-type": "2.0.0-main-
|
21
|
-
"@latticexyz/store": "2.0.0-main-
|
22
|
-
"@latticexyz/world": "2.0.0-main-
|
18
|
+
"@latticexyz/common": "2.0.0-main-94d7f1ee",
|
19
|
+
"@latticexyz/config": "2.0.0-main-94d7f1ee",
|
20
|
+
"@latticexyz/schema-type": "2.0.0-main-94d7f1ee",
|
21
|
+
"@latticexyz/store": "2.0.0-main-94d7f1ee",
|
22
|
+
"@latticexyz/world": "2.0.0-main-94d7f1ee"
|
23
23
|
},
|
24
24
|
"devDependencies": {
|
25
25
|
"@types/ejs": "^3.1.1",
|
@@ -34,8 +34,8 @@
|
|
34
34
|
"tsup": "^6.7.0",
|
35
35
|
"tsx": "^3.12.6",
|
36
36
|
"vitest": "0.31.4",
|
37
|
-
"@latticexyz/abi-ts": "2.0.0-main-
|
38
|
-
"@latticexyz/gas-report": "2.0.0-main-
|
37
|
+
"@latticexyz/abi-ts": "2.0.0-main-94d7f1ee",
|
38
|
+
"@latticexyz/gas-report": "2.0.0-main-94d7f1ee"
|
39
39
|
},
|
40
40
|
"publishConfig": {
|
41
41
|
"access": "public"
|
@@ -1,10 +1,13 @@
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
2
2
|
pragma solidity >=0.8.21;
|
3
3
|
|
4
|
-
import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol";
|
5
4
|
import { IBaseWorld } from "@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol";
|
6
5
|
|
7
6
|
import { IUniqueEntitySystem } from "../../interfaces/IUniqueEntitySystem.sol";
|
7
|
+
import { UniqueEntitySystem } from "./UniqueEntitySystem.sol";
|
8
|
+
|
9
|
+
import { SystemSwitch } from "../../utils/SystemSwitch.sol";
|
10
|
+
import { SYSTEM_ID } from "./constants.sol";
|
8
11
|
|
9
12
|
/**
|
10
13
|
* Increment and get an entity nonce.
|
@@ -13,8 +16,7 @@ import { IUniqueEntitySystem } from "../../interfaces/IUniqueEntitySystem.sol";
|
|
13
16
|
* For usage outside of a World, use the overload that takes an explicit store argument.
|
14
17
|
*/
|
15
18
|
function getUniqueEntity() returns (bytes32 uniqueEntity) {
|
16
|
-
|
17
|
-
return IUniqueEntitySystem(world).uniqueEntity_system_getUniqueEntity();
|
19
|
+
return abi.decode(SystemSwitch.call(SYSTEM_ID, abi.encodeCall(UniqueEntitySystem.getUniqueEntity, ())), (bytes32));
|
18
20
|
}
|
19
21
|
|
20
22
|
/**
|
@@ -0,0 +1,82 @@
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
2
|
+
pragma solidity >=0.8.21;
|
3
|
+
|
4
|
+
import { Hook } from "@latticexyz/store/src/Hook.sol";
|
5
|
+
import { Bytes } from "@latticexyz/store/src/Bytes.sol";
|
6
|
+
|
7
|
+
import { IWorldKernel } from "@latticexyz/world/src/IWorldKernel.sol";
|
8
|
+
import { ResourceId, WorldResourceIdInstance } from "@latticexyz/world/src/WorldResourceId.sol";
|
9
|
+
import { WorldContextProviderLib, WorldContextConsumerLib } from "@latticexyz/world/src/WorldContext.sol";
|
10
|
+
import { AccessControl } from "@latticexyz/world/src/AccessControl.sol";
|
11
|
+
import { ROOT_NAMESPACE } from "@latticexyz/world/src/constants.sol";
|
12
|
+
import { revertWithBytes } from "@latticexyz/world/src/revertWithBytes.sol";
|
13
|
+
import { BEFORE_CALL_SYSTEM, AFTER_CALL_SYSTEM } from "@latticexyz/world/src/systemHookTypes.sol";
|
14
|
+
|
15
|
+
import { IWorldErrors } from "@latticexyz/world/src/IWorldErrors.sol";
|
16
|
+
import { ISystemHook } from "@latticexyz/world/src/ISystemHook.sol";
|
17
|
+
|
18
|
+
import { FunctionSelectors } from "@latticexyz/world/src/codegen/tables/FunctionSelectors.sol";
|
19
|
+
import { Systems } from "@latticexyz/world/src/codegen/tables/Systems.sol";
|
20
|
+
import { SystemHooks } from "@latticexyz/world/src/codegen/tables/SystemHooks.sol";
|
21
|
+
import { Balances } from "@latticexyz/world/src/codegen/tables/Balances.sol";
|
22
|
+
|
23
|
+
/**
|
24
|
+
* @title SystemSwitch
|
25
|
+
* @dev The SystemSwitch library provides functions for interacting with systems from other systems.
|
26
|
+
*/
|
27
|
+
library SystemSwitch {
|
28
|
+
using WorldResourceIdInstance for ResourceId;
|
29
|
+
|
30
|
+
/**
|
31
|
+
* @notice Calls a system identified by its Resource ID.
|
32
|
+
* @dev Reverts if the system is not found, or if the system call reverts.
|
33
|
+
* If the call is executed from the root context, the system is called directly via delegatecall.
|
34
|
+
* Otherwise, the call is executed via an external call to the World contract.
|
35
|
+
* @param systemId The unique Resource ID of the system being called.
|
36
|
+
* @param callData The calldata to be executed in the system.
|
37
|
+
* @return returnData The return data from the system call.
|
38
|
+
*/
|
39
|
+
function call(ResourceId systemId, bytes memory callData) internal returns (bytes memory returnData) {
|
40
|
+
address worldAddress = WorldContextConsumerLib._world();
|
41
|
+
|
42
|
+
// If we're in the World context, call the system directly via delegatecall
|
43
|
+
if (address(this) == worldAddress) {
|
44
|
+
(address systemAddress, ) = Systems.get(systemId);
|
45
|
+
// Check if the system exists
|
46
|
+
if (systemAddress == address(0)) revert IWorldErrors.World_ResourceNotFound(systemId, systemId.toString());
|
47
|
+
|
48
|
+
bool success;
|
49
|
+
(success, returnData) = WorldContextProviderLib.delegatecallWithContext({
|
50
|
+
msgSender: WorldContextConsumerLib._msgSender(),
|
51
|
+
msgValue: WorldContextConsumerLib._msgValue(),
|
52
|
+
target: systemAddress,
|
53
|
+
callData: callData
|
54
|
+
});
|
55
|
+
|
56
|
+
if (!success) revertWithBytes(returnData);
|
57
|
+
return returnData;
|
58
|
+
}
|
59
|
+
|
60
|
+
// Otherwise, call the system via world.call
|
61
|
+
returnData = IWorldKernel(worldAddress).call(systemId, callData);
|
62
|
+
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
* @notice Calls a system via the function selector registered for it in the World contract.
|
66
|
+
* @dev Reverts if the system is not found, or if the system call reverts.
|
67
|
+
* If the call is executed from the root context, the system is called directly via delegatecall.
|
68
|
+
* Otherwise, the call is executed via an external call to the World contract.
|
69
|
+
* @param callData The world function selector, and call data to be forwarded to the system.
|
70
|
+
* @return returnData The return data from the system call.
|
71
|
+
*/
|
72
|
+
function call(bytes memory callData) internal returns (bytes memory returnData) {
|
73
|
+
// Get the systemAddress and systemFunctionSelector from the worldFunctionSelector encoded in the calldata
|
74
|
+
(ResourceId systemId, bytes4 systemFunctionSelector) = FunctionSelectors.get(bytes4(callData));
|
75
|
+
|
76
|
+
// Revert if the function selector is not found
|
77
|
+
if (ResourceId.unwrap(systemId) == 0) revert IWorldErrors.World_FunctionSelectorNotFound(msg.sig);
|
78
|
+
|
79
|
+
// Replace function selector in the calldata with the system function selector, and call the system
|
80
|
+
return call({ systemId: systemId, callData: Bytes.setBytes4(callData, 0, systemFunctionSelector) });
|
81
|
+
}
|
82
|
+
}
|