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: updated documentation #199

Merged
merged 27 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7b8fa9a
Added pre-release ci task
oveddan Sep 18, 2023
1e6f973
Gasless
oveddan May 31, 2023
d00556f
Creator attribution - reduce optimizer runs to get contracts to build…
oveddan Aug 22, 2023
c54b05e
prettier fix
oveddan Aug 23, 2023
08737a1
hack - only test fork on zora goerli for premint
oveddan Aug 23, 2023
f2a8bbb
deployed new creator attribution
oveddan Aug 18, 2023
012c3f1
fix: factory tests
kulkarohan Aug 28, 2023
9bccade
chore: remove alt deploy script
kulkarohan Aug 29, 2023
4e1bfd2
refactor: store 1155 factory as immutable
kulkarohan Aug 29, 2023
9aff1dc
chore: update tests
kulkarohan Aug 29, 2023
e970353
chore: update tests
kulkarohan Sep 1, 2023
63b7a9b
chore: lint
kulkarohan Sep 1, 2023
8919667
Premint: fix fork tests (#164)
oveddan Sep 11, 2023
1b9984b
Premint: add creator to creator attribution event (#163)
oveddan Sep 12, 2023
fdaa89d
fix coverage compilation issue
oveddan Sep 12, 2023
42b9357
Premint: first minter rewards (#162)
oveddan Sep 14, 2023
82ee3ca
Made premint executor upgradeable via a proxy. (#168)
oveddan Sep 14, 2023
d347837
Extracted erc1155 errors to an interface, and importing that into pre…
oveddan Sep 14, 2023
91dd712
Reverted manual premint version update, and just pointing to origin v…
oveddan Sep 14, 2023
6322adf
updated readme
oveddan Sep 22, 2023
851d702
updating natspec
oveddan Sep 22, 2023
96304ae
updated natspec readme
oveddan Sep 22, 2023
22fe7ac
remove unnecessary changes
iainnash Sep 27, 2023
34794cf
update uml diagrams
iainnash Sep 27, 2023
71c2648
fix build
iainnash Sep 27, 2023
85121f8
Undo changes to changesets
oveddan Sep 28, 2023
7b14636
cleaned up readme, and removed some uml
oveddan Sep 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/happy-socks-melt.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"@zoralabs/zora-1155-contracts": minor
---

Adds first minter rewards to zora 1155 contracts.
Adds first minter rewards to zora 1155 contracts.
4 changes: 3 additions & 1 deletion .changeset/long-avocados-visit.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
"@zoralabs/zora-1155-contracts": minor
---

Added deterministic contract creation from the Zora1155 factory
- Added deterministic contract creation from the Zora1155 factory
- Added gasless minter
- Added deterministic contract creation
2 changes: 1 addition & 1 deletion .changeset/twelve-comics-sniff.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"@zoralabs/zora-1155-contracts": minor
---

Added the PremintExecutor contract, and updated erc1155 to support delegated minting
Added the PremintExecutor contract, and updated erc1155 to support delegated minting
4 changes: 4 additions & 0 deletions src/nft/ZoraCreator1155Impl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,10 @@ contract ZoraCreator1155Impl is
return _getImplementation();
}

/// Sets up a new token using a token configuration and a signature created for the token creation parameters.
/// The signature must be created by an account with the PERMISSION_BIT_MINTER role on the contract.
/// @param premintConfig configuration of token to be created
/// @param signature EIP-712 Signature created on the premintConfig by an account with the PERMISSION_BIT_MINTER role on the contract.
function delegateSetupNewToken(PremintConfig calldata premintConfig, bytes calldata signature) public nonReentrant returns (uint256 newTokenId) {
// if a token has already been created for a premint config with this uid:
if (delegatedTokenId[premintConfig.uid] != 0) {
Expand Down
4 changes: 1 addition & 3 deletions test/factory/ZoraCreator1155Factory_Fork.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ import {ZoraCreatorFixedPriceSaleStrategy} from "../../src/minters/fixed-price/Z
import {ForkDeploymentConfig} from "../../src/deployment/DeploymentConfig.sol";

contract ZoraCreator1155FactoryForkTest is ForkDeploymentConfig, Test {
uint96 constant tokenPrice = 1 ether;
uint256 constant quantityToMint = 3;
uint256 constant tokenMaxSupply = 100;
uint32 constant royaltyMintSchedule = 10;
uint32 constant royaltyBPS = 100;

address collector;
address creator;
Expand Down Expand Up @@ -96,6 +93,7 @@ contract ZoraCreator1155FactoryForkTest is ForkDeploymentConfig, Test {
}

function testTheFork(string memory chainName) private {
uint96 tokenPrice = 1 ether;
console.log("testing on fork: ", chainName);

// create and select the fork, which will be used for all subsequent calls
Expand Down
20 changes: 0 additions & 20 deletions uml/gasslessCreate-collecting-activity.puml

This file was deleted.

42 changes: 17 additions & 25 deletions uml/gasslessCreate-collecting-sequence.puml
Original file line number Diff line number Diff line change
@@ -1,46 +1,38 @@
@startuml
actor Collector
entity PremintCollectPage
entity CollectUI
entity Wallet
boundary SignatureAPI
entity SignatureDB
entity PreminterContract
entity PremintExecutorContract
entity 1155FactoryContract
entity 1155Contract

Collector -> PremintCollectPage: Open, param is \ndeterministic collection address\n+ token uid
Activate PremintCollectPage
PremintCollectPage -> SignatureAPI: Fetch by collection address\n+ token uid
SignatureAPI -> SignatureDB: Fetch most recent signature\nby contract hash token uid
SignatureDB --> SignatureAPI: contract + token creation params\n+ signature
SignatureAPI --> PremintCollectPage: contract + token creation params\n+ signature
PremintCollectPage -> PreminterContract: Check if signature has been used (by contract hash + token uid)
PreminterContract --> PremintCollectPage: Signature has been used or not
Collector -> CollectUI: Open, param is \ndeterministic collection address\n+ token uid
Activate CollectUI
CollectUI -> SignatureAPI: Fetch by:\ncollection address, premint uid
SignatureAPI --> CollectUI: contract creation params,\ntoken creation params,\nsignature

Group signature has been used

PremintCollectPage -> Collector: Redirect to \nstandard collect page

end

Collector -> PremintCollectPage: mint
PremintCollectPage -> Collector: Submit transaction
deactivate PremintCollectPage
Collector -> PreminterContract: Submit premint transaction containing \nsignature, contract creation & token creation params
activate PreminterContract
PreminterContract -> PreminterContract: record signature used;\nrevert if already used
Collector -> CollectUI: mint
CollectUI -> Wallet: Submit premint transaction
deactivate CollectUI
Wallet -> PremintExecutorContract: premint(collectionConfig, tokenConfig, uid, signature)
activate PremintExecutorContract

Group contract doesnt exist

PreminterContract -> 1155FactoryContract: create contract
PremintExecutorContract -> 1155FactoryContract: create contract
activate 1155FactoryContract
1155FactoryContract -> 1155Contract: create
deactivate 1155FactoryContract
activate 1155Contract

end

PreminterContract -> 1155Contract: create new token\nwith signature
PreminterContract -> 1155Contract: set new token sale parameters
PreminterContract -> 1155Contract: mint tokens to collector

deactivate PreminterContract
deactivate PremintExecutorContract
1155Contract --> Collector: Minted tokens
deactivate 1155Contract

Expand Down
27 changes: 0 additions & 27 deletions uml/gasslessCreate-creation-activity.puml

This file was deleted.

71 changes: 40 additions & 31 deletions uml/gasslessCreate-creation-sequence.puml
Original file line number Diff line number Diff line change
@@ -1,51 +1,60 @@
@startuml

title Creating a signature for a new erc1155 contract + token
title Creating a signature for a Premint Erc1155 contract + New token

actor Creator
entity CreatePage
boundary SignatureAPI
entity Wallet
entity CreateUI
boundary PremintAPI
boundary PremintContract
entity SignatureDB


Group Signature not created for contract yet
Group New premint token on new contract

activate CreatePage
Creator -> CreatePage: setup NEW contract name + image
CreatePage -> SignatureAPI: validate that contract \nwith same params for\ncreator doesnt exist
SignatureAPI -> SignatureDB: check if signature with hash \nfor contract is already stored
SignatureAPI --> CreatePage: validation results
Creator -> CreateUI: setup NEW contract name + image
activate CreateUI
CreateUI -> PremintContract: get determnistic collection address\nfor contract creation params
activate PremintContract
PremintContract --> CreateUI: determinstic collection address
deactivate CreateUI
deactivate PremintContract

end

Group Signature has been created for contract
Group New premint token on existing premint contract

Creator -> CreateUI: load page to create new token for\npremint at determinstic\ncollection address
activate CreateUI
CreateUI -> PremintAPI: load collection creation params\nby determinstic address
activate PremintAPI

Creator -> CreatePage: load page by determinstic collection address
CreatePage -> SignatureAPI: load collection creation params
SignatureAPI -> SignatureDB: fetch collection creation params\nby hash
SignatureAPI --> CreatePage: contract creation params
Group Premint exists
PremintAPI --> CreateUI: collection creation params\n(from premint)
deactivate CreateUI
deactivate PremintAPI
end

end

Creator -> CreatePage: setup new token
CreatePage -> PremintContract: get determnistic collection address
PremintContract --> CreatePage: determinstic collection address
CreatePage -> SignatureAPI: get new uid for collection address
SignatureAPI -> SignatureDB: get next token uid\nscoped to collection address
SignatureDB --> SignatureAPI: next token uid
SignatureAPI --> CreatePage: next token uid
Creator -> CreatePage: Submit new token creation params
CreatePage -> Creator: request signature of\n contract + token creation params + token uid
deactivate CreatePage
Creator -> SignatureAPI: Submit signature + contract + token params + token uid
SignatureAPI -> PremintContract: validate signature
PremintContract --> SignatureAPI: validation results (true/false & recovered signer)
CreateUI -> PremintAPI: get next uid for\ncollection address
activate CreateUI
activate PremintAPI
PremintAPI --> CreateUI: next uid for collection

Group Signature is valid
Creator -> CreateUI: configure new token parameters
Creator -> CreateUI: Submit
CreateUI -> Creator: request Premint EIP-712 signature containing:\n token creation params, token uid, version
Creator -> Wallet: sign message
Wallet -> CreateUI: Signed message by creator of\ntoken creation params, token uid, version
CreateUI -> PremintAPI: validate and store signature
PremintAPI -> PremintContract: validate signature
PremintContract --> PremintAPI: validation results (true/false & recovered signer)

SignatureAPI -> SignatureDB: store signature + \ncontract creation + \ntoken creation params + \ncollection address + \ntoken uid
Group Signature is valid
PremintAPI -> PremintAPI: store premint and signature

end

PremintAPI -> CreateUI: validation & storage status
deactivate CreateUI

@enduml
1 change: 0 additions & 1 deletion uml/generated/gasslessCreate-collecting-activity.svg

This file was deleted.

2 changes: 1 addition & 1 deletion uml/generated/gasslessCreate-collecting-sequence.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading