@towns-protocol/contracts 0.0.410 → 0.0.412

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.410",
3
+ "version": "0.0.412",
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.410",
36
+ "@towns-protocol/prettier-config": "^0.0.412",
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",
@@ -53,5 +53,5 @@
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  },
56
- "gitHead": "171a29333009f68329eb75bdd4b8d8f4983e4007"
56
+ "gitHead": "faf36d126bdccd3c15bd910d1021c04627e92961"
57
57
  }
@@ -209,9 +209,10 @@ abstract contract WalletLinkBase is IWalletLinkBase, EIP712Base, Nonces {
209
209
  revert WalletLink__NotLinked(walletToRemove, rootWallet.addr);
210
210
  }
211
211
 
212
- // Check that the wallet is not the default wallet
212
+ // If the wallet is the default wallet, unset it before removal
213
213
  if (ds.rootWalletByRootKey[rootWallet.addr].defaultWallet == walletToRemove) {
214
- revert WalletLink__CannotRemoveDefaultWallet();
214
+ ds.rootWalletByRootKey[rootWallet.addr].defaultWallet = address(0);
215
+ emit SetDefaultWallet(rootWallet.addr, address(0));
215
216
  }
216
217
 
217
218
  // Verify that the root wallet signature contains the correct nonce and the correct wallet
@@ -246,9 +247,10 @@ abstract contract WalletLinkBase is IWalletLinkBase, EIP712Base, Nonces {
246
247
  revert WalletLink__NotLinked(walletToRemove, rootWallet);
247
248
  }
248
249
 
249
- // check that the default wallet is not the wallet to remove
250
+ // If the wallet is the default wallet, unset it before removal
250
251
  if (ds.rootWalletByRootKey[rootWallet].defaultWallet == walletToRemove) {
251
- revert WalletLink__CannotRemoveDefaultWallet();
252
+ ds.rootWalletByRootKey[rootWallet].defaultWallet = address(0);
253
+ emit SetDefaultWallet(rootWallet, address(0));
252
254
  }
253
255
 
254
256
  // Remove the link in the walletToRemove to root keys map
@@ -190,11 +190,18 @@ abstract contract MembershipBase is IMembershipBase {
190
190
 
191
191
  uint256 minFee = platform.getMembershipFee();
192
192
  uint256 renewalPrice = $.renewalPriceByTokenId[tokenId];
193
+ uint256 currentPrice = _getMembershipPrice(totalSupply);
193
194
 
194
- if (renewalPrice != 0) return FixedPointMathLib.max(renewalPrice, minFee);
195
+ // If no stored renewal price, use current price
196
+ if (renewalPrice == 0) {
197
+ return FixedPointMathLib.max(currentPrice, minFee);
198
+ }
195
199
 
196
- uint256 price = _getMembershipPrice(totalSupply);
197
- return FixedPointMathLib.max(price, minFee);
200
+ // Use the LOWER of stored renewal price or current price
201
+ // This ensures users benefit from price drops (including free transitions)
202
+ // while maintaining their locked-in rate if prices increase
203
+ uint256 effectivePrice = FixedPointMathLib.min(renewalPrice, currentPrice);
204
+ return FixedPointMathLib.max(effectivePrice, minFee);
198
205
  }
199
206
 
200
207
  /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/