@zoralabs/protocol-deployments 0.0.12 → 0.0.13

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 (90) hide show
  1. package/.turbo/turbo-build.log +24 -25
  2. package/CHANGELOG.md +10 -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 +9 -21
  15. package/{script → scripts}/bundle-chainConfigs.mjs +9 -7
  16. package/tsconfig.json +1 -1
  17. package/tsup.config.ts +5 -5
  18. package/wagmi.config.ts +31 -9
  19. package/.env.anvil +0 -2
  20. package/addresses/1.json +0 -13
  21. package/addresses/10.json +0 -13
  22. package/addresses/11155111.json +0 -13
  23. package/addresses/420.json +0 -13
  24. package/addresses/424.json +0 -11
  25. package/addresses/5.json +0 -14
  26. package/addresses/58008.json +0 -11
  27. package/addresses/7777777.json +0 -13
  28. package/addresses/8453.json +0 -13
  29. package/addresses/84531.json +0 -14
  30. package/addresses/999.json +0 -13
  31. package/addresses/999999999.json +0 -14
  32. package/chainConfigs/1.json +0 -5
  33. package/chainConfigs/10.json +0 -5
  34. package/chainConfigs/11155111.json +0 -5
  35. package/chainConfigs/420.json +0 -5
  36. package/chainConfigs/424.json +0 -5
  37. package/chainConfigs/5.json +0 -5
  38. package/chainConfigs/58008.json +0 -4
  39. package/chainConfigs/7777777.json +0 -5
  40. package/chainConfigs/8453.json +0 -5
  41. package/chainConfigs/84531.json +0 -5
  42. package/chainConfigs/999.json +0 -5
  43. package/chainConfigs/999999999.json +0 -5
  44. package/deterministicConfig/factoryProxy/params.json +0 -10
  45. package/deterministicConfig/factoryProxy/signatures.json +0 -14
  46. package/deterministicConfig/premintExecutorProxy/params.json +0 -10
  47. package/deterministicConfig/premintExecutorProxy/signatures.json +0 -12
  48. package/deterministicConfig/upgradeGate/params.json +0 -7
  49. package/deterministicConfig/upgradeGate/signatures.json +0 -14
  50. package/dist/package/batchPublish.test.d.ts +0 -452
  51. package/dist/package/batchPublish.test.d.ts.map +0 -1
  52. package/dist/package/chainConfigs.d.ts.map +0 -1
  53. package/dist/package/deployment.d.ts.map +0 -1
  54. package/dist/package/index.d.ts.map +0 -1
  55. package/dist/script/copy-deployed-contracts.d.ts +0 -2
  56. package/dist/script/copy-deployed-contracts.d.ts.map +0 -1
  57. package/dist/script/signDeploymentTransactions.d.ts +0 -2
  58. package/dist/script/signDeploymentTransactions.d.ts.map +0 -1
  59. package/foundry.toml +0 -41
  60. package/package/batchPublish.test.ts +0 -327
  61. package/package/wagmiGenerated.ts +0 -3657
  62. package/remappings.txt +0 -9
  63. package/script/CalculateDeterministicParams.s.sol +0 -84
  64. package/script/DeployMintersAndImplementations.s.sol +0 -29
  65. package/script/DeployNew1155Impl.s.sol +0 -24
  66. package/script/DeployNewImplementation.s.sol +0 -26
  67. package/script/DeployPreminterImpl.s.sol +0 -23
  68. package/script/DeployProxiesToNewChain.s.sol +0 -50
  69. package/script/DeployTestContracts.s.sol +0 -35
  70. package/script/DeployUpgradeGate.s.sol +0 -27
  71. package/script/Upgrade.s.sol +0 -83
  72. package/script/UpgradePreminter.s.sol +0 -34
  73. package/script/copy-deployed-contracts.ts +0 -86
  74. package/script/signDeploymentTransactions.ts +0 -302
  75. package/src/DeploymentConfig.sol +0 -124
  76. package/src/DeploymentTestingUtils.sol +0 -166
  77. package/src/DeterministicDeployerScript.sol +0 -249
  78. package/src/DeterministicProxyDeployer.sol +0 -139
  79. package/src/IImmutableCreate2Factory.sol +0 -59
  80. package/src/Zora1155PremintFixtures.sol +0 -75
  81. package/src/ZoraDeployerBase.sol +0 -144
  82. package/src/ZoraDeployerUtils.sol +0 -212
  83. package/test/NewFactoryProxyDeployer.t.sol +0 -127
  84. package/test/UpgradesTest.t.sol +0 -222
  85. package/test/ZoraCreator1155Factory_Fork.t.sol +0 -149
  86. package/test/ZoraCreator1155PremintExecutorForkTest.t.sol +0 -205
  87. /package/dist/{package/deployment.d.ts → deployment.d.ts} +0 -0
  88. /package/dist/{package/index.d.ts → index.d.ts} +0 -0
  89. /package/{package → src}/deployment.ts +0 -0
  90. /package/{package → src}/index.ts +0 -0
