@latticexyz/world-module-erc20 2.2.21-581228bd857077023efdb496a9a44fa62ff89936 → 2.2.21-a1b22c2778fe67a4457042f68a7240465c07183d

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 (80) hide show
  1. package/dist/{ccip-VJWDNI4X.js → ccip-VIBPEQNI.js} +3 -3
  2. package/dist/{chunk-2VXHCW2O.js → chunk-M5FHJZR5.js} +37 -30
  3. package/dist/chunk-M5FHJZR5.js.map +1 -0
  4. package/dist/{chunk-LIWKL347.js → chunk-XE443CMG.js} +305 -249
  5. package/dist/chunk-XE443CMG.js.map +1 -0
  6. package/dist/internal.js +2 -2
  7. package/dist/{secp256k1-XVT662DN.js → secp256k1-QT34R5PW.js} +507 -428
  8. package/dist/secp256k1-QT34R5PW.js.map +1 -0
  9. package/out/AccessManagementSystem.sol/AccessManagementSystem.json +1 -1
  10. package/out/BalanceTransferSystem.sol/BalanceTransferSystem.json +1 -1
  11. package/out/BatchCallSystem.sol/BatchCallSystem.json +1 -1
  12. package/out/Constants.sol/ERC20TableNames.json +1 -1
  13. package/out/Constants.sol/ModuleConstants.json +1 -1
  14. package/out/Constants.sol/PausableTableNames.json +1 -1
  15. package/out/ERC20BaseTest.t.sol/ERC20BehaviorTest.abi.json +324 -0
  16. package/out/ERC20BaseTest.t.sol/ERC20BehaviorTest.abi.json.d.ts +324 -0
  17. package/out/ERC20BaseTest.t.sol/ERC20BehaviorTest.json +1 -1
  18. package/out/ERC20BaseTest.t.sol/ERC20Test.abi.json +324 -0
  19. package/out/ERC20BaseTest.t.sol/ERC20Test.abi.json.d.ts +324 -0
  20. package/out/ERC20BaseTest.t.sol/ERC20Test.json +1 -1
  21. package/out/ERC20BaseTest.t.sol/MockERC20Base.abi.json +21 -280
  22. package/out/ERC20BaseTest.t.sol/MockERC20Base.abi.json.d.ts +21 -280
  23. package/out/ERC20BaseTest.t.sol/MockERC20Base.json +1 -1
  24. package/out/ERC20Burnable.sol/ERC20Burnable.abi.json +8 -317
  25. package/out/ERC20Burnable.sol/ERC20Burnable.abi.json.d.ts +8 -317
  26. package/out/ERC20Burnable.sol/ERC20Burnable.json +1 -1
  27. package/out/ERC20Burnable.t.sol/ERC20BurnableTest.abi.json +324 -0
  28. package/out/ERC20Burnable.t.sol/ERC20BurnableTest.abi.json.d.ts +324 -0
  29. package/out/ERC20Burnable.t.sol/ERC20BurnableTest.json +1 -1
  30. package/out/ERC20Burnable.t.sol/MockERC20Burnable.abi.json +25 -279
  31. package/out/ERC20Burnable.t.sol/MockERC20Burnable.abi.json.d.ts +25 -279
  32. package/out/ERC20Burnable.t.sol/MockERC20Burnable.json +1 -1
  33. package/out/ERC20Module.sol/ERC20Module.json +1 -1
  34. package/out/ERC20Module.sol/ERC20ModuleLib.json +1 -0
  35. package/out/ERC20Module.t.sol/ERC20ModuleTest.json +1 -1
  36. package/out/ERC20Module.t.sol/TestConstants.json +1 -1
  37. package/out/ERC20Pausable.sol/ERC20Pausable.abi.json +8 -317
  38. package/out/ERC20Pausable.sol/ERC20Pausable.abi.json.d.ts +8 -317
  39. package/out/ERC20Pausable.sol/ERC20Pausable.json +1 -1
  40. package/out/ERC20Pausable.t.sol/{ERC20PausableBehaviorTest.abi.json → ERC20PausableTest.abi.json} +324 -0
  41. package/out/ERC20Pausable.t.sol/{ERC20PausableBehaviorTest.abi.json.d.ts → ERC20PausableTest.abi.json.d.ts} +324 -0
  42. package/out/ERC20Pausable.t.sol/ERC20PausableTest.json +1 -0
  43. package/out/ERC20Pausable.t.sol/MockERC20Pausable.abi.json +25 -279
  44. package/out/ERC20Pausable.t.sol/MockERC20Pausable.abi.json.d.ts +25 -279
  45. package/out/ERC20Pausable.t.sol/MockERC20Pausable.json +1 -1
  46. package/out/ERC20PausableBurnable.sol/ERC20PausableBurnable.abi.json +50 -284
  47. package/out/ERC20PausableBurnable.sol/ERC20PausableBurnable.abi.json.d.ts +50 -284
  48. package/out/ERC20PausableBurnable.sol/ERC20PausableBurnable.json +1 -1
  49. package/out/InitModule.sol/InitModule.json +1 -1
  50. package/out/MUDERC20.sol/MUDERC20.abi.json +8 -317
  51. package/out/MUDERC20.sol/MUDERC20.abi.json.d.ts +8 -317
  52. package/out/MUDERC20.sol/MUDERC20.json +1 -1
  53. package/out/Pausable.sol/Pausable.abi.json +8 -369
  54. package/out/Pausable.sol/Pausable.abi.json.d.ts +8 -369
  55. package/out/Pausable.sol/Pausable.json +1 -1
  56. package/out/RegistrationSystem.sol/RegistrationSystem.json +1 -1
  57. package/out/World.sol/World.json +1 -1
  58. package/out/WorldConsumer.sol/WorldConsumer.abi.json +8 -45
  59. package/out/WorldConsumer.sol/WorldConsumer.abi.json.d.ts +8 -45
  60. package/out/WorldConsumer.sol/WorldConsumer.json +1 -1
  61. package/out/build-info/{575e1001b22e51590748b4ce55e7c596.json → 5dec426f2d87057b9b49f18296a28057.json} +1 -1
  62. package/package.json +8 -8
  63. package/src/examples/ERC20PausableBurnable.sol +21 -8
  64. package/src/experimental/Constants.sol +0 -4
  65. package/src/experimental/ERC20Module.sol +46 -9
  66. package/src/experimental/ERC20Pausable.sol +3 -0
  67. package/src/experimental/MUDERC20.sol +24 -29
  68. package/src/experimental/Pausable.sol +15 -15
  69. package/dist/chunk-2VXHCW2O.js.map +0 -1
  70. package/dist/chunk-LIWKL347.js.map +0 -1
  71. package/dist/secp256k1-XVT662DN.js.map +0 -1
  72. package/out/Constants.sol/OwnableTableNames.abi.json +0 -1
  73. package/out/Constants.sol/OwnableTableNames.json +0 -1
  74. package/out/ERC20BaseTest.t.sol/TestConstants.abi.json +0 -1
  75. package/out/ERC20BaseTest.t.sol/TestConstants.json +0 -1
  76. package/out/ERC20Module.sol/ERC20RegistryLib.json +0 -1
  77. package/out/ERC20Pausable.t.sol/ERC20PausableBehaviorTest.json +0 -1
  78. /package/dist/{ccip-VJWDNI4X.js.map → ccip-VIBPEQNI.js.map} +0 -0
  79. /package/out/ERC20Module.sol/{ERC20RegistryLib.abi.json → ERC20ModuleLib.abi.json} +0 -0
  80. /package/out/ERC20Module.sol/{ERC20RegistryLib.abi.json.d.ts → ERC20ModuleLib.abi.json.d.ts} +0 -0
