@zoralabs/protocol-deployments 0.0.8 → 0.0.10

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.
@@ -53,20 +53,62 @@ contract UpgradesTest is ForkDeploymentConfig, DeploymentTestingUtils, Test {
53
53
  }
54
54
 
55
55
  function _buildSafeUrl(address safe, address target, bytes memory cd) internal view returns (string memory) {
56
- // sample url: https://ourzora.github.io/smol-safe/?value=0&safe={safeAddress}&to={target}&data={calldata}&network={chainId}
57
- // https://ourzora.github.io/smol-safe/?safe={safe}&to={to}&data={data}&value=0&network={network}
58
- string memory safeQueryString = string.concat("safe=", vm.toString(safe));
59
- string memory toQueryString = string.concat("&to=", vm.toString(target));
60
- string memory dataQueryString = string.concat("&data=", vm.toString(cd));
61
- string memory valueQueryString = "&value=0";
62
- string memory chainIdQueryString = string.concat("&network=", vm.toString(block.chainid));
63
- string memory targetUrl = string.concat(
64
- string.concat(
65
- string.concat(string.concat(string.concat("https://ourzora.github.io/smol-safe/?", safeQueryString), toQueryString), dataQueryString),
66
- valueQueryString
67
- ),
68
- chainIdQueryString
69
- );
56
+ address[] memory targets = new address[](1);
57
+ targets[0] = target;
58
+
59
+ bytes[] memory calldatas = new bytes[](1);
60
+ calldatas[0] = cd;
61
+
62
+ return _buildBatchSafeUrl(safe, targets, calldatas);
63
+ }
64
+
65
+ // pipe delimiter is url encoded | which is %7C
66
+ string constant PIPE_DELIMITER = "%7C";
67
+
68
+ function _buildBatchSafeUrl(address safe, address[] memory targets, bytes[] memory cd) internal view returns (string memory) {
69
+ string memory targetsString = "";
70
+
71
+ for (uint256 i = 0; i < targets.length; i++) {
72
+ targetsString = string.concat(targetsString, vm.toString(targets[i]));
73
+
74
+ if (i < targets.length - 1) {
75
+ targetsString = string.concat(targetsString, PIPE_DELIMITER);
76
+ }
77
+ }
78
+
79
+ string memory calldataString = "";
80
+
81
+ for (uint256 i = 0; i < cd.length; i++) {
82
+ calldataString = string.concat(calldataString, vm.toString(cd[i]));
83
+
84
+ if (i < cd.length - 1) {
85
+ calldataString = string.concat(calldataString, PIPE_DELIMITER);
86
+ }
87
+ }
88
+
89
+ string memory valuesString = "";
90
+
91
+ for (uint256 i = 0; i < cd.length; i++) {
92
+ valuesString = string.concat(valuesString, "0");
93
+
94
+ if (i < cd.length - 1) {
95
+ valuesString = string.concat(valuesString, PIPE_DELIMITER);
96
+ }
97
+ }
98
+
99
+ // sample url: https://ourzora.github.io/smol-safe/${chainId}/${safeAddress}&target={pipeDelimitedTargets}&calldata={pipeDelimitedCalldata}&value={pipeDelimitedValues}
100
+ string memory targetUrl = "https://ourzora.github.io/smol-safe/#safe/";
101
+ targetUrl = string.concat(targetUrl, vm.toString(block.chainid));
102
+ targetUrl = string.concat(targetUrl, "/");
103
+ targetUrl = string.concat(targetUrl, vm.toString(safe));
104
+ targetUrl = string.concat(targetUrl, "/new");
105
+ targetUrl = string.concat(targetUrl, "?");
106
+ targetUrl = string.concat(targetUrl, "targets=");
107
+ targetUrl = string.concat(targetUrl, targetsString);
108
+ targetUrl = string.concat(targetUrl, "&calldatas=");
109
+ targetUrl = string.concat(targetUrl, calldataString);
110
+ targetUrl = string.concat(targetUrl, "&values=");
111
+ targetUrl = string.concat(targetUrl, valuesString);
70
112
 
71
113
  return targetUrl;
72
114
  }
