From 5b4d804386987c60679627dc9251bed75d8e7334 Mon Sep 17 00:00:00 2001 From: Tomi_Ohl Date: Thu, 16 May 2024 17:07:25 +0200 Subject: [PATCH] Use mintableAmountPerUser = 0 for unlimited mints --- contracts/ConfigurableGuildRewardNFT.sol | 6 ++++-- contracts/interfaces/IConfigurableGuildRewardNFT.sol | 4 ++-- docs/contracts/ConfigurableGuildRewardNFT.md | 2 +- docs/contracts/interfaces/IConfigurableGuildRewardNFT.md | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/contracts/ConfigurableGuildRewardNFT.sol b/contracts/ConfigurableGuildRewardNFT.sol index df7a7cd..8a140e9 100644 --- a/contracts/ConfigurableGuildRewardNFT.sol +++ b/contracts/ConfigurableGuildRewardNFT.sol @@ -61,8 +61,10 @@ contract ConfigurableGuildRewardNFT is if (signedAt < block.timestamp - SIGNATURE_VALIDITY) revert ExpiredSignature(); uint256 mintableAmount = mintableAmountPerUser; - if (amount > mintableAmount - balanceOf(receiver) || amount > mintableAmount - claimedTokens[userId]) - revert AlreadyClaimed(); + if ( + mintableAmount > 0 && + (amount > mintableAmount - balanceOf(receiver) || amount > mintableAmount - claimedTokens[userId]) + ) revert AlreadyClaimed(); if (!isValidSignature(amount, signedAt, receiver, userId, signature)) revert IncorrectSignature(); (uint256 guildFee, address payable guildTreasury) = ITreasuryManager(factoryProxy).getFeeData(); diff --git a/contracts/interfaces/IConfigurableGuildRewardNFT.sol b/contracts/interfaces/IConfigurableGuildRewardNFT.sol index 244b538..a78e261 100644 --- a/contracts/interfaces/IConfigurableGuildRewardNFT.sol +++ b/contracts/interfaces/IConfigurableGuildRewardNFT.sol @@ -13,7 +13,7 @@ interface IConfigurableGuildRewardNFT is IMaxSupply { /// @notice The maximum amount of tokens a Guild user can claim from the token. /// @dev Doesn't matter if they are claimed in the same transaction or separately. - /// @return mintableAmountPerUser The amount of tokens. + /// @return mintableAmountPerUser The amount of tokens. Unlimited if zero. function mintableAmountPerUser() external view returns (uint256 mintableAmountPerUser); /// @notice The time interval while a signature is valid. @@ -69,7 +69,7 @@ interface IConfigurableGuildRewardNFT is IMaxSupply { /// @notice Sets the amount of tokens a user can mint from the token. /// @dev Only callable by the owner. - /// @param newAmount The new amount a user can mint from the token. + /// @param newAmount The new amount a user can mint from the token. Unlimited if zero. function setMintableAmountPerUser(uint256 newAmount) external; /// @notice Updates the cid for tokenURI. diff --git a/docs/contracts/ConfigurableGuildRewardNFT.md b/docs/contracts/ConfigurableGuildRewardNFT.md index 6876e8c..9606d36 100644 --- a/docs/contracts/ConfigurableGuildRewardNFT.md +++ b/docs/contracts/ConfigurableGuildRewardNFT.md @@ -196,7 +196,7 @@ Only callable by the owner. | Name | Type | Description | | :--- | :--- | :---------- | -| `newAmount` | uint256 | The new amount a user can mint from the token. | +| `newAmount` | uint256 | The new amount a user can mint from the token. Unlimited if zero. | ### updateTokenURI diff --git a/docs/contracts/interfaces/IConfigurableGuildRewardNFT.md b/docs/contracts/interfaces/IConfigurableGuildRewardNFT.md index 7025c17..25a0afe 100644 --- a/docs/contracts/interfaces/IConfigurableGuildRewardNFT.md +++ b/docs/contracts/interfaces/IConfigurableGuildRewardNFT.md @@ -33,7 +33,7 @@ Doesn't matter if they are claimed in the same transaction or separately. | Name | Type | Description | | :--- | :--- | :---------- | -| `mintableAmountPerUser` | uint256 | The amount of tokens. | +| `mintableAmountPerUser` | uint256 | The amount of tokens. Unlimited if zero. | ### SIGNATURE_VALIDITY ```solidity @@ -170,7 +170,7 @@ Only callable by the owner. | Name | Type | Description | | :--- | :--- | :---------- | -| `newAmount` | uint256 | The new amount a user can mint from the token. | +| `newAmount` | uint256 | The new amount a user can mint from the token. Unlimited if zero. | ### updateTokenURI