@@ -7,30 +7,43 @@ import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
7
7
  import { IBaseWorld } from "@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol";
8
8
  import { WorldConsumer } from "@latticexyz/world-consumer/src/experimental/WorldConsumer.sol";
9
9
 
10
+ import { Pausable } from "../experimental/Pausable.sol";
10
11
  import { ERC20Pausable } from "../experimental/ERC20Pausable.sol";
11
12
  import { ERC20Burnable } from "../experimental/ERC20Burnable.sol";
12
13
  import { MUDERC20 } from "../experimental/MUDERC20.sol";
13
14
 
14
15
  contract ERC20PausableBurnable is MUDERC20, ERC20Pausable, ERC20Burnable {
16
+ error ERC20PausableBurnable_AlreadyInitialized();
17
+
18
+ bytes14 private immutable _namespace;
19
+
15
20
  constructor(
16
21
  IBaseWorld world,
17
22
  bytes14 namespace,
18
- string memory name,
19
- string memory symbol
20
- ) WorldConsumer(world, namespace, true) MUDERC20(name, symbol) {
21
- // Transfer namespace ownership to the creator
22
- world.transferOwnership(namespaceId, _msgSender());
23
+ ResourceId totalSupplyId,
24
+ ResourceId balancesId,
25
+ ResourceId allowancesId,
26
+ ResourceId metadataId,
27
+ ResourceId pausedId
28
+ ) WorldConsumer(world) MUDERC20(totalSupplyId, balancesId, allowancesId, metadataId) ERC20Pausable(pausedId) {
29
+ // Namespace used for access control
30
+ _namespace = namespace;
31
+ }
32
+
33
+ function initialize(string memory name, string memory symbol) external onlyNamespaceOwner(_namespace) {
34
+ _MUDERC20_init(name, symbol);
35
+ _Pausable_init();
23
36
  }
24
37
 
25
- function mint(address to, uint256 value) public onlyNamespace {
38
+ function mint(address to, uint256 value) public onlyNamespace(_namespace) {
26
39
  _mint(to, value);
27
40
  }
28
41
 
29
- function pause() public onlyNamespace {
42
+ function pause() public onlyNamespace(_namespace) {
30
43
  _pause();
31
44
  }
32
45
 
33
- function unpause() public onlyNamespace {
46
+ function unpause() public onlyNamespace(_namespace) {
34
47
  _unpause();
35
48
  }
36
49
 
@@ -27,10 +27,6 @@ library ERC20TableNames {
27
27
  bytes16 internal constant METADATA = "Metadata";
28
28
  }
29
29
 
30
- library OwnableTableNames {
31
- bytes16 internal constant OWNER = "Owner";
32
- }
33
-
34
30
  library PausableTableNames {
35
31
  bytes16 internal constant PAUSED = "Paused";
36
32
  }
@@ -3,16 +3,23 @@ pragma solidity >=0.8.24;
3
3
 
4
4
  import { ResourceIds } from "@latticexyz/store/src/codegen/tables/ResourceIds.sol";
5
5
  import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
6
+ import { RESOURCE_TABLE } from "@latticexyz/store/src/storeResourceTypes.sol";
6
7
 
7
8
  import { Module } from "@latticexyz/world/src/Module.sol";
8
9
  import { RESOURCE_SYSTEM } from "@latticexyz/world/src/worldResourceTypes.sol";
9
10
  import { WorldResourceIdLib } from "@latticexyz/world/src/WorldResourceId.sol";
10
11
  import { IBaseWorld } from "@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol";
11
- import { revertWithBytes } from "@latticexyz/world/src/revertWithBytes.sol";
12
12
 
13
13
  import { ERC20Registry } from "../codegen/tables/ERC20Registry.sol";
14
14
  import { ERC20PausableBurnable } from "../examples/ERC20PausableBurnable.sol";
15
- import { ModuleConstants } from "./Constants.sol";
15
+ import { MUDERC20 } from "../experimental/MUDERC20.sol";
16
+ import { ModuleConstants, ERC20TableNames, PausableTableNames } from "./Constants.sol";
17
+
18
+ import { ERC20Metadata, ERC20MetadataData } from "../codegen/tables/ERC20Metadata.sol";
19
+ import { TotalSupply } from "../codegen/tables/TotalSupply.sol";
20
+ import { Balances } from "../codegen/tables/Balances.sol";
21
+ import { Allowances } from "../codegen/tables/Allowances.sol";
22
+ import { Paused } from "../codegen/tables/Paused.sol";
16
23
 
17
24
  contract ERC20Module is Module {
18
25
  error ERC20Module_InvalidNamespace(bytes14 namespace);
@@ -39,23 +46,53 @@ contract ERC20Module is Module {
39
46
 
40
47
  IBaseWorld world = IBaseWorld(_world());
41
48
 
42
- ERC20PausableBurnable token = new ERC20PausableBurnable(world, namespace, name, symbol);
49
+ world.registerNamespace(namespaceId);
50
+
51
+ ERC20PausableBurnable token = ERC20ModuleLib.deployAndRegisterTables(world, namespace);
43
52
 
44
- // Grant access to the token so it can write to tables after transferring ownership
53
+ // Grant access to the token so it can register and write to tables after transferring ownership
45
54
  world.grantAccess(namespaceId, address(token));
46
55
 
47
56
  // Register token as a system so its functions can be called through the world
48
57
  world.registerSystem(systemId, token, true);
49
58
 
50
- // The token should have transferred the namespace ownership to this module in its constructor
51
- world.transferOwnership(namespaceId, _msgSender());
59
+ // Set metadata and paused state by calling initialize (onlyNamespaceOwner)
60
+ world.call(systemId, abi.encodeCall(ERC20PausableBurnable.initialize, (name, symbol)));
52
61
 
53
- ERC20RegistryLib.register(world, namespaceId, address(token));
62
+ ERC20ModuleLib.registerToken(world, namespaceId, address(token));
63
+
64
+ world.transferOwnership(namespaceId, _msgSender());
54
65
  }
55
66
  }
56
67
 
57
- library ERC20RegistryLib {
58
- function register(IBaseWorld world, ResourceId namespaceId, address token) public {
68
+ library ERC20ModuleLib {
69
+ function deployAndRegisterTables(IBaseWorld world, bytes14 namespace) public returns (ERC20PausableBurnable) {
70
+ ResourceId totalSupplyId = WorldResourceIdLib.encode(RESOURCE_TABLE, namespace, ERC20TableNames.TOTAL_SUPPLY);
71
+ ResourceId balancesId = WorldResourceIdLib.encode(RESOURCE_TABLE, namespace, ERC20TableNames.BALANCES);
72
+ ResourceId allowancesId = WorldResourceIdLib.encode(RESOURCE_TABLE, namespace, ERC20TableNames.ALLOWANCES);
73
+ ResourceId metadataId = WorldResourceIdLib.encode(RESOURCE_TABLE, namespace, ERC20TableNames.METADATA);
74
+ ResourceId pausedId = WorldResourceIdLib.encode(RESOURCE_TABLE, namespace, PausableTableNames.PAUSED);
75
+
76
+ // Register each table
77
+ TotalSupply.register(totalSupplyId);
78
+ Balances.register(balancesId);
79
+ Allowances.register(allowancesId);
80
+ ERC20Metadata.register(metadataId);
81
+ Paused.register(pausedId);
82
+
83
+ return
84
+ new ERC20PausableBurnable({
85
+ world: world,
86
+ namespace: namespace,
87
+ totalSupplyId: totalSupplyId,
88
+ balancesId: balancesId,
89
+ allowancesId: allowancesId,
90
+ metadataId: metadataId,
91
+ pausedId: pausedId
92
+ });
93
+ }
94
+
95
+ function registerToken(IBaseWorld world, ResourceId namespaceId, address token) public {
59
96
  ResourceId erc20RegistryTableId = ModuleConstants.registryTableId();
60
97
  if (!ResourceIds.getExists(erc20RegistryTableId)) {
61
98
  world.registerNamespace(ModuleConstants.namespaceId());
@@ -2,10 +2,13 @@
2
2
  // Adapted from OpenZeppelin's [ERC20Pausable extenstion](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/f989fff93168606c726bc5e831ef50dd6e543f45/contracts/token/ERC20/extensions/ERC20Pausable.sol)
3
3
  pragma solidity >=0.8.24;
4
4
 
5
+ import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
5
6
  import { Pausable } from "./Pausable.sol";
6
7
  import { MUDERC20 } from "./MUDERC20.sol";
7
8
 
8
9
  abstract contract ERC20Pausable is MUDERC20, Pausable {
10
+ constructor(ResourceId pausedId) Pausable(pausedId) {}
11
+
9
12
  function _update(address from, address to, uint256 value) internal virtual override whenNotPaused {
10
13
  super._update(from, to, value);
11
14
  }
@@ -19,25 +19,16 @@ import { IERC20Errors } from "../interfaces/IERC20Errors.sol";
19
19
  import { ERC20TableNames } from "./Constants.sol";
20
20
 
21
21
  abstract contract MUDERC20 is IERC20, IERC20Metadata, IERC20Errors, WorldConsumer {
22
- ResourceId internal immutable totalSupplyId;
23
- ResourceId internal immutable balancesId;
24
- ResourceId internal immutable allowancesId;
25
- ResourceId internal immutable metadataId;
26
-
27
- constructor(string memory _name, string memory _symbol) {
28
- // Needs to be inlined in the constructor
29
- totalSupplyId = WorldResourceIdLib.encode(RESOURCE_TABLE, namespace, ERC20TableNames.TOTAL_SUPPLY);
30
- balancesId = WorldResourceIdLib.encode(RESOURCE_TABLE, namespace, ERC20TableNames.BALANCES);
31
- allowancesId = WorldResourceIdLib.encode(RESOURCE_TABLE, namespace, ERC20TableNames.ALLOWANCES);
32
- metadataId = WorldResourceIdLib.encode(RESOURCE_TABLE, namespace, ERC20TableNames.METADATA);
33
-
34
- // Register each table
35
- TotalSupply.register(totalSupplyId);
36
- Balances.register(balancesId);
37
- Allowances.register(allowancesId);
38
- ERC20Metadata.register(metadataId);
39
-
40
- _setMetadata(_name, _symbol, 18);
22
+ ResourceId private immutable _totalSupplyId;
23
+ ResourceId private immutable _balancesId;
24
+ ResourceId private immutable _allowancesId;
25
+ ResourceId private immutable _metadataId;
26
+
27
+ constructor(ResourceId totalSupplyId, ResourceId balancesId, ResourceId allowancesId, ResourceId metadataId) {
28
+ _totalSupplyId = totalSupplyId;
29
+ _balancesId = balancesId;
30
+ _allowancesId = allowancesId;
31
+ _metadataId = metadataId;
41
32
  }
42
33
 
43
34
  /**
@@ -153,6 +144,10 @@ abstract contract MUDERC20 is IERC20, IERC20Metadata, IERC20Errors, WorldConsume
153
144
  return true;
154
145
  }
155
146
 
147
+ function _MUDERC20_init(string memory _name, string memory _symbol) internal {
148
+ _setMetadata(_name, _symbol, 18);
149
+ }
150
+
156
151
  /**
157
152
  * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
158
153
  * Relies on the `_update` mechanism
@@ -284,43 +279,43 @@ abstract contract MUDERC20 is IERC20, IERC20Metadata, IERC20Errors, WorldConsume
284
279
  }
285
280
 
286
281
  function _getName() internal view returns (string memory) {
287
- return ERC20Metadata.getName(metadataId);
282
+ return ERC20Metadata.getName(_metadataId);
288
283
  }
289
284
 
290
285
  function _getSymbol() internal view returns (string memory) {
291
- return ERC20Metadata.getSymbol(metadataId);
286
+ return ERC20Metadata.getSymbol(_metadataId);
292
287
  }
293
288
 
294
289
  function _getDecimals() internal view returns (uint8) {
295
- return ERC20Metadata.getDecimals(metadataId);
290
+ return ERC20Metadata.getDecimals(_metadataId);
296
291
  }
297
292
 
298
293
  function _getTotalSupply() internal view returns (uint256) {
299
- return TotalSupply.get(totalSupplyId);
294
+ return TotalSupply.get(_totalSupplyId);
300
295
  }
301
296
 
302
297
  function _getBalance(address account) internal view returns (uint256) {
303
- return Balances.get(balancesId, account);
298
+ return Balances.get(_balancesId, account);
304
299
  }
305
300
 
306
301
  function _getAllowance(address owner, address spender) internal view returns (uint256) {
307
- return Allowances.get(allowancesId, owner, spender);
302
+ return Allowances.get(_allowancesId, owner, spender);
308
303
  }
309
304
 
310
305
  function _setTotalSupply(uint256 value) internal virtual {
311
- TotalSupply.set(totalSupplyId, value);
306
+ TotalSupply.set(_totalSupplyId, value);
312
307
  }
313
308
 
314
309
  function _setBalance(address account, uint256 value) internal virtual {
315
- Balances.set(balancesId, account, value);
310
+ Balances.set(_balancesId, account, value);
316
311
  }
317
312
 
318
313
  function _setAllowance(address owner, address spender, uint256 value) internal virtual {
319
- Allowances.set(allowancesId, owner, spender, value);
314
+ Allowances.set(_allowancesId, owner, spender, value);
320
315
  }
321
316
 
322
317
  function _setMetadata(string memory _name, string memory _symbol, uint8 _decimals) internal virtual {
323
318
  ERC20MetadataData memory metadata = ERC20MetadataData(_decimals, _name, _symbol);
324
- ERC20Metadata.set(metadataId, metadata);
319
+ ERC20Metadata.set(_metadataId, metadata);
325
320
  }
326
321
  }
@@ -2,13 +2,11 @@
2
2
  // Adapted from OpenZeppelin Contracts [utils/Pausable.sol](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/f989fff93168606c726bc5e831ef50dd6e543f45/contracts/utils/Pausable.sol)
3
3
  pragma solidity >=0.8.24;
4
4
 
5
- import { RESOURCE_TABLE } from "@latticexyz/store/src/storeResourceTypes.sol";
6
5
  import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
7
6
  import { WorldResourceIdLib } from "@latticexyz/world/src/WorldResourceId.sol";
8
7
  import { WorldConsumer } from "@latticexyz/world-consumer/src/experimental/WorldConsumer.sol";
9
8
 
10
9
  import { Paused as PausedTable } from "../codegen/tables/Paused.sol";
11
- import { PausableTableNames } from "./Constants.sol";
12
10
 
13
11
  /**
14
12
  * @dev Contract module which allows children to implement an emergency stop
@@ -20,7 +18,7 @@ import { PausableTableNames } from "./Constants.sol";
20
18
  * simply including this module, only once the modifiers are put in place.
21
19
  */
22
20
  abstract contract Pausable is WorldConsumer {
23
- ResourceId internal immutable pausedId;
21
+ ResourceId private immutable _pausedId;
24
22
 
25
23
  /**
26
24
  * @dev Emitted when the pause is triggered by `account`.
@@ -42,15 +40,6 @@ abstract contract Pausable is WorldConsumer {
42
40
  */
43
41
  error ExpectedPause();
44
42
 
45
- /**
46
- * @dev Initializes the contract in unpaused state.
47
- */
48
- constructor() {
49
- pausedId = WorldResourceIdLib.encode(RESOURCE_TABLE, namespace, PausableTableNames.PAUSED);
50
- PausedTable.register(pausedId);
51
- PausedTable.set(pausedId, false);
52
- }
53
-
54
43
  /**
55
44
  * @dev Modifier to make a function callable only when the contract is not paused.
56
45
  *
@@ -75,11 +64,22 @@ abstract contract Pausable is WorldConsumer {
75
64
  _;
76
65
  }
77
66
 
67
+ constructor(ResourceId pausedId) {
68
+ _pausedId = pausedId;
69
+ }
70
+
71
+ /**
72
+ * @dev Initializes the contract in unpaused state.
73
+ */
74
+ function _Pausable_init() internal {
75
+ PausedTable.set(_pausedId, false);
76
+ }
77
+
78
78
  /**
79
79
  * @dev Returns true if the contract is paused, and false otherwise.
80
80
  */
81
81
  function paused() public view virtual returns (bool) {
82
- return PausedTable.get(pausedId);
82
+ return PausedTable.get(_pausedId);
83
83
  }
84
84
 
85
85
  /**
@@ -108,7 +108,7 @@ abstract contract Pausable is WorldConsumer {
108
108
  * - The contract must not be paused.
109
109
  */
110
110
  function _pause() internal virtual whenNotPaused {
111
- PausedTable.set(pausedId, true);
111
+ PausedTable.set(_pausedId, true);
112
112
  emit Paused(_msgSender());
113
113
  }
114
114
 
@@ -120,7 +120,7 @@ abstract contract Pausable is WorldConsumer {
120
120
  * - The contract must be paused.
121
121
  */
122
122
  function _unpause() internal virtual whenPaused {
123
- PausedTable.set(pausedId, false);
123
+ PausedTable.set(_pausedId, false);
124
124
  emit Unpaused(_msgSender());
125
125
  }
126
126
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/src/cryptoNode.ts","../../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/src/_assert.ts","../../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/src/utils.ts"],"sourcesContent":["// We prefer WebCrypto aka globalThis.crypto, which exists in node.js 16+.\n// Falls back to Node.js built-in crypto for Node.js <=v14\n// See utils.ts for details.\n// @ts-ignore\nimport * as nc from 'node:crypto';\nexport const crypto =\n nc && typeof nc === 'object' && 'webcrypto' in nc\n ? (nc.webcrypto as any)\n : nc && typeof nc === 'object' && 'randomBytes' in nc\n ? nc\n : undefined;\n","function number(n: number) {\n if (!Number.isSafeInteger(n) || n < 0) throw new Error(`positive integer expected, not ${n}`);\n}\n\nfunction bool(b: boolean) {\n if (typeof b !== 'boolean') throw new Error(`boolean expected, not ${b}`);\n}\n\n// copied from utils\nexport function isBytes(a: unknown): a is Uint8Array {\n return (\n a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array')\n );\n}\n\nfunction bytes(b: Uint8Array | undefined, ...lengths: number[]) {\n if (!isBytes(b)) throw new Error('Uint8Array expected');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);\n}\n\ntype Hash = {\n (data: Uint8Array): Uint8Array;\n blockLen: number;\n outputLen: number;\n create: any;\n};\nfunction hash(h: Hash) {\n if (typeof h !== 'function' || typeof h.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(h.outputLen);\n number(h.blockLen);\n}\n\nfunction exists(instance: any, checkFinished = true) {\n if (instance.destroyed) throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called');\n}\nfunction output(out: any, instance: any) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\n\nexport { number, bool, bytes, hash, exists, output };\n\nconst assert = { number, bool, bytes, hash, exists, output };\nexport default assert;\n","/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\nimport { bytes as abytes } from './_assert.js';\n// export { isBytes } from './_assert.js';\n// We can't reuse isBytes from _assert, because somehow this causes huge perf issues\nexport function isBytes(a: unknown): a is Uint8Array {\n return (\n a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array')\n );\n}\n\n// prettier-ignore\nexport type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array |\n Uint16Array | Int16Array | Uint32Array | Int32Array;\n\n// Cast array to different type\nexport const u8 = (arr: TypedArray) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr: TypedArray) =>\n new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n\n// Cast array to view\nexport const createView = (arr: TypedArray) =>\n new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word: number, shift: number) => (word << (32 - shift)) | (word >>> shift);\n// The rotate left (circular left shift) operation for uint32\nexport const rotl = (word: number, shift: number) =>\n (word << shift) | ((word >>> (32 - shift)) >>> 0);\n\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\n// The byte swap operation for uint32\nexport const byteSwap = (word: number) =>\n ((word << 24) & 0xff000000) |\n ((word << 8) & 0xff0000) |\n ((word >>> 8) & 0xff00) |\n ((word >>> 24) & 0xff);\n// Conditionally byte swap if on a big-endian platform\nexport const byteSwapIfBE = isLE ? (n: number) => n : (n: number) => byteSwap(n);\n\n// In place byte swap for Uint32Array\nexport function byteSwap32(arr: Uint32Array) {\n for (let i = 0; i < arr.length; i++) {\n arr[i] = byteSwap(arr[i]);\n }\n}\n\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) =>\n i.toString(16).padStart(2, '0')\n);\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes: Uint8Array): string {\n abytes(bytes);\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 } as const;\nfunction asciiToBase16(char: number): number | undefined {\n if (char >= asciis._0 && char <= asciis._9) return char - asciis._0;\n if (char >= asciis._A && char <= asciis._F) return char - (asciis._A - 10);\n if (char >= asciis._a && char <= asciis._f) return char - (asciis._a - 10);\n return;\n}\n\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex: string): Uint8Array {\n if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex);\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2) throw new Error('padded hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2;\n }\n return array;\n}\n\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => {};\n\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters: number, tick: number, cb: (i: number) => void) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick) continue;\n await nextTick();\n ts += diff;\n }\n}\n\n// Global symbols in both browsers and Node.js since v11\n// See https://github.com/microsoft/TypeScript/issues/31535\ndeclare const TextEncoder: any;\n\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str: string): Uint8Array {\n if (typeof str !== 'string') throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n\nexport type Input = Uint8Array | string;\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data: Input): Uint8Array {\n if (typeof data === 'string') data = utf8ToBytes(data);\n abytes(data);\n return data;\n}\n\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays: Uint8Array[]): Uint8Array {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n abytes(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n\n// For runtime check if class implements interface\nexport abstract class Hash<T extends Hash<T>> {\n abstract blockLen: number; // Bytes per block\n abstract outputLen: number; // Bytes in output\n abstract update(buf: Input): this;\n // Writes digest into buf\n abstract digestInto(buf: Uint8Array): void;\n abstract digest(): Uint8Array;\n /**\n * Resets internal state. Makes Hash instance unusable.\n * Reset is impossible for keyed hashes if key is consumed into state. If digest is not consumed\n * by user, they will need to manually call `destroy()` when zeroing is necessary.\n */\n abstract destroy(): void;\n /**\n * Clones hash instance. Unsafe: doesn't check whether `to` is valid. Can be used as `clone()`\n * when no options are passed.\n * Reasons to use `_cloneInto` instead of clone: 1) performance 2) reuse instance => all internal\n * buffers are overwritten => causes buffer overwrite which is used for digest in some cases.\n * There are no guarantees for clean-up because it's impossible in JS.\n */\n abstract _cloneInto(to?: T): T;\n // Safe version that clones internal state\n clone(): T {\n return this._cloneInto();\n }\n}\n\n/**\n * XOF: streaming API to read digest in chunks.\n * Same as 'squeeze' in keccak/k12 and 'seek' in blake3, but more generic name.\n * When hash used in XOF mode it is up to user to call '.destroy' afterwards, since we cannot\n * destroy state, next call can require more bytes.\n */\nexport type HashXOF<T extends Hash<T>> = Hash<T> & {\n xof(bytes: number): Uint8Array; // Read 'bytes' bytes from digest stream\n xofInto(buf: Uint8Array): Uint8Array; // read buf.length bytes from digest stream into buf\n};\n\nconst toStr = {}.toString;\ntype EmptyObj = {};\nexport function checkOpts<T1 extends EmptyObj, T2 extends EmptyObj>(\n defaults: T1,\n opts?: T2\n): T1 & T2 {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged as T1 & T2;\n}\n\nexport type CHash = ReturnType<typeof wrapConstructor>;\n\nexport function wrapConstructor<T extends Hash<T>>(hashCons: () => Hash<T>) {\n const hashC = (msg: Input): Uint8Array => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\n\nexport function wrapConstructorWithOpts<H extends Hash<H>, T extends Object>(\n hashCons: (opts?: T) => Hash<H>\n) {\n const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({} as T);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts: T) => hashCons(opts);\n return hashC;\n}\n\nexport function wrapXOFConstructorWithOpts<H extends HashXOF<H>, T extends Object>(\n hashCons: (opts?: T) => HashXOF<H>\n) {\n const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({} as T);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts: T) => hashCons(opts);\n return hashC;\n}\n\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nexport function randomBytes(bytesLength = 32): Uint8Array {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n // Legacy Node.js compatibility\n if (crypto && typeof crypto.randomBytes === 'function') {\n return crypto.randomBytes(bytesLength);\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n"],"mappings":";AAIA,YAAY,QAAQ;AACb,IAAM,SACX,MAAM,OAAO,OAAO,YAAY,eAAe,KACvC,eACJ,MAAM,OAAO,OAAO,YAAY,iBAAiB,KAC/C,KACA;;;ACVR,SAAS,OAAO,GAAS;AACvB,MAAI,CAAC,OAAO,cAAc,CAAC,KAAK,IAAI;AAAG,UAAM,IAAI,MAAM,kCAAkC,CAAC,EAAE;AAC9F;AAOM,SAAU,QAAQ,GAAU;AAChC,SACE,aAAa,cACZ,KAAK,QAAQ,OAAO,MAAM,YAAY,EAAE,YAAY,SAAS;AAElE;AAEA,SAAS,MAAM,MAA8B,SAAiB;AAC5D,MAAI,CAAC,QAAQ,CAAC;AAAG,UAAM,IAAI,MAAM,qBAAqB;AAC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