Skip to content

Commit

Permalink
Deploy 2.4.0 to all chains
Browse files Browse the repository at this point in the history
  • Loading branch information
oveddan committed Nov 17, 2023
1 parent 597559d commit ec1ce5f
Show file tree
Hide file tree
Showing 16 changed files with 161 additions and 65 deletions.
6 changes: 6 additions & 0 deletions .changeset/cold-toys-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@zoralabs/protocol-deployments": patch
---

* Moved deployment related code from 1155 to protocol-deployments package
* Deployed 2.4.0 to zora-goerli (testnet)
13 changes: 13 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"mode": "pre",
"tag": "prerelease",
"initialVersions": {
"@zoralabs/zora-1155-contracts": "2.4.0",
"@zoralabs/premint-sdk": "0.1.1",
"@zoralabs/protocol-deployments": "0.0.4",
"@zoralabs/protocol-rewards": "1.2.1"
},
"changesets": [
"cold-toys-agree"
]
}
9 changes: 9 additions & 0 deletions packages/protocol-deployments/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# @zoralabs/premint-sdk

<<<<<<< HEAD
## 0.0.5

### Patch Changes

- 293e2c0: Moved deployment related code from 1155 to protocol-deployments package
=======
## 0.0.5-prerelease.0

### Patch Changes

- a50ae1c: \* Moved deployment related code from 1155 to protocol-deployments package
- Deployed 2.4.0 to zora-goerli (testnet)
>>>>>>> 56ad2cd4 (Move deployment related config to protocol-deployments)
## 0.0.4

