Skip to content

Commit

Permalink
another rename :)
Browse files Browse the repository at this point in the history
  • Loading branch information
oveddan committed Sep 28, 2023
1 parent c79f671 commit c34d9cd
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 19 deletions.
4 changes: 2 additions & 2 deletions script/DeployNewFactoryProxy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "forge-std/console2.sol";

import {ZoraDeployerBase} from "./ZoraDeployerBase.sol";
import {ChainConfig, Deployment} from "../src/deployment/DeploymentConfig.sol";
import {ZoraDeployer} from "../src/deployment/ZoraDeployer.sol";
import {ZoraDeployerUtils} from "../src/deployment/ZoraDeployerUtils.sol";
import {NewFactoryProxyDeployer} from "../src/deployment/NewFactoryProxyDeployer.sol";
import {DeterminsticDeployerScript, DeterminsticParams} from "../src/deployment/DeterminsticDeployerScript.sol";

Expand All @@ -31,7 +31,7 @@ contract DeployNewFactoryProxy is ZoraDeployerBase, DeterminsticDeployerScript {
vm.startBroadcast(deployerPrivateKey);

NewFactoryProxyDeployer factoryDeployer = NewFactoryProxyDeployer(
ZoraDeployer.IMMUTABLE_CREATE2_FACTORY.safeCreate2(params.proxyDeployerSalt, params.proxyDeployerCreationCode)
ZoraDeployerUtils.IMMUTABLE_CREATE2_FACTORY.safeCreate2(params.proxyDeployerSalt, params.proxyDeployerCreationCode)
);

console2.log(address(factoryDeployer));
Expand Down
4 changes: 2 additions & 2 deletions script/DeployNewImplementation.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {IMinter1155} from "../src/interfaces/IMinter1155.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 {ZoraDeployer} from "../src/deployment/ZoraDeployer.sol";
import {ZoraDeployerUtils} from "../src/deployment/ZoraDeployerUtils.sol";

contract DeployNewImplementations is ZoraDeployerBase {
function run() public returns (string memory) {
Expand All @@ -33,7 +33,7 @@ contract DeployNewImplementations is ZoraDeployerBase {

vm.startBroadcast(deployerPrivateKey);

(address factoryImplAddress, address contract1155ImplAddress) = ZoraDeployer.deployNew1155AndFactoryImpl(
(address factoryImplAddress, address contract1155ImplAddress) = ZoraDeployerUtils.deployNew1155AndFactoryImpl(
address(deployment.factoryProxy),
chainConfig.mintFeeRecipient,
chainConfig.protocolRewards,
Expand Down
2 changes: 1 addition & 1 deletion script/GenerateDeterminsticParams.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {Zora1155Factory} from "../src/proxies/Zora1155Factory.sol";
import {ProxyShim} from "../src/utils/ProxyShim.sol";
import {LibString} from "solady/utils/LibString.sol";
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";
import {ZoraDeployer} from "../src/deployment/ZoraDeployer.sol";
import {ZoraDeployerUtils} from "../src/deployment/ZoraDeployerUtils.sol";
import {DeterminsticDeployerScript, DeterminsticParams} from "../src/deployment/DeterminsticDeployerScript.sol";
import {NewFactoryProxyDeployer} from "../src/deployment/NewFactoryProxyDeployer.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
Expand Down
4 changes: 2 additions & 2 deletions script/UpgradePreminter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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";
import {ZoraDeployer} from "../src/deployment/ZoraDeployer.sol";
import {ZoraDeployerUtils} from "../src/deployment/ZoraDeployerUtils.sol";

contract UpgradePreminter is ZoraDeployerBase {
function run() public returns (string memory, bytes memory upgradeCalldata, address upgradeTarget) {
Expand All @@ -17,7 +17,7 @@ contract UpgradePreminter is ZoraDeployerBase {

vm.startBroadcast(deployerPrivateKey);

address preminterImplementation = ZoraDeployer.deployNewPreminterImplementation(deployment.factoryProxy);
address preminterImplementation = ZoraDeployerUtils.deployNewPreminterImplementation(deployment.factoryProxy);

vm.stopBroadcast();

Expand Down
6 changes: 3 additions & 3 deletions script/ZoraDeployerBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {ZoraCreator1155Impl} from "../src/nft/ZoraCreator1155Impl.sol";
import {Zora1155Factory} from "../src/proxies/Zora1155Factory.sol";
import {ICreatorRoyaltiesControl} from "../src/interfaces/ICreatorRoyaltiesControl.sol";
import {ScriptDeploymentConfig, Deployment, ChainConfig} from "../src/deployment/DeploymentConfig.sol";
import {ZoraDeployer} from "../src/deployment/ZoraDeployer.sol";
import {ZoraDeployerUtils} from "../src/deployment/ZoraDeployerUtils.sol";
import {IMinter1155} from "../src/interfaces/IMinter1155.sol";

/// @notice Deployment drops for base where
Expand Down Expand Up @@ -38,7 +38,7 @@ abstract contract ZoraDeployerBase is ScriptDeploymentConfig, Script {
function deployNew1155AndFactoryImpl(Deployment memory deployment, Zora1155Factory factoryProxy) internal {
ChainConfig memory chainConfig = getChainConfig();

(address factoryImplAddress, address contract1155ImplAddress) = ZoraDeployer.deployNew1155AndFactoryImpl({
(address factoryImplAddress, address contract1155ImplAddress) = ZoraDeployerUtils.deployNew1155AndFactoryImpl({
factoryProxyAddress: address(factoryProxy),
mintFeeRecipient: chainConfig.mintFeeRecipient,
protocolRewards: chainConfig.protocolRewards,
Expand All @@ -54,7 +54,7 @@ abstract contract ZoraDeployerBase is ScriptDeploymentConfig, Script {
function deployNewPreminterProxy(Deployment memory deployment) internal {
address proxyOwner = getChainConfig().factoryOwner;

deployment.preminter = ZoraDeployer.deployNewPreminterProxy(deployment.factoryProxy, proxyOwner);
deployment.preminter = ZoraDeployerUtils.deployNewPreminterProxy(deployment.factoryProxy, proxyOwner);
}

/// @notice Deploy a test contract for etherscan auto-verification
Expand Down
9 changes: 6 additions & 3 deletions src/deployment/DeterminsticDeployerScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {ProxyShim} from "../utils/ProxyShim.sol";
import {NewFactoryProxyDeployer} from "./NewFactoryProxyDeployer.sol";
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";
import {LibString} from "solady/utils/LibString.sol";
import {ZoraDeployer} from "./ZoraDeployer.sol";
import {ZoraDeployerUtils} from "./ZoraDeployerUtils.sol";

struct DeterminsticParams {
bytes proxyDeployerCreationCode;
Expand Down Expand Up @@ -108,13 +108,16 @@ contract DeterminsticDeployerScript is Script {

// replace first 20 characters of salt with deployer address, so that the salt can be used with
// ImmutableCreate2Factory.safeCreate2 when called by this deployer's account:
newFactoryProxyDeployerSalt = ZoraDeployer.FACTORY_DEPLOYER_DEPLOYMENT_SALT;
newFactoryProxyDeployerSalt = ZoraDeployerUtils.FACTORY_DEPLOYER_DEPLOYMENT_SALT;

newFactoryProxyDeployerInitCode = type(NewFactoryProxyDeployer).creationCode;

// we can know determinstically what the address of the new factory proxy deployer will be, given it's deployed from with the salt and init code,
// from the ImmutableCreate2Factory
proxyDeployerContractAddress = ZoraDeployer.IMMUTABLE_CREATE2_FACTORY.findCreate2Address(newFactoryProxyDeployerSalt, newFactoryProxyDeployerInitCode);
proxyDeployerContractAddress = ZoraDeployerUtils.IMMUTABLE_CREATE2_FACTORY.findCreate2Address(
newFactoryProxyDeployerSalt,
newFactoryProxyDeployerInitCode
);

console2.log("expected factory deployer address:", proxyDeployerContractAddress);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {IImmutableCreate2Factory} from "./IImmutableCreate2Factory.sol";
import {NewFactoryProxyDeployer} from "./NewFactoryProxyDeployer.sol";
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";

library ZoraDeployer {
library ZoraDeployerUtils {
IImmutableCreate2Factory constant IMMUTABLE_CREATE2_FACTORY = IImmutableCreate2Factory(0x0000000000FFe8B47B3e2130213B802212439497);

function deployNew1155AndFactoryImpl(
Expand Down
10 changes: 5 additions & 5 deletions test/deployer/NewFactoryProxyDeployer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.17;

import "forge-std/Test.sol";
import {Zora1155Factory} from "../../src/proxies/Zora1155Factory.sol";
import {ZoraDeployer} from "../../src/deployment/ZoraDeployer.sol";
import {ZoraDeployerUtils} from "../../src/deployment/ZoraDeployerUtils.sol";
import {NewFactoryProxyDeployer} from "../../src/deployment/NewFactoryProxyDeployer.sol";
import {ProxyShim} from "../../src/utils/ProxyShim.sol";
import {Deployment, ChainConfig} from "../../src/deployment/DeploymentConfig.sol";
Expand Down Expand Up @@ -33,14 +33,14 @@ contract NewFactoryProxyDeployerTest is Test {

bytes memory newFactoryProxyDeployerInitCode = type(NewFactoryProxyDeployer).creationCode;

address computedFactoryDeployerAddress = ZoraDeployer.IMMUTABLE_CREATE2_FACTORY.findCreate2Address(
address computedFactoryDeployerAddress = ZoraDeployerUtils.IMMUTABLE_CREATE2_FACTORY.findCreate2Address(
newFactoryProxyDeployerCreationSalt,
newFactoryProxyDeployerInitCode
);

assertEq(computedFactoryDeployerAddress, expectedFactoryDeployerAddress, "determinstic factory deployer address wrong");

address computedFactoryProxyAddress = ZoraDeployer.determinsticFactoryProxyAddress({
address computedFactoryProxyAddress = ZoraDeployerUtils.determinsticFactoryProxyAddress({
proxyShimSalt: proxyShimSalt,
factoryProxySalt: factoryProxySalt,
proxyDeployerAddress: computedFactoryDeployerAddress
Expand All @@ -51,7 +51,7 @@ contract NewFactoryProxyDeployerTest is Test {
// 1. Create implementation contracts based on determinstic factory proxy address

// create 1155 and factory impl, we can know the determinstic factor proxy address ahead of time:
(address factoryImplAddress, ) = ZoraDeployer.deployNew1155AndFactoryImpl({
(address factoryImplAddress, ) = ZoraDeployerUtils.deployNew1155AndFactoryImpl({
factoryProxyAddress: expectedFactoryProxyAddress,
mintFeeRecipient: mintFeeRecipient,
protocolRewards: protocolRewards,
Expand All @@ -67,7 +67,7 @@ contract NewFactoryProxyDeployerTest is Test {
// 2. Create factory deployer at determinstic address

// create new factory deployer using ImmutableCreate2Factory
address newFactoryProxyDeployerAddress = ZoraDeployer.IMMUTABLE_CREATE2_FACTORY.safeCreate2(
address newFactoryProxyDeployerAddress = ZoraDeployerUtils.IMMUTABLE_CREATE2_FACTORY.safeCreate2(
newFactoryProxyDeployerCreationSalt,
newFactoryProxyDeployerInitCode
);
Expand Down

0 comments on commit c34d9cd

Please sign in to comment.