Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlumeGoon #160

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

PlumeGoon #160

wants to merge 1 commit into from

Conversation

Purva-Chaudhari
Copy link
Member

Old goon nft contract

Copy link
Member

@ungaro ungaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add:

  • proxy contract
  • deployment and upgrade scripts
  • tests

thanks.


require(ps.hasMinted[user], "User should have already minted an NFT to reset them");
require(balanceOf(user) > 0, "User should have already minted an NFT to reset them");
require(ownerOf(burnTokenId) == user, "Incorrect Token Id provided for reset");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we change this to custom errors?

error UserHasNotMinted();
error UserHasNoTokens();
error IncorrectTokenOwner();

if (!ps.hasMinted[user]) revert UserHasNotMinted();
if (balanceOf(user) == 0) revert UserHasNoTokens();
if (ownerOf(burnTokenId) != user) revert IncorrectTokenOwner();

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ERC721BurnableUpgradeable.sol is not inherited or used

mapping(bytes32 => bool) usedNonces;
}

// keccak256(abi.encode(uint256(keccak256("plume.storage.PlumeStorage")) - 1)) & ~bytes32(uint256(0xff))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be plume.storage.PlumeGoonStorage?


_grantRole(DEFAULT_ADMIN_ROLE, _admin);
_grantRole(PAUSER_ROLE, pauser);
_grantRole(MINTER_ROLE, minter);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have 2 roles for PAUSER_ROLE and MINTER_ROLE? can PAUSER_ROLE be UPGRADER_ROLE? I assume MINTER_ROLE is required.

) internal view returns (bool) {
PlumeGoonStorage storage ps = _getPlumeGoonStorage();
bytes32 message = prefixed(keccak256(abi.encodePacked(_tokenUri, user, tier, nonce)));
return recoverSignerFromSignature(message, signature) == ps.admin;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recoverSignerFromSignature is not used anywhere else, maybe can put it here directly?

) internal override(ERC721Upgradeable, ERC721EnumerableUpgradeable, ERC721PausableUpgradeable) returns (address) {
return super._update(to, tokenId, auth);
}

Copy link
Member

@ungaro ungaro Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add natspec comments for functions that have them missing:
/**
* @dev Internal function to increase the balance of an account
* @notice This function overrides both ERC721Upgradeable and ERC721EnumerableUpgradeable implementations
* @param account The address of the account whose balance should be increased
* @param value The amount to increase the balance by
* @inheritdoc ERC721Upgradeable
*/

_grantRole(MINTER_ROLE, minter);
_grantRole(UPGRADER_ROLE, _admin);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add reinitialize for upgrading?

bytes32 nonce
) internal view returns (bool) {
PlumeGoonStorage storage ps = _getPlumeGoonStorage();
bytes32 message = prefixed(keccak256(abi.encodePacked(_tokenUri, user, tier, nonce)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abi.encode() is safer here.

{
return super.supportsInterface(interfaceId);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add _beforeTokenTransfer override? not sure, since there is no compilation error.

modifier _onlyWithAdminSignature(string memory _tokenUri, address user, uint8 tier, bytes memory signature, bytes32 nonce) {
PlumeGoonStorage storage ps = _getPlumeGoonStorage();
require(!isNonceUsed(nonce), "Nonce already used");
require(onlySignedByAdmin(_tokenUri, user, tier, signature, nonce), "Invalid signature");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add custom errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants