@towns-protocol/contracts 0.0.439 → 0.0.440

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@towns-protocol/contracts",
3
- "version": "0.0.439",
3
+ "version": "0.0.440",
4
4
  "scripts": {
5
5
  "clean": "forge clean",
6
6
  "compile": "forge build",
@@ -33,7 +33,7 @@
33
33
  "@layerzerolabs/oapp-evm": "^0.3.2",
34
34
  "@openzeppelin/merkle-tree": "^1.0.8",
35
35
  "@prb/test": "^0.6.4",
36
- "@towns-protocol/prettier-config": "^0.0.439",
36
+ "@towns-protocol/prettier-config": "^0.0.440",
37
37
  "@wagmi/cli": "^2.2.0",
38
38
  "forge-std": "github:foundry-rs/forge-std#v1.10.0",
39
39
  "prettier": "^3.5.3",
@@ -50,5 +50,5 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "gitHead": "8e9e84d7be1d6fb6eadbd24b67db8bc7d495cc4c"
53
+ "gitHead": "7c25c92bebcb924258f283120f670a7517895807"
54
54
  }
@@ -11,6 +11,7 @@ import {ISchemaResolver} from "@ethereum-attestation-service/eas-contracts/resol
11
11
  import {IPlatformRequirements} from "../../../factory/facets/platform/requirements/IPlatformRequirements.sol";
12
12
  import {IERC173} from "@towns-protocol/diamond/src/facets/ownable/IERC173.sol";
13
13
  import {IAppAccount} from "../../../spaces/facets/account/IAppAccount.sol";
14
+ import {IEntitlementsManager} from "../../../spaces/facets/entitlements/IEntitlementsManager.sol";
14
15
 
15
16
  // libraries
16
17
  import {CustomRevert} from "../../../utils/libraries/CustomRevert.sol";
@@ -24,6 +25,7 @@ import {LibAppRegistry} from "./LibAppRegistry.sol";
24
25
  import {ExecutionManifest} from "@erc6900/reference-implementation/interfaces/IExecutionModule.sol";
25
26
  import {Attestation, EMPTY_UID} from "@ethereum-attestation-service/eas-contracts/Common.sol";
26
27
  import {AttestationRequest, RevocationRequestData} from "@ethereum-attestation-service/eas-contracts/IEAS.sol";
28
+ import {Permissions} from "../../../spaces/facets/Permissions.sol";
27
29
 
28
30
  // contracts
29
31
  import {SchemaBase} from "../schema/SchemaBase.sol";
@@ -32,8 +34,16 @@ import {AttestationBase} from "../attest/AttestationBase.sol";
32
34
  abstract contract AppRegistryBase is IAppRegistryBase, SchemaBase, AttestationBase {
33
35
  using CustomRevert for bytes4;
34
36
 
37
+ /// @notice Modifier to check if the caller is allowed to interact with the app registry
38
+ /// @dev Only the owner of the space or modular account can interact
35
39
  modifier onlyAllowed(IAppAccount account) {
36
- if (address(account) != msg.sender && IERC173(address(account)).owner() != msg.sender) {
40
+ if (
41
+ address(account) != msg.sender &&
42
+ !IEntitlementsManager(address(account)).isEntitledToSpace(
43
+ msg.sender,
44
+ Permissions.ModifyAppSettings
45
+ )
46
+ ) {
37
47
  NotAllowed.selector.revertWith();
38
48
  }
39
49
  _;
@@ -8,14 +8,15 @@ pragma solidity ^0.8.23;
8
8
  // contracts
9
9
 
10
10
  library Permissions {
11
- string public constant ModifyChannel = "ModifyChannel";
12
- string public constant AddRemoveChannels = "AddRemoveChannels";
13
- string public constant ModifySpaceSettings = "ModifySpaceSettings";
14
- string public constant ModifyRoles = "ModifyRoles";
15
- string public constant JoinSpace = "JoinSpace";
16
- string public constant ModifyBanning = "ModifyBanning";
17
- string public constant Read = "Read";
18
- string public constant Write = "Write";
19
- string public constant React = "React";
20
- string public constant Ping = "Ping";
11
+ string internal constant ModifyChannel = "ModifyChannel";
12
+ string internal constant AddRemoveChannels = "AddRemoveChannels";
13
+ string internal constant ModifySpaceSettings = "ModifySpaceSettings";
14
+ string internal constant ModifyRoles = "ModifyRoles";
15
+ string internal constant JoinSpace = "JoinSpace";
16
+ string internal constant ModifyBanning = "ModifyBanning";
17
+ string internal constant Read = "Read";
18
+ string internal constant Write = "Write";
19
+ string internal constant React = "React";
20
+ string internal constant Ping = "Ping";
21
+ string internal constant ModifyAppSettings = "ModifyAppSettings";
21
22
  }