-
Notifications
You must be signed in to change notification settings - Fork 10
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
base: main
Are you sure you want to change the base?
PlumeGoon #160
Conversation
There was a problem hiding this 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"); |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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); | ||
} | ||
|
There was a problem hiding this comment.
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); | ||
} | ||
|
There was a problem hiding this comment.
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))); |
There was a problem hiding this comment.
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); | ||
} | ||
|
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add custom errors.
Old goon nft contract