@latticexyz/world-module-erc20 2.2.21-581228bd857077023efdb496a9a44fa62ff89936 → 2.2.21-8b83c6b7481219898ab0f8e9c1afd88591646396
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/AccessManagementSystem.sol/AccessManagementSystem.json +1 -1
- package/out/BalanceTransferSystem.sol/BalanceTransferSystem.json +1 -1
- package/out/BatchCallSystem.sol/BatchCallSystem.json +1 -1
- package/out/Constants.sol/ERC20TableNames.json +1 -1
- package/out/Constants.sol/ModuleConstants.json +1 -1
- package/out/Constants.sol/PausableTableNames.json +1 -1
- package/out/ERC20BaseTest.t.sol/ERC20BehaviorTest.abi.json +324 -0
- package/out/ERC20BaseTest.t.sol/ERC20BehaviorTest.abi.json.d.ts +324 -0
- package/out/ERC20BaseTest.t.sol/ERC20BehaviorTest.json +1 -1
- package/out/ERC20BaseTest.t.sol/ERC20Test.abi.json +324 -0
- package/out/ERC20BaseTest.t.sol/ERC20Test.abi.json.d.ts +324 -0
- package/out/ERC20BaseTest.t.sol/ERC20Test.json +1 -1
- package/out/ERC20BaseTest.t.sol/MockERC20Base.abi.json +21 -280
- package/out/ERC20BaseTest.t.sol/MockERC20Base.abi.json.d.ts +21 -280
- package/out/ERC20BaseTest.t.sol/MockERC20Base.json +1 -1
- package/out/ERC20Burnable.sol/ERC20Burnable.abi.json +8 -317
- package/out/ERC20Burnable.sol/ERC20Burnable.abi.json.d.ts +8 -317
- package/out/ERC20Burnable.sol/ERC20Burnable.json +1 -1
- package/out/ERC20Burnable.t.sol/ERC20BurnableTest.abi.json +324 -0
- package/out/ERC20Burnable.t.sol/ERC20BurnableTest.abi.json.d.ts +324 -0
- package/out/ERC20Burnable.t.sol/ERC20BurnableTest.json +1 -1
- package/out/ERC20Burnable.t.sol/MockERC20Burnable.abi.json +25 -279
- package/out/ERC20Burnable.t.sol/MockERC20Burnable.abi.json.d.ts +25 -279
- package/out/ERC20Burnable.t.sol/MockERC20Burnable.json +1 -1
- package/out/ERC20Module.sol/ERC20Module.json +1 -1
- package/out/ERC20Module.sol/ERC20ModuleLib.json +1 -0
- package/out/ERC20Module.t.sol/ERC20ModuleTest.json +1 -1
- package/out/ERC20Module.t.sol/TestConstants.json +1 -1
- package/out/ERC20Pausable.sol/ERC20Pausable.abi.json +8 -317
- package/out/ERC20Pausable.sol/ERC20Pausable.abi.json.d.ts +8 -317
- package/out/ERC20Pausable.sol/ERC20Pausable.json +1 -1
- package/out/ERC20Pausable.t.sol/{ERC20PausableBehaviorTest.abi.json → ERC20PausableTest.abi.json} +324 -0
- package/out/ERC20Pausable.t.sol/{ERC20PausableBehaviorTest.abi.json.d.ts → ERC20PausableTest.abi.json.d.ts} +324 -0
- package/out/ERC20Pausable.t.sol/ERC20PausableTest.json +1 -0
- package/out/ERC20Pausable.t.sol/MockERC20Pausable.abi.json +25 -279
- package/out/ERC20Pausable.t.sol/MockERC20Pausable.abi.json.d.ts +25 -279
- package/out/ERC20Pausable.t.sol/MockERC20Pausable.json +1 -1
- package/out/ERC20PausableBurnable.sol/ERC20PausableBurnable.abi.json +50 -284
- package/out/ERC20PausableBurnable.sol/ERC20PausableBurnable.abi.json.d.ts +50 -284
- package/out/ERC20PausableBurnable.sol/ERC20PausableBurnable.json +1 -1
- package/out/InitModule.sol/InitModule.json +1 -1
- package/out/MUDERC20.sol/MUDERC20.abi.json +8 -317
- package/out/MUDERC20.sol/MUDERC20.abi.json.d.ts +8 -317
- package/out/MUDERC20.sol/MUDERC20.json +1 -1
- package/out/Pausable.sol/Pausable.abi.json +8 -369
- package/out/Pausable.sol/Pausable.abi.json.d.ts +8 -369
- package/out/Pausable.sol/Pausable.json +1 -1
- package/out/RegistrationSystem.sol/RegistrationSystem.json +1 -1
- package/out/World.sol/World.json +1 -1
- package/out/WorldConsumer.sol/WorldConsumer.abi.json +8 -45
- package/out/WorldConsumer.sol/WorldConsumer.abi.json.d.ts +8 -45
- package/out/WorldConsumer.sol/WorldConsumer.json +1 -1
- package/out/build-info/{575e1001b22e51590748b4ce55e7c596.json → 5dec426f2d87057b9b49f18296a28057.json} +1 -1
- package/package.json +8 -8
- package/src/examples/ERC20PausableBurnable.sol +21 -8
- package/src/experimental/Constants.sol +0 -4
- package/src/experimental/ERC20Module.sol +46 -9
- package/src/experimental/ERC20Pausable.sol +3 -0
- package/src/experimental/MUDERC20.sol +24 -29
- package/src/experimental/Pausable.sol +15 -15
- package/out/Constants.sol/OwnableTableNames.abi.json +0 -1
- package/out/Constants.sol/OwnableTableNames.json +0 -1
- package/out/ERC20BaseTest.t.sol/TestConstants.abi.json +0 -1
- package/out/ERC20BaseTest.t.sol/TestConstants.json +0 -1
- package/out/ERC20Module.sol/ERC20RegistryLib.json +0 -1
- package/out/ERC20Pausable.t.sol/ERC20PausableBehaviorTest.json +0 -1
- /package/out/ERC20Module.sol/{ERC20RegistryLib.abi.json → ERC20ModuleLib.abi.json} +0 -0
- /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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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 {
|
|
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
|
-
|
|
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
|
-
//
|
|
51
|
-
world.
|
|
59
|
+
// Set metadata and paused state by calling initialize (onlyNamespaceOwner)
|
|
60
|
+
world.call(systemId, abi.encodeCall(ERC20PausableBurnable.initialize, (name, symbol)));
|
|
52
61
|
|
|
53
|
-
|
|
62
|
+
ERC20ModuleLib.registerToken(world, namespaceId, address(token));
|
|
63
|
+
|
|
64
|
+
world.transferOwnership(namespaceId, _msgSender());
|
|
54
65
|
}
|
|
55
66
|
}
|
|
56
67
|
|
|
57
|
-
library
|
|
58
|
-
function
|
|
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
|
|
23
|
-
ResourceId
|
|
24
|
-
ResourceId
|
|
25
|
-
ResourceId
|
|
26
|
-
|
|
27
|
-
constructor(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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(
|
|
282
|
+
return ERC20Metadata.getName(_metadataId);
|
|
288
283
|
}
|
|
289
284
|
|
|
290
285
|
function _getSymbol() internal view returns (string memory) {
|
|
291
|
-
return ERC20Metadata.getSymbol(
|
|
286
|
+
return ERC20Metadata.getSymbol(_metadataId);
|
|
292
287
|
}
|
|
293
288
|
|
|
294
289
|
function _getDecimals() internal view returns (uint8) {
|
|
295
|
-
return ERC20Metadata.getDecimals(
|
|
290
|
+
return ERC20Metadata.getDecimals(_metadataId);
|
|
296
291
|
}
|
|
297
292
|
|
|
298
293
|
function _getTotalSupply() internal view returns (uint256) {
|
|
299
|
-
return TotalSupply.get(
|
|
294
|
+
return TotalSupply.get(_totalSupplyId);
|
|
300
295
|
}
|
|
301
296
|
|
|
302
297
|
function _getBalance(address account) internal view returns (uint256) {
|
|
303
|
-
return Balances.get(
|
|
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(
|
|
302
|
+
return Allowances.get(_allowancesId, owner, spender);
|
|
308
303
|
}
|
|
309
304
|
|
|
310
305
|
function _setTotalSupply(uint256 value) internal virtual {
|
|
311
|
-
TotalSupply.set(
|
|
306
|
+
TotalSupply.set(_totalSupplyId, value);
|
|
312
307
|
}
|
|
313
308
|
|
|
314
309
|
function _setBalance(address account, uint256 value) internal virtual {
|
|
315
|
-
Balances.set(
|
|
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(
|
|
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(
|
|
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
|
|
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(
|
|
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(
|
|
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(
|
|
123
|
+
PausedTable.set(_pausedId, false);
|
|
124
124
|
emit Unpaused(_msgSender());
|
|
125
125
|
}
|
|
126
126
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"abi":[],"bytecode":{"object":"0x602c6032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f80fdfea164736f6c6343000818000a","sourceMap":"912:74:129:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;912:74:129;;;;;;;;;;;;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x730000000000000000000000000000000000000000301460806040525f80fdfea164736f6c6343000818000a","sourceMap":"912:74:129:-:0;;;;;;;;","linkReferences":{}},"methodIdentifiers":{},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/experimental/Constants.sol\":\"OwnableTableNames\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\"},\"optimizer\":{\"enabled\":true,\"runs\":3000},\"remappings\":[\":@latticexyz/=node_modules/@latticexyz/\",\":ds-test/=node_modules/ds-test/src/\",\":forge-std/=node_modules/forge-std/src/\"]},\"sources\":{\"node_modules/@latticexyz/store/src/Bytes.sol\":{\"keccak256\":\"0x7dec900f9c9e7dff59430fa6f520e76c56338c3e829201aea140d49342e4fef8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e55c1dfcda94dcc64b8577949b2e92a9d3fc44f5fba1ae77ceacccfdc8e22e35\",\"dweb:/ipfs/QmS7uRJbEQYkPuZ5Dz5aSNjaaxj9PA8RtxUeUGN2W3jZx6\"]},\"node_modules/@latticexyz/store/src/ResourceId.sol\":{\"keccak256\":\"0x842b07f2ff9df2e1ecf9bf424b0e5a77e1471c983d674cf86b76c365178d6cc5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f4c2df8853b020aef1bb8615ac69d5512a9b5385b82c88e03b27dc521c9d007b\",\"dweb:/ipfs/QmWEDiJn69DvHsdrikrMWY8DERWPSeWwVYgPcunfq3yiT7\"]},\"node_modules/@latticexyz/store/src/storeResourceTypes.sol\":{\"keccak256\":\"0x1c4cb6b3ecf76f614479ab304d7de3ade0e99c7ccfd07717b57c92f699a27261\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2c9b0e0c9b3b5610d6fd65a8ffd7c54df390a34ccc70d58f4a055c49ad1ea586\",\"dweb:/ipfs/QmP6ffpnR7aRyvq9AiUkVNH6LbGfFP3NDq7E2n2PVcHhp2\"]},\"node_modules/@latticexyz/world/src/WorldResourceId.sol\":{\"keccak256\":\"0xaff9a22fac8a0f6eee5763b07a7ccb623c829d37922b85e42e914aad2ad417ee\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e598f0274d6d97c0a09806bf4fd1f0d054c310cf51b2123f5ce6380d6f3186ea\",\"dweb:/ipfs/QmaaVvqm21YsCgxozDyShcM17jKUXJhf2y26bk2YzPYZoM\"]},\"node_modules/@latticexyz/world/src/constants.sol\":{\"keccak256\":\"0xb8320f88ed5519a4fe2554ad94815ce328a50fef7719932375d6ce695265c2f5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a8f5de30fbcc63e469e46ad4a4d4bcd7d8e4b4f2d31fcf62a04aca48d999af22\",\"dweb:/ipfs/QmXw1jDQM2szfRY3tAGrRy6fEzte6yVFgebJAqCLMDHndV\"]},\"node_modules/@latticexyz/world/src/worldResourceTypes.sol\":{\"keccak256\":\"0xeb042e7d3638430f6fd394107f3237cf14e4325154f0098624e8a7826584d465\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://39e0b8eb87616b661f5a4f2fd7e1a727bd19b7fd8d40ad3d93fda26822f433ea\",\"dweb:/ipfs/QmacYMatKV9pwEwirVRY9a6r89RoNs5yk99ic37ieWA8Dk\"]},\"src/experimental/Constants.sol\":{\"keccak256\":\"0x1828d78c43a249009f887c267a5fa4c5b7cdd86c6bedc1e6cb57416d2805470c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2e5af1fde1db28001cf53728a23fc552bf3eb5130b9b20239c2e12faa618d83e\",\"dweb:/ipfs/QmUvfh2Vxqm22cdx2543fZ3Mco5bYLU8vp72wD7dtDmirU\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.24+commit.e11b9ed9"},"language":"Solidity","output":{"abi":[],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@latticexyz/=node_modules/@latticexyz/","ds-test/=node_modules/ds-test/src/","forge-std/=node_modules/forge-std/src/"],"optimizer":{"enabled":true,"runs":3000},"metadata":{"bytecodeHash":"none"},"compilationTarget":{"src/experimental/Constants.sol":"OwnableTableNames"},"evmVersion":"cancun","libraries":{}},"sources":{"node_modules/@latticexyz/store/src/Bytes.sol":{"keccak256":"0x7dec900f9c9e7dff59430fa6f520e76c56338c3e829201aea140d49342e4fef8","urls":["bzz-raw://e55c1dfcda94dcc64b8577949b2e92a9d3fc44f5fba1ae77ceacccfdc8e22e35","dweb:/ipfs/QmS7uRJbEQYkPuZ5Dz5aSNjaaxj9PA8RtxUeUGN2W3jZx6"],"license":"MIT"},"node_modules/@latticexyz/store/src/ResourceId.sol":{"keccak256":"0x842b07f2ff9df2e1ecf9bf424b0e5a77e1471c983d674cf86b76c365178d6cc5","urls":["bzz-raw://f4c2df8853b020aef1bb8615ac69d5512a9b5385b82c88e03b27dc521c9d007b","dweb:/ipfs/QmWEDiJn69DvHsdrikrMWY8DERWPSeWwVYgPcunfq3yiT7"],"license":"MIT"},"node_modules/@latticexyz/store/src/storeResourceTypes.sol":{"keccak256":"0x1c4cb6b3ecf76f614479ab304d7de3ade0e99c7ccfd07717b57c92f699a27261","urls":["bzz-raw://2c9b0e0c9b3b5610d6fd65a8ffd7c54df390a34ccc70d58f4a055c49ad1ea586","dweb:/ipfs/QmP6ffpnR7aRyvq9AiUkVNH6LbGfFP3NDq7E2n2PVcHhp2"],"license":"MIT"},"node_modules/@latticexyz/world/src/WorldResourceId.sol":{"keccak256":"0xaff9a22fac8a0f6eee5763b07a7ccb623c829d37922b85e42e914aad2ad417ee","urls":["bzz-raw://e598f0274d6d97c0a09806bf4fd1f0d054c310cf51b2123f5ce6380d6f3186ea","dweb:/ipfs/QmaaVvqm21YsCgxozDyShcM17jKUXJhf2y26bk2YzPYZoM"],"license":"MIT"},"node_modules/@latticexyz/world/src/constants.sol":{"keccak256":"0xb8320f88ed5519a4fe2554ad94815ce328a50fef7719932375d6ce695265c2f5","urls":["bzz-raw://a8f5de30fbcc63e469e46ad4a4d4bcd7d8e4b4f2d31fcf62a04aca48d999af22","dweb:/ipfs/QmXw1jDQM2szfRY3tAGrRy6fEzte6yVFgebJAqCLMDHndV"],"license":"MIT"},"node_modules/@latticexyz/world/src/worldResourceTypes.sol":{"keccak256":"0xeb042e7d3638430f6fd394107f3237cf14e4325154f0098624e8a7826584d465","urls":["bzz-raw://39e0b8eb87616b661f5a4f2fd7e1a727bd19b7fd8d40ad3d93fda26822f433ea","dweb:/ipfs/QmacYMatKV9pwEwirVRY9a6r89RoNs5yk99ic37ieWA8Dk"],"license":"MIT"},"src/experimental/Constants.sol":{"keccak256":"0x1828d78c43a249009f887c267a5fa4c5b7cdd86c6bedc1e6cb57416d2805470c","urls":["bzz-raw://2e5af1fde1db28001cf53728a23fc552bf3eb5130b9b20239c2e12faa618d83e","dweb:/ipfs/QmUvfh2Vxqm22cdx2543fZ3Mco5bYLU8vp72wD7dtDmirU"],"license":"MIT"}},"version":1},"id":129}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[]
|