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

Version Packages #367

Merged
merged 3 commits into from
Nov 20, 2023
Merged

Version Packages #367

merged 3 commits into from
Nov 20, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Nov 15, 2023

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@zoralabs/[email protected]

Minor Changes

  • d84721a: # Premint v2

    New fields on signature

    Adding a new PremintConfigV2 struct that can be signed, that now contains a createReferral. ZoraCreator1155PremintExecutor recognizes new version of the PremintConfig, and still works with the v1 (legacy) version of the PremintConfig.

    Additional changes to the PremintConfigV2:

    • tokenConfig.royaltyMintSchedule has been removed as it is deprecated and no longer recognized by new versions of the 1155 contract
    • tokenConfig.royaltyRecipient has been renamed to tokenConfig.payoutRecipient to better reflect the fact that this address is used to receive creator rewards, secondary royalties, and paid mint funds. This is the address that will be set on the royaltyRecipient for the created token on the 1155 contract, which is the address that receives creator rewards and secondary royalties for the token, and on the fundsRecipient on the ZoraCreatorFixedPriceSaleStrategy contract for the token, which is the address that receives paid mint funds for the token.

    New MintArguments on premint functions, specifying mintRecipient and mintReferral

    mintReferral and mintRecipient are now specified in the premint functions on the ZoraCreator1155PremintExecutor, via the MintArguments mintArguments param; new premintV1 and premintV2 function now take the MintArguments struct as an argument which contains mintRecipient, defining which account will receive the minted tokens, mintComment, and mintReferral, defining which account will receive a mintReferral reward, if any. mintRecipient must be specified or else it reverts.

    New signature validation methods

    ZoraCreator1155PremintExecutor can now validate signatures by passing it the contract address, instead of needing to pass the full contract creation config, enabling it to validate signatures for 1155 contracts that were not created via the premint executor contract. This allows premints signatures to be validated on contracts that have been upgraded to a version that supports premints, and allows premints to be created on contracts that were not created via the premint executor contract. These functions are called isValidSignatureV1 and isValidSignatureV2 for v1 and v2 of the premint config structs and signatures correspondingly.

    Changes to handling of setting of fundsRecipient

    Previously the fundsRecipient on the fixeed priced minters sales config for the token was set to the signer of the premint. This has been changed to be set to the payoutRecipient of the premint config for v2 of premint config, and to the royaltyRecipient of the premint config for v1 of the premint config, for 1155 contracts that are to be newly created, and for existing 1155 contracts that are upgraded to the latest version and execute a v1 of the premint config.

    Changes to 1155's delegateSetupNewToken

    delegateSetupNewToken on 1155 contract has been updated to now take an abi encoded premint config, premint config version, and send it to an external library to decode the config, the signer, and setup actions. Previously it took a non-encoded PremintConfig. This new change allows this function signature to support multiple versions of a premint config, while offloading decoding of the config and the corresponding setup actions to the external library. This ultimately allows supporting multiple versions of a premint config and corresponding signature without increasing codespace.

    PremintConfigV2 are updated to containe createReferral, and now look like:

    struct PremintConfigV2 {
      // The config for the token to be created
      TokenCreationConfigV2 tokenConfig;
      // Unique id of the token, used to ensure that multiple signatures can't be used to create the same intended token.
      // only one signature per token id, scoped to the contract hash can be executed.
      uint32 uid;
      // Version of this premint, scoped to the uid and contract.  Not used for logic in the contract, but used externally to track the newest version
      uint32 version;
      // If executing this signature results in preventing any signature with this uid from being minted.
      bool deleted;
    }
    
    struct TokenCreationConfigV2 {
      // Metadata URI for the created token
      string tokenURI;
      // Max supply of the created token
      uint256 maxSupply;
      // Max tokens that can be minted for an address, 0 if unlimited
      uint64 maxTokensPerAddress;
      // Price per token in eth wei. 0 for a free mint.
      uint96 pricePerToken;
      // The start time of the mint, 0 for immediate.  Prevents signatures from being used until the start time.
      uint64 mintStart;
      // The duration of the mint, starting from the first mint of this token. 0 for infinite
      uint64 mintDuration;
      // RoyaltyBPS for created tokens. The royalty amount in basis points for secondary sales.
      uint32 royaltyBPS;
      // The address that will receive creatorRewards, secondary royalties, and paid mint funds.  This is the address that will be set on the `royaltyRecipient` for the created token on the 1155 contract, which is the address that receives creator rewards and secondary royalties for the token, and on the `fundsRecipient` on the ZoraCreatorFixedPriceSaleStrategy contract for the token, which is the address that receives paid mint funds for the token.
      address payoutRecipient;
      // Fixed price minter address
      address fixedPriceMinter;
      // create referral
      address createReferral;
    }

    PremintConfig fields are the same as they were before, but are treated as a version 1:

    struct PremintConfig {
      // The config for the token to be created
      TokenCreationConfig tokenConfig;
      // Unique id of the token, used to ensure that multiple signatures can't be used to create the same intended token.
      // only one signature per token id, scoped to the contract hash can be executed.
      uint32 uid;
      // Version of this premint, scoped to the uid and contract.  Not used for logic in the contract, but used externally to track the newest version
      uint32 version;
      // If executing this signature results in preventing any signature with this uid from being minted.
      bool deleted;
    }
    
    struct TokenCreationConfig {
      // Metadata URI for the created token
      string tokenURI;
      // Max supply of the created token
      uint256 maxSupply;
      // Max tokens that can be minted for an address, 0 if unlimited
      uint64 maxTokensPerAddress;
      // Price per token in eth wei. 0 for a free mint.
      uint96 pricePerToken;
      // The start time of the mint, 0 for immediate.  Prevents signatures from being used until the start time.
      uint64 mintStart;
      // The duration of the mint, starting from the first mint of this token. 0 for infinite
      uint64 mintDuration;
      // deperecated field; will be ignored.
      uint32 royaltyMintSchedule;
      // RoyaltyBPS for created tokens. The royalty amount in basis points for secondary sales.
      uint32 royaltyBPS;
      // The address that will receive creatorRewards, secondary royalties, and paid mint funds.  This is the address that will be set on the `royaltyRecipient` for the created token on the 1155 contract, which is the address that receives creator rewards and secondary royalties for the token, and on the `fundsRecipient` on the ZoraCreatorFixedPriceSaleStrategy contract for the token, which is the address that receives paid mint funds for the token.
      address royaltyRecipient;
      // Fixed price minter address
      address fixedPriceMinter;
    }

    changes to ZoraCreator1155PremintExecutorImpl:

    • new function premintV1 - takes a PremintConfig, and premint v1 signature, and executes a premint, with added functionality of being able to specify mint referral and mint recipient
    • new function premintV2 - takes a PremintConfigV2 signature and executes a premint, with being able to specify mint referral and mint recipient
    • deprecated function premint - call premintV1 instead
    • new function
    isAuthorizedToCreatePremint(
            address signer,
            address premintContractConfigContractAdmin,
            address contractAddress
    ) public view returns (bool isAuthorized)

    takes a signer, contractConfig.contractAdmin, and 1155 address, and determines if the signer is authorized to sign premints on the given contract. Replaces isValidSignature - by putting the burden on clients to first decode the signature, then pass the recovered signer to this function to determine if the signer has premint authorization on the contract.

    • deprecated function isValidSignature - call isAuthorizedToCreatePremint instead

Patch Changes

  • 885ffa4: Premint executor can still execute premint mints on 1155 contracts that were created with the old signature for delegateSetupNewToken
  • ffb5cb7: Premint - added method getSupportedPremintSignatureVersions(contractAddress) that returns an array of the premint signature versions an 1155 contract supports. If the contract hasn't been created yet, assumes that when it will be created it will support the latest versions of the signatures, so the function returns all versions.
  • ffb5cb7: Added method IZoraCreator1155PremintExecutor.supportedPremintSignatureVersions(contractAddress) that tells what version of the premint signature the contract supports, and added corresponding method ZoraCreator1155Impl.supportedPremintSignatureVersions() to fetch supported version. If premint not supported, returns an empty array.
  • cacb543: Added impl getter to premint executor

@zoralabs/[email protected]

Patch Changes

@zoralabs/[email protected]

Patch Changes

  • de0b0b7: preminter exposes new function isValidSignatureV1 that recovers a signer from a signed premint and determines if that signer is authorized to sign
  • Updated dependencies [f3b7df8]

@github-actions github-actions bot force-pushed the changeset-release/main branch 5 times, most recently from 5890116 to 51e8771 Compare November 17, 2023 22:41

`delegateSetupNewToken` on 1155 contract has been updated to now take an abi encoded premint config, premint config version, and send it to an external library to decode the config, the signer, and setup actions. Previously it took a non-encoded PremintConfig. This new change allows this function signature to support multiple versions of a premint config, while offloading decoding of the config and the corresponding setup actions to the external library. This ultimately allows supporting multiple versions of a premint config and corresponding signature without increasing codespace.

`PremintConfigV2` are updated to containe `createReferral`, and now look like:
Copy link
Contributor

Choose a reason for hiding this comment

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

smol typo "contain"

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah thanks!

}
```

### changes to `ZoraCreator1155PremintExecutorImpl`:
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: "Changes" for consistency

Copy link
Collaborator

Choose a reason for hiding this comment

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

nice catch thx


### Patch Changes

- 885ffa4: Premint executor can still execute premint mints on 1155 contracts that were created with the old signature for `delegateSetupNewToken`
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe can be more explicit and say "....that were created with V1 signatures for delegateSetupNewToken" ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yep sounds good

@kulkarohan
Copy link
Contributor

approved

general feedback is that the details are great for devs, but could be easier to parse with more bullet points, especially for PMs

@github-actions github-actions bot force-pushed the changeset-release/main branch from 5edd2a4 to c753b6a Compare November 20, 2023 19:36
@oveddan oveddan merged commit 3af6b1f into main Nov 20, 2023
@oveddan oveddan deleted the changeset-release/main branch November 20, 2023 20:35
iainnash pushed a commit that referenced this pull request Jan 5, 2024
* Version Packages

* fix per suggestions

* improved changelog

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Dan Oved <[email protected]>
iainnash pushed a commit that referenced this pull request Jan 11, 2024
* Version Packages

* fix per suggestions

* improved changelog

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Dan Oved <[email protected]>
iainnash pushed a commit that referenced this pull request Jan 11, 2024
* Version Packages

* fix per suggestions

* improved changelog

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Dan Oved <[email protected]>
oveddan added a commit that referenced this pull request May 10, 2024
<!--- Provide a general summary of your changes in the Title above -->

## Description

<!--- Describe your changes in detail -->

The Mints readme had the original design with the fully upgradeable contract.  This updates the readme to define the two different contracts.

<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## Does this change the ABI/API?

- [ ] This changes the ABI/API

<!-- If so, please describe how and what potential impact this may have -->

## What tests did you add/modify to account for these changes

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, tests ran to see how -->
<!--- your change affects other areas of the code, etc. -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New module / feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] i added a changeset to account for this change

## Reviewer Checklist:

- [ ] My review includes a symposis of the changes and potential issues
- [ ] The code style is enforced
- [ ] There are no risky / concerning changes / additions to the PR
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.

3 participants