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

Add collection plus and merkle minters #116

Merged
merged 7 commits into from
Sep 12, 2023
Merged

Add collection plus and merkle minters #116

merged 7 commits into from
Sep 12, 2023

Conversation

neokry
Copy link
Collaborator

@neokry neokry commented Sep 11, 2023

Adds collection plus minter:

Adds merkle minter:

  • allows users to mint reserved tokens using merkle proofs
  • will be used for L1 -> L2 DAO migrations

Changes ERC721Votes batch delegate with sig function:

  • updated to only allow one to address and one duration
  • makes it more efficent to build delegation params via contracts
  • users will likely not be delegating to multiple addresses in one transaction

Code review:

  • do new minters work as expected
  • do token changes work as expected

@neokry neokry changed the base branch from main to v2-audit September 11, 2023 07:37
| settings | struct AuctionTypesV1.Settings | 4 | 0 | 64 | src/auction/Auction.sol:Auction |
| token | contract IBaseToken | 6 | 0 | 20 | src/auction/Auction.sol:Auction |
| auction | struct AuctionTypesV1.Auction | 7 | 0 | 96 | src/auction/Auction.sol:Auction |
| currentBidReferral | address | 10 | 0 | 20 | src/auction/Auction.sol:Auction |
Copy link
Contributor

Choose a reason for hiding this comment

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

be careful when adding slots, looks fine here.

/// @notice Allows the manager admin to set the ERC6551 implementation address
/// @param _erc6551Impl Address of the ERC6551 implementation
function setERC6551Implementation(address _erc6551Impl) external {
if (msg.sender != manager.owner()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this break registry entries and provide a potential for attack with a bad erc6551 impl?

Copy link
Contributor

Choose a reason for hiding this comment

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

If this is an immutable registry would setting it as an instance (immutable) variable on deploy make sense and if there is a reason to upgrade changing it during an upgrade to a known registry with added functionality etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

agreed will change to immutable


/// @notice mints a token from reserve using the collection plus strategy
/// @param params Mint parameters
function mintFromReserve(MintParams calldata params) public payable {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to break out MintParams as args or are they used elsewhere as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

used this to work around stack too deep issue. open to changing this if you think there is a better solution @iainnash

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

seems like this was fixed when I moved validation to an internal function actually. will break out the params here

}

// Transfer funds to treasury
if (settings.pricePerToken > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: what happens if claimCount is 0? This function will still be called. Would it make sense to either 1) check on uint256 desiredAmount = claimCount * settings.pricePerToken and desiredAmount > 0 here rather than pricePerToken or disallow mints with 0 as a claimCount?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

disallowing mints with 0 as claimCount thanks for flagging

/// @param tokenContract Token contract to set settings for
/// @param merkleMinterSettings Settings to set
function setSettings(address tokenContract, MerkleMinterSettings memory merkleMinterSettings) external {
if (IOwnable(tokenContract).owner() != msg.sender) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could make for a useful modifier onlyContractOwner(tokenContract)

/// @notice Resets the minter settings for a token
/// @param tokenContract Token contract to reset settings for
function resetSettings(address tokenContract) external {
if (IOwnable(tokenContract).owner() != msg.sender) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: see modifier above

@neokry neokry temporarily deployed to Test September 12, 2023 02:11 — with GitHub Actions Inactive
@neokry neokry temporarily deployed to Test September 12, 2023 02:21 — with GitHub Actions Inactive
@neokry neokry temporarily deployed to Test September 12, 2023 02:36 — with GitHub Actions Inactive
@neokry neokry merged commit f660035 into v2-audit Sep 12, 2023
2 checks passed
@neokry neokry temporarily deployed to Test September 12, 2023 07:29 — with GitHub Actions Inactive
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