@@ -1,149 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.17;
3
-
4
- import "forge-std/Test.sol";
5
- import {IZoraCreator1155Factory} from "@zoralabs/zora-1155-contracts/src/interfaces/IZoraCreator1155Factory.sol";
6
- import {ZoraCreator1155FactoryImpl} from "@zoralabs/zora-1155-contracts/src/factory/ZoraCreator1155FactoryImpl.sol";
7
- import {IZoraCreator1155Errors} from "@zoralabs/zora-1155-contracts/src/interfaces/IZoraCreator1155Errors.sol";
8
- import {IZoraCreator1155} from "@zoralabs/zora-1155-contracts/src/interfaces/IZoraCreator1155.sol";
9
- import {ZoraCreator1155Impl} from "@zoralabs/zora-1155-contracts/src/nft/ZoraCreator1155Impl.sol";
10
- import {IMinter1155} from "@zoralabs/zora-1155-contracts/src/interfaces/IMinter1155.sol";
11
- import {IOwnable} from "@zoralabs/zora-1155-contracts/src/interfaces/IOwnable.sol";
12
- import {ICreatorRoyaltiesControl} from "@zoralabs/zora-1155-contracts/src/interfaces/ICreatorRoyaltiesControl.sol";
13
- import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
14
- import {ZoraCreatorFixedPriceSaleStrategy} from "@zoralabs/zora-1155-contracts/src/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.sol";
15
- import {ForkDeploymentConfig, Deployment} from "../src/DeploymentConfig.sol";
16
-
17
- contract ZoraCreator1155FactoryForkTest is ForkDeploymentConfig, Test {
18
- uint256 constant quantityToMint = 3;
19
- uint256 constant tokenMaxSupply = 100;
20
- uint32 constant royaltyMintSchedule = 10;
21
- uint32 constant royaltyBPS = 100;
22
- uint256 constant mintFee = 0.000777 ether;
23
-
24
- address collector;
25
- address creator;
26
-
27
- uint256 public constant PERMISSION_BIT_MINTER = 2 ** 2;
28
-
29
- function setUp() external {
30
- creator = vm.addr(1);
31
- collector = vm.addr(2);
32
- }
33
-
34
- /// @notice gets the chains to do fork tests on, by reading environment var FORK_TEST_CHAINS.
35
- /// Chains are by name, and must match whats under `rpc_endpoints` in the foundry.toml
36
- function getForkTestChains() private view returns (string[] memory result) {
37
- try vm.envString("FORK_TEST_CHAINS", ",") returns (string[] memory forkTestChains) {
38
- result = forkTestChains;
39
- } catch {
40
- console.log("could not get fork test chains - make sure the environment variable FORK_TEST_CHAINS is set");
41
- result = new string[](0);
42
- }
43
- }
44
-
45
- function _setupToken(IZoraCreator1155 target, IMinter1155 fixedPrice, uint96 tokenPrice) private returns (uint256 tokenId) {
46
- string memory tokenURI = "ipfs://token";
47
-
48
- tokenId = target.setupNewToken(tokenURI, tokenMaxSupply);
49
-
50
- target.addPermission(tokenId, address(fixedPrice), PERMISSION_BIT_MINTER);
51
-
52
- target.callSale(
53
- tokenId,
54
- fixedPrice,
55
- abi.encodeWithSelector(
56
- ZoraCreatorFixedPriceSaleStrategy.setSale.selector,
57
- tokenId,
58
- ZoraCreatorFixedPriceSaleStrategy.SalesConfig({
59
- pricePerToken: tokenPrice,
60
- saleStart: 0,
61
- saleEnd: type(uint64).max,
62
- maxTokensPerAddress: 0,
63
- fundsRecipient: address(0)
64
- })
65
- )
66
- );
67
- }
68
-
69
- function _createErc1155Contract(IZoraCreator1155Factory factory) private returns (IZoraCreator1155 target) {
70
- // create the contract, with no toekns
71
- bytes[] memory initSetup = new bytes[](0);
72
-
73
- address admin = creator;
74
- string memory contractURI = "ipfs://asdfasdf";
75
- string memory name = "Test";
76
- address royaltyRecipient = creator;
77
-
78
- address deployedAddress = factory.createContract(
79
- contractURI,
80
- name,
81
- ICreatorRoyaltiesControl.RoyaltyConfiguration({
82
- royaltyBPS: royaltyBPS,
83
- royaltyRecipient: royaltyRecipient,
84
- royaltyMintSchedule: royaltyMintSchedule
85
- }),
86
- payable(admin),
87
- initSetup
88
- );
89
-
90
- target = IZoraCreator1155(deployedAddress);
91
-
92
- // ** 2. Setup a new token with the fixed price sales strategy **
93
- }
94
-
95
- function mintTokenAtFork(IZoraCreator1155Factory factory) internal {
96
- uint96 tokenPrice = 1 ether;
97
- IMinter1155 fixedPrice = factory.defaultMinters()[0];
98
- // now create a contract with the factory
99
- vm.startPrank(creator);
100
-
101
- // ** 1. Create the erc1155 contract **
102
- IZoraCreator1155 target = _createErc1155Contract(factory);
103
-
104
- // ** 2. Setup a new token with the fixed price sales strategy and the token price **
105
- uint256 tokenId = _setupToken(target, fixedPrice, tokenPrice);
106
-
107
- // ** 3. Mint on that contract **
108
-
109
- // mint 3 tokens
110
- uint256 valueToSend = quantityToMint * (tokenPrice + mintFee);
111
-
112
- // mint the token
113
- vm.deal(collector, valueToSend);
114
- vm.startPrank(collector);
115
- ZoraCreator1155Impl(payable(address(target))).mintWithRewards{value: valueToSend}(fixedPrice, tokenId, quantityToMint, abi.encode(collector), address(0));
116
-
117
- uint256 balance = ZoraCreator1155Impl(payable(address(target))).balanceOf(collector, tokenId);
118
-
119
- assertEq(balance, quantityToMint, "balance mismatch");
120
- }
121
-
122
- function testTheFork(string memory chainName) private {
123
- console.log("testing on fork: ", chainName);
124
-
125
- // create and select the fork, which will be used for all subsequent calls
126
- // it will also affect the current block chain id based on the rpc url returned
127
- vm.createSelectFork(vm.rpcUrl(chainName));
128
-
129
- Deployment memory deployment = getDeployment();
130
-
131
- address factoryAddress = deployment.factoryProxy;
132
- ZoraCreator1155FactoryImpl factory = ZoraCreator1155FactoryImpl(factoryAddress);
133
-
134
- assertEq(getChainConfig().factoryOwner, IOwnable(factoryAddress).owner(), string.concat("configured owner incorrect on: ", chainName));
135
-
136
- // make sure that the address from the factory matches the stored fixed price address
137
- // sanity check - check minters match config
138
- assertEq(address(factory.merkleMinter()), deployment.merkleMintSaleStrategy, "merkle minter incorrect");
139
- assertEq(address(factory.fixedPriceMinter()), deployment.fixedPriceSaleStrategy, "fixed priced minter incorrect");
140
- assertEq(address(factory.redeemMinterFactory()), deployment.redeemMinterFactory, "redeem minter not correct");
141
- }
142
-
143
- function test_fork_canCreateContractAndMint() external {
144
- string[] memory forkTestChains = getForkTestChains();
145
- for (uint256 i = 0; i < forkTestChains.length; i++) {
146
- testTheFork(forkTestChains[i]);
147
- }
148
- }
149
- }
@@ -1,205 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.17;
3
-
4
- import "forge-std/Test.sol";
5
- import {ForkDeploymentConfig} from "../src/DeploymentConfig.sol";
6
- import {ZoraCreator1155Attribution, ContractCreationConfig, PremintConfig, PremintConfigV2, TokenCreationConfig} from "@zoralabs/zora-1155-contracts/src/delegation/ZoraCreator1155Attribution.sol";
7
- import {ZoraCreator1155PremintExecutorImpl} from "@zoralabs/zora-1155-contracts/src/delegation/ZoraCreator1155PremintExecutorImpl.sol";
8
- import {ZoraCreator1155FactoryImpl} from "@zoralabs/zora-1155-contracts/src/factory/ZoraCreator1155FactoryImpl.sol";
9
- import {IZoraCreator1155PremintExecutor} from "@zoralabs/zora-1155-contracts/src/interfaces/IZoraCreator1155PremintExecutor.sol";
10
- import {Zora1155PremintFixtures} from "../src/Zora1155PremintFixtures.sol";
11
-
12
- contract ZoraCreator1155PreminterForkTest is ForkDeploymentConfig, Test {
13
- ZoraCreator1155FactoryImpl factory;
14
- ZoraCreator1155PremintExecutorImpl preminter;
15
- uint256 mintFeeAmount = 0.000777 ether;
16
- address creator;
17
- uint256 creatorPrivateKey;
18
- address payoutRecipient = makeAddr("payoutRecipient");
19
- address minter = makeAddr("minter");
20
-
21
- ContractCreationConfig contractConfig;
22
- PremintConfig premintConfig;
23
- PremintConfigV2 premintConfigV2;
24
- address createReferral = makeAddr("creatReferral");
25
-
26
- /// @notice gets the chains to do fork tests on, by reading environment var FORK_TEST_CHAINS.
27
- /// Chains are by name, and must match whats under `rpc_endpoints` in the foundry.toml
28
- function getForkTestChains() private view returns (string[] memory result) {
29
- try vm.envString("FORK_TEST_CHAINS", ",") returns (string[] memory forkTestChains) {
30
- result = forkTestChains;
31
- } catch {
32
- console.log("could not get fork test chains - make sure the environment variable FORK_TEST_CHAINS is set");
33
- result = new string[](0);
34
- }
35
- }
36
-
37
- function setupPremint() private {
38
- // get contract hash, which is unique per contract creation config, and can be used
39
- // retrieve the address created for a contract
40
- address preminterAddress = getDeployment().preminterProxy;
41
-
42
- // override local preminter to use the addresses from the chain
43
- factory = ZoraCreator1155FactoryImpl(getDeployment().factoryProxy);
44
- preminter = ZoraCreator1155PremintExecutorImpl(preminterAddress);
45
-
46
- (creator, creatorPrivateKey) = makeAddrAndKey("creator");
47
-
48
- contractConfig = Zora1155PremintFixtures.makeDefaultContractCreationConfig(creator);
49
-
50
- premintConfig = Zora1155PremintFixtures.makeDefaultV1PremintConfig(factory.fixedPriceMinter(), payoutRecipient);
51
- premintConfigV2 = Zora1155PremintFixtures.makeDefaultV2PremintConfig(factory.fixedPriceMinter(), payoutRecipient, createReferral);
52
- }
53
-
54
- function equals(string memory str1, string memory str2) public pure returns (bool) {
55
- return keccak256(abi.encodePacked(str1)) == keccak256(abi.encodePacked(str2));
56
- }
57
-
58
- function test_fork_legacyPremint_successfullyMintsPremintTokens() external {
59
- string[] memory forkTestChains = getForkTestChains();
60
- for (uint256 i = 0; i < forkTestChains.length; i++) {
61
- string memory chainName = forkTestChains[i];
62
-
63
- console.log("testing on fork: ", chainName);
64
-
65
- // create and select the fork, which will be used for all subsequent calls
66
- // it will also affect the current block chain id based on the rpc url returned
67
- vm.createSelectFork(vm.rpcUrl(chainName));
68
-
69
- setupPremint();
70
-
71
- _signAndExecutePremintLegacy(creatorPrivateKey, minter, 1, "test comment");
72
- }
73
- }
74
-
75
- function test_fork_premintV1_successfullyMintsPremintTokens() external {
76
- string[] memory forkTestChains = getForkTestChains();
77
- for (uint256 i = 0; i < forkTestChains.length; i++) {
78
- string memory chainName = forkTestChains[i];
79
-
80
- if (!_chainSupportsPremintV2(chainName)) {
81
- console.log("skipping chain, does not support v1 premint: ", chainName);
82
- continue;
83
- }
84
-
85
- console.log("testing on fork: ", chainName);
86
-
87
- // it will also affect the current block chain id based on the rpc url returned
88
- vm.createSelectFork(vm.rpcUrl(chainName));
89
-
90
- setupPremint();
91
-
92
- _signAndExecutePremintV1(creatorPrivateKey, minter, 1, "test comment");
93
- }
94
- }
95
-
96
- function test_fork_premintV2_successfullyMintsPremintTokens() external {
97
- string[] memory forkTestChains = getForkTestChains();
98
- for (uint256 i = 0; i < forkTestChains.length; i++) {
99
- string memory chainName = forkTestChains[i];
100
-
101
- if (!_chainSupportsPremintV2(chainName)) {
102
- console.log("skipping chain, does not support v2 premint: ", chainName);
103
- continue;
104
- }
105
-
106
- console.log("testing on fork: ", chainName);
107
-
108
- // it will also affect the current block chain id based on the rpc url returned
109
- vm.createSelectFork(vm.rpcUrl(chainName));
110
-
111
- setupPremint();
112
-
113
- _signAndExecutePremintV2(creatorPrivateKey, minter, 0, "test comment");
114
- }
115
- }
116
-
117
- function _chainSupportsPremintV2(string memory chainName) private pure returns (bool) {
118
- // for now we know that only goerli and sepolia have v2 premint deployed
119
- return (equals(chainName, "zora_sepolia") || equals(chainName, "zora_goerli"));
120
- }
121
-
122
- function _signAndExecutePremintLegacy(
123
- uint256 privateKey,
124
- address executor,
125
- uint256 quantityToMint,
126
- string memory comment
127
- ) private returns (uint256 newTokenId) {
128
- bytes memory signature = _signPremintV1(preminter.getContractAddress(contractConfig), privateKey, block.chainid);
129
-
130
- uint256 mintCost = mintFeeAmount * quantityToMint;
131
- vm.deal(executor, mintCost);
132
-
133
- // now call the premint function, using the same config that was used to generate the digest, and the signature
134
- vm.prank(executor);
135
- newTokenId = preminter.premint{value: mintCost}(contractConfig, premintConfig, signature, quantityToMint, comment);
136
- }
137
-
138
- function _signAndExecutePremintV1(uint256 privateKey, address executor, uint256 quantityToMint, string memory comment) private {
139
- bytes memory signature = _signPremintV1(preminter.getContractAddress(contractConfig), privateKey, block.chainid);
140
-
141
- uint256 mintCost = mintFeeAmount * quantityToMint;
142
- vm.deal(executor, mintCost);
143
-
144
- // now call the premint function, using the same config that was used to generate the digest, and the signature
145
- vm.prank(executor);
146
- preminter.premintV1{value: mintCost}(
147
- contractConfig,
148
- premintConfig,
149
- signature,
150
- quantityToMint,
151
- IZoraCreator1155PremintExecutor.MintArguments({mintRecipient: executor, mintComment: comment, mintRewardsRecipients: new address[](0)})
152
- );
153
- }
154
-
155
- function _signPremintV1(address contractAddress, uint256 privateKey, uint256 chainId) private view returns (bytes memory) {
156
- bytes32 digest = ZoraCreator1155Attribution.premintHashedTypeDataV4(
157
- ZoraCreator1155Attribution.hashPremint(premintConfig),
158
- contractAddress,
159
- ZoraCreator1155Attribution.HASHED_VERSION_1,
160
- chainId
161
- );
162
-
163
- // 3. Sign the digest
164
- // create a signature with the digest for the params
165
- return _sign(privateKey, digest);
166
- }
167
-
168
- function _signAndExecutePremintV2(uint256 privateKey, address executor, uint256 quantityToMint, string memory comment) private {
169
- bytes memory signature = _signPremintV2(preminter.getContractAddress(contractConfig), privateKey, block.chainid);
170
-
171
- uint256 mintCost = mintFeeAmount * quantityToMint;
172
- vm.deal(executor, mintCost);
173
-
174
- // now call the premint function, using the same config that was used to generate the digest, and the signature
175
- vm.prank(executor);
176
- preminter.premintV2{value: mintCost}(
177
- contractConfig,
178
- premintConfigV2,
179
- signature,
180
- quantityToMint,
181
- IZoraCreator1155PremintExecutor.MintArguments({mintRecipient: executor, mintComment: comment, mintRewardsRecipients: new address[](0)})
182
- );
183
- }
184
-
185
- function _signPremintV2(address contractAddress, uint256 privateKey, uint256 chainId) private view returns (bytes memory) {
186
- bytes32 digest = ZoraCreator1155Attribution.premintHashedTypeDataV4(
187
- ZoraCreator1155Attribution.hashPremint(premintConfigV2),
188
- contractAddress,
189
- ZoraCreator1155Attribution.HASHED_VERSION_2,
190
- chainId
191
- );
192
-
193
- // 3. Sign the digest
194
- // create a signature with the digest for the params
195
- return _sign(privateKey, digest);
196
- }
197
-
198
- function _sign(uint256 privateKey, bytes32 digest) private pure returns (bytes memory) {
199
- // sign the message
200
- (uint8 v, bytes32 r, bytes32 s) = vm.sign(privateKey, digest);
201
-
202
- // combine into a single bytes array
203
- return abi.encodePacked(r, s, v);
204
- }
205
- }
File without changes
File without changes
File without changes