@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
@@ -33,12 +33,18 @@ FieldLayout constant _fieldLayout = FieldLayout.wrap(
|
|
33
33
|
);
|
34
34
|
|
35
35
|
library CallboundDelegations {
|
36
|
-
/**
|
36
|
+
/**
|
37
|
+
* @notice Get the table values' field layout.
|
38
|
+
* @return _fieldLayout The field layout for the table.
|
39
|
+
*/
|
37
40
|
function getFieldLayout() internal pure returns (FieldLayout) {
|
38
41
|
return _fieldLayout;
|
39
42
|
}
|
40
43
|
|
41
|
-
/**
|
44
|
+
/**
|
45
|
+
* @notice Get the table's key schema.
|
46
|
+
* @return _keySchema The key schema for the table.
|
47
|
+
*/
|
42
48
|
function getKeySchema() internal pure returns (Schema) {
|
43
49
|
SchemaType[] memory _keySchema = new SchemaType[](4);
|
44
50
|
_keySchema[0] = SchemaType.ADDRESS;
|
@@ -49,7 +55,10 @@ library CallboundDelegations {
|
|
49
55
|
return SchemaLib.encode(_keySchema);
|
50
56
|
}
|
51
57
|
|
52
|
-
/**
|
58
|
+
/**
|
59
|
+
* @notice Get the table's value schema.
|
60
|
+
* @return _valueSchema The value schema for the table.
|
61
|
+
*/
|
53
62
|
function getValueSchema() internal pure returns (Schema) {
|
54
63
|
SchemaType[] memory _valueSchema = new SchemaType[](1);
|
55
64
|
_valueSchema[0] = SchemaType.UINT256;
|
@@ -57,7 +66,10 @@ library CallboundDelegations {
|
|
57
66
|
return SchemaLib.encode(_valueSchema);
|
58
67
|
}
|
59
68
|
|
60
|
-
/**
|
69
|
+
/**
|
70
|
+
* @notice Get the table's key field names.
|
71
|
+
* @return keyNames An array of strings with the names of key fields.
|
72
|
+
*/
|
61
73
|
function getKeyNames() internal pure returns (string[] memory keyNames) {
|
62
74
|
keyNames = new string[](4);
|
63
75
|
keyNames[0] = "delegator";
|
@@ -66,28 +78,39 @@ library CallboundDelegations {
|
|
66
78
|
keyNames[3] = "callDataHash";
|
67
79
|
}
|
68
80
|
|
69
|
-
/**
|
81
|
+
/**
|
82
|
+
* @notice Get the table's value field names.
|
83
|
+
* @return fieldNames An array of strings with the names of value fields.
|
84
|
+
*/
|
70
85
|
function getFieldNames() internal pure returns (string[] memory fieldNames) {
|
71
86
|
fieldNames = new string[](1);
|
72
87
|
fieldNames[0] = "availableCalls";
|
73
88
|
}
|
74
89
|
|
75
|
-
/**
|
90
|
+
/**
|
91
|
+
* @notice Register the table with its config.
|
92
|
+
*/
|
76
93
|
function register() internal {
|
77
94
|
StoreSwitch.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
|
78
95
|
}
|
79
96
|
|
80
|
-
/**
|
97
|
+
/**
|
98
|
+
* @notice Register the table with its config.
|
99
|
+
*/
|
81
100
|
function _register() internal {
|
82
101
|
StoreCore.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
|
83
102
|
}
|
84
103
|
|
85
|
-
/**
|
104
|
+
/**
|
105
|
+
* @notice Register the table with its config (using the specified store).
|
106
|
+
*/
|
86
107
|
function register(IStore _store) internal {
|
87
108
|
_store.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
|
88
109
|
}
|
89
110
|
|
90
|
-
/**
|
111
|
+
/**
|
112
|
+
* @notice Get availableCalls.
|
113
|
+
*/
|
91
114
|
function getAvailableCalls(
|
92
115
|
address delegator,
|
93
116
|
address delegatee,
|
@@ -104,7 +127,9 @@ library CallboundDelegations {
|
|
104
127
|
return (uint256(bytes32(_blob)));
|
105
128
|
}
|
106
129
|
|
107
|
-
/**
|
130
|
+
/**
|
131
|
+
* @notice Get availableCalls.
|
132
|
+
*/
|
108
133
|
function _getAvailableCalls(
|
109
134
|
address delegator,
|
110
135
|
address delegatee,
|
@@ -121,7 +146,9 @@ library CallboundDelegations {
|
|
121
146
|
return (uint256(bytes32(_blob)));
|
122
147
|
}
|
123
148
|
|
124
|
-
/**
|
149
|
+
/**
|
150
|
+
* @notice Get availableCalls (using the specified store).
|
151
|
+
*/
|
125
152
|
function getAvailableCalls(
|
126
153
|
IStore _store,
|
127
154
|
address delegator,
|
@@ -139,7 +166,9 @@ library CallboundDelegations {
|
|
139
166
|
return (uint256(bytes32(_blob)));
|
140
167
|
}
|
141
168
|
|
142
|
-
/**
|
169
|
+
/**
|
170
|
+
* @notice Get availableCalls.
|
171
|
+
*/
|
143
172
|
function get(
|
144
173
|
address delegator,
|
145
174
|
address delegatee,
|
@@ -156,7 +185,9 @@ library CallboundDelegations {
|
|
156
185
|
return (uint256(bytes32(_blob)));
|
157
186
|
}
|
158
187
|
|
159
|
-
/**
|
188
|
+
/**
|
189
|
+
* @notice Get availableCalls.
|
190
|
+
*/
|
160
191
|
function _get(
|
161
192
|
address delegator,
|
162
193
|
address delegatee,
|
@@ -173,7 +204,9 @@ library CallboundDelegations {
|
|
173
204
|
return (uint256(bytes32(_blob)));
|
174
205
|
}
|
175
206
|
|
176
|
-
/**
|
207
|
+
/**
|
208
|
+
* @notice Get availableCalls (using the specified store).
|
209
|
+
*/
|
177
210
|
function get(
|
178
211
|
IStore _store,
|
179
212
|
address delegator,
|
@@ -191,7 +224,9 @@ library CallboundDelegations {
|
|
191
224
|
return (uint256(bytes32(_blob)));
|
192
225
|
}
|
193
226
|
|
194
|
-
/**
|
227
|
+
/**
|
228
|
+
* @notice Set availableCalls.
|
229
|
+
*/
|
195
230
|
function setAvailableCalls(
|
196
231
|
address delegator,
|
197
232
|
address delegatee,
|
@@ -208,7 +243,9 @@ library CallboundDelegations {
|
|
208
243
|
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout);
|
209
244
|
}
|
210
245
|
|
211
|
-
/**
|
246
|
+
/**
|
247
|
+
* @notice Set availableCalls.
|
248
|
+
*/
|
212
249
|
function _setAvailableCalls(
|
213
250
|
address delegator,
|
214
251
|
address delegatee,
|
@@ -225,7 +262,9 @@ library CallboundDelegations {
|
|
225
262
|
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout);
|
226
263
|
}
|
227
264
|
|
228
|
-
/**
|
265
|
+
/**
|
266
|
+
* @notice Set availableCalls (using the specified store).
|
267
|
+
*/
|
229
268
|
function setAvailableCalls(
|
230
269
|
IStore _store,
|
231
270
|
address delegator,
|
@@ -243,7 +282,9 @@ library CallboundDelegations {
|
|
243
282
|
_store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout);
|
244
283
|
}
|
245
284
|
|
246
|
-
/**
|
285
|
+
/**
|
286
|
+
* @notice Set availableCalls.
|
287
|
+
*/
|
247
288
|
function set(
|
248
289
|
address delegator,
|
249
290
|
address delegatee,
|
@@ -260,7 +301,9 @@ library CallboundDelegations {
|
|
260
301
|
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout);
|
261
302
|
}
|
262
303
|
|
263
|
-
/**
|
304
|
+
/**
|
305
|
+
* @notice Set availableCalls.
|
306
|
+
*/
|
264
307
|
function _set(
|
265
308
|
address delegator,
|
266
309
|
address delegatee,
|
@@ -277,7 +320,9 @@ library CallboundDelegations {
|
|
277
320
|
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout);
|
278
321
|
}
|
279
322
|
|
280
|
-
/**
|
323
|
+
/**
|
324
|
+
* @notice Set availableCalls (using the specified store).
|
325
|
+
*/
|
281
326
|
function set(
|
282
327
|
IStore _store,
|
283
328
|
address delegator,
|
@@ -295,7 +340,9 @@ library CallboundDelegations {
|
|
295
340
|
_store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout);
|
296
341
|
}
|
297
342
|
|
298
|
-
/**
|
343
|
+
/**
|
344
|
+
* @notice Delete all data for given keys.
|
345
|
+
*/
|
299
346
|
function deleteRecord(address delegator, address delegatee, ResourceId systemId, bytes32 callDataHash) internal {
|
300
347
|
bytes32[] memory _keyTuple = new bytes32[](4);
|
301
348
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|
@@ -306,7 +353,9 @@ library CallboundDelegations {
|
|
306
353
|
StoreSwitch.deleteRecord(_tableId, _keyTuple);
|
307
354
|
}
|
308
355
|
|
309
|
-
/**
|
356
|
+
/**
|
357
|
+
* @notice Delete all data for given keys.
|
358
|
+
*/
|
310
359
|
function _deleteRecord(address delegator, address delegatee, ResourceId systemId, bytes32 callDataHash) internal {
|
311
360
|
bytes32[] memory _keyTuple = new bytes32[](4);
|
312
361
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|
@@ -317,7 +366,9 @@ library CallboundDelegations {
|
|
317
366
|
StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout);
|
318
367
|
}
|
319
368
|
|
320
|
-
/**
|
369
|
+
/**
|
370
|
+
* @notice Delete all data for given keys (using the specified store).
|
371
|
+
*/
|
321
372
|
function deleteRecord(
|
322
373
|
IStore _store,
|
323
374
|
address delegator,
|
@@ -334,12 +385,20 @@ library CallboundDelegations {
|
|
334
385
|
_store.deleteRecord(_tableId, _keyTuple);
|
335
386
|
}
|
336
387
|
|
337
|
-
/**
|
388
|
+
/**
|
389
|
+
* @notice Tightly pack static (fixed length) data using this table's schema.
|
390
|
+
* @return The static data, encoded into a sequence of bytes.
|
391
|
+
*/
|
338
392
|
function encodeStatic(uint256 availableCalls) internal pure returns (bytes memory) {
|
339
393
|
return abi.encodePacked(availableCalls);
|
340
394
|
}
|
341
395
|
|
342
|
-
/**
|
396
|
+
/**
|
397
|
+
* @notice Encode all of a record's fields.
|
398
|
+
* @return The static (fixed length) data, encoded into a sequence of bytes.
|
399
|
+
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
400
|
+
* @return The dyanmic (variable length) data, encoded into a sequence of bytes.
|
401
|
+
*/
|
343
402
|
function encode(uint256 availableCalls) internal pure returns (bytes memory, PackedCounter, bytes memory) {
|
344
403
|
bytes memory _staticData = encodeStatic(availableCalls);
|
345
404
|
|
@@ -349,7 +408,9 @@ library CallboundDelegations {
|
|
349
408
|
return (_staticData, _encodedLengths, _dynamicData);
|
350
409
|
}
|
351
410
|
|
352
|
-
/**
|
411
|
+
/**
|
412
|
+
* @notice Encode keys as a bytes32 array using this table's field layout.
|
413
|
+
*/
|
353
414
|
function encodeKeyTuple(
|
354
415
|
address delegator,
|
355
416
|
address delegatee,
|
@@ -30,12 +30,18 @@ FieldLayout constant _fieldLayout = FieldLayout.wrap(
|
|
30
30
|
);
|
31
31
|
|
32
32
|
library TimeboundDelegations {
|
33
|
-
/**
|
33
|
+
/**
|
34
|
+
* @notice Get the table values' field layout.
|
35
|
+
* @return _fieldLayout The field layout for the table.
|
36
|
+
*/
|
34
37
|
function getFieldLayout() internal pure returns (FieldLayout) {
|
35
38
|
return _fieldLayout;
|
36
39
|
}
|
37
40
|
|
38
|
-
/**
|
41
|
+
/**
|
42
|
+
* @notice Get the table's key schema.
|
43
|
+
* @return _keySchema The key schema for the table.
|
44
|
+
*/
|
39
45
|
function getKeySchema() internal pure returns (Schema) {
|
40
46
|
SchemaType[] memory _keySchema = new SchemaType[](2);
|
41
47
|
_keySchema[0] = SchemaType.ADDRESS;
|
@@ -44,7 +50,10 @@ library TimeboundDelegations {
|
|
44
50
|
return SchemaLib.encode(_keySchema);
|
45
51
|
}
|
46
52
|
|
47
|
-
/**
|
53
|
+
/**
|
54
|
+
* @notice Get the table's value schema.
|
55
|
+
* @return _valueSchema The value schema for the table.
|
56
|
+
*/
|
48
57
|
function getValueSchema() internal pure returns (Schema) {
|
49
58
|
SchemaType[] memory _valueSchema = new SchemaType[](1);
|
50
59
|
_valueSchema[0] = SchemaType.UINT256;
|
@@ -52,35 +61,49 @@ library TimeboundDelegations {
|
|
52
61
|
return SchemaLib.encode(_valueSchema);
|
53
62
|
}
|
54
63
|
|
55
|
-
/**
|
64
|
+
/**
|
65
|
+
* @notice Get the table's key field names.
|
66
|
+
* @return keyNames An array of strings with the names of key fields.
|
67
|
+
*/
|
56
68
|
function getKeyNames() internal pure returns (string[] memory keyNames) {
|
57
69
|
keyNames = new string[](2);
|
58
70
|
keyNames[0] = "delegator";
|
59
71
|
keyNames[1] = "delegatee";
|
60
72
|
}
|
61
73
|
|
62
|
-
/**
|
74
|
+
/**
|
75
|
+
* @notice Get the table's value field names.
|
76
|
+
* @return fieldNames An array of strings with the names of value fields.
|
77
|
+
*/
|
63
78
|
function getFieldNames() internal pure returns (string[] memory fieldNames) {
|
64
79
|
fieldNames = new string[](1);
|
65
80
|
fieldNames[0] = "maxTimestamp";
|
66
81
|
}
|
67
82
|
|
68
|
-
/**
|
83
|
+
/**
|
84
|
+
* @notice Register the table with its config.
|
85
|
+
*/
|
69
86
|
function register() internal {
|
70
87
|
StoreSwitch.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
|
71
88
|
}
|
72
89
|
|
73
|
-
/**
|
90
|
+
/**
|
91
|
+
* @notice Register the table with its config.
|
92
|
+
*/
|
74
93
|
function _register() internal {
|
75
94
|
StoreCore.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
|
76
95
|
}
|
77
96
|
|
78
|
-
/**
|
97
|
+
/**
|
98
|
+
* @notice Register the table with its config (using the specified store).
|
99
|
+
*/
|
79
100
|
function register(IStore _store) internal {
|
80
101
|
_store.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
|
81
102
|
}
|
82
103
|
|
83
|
-
/**
|
104
|
+
/**
|
105
|
+
* @notice Get maxTimestamp.
|
106
|
+
*/
|
84
107
|
function getMaxTimestamp(address delegator, address delegatee) internal view returns (uint256 maxTimestamp) {
|
85
108
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
86
109
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|
@@ -90,7 +113,9 @@ library TimeboundDelegations {
|
|
90
113
|
return (uint256(bytes32(_blob)));
|
91
114
|
}
|
92
115
|
|
93
|
-
/**
|
116
|
+
/**
|
117
|
+
* @notice Get maxTimestamp.
|
118
|
+
*/
|
94
119
|
function _getMaxTimestamp(address delegator, address delegatee) internal view returns (uint256 maxTimestamp) {
|
95
120
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
96
121
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|
@@ -100,7 +125,9 @@ library TimeboundDelegations {
|
|
100
125
|
return (uint256(bytes32(_blob)));
|
101
126
|
}
|
102
127
|
|
103
|
-
/**
|
128
|
+
/**
|
129
|
+
* @notice Get maxTimestamp (using the specified store).
|
130
|
+
*/
|
104
131
|
function getMaxTimestamp(
|
105
132
|
IStore _store,
|
106
133
|
address delegator,
|
@@ -114,7 +141,9 @@ library TimeboundDelegations {
|
|
114
141
|
return (uint256(bytes32(_blob)));
|
115
142
|
}
|
116
143
|
|
117
|
-
/**
|
144
|
+
/**
|
145
|
+
* @notice Get maxTimestamp.
|
146
|
+
*/
|
118
147
|
function get(address delegator, address delegatee) internal view returns (uint256 maxTimestamp) {
|
119
148
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
120
149
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|
@@ -124,7 +153,9 @@ library TimeboundDelegations {
|
|
124
153
|
return (uint256(bytes32(_blob)));
|
125
154
|
}
|
126
155
|
|
127
|
-
/**
|
156
|
+
/**
|
157
|
+
* @notice Get maxTimestamp.
|
158
|
+
*/
|
128
159
|
function _get(address delegator, address delegatee) internal view returns (uint256 maxTimestamp) {
|
129
160
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
130
161
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|
@@ -134,7 +165,9 @@ library TimeboundDelegations {
|
|
134
165
|
return (uint256(bytes32(_blob)));
|
135
166
|
}
|
136
167
|
|
137
|
-
/**
|
168
|
+
/**
|
169
|
+
* @notice Get maxTimestamp (using the specified store).
|
170
|
+
*/
|
138
171
|
function get(IStore _store, address delegator, address delegatee) internal view returns (uint256 maxTimestamp) {
|
139
172
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
140
173
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|
@@ -144,7 +177,9 @@ library TimeboundDelegations {
|
|
144
177
|
return (uint256(bytes32(_blob)));
|
145
178
|
}
|
146
179
|
|
147
|
-
/**
|
180
|
+
/**
|
181
|
+
* @notice Set maxTimestamp.
|
182
|
+
*/
|
148
183
|
function setMaxTimestamp(address delegator, address delegatee, uint256 maxTimestamp) internal {
|
149
184
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
150
185
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|
@@ -153,7 +188,9 @@ library TimeboundDelegations {
|
|
153
188
|
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout);
|
154
189
|
}
|
155
190
|
|
156
|
-
/**
|
191
|
+
/**
|
192
|
+
* @notice Set maxTimestamp.
|
193
|
+
*/
|
157
194
|
function _setMaxTimestamp(address delegator, address delegatee, uint256 maxTimestamp) internal {
|
158
195
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
159
196
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|
@@ -162,7 +199,9 @@ library TimeboundDelegations {
|
|
162
199
|
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout);
|
163
200
|
}
|
164
201
|
|
165
|
-
/**
|
202
|
+
/**
|
203
|
+
* @notice Set maxTimestamp (using the specified store).
|
204
|
+
*/
|
166
205
|
function setMaxTimestamp(IStore _store, address delegator, address delegatee, uint256 maxTimestamp) internal {
|
167
206
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
168
207
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|
@@ -171,7 +210,9 @@ library TimeboundDelegations {
|
|
171
210
|
_store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout);
|
172
211
|
}
|
173
212
|
|
174
|
-
/**
|
213
|
+
/**
|
214
|
+
* @notice Set maxTimestamp.
|
215
|
+
*/
|
175
216
|
function set(address delegator, address delegatee, uint256 maxTimestamp) internal {
|
176
217
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
177
218
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|
@@ -180,7 +221,9 @@ library TimeboundDelegations {
|
|
180
221
|
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout);
|
181
222
|
}
|
182
223
|
|
183
|
-
/**
|
224
|
+
/**
|
225
|
+
* @notice Set maxTimestamp.
|
226
|
+
*/
|
184
227
|
function _set(address delegator, address delegatee, uint256 maxTimestamp) internal {
|
185
228
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
186
229
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|
@@ -189,7 +232,9 @@ library TimeboundDelegations {
|
|
189
232
|
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout);
|
190
233
|
}
|
191
234
|
|
192
|
-
/**
|
235
|
+
/**
|
236
|
+
* @notice Set maxTimestamp (using the specified store).
|
237
|
+
*/
|
193
238
|
function set(IStore _store, address delegator, address delegatee, uint256 maxTimestamp) internal {
|
194
239
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
195
240
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|
@@ -198,7 +243,9 @@ library TimeboundDelegations {
|
|
198
243
|
_store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout);
|
199
244
|
}
|
200
245
|
|
201
|
-
/**
|
246
|
+
/**
|
247
|
+
* @notice Delete all data for given keys.
|
248
|
+
*/
|
202
249
|
function deleteRecord(address delegator, address delegatee) internal {
|
203
250
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
204
251
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|
@@ -207,7 +254,9 @@ library TimeboundDelegations {
|
|
207
254
|
StoreSwitch.deleteRecord(_tableId, _keyTuple);
|
208
255
|
}
|
209
256
|
|
210
|
-
/**
|
257
|
+
/**
|
258
|
+
* @notice Delete all data for given keys.
|
259
|
+
*/
|
211
260
|
function _deleteRecord(address delegator, address delegatee) internal {
|
212
261
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
213
262
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|
@@ -216,7 +265,9 @@ library TimeboundDelegations {
|
|
216
265
|
StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout);
|
217
266
|
}
|
218
267
|
|
219
|
-
/**
|
268
|
+
/**
|
269
|
+
* @notice Delete all data for given keys (using the specified store).
|
270
|
+
*/
|
220
271
|
function deleteRecord(IStore _store, address delegator, address delegatee) internal {
|
221
272
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
222
273
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|
@@ -225,12 +276,20 @@ library TimeboundDelegations {
|
|
225
276
|
_store.deleteRecord(_tableId, _keyTuple);
|
226
277
|
}
|
227
278
|
|
228
|
-
/**
|
279
|
+
/**
|
280
|
+
* @notice Tightly pack static (fixed length) data using this table's schema.
|
281
|
+
* @return The static data, encoded into a sequence of bytes.
|
282
|
+
*/
|
229
283
|
function encodeStatic(uint256 maxTimestamp) internal pure returns (bytes memory) {
|
230
284
|
return abi.encodePacked(maxTimestamp);
|
231
285
|
}
|
232
286
|
|
233
|
-
/**
|
287
|
+
/**
|
288
|
+
* @notice Encode all of a record's fields.
|
289
|
+
* @return The static (fixed length) data, encoded into a sequence of bytes.
|
290
|
+
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
291
|
+
* @return The dyanmic (variable length) data, encoded into a sequence of bytes.
|
292
|
+
*/
|
234
293
|
function encode(uint256 maxTimestamp) internal pure returns (bytes memory, PackedCounter, bytes memory) {
|
235
294
|
bytes memory _staticData = encodeStatic(maxTimestamp);
|
236
295
|
|
@@ -240,7 +299,9 @@ library TimeboundDelegations {
|
|
240
299
|
return (_staticData, _encodedLengths, _dynamicData);
|
241
300
|
}
|
242
301
|
|
243
|
-
/**
|
302
|
+
/**
|
303
|
+
* @notice Encode keys as a bytes32 array using this table's field layout.
|
304
|
+
*/
|
244
305
|
function encodeKeyTuple(address delegator, address delegatee) internal pure returns (bytes32[] memory) {
|
245
306
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
246
307
|
_keyTuple[0] = bytes32(uint256(uint160(delegator)));
|