@zoralabs/protocol-deployments 0.0.12 → 0.0.14-MINT.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.
Files changed (91) hide show
  1. package/.turbo/turbo-build.log +17 -18
  2. package/CHANGELOG.md +19 -0
  3. package/README.md +2 -8
  4. package/dist/{package/chainConfigs.d.ts → chainConfigs.d.ts} +4 -3
  5. package/dist/chainConfigs.d.ts.map +1 -0
  6. package/dist/deployment.d.ts.map +1 -0
  7. package/dist/index.cjs +88 -57
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +84 -53
  11. package/dist/index.js.map +1 -1
  12. package/dist/{package/wagmiGenerated.d.ts → wagmiGenerated.d.ts} +118 -44
  13. package/dist/{package/wagmiGenerated.d.ts.map → wagmiGenerated.d.ts.map} +1 -1
  14. package/package.json +10 -22
  15. package/{script → scripts}/bundle-chainConfigs.mjs +9 -7
  16. package/src/chainConfigs.ts +62 -0
  17. package/{package → src}/wagmiGenerated.ts +72 -36
  18. package/tsconfig.json +1 -1
  19. package/tsup.config.ts +5 -5
  20. package/wagmi.config.ts +31 -9
  21. package/.env.anvil +0 -2
  22. package/addresses/1.json +0 -13
  23. package/addresses/10.json +0 -13
  24. package/addresses/11155111.json +0 -13
  25. package/addresses/420.json +0 -13
  26. package/addresses/424.json +0 -11
  27. package/addresses/5.json +0 -14
  28. package/addresses/58008.json +0 -11
  29. package/addresses/7777777.json +0 -13
  30. package/addresses/8453.json +0 -13
  31. package/addresses/84531.json +0 -14
  32. package/addresses/999.json +0 -13
  33. package/addresses/999999999.json +0 -14
  34. package/chainConfigs/1.json +0 -5
  35. package/chainConfigs/10.json +0 -5
  36. package/chainConfigs/11155111.json +0 -5
  37. package/chainConfigs/420.json +0 -5
  38. package/chainConfigs/424.json +0 -5
  39. package/chainConfigs/5.json +0 -5
  40. package/chainConfigs/58008.json +0 -4
  41. package/chainConfigs/7777777.json +0 -5
  42. package/chainConfigs/8453.json +0 -5
  43. package/chainConfigs/84531.json +0 -5
  44. package/chainConfigs/999.json +0 -5
  45. package/chainConfigs/999999999.json +0 -5
  46. package/deterministicConfig/factoryProxy/params.json +0 -10
  47. package/deterministicConfig/factoryProxy/signatures.json +0 -14
  48. package/deterministicConfig/premintExecutorProxy/params.json +0 -10
  49. package/deterministicConfig/premintExecutorProxy/signatures.json +0 -12
  50. package/deterministicConfig/upgradeGate/params.json +0 -7
  51. package/deterministicConfig/upgradeGate/signatures.json +0 -14
  52. package/dist/package/batchPublish.test.d.ts +0 -452
  53. package/dist/package/batchPublish.test.d.ts.map +0 -1
  54. package/dist/package/chainConfigs.d.ts.map +0 -1
  55. package/dist/package/deployment.d.ts.map +0 -1
  56. package/dist/package/index.d.ts.map +0 -1
  57. package/dist/script/copy-deployed-contracts.d.ts +0 -2
  58. package/dist/script/copy-deployed-contracts.d.ts.map +0 -1
  59. package/dist/script/signDeploymentTransactions.d.ts +0 -2
  60. package/dist/script/signDeploymentTransactions.d.ts.map +0 -1
  61. package/foundry.toml +0 -41
  62. package/package/batchPublish.test.ts +0 -327
  63. package/remappings.txt +0 -9
  64. package/script/CalculateDeterministicParams.s.sol +0 -84
  65. package/script/DeployMintersAndImplementations.s.sol +0 -29
  66. package/script/DeployNew1155Impl.s.sol +0 -24
  67. package/script/DeployNewImplementation.s.sol +0 -26
  68. package/script/DeployPreminterImpl.s.sol +0 -23
  69. package/script/DeployProxiesToNewChain.s.sol +0 -50
  70. package/script/DeployTestContracts.s.sol +0 -35
  71. package/script/DeployUpgradeGate.s.sol +0 -27
  72. package/script/Upgrade.s.sol +0 -83
  73. package/script/UpgradePreminter.s.sol +0 -34
  74. package/script/copy-deployed-contracts.ts +0 -86
  75. package/script/signDeploymentTransactions.ts +0 -302
  76. package/src/DeploymentConfig.sol +0 -124
  77. package/src/DeploymentTestingUtils.sol +0 -166
  78. package/src/DeterministicDeployerScript.sol +0 -249
  79. package/src/DeterministicProxyDeployer.sol +0 -139
  80. package/src/IImmutableCreate2Factory.sol +0 -59
  81. package/src/Zora1155PremintFixtures.sol +0 -75
  82. package/src/ZoraDeployerBase.sol +0 -144
  83. package/src/ZoraDeployerUtils.sol +0 -212
  84. package/test/NewFactoryProxyDeployer.t.sol +0 -127
  85. package/test/UpgradesTest.t.sol +0 -222
  86. package/test/ZoraCreator1155Factory_Fork.t.sol +0 -149
  87. package/test/ZoraCreator1155PremintExecutorForkTest.t.sol +0 -205
  88. /package/dist/{package/deployment.d.ts → deployment.d.ts} +0 -0
  89. /package/dist/{package/index.d.ts → index.d.ts} +0 -0
  90. /package/{package → src}/deployment.ts +0 -0
  91. /package/{package → src}/index.ts +0 -0