Expand Down
12 changes: 6 additions & 6 deletions packages/protocol-deployments/addresses/1.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"CONTRACT_1155_IMPL": "0x8e90D8cfc0CA66EA143930E4c5F7E31Bf16F722b",
"CONTRACT_1155_IMPL_VERSION": "2.0.0",
"UPGRADE_GATE": "0xbC50029836A59A4E5e1Bb8988272F46ebA0F9900",
"FACTORY_IMPL": "0x55B53DBE22859d538E3b44DD06C9FAE292409E3c",
"CONTRACT_1155_IMPL": "0xCf0B4Acab081169D12b729c3Bd1c6E7bbAB820Da",
"CONTRACT_1155_IMPL_VERSION": "2.4.0",
"FACTORY_IMPL": "0x8a5027ea12f45a13deb6CB96A07913c6e192BE84",
"FACTORY_PROXY": "0x777777C338d93e2C7adf08D102d45CA7CC4Ed021",
"FIXED_PRICE_SALE_STRATEGY": "0x04E2516A2c207E84a1839755675dfd8eF6302F0a",
"MERKLE_MINT_SALE_STRATEGY": "0xf48172CA3B6068B20eE4917Eb27b5472f1f272C7",
"PREMINTER_IMPL": "0x6E2AbBcd82935bFC68A1d5d2c96372b13b65eD9C",
"PREMINTER_PROXY": "0x7777773606e7e46C8Ba8B98C08f5cD218e31d340",
"REDEEM_MINTER_FACTORY": "0x78964965cF77850224513a367f899435C5B69174",
"timestamp": 1696362785,
"commit": "5e4c96a"
"UPGRADE_GATE": "0xbC50029836A59A4E5e1Bb8988272F46ebA0F9900",
"timestamp": 1700089183,
"commit": "bd8e9bd2"
}
12 changes: 6 additions & 6 deletions packages/protocol-deployments/addresses/10.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"CONTRACT_1155_IMPL": "0xF3a46845548bE811Ce37e65153563f4a0AaEbe31",
"CONTRACT_1155_IMPL_VERSION": "2.0.0",
"UPGRADE_GATE": "0xbC50029836A59A4E5e1Bb8988272F46ebA0F9900",
"FACTORY_IMPL": "0xF7e49F97E82cc38ACd82E303F37Fe046f5a190B5",
"CONTRACT_1155_IMPL": "0xCf0B4Acab081169D12b729c3Bd1c6E7bbAB820Da",
"CONTRACT_1155_IMPL_VERSION": "2.4.0",
"FACTORY_IMPL": "0x8a5027ea12f45a13deb6CB96A07913c6e192BE84",
"FACTORY_PROXY": "0x777777C338d93e2C7adf08D102d45CA7CC4Ed021",
"FIXED_PRICE_SALE_STRATEGY": "0x3678862f04290E565cCA2EF163BAeb92Bb76790C",
"MERKLE_MINT_SALE_STRATEGY": "0x899ce31dF6C6Af81203AcAaD285bF539234eF4b8",
"PREMINTER_IMPL": "0x6E2AbBcd82935bFC68A1d5d2c96372b13b65eD9C",
"PREMINTER_PROXY": "0x7777773606e7e46C8Ba8B98C08f5cD218e31d340",
"REDEEM_MINTER_FACTORY": "0x1B28A04b7eB7b93f920ddF2021aa3fAE065395f2",
"timestamp": 1696355077,
"commit": "dbb5d57"
"UPGRADE_GATE": "0xbC50029836A59A4E5e1Bb8988272F46ebA0F9900",
"timestamp": 1700087464,
"commit": "16d11cce"
}
12 changes: 6 additions & 6 deletions packages/protocol-deployments/addresses/7777777.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"CONTRACT_1155_IMPL": "0xa1F45f5B50e16E79366867E91fE45c181D18Cb67",
"CONTRACT_1155_IMPL_VERSION": "2.3.1",
"UPGRADE_GATE": "0xbC50029836A59A4E5e1Bb8988272F46ebA0F9900",
"FACTORY_IMPL": "0x2D6d587e9B09fa01405A5816938554ccdeEf69db",
"CONTRACT_1155_IMPL": "0x91509707F397e357DCe975399Fc98bB58081Ad63",
"CONTRACT_1155_IMPL_VERSION": "2.4.0",
"FACTORY_IMPL": "0xAeAA622E522130676A8d5a4D04e28aC9Afb84536",
"FACTORY_PROXY": "0x777777C338d93e2C7adf08D102d45CA7CC4Ed021",
"FIXED_PRICE_SALE_STRATEGY": "0x04E2516A2c207E84a1839755675dfd8eF6302F0a",
"MERKLE_MINT_SALE_STRATEGY": "0xf48172CA3B6068B20eE4917Eb27b5472f1f272C7",
"PREMINTER_IMPL": "0x6E2AbBcd82935bFC68A1d5d2c96372b13b65eD9C",
"PREMINTER_PROXY": "0x7777773606e7e46C8Ba8B98C08f5cD218e31d340",
"REDEEM_MINTER_FACTORY": "0x78964965cF77850224513a367f899435C5B69174",
"timestamp": 1696022353,
"commit": "9cac592"
"UPGRADE_GATE": "0xbC50029836A59A4E5e1Bb8988272F46ebA0F9900",
"timestamp": 1700159352,
"commit": "295b20e9"
}
12 changes: 6 additions & 6 deletions packages/protocol-deployments/addresses/8453.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"CONTRACT_1155_IMPL": "0x314E552b55DFbDfD4d76623E1D45E5056723998B",
"CONTRACT_1155_IMPL_VERSION": "2.0.0",
"UPGRADE_GATE": "0xbC50029836A59A4E5e1Bb8988272F46ebA0F9900",
"FACTORY_IMPL": "0xC6899816663891D7493939d74d83cb7f2BBcBB16",
"CONTRACT_1155_IMPL": "0xE9BaDfb9a1658cDF67D8c4631a7f22610C013319",
"CONTRACT_1155_IMPL_VERSION": "2.4.0",
"FACTORY_IMPL": "0x4518c41975F6D670777bD6d5D22F213f21140A32",
"FACTORY_PROXY": "0x777777C338d93e2C7adf08D102d45CA7CC4Ed021",
"FIXED_PRICE_SALE_STRATEGY": "0x04E2516A2c207E84a1839755675dfd8eF6302F0a",
"MERKLE_MINT_SALE_STRATEGY": "0xf48172CA3B6068B20eE4917Eb27b5472f1f272C7",
"PREMINTER_IMPL": "0x6E2AbBcd82935bFC68A1d5d2c96372b13b65eD9C",
"PREMINTER_PROXY": "0x7777773606e7e46C8Ba8B98C08f5cD218e31d340",
"REDEEM_MINTER_FACTORY": "0x78964965cF77850224513a367f899435C5B69174",
"timestamp": 1696357595,
"commit": "804ad45"
"UPGRADE_GATE": "0xbC50029836A59A4E5e1Bb8988272F46ebA0F9900",
"timestamp": 1700087984,
"commit": "a2700107"
}
12 changes: 6 additions & 6 deletions packages/protocol-deployments/addresses/999.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"CONTRACT_1155_IMPL": "0x26C2835dd7F048B7140906fA50E77ea8f8186Bbc",
"CONTRACT_1155_IMPL_VERSION": "2.3.0",
"UPGRADE_GATE": "0xbC50029836A59A4E5e1Bb8988272F46ebA0F9900",
"FACTORY_IMPL": "0x9a42d0786c17e231E0409E8441C99acf4678763d",
"CONTRACT_1155_IMPL": "0xcD7230AFfBC8C720aE607e0Bc386fbCAF5C34C2E",
"CONTRACT_1155_IMPL_VERSION": "2.4.0",
"FACTORY_IMPL": "0x869Be2EaE4AB30Cf319a46B5dE50Ac203c8784Aa",
"FACTORY_PROXY": "0x777777C338d93e2C7adf08D102d45CA7CC4Ed021",
"FIXED_PRICE_SALE_STRATEGY": "0x04E2516A2c207E84a1839755675dfd8eF6302F0a",
"MERKLE_MINT_SALE_STRATEGY": "0xf48172CA3B6068B20eE4917Eb27b5472f1f272C7",
"PREMINTER_IMPL": "0x6E2AbBcd82935bFC68A1d5d2c96372b13b65eD9C",
"PREMINTER_PROXY": "0x7777773606e7e46C8Ba8B98C08f5cD218e31d340",
"REDEEM_MINTER_FACTORY": "0x78964965cF77850224513a367f899435C5B69174",
"timestamp": 1696017248,
"commit": "7a0ae52"
"UPGRADE_GATE": "0xbC50029836A59A4E5e1Bb8988272F46ebA0F9900",
"timestamp": 1699570171,
"commit": "385e4932"
}
13 changes: 7 additions & 6 deletions packages/protocol-deployments/addresses/999999999.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"CONTRACT_1155_IMPL": "0x8f99FcF39C9f0B967daFcb5f85E182eb6677DdaB",
"CONTRACT_1155_IMPL_VERSION": "2.1.1-premint-api.0",
"FACTORY_IMPL": "0x3D6887CC977cAfBf7A6cCd78f587Fb77B97564E6",
"CONTRACT_1155_IMPL": "0xC6899816663891D7493939d74d83cb7f2BBcBB16",
"CONTRACT_1155_IMPL_VERSION": "2.4.0",
"FACTORY_IMPL": "0xA2d5B3C1feb801c0A1CF083Ee17d939A5E5D2464",
"FACTORY_PROXY": "0x777777C338d93e2C7adf08D102d45CA7CC4Ed021",
"FIXED_PRICE_SALE_STRATEGY": "0x6d28164C3CE04A190D5F9f0f8881fc807EAD975A",
"MERKLE_MINT_SALE_STRATEGY": "0x5e5fD4b758076BAD940db0284b711A67E8a3B88c",
"PREMINTER_IMPL": "0xC2EB55e7FAdC2289CFd063b1ec7c566EC2F0DA63",
"PREMINTER_IMPL": "0x4e10791d56a6E90b4b7E2840Fa96DD4fB273F3F2",
"PREMINTER_PROXY": "0x7777773606e7e46C8Ba8B98C08f5cD218e31d340",
"REDEEM_MINTER_FACTORY": "0x25cFb6dd9cDE8425e781d6718a29Ccbca3F038d6",
"timestamp": 1698699941,
"commit": "ad16b9b"
"UPGRADE_GATE": "0x0000000000000000000000000000000000000000",
"timestamp": 1700087849,
"commit": "a2700107"
}
4 changes: 4 additions & 0 deletions packages/protocol-deployments/script/DeployNew1155Impl.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import "forge-std/Script.sol";
import "forge-std/console2.sol";

