diff --git a/script/DeployNewPreminterAndFactoryProxy.s.sol b/script/DeployNewPreminterAndFactoryProxy.s.sol index 15782ad90..e6fcd46d5 100644 --- a/script/DeployNewPreminterAndFactoryProxy.s.sol +++ b/script/DeployNewPreminterAndFactoryProxy.s.sol @@ -7,29 +7,15 @@ import "forge-std/console2.sol"; import {ZoraDeployerBase} from "./ZoraDeployerBase.sol"; import {ChainConfig, Deployment} from "../src/deployment/DeploymentConfig.sol"; -import {ZoraCreator1155FactoryImpl} from "../src/factory/ZoraCreator1155FactoryImpl.sol"; -import {Zora1155Factory} from "../src/proxies/Zora1155Factory.sol"; -import {ZoraCreator1155Impl} from "../src/nft/ZoraCreator1155Impl.sol"; -import {ICreatorRoyaltiesControl} from "../src/interfaces/ICreatorRoyaltiesControl.sol"; -import {IZoraCreator1155Factory} from "../src/interfaces/IZoraCreator1155Factory.sol"; -import {IMinter1155} from "../src/interfaces/IMinter1155.sol"; -import {IZoraCreator1155} from "../src/interfaces/IZoraCreator1155.sol"; -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 {ZoraCreator1155PremintExecutor} from "../src/premint/ZoraCreator1155PremintExecutor.sol"; - contract DeployNewPreminterAndFactoryProxy is ZoraDeployerBase { function run() public returns (string memory) { Deployment memory deployment = getDeployment(); uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY"); + address deployer = vm.envAddress("DEPLOYER"); vm.startBroadcast(deployerPrivateKey); - address deployer = vm.envAddress("DEPLOYER"); - deployNew1155AndFactoryProxy(deployment, deployer); deployNewPreminterProxy(deployment); diff --git a/script/UpgradePreminter.s.sol b/script/UpgradePreminter.s.sol new file mode 100644 index 000000000..60438548a --- /dev/null +++ b/script/UpgradePreminter.s.sol @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.17; + +import "forge-std/Script.sol"; +import "forge-std/console2.sol"; + +import {ZoraDeployerBase} from "./ZoraDeployerBase.sol"; +import {ChainConfig, Deployment} from "../src/deployment/DeploymentConfig.sol"; +import {UUPSUpgradeable} from "@zoralabs/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol"; + +contract UpgradePreminter is ZoraDeployerBase { + function run() public returns (string memory, bytes memory upgradeCalldata, address upgradeTarget) { + Deployment memory deployment = getDeployment(); + + uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY"); + + vm.startBroadcast(deployerPrivateKey); + + address preminterImplementation = deployNewPreminterImplementation(deployment); + + vm.stopBroadcast(); + + upgradeCalldata = abi.encodeWithSelector(UUPSUpgradeable.upgradeTo.selector, preminterImplementation); + + upgradeTarget = deployment.preminter; + + console2.log("Upgrade PremintExecutor target and implementatin:", upgradeTarget, preminterImplementation); + console2.log("To upgrade, use this calldata:"); + console2.logBytes(upgradeCalldata); + + return (getDeploymentJSON(deployment), upgradeCalldata, upgradeTarget); + } +} diff --git a/script/ZoraDeployerBase.sol b/script/ZoraDeployerBase.sol index 1d7335b00..909d65d9c 100644 --- a/script/ZoraDeployerBase.sol +++ b/script/ZoraDeployerBase.sol @@ -77,12 +77,18 @@ abstract contract ZoraDeployerBase is ScriptDeploymentConfig, Script { console2.log("Factory Proxy", address(factoryProxy)); } - function deployNewPreminterProxy(Deployment memory deployment) internal { + function deployNewPreminterImplementation(Deployment memory deployment) internal returns (address) { // create preminter implementation ZoraCreator1155PremintExecutor preminterImplementation = new ZoraCreator1155PremintExecutor(ZoraCreator1155FactoryImpl(deployment.factoryProxy)); + return address(preminterImplementation); + } + + function deployNewPreminterProxy(Deployment memory deployment) internal { + address preminterImplementation = deployNewPreminterImplementation(deployment); + // build the proxy - Zora1155PremintExecutorProxy proxy = new Zora1155PremintExecutorProxy(address(preminterImplementation), ""); + Zora1155PremintExecutorProxy proxy = new Zora1155PremintExecutorProxy(preminterImplementation, ""); deployment.preminter = address(proxy);