@zoralabs/protocol-deployments 0.0.3 → 0.0.5-prerelease.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +13 -13
- package/CHANGELOG.md +13 -0
- package/addresses/7777777.json +3 -3
- package/addresses/999.json +6 -6
- package/dist/index.cjs +76 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +76 -68
- package/dist/index.js.map +1 -1
- package/dist/package/batchPublish.test.d.ts +16 -16
- package/dist/package/wagmiGenerated.d.ts +312 -201
- package/dist/package/wagmiGenerated.d.ts.map +1 -1
- package/package/wagmiGenerated.ts +76 -105
- package/package.json +2 -3
- package/script/CalculateDeterministicParams.s.sol +3 -3
- package/script/DeployMintersAndImplementations.s.sol +3 -3
- package/script/DeployNew1155Impl.s.sol +25 -0
- package/script/DeployNewImplementation.s.sol +3 -3
- package/script/DeployPreminterImpl.s.sol +3 -3
- package/script/DeployProxiesToNewChain.s.sol +4 -4
- package/script/DeployUpgradeGate.s.sol +5 -5
- package/script/Simulate1155Upgrade.s.sol +37 -0
- package/script/Upgrade.s.sol +3 -3
- package/script/UpgradePreminter.s.sol +3 -3
- package/src/DeploymentConfig.sol +124 -0
- package/src/DeploymentTestingUtils.sol +56 -0
- package/src/DeterministicDeployerScript.sol +253 -0
- package/src/DeterministicProxyDeployer.sol +139 -0
- package/src/IImmutableCreate2Factory.sol +59 -0
- package/src/ZoraDeployerBase.sol +144 -0
- package/src/ZoraDeployerUtils.sol +199 -0
- package/test/NewFactoryProxyDeployer.t.sol +4 -4
- package/test/ZoraCreator1155Factory_Fork.t.sol +1 -3
- package/test/ZoraCreator1155PremintExecutorForkTest.t.sol +1 -1
- package/wagmi.config.ts +1 -7
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.13;
|
|
3
|
+
|
|
4
|
+
import "forge-std/Script.sol";
|
|
5
|
+
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
|
|
6
|
+
|
|
7
|
+
import {IZoraCreator1155Factory} from "@zoralabs/zora-1155-contracts/src/interfaces/IZoraCreator1155Factory.sol";
|
|
8
|
+
import {ZoraCreator1155Impl} from "@zoralabs/zora-1155-contracts/src/nft/ZoraCreator1155Impl.sol";
|
|
9
|
+
import {Zora1155Factory} from "@zoralabs/zora-1155-contracts/src/proxies/Zora1155Factory.sol";
|
|
10
|
+
import {ICreatorRoyaltiesControl} from "@zoralabs/zora-1155-contracts/src/interfaces/ICreatorRoyaltiesControl.sol";
|
|
11
|
+
import {ScriptDeploymentConfig, Deployment, ChainConfig} from "./DeploymentConfig.sol";
|
|
12
|
+
import {ZoraDeployerUtils} from "./ZoraDeployerUtils.sol";
|
|
13
|
+
import {IMinter1155} from "@zoralabs/zora-1155-contracts/src/interfaces/IMinter1155.sol";
|
|
14
|
+
import {DeterministicDeployerScript} from "./DeterministicDeployerScript.sol";
|
|
15
|
+
import {ZoraCreator1155FactoryImpl} from "@zoralabs/zora-1155-contracts/src/factory/ZoraCreator1155FactoryImpl.sol";
|
|
16
|
+
|
|
17
|
+
/// @notice Deployment drops for base where
|
|
18
|
+
abstract contract ZoraDeployerBase is ScriptDeploymentConfig, DeterministicDeployerScript {
|
|
19
|
+
using stdJson for string;
|
|
20
|
+
|
|
21
|
+
/// @notice File used for demo metadata on verification test mint
|
|
22
|
+
string constant DEMO_IPFS_METADATA_FILE = "ipfs://bafkreigu544g6wjvqcysurpzy5pcskbt45a5f33m6wgythpgb3rfqi3lzi";
|
|
23
|
+
|
|
24
|
+
/// @notice Get deployment configuration struct as JSON
|
|
25
|
+
/// @param deployment deployment struct
|
|
26
|
+
/// @return deploymentJson string JSON of the deployment info
|
|
27
|
+
function getDeploymentJSON(Deployment memory deployment) internal returns (string memory deploymentJson) {
|
|
28
|
+
string memory deploymentJsonKey = "deployment_json_file_key";
|
|
29
|
+
vm.serializeAddress(deploymentJsonKey, FIXED_PRICE_SALE_STRATEGY, deployment.fixedPriceSaleStrategy);
|
|
30
|
+
vm.serializeAddress(deploymentJsonKey, MERKLE_MINT_SALE_STRATEGY, deployment.merkleMintSaleStrategy);
|
|
31
|
+
vm.serializeAddress(deploymentJsonKey, REDEEM_MINTER_FACTORY, deployment.redeemMinterFactory);
|
|
32
|
+
vm.serializeString(deploymentJsonKey, CONTRACT_1155_IMPL_VERSION, deployment.contract1155ImplVersion);
|
|
33
|
+
vm.serializeAddress(deploymentJsonKey, CONTRACT_1155_IMPL, deployment.contract1155Impl);
|
|
34
|
+
vm.serializeAddress(deploymentJsonKey, FACTORY_IMPL, deployment.factoryImpl);
|
|
35
|
+
vm.serializeAddress(deploymentJsonKey, PREMINTER_PROXY, deployment.preminterProxy);
|
|
36
|
+
vm.serializeAddress(deploymentJsonKey, PREMINTER_IMPL, deployment.preminterImpl);
|
|
37
|
+
vm.serializeAddress(deploymentJsonKey, UPGRADE_GATE, deployment.upgradeGate);
|
|
38
|
+
deploymentJson = vm.serializeAddress(deploymentJsonKey, FACTORY_PROXY, deployment.factoryProxy);
|
|
39
|
+
console2.log(deploymentJson);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function deployMinters(Deployment memory deployment) internal {
|
|
43
|
+
(address fixedPriceMinter, address merkleMinter, address redeemMinterFactory) = ZoraDeployerUtils.deployMinters();
|
|
44
|
+
deployment.fixedPriceSaleStrategy = address(fixedPriceMinter);
|
|
45
|
+
deployment.merkleMintSaleStrategy = address(merkleMinter);
|
|
46
|
+
deployment.redeemMinterFactory = address(redeemMinterFactory);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function deployNew1155AndFactoryImpl(Deployment memory deployment) internal {
|
|
50
|
+
ChainConfig memory chainConfig = getChainConfig();
|
|
51
|
+
|
|
52
|
+
ensureCanOwn(chainConfig.factoryOwner);
|
|
53
|
+
|
|
54
|
+
(address factoryImplDeployment, address contract1155ImplDeployment, string memory contract1155ImplVersion) = ZoraDeployerUtils
|
|
55
|
+
.deployNew1155AndFactoryImpl({
|
|
56
|
+
upgradeGateAddress: determinsticUpgradeGateAddress(),
|
|
57
|
+
mintFeeRecipient: chainConfig.mintFeeRecipient,
|
|
58
|
+
protocolRewards: chainConfig.protocolRewards,
|
|
59
|
+
merkleMinter: IMinter1155(deployment.merkleMintSaleStrategy),
|
|
60
|
+
redeemMinterFactory: IMinter1155(deployment.redeemMinterFactory),
|
|
61
|
+
fixedPriceMinter: IMinter1155(deployment.fixedPriceSaleStrategy)
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
deployment.factoryImpl = factoryImplDeployment;
|
|
65
|
+
deployment.contract1155Impl = contract1155ImplDeployment;
|
|
66
|
+
deployment.contract1155ImplVersion = contract1155ImplVersion;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function deployNewPreminterImplementationDeterminstic(Deployment memory deployment) internal {
|
|
70
|
+
address factoryProxyAddress = determinticFactoryProxyAddress();
|
|
71
|
+
deployment.preminterImpl = ZoraDeployerUtils.deployNewPreminterImplementationDeterminstic(factoryProxyAddress);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function determinticFactoryProxyAddress() internal view returns (address) {
|
|
75
|
+
return readFactoryProxyDeterminsticParams().deterministicProxyAddress;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function determinsticPreminterProxyAddress() internal view returns (address) {
|
|
79
|
+
return readPreminterProxyDeterminsticParams().deterministicProxyAddress;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function deployFactoryProxyDeterminstic(Deployment memory deployment) internal {
|
|
83
|
+
ChainConfig memory chainConfig = getChainConfig();
|
|
84
|
+
|
|
85
|
+
ensureCanOwn(chainConfig.factoryOwner);
|
|
86
|
+
|
|
87
|
+
address factoryProxyAddress = deployDeterministicProxy({
|
|
88
|
+
proxyName: "factoryProxy",
|
|
89
|
+
implementation: deployment.factoryImpl,
|
|
90
|
+
owner: chainConfig.factoryOwner,
|
|
91
|
+
chain: chainId()
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
require(factoryProxyAddress == determinticFactoryProxyAddress(), "address not expected deterministic address");
|
|
95
|
+
|
|
96
|
+
require(
|
|
97
|
+
keccak256(abi.encodePacked(ZoraCreator1155FactoryImpl(factoryProxyAddress).contractName())) ==
|
|
98
|
+
keccak256(abi.encodePacked("ZORA 1155 Contract Factory"))
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
deployment.factoryProxy = factoryProxyAddress;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function deployPreminterProxyDeterminstic(Deployment memory deployment) internal {
|
|
105
|
+
ChainConfig memory chainConfig = getChainConfig();
|
|
106
|
+
|
|
107
|
+
ensureCanOwn(chainConfig.factoryOwner);
|
|
108
|
+
|
|
109
|
+
address preminterProxyAddress = deployDeterministicProxy({
|
|
110
|
+
proxyName: "premintExecutorProxy",
|
|
111
|
+
implementation: deployment.preminterImpl,
|
|
112
|
+
owner: chainConfig.factoryOwner,
|
|
113
|
+
chain: chainId()
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
require(preminterProxyAddress == determinsticPreminterProxyAddress(), "address not expected deterministic address");
|
|
117
|
+
|
|
118
|
+
deployment.preminterProxy = preminterProxyAddress;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function deployUpgradeGateDeterminstic(Deployment memory deployment) internal {
|
|
122
|
+
ChainConfig memory chainConfig = getChainConfig();
|
|
123
|
+
|
|
124
|
+
ensureCanOwn(chainConfig.factoryOwner);
|
|
125
|
+
|
|
126
|
+
address upgradeGateAddress = deployUpgradeGate({chain: chainId(), upgradeGateOwner: chainConfig.factoryOwner});
|
|
127
|
+
|
|
128
|
+
require(upgradeGateAddress == determinsticUpgradeGateAddress(), "address not expected deterministic address");
|
|
129
|
+
|
|
130
|
+
deployment.upgradeGate = upgradeGateAddress;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function ensureCanOwn(address account) internal view {
|
|
134
|
+
// Sanity check to make sure that the factory owner is a smart contract.
|
|
135
|
+
// This may catch cross-chain data copy mistakes where there is no safe at the desired admin address.
|
|
136
|
+
if (account.code.length == 0) {
|
|
137
|
+
revert("FactoryOwner should be a contract. See DeployNewProxies:31.");
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function determinsticUpgradeGateAddress() internal view returns (address) {
|
|
142
|
+
return vm.parseJsonAddress(vm.readFile("./deterministicConfig/upgradeGate/params.json"), ".upgradeGateAddress");
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
// spdx-license-identifier: mit
|
|
2
|
+
pragma solidity ^0.8.17;
|
|
3
|
+
|
|
4
|
+
import {Zora1155Factory} from "@zoralabs/zora-1155-contracts/src/proxies/Zora1155Factory.sol";
|
|
5
|
+
import {ZoraCreator1155Impl} from "@zoralabs/zora-1155-contracts/src/nft/ZoraCreator1155Impl.sol";
|
|
6
|
+
import {IZoraCreator1155Factory} from "@zoralabs/zora-1155-contracts/src/interfaces/IZoraCreator1155Factory.sol";
|
|
7
|
+
import {ZoraCreator1155FactoryImpl} from "@zoralabs/zora-1155-contracts/src/factory/ZoraCreator1155FactoryImpl.sol";
|
|
8
|
+
import {IMinter1155} from "@zoralabs/zora-1155-contracts/src/interfaces/IMinter1155.sol";
|
|
9
|
+
import {Deployment, ChainConfig} from "./DeploymentConfig.sol";
|
|
10
|
+
import {ProxyShim} from "@zoralabs/zora-1155-contracts/src/utils/ProxyShim.sol";
|
|
11
|
+
import {ZoraCreator1155PremintExecutorImpl} from "@zoralabs/zora-1155-contracts/src/delegation/ZoraCreator1155PremintExecutorImpl.sol";
|
|
12
|
+
import {IImmutableCreate2Factory} from "./IImmutableCreate2Factory.sol";
|
|
13
|
+
import {DeterministicProxyDeployer} from "./DeterministicProxyDeployer.sol";
|
|
14
|
+
import {ZoraCreatorFixedPriceSaleStrategy} from "@zoralabs/zora-1155-contracts/src/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.sol";
|
|
15
|
+
import {ZoraCreatorMerkleMinterStrategy} from "@zoralabs/zora-1155-contracts/src/minters/merkle/ZoraCreatorMerkleMinterStrategy.sol";
|
|
16
|
+
import {ZoraCreatorRedeemMinterFactory} from "@zoralabs/zora-1155-contracts/src/minters/redeem/ZoraCreatorRedeemMinterFactory.sol";
|
|
17
|
+
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";
|
|
18
|
+
import {ICreatorRoyaltiesControl} from "@zoralabs/zora-1155-contracts/src/interfaces/ICreatorRoyaltiesControl.sol";
|
|
19
|
+
import {UpgradeGate} from "@zoralabs/zora-1155-contracts/src/upgrades/UpgradeGate.sol";
|
|
20
|
+
|
|
21
|
+
struct Create2Deployment {
|
|
22
|
+
address deployerAddress;
|
|
23
|
+
bytes32 salt;
|
|
24
|
+
bytes constructorArguments;
|
|
25
|
+
address deployedAddress;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
library ZoraDeployerUtils {
|
|
29
|
+
IImmutableCreate2Factory constant IMMUTABLE_CREATE2_FACTORY = IImmutableCreate2Factory(0x0000000000FFe8B47B3e2130213B802212439497);
|
|
30
|
+
|
|
31
|
+
bytes32 constant IMMUTABLE_CREATE_2_FRIENDLY_SALT = bytes32(0x0000000000000000000000000000000000000000000000000000000000000001);
|
|
32
|
+
|
|
33
|
+
function deployWithImmutableCreate2(
|
|
34
|
+
bytes32 salt,
|
|
35
|
+
bytes memory creationCode,
|
|
36
|
+
bytes memory constructorArguments
|
|
37
|
+
) internal returns (Create2Deployment memory) {
|
|
38
|
+
address deployedAddress = IMMUTABLE_CREATE2_FACTORY.safeCreate2(salt, abi.encodePacked(creationCode, constructorArguments));
|
|
39
|
+
|
|
40
|
+
return
|
|
41
|
+
Create2Deployment({
|
|
42
|
+
deployerAddress: address(IMMUTABLE_CREATE2_FACTORY),
|
|
43
|
+
salt: salt,
|
|
44
|
+
constructorArguments: constructorArguments,
|
|
45
|
+
deployedAddress: deployedAddress
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function ensureValidUpgradeGate(address upgradeGateAddress) internal pure {
|
|
50
|
+
require(
|
|
51
|
+
keccak256(abi.encodePacked(UpgradeGate(upgradeGateAddress).contractName())) == keccak256(abi.encodePacked("ZORA 1155 Upgrade Gate")),
|
|
52
|
+
"INVALID_UPGRADE_GATE"
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function deployNew1155AndFactoryImpl(
|
|
57
|
+
address upgradeGateAddress,
|
|
58
|
+
address mintFeeRecipient,
|
|
59
|
+
address protocolRewards,
|
|
60
|
+
IMinter1155 merkleMinter,
|
|
61
|
+
IMinter1155 redeemMinterFactory,
|
|
62
|
+
IMinter1155 fixedPriceMinter
|
|
63
|
+
) internal returns (address factoryImplAddress, address contract1155ImplAddress, string memory contract1155ImplVersion) {
|
|
64
|
+
ensureValidUpgradeGate(upgradeGateAddress);
|
|
65
|
+
|
|
66
|
+
ZoraCreator1155Impl zoraCreator1155Impl = new ZoraCreator1155Impl(mintFeeRecipient, upgradeGateAddress, protocolRewards);
|
|
67
|
+
|
|
68
|
+
contract1155ImplVersion = zoraCreator1155Impl.contractVersion();
|
|
69
|
+
|
|
70
|
+
contract1155ImplAddress = address(zoraCreator1155Impl);
|
|
71
|
+
factoryImplAddress = address(
|
|
72
|
+
new ZoraCreator1155FactoryImpl({
|
|
73
|
+
_zora1155Impl: zoraCreator1155Impl,
|
|
74
|
+
_merkleMinter: merkleMinter,
|
|
75
|
+
_redeemMinterFactory: redeemMinterFactory,
|
|
76
|
+
_fixedPriceMinter: fixedPriceMinter
|
|
77
|
+
})
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function deployImmutableOrGetAddress(bytes32 salt, bytes memory creationCode) internal returns (address) {
|
|
82
|
+
address deployedAddress = Create2.computeAddress(salt, keccak256(creationCode), address(IMMUTABLE_CREATE2_FACTORY));
|
|
83
|
+
if (IMMUTABLE_CREATE2_FACTORY.hasBeenDeployed(deployedAddress)) {
|
|
84
|
+
return deployedAddress;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return IMMUTABLE_CREATE2_FACTORY.safeCreate2(salt, creationCode);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function deployMinters() internal returns (address fixedPriceMinter, address merkleMinter, address redeemMinterFactory) {
|
|
91
|
+
fixedPriceMinter = deployImmutableOrGetAddress(
|
|
92
|
+
bytes32(0x0000000000000000000000000000000000000000000000000000000000000001),
|
|
93
|
+
type(ZoraCreatorFixedPriceSaleStrategy).creationCode
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
merkleMinter = deployImmutableOrGetAddress(
|
|
97
|
+
bytes32(0x0000000000000000000000000000000000000000000000000000000000000001),
|
|
98
|
+
type(ZoraCreatorMerkleMinterStrategy).creationCode
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
redeemMinterFactory = deployImmutableOrGetAddress(
|
|
102
|
+
bytes32(0x0000000000000000000000000000000000000000000000000000000000000001),
|
|
103
|
+
type(ZoraCreatorRedeemMinterFactory).creationCode
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// we dont care what this salt is, as long as it's the same for all deployments and it has first 20 bytes of 0
|
|
108
|
+
// so that anyone can deploy it
|
|
109
|
+
bytes32 constant FACTORY_DEPLOYER_DEPLOYMENT_SALT = bytes32(0x0000000000000000000000000000000000000000668d7f9ed18e35000dbaba0f);
|
|
110
|
+
|
|
111
|
+
function createDeterministicFactoryProxyDeployer() internal returns (DeterministicProxyDeployer) {
|
|
112
|
+
return
|
|
113
|
+
DeterministicProxyDeployer(IMMUTABLE_CREATE2_FACTORY.safeCreate2(FACTORY_DEPLOYER_DEPLOYMENT_SALT, type(DeterministicProxyDeployer).creationCode));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function deployNewPreminterImplementationDeterminstic(address factoryProxyAddress) internal returns (address) {
|
|
117
|
+
// create preminter implementation
|
|
118
|
+
bytes memory creationCode = abi.encodePacked(type(ZoraCreator1155PremintExecutorImpl).creationCode, abi.encode(factoryProxyAddress));
|
|
119
|
+
|
|
120
|
+
address preminterImplementation = IMMUTABLE_CREATE2_FACTORY.safeCreate2(
|
|
121
|
+
bytes32(0x0000000000000000000000000000000000000000668d7f9ec18e35000dbaba0e),
|
|
122
|
+
creationCode
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
return preminterImplementation;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function deterministicFactoryDeployerAddress() internal view returns (address) {
|
|
129
|
+
// we can know deterministically what the address of the new factory proxy deployer will be, given it's deployed from with the salt and init code,
|
|
130
|
+
// from the ImmutableCreate2Factory
|
|
131
|
+
return IMMUTABLE_CREATE2_FACTORY.findCreate2Address(FACTORY_DEPLOYER_DEPLOYMENT_SALT, type(DeterministicProxyDeployer).creationCode);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function factoryProxyConstructorArguments(bytes32 proxyShimSalt, address proxyDeployerAddress) internal pure returns (bytes memory) {
|
|
135
|
+
address proxyShimAddress = Create2.computeAddress(
|
|
136
|
+
proxyShimSalt,
|
|
137
|
+
keccak256(abi.encodePacked(type(ProxyShim).creationCode, abi.encode(proxyDeployerAddress))),
|
|
138
|
+
proxyDeployerAddress
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
return abi.encode(proxyShimAddress, "");
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function deterministicFactoryProxyAddress(bytes32 proxyShimSalt, bytes32 factoryProxySalt, address proxyDeployerAddress) internal pure returns (address) {
|
|
145
|
+
bytes memory constructorArguments = factoryProxyConstructorArguments(proxyShimSalt, proxyDeployerAddress);
|
|
146
|
+
|
|
147
|
+
return
|
|
148
|
+
Create2.computeAddress(
|
|
149
|
+
factoryProxySalt,
|
|
150
|
+
keccak256(abi.encodePacked(type(Zora1155Factory).creationCode, constructorArguments)),
|
|
151
|
+
proxyDeployerAddress
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/// @notice Deploy a test contract for etherscan auto-verification
|
|
156
|
+
/// @param factoryProxy Factory address to use
|
|
157
|
+
/// @param admin Admin owner address to use
|
|
158
|
+
function deployTestContractForVerification(address factoryProxy, address admin) internal returns (address) {
|
|
159
|
+
bytes[] memory initUpdate = new bytes[](1);
|
|
160
|
+
initUpdate[0] = abi.encodeWithSelector(
|
|
161
|
+
ZoraCreator1155Impl.setupNewToken.selector,
|
|
162
|
+
"ipfs://bafkreigu544g6wjvqcysurpzy5pcskbt45a5f33m6wgythpgb3rfqi3lzi",
|
|
163
|
+
100
|
|
164
|
+
);
|
|
165
|
+
return
|
|
166
|
+
address(
|
|
167
|
+
IZoraCreator1155Factory(factoryProxy).createContract(
|
|
168
|
+
"ipfs://bafybeicgolwqpozsc7iwgytavete56a2nnytzix2nb2rxefdvbtwwtnnoe/metadata",
|
|
169
|
+
unicode"🪄",
|
|
170
|
+
ICreatorRoyaltiesControl.RoyaltyConfiguration({royaltyBPS: 0, royaltyRecipient: address(0), royaltyMintSchedule: 0}),
|
|
171
|
+
payable(admin),
|
|
172
|
+
initUpdate
|
|
173
|
+
)
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function getUpgradeCalldata(Deployment memory deployment) internal returns (bytes memory upgradeCalldata) {
|
|
178
|
+
// create 1155 proxy from deployment factory proxy address
|
|
179
|
+
ZoraCreator1155FactoryImpl factory = ZoraCreator1155FactoryImpl(deployment.factoryProxy);
|
|
180
|
+
|
|
181
|
+
address owner = factory.owner();
|
|
182
|
+
|
|
183
|
+
// simulate upgrade call
|
|
184
|
+
upgradeCalldata = abi.encodeWithSelector(factory.upgradeTo.selector, deployment.factoryImpl);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function simulateUpgrade(Deployment memory deployment) internal returns (address target, bytes memory upgradeCalldata) {
|
|
188
|
+
// console log update information
|
|
189
|
+
|
|
190
|
+
upgradeCalldata = getUpgradeCalldata(deployment);
|
|
191
|
+
|
|
192
|
+
target = deployment.factoryProxy;
|
|
193
|
+
// upgrade the factory proxy to the new implementation
|
|
194
|
+
|
|
195
|
+
(bool success, ) = target.call(upgradeCalldata);
|
|
196
|
+
|
|
197
|
+
require(success, "upgrade failed");
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -3,14 +3,14 @@ pragma solidity 0.8.17;
|
|
|
3
3
|
|
|
4
4
|
import "forge-std/Test.sol";
|
|
5
5
|
import {Zora1155Factory} from "@zoralabs/zora-1155-contracts/src/proxies/Zora1155Factory.sol";
|
|
6
|
-
import {ZoraDeployerUtils, Create2Deployment} from "
|
|
7
|
-
import {DeterministicProxyDeployer} from "
|
|
6
|
+
import {ZoraDeployerUtils, Create2Deployment} from "../src/ZoraDeployerUtils.sol";
|
|
7
|
+
import {DeterministicProxyDeployer} from "../src/DeterministicProxyDeployer.sol";
|
|
8
8
|
import {ProxyShim} from "@zoralabs/zora-1155-contracts/src/utils/ProxyShim.sol";
|
|
9
9
|
import {UpgradeGate} from "@zoralabs/zora-1155-contracts/src/upgrades/UpgradeGate.sol";
|
|
10
|
-
import {Deployment, ChainConfig} from "
|
|
10
|
+
import {Deployment, ChainConfig} from "../src/DeploymentConfig.sol";
|
|
11
11
|
import {IMinter1155} from "@zoralabs/zora-1155-contracts/src/interfaces/IMinter1155.sol";
|
|
12
12
|
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";
|
|
13
|
-
import {DeterministicDeployerScript, DeterministicParams} from "
|
|
13
|
+
import {DeterministicDeployerScript, DeterministicParams} from "../src/DeterministicDeployerScript.sol";
|
|
14
14
|
|
|
15
15
|
contract DeterministicProxyDeployerTest is DeterministicDeployerScript, Test {
|
|
16
16
|
using stdJson for string;
|
|
@@ -12,7 +12,7 @@ import {IOwnable} from "@zoralabs/zora-1155-contracts/src/interfaces/IOwnable.so
|
|
|
12
12
|
import {ICreatorRoyaltiesControl} from "@zoralabs/zora-1155-contracts/src/interfaces/ICreatorRoyaltiesControl.sol";
|
|
13
13
|
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
|
|
14
14
|
import {ZoraCreatorFixedPriceSaleStrategy} from "@zoralabs/zora-1155-contracts/src/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.sol";
|
|
15
|
-
import {ForkDeploymentConfig, Deployment} from "
|
|
15
|
+
import {ForkDeploymentConfig, Deployment} from "../src/DeploymentConfig.sol";
|
|
16
16
|
|
|
17
17
|
contract ZoraCreator1155FactoryForkTest is ForkDeploymentConfig, Test {
|
|
18
18
|
uint256 constant quantityToMint = 3;
|
|
@@ -131,8 +131,6 @@ contract ZoraCreator1155FactoryForkTest is ForkDeploymentConfig, Test {
|
|
|
131
131
|
address factoryAddress = deployment.factoryProxy;
|
|
132
132
|
ZoraCreator1155FactoryImpl factory = ZoraCreator1155FactoryImpl(factoryAddress);
|
|
133
133
|
|
|
134
|
-
assertEq(factory.implementation(), deployment.factoryImpl, "factory implementation incorrect");
|
|
135
|
-
|
|
136
134
|
assertEq(getChainConfig().factoryOwner, IOwnable(factoryAddress).owner(), string.concat("configured owner incorrect on: ", chainName));
|
|
137
135
|
|
|
138
136
|
// make sure that the address from the factory matches the stored fixed price address
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
pragma solidity 0.8.17;
|
|
3
3
|
|
|
4
4
|
import "forge-std/Test.sol";
|
|
5
|
-
import {ForkDeploymentConfig} from "
|
|
5
|
+
import {ForkDeploymentConfig} from "../src/DeploymentConfig.sol";
|
|
6
6
|
import {ZoraCreator1155Attribution, ContractCreationConfig, PremintConfig, TokenCreationConfig} from "@zoralabs/zora-1155-contracts/src/delegation/ZoraCreator1155Attribution.sol";
|
|
7
7
|
import {ZoraCreator1155PremintExecutorImpl} from "@zoralabs/zora-1155-contracts/src/delegation/ZoraCreator1155PremintExecutorImpl.sol";
|
|
8
8
|
import {ZoraCreator1155FactoryImpl} from "@zoralabs/zora-1155-contracts/src/factory/ZoraCreator1155FactoryImpl.sol";
|
package/wagmi.config.ts
CHANGED
|
@@ -85,13 +85,7 @@ const getAddresses = () => {
|
|
|
85
85
|
chainId,
|
|
86
86
|
address: jsonAddress.PREMINTER_PROXY,
|
|
87
87
|
abi: abis.zoraCreator1155PremintExecutorImplABI,
|
|
88
|
-
})
|
|
89
|
-
addAddress({
|
|
90
|
-
contractName: "IImmutableCreate2Factory",
|
|
91
|
-
chainId,
|
|
92
|
-
address: "0x0000000000FFe8B47B3e2130213B802212439497",
|
|
93
|
-
abi: abis.iImmutableCreate2FactoryABI,
|
|
94
|
-
});
|
|
88
|
+
});
|
|
95
89
|
}
|
|
96
90
|
|
|
97
91
|
return addresses;
|