@latticexyz/world-modules 2.2.17-32649080323d2a27cdf4a189917a70b958d062da → 2.2.17-3d5b7b75c5c68f4c7499ecd2fcf6e3b2b40c6ad5

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.
Files changed (130) hide show
  1. package/dist/mud.config.d.ts +1 -57
  2. package/dist/mud.config.js +1 -1
  3. package/dist/mud.config.js.map +1 -1
  4. package/out/AccessManagementSystem.sol/AccessManagementSystem.json +1 -1
  5. package/out/Allowances.sol/Allowances.json +1 -1
  6. package/out/ArrayLib.sol/ArrayLib.json +1 -1
  7. package/out/BalanceTransferSystem.sol/BalanceTransferSystem.json +1 -1
  8. package/out/Balances.sol/Balances.json +1 -1
  9. package/out/BatchCallSystem.sol/BatchCallSystem.json +1 -1
  10. package/out/CallboundDelegationControl.sol/CallboundDelegationControl.json +1 -1
  11. package/out/CallboundDelegations.sol/CallboundDelegations.json +1 -1
  12. package/out/DelegationControlMock.sol/DelegationControlMock.json +1 -1
  13. package/out/ERC20.t.sol/ERC20Test.json +1 -1
  14. package/out/ERC20Metadata.sol/ERC20Metadata.json +1 -1
  15. package/out/ERC20Module.sol/ERC20Module.json +1 -1
  16. package/out/ERC20Module.sol/ERC20ModuleRegistrationLib.json +1 -1
  17. package/out/ERC20Registry.sol/ERC20Registry.json +1 -1
  18. package/out/ERC20System.sol/ERC20System.json +1 -1
  19. package/out/ERC721.t.sol/ERC721Recipient.json +1 -1
  20. package/out/ERC721.t.sol/ERC721Test.json +1 -1
  21. package/out/ERC721.t.sol/ERC721TokenReceiver.json +1 -1
  22. package/out/ERC721.t.sol/NonERC721Recipient.json +1 -1
  23. package/out/ERC721.t.sol/RevertingERC721Recipient.json +1 -1
  24. package/out/ERC721.t.sol/WrongReturnDataERC721Recipient.json +1 -1
  25. package/out/ERC721Metadata.sol/ERC721Metadata.json +1 -1
  26. package/out/ERC721Module.sol/ERC721Module.json +1 -1
  27. package/out/ERC721Module.sol/ERC721ModuleRegistrationLib.json +1 -1
  28. package/out/ERC721Registry.sol/ERC721Registry.json +1 -1
  29. package/out/ERC721System.sol/ERC721System.json +1 -1
  30. package/out/EchoSubscriber.sol/EchoSubscriber.json +1 -1
  31. package/out/GasReporter.sol/GasReporter.json +1 -1
  32. package/out/IERC20.sol/IERC20.json +1 -1
  33. package/out/IERC20Errors.sol/IERC20Errors.json +1 -1
  34. package/out/IERC20Events.sol/IERC20Events.json +1 -1
  35. package/out/IERC20Mintable.sol/IERC20Mintable.json +1 -1
  36. package/out/IERC721.sol/IERC721.json +1 -1
  37. package/out/IERC721Errors.sol/IERC721Errors.json +1 -1
  38. package/out/IERC721Events.sol/IERC721Events.json +1 -1
  39. package/out/IERC721Metadata.sol/IERC721Metadata.json +1 -1
  40. package/out/IERC721Mintable.sol/IERC721Mintable.json +1 -1
  41. package/out/IERC721Receiver.sol/IERC721Receiver.json +1 -1
  42. package/out/InitModule.sol/InitModule.json +1 -1
  43. package/out/KeysInTable.sol/KeysInTable.json +1 -1
  44. package/out/KeysInTableHook.sol/KeysInTableHook.json +1 -1
  45. package/out/KeysInTableModule.sol/KeysInTableModule.json +1 -1
  46. package/out/KeysInTableModule.t.sol/KeysInTableModuleTest.json +1 -1
  47. package/out/KeysWithValue.sol/KeysWithValue.json +1 -1
  48. package/out/KeysWithValueHook.sol/KeysWithValueHook.json +1 -1
  49. package/out/KeysWithValueModule.sol/KeysWithValueModule.json +1 -1
  50. package/out/KeysWithValueModule.t.sol/KeysWithValueModuleTest.json +1 -1
  51. package/out/LibString.sol/LibString.json +1 -1
  52. package/out/ModuleInstallationSystem.sol/ModuleInstallationSystem.json +1 -1
  53. package/out/OperatorApproval.sol/OperatorApproval.json +1 -1
  54. package/out/Owners.sol/Owners.json +1 -1
  55. package/out/Puppet.sol/Puppet.json +1 -1
  56. package/out/PuppetDelegationControl.sol/PuppetDelegationControl.json +1 -1
  57. package/out/PuppetFactorySystem.sol/PuppetFactorySystem.json +1 -1
  58. package/out/PuppetMaster.sol/PuppetMaster.json +1 -1
  59. package/out/PuppetModule.sol/PuppetModule.json +1 -1
  60. package/out/PuppetModule.t.sol/PuppetModuleTest.json +1 -1
  61. package/out/PuppetModule.t.sol/PuppetTestSystem.json +1 -1
  62. package/out/PuppetRegistry.sol/PuppetRegistry.json +1 -1
  63. package/out/RegistrationSystem.sol/RegistrationSystem.json +1 -1
  64. package/out/RevertSubscriber.sol/RevertSubscriber.json +1 -1
  65. package/out/StandardDelegationsModule.sol/StandardDelegationsModule.json +1 -1
  66. package/out/StandardDelegationsModule.t.sol/StandardDelegationsModuleTest.json +1 -1
  67. package/out/StdError.sol/stdError.json +1 -1
  68. package/out/StoreRead.sol/StoreRead.json +1 -1
  69. package/out/StoreRegistrationSystem.sol/StoreRegistrationSystem.json +1 -1
  70. package/out/System.sol/System.json +1 -1
  71. package/out/SystemSwitch.sol/SystemSwitch.json +1 -1
  72. package/out/SystemSwitch.t.sol/EchoSystem.json +1 -1
  73. package/out/SystemSwitch.t.sol/SystemSwitchTest.json +1 -1
  74. package/out/SystemboundDelegationControl.sol/SystemboundDelegationControl.json +1 -1
  75. package/out/SystemboundDelegations.sol/SystemboundDelegations.json +1 -1
  76. package/out/TimeboundDelegationControl.sol/TimeboundDelegationControl.json +1 -1
  77. package/out/TimeboundDelegations.sol/TimeboundDelegations.json +1 -1
  78. package/out/TokenApproval.sol/TokenApproval.json +1 -1
  79. package/out/TokenURI.sol/TokenURI.json +1 -1
  80. package/out/TotalSupply.sol/TotalSupply.json +1 -1
  81. package/out/UniqueEntity.sol/UniqueEntity.json +1 -1
  82. package/out/UniqueEntityModule.sol/UniqueEntityModule.json +1 -1
  83. package/out/UniqueEntityModule.t.sol/UniqueEntityModuleTest.json +1 -1
  84. package/out/UniqueEntityModule.t.sol/UniqueEntityTestSystem.json +1 -1
  85. package/out/UniqueEntitySystem.sol/UniqueEntitySystem.json +1 -1
  86. package/out/UsedKeysIndex.sol/UsedKeysIndex.json +1 -1
  87. package/out/World.sol/World.json +1 -1
  88. package/out/World.t.sol/EchoSystemHook.json +1 -1
  89. package/out/World.t.sol/PayableFallbackSystem.json +1 -1
  90. package/out/World.t.sol/RevertSystemHook.json +1 -1
  91. package/out/World.t.sol/WorldTest.json +1 -1
  92. package/out/World.t.sol/WorldTestSystem.json +1 -1
  93. package/out/WorldRegistrationSystem.sol/WorldRegistrationSystem.json +1 -1
  94. package/out/build-info/{168545c7409f2927f6e50ed7ce0d033c.json → 5adb61cced337bb5e7b3d4344c85094e.json} +1 -1
  95. package/out/query.t.sol/QueryTest.json +1 -1
  96. package/out/test.sol/DSTest.json +1 -1
  97. package/package.json +9 -9
  98. package/src/codegen/index.sol +0 -1
  99. package/out/CallWithSignatureModule.t.sol/Unstable_CallWithSignatureModuleTest.abi.json +0 -541
  100. package/out/CallWithSignatureModule.t.sol/Unstable_CallWithSignatureModuleTest.abi.json.d.ts +0 -543
  101. package/out/CallWithSignatureModule.t.sol/Unstable_CallWithSignatureModuleTest.json +0 -1
  102. package/out/CallWithSignatureNonces.sol/CallWithSignatureNonces.abi.json +0 -1
  103. package/out/CallWithSignatureNonces.sol/CallWithSignatureNonces.json +0 -1
  104. package/out/ECDSA.sol/ECDSA.abi.json +0 -29
  105. package/out/ECDSA.sol/ECDSA.abi.json.d.ts +0 -31
  106. package/out/ECDSA.sol/ECDSA.json +0 -1
  107. package/out/IERC1271.sol/IERC1271.abi.json +0 -26
  108. package/out/IERC1271.sol/IERC1271.abi.json.d.ts +0 -28
  109. package/out/IERC1271.sol/IERC1271.json +0 -1
  110. package/out/IUnstable_CallWithSignatureErrors.sol/IUnstable_CallWithSignatureErrors.abi.json +0 -7
  111. package/out/IUnstable_CallWithSignatureErrors.sol/IUnstable_CallWithSignatureErrors.abi.json.d.ts +0 -9
  112. package/out/IUnstable_CallWithSignatureErrors.sol/IUnstable_CallWithSignatureErrors.json +0 -1
  113. package/out/SignatureChecker.sol/SignatureChecker.abi.json +0 -1
  114. package/out/SignatureChecker.sol/SignatureChecker.json +0 -1
  115. package/out/Unstable_CallWithSignatureModule.sol/Unstable_CallWithSignatureModule.abi.json +0 -436
  116. package/out/Unstable_CallWithSignatureModule.sol/Unstable_CallWithSignatureModule.abi.json.d.ts +0 -438
  117. package/out/Unstable_CallWithSignatureModule.sol/Unstable_CallWithSignatureModule.json +0 -1
  118. package/out/Unstable_CallWithSignatureSystem.sol/Unstable_CallWithSignatureSystem.abi.json +0 -183
  119. package/out/Unstable_CallWithSignatureSystem.sol/Unstable_CallWithSignatureSystem.abi.json.d.ts +0 -185
  120. package/out/Unstable_CallWithSignatureSystem.sol/Unstable_CallWithSignatureSystem.json +0 -1
  121. package/src/modules/callwithsignature/ECDSA.sol +0 -174
  122. package/src/modules/callwithsignature/IERC1271.sol +0 -17
  123. package/src/modules/callwithsignature/IUnstable_CallWithSignatureErrors.sol +0 -9
  124. package/src/modules/callwithsignature/SignatureChecker.sol +0 -50
  125. package/src/modules/callwithsignature/Unstable_CallWithSignatureModule.sol +0 -48
  126. package/src/modules/callwithsignature/Unstable_CallWithSignatureSystem.sol +0 -36
  127. package/src/modules/callwithsignature/constants.sol +0 -10
  128. package/src/modules/callwithsignature/getSignedMessageHash.sol +0 -54
  129. package/src/modules/callwithsignature/tables/CallWithSignatureNonces.sol +0 -199
  130. package/src/modules/callwithsignature/validateCallWithSignature.sol +0 -31
