Skip to content

Commit

Permalink
deployed 2.4.0 to zora testnet. created script to just deploy 1155 an…
Browse files Browse the repository at this point in the history
…d print upgrade
  • Loading branch information
oveddan committed Nov 9, 2023
1 parent 385e493 commit dd57cb6
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/protocol-deployments/addresses/999.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"CONTRACT_1155_IMPL": "0x2482ffB455FC6cAE757C1e72FB7Ab01cF045ac52",
"CONTRACT_1155_IMPL": "0xcD7230AFfBC8C720aE607e0Bc386fbCAF5C34C2E",
"CONTRACT_1155_IMPL_VERSION": "2.4.0",
"FACTORY_IMPL": "0x3E03bb82bf1441adCeCf4A0321ccedd779fF774C",
"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",
"UPGRADE_GATE": "0xbC50029836A59A4E5e1Bb8988272F46ebA0F9900",
"timestamp": 1699565037,
"commit": "5d86660c"
"timestamp": 1699570171,
"commit": "385e4932"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "forge-std/Script.sol";
import "forge-std/console2.sol";

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

Expand Down
37 changes: 37 additions & 0 deletions packages/protocol-deployments/script/Simulat1155Upgrade.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);
}
}
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");
}
}

0 comments on commit dd57cb6

Please sign in to comment.