-
Notifications
You must be signed in to change notification settings - Fork 196
/
Copy pathmud.config.ts
215 lines (212 loc) · 5.75 KB
/
mud.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
import { mudConfig } from "./ts/register";
export default mudConfig({
worldImportPath: "../",
worldgenDirectory: "interfaces",
worldInterfaceName: "IBaseWorld",
codegenDirectory: "",
tables: {
/************************************************************************
*
* CORE TABLES
*
************************************************************************/
NamespaceOwner: {
keySchema: {
namespace: "bytes16",
},
schema: {
owner: "address",
},
},
ResourceAccess: {
keySchema: {
resourceSelector: "bytes32",
caller: "address",
},
schema: {
access: "bool",
},
},
InstalledModules: {
keySchema: {
moduleName: "bytes16",
argumentsHash: "bytes32", // Hash of the params passed to the `install` function
},
schema: {
moduleAddress: "address",
},
// TODO: this is a workaround to use `getRecord` instead of `getField` in the autogen library,
// to allow using the table before it is registered. This is because `getRecord` passes the schema
// to store, while `getField` loads it from storage. Remove this once we have support for passing the
// schema in `getField` too. (See https://github.com/latticexyz/mud/issues/444)
dataStruct: true,
},
Delegations: {
keySchema: {
delegator: "address",
delegatee: "address",
},
schema: {
delegationControlId: "bytes32",
},
},
/************************************************************************
*
* MODULE TABLES
*
************************************************************************/
Balances: {
directory: "modules/core/tables",
keySchema: {
namespace: "bytes16",
},
schema: {
balance: "uint256",
},
},
Systems: {
directory: "modules/core/tables",
keySchema: {
resourceSelector: "bytes32",
},
schema: {
system: "address",
publicAccess: "bool",
},
dataStruct: false,
},
SystemRegistry: {
directory: "modules/core/tables",
keySchema: {
system: "address",
},
schema: {
resourceSelector: "bytes32",
},
},
SystemHooks: {
directory: "modules/core/tables",
keySchema: {
resourceSelector: "bytes32",
},
schema: "bytes21[]",
},
ResourceType: {
directory: "modules/core/tables",
keySchema: {
resourceSelector: "bytes32",
},
schema: {
resourceType: "Resource",
},
},
FunctionSelectors: {
directory: "modules/core/tables",
keySchema: {
functionSelector: "bytes4",
},
schema: {
resourceSelector: "bytes32",
systemFunctionSelector: "bytes4",
},
dataStruct: false,
},
KeysWithValue: {
directory: "modules/keyswithvalue/tables",
keySchema: {
valueHash: "bytes32",
},
schema: {
keysWithValue: "bytes32[]", // For now only supports 1 key per value
},
tableIdArgument: true,
},
KeysInTable: {
directory: "modules/keysintable/tables",
keySchema: { sourceTable: "bytes32" },
schema: {
keys0: "bytes32[]",
keys1: "bytes32[]",
keys2: "bytes32[]",
keys3: "bytes32[]",
keys4: "bytes32[]",
},
},
UsedKeysIndex: {
directory: "modules/keysintable/tables",
keySchema: {
sourceTable: "bytes32",
keysHash: "bytes32",
},
schema: { has: "bool", index: "uint40" },
dataStruct: false,
},
UniqueEntity: {
directory: "modules/uniqueentity/tables",
keySchema: {},
schema: "uint256",
tableIdArgument: true,
storeArgument: true,
},
CallboundDelegations: {
directory: "modules/std-delegations/tables",
keySchema: {
delegator: "address",
delegatee: "address",
resourceSelector: "bytes32",
funcSelectorAndArgsHash: "bytes32",
},
schema: {
availableCalls: "uint256",
},
},
TimeboundDelegations: {
directory: "modules/std-delegations/tables",
keySchema: {
delegator: "address",
delegatee: "address",
},
schema: {
maxTimestamp: "uint256",
},
},
/************************************************************************
*
* TEST TABLES
*
************************************************************************/
Bool: {
directory: "../test/tables",
keySchema: {},
schema: {
value: "bool",
},
tableIdArgument: true,
},
AddressArray: {
directory: "../test/tables",
schema: "address[]",
tableIdArgument: true,
},
},
enums: {
Resource: ["NONE", "NAMESPACE", "TABLE", "SYSTEM"],
},
excludeSystems: [
// IUniqueEntitySystem is not part of the root namespace and
// installed separately by UniqueEntityModule.
// TODO: Move optional modules into a separate package
// (see https://github.com/latticexyz/mud/pull/584)
"UniqueEntitySystem",
// Worldgen currently does not support systems inheriting logic
// from other contracts, so all parts of CoreSystem are named
// System too to be included in the IBaseWorld interface.
// However, IStoreRegistrationSystem overlaps with IStore if
// included in IBaseWorld, so it needs to be excluded from worldgen.
// TODO: add support for inheritance to worldgen
// (see: https://github.com/latticexyz/mud/issues/631)
"StoreRegistrationSystem",
// Similar overlap occurs for IEphemeralRecordSystem. IWorldEphemeral is included instead.
"EphemeralRecordSystem",
],
});