@@ -1,36 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity >=0.8.24;
3
-
4
- import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
5
- import { System } from "@latticexyz/world/src/System.sol";
6
- import { SystemCall } from "@latticexyz/world/src/SystemCall.sol";
7
- import { createDelegation } from "@latticexyz/world/src/modules/init/implementations/createDelegation.sol";
8
-
9
- import { CallWithSignatureNonces } from "./tables/CallWithSignatureNonces.sol";
10
- import { getSignedMessageHash } from "./getSignedMessageHash.sol";
11
- import { ECDSA } from "./ECDSA.sol";
12
- import { validateCallWithSignature } from "./validateCallWithSignature.sol";
13
- import { IUnstable_CallWithSignatureErrors } from "./IUnstable_CallWithSignatureErrors.sol";
14
-
15
- contract Unstable_CallWithSignatureSystem is System, IUnstable_CallWithSignatureErrors {
16
- /**
17
- * @notice Calls a system with a given system ID using the given signature.
18
- * @param signer The address on whose behalf the system is called.
19
- * @param systemId The ID of the system to be called.
20
- * @param callData The ABI data for the system call.
21
- * @param signature The EIP712 signature.
22
- * @return Return data from the system call.
23
- */
24
- function callWithSignature(
25
- address signer,
26
- ResourceId systemId,
27
- bytes memory callData,
28
- bytes memory signature
29
- ) external payable returns (bytes memory) {
30
- validateCallWithSignature(signer, systemId, callData, signature);
31
-
32
- CallWithSignatureNonces._set(signer, CallWithSignatureNonces._get(signer) + 1);
33
-
34
- return SystemCall.callWithHooksOrRevert(signer, systemId, callData, _msgValue());
35
- }
36
- }
@@ -1,10 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity >=0.8.24;
3
-
4
- import { ResourceId } from "@latticexyz/world/src/WorldResourceId.sol";
5
- import { ROOT_NAMESPACE } from "@latticexyz/world/src/constants.sol";
6
- import { RESOURCE_TABLE, RESOURCE_SYSTEM, RESOURCE_NAMESPACE } from "@latticexyz/world/src/worldResourceTypes.sol";
7
-
8
- ResourceId constant DELEGATION_SYSTEM_ID = ResourceId.wrap(
9
- (bytes32(abi.encodePacked(RESOURCE_SYSTEM, ROOT_NAMESPACE, "Delegation")))
10
- );
@@ -1,54 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity >=0.8.24;
3
-
4
- import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
5
- import { WorldResourceIdLib, WorldResourceIdInstance } from "@latticexyz/world/src/WorldResourceId.sol";
6
-
7
- using WorldResourceIdInstance for ResourceId;
8
-
9
- // Note the intended value of the `salt` field is the chain ID.
10
- // It is not included in `chainId`, to allow cross-chain signing without requiring wallets to switch networks.
11
- // The value of this field should be the chain on which the world lives, rather than the chain the wallet is connected to.
12
- bytes32 constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(address verifyingContract,bytes32 salt)");
13
- bytes32 constant CALL_TYPEHASH = keccak256(
14
- "Call(address signer,string systemNamespace,string systemName,bytes callData,uint256 nonce)"
15
- );
16
-
17
- /**
18
- * @notice Generate the message hash for a given delegation signature.
19
- * For EIP712 signatures https://eips.ethereum.org/EIPS/eip-712
20
- * @dev We include the signer address to prevent generating a signature that recovers to a random address that didn't sign the message.
21
- * @param signer The address on whose behalf the system is called.
22
- * @param systemId The ID of the system to be called.
23
- * @param callData The ABI data for the system call.
24
- * @param nonce The nonce of the signer
25
- * @param worldAddress The world address
26
- * @return Return the message hash.
27
- */
28
- function getSignedMessageHash(
29
- address signer,
30
- ResourceId systemId,
31
- bytes memory callData,
32
- uint256 nonce,
33
- address worldAddress
34
- ) view returns (bytes32) {
35
- bytes32 domainSeperator = keccak256(abi.encode(DOMAIN_TYPEHASH, worldAddress, bytes32(block.chainid)));
36
-
37
- return
38
- keccak256(
39
- abi.encodePacked(
40
- "\x19\x01",
41
- domainSeperator,
42
- keccak256(
43
- abi.encode(
44
- CALL_TYPEHASH,
45
- signer,
46
- keccak256(abi.encodePacked(WorldResourceIdLib.toTrimmedString(systemId.getNamespace()))),
47
- keccak256(abi.encodePacked(WorldResourceIdLib.toTrimmedString(systemId.getName()))),
48
- keccak256(callData),
49
- nonce
50
- )
51
- )
52
- )
53
- );
54
- }
@@ -1,199 +0,0 @@
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
- library CallWithSignatureNonces {
20
- // Hex below is the result of `WorldResourceIdLib.encode({ namespace: "", name: "CallWithSignatur", typeId: RESOURCE_TABLE });`
21
- ResourceId constant _tableId = ResourceId.wrap(0x7462000000000000000000000000000043616c6c576974685369676e61747572);
22
-
23
- FieldLayout constant _fieldLayout =
24
- FieldLayout.wrap(0x0020010020000000000000000000000000000000000000000000000000000000);
25
-
26
- // Hex-encoded key schema of (address)
27
- Schema constant _keySchema = Schema.wrap(0x0014010061000000000000000000000000000000000000000000000000000000);
28
- // Hex-encoded value schema of (uint256)
29
- Schema constant _valueSchema = Schema.wrap(0x002001001f000000000000000000000000000000000000000000000000000000);
30
-
31
- /**
32
- * @notice Get the table's key field names.
33
- * @return keyNames An array of strings with the names of key fields.
34
- */
35
- function getKeyNames() internal pure returns (string[] memory keyNames) {
36
- keyNames = new string[](1);
37
- keyNames[0] = "signer";
38
- }
39
-
40
- /**
41
- * @notice Get the table's value field names.
42
- * @return fieldNames An array of strings with the names of value fields.
43
- */
44
- function getFieldNames() internal pure returns (string[] memory fieldNames) {
45
- fieldNames = new string[](1);
46
- fieldNames[0] = "nonce";
47
- }
48
-
49
- /**
50
- * @notice Register the table with its config.
51
- */
52
- function register() internal {
53
- StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames());
54
- }
55
-
56
- /**
57
- * @notice Register the table with its config.
58
- */
59
- function _register() internal {
60
- StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames());
61
- }
62
-
63
- /**
64
- * @notice Get nonce.
65
- */
66
- function getNonce(address signer) internal view returns (uint256 nonce) {
67
- bytes32[] memory _keyTuple = new bytes32[](1);
68
- _keyTuple[0] = bytes32(uint256(uint160(signer)));
69
-
70
- bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
71
- return (uint256(bytes32(_blob)));
72
- }
73
-
74
- /**
75
- * @notice Get nonce.
76
- */
77
- function _getNonce(address signer) internal view returns (uint256 nonce) {
78
- bytes32[] memory _keyTuple = new bytes32[](1);
79
- _keyTuple[0] = bytes32(uint256(uint160(signer)));
80
-
81
- bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
82
- return (uint256(bytes32(_blob)));
83
- }
84
-
85
- /**
86
- * @notice Get nonce.
87
- */
88
- function get(address signer) internal view returns (uint256 nonce) {
89
- bytes32[] memory _keyTuple = new bytes32[](1);
90
- _keyTuple[0] = bytes32(uint256(uint160(signer)));
91
-
92
- bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
93
- return (uint256(bytes32(_blob)));
94
- }
95
-
96
- /**
97
- * @notice Get nonce.
98
- */
99
- function _get(address signer) internal view returns (uint256 nonce) {
100
- bytes32[] memory _keyTuple = new bytes32[](1);
101
- _keyTuple[0] = bytes32(uint256(uint160(signer)));
102
-
103
- bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
104
- return (uint256(bytes32(_blob)));
105
- }
106
-
107
- /**
108
- * @notice Set nonce.
109
- */
110
- function setNonce(address signer, uint256 nonce) internal {
111
- bytes32[] memory _keyTuple = new bytes32[](1);
112
- _keyTuple[0] = bytes32(uint256(uint160(signer)));
113
-
114
- StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((nonce)), _fieldLayout);
115
- }
116
-
117
- /**
118
- * @notice Set nonce.
119
- */
120
- function _setNonce(address signer, uint256 nonce) internal {
121
- bytes32[] memory _keyTuple = new bytes32[](1);
122
- _keyTuple[0] = bytes32(uint256(uint160(signer)));
123
-
124
- StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((nonce)), _fieldLayout);
125
- }
126
-
127
- /**
128
- * @notice Set nonce.
129
- */
130
- function set(address signer, uint256 nonce) internal {
131
- bytes32[] memory _keyTuple = new bytes32[](1);
132
- _keyTuple[0] = bytes32(uint256(uint160(signer)));
133
-
134
- StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((nonce)), _fieldLayout);
135
- }
136
-
137
- /**
138
- * @notice Set nonce.
139
- */
140
- function _set(address signer, uint256 nonce) internal {
141
- bytes32[] memory _keyTuple = new bytes32[](1);
142
- _keyTuple[0] = bytes32(uint256(uint160(signer)));
143
-
144
- StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((nonce)), _fieldLayout);
145
- }
146
-
147
- /**
148
- * @notice Delete all data for given keys.
149
- */
150
- function deleteRecord(address signer) internal {
151
- bytes32[] memory _keyTuple = new bytes32[](1);
152
- _keyTuple[0] = bytes32(uint256(uint160(signer)));
153
-
154
- StoreSwitch.deleteRecord(_tableId, _keyTuple);
155
- }
156
-
157
- /**
158
- * @notice Delete all data for given keys.
159
- */
160
- function _deleteRecord(address signer) internal {
161
- bytes32[] memory _keyTuple = new bytes32[](1);
162
- _keyTuple[0] = bytes32(uint256(uint160(signer)));
163
-
164
- StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout);
165
- }
166
-
167
- /**
168
- * @notice Tightly pack static (fixed length) data using this table's schema.
169
- * @return The static data, encoded into a sequence of bytes.
170
- */
171
- function encodeStatic(uint256 nonce) internal pure returns (bytes memory) {
172
- return abi.encodePacked(nonce);
173
- }
174
-
175
- /**
176
- * @notice Encode all of a record's fields.
177
- * @return The static (fixed length) data, encoded into a sequence of bytes.
178
- * @return The lengths of the dynamic fields (packed into a single bytes32 value).
179
- * @return The dynamic (variable length) data, encoded into a sequence of bytes.
180
- */
181
- function encode(uint256 nonce) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
182
- bytes memory _staticData = encodeStatic(nonce);
183
-
184
- EncodedLengths _encodedLengths;
185
- bytes memory _dynamicData;
186
-
187
- return (_staticData, _encodedLengths, _dynamicData);
188
- }
189
-
190
- /**
191
- * @notice Encode keys as a bytes32 array using this table's field layout.
192
- */
193
- function encodeKeyTuple(address signer) internal pure returns (bytes32[] memory) {
194
- bytes32[] memory _keyTuple = new bytes32[](1);
195
- _keyTuple[0] = bytes32(uint256(uint160(signer)));
196
-
197
- return _keyTuple;
198
- }
199
- }
@@ -1,31 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity >=0.8.24;
3
- import { ResourceId } from "@latticexyz/world/src/WorldResourceId.sol";
4
- import { WorldContextConsumerLib } from "@latticexyz/world/src/WorldContext.sol";
5
- import { CallWithSignatureNonces } from "./tables/CallWithSignatureNonces.sol";
6
- import { getSignedMessageHash } from "./getSignedMessageHash.sol";
7
- import { ECDSA } from "./ECDSA.sol";
8
- import { IUnstable_CallWithSignatureErrors } from "./IUnstable_CallWithSignatureErrors.sol";
9
- import { SignatureChecker } from "./SignatureChecker.sol";
10
-
11
- /**
12
- * @notice Verifies the given system call corresponds to the given signature.
13
- * @param signer The address on whose behalf the system is called.
14
- * @param systemId The ID of the system to be called.
15
- * @param callData The ABI data for the system call.
16
- * @param signature The EIP712 signature.
17
- * @dev Reverts with InvalidSignature(recoveredSigner) if the signature is invalid.
18
- */
19
- function validateCallWithSignature(
20
- address signer,
21
- ResourceId systemId,
22
- bytes memory callData,
23
- bytes memory signature
24
- ) view {
25
- uint256 nonce = CallWithSignatureNonces._get(signer);
26
- bytes32 hash = getSignedMessageHash(signer, systemId, callData, nonce, WorldContextConsumerLib._world());
27
-
28
- if (!SignatureChecker.isValidSignatureNow(signer, hash, signature)) {
29
- revert IUnstable_CallWithSignatureErrors.InvalidSignature();
30
- }
31
- }