@@ -93,37 +135,49 @@ contract UpgradesTest is ForkDeploymentConfig, DeploymentTestingUtils, Test {
93
135
  console2.log("chain:", chainName);
94
136
  console2.log("upgrade owner:", chainConfig.factoryOwner);
95
137
 
138
+ bytes memory factory1155UpgradeCalldata;
139
+
96
140
  if (is1155UpgradeNeeded) {
97
141
  console2.log("-- 1155 upgrade needed --");
98
142
  vm.prank(chainConfig.factoryOwner);
99
- bytes memory factory1155UpgradeCalldata = ZoraDeployerUtils.simulateUpgrade(targetProxy1155, targetImpl1155);
143
+ factory1155UpgradeCalldata = ZoraDeployerUtils.simulateUpgrade(targetProxy1155, targetImpl1155);
100
144
  vm.prank(creator);
101
145
  ZoraDeployerUtils.deployTestContractForVerification(targetProxy1155, creator);
102
146
 
103
147
  console2.log("1155 upgrade target:", targetProxy1155);
104
148
  console2.log("upgrade calldata:");
105
149
  console.logBytes(factory1155UpgradeCalldata);
106
- console2.log("upgrade to address:", targetImpl1155);
107
- console2.log("upgrade to version:", ZoraCreator1155FactoryImpl(targetImpl1155).contractVersion());
108
- console2.log("smol safe upgrade url: ", _buildSafeUrl(chainConfig.factoryOwner, targetProxy1155, factory1155UpgradeCalldata));
109
- console2.log("------------------------");
150
+ {
151
+ console2.log("upgrade to address:", targetImpl1155);
152
+ console2.log("upgrade to version:", ZoraCreator1155FactoryImpl(targetImpl1155).contractVersion());
153
+ if (!preminterUpgradeNeeded) {
154
+ console2.log("smol safe upgrade url: ", _buildSafeUrl(chainConfig.factoryOwner, targetProxy1155, factory1155UpgradeCalldata));
155
+ }
156
+ console2.log("------------------------");
157
+ }
110
158
  }
111
159
 
160
+ address factoryOwner = chainConfig.factoryOwner;
161
+ bytes memory preminterUpgradeCalldata;
162
+
112
163
  // hack - for now, only check on zora sepolia or goerli
113
164
  if (preminterUpgradeNeeded) {
114
165
  console2.log("-- preminter upgrade needed --");
115
166
  console2.log("preminter upgrade target:", targetPreminterProxy);
116
- vm.prank(chainConfig.factoryOwner);
117
- bytes memory preminterUpgradeCalldata = ZoraDeployerUtils.simulateUpgrade(deployment.preminterProxy, deployment.preminterImpl);
167
+ vm.prank(factoryOwner);
168
+ preminterUpgradeCalldata = ZoraDeployerUtils.simulateUpgrade(deployment.preminterProxy, deployment.preminterImpl);
118
169
 
119
170
  address collector = makeAddr("collector");
120
171
  address mintReferral = makeAddr("referral");
121
172
  vm.deal(collector, 10 ether);
122
173
 
174
+ address[] memory mintRewardsRecipients = new address[](1);
175
+ mintRewardsRecipients[0] = mintReferral;
176
+
123
177
  IZoraCreator1155PremintExecutor.MintArguments memory mintArguments = IZoraCreator1155PremintExecutor.MintArguments({
124
178
  mintRecipient: collector,
125
179
  mintComment: "",
126
- mintReferral: mintReferral
180
+ mintRewardsRecipients: mintRewardsRecipients
127
181
  });
128
182
 
129
183
  vm.startPrank(collector);
@@ -132,11 +186,28 @@ contract UpgradesTest is ForkDeploymentConfig, DeploymentTestingUtils, Test {
132
186
 
133
187
  vm.stopPrank();
134
188
 
135
- console2.log("upgrade calldata:");
136
- console.logBytes(preminterUpgradeCalldata);
137
- console2.log("upgrade to address:", targetPremintImpl);
138
- console2.log("smol safe upgrade url: ", _buildSafeUrl(chainConfig.factoryOwner, targetPreminterProxy, preminterUpgradeCalldata));
139
- console2.log("------------------------");
189
+ {
190
+ console2.log("upgrade calldata:");
191
+ console.logBytes(preminterUpgradeCalldata);
192
+ console2.log("upgrade to address:", targetPremintImpl);
193
+ if (!is1155UpgradeNeeded) {
194
+ console2.log("smol safe upgrade url: ", _buildSafeUrl(factoryOwner, targetPreminterProxy, preminterUpgradeCalldata));
195
+ }
196
+ console2.log("------------------------");
197
+ }
198
+ }
199
+
200
+ // if both needed:
201
+ if (is1155UpgradeNeeded && preminterUpgradeNeeded) {
202
+ address[] memory targets = new address[](2);
203
+ targets[0] = targetProxy1155;
204
+ targets[1] = targetPreminterProxy;
205
+
206
+ bytes[] memory calldatas = new bytes[](2);
207
+ calldatas[0] = factory1155UpgradeCalldata;
208
+ calldatas[1] = preminterUpgradeCalldata;
209
+
210
+ console2.log("multi-upgrade smol safe upgrade url: ", _buildBatchSafeUrl(factoryOwner, targets, calldatas));
140
211
  }
141
212
 
142
213
  console2.log("=================\n");
@@ -112,9 +112,9 @@ contract ZoraCreator1155FactoryForkTest is ForkDeploymentConfig, Test {
112
112
  // mint the token
113
113
  vm.deal(collector, valueToSend);
114
114
  vm.startPrank(collector);
115
- ZoraCreator1155Impl(address(target)).mintWithRewards{value: valueToSend}(fixedPrice, tokenId, quantityToMint, abi.encode(collector), address(0));
115
+ ZoraCreator1155Impl(payable(address(target))).mintWithRewards{value: valueToSend}(fixedPrice, tokenId, quantityToMint, abi.encode(collector), address(0));
116
116
 
117
- uint256 balance = ZoraCreator1155Impl(address(target)).balanceOf(collector, tokenId);
117
+ uint256 balance = ZoraCreator1155Impl(payable(address(target))).balanceOf(collector, tokenId);
118
118
 
119
119
  assertEq(balance, quantityToMint, "balance mismatch");
120
120
  }
@@ -148,7 +148,7 @@ contract ZoraCreator1155PreminterForkTest is ForkDeploymentConfig, Test {
148
148
  premintConfig,
149
149
  signature,
150
150
  quantityToMint,
151
- IZoraCreator1155PremintExecutor.MintArguments({mintRecipient: executor, mintComment: comment, mintReferral: executor})
151
+ IZoraCreator1155PremintExecutor.MintArguments({mintRecipient: executor, mintComment: comment, mintRewardsRecipients: new address[](0)})
152
152
  );
153
153
  }
154
154
 
@@ -178,7 +178,7 @@ contract ZoraCreator1155PreminterForkTest is ForkDeploymentConfig, Test {
178
178
  premintConfigV2,
179
179
  signature,
180
180
  quantityToMint,
181
- IZoraCreator1155PremintExecutor.MintArguments({mintRecipient: executor, mintComment: comment, mintReferral: executor})
181
+ IZoraCreator1155PremintExecutor.MintArguments({mintRecipient: executor, mintComment: comment, mintRewardsRecipients: new address[](0)})
182
182
  );
183
183
  }
184
184