@@ -1,83 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity ^0.8.17;
3
-
4
- import "forge-std/Script.sol";
5
-
6
- import {ZoraDeployerBase} from "../src/ZoraDeployerBase.sol";
7
- import {ChainConfig, Deployment} from "../src/DeploymentConfig.sol";
8
-
9
- import {ZoraCreator1155FactoryImpl} from "@zoralabs/zora-1155-contracts/src/factory/ZoraCreator1155FactoryImpl.sol";
10
- import {Zora1155Factory} from "@zoralabs/zora-1155-contracts/src/proxies/Zora1155Factory.sol";
11
- import {ZoraCreator1155Impl} from "@zoralabs/zora-1155-contracts/src/nft/ZoraCreator1155Impl.sol";
12
- import {ICreatorRoyaltiesControl} from "@zoralabs/zora-1155-contracts/src/interfaces/ICreatorRoyaltiesControl.sol";
13
- import {IZoraCreator1155Factory} from "@zoralabs/zora-1155-contracts/src/interfaces/IZoraCreator1155Factory.sol";
14
- import {IMinter1155} from "@zoralabs/zora-1155-contracts/src/interfaces/IMinter1155.sol";
15
- import {IZoraCreator1155} from "@zoralabs/zora-1155-contracts/src/interfaces/IZoraCreator1155.sol";
16
- import {ZoraCreatorFixedPriceSaleStrategy} from "@zoralabs/zora-1155-contracts/src/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.sol";
17
- import {ZoraCreatorMerkleMinterStrategy} from "@zoralabs/zora-1155-contracts/src/minters/merkle/ZoraCreatorMerkleMinterStrategy.sol";
18
- import {ZoraCreatorRedeemMinterFactory} from "@zoralabs/zora-1155-contracts/src/minters/redeem/ZoraCreatorRedeemMinterFactory.sol";
19
- import {ZoraDeployerUtils} from "../src/ZoraDeployerUtils.sol";
20
- import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
21
-
22
- contract UpgradeScript is ZoraDeployerBase {
23
- using Strings for uint256;
24
- using stdJson for string;
25
-
26
- string configFile;
27
-
28
- function run() public returns (string memory) {
29
- Deployment memory deployment = getDeployment();
30
- ChainConfig memory chainConfig = getChainConfig();
31
-
32
- vm.startBroadcast();
33
-
34
- if (deployment.fixedPriceSaleStrategy == address(0)) {
35
- deployment.fixedPriceSaleStrategy = address(new ZoraCreatorFixedPriceSaleStrategy());
36
- console2.log("New FixedPriceMinter", deployment.fixedPriceSaleStrategy);
37
- } else {
38
- console2.log("Existing FIXED_PRICE_STRATEGY", deployment.fixedPriceSaleStrategy);
39
- }
40
-
41
- if (deployment.merkleMintSaleStrategy == address(0)) {
42
- deployment.merkleMintSaleStrategy = address(new ZoraCreatorMerkleMinterStrategy());
43
- console2.log("New MerkleMintStrategy", deployment.merkleMintSaleStrategy);
44
- } else {
45
- console2.log("Existing MERKLE_MINT_STRATEGY", deployment.merkleMintSaleStrategy);
46
- }
47
-
48
- if (deployment.redeemMinterFactory == address(0)) {
49
- deployment.redeemMinterFactory = address(new ZoraCreatorRedeemMinterFactory());
50
- console2.log("New REDEEM_MINTER_FACTORY", address(deployment.redeemMinterFactory));
51
- } else {
52
- console2.log("Existing REDEEM_MINTER_FACTORY", deployment.redeemMinterFactory);
53
- }
54
-
55
- bool isNewNFTImpl = deployment.contract1155Impl == address(0);
56
- if (isNewNFTImpl) {
57
- console2.log("mintFeeRecipient", chainConfig.mintFeeRecipient);
58
- console2.log("protocolRewards", chainConfig.protocolRewards);
59
- deployment.contract1155Impl = address(new ZoraCreator1155Impl(chainConfig.mintFeeRecipient, deployment.factoryProxy, chainConfig.protocolRewards));
60
- console2.log("New NFT_IMPL", deployment.contract1155Impl);
61
- } else {
62
- console2.log("Existing NFT_IMPL", deployment.contract1155Impl);
63
- }
64
-
65
- deployment.factoryProxy = address(
66
- new ZoraCreator1155FactoryImpl({
67
- _zora1155Impl: IZoraCreator1155(deployment.contract1155Impl),
68
- _merkleMinter: ZoraCreatorMerkleMinterStrategy(deployment.merkleMintSaleStrategy),
69
- _redeemMinterFactory: ZoraCreatorRedeemMinterFactory(deployment.redeemMinterFactory),
70
- _fixedPriceMinter: ZoraCreatorFixedPriceSaleStrategy(deployment.fixedPriceSaleStrategy)
71
- })
72
- );
73
-
74
- console2.log("New Factory Impl", deployment.factoryImpl);
75
- console2.log("Upgrade to this new factory impl on the proxy:", deployment.factoryProxy);
76
-
77
- if (isNewNFTImpl) {
78
- ZoraDeployerUtils.deployTestContractForVerification(deployment.factoryProxy, makeAddr("admin"));
79
- }
80
-
81
- return getDeploymentJSON(deployment);
82
- }
83
- }
@@ -1,34 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity ^0.8.17;
3
-
4
- import "forge-std/Script.sol";
5
- import "forge-std/console2.sol";
6
-
7
- import {ZoraDeployerBase} from "../src/ZoraDeployerBase.sol";
8
- import {ChainConfig, Deployment} from "../src/DeploymentConfig.sol";
9
- import {UUPSUpgradeable} from "@zoralabs/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol";
10
- import {ZoraDeployerUtils} from "../src/ZoraDeployerUtils.sol";
11
-
12
- contract UpgradePreminter is ZoraDeployerBase {
13
- function run() public returns (string memory, bytes memory upgradeCalldata, address upgradeTarget) {
14
- Deployment memory deployment = getDeployment();
15
-
16
- uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY");
17
-
18
- vm.startBroadcast(deployerPrivateKey);
19
-
20
- address preminterImplementation = ZoraDeployerUtils.deployNewPreminterImplementationDeterminstic(deployment.factoryProxy);
21
-
22
- vm.stopBroadcast();
23
-
24
- upgradeCalldata = abi.encodeWithSelector(UUPSUpgradeable.upgradeTo.selector, preminterImplementation);
25
-
26
- upgradeTarget = deployment.preminterImpl;
27
-
28
- console2.log("Upgrade PremintExecutor target and implementatin:", upgradeTarget, preminterImplementation);
29
- console2.log("To upgrade, use this calldata:");
30
- console2.logBytes(upgradeCalldata);
31
-
32
- return (getDeploymentJSON(deployment), upgradeCalldata, upgradeTarget);
33
- }
34
- }
@@ -1,86 +0,0 @@
1
- import { writeFile, readFile } from "fs/promises";
2
- import esMain from "es-main";
3
- // @ts-ignore
4
- import { glob } from "glob";
5
-
6
- type Deploy = {
7
- timestamp: number;
8
- commit: string;
9
- returns: { value: string }[];
10
- chain: number;
11
- };
12
- async function copyEnvironmentRunFiles() {
13
- const latestFiles = await glob(`broadcast/**/*run-latest.json`);
14
-
15
- const allFileContents = await Promise.all(
16
- latestFiles.map(async (file: string) => {
17
- const fileParts = file.split("/");
18
- const chainId = fileParts[fileParts.length - 2];
19
- const parsed = JSON.parse(await readFile(file, "utf-8")) as Deploy;
20
- const returns = parsed.returns[0]?.value || "{}";
21
-
22
- // a recent version of forge added a bug where the returns value with some sort of url based encoding.
23
- // the below code is a hack to fix this. It should be removed once forge is fixed.
24
- // use string regex replace all to remove all instances of \\ from returns (this appeared in a wierd version of forge)
25
- // also opening and closing quotes that incorrecly appear before opening bracket:
26
- const filtered = returns
27
- .replace(/\\/g, "")
28
- .replace('"{', "{")
29
- .replace('}"', "}");
30
-
31
- const parsedReturns = JSON.parse(filtered);
32
- return {
33
- chainId,
34
- timestamp: parsed.timestamp,
35
- returns: parsedReturns,
36
- };
37
- }),
38
- );
39
-
40
- const groupedByChainId = allFileContents.reduce(
41
- (acc: any, file: any) => {
42
- const chainId = file.chainId!;
43
- if (isNaN(Number(chainId))) return acc;
44
-
45
- if (!acc[chainId]) {
46
- acc[chainId] = [];
47
- }
48
- acc[chainId]!.push(file);
49
- return acc;
50
- },
51
- {} as Record<string, Deploy[]>,
52
- );
53
-
54
- const withLatest = Object.entries(groupedByChainId).map(
55
- ([chainId, files]: any) => {
56
- const latest = files.sort(
57
- (a: any, b: any) => b.timestamp! - a.timestamp!,
58
- )[0];
59
- return {
60
- chainId,
61
- latest,
62
- };
63
- },
64
- );
65
-
66
- withLatest.forEach(async ({ chainId, latest }) => {
67
- const filePath = `addresses/${chainId}.json`;
68
-
69
- await writeFile(
70
- filePath,
71
- JSON.stringify(
72
- {
73
- ...latest!.returns,
74
- timestamp: latest!.timestamp,
75
- commit: latest!.commit,
76
- },
77
- null,
78
- 2,
79
- ),
80
- );
81
- });
82
- }
83
-
84
- if (esMain(import.meta)) {
85
- await copyEnvironmentRunFiles();
86
- }
@@ -1,302 +0,0 @@
1
- import { createAccount } from "@turnkey/viem";
2
- import { TurnkeyClient } from "@turnkey/http";
3
- import { Address, encodeFunctionData, parseAbi, LocalAccount, Hex } from "viem";
4
- import { ApiKeyStamper } from "@turnkey/api-key-stamper";
5
- import { glob } from "glob";
6
- import * as path from "path";
7
- import * as dotenv from "dotenv";
8
- import { writeFile, readFile } from "fs/promises";
9
- import {
10
- ConfiguredSalt,
11
- DeterministicDeploymentConfig,
12
- GenericDeploymentConfiguration,
13
- signDeployFactory,
14
- signGenericDeploy,
15
- } from "../package/deployment";
16
- import { fileURLToPath } from "url";
17
- import { dirname } from "path";
18
-
19
- const __filename = fileURLToPath(import.meta.url);
20
- const __dirname = dirname(__filename);
21
-
22
- // Load environment variables from `.env.local`
23
- dotenv.config({ path: path.resolve(__dirname, "../.env") });
24
-
25
- type ChainConfig = {
26
- chainId: number;
27
- implementationAddress: Address;
28
- owner: Address;
29
- };
30
-
31
- async function signAndSaveSignatures({
32
- turnkeyAccount,
33
- chainConfigs,
34
- proxyName,
35
- chainId,
36
- }: {
37
- turnkeyAccount: LocalAccount;
38
- chainConfigs: ChainConfig[];
39
- proxyName: "factoryProxy" | "premintExecutorProxy";
40
- chainId: number;
41
- }) {
42
- const configFolder = path.resolve(
43
- __dirname,
44
- `../deterministicConfig/${proxyName}/`,
45
- );
46
- const configFile = path.join(configFolder, "params.json");
47
- const deterministicDeployConfig = JSON.parse(
48
- await readFile(configFile, "utf-8"),
49
- );
50
-
51
- const deploymentConfig: DeterministicDeploymentConfig = {
52
- proxyDeployerAddress:
53
- deterministicDeployConfig.proxyDeployerAddress as Address,
54
- proxySalt: deterministicDeployConfig.proxySalt as ConfiguredSalt,
55
- proxyShimSalt: deterministicDeployConfig.proxyShimSalt as ConfiguredSalt,
56
- proxyCreationCode: deterministicDeployConfig.proxyCreationCode as Address,
57
- };
58
-
59
- const chainConfig = chainConfigs.find((x) => x.chainId === chainId);
60
-
61
- if (!chainConfig) {
62
- return;
63
- }
64
-
65
- const signature = await signDeployFactory({
66
- account: turnkeyAccount,
67
- implementationAddress: chainConfig.implementationAddress,
68
- owner: chainConfig.owner,
69
- chainId: chainConfig.chainId,
70
- deterministicDeploymentConfig: deploymentConfig,
71
- });
72
-
73
- const existingSignatures = JSON.parse(
74
- await readFile(path.join(configFolder, "signatures.json"), "utf-8"),
75
- );
76
-
77
- const updated = {
78
- ...existingSignatures,
79
- [chainId]: signature,
80
- };
81
-
82
- // aggregate above to object of key value pair indexed by chain id as number:
83
- // write as json to ../deterministicConfig/factoryDeploySignatures.json:
84
- await writeFile(
85
- path.join(configFolder, "signatures.json"),
86
- JSON.stringify(updated, null, 2),
87
- );
88
- }
89
-
90
- async function signAndSaveUpgradeGate({
91
- turnkeyAccount,
92
- chainConfigs,
93
- proxyName,
94
- chainId,
95
- }: {
96
- turnkeyAccount: LocalAccount;
97
- chainConfigs: {
98
- chainId: number;
99
- owner: Address;
100
- }[];
101
- proxyName: "upgradeGate";
102
- chainId: number;
103
- }) {
104
- const configFolder = path.resolve(
105
- __dirname,
106
- `../deterministicConfig/${proxyName}/`,
107
- );
108
- const configFile = path.join(configFolder, "params.json");
109
-
110
- const deterministicDeployConfig = JSON.parse(
111
- await readFile(configFile, "utf-8"),
112
- );
113
-
114
- const deploymentConfig: GenericDeploymentConfiguration = {
115
- creationCode: deterministicDeployConfig.creationCode! as Hex,
116
- salt: deterministicDeployConfig.salt! as Hex,
117
- deployerAddress: deterministicDeployConfig.deployerAddress! as Address,
118
- upgradeGateAddress:
119
- deterministicDeployConfig.upgradeGateAddress! as Address,
120
- proxyDeployerAddress:
121
- deterministicDeployConfig.proxyDeployerAddress! as Address,
122
- };
123
-
124
- const upgradeGateAbi = parseAbi(["function initialize(address owner)"]);
125
-
126
- const chainConfig = chainConfigs.find((x) => x.chainId === chainId);
127
-
128
- if (!chainConfig) {
129
- throw new Error(`No chain config found for chain id ${chainId}`);
130
- }
131
-
132
- const initCall = encodeFunctionData({
133
- abi: upgradeGateAbi,
134
- functionName: "initialize",
135
- args: [chainConfig.owner],
136
- });
137
-
138
- console.log("signing", { turnkeyAccount, deploymentConfig });
139
-
140
- const signature = await signGenericDeploy({
141
- account: turnkeyAccount,
142
- chainId: chainConfig.chainId,
143
- config: deploymentConfig,
144
- initCall,
145
- });
146
-
147
- const existingSignatures = JSON.parse(
148
- await readFile(path.join(configFolder, "signatures.json"), "utf-8"),
149
- );
150
-
151
- const updated = {
152
- ...existingSignatures,
153
- [chainId]: signature,
154
- };
155
-
156
- // write as json to ../deterministicConfig/factoryDeploySignatures.json:
157
- await writeFile(
158
- path.join(configFolder, "signatures.json"),
159
- JSON.stringify(updated, null, 2),
160
- );
161
- }
162
-
163
- const getChainConfigs = async () => {
164
- const chainConfigsFiles = await glob(
165
- path.resolve(__dirname, "../chainConfigs/*.json"),
166
- );
167
-
168
- const chainConfigs = await Promise.all(
169
- chainConfigsFiles.map(async (chainConfigFile) => {
170
- const chainId = parseInt(path.basename(chainConfigFile).split(".")[0]!);
171
-
172
- // read file and process JSON contents:
173
- const fileContents = await import(chainConfigFile);
174
-
175
- return {
176
- chainId,
177
- owner: fileContents["FACTORY_OWNER"]! as Address,
178
- };
179
- }),
180
- );
181
-
182
- return chainConfigs;
183
- };
184
-
185
- const getFactoryImplConfigs = async () => {
186
- const addresseFiles = await glob(
187
- path.resolve(__dirname, "../addresses/*.json"),
188
- );
189
-
190
- const chainConfigs = await Promise.all(
191
- addresseFiles.map(async (addressConfigFile) => {
192
- const chainId = parseInt(path.basename(addressConfigFile).split(".")[0]!);
193
-
194
- // read file and process JSON contents:
195
- const fileContents = await import(addressConfigFile);
196
-
197
- // read chain config file as json, which is located at: ../chainConfigs/${chainId}.json:
198
- const chainConfig = await import(
199
- path.resolve(__dirname, `../chainConfigs/${chainId}.json`)
200
- );
201
-
202
- return {
203
- chainId,
204
- implementationAddress: fileContents["FACTORY_IMPL"] as Address,
205
- owner: chainConfig["FACTORY_OWNER"] as Address,
206
- };
207
- }),
208
- );
209
-
210
- return chainConfigs;
211
- };
212
-
213
- const getPreminterImplConfigs = async () => {
214
- const addresseFiles = await glob(
215
- path.resolve(__dirname, "../addresses/*.json"),
216
- );
217
-
218
- const chainConfigs = await Promise.all(
219
- addresseFiles.map(async (addressConfigFile) => {
220
- const chainId = parseInt(path.basename(addressConfigFile).split(".")[0]!);
221
-
222
- // read file and process JSON contents:
223
- const fileContents = await import(addressConfigFile);
224
-
225
- // read chain config file as json, which is located at: ../chainConfigs/${chainId}.json:
226
- const chainConfig = await import(
227
- path.resolve(__dirname, `../chainConfigs/${chainId}.json`)
228
- );
229
-
230
- return {
231
- chainId,
232
- implementationAddress: fileContents["PREMINTER_IMPL"] as Address,
233
- owner: chainConfig["FACTORY_OWNER"] as Address,
234
- };
235
- }),
236
- );
237
-
238
- return chainConfigs.filter((x) => x.implementationAddress !== undefined);
239
- };
240
-
241
- function getChainIdPositionalArg() {
242
- // parse chain id as first argument:
243
- const chainIdArg = process.argv[2];
244
-
245
- if (!chainIdArg) {
246
- throw new Error("Must provide chain id as first argument");
247
- }
248
-
249
- return parseInt(chainIdArg);
250
- }
251
-
252
- async function main() {
253
- // Create a Turnkey HTTP client with API key credentials
254
- const httpClient = new TurnkeyClient(
255
- {
256
- baseUrl: "https://api.turnkey.com",
257
- },
258
- // This uses API key credentials.
259
- // If you're using passkeys, use `@turnkey/webauthn-stamper` to collect webauthn signatures:
260
- new ApiKeyStamper({
261
- apiPublicKey: process.env.TURNKEY_API_PUBLIC_KEY!,
262
- apiPrivateKey: process.env.TURNKEY_API_PRIVATE_KEY!,
263
- }),
264
- );
265
-
266
- // Create the Viem custom account
267
- const turnkeyAccount = await createAccount({
268
- client: httpClient,
269
- organizationId: process.env.TURNKEY_ORGANIZATION_ID!,
270
- signWith: process.env.TURNKEY_PRIVATE_KEY_ID!,
271
- // optional; will be fetched from Turnkey if not provided
272
- ethereumAddress: process.env.TURNKEY_TARGET_ADDRESS!,
273
- });
274
-
275
- const chainId = getChainIdPositionalArg();
276
-
277
- await signAndSaveSignatures({
278
- turnkeyAccount,
279
- chainConfigs: await getFactoryImplConfigs(),
280
- proxyName: "factoryProxy",
281
- chainId,
282
- });
283
-
284
- await signAndSaveSignatures({
285
- turnkeyAccount,
286
- chainConfigs: await getPreminterImplConfigs(),
287
- proxyName: "premintExecutorProxy",
288
- chainId,
289
- });
290
-
291
- await signAndSaveUpgradeGate({
292
- turnkeyAccount,
293
- chainConfigs: await getChainConfigs(),
294
- proxyName: "upgradeGate",
295
- chainId,
296
- });
297
- }
298
-
299
- main().catch((error) => {
300
- console.error(error);
301
- process.exit(1);
302
- });
@@ -1,124 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.17;
3
-
4
- import "forge-std/Test.sol";
5
- import {CommonBase} from "forge-std/Base.sol";
6
- import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
7
- import {Script} from "forge-std/Script.sol";
8
-
9
- /// @notice Chain configuration for constants set manually during deploy. Does not get written to after deploys.
10
- struct ChainConfig {
11
- /// @notice The user that owns the factory proxy. Allows ability to upgrade for new implementations deployed.
12
- address factoryOwner;
13
- /// @notice Mint fee recipient user
14
- address mintFeeRecipient;
15
- /// @notice Protocol rewards contract address
16
- address protocolRewards;
17
- }
18
-
19
- /// @notice Deployment addresses – set to new deployed addresses by the scripts.
20
- struct Deployment {
21
- /// @notice Fixed price minter strategy configuration contract
22
- address fixedPriceSaleStrategy;
23
- /// @notice Merkle minter strategy (formerly presale) configuration
24
- address merkleMintSaleStrategy;
25
- /// @notice Redeem minter factory contract for redeem sales configurations
26
- address redeemMinterFactory;
27
- /// @notice Implementation contract for the 1155 contract
28
- address contract1155Impl;
29
- /// @notice Implementation contract version for the 1155 contract
30
- string contract1155ImplVersion;
31
- /// @notice Factory implementation contract that is the impl for the above proxy.
32
- address factoryImpl;
33
- /// @notice Factory proxy contract that creates zora drops style NFT contracts
34
- address factoryProxy;
35
- /// @notice Preminter proxy contract address
36
- address preminterImpl;
37
- /// @notice Preminter implementation contract address
38
- address preminterProxy;
39
- /// @notice Upgrade gate
40
- address upgradeGate;
41
- }
42
-
43
- abstract contract DeploymentConfig is Script {
44
- using stdJson for string;
45
-
46
- /// @notice ChainID convenience getter
47
- /// @return id chainId
48
- function chainId() internal view virtual returns (uint256 id);
49
-
50
- ///
51
- // These are the JSON key constants to standardize writing and reading configuration
52
- ///
53
-
54
- string constant FACTORY_OWNER = "FACTORY_OWNER";
55
- string constant MINT_FEE_RECIPIENT = "MINT_FEE_RECIPIENT";
56
- string constant PROTOCOL_REWARDS = "PROTOCOL_REWARDS";
57
-
58
- string constant FIXED_PRICE_SALE_STRATEGY = "FIXED_PRICE_SALE_STRATEGY";
59
- string constant MERKLE_MINT_SALE_STRATEGY = "MERKLE_MINT_SALE_STRATEGY";
60
- string constant REDEEM_MINTER_FACTORY = "REDEEM_MINTER_FACTORY";
61
- string constant CONTRACT_1155_IMPL = "CONTRACT_1155_IMPL";
62
- string constant CONTRACT_1155_IMPL_VERSION = "CONTRACT_1155_IMPL_VERSION";
63
- string constant FACTORY_IMPL = "FACTORY_IMPL";
64
- string constant FACTORY_PROXY = "FACTORY_PROXY";
65
- string constant PREMINTER_PROXY = "PREMINTER_PROXY";
66
- string constant PREMINTER_IMPL = "PREMINTER_IMPL";
67
- string constant UPGRADE_GATE = "UPGRADE_GATE";
68
-
69
- /// @notice Return a prefixed key for reading with a ".".
70
- /// @param key key to prefix
71
- /// @return prefixed key
72
- function getKeyPrefix(string memory key) internal pure returns (string memory) {
73
- return string.concat(".", key);
74
- }
75
-
76
- /// @notice Returns the chain configuration struct from the JSON configuration file
77
- /// @return chainConfig structure
78
- function getChainConfig() internal view returns (ChainConfig memory chainConfig) {
79
- string memory json = vm.readFile(string.concat("chainConfigs/", Strings.toString(chainId()), ".json"));
80
- chainConfig.factoryOwner = json.readAddress(getKeyPrefix(FACTORY_OWNER));
81
- chainConfig.mintFeeRecipient = json.readAddress(getKeyPrefix(MINT_FEE_RECIPIENT));
82
- chainConfig.protocolRewards = json.readAddress(getKeyPrefix(PROTOCOL_REWARDS));
83
- }
84
-
85
- function readAddressOrDefaultToZero(string memory json, string memory key) internal view returns (address addr) {
86
- string memory keyPrefix = getKeyPrefix(key);
87
-
88
- if (vm.keyExists(json, keyPrefix)) {
89
- addr = json.readAddress(keyPrefix);
90
- } else {
91
- addr = address(0);
92
- }
93
- }
94
-
95
- /// @notice Get the deployment configuration struct from the JSON configuration file
96
- /// @return deployment deployment configuration structure
97
- function getDeployment() internal view returns (Deployment memory deployment) {
98
- string memory json = vm.readFile(string.concat("addresses/", Strings.toString(chainId()), ".json"));
99
- deployment.fixedPriceSaleStrategy = readAddressOrDefaultToZero(json, FIXED_PRICE_SALE_STRATEGY);
100
- deployment.merkleMintSaleStrategy = readAddressOrDefaultToZero(json, MERKLE_MINT_SALE_STRATEGY);
101
- deployment.redeemMinterFactory = readAddressOrDefaultToZero(json, REDEEM_MINTER_FACTORY);
102
- deployment.contract1155Impl = readAddressOrDefaultToZero(json, CONTRACT_1155_IMPL);
103
- deployment.contract1155ImplVersion = json.readString(getKeyPrefix(CONTRACT_1155_IMPL_VERSION));
104
- deployment.factoryImpl = readAddressOrDefaultToZero(json, FACTORY_IMPL);
105
- deployment.factoryProxy = readAddressOrDefaultToZero(json, FACTORY_PROXY);
106
- deployment.preminterImpl = readAddressOrDefaultToZero(json, PREMINTER_IMPL);
107
- deployment.preminterProxy = readAddressOrDefaultToZero(json, PREMINTER_PROXY);
108
- deployment.upgradeGate = readAddressOrDefaultToZero(json, UPGRADE_GATE);
109
- }
110
- }
111
-
112
- contract ForkDeploymentConfig is DeploymentConfig {
113
- function chainId() internal view override returns (uint256 id) {
114
- return block.chainid;
115
- }
116
- }
117
-
118
- contract ScriptDeploymentConfig is DeploymentConfig {
119
- function chainId() internal view override returns (uint256 id) {
120
- assembly {
121
- id := chainid()
122
- }
123
- }
124
- }