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

Premint V2 #262

Merged
merged 3 commits into from
Nov 15, 2023
Merged

Premint V2 #262

merged 3 commits into from
Nov 15, 2023

Conversation

kulkarohan
Copy link
Contributor

@kulkarohan kulkarohan commented Oct 11, 2023

Premint v2 - adding a new signature, where createReferral can be specified. ZoraCreator1155PremintExecutor recognizes new version of the signature, and still works with the v1 (legacy) version of the signature. 1155 contract has been updated to now take abi encoded premint config, premint config version, and send it to an external library to decode the config, the signer, and setup actions.

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 upgrade to a version that supports premints, and allows premints to be created on contracts that were not created via the premint executor contract.

1155 contract has been updated to now take abi encoded premint config, premint config version, and send it to an external library to decode the config, the signer, and setup actions.

changes to ZoraCreator1155PremintExecutorImpl:

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.
    address payoutAddress;
    // 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;
    // RoyaltyMintSchedule for created tokens. Every nth token will go to the royalty recipient.
    uint32 royaltyMintSchedule;
    // RoyaltyBPS for created tokens. The royalty amount in basis points for secondary sales.
    uint32 royaltyBPS;
    // RoyaltyRecipient for created tokens. The address that will receive the royalty payments.
    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 isValidSignatureV1 - takes an 1155 address, contract admin, premint v1 config and signature, and validates the signature. Can be used for 1155 contracts that were not created via the premint executor contract.
  • new function isValidSignatureV2 - takes an 1155 address, contract admin, premint v2 config and signature, and validates the signature. Can be used for 1155 contracts that were not created via the premint executor contract.
  • deprecated function isValidSignature - call isValidSignatureV1 instead

@kulkarohan
Copy link
Contributor Author

kulkarohan commented Oct 11, 2023

@oveddan
Copy link
Collaborator

oveddan commented Oct 12, 2023

hey this makes sense as a way to support this.
The main issue is that existing signatures would not work (we need new forms of signatures, like a v2 of the signature) so an upgrade to this contract would result in existing signatures not working

