@@ -311,7 +311,6 @@ contract GamePasses is
311
311
* - trustedForwarder: Address of the trusted meta-transaction forwarder.
312
312
* - defaultTreasury: Address of the default treasury wallet.
313
313
* - owner: Address that will be set as the internal owner.
314
- * - sandContract: Address of the SAND contract.
315
314
*/
316
315
function initialize (InitParams calldata params ) external initializer {
317
316
__ERC2771Handler_init (params.trustedForwarder);
@@ -582,11 +581,10 @@ contract GamePasses is
582
581
}
583
582
584
583
_updateAndCheckTotalMinted (mintTokenId, mintAmount);
585
- mintConfig.mintedPerWallet[ mintTo] += mintAmount;
584
+ _updateAndCheckMaxPerWallet (mintTokenId, mintTo, mintAmount) ;
586
585
587
586
_burn (burnFrom, burnTokenId, burnAmount);
588
587
589
- _checkMaxPerWallet (mintTokenId, mintTo, mintAmount);
590
588
_mint (mintTo, mintTokenId, mintAmount, "" );
591
589
}
592
590
@@ -640,8 +638,7 @@ contract GamePasses is
640
638
}
641
639
642
640
_updateAndCheckTotalMinted (mintTokenIds[i], mintAmounts[i]);
643
- _checkMaxPerWallet (mintTokenIds[i], mintTo, mintAmounts[i]);
644
- mintConfig.mintedPerWallet[mintTo] += mintAmounts[i];
641
+ _updateAndCheckMaxPerWallet (mintTokenIds[i], mintTo, mintAmounts[i]);
645
642
}
646
643
647
644
_burnBatch (burnFrom, burnTokenIds, burnAmounts);
@@ -707,11 +704,9 @@ contract GamePasses is
707
704
verifyBurnAndMintSignature (request, signature);
708
705
709
706
_updateAndCheckTotalMinted (mintId, mintAmount);
710
- mintConfig.mintedPerWallet[ caller] += mintAmount;
707
+ _updateAndCheckMaxPerWallet (mintId, caller, mintAmount) ;
711
708
712
709
_burn (caller, burnId, burnAmount);
713
-
714
- _checkMaxPerWallet (mintId, caller, mintAmount);
715
710
_mint (caller, mintId, mintAmount, "" );
716
711
}
717
712
@@ -1074,12 +1069,11 @@ contract GamePasses is
1074
1069
/**
1075
1070
* @notice Returns the metadata URI for a specific token ID
1076
1071
* @param tokenId ID of the token to get URI for
1077
- * @dev Constructs the URI by concatenating baseURI + tokenId + ".json"
1078
- * @dev Can be overridden by derived contracts to implement different URI logic
1079
- * @return string The complete URI for the token metadata
1072
+ * @dev Returns the token-specific metadata string stored in the token configuration
1073
+ * @return string The metadata URI for the token
1080
1074
*/
1081
1075
function uri (uint256 tokenId ) public view virtual override returns (string memory ) {
1082
- return string ( abi.encodePacked ( _coreStorage ().baseURI, tokenId. toString (), " .json " )) ;
1076
+ return _tokenStorage ().tokenConfigs[ tokenId].metadata ;
1083
1077
}
1084
1078
1085
1079
/**
@@ -1272,11 +1266,9 @@ contract GamePasses is
1272
1266
1273
1267
verifySignature (request, signature);
1274
1268
1275
- _checkMaxPerWallet (request.tokenId, request.caller, request.amount);
1269
+ _updateAndCheckMaxPerWallet (request.tokenId, request.caller, request.amount);
1276
1270
_updateAndCheckTotalMinted (request.tokenId, request.amount);
1277
1271
1278
- config.mintedPerWallet[request.caller] += request.amount;
1279
-
1280
1272
address treasury = config.treasuryWallet;
1281
1273
if (treasury == address (0 )) {
1282
1274
treasury = _coreStorage ().defaultTreasuryWallet;
@@ -1308,11 +1300,9 @@ contract GamePasses is
1308
1300
revert TokenNotConfigured (request.tokenIds[i]);
1309
1301
}
1310
1302
1311
- _checkMaxPerWallet (request.tokenIds[i], request.caller, request.amounts[i]);
1303
+ _updateAndCheckMaxPerWallet (request.tokenIds[i], request.caller, request.amounts[i]);
1312
1304
_updateAndCheckTotalMinted (request.tokenIds[i], request.amounts[i]);
1313
1305
1314
- config.mintedPerWallet[request.caller] += request.amounts[i];
1315
-
1316
1306
address treasury = config.treasuryWallet;
1317
1307
if (treasury == address (0 )) {
1318
1308
treasury = _coreStorage ().defaultTreasuryWallet;
@@ -1391,14 +1381,16 @@ contract GamePasses is
1391
1381
* - Current wallet balance + amount would exceed max per wallet
1392
1382
* @dev Skips check if maxPerWallet is type(uint256).max (unlimited)
1393
1383
*/
1394
- function _checkMaxPerWallet (uint256 tokenId , address to , uint256 amount ) private view {
1384
+ function _updateAndCheckMaxPerWallet (uint256 tokenId , address to , uint256 amount ) private {
1395
1385
TokenConfig storage config = _tokenStorage ().tokenConfigs[tokenId];
1396
1386
1387
+ config.mintedPerWallet[to] += amount;
1388
+
1397
1389
if (config.maxPerWallet == 0 ) {
1398
1390
revert ExceedsMaxPerWallet (tokenId, to, amount, 0 );
1399
1391
}
1400
1392
1401
- if (config.maxPerWallet != type ( uint256 ).max && config. mintedPerWallet[to] + amount > config.maxPerWallet) {
1393
+ if (config.mintedPerWallet[to] > config.maxPerWallet) {
1402
1394
revert ExceedsMaxPerWallet (tokenId, to, amount, config.maxPerWallet);
1403
1395
}
1404
1396
}
0 commit comments