@towns-protocol/contracts 0.0.433 → 0.0.435

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.433",
3
+ "version": "0.0.435",
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.433",
36
+ "@towns-protocol/prettier-config": "^0.0.435",
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": "0fe7289140a4eb11ccc26cc9deb3c1818d0d5ea3"
53
+ "gitHead": "6b93d4cf1197625fd10a793981b6301820e34cfe"
54
54
  }
@@ -14,6 +14,7 @@ interface IPrepayBase {
14
14
  error Prepay__InvalidAmount();
15
15
  error Prepay__InvalidAddress();
16
16
  error Prepay__InvalidMembership();
17
+ error Prepay__NotAllowed();
17
18
 
18
19
  // =============================================================
19
20
  // EVENTS
@@ -23,6 +23,7 @@ contract PrepayFacet is IPrepay, PrepayBase, ReentrancyGuard, Entitled, Facet {
23
23
  }
24
24
 
25
25
  function prepayMembership(uint256 supply) external payable nonReentrant {
26
+ _validatePrepayCaller();
26
27
  if (supply == 0) revert Prepay__InvalidSupplyAmount();
27
28
 
28
29
  MembershipStorage.Layout storage ds = MembershipStorage.layout();
@@ -56,4 +57,9 @@ contract PrepayFacet is IPrepay, PrepayBase, ReentrancyGuard, Entitled, Facet {
56
57
  IPlatformRequirements platform = IPlatformRequirements(ds.spaceFactory);
57
58
  return supply * platform.getMembershipFee();
58
59
  }
60
+
61
+ function _validatePrepayCaller() internal view {
62
+ address spaceFactory = MembershipStorage.layout().spaceFactory;
63
+ if (msg.sender != spaceFactory && msg.sender != _owner()) revert Prepay__NotAllowed();
64
+ }
59
65
  }