import {ZoraDeployerBase} from "../src/ZoraDeployerBase.sol";
<<<<<<< HEAD
=======
import {ZoraDeployerUtils} from "../src/ZoraDeployerUtils.sol";
>>>>>>> 56ad2cd4 (Move deployment related config to protocol-deployments)
import {Deployment} from "../src/DeploymentConfig.sol";
import {DeterministicDeployerScript} from "../src/DeterministicDeployerScript.sol";

Expand Down
37 changes: 37 additions & 0 deletions packages/protocol-deployments/script/Simulate1155Upgrade.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "forge-std/Script.sol";
import "forge-std/console2.sol";

import {ZoraDeployerBase} from "../src/ZoraDeployerBase.sol";
import {ZoraDeployerUtils} from "../src/ZoraDeployerUtils.sol";
import {Deployment, ChainConfig} from "../src/DeploymentConfig.sol";
import {DeterministicDeployerScript} from "../src/DeterministicDeployerScript.sol";

/// @dev Deploys implementation contracts for 1155 contracts.
/// @notice Run after deploying the minters
/// @notice This
contract Simulate1155Upgrade is ZoraDeployerBase {
function run() public returns (string memory) {
Deployment memory deployment = getDeployment();

ChainConfig memory chainConfig = getChainConfig();

address creator = makeAddr("creator");

vm.startBroadcast(chainConfig.factoryOwner);

(address target, bytes memory upgradeCalldata) = ZoraDeployerUtils.simulateUpgrade(deployment);

console2.log("upgrade 1155 target:", target);
console2.log("calldata:");
console.logBytes(upgradeCalldata);

ZoraDeployerUtils.deployTestContractForVerification(deployment.factoryProxy, creator);

vm.stopBroadcast();

return getDeploymentJSON(deployment);
}
}
42 changes: 14 additions & 28 deletions packages/protocol-deployments/src/DeploymentTestingUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,32 @@ pragma solidity ^0.8.13;