@oveddan oveddan force-pushed the premint_create_referral branch from 4127639 to d20d7f7 Compare October 13, 2023 21:10
@oveddan oveddan changed the base branch from main to fast-testing October 17, 2023 16:39
@oveddan oveddan force-pushed the premint_create_referral branch from d20d7f7 to 985c7ff Compare October 17, 2023 16:39
@oveddan oveddan changed the base branch from fast-testing to main October 17, 2023 21:14
@oveddan oveddan force-pushed the premint_create_referral branch from 985c7ff to 5ca081e Compare October 17, 2023 21:14
@oveddan oveddan changed the base branch from main to deprecate_supply_royalty October 17, 2023 23:58
@oveddan oveddan force-pushed the premint_create_referral branch from 5ca081e to 414ea11 Compare October 17, 2023 23:58
@oveddan oveddan changed the base branch from deprecate_supply_royalty to dont-check-royalty-mint-schedule-greater-zero October 18, 2023 00:06
@oveddan oveddan force-pushed the premint_create_referral branch from 414ea11 to 584f563 Compare October 18, 2023 00:06
@oveddan oveddan force-pushed the dont-check-royalty-mint-schedule-greater-zero branch from 867b3ca to 3ffa41e Compare October 18, 2023 16:39
@oveddan oveddan force-pushed the premint_create_referral branch from 584f563 to 6abc607 Compare October 18, 2023 16:39
@oveddan oveddan force-pushed the dont-check-royalty-mint-schedule-greater-zero branch from 3ffa41e to 29b2b15 Compare October 18, 2023 17:41
@oveddan oveddan changed the base branch from dont-check-royalty-mint-schedule-greater-zero to main October 18, 2023 19:38
@oveddan oveddan force-pushed the premint_create_referral branch from 6abc607 to 3145165 Compare October 18, 2023 19:38
@oveddan oveddan mentioned this pull request Oct 18, 2023
@oveddan oveddan changed the base branch from main to creator-reward-recipient-better-docs October 19, 2023 20:18
@oveddan oveddan force-pushed the premint_create_referral branch from 3145165 to 640736f Compare October 19, 2023 20:18
@oveddan oveddan force-pushed the premint_create_referral branch from afe3ce3 to 1aeeabd Compare November 13, 2023 23:22
@oveddan oveddan changed the base branch from move-deployment-utils-to-protocol-deployments to 11-14-Allow_fork_rpc_and_block_number_to_be_specified November 14, 2023 20:06
@oveddan oveddan force-pushed the premint_create_referral branch 2 times, most recently from 1aeeabd to 6e178ec Compare November 14, 2023 20:06
@oveddan oveddan force-pushed the 11-14-Allow_fork_rpc_and_block_number_to_be_specified branch from f910167 to faeff94 Compare November 14, 2023 23:24
@oveddan oveddan force-pushed the premint_create_referral branch from 6e178ec to a1da19c Compare November 14, 2023 23:24
@oveddan oveddan force-pushed the 11-14-Allow_fork_rpc_and_block_number_to_be_specified branch from faeff94 to 8e5aed9 Compare November 15, 2023 00:45
@oveddan oveddan force-pushed the premint_create_referral branch from a1da19c to 9d8548b Compare November 15, 2023 00:45
@oveddan oveddan force-pushed the 11-14-Allow_fork_rpc_and_block_number_to_be_specified branch from 8e5aed9 to 06db23c Compare November 15, 2023 01:10
@oveddan oveddan force-pushed the premint_create_referral branch from 9d8548b to 9d2c585 Compare November 15, 2023 01:10
@oveddan oveddan force-pushed the 11-14-Allow_fork_rpc_and_block_number_to_be_specified branch from 06db23c to cf76fd5 Compare November 15, 2023 01:12
@oveddan oveddan force-pushed the premint_create_referral branch from 9d2c585 to 7bf9aac Compare November 15, 2023 01:12
@oveddan oveddan changed the base branch from 11-14-Allow_fork_rpc_and_block_number_to_be_specified to main November 15, 2023 01:13
@oveddan oveddan force-pushed the premint_create_referral branch from 7bf9aac to 46afabc Compare November 15, 2023 01:13
@oveddan
Copy link
Collaborator

oveddan commented Nov 15, 2023

Merge activity

  • Nov 15, 2:48 PM: @oveddan started a stack merge that includes this pull request via Graphite.
  • Nov 15, 2:48 PM: Graphite couldn't merge this PR because it was not satisfying all requirements.

@oveddan oveddan merged commit d84721a into main Nov 15, 2023
11 checks passed
iainnash pushed a commit that referenced this pull request Jan 5, 2024
Premint v2 - adding a new signature, where `createReferral` can be specified.  `ZoraCreator1155PremintExecutor` recognizes new version of the signature, and still works with the v1 (legacy) version of the signature.  1155 contract has been updated to now take abi encoded premint config, premint config version, and send it to an external library to decode the config, the signer, and setup actions.

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 upgrade to a version that supports premints, and allows premints to be created on contracts that were not created via the premint executor contract.

1155 contract has been updated to now take abi encoded premint config, premint config version, and send it to an external library to decode the config, the signer, and setup actions.  

changes to `ZoraCreator1155PremintExecutorImpl`:

`PremintConfigV2` are updated to containe `createReferral`, and now look like:
```solidity
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.
    address payoutAddress;
    // 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**:

```solidity
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;
    // RoyaltyMintSchedule for created tokens. Every nth token will go to the royalty recipient.
    uint32 royaltyMintSchedule;
    // RoyaltyBPS for created tokens. The royalty amount in basis points for secondary sales.
    uint32 royaltyBPS;
    // RoyaltyRecipient for created tokens. The address that will receive the royalty payments.
    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 `isValidSignatureV1` - takes an 1155 address, contract admin, premint v1 config and signature,  and validates the signature.  Can be used for 1155 contracts that were not created via the premint executor contract.
