Skip to content

Commit

Permalink
Creator attribution - reduce optimizer runs to get contracts to build (
Browse files Browse the repository at this point in the history
…#144)

* reduce optimizer runs to get contracts to build

* Premint V2 - Creator Attribution (#128)

* wip on move premint to creator attribution style

* updated readme to reflect new contracts

* Revert "undo changes to js sdk"

This reverts commit 4deabf5.

* better comments

* Added methods to get status of creator attribution, and validate signatures, useful for the backend

* better comments

* fixed back fork test

* slightly more comments
  • Loading branch information
oveddan authored and iainnash committed Sep 27, 2023
1 parent 1e6f973 commit d00556f
Show file tree
Hide file tree
Showing 11 changed files with 712 additions and 676 deletions.
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
2 changes: 1 addition & 1 deletion .env.anvil
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FORK_RPC_URL="https://testnet.rpc.zora.co/"
# FORK_BLOCK_NUMBER=916572
FORK_BLOCK_NUMBER=700700
FORK_BLOCK_NUMBER=700700
1 change: 1 addition & 0 deletions package/preminter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,5 @@ describe("ZoraCreator1155Preminter", () => {
// 10 second timeout
40 * 1000
);

});
46 changes: 42 additions & 4 deletions script/DeployPreminter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,58 @@ import {ProxyShim} from "../src/utils/ProxyShim.sol";
import {ZoraCreatorFixedPriceSaleStrategy} from "../src/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.sol";
import {ZoraCreatorMerkleMinterStrategy} from "../src/minters/merkle/ZoraCreatorMerkleMinterStrategy.sol";
import {ZoraCreatorRedeemMinterFactory} from "../src/minters/redeem/ZoraCreatorRedeemMinterFactory.sol";
import {ZoraCreator1155Preminter} from "../src/premint/ZoraCreator1155Preminter.sol";
import {ZoraCreator1155PremintExecutor} from "../src/premint/ZoraCreator1155PremintExecutor.sol";

contract DeployPreminter is ZoraDeployerBase {
function run() public returns (string memory) {
Deployment memory deployment = getDeployment();

uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY");

ZoraCreator1155FactoryImpl factory = ZoraCreator1155FactoryImpl(deployment.factoryProxy);
// bool deployFactory = vm.envBool("DEPLOY_FACTORY");
bool deployFactory = vm.envBool("DEPLOY_FACTORY");

IZoraCreator1155Factory factoryProxy;
vm.startBroadcast(deployerPrivateKey);

ZoraCreator1155Preminter preminter = new ZoraCreator1155Preminter();
preminter.initialize(factory);
if (deployFactory) {
address deployer = vm.envAddress("DEPLOYER");
address factoryShimAddress = address(new ProxyShim(deployer));
ChainConfig memory chainConfig = getChainConfig();

factoryProxy = IZoraCreator1155Factory(address(new Zora1155Factory(factoryShimAddress, "")));

deployment.factoryProxy = address(factoryProxy);

ZoraCreator1155Impl creatorImpl = new ZoraCreator1155Impl(
chainConfig.mintFeeAmount,
chainConfig.mintFeeRecipient,
address(factoryProxy),
chainConfig.protocolRewards
);

deployment.contract1155Impl = address(creatorImpl);

ZoraCreator1155FactoryImpl factoryImpl = new ZoraCreator1155FactoryImpl({
_implementation: creatorImpl,
_merkleMinter: IMinter1155(deployment.merkleMintSaleStrategy),
_redeemMinterFactory: IMinter1155(deployment.redeemMinterFactory),
_fixedPriceMinter: IMinter1155(deployment.fixedPriceSaleStrategy)
});

// Upgrade to "real" factory address
ZoraCreator1155FactoryImpl(address(factoryProxy)).upgradeTo(address(factoryImpl));
ZoraCreator1155FactoryImpl(address(factoryProxy)).initialize(chainConfig.factoryOwner);

deployment.factoryImpl = address(factoryImpl);
} else {
factoryProxy = ZoraCreator1155FactoryImpl(deployment.factoryProxy);
}

console.log("!!!factory proxy!!!");
// console.log(factoryProxy);

ZoraCreator1155PremintExecutor preminter = new ZoraCreator1155PremintExecutor(factoryProxy);

vm.stopBroadcast();

Expand Down
90 changes: 0 additions & 90 deletions script/EstimatePreminterGas.s.sol

This file was deleted.

2 changes: 2 additions & 0 deletions src/interfaces/IZoraCreator1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ interface IZoraCreator1155 is IZoraCreator1155TypesV1, IZoraCreator1155Errors, I

function delegateSetupNewToken(PremintConfig calldata premintConfig, bytes calldata signature) external returns (uint256 newTokenId);

function delegatedTokenId(uint32 uid) external view returns (uint256 tokenId);

function updateTokenURI(uint256 tokenId, string memory _newURI) external;

function updateContractMetadata(string memory _newURI, string memory _newName) external;
Expand Down
106 changes: 0 additions & 106 deletions src/premint/EIP712UpgradeableWithChainId.sol

This file was deleted.

Loading

0 comments on commit d00556f

Please sign in to comment.