import "forge-std/Script.sol";
import {IMinter1155} from "@zoralabs/zora-1155-contracts/src/interfaces/IMinter1155.sol";
import {IZoraCreator1155PremintExecutor} from "@zoralabs/zora-1155-contracts/src/interfaces/IZoraCreator1155PremintExecutor.sol";
import {ZoraCreator1155PremintExecutorImpl} from "@zoralabs/zora-1155-contracts/src/delegation/ZoraCreator1155PremintExecutorImpl.sol";
import {ZoraCreator1155FactoryImpl} from "@zoralabs/zora-1155-contracts/src/factory/ZoraCreator1155FactoryImpl.sol";
import {ZoraCreator1155Attribution, ContractCreationConfig, PremintConfigV2, TokenCreationConfigV2} from "@zoralabs/zora-1155-contracts/src/delegation/ZoraCreator1155Attribution.sol";
import {ZoraCreator1155Attribution, ContractCreationConfig, PremintConfig, TokenCreationConfig} from "@zoralabs/zora-1155-contracts/src/delegation/ZoraCreator1155Attribution.sol";
import {ZoraCreator1155Impl} from "@zoralabs/zora-1155-contracts/src/nft/ZoraCreator1155Impl.sol";

contract DeploymentTestingUtils is Script {
function signAndExecutePremint(address premintExecutorProxyAddress, address payoutRecipient) internal {
function signAndExecutePremint(address premintExecutorProxyAddress) internal {
console2.log("preminter proxy", premintExecutorProxyAddress);

(address creator, uint256 creatorPrivateKey) = makeAddrAndKey("creator");
IZoraCreator1155PremintExecutor preminterAtProxy = IZoraCreator1155PremintExecutor(premintExecutorProxyAddress);
ZoraCreator1155PremintExecutorImpl preminterAtProxy = ZoraCreator1155PremintExecutorImpl(premintExecutorProxyAddress);

IMinter1155 fixedPriceMinter = ZoraCreator1155FactoryImpl(address(preminterAtProxy.zora1155Factory())).fixedPriceMinter();

PremintConfigV2 memory premintConfig = PremintConfigV2({
tokenConfig: TokenCreationConfigV2({
PremintConfig memory premintConfig = PremintConfig({
tokenConfig: TokenCreationConfig({
tokenURI: "blah.token",
maxSupply: 10,
maxTokensPerAddress: 5,
pricePerToken: 0,
mintStart: 0,
mintDuration: 0,
royaltyMintSchedule: 0,
royaltyBPS: 100,
payoutRecipient: payoutRecipient,
fixedPriceMinter: address(fixedPriceMinter),
createReferral: address(0)
royaltyRecipient: creator,
fixedPriceMinter: address(fixedPriceMinter)
}),
uid: 100,
version: 0,
Expand All @@ -40,31 +39,18 @@ contract DeploymentTestingUtils is Script {
ContractCreationConfig memory contractConfig = ContractCreationConfig({contractAdmin: creator, contractName: "blah", contractURI: "blah.contract"});
address deterministicAddress = preminterAtProxy.getContractAddress(contractConfig);

uint256 quantityToMint = 1;
// sign the premint
bytes32 digest = ZoraCreator1155Attribution.premintHashedTypeDataV4(premintConfig, deterministicAddress, block.chainid);

address mintRecipient = creator;
(uint8 v, bytes32 r, bytes32 s) = vm.sign(creatorPrivateKey, digest);

IZoraCreator1155PremintExecutor.MintArguments memory mintArguments = IZoraCreator1155PremintExecutor.MintArguments({
mintRecipient: mintRecipient,
mintComment: "",
mintReferral: address(0)
});
uint256 quantityToMint = 1;

bytes memory signature = signPremint(premintConfig, deterministicAddress, creatorPrivateKey);
bytes memory signature = abi.encodePacked(r, s, v);

// execute the premint
uint256 tokenId = preminterAtProxy.premintV2{value: 0.000777 ether}(contractConfig, premintConfig, signature, quantityToMint, mintArguments).tokenId;
uint256 tokenId = preminterAtProxy.premint{value: 0.000777 ether}(contractConfig, premintConfig, signature, quantityToMint, "");

require(ZoraCreator1155Impl(deterministicAddress).delegatedTokenId(premintConfig.uid) == tokenId, "token id not created for uid");
}

function signPremint(PremintConfigV2 memory premintConfig, address deterministicAddress, uint256 privateKey) private view returns (bytes memory signature) {
bytes32 signatureVersion = ZoraCreator1155Attribution.HASHED_VERSION_2;
bytes32 structHash = ZoraCreator1155Attribution.hashPremint(premintConfig);
// sign the premint
bytes32 digest = ZoraCreator1155Attribution.premintHashedTypeDataV4(structHash, deterministicAddress, signatureVersion, block.chainid);

(uint8 v, bytes32 r, bytes32 s) = vm.sign(privateKey, digest);
return abi.encodePacked(r, s, v);
}
}
23 changes: 23 additions & 0 deletions packages/protocol-deployments/src/ZoraDeployerUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,27 @@ library ZoraDeployerUtils {
)
);
}

function getUpgradeCalldata(Deployment memory deployment) internal returns (bytes memory upgradeCalldata) {
// create 1155 proxy from deployment factory proxy address
ZoraCreator1155FactoryImpl factory = ZoraCreator1155FactoryImpl(deployment.factoryProxy);

address owner = factory.owner();

// simulate upgrade call
upgradeCalldata = abi.encodeWithSelector(factory.upgradeTo.selector, deployment.factoryImpl);
}

function simulateUpgrade(Deployment memory deployment) internal returns (address target, bytes memory upgradeCalldata) {
// console log update information

upgradeCalldata = getUpgradeCalldata(deployment);

target = deployment.factoryProxy;
// upgrade the factory proxy to the new implementation

(bool success, ) = target.call(upgradeCalldata);

require(success, "upgrade failed");
}
}
7 changes: 7 additions & 0 deletions packages/protocol-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
- added 1155 creation sdk, usable with `create1155CreatorClient`
- premint sdk is now useable with `createPremintClient`

## 0.1.2-prerelease.0

### Patch Changes

- Updated dependencies [a50ae1c]
- @zoralabs/protocol-deployments@0.0.5-prerelease.0

## 0.1.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"lint": "prettier --check 'src/**/*.ts'"
},
"dependencies": {
"@zoralabs/protocol-deployments": "*",
"@zoralabs/protocol-deployments": "0.0.5-prerelease.0",
"abitype": "^0.8.7",
"vite": "4.5.0"
},
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,16 @@
resolved "https://registry.yarnpkg.com/@zoralabs/openzeppelin-contracts-upgradeable/-/openzeppelin-contracts-upgradeable-4.8.4.tgz#130b69cd5ff70b1f67da11fe53fe8b2323464b84"
integrity sha512-5vhL88tz00Gv2+NUhLdYBRqb9RRekfyQAodXTQxJU2LYxxy6jr1mPycTZempQ1kmw5wIwFbSIoYzpaxOx6UK6Q==

"@zoralabs/protocol-deployments@0.0.5-prerelease.0":
version "0.0.5-prerelease.0"
resolved "https://registry.yarnpkg.com/@zoralabs/protocol-deployments/-/protocol-deployments-0.0.5-prerelease.0.tgz#9eedad9118a6a271564270b511db43ac49fea1a2"
integrity sha512-GuOHx4ReHD986D1NlX3WEoHb7Qf3lxY00cXYe6GqDt80NoHReZaCsoBpZScSySoNGs644y7I1IAq7PHiIGUA/w==
dependencies:
"@zoralabs/zora-1155-contracts" "*"
ds-test "https://github.com/dapphub/ds-test#cd98eff28324bfac652e63a239a60632a761790b"
forge-std "https://github.com/foundry-rs/forge-std#705263c95892a906d7af65f0f73ce8a4a0c80b80"
solmate "^6.1.0"

abitype@0.8.7:
version "0.8.7"
resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.8.7.tgz#e4b3f051febd08111f486c0cc6a98fa72d033622"
Expand Down

0 comments on commit ec1ce5f

Please sign in to comment.