* new function `isValidSignatureV2` - takes an 1155 address, contract admin, premint v2 config and signature,  and validates the signature.  Can be used for 1155 contracts that were not created via the premint executor contract.
* deprecated function `isValidSignature` - call `isValidSignatureV1` instead
iainnash pushed a commit that referenced this pull request Jan 11, 2024
Premint v2 - adding a new signature, where `createReferral` can be specified.  `ZoraCreator1155PremintExecutor` recognizes new version of the signature, and still works with the v1 (legacy) version of the signature.  1155 contract has been updated to now take abi encoded premint config, premint config version, and send it to an external library to decode the config, the signer, and setup actions.

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 upgrade to a version that supports premints, and allows premints to be created on contracts that were not created via the premint executor contract.

1155 contract has been updated to now take abi encoded premint config, premint config version, and send it to an external library to decode the config, the signer, and setup actions.  

changes to `ZoraCreator1155PremintExecutorImpl`:

`PremintConfigV2` are updated to containe `createReferral`, and now look like:
```solidity
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.
    address payoutAddress;
    // 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**:

```solidity
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;
    // RoyaltyMintSchedule for created tokens. Every nth token will go to the royalty recipient.
    uint32 royaltyMintSchedule;
    // RoyaltyBPS for created tokens. The royalty amount in basis points for secondary sales.
    uint32 royaltyBPS;
    // RoyaltyRecipient for created tokens. The address that will receive the royalty payments.
    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 `isValidSignatureV1` - takes an 1155 address, contract admin, premint v1 config and signature,  and validates the signature.  Can be used for 1155 contracts that were not created via the premint executor contract.
* new function `isValidSignatureV2` - takes an 1155 address, contract admin, premint v2 config and signature,  and validates the signature.  Can be used for 1155 contracts that were not created via the premint executor contract.
* deprecated function `isValidSignature` - call `isValidSignatureV1` instead
iainnash pushed a commit that referenced this pull request Jan 11, 2024
Premint v2 - adding a new signature, where `createReferral` can be specified.  `ZoraCreator1155PremintExecutor` recognizes new version of the signature, and still works with the v1 (legacy) version of the signature.  1155 contract has been updated to now take abi encoded premint config, premint config version, and send it to an external library to decode the config, the signer, and setup actions.

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 upgrade to a version that supports premints, and allows premints to be created on contracts that were not created via the premint executor contract.

1155 contract has been updated to now take abi encoded premint config, premint config version, and send it to an external library to decode the config, the signer, and setup actions.  

changes to `ZoraCreator1155PremintExecutorImpl`:

`PremintConfigV2` are updated to containe `createReferral`, and now look like:
```solidity
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.
    address payoutAddress;
    // 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**:

```solidity
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;
    // RoyaltyMintSchedule for created tokens. Every nth token will go to the royalty recipient.
    uint32 royaltyMintSchedule;
    // RoyaltyBPS for created tokens. The royalty amount in basis points for secondary sales.
    uint32 royaltyBPS;
    // RoyaltyRecipient for created tokens. The address that will receive the royalty payments.
    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 `isValidSignatureV1` - takes an 1155 address, contract admin, premint v1 config and signature,  and validates the signature.  Can be used for 1155 contracts that were not created via the premint executor contract.
* new function `isValidSignatureV2` - takes an 1155 address, contract admin, premint v2 config and signature,  and validates the signature.  Can be used for 1155 contracts that were not created via the premint executor contract.
* deprecated function `isValidSignature` - call `isValidSignatureV1` instead
@iainnash iainnash deleted the premint_create_referral branch January 11, 2024 15:36
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