Skip to content

Commit

Permalink
Use mintableAmountPerUser = 0 for unlimited mints
Browse files Browse the repository at this point in the history
  • Loading branch information
TomiOhl committed May 16, 2024
1 parent 898680b commit 5b4d804
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions contracts/ConfigurableGuildRewardNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions contracts/interfaces/IConfigurableGuildRewardNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/contracts/ConfigurableGuildRewardNFT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docs/contracts/interfaces/IConfigurableGuildRewardNFT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 5b4d804

Please sign in to comment.