Skip to content

Commit

Permalink
Moved deployments to new folder, and now wagmi generates the config
Browse files Browse the repository at this point in the history
  • Loading branch information
oveddan committed Oct 27, 2023
1 parent 1193564 commit 3c1992b
Show file tree
Hide file tree
Showing 64 changed files with 355 additions and 301 deletions.
16 changes: 5 additions & 11 deletions packages/1155-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@
"test-gas": "forge test --gas-report",
"prettier:check": "prettier --check 'src/**/*.sol' 'test/**/*.sol' 'package/**/*.ts' 'wagmi.config.ts'",
"prettier": "prettier --write 'src/**/*.sol' 'test/**/*.sol' 'package/**/*.ts' 'script/**/*.ts' 'wagmi.config.ts'",
"prepack": "yarn wagmi && yarn copy-abis && yarn build",
"copy-abis": "tsx script/bundle-abis.ts",
"lint": "yarn run prettier:check",
"coverage": "forge coverage --report lcov",
"write-gas-report": "forge test --gas-report > gasreport.ansi",
"copy-abis": "tsx script/bundle-abis.ts",
"prepack": "yarn wagmi && yarn copy-abis && yarn bundle-configs && yarn build",
"update-new-deployment-addresses": "node script/copy-deployed-contracts.mjs deploy",
"update-contract-version": "node script/update-contract-version.mjs",
"build:contracts": "forge build",
"build": "tsup",
"build:sizes": "forge build --sizes",
"bundle-configs": "node script/bundle-chainConfigs.mjs && yarn prettier",
"wagmi": "wagmi generate",
"storage-inspect:check": "./script/storage-check.sh check ZoraCreator1155Impl ZoraCreator1155FactoryImpl",
"storage-inspect:generate": "./script/storage-check.sh generate ZoraCreator1155Impl ZoraCreator1155FactoryImpl"
"storage-inspect:generate": "./script/storage-check.sh generate ZoraCreator1155Impl ZoraCreator1155FactoryImpl",
"update-contract-version": "node script/update-contract-version.mjs"
},
"files": [
"dist/",
Expand All @@ -48,16 +45,13 @@
"solady": "^0.0.123",
"solmate": "^6.1.0"
},
"devDependencies": {
"devdependencies": {
"@wagmi/cli": "^1.0.1",
"tsx": "^3.13.0",
"glob": "^10.2.2",
"prettier": "^2.8.8",
"es-main": "^1.2.0",
"@turnkey/api-key-stamper": "^0.1.1",
"prettier-plugin-solidity": "^1.1.3",
"@turnkey/http": "^1.2.0",
"@turnkey/viem": "^0.2.4",
"@types/node": "^20.1.2",
"tsup": "^7.2.0",
"typescript": "^5.0.4"
Expand Down
1 change: 0 additions & 1 deletion packages/1155-contracts/package/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
// built at build time. They are not checked in to git.
// The can be generated by running `yarn prepack` in the root
export * from "./wagmiGenerated";
export { chainConfigs } from "./chainConfigs";
27 changes: 0 additions & 27 deletions packages/1155-contracts/script/DeployUpgradeGate.s.sol

This file was deleted.

67 changes: 0 additions & 67 deletions packages/1155-contracts/script/TestCreateDeterministic.sol

This file was deleted.

43 changes: 0 additions & 43 deletions packages/1155-contracts/script/TestUpgrade.s.sol

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ pragma solidity ^0.8.13;
import "forge-std/Script.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";

import {IZoraCreator1155Factory} from "../src/interfaces/IZoraCreator1155Factory.sol";
import {ZoraCreator1155Impl} from "../src/nft/ZoraCreator1155Impl.sol";
import {Zora1155Factory} from "../src/proxies/Zora1155Factory.sol";
import {ICreatorRoyaltiesControl} from "../src/interfaces/ICreatorRoyaltiesControl.sol";
import {ScriptDeploymentConfig, Deployment, ChainConfig} from "../src/deployment/DeploymentConfig.sol";
import {ZoraDeployerUtils} from "../src/deployment/ZoraDeployerUtils.sol";
import {IMinter1155} from "../src/interfaces/IMinter1155.sol";
import {DeterministicDeployerScript} from "../src/deployment/DeterministicDeployerScript.sol";
import {ZoraCreator1155FactoryImpl} from "../src/factory/ZoraCreator1155FactoryImpl.sol";
import {IZoraCreator1155Factory} from "../interfaces/IZoraCreator1155Factory.sol";
import {ZoraCreator1155Impl} from "../nft/ZoraCreator1155Impl.sol";
import {Zora1155Factory} from "../proxies/Zora1155Factory.sol";
import {ICreatorRoyaltiesControl} from "../interfaces/ICreatorRoyaltiesControl.sol";
import {ScriptDeploymentConfig, Deployment, ChainConfig} from "../deployment/DeploymentConfig.sol";
import {ZoraDeployerUtils} from "../deployment/ZoraDeployerUtils.sol";
import {IMinter1155} from "../interfaces/IMinter1155.sol";
import {DeterministicDeployerScript} from "../deployment/DeterministicDeployerScript.sol";
import {ZoraCreator1155FactoryImpl} from "../factory/ZoraCreator1155FactoryImpl.sol";

/// @notice Deployment drops for base where
abstract contract ZoraDeployerBase is ScriptDeploymentConfig, DeterministicDeployerScript {
Expand Down
82 changes: 3 additions & 79 deletions packages/1155-contracts/wagmi.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { defineConfig } from "@wagmi/cli";
import { foundry } from "@wagmi/cli/plugins";
import { readdirSync, readFileSync } from "fs";
import { publishAbisJson } from "./publishAbisPlugin";

type ContractNames =
| "ZoraCreator1155FactoryImpl"
Expand All @@ -14,8 +12,6 @@ type ContractNames =
| "DeterministicProxyDeployer"
| "IImmutableCreate2Factory";

type Address = `0x${string}`;

const contractFilesToInclude: ContractNames[] = [
"ZoraCreator1155FactoryImpl",
"ZoraCreator1155Impl",
Expand All @@ -28,85 +24,13 @@ const contractFilesToInclude: ContractNames[] = [
"IImmutableCreate2Factory",
];

type Addresses = {
[key in ContractNames]?: {
[chainId: number]: Address;
};
};

const getAddresses = () => {
const addresses: Addresses = {};

const addressesFiles = readdirSync("./addresses");

const addAddress = (
contractName: ContractNames,
chainId: number,
address?: Address
) => {
if (!address) return;
if (!addresses[contractName]) {
addresses[contractName] = {};
}

addresses[contractName]![chainId] = address;
};

for (const addressesFile of addressesFiles) {
const jsonAddress = JSON.parse(
readFileSync(`./addresses/${addressesFile}`, "utf-8")
) as {
FIXED_PRICE_SALE_STRATEGY: Address;
MERKLE_MINT_SALE_STRATEGY: Address;
REDEEM_MINTER_FACTORY: Address;
"1155_IMPL": Address;
FACTORY_IMPL: Address;
FACTORY_PROXY: Address;
PREMINTER_PROXY?: Address;
};

const chainId = parseInt(addressesFile.split(".")[0]);

addAddress(
"ZoraCreatorFixedPriceSaleStrategy",
chainId,
jsonAddress.FIXED_PRICE_SALE_STRATEGY
);
addAddress(
"ZoraCreatorMerkleMinterStrategy",
chainId,
jsonAddress.MERKLE_MINT_SALE_STRATEGY
);
addAddress(
"ZoraCreator1155FactoryImpl",
chainId,
jsonAddress.FACTORY_PROXY
);
addAddress(
"ZoraCreatorRedeemMinterFactory",
chainId,
jsonAddress.REDEEM_MINTER_FACTORY
);
addAddress(
"ZoraCreator1155PremintExecutorImpl",
chainId,
jsonAddress.PREMINTER_PROXY
),
addAddress(
"IImmutableCreate2Factory",
chainId,
"0x0000000000FFe8B47B3e2130213B802212439497"
);
}

return addresses;
};

export default defineConfig({
out: "package/wagmiGenerated.ts",
plugins: [
foundry({
deployments: getAddresses(),
forge: {
build: false,
},
include: contractFilesToInclude.map(
(contractName) => `${contractName}.json`
),
Expand Down
2 changes: 2 additions & 0 deletions packages/deployments/.env.anvil
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FORK_RPC_URL="https://rpc.zora.co/"
FORK_BLOCK_NUMBER=5141442
22 changes: 22 additions & 0 deletions packages/deployments/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# @zoralabs/premint-sdk

## 0.0.2-premint-api.2

### Patch Changes

- c29e080: Update retry and error reporting

## 0.0.2-premint-api.1

### Patch Changes

- 6eaf7bb: add retries

## 0.0.2-premint-api.0

### Patch Changes

- Updated dependencies [8395b8e]
- Updated dependencies [aae756b]
- Updated dependencies [cf184b3]
- @zoralabs/zora-1155-contracts@2.1.1-premint-api.0
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
39 changes: 39 additions & 0 deletions packages/deployments/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[profile.default]
fs_permissions = [
{ access = "read", path = "./addresses" },
{ access = "read", path = "./chainConfigs" },
{ access = "read", path = "./package.json" },
{ access = "readwrite", path = "./deterministicConfig" },
]
libs = ['_imagine', 'node_modules', 'script']
allow_paths = [
"node_modules/@zoralabs/protocol-rewards",
"node_modules/@zoralabs/zora-1155-contracts",
]
optimizer = true
optimizer_runs = 50
via_ir = true
solc_version = '0.8.17'
out = 'out'
src = 'src'

[profile.dev]
optimizer = false
optimizer_runs = 0
via_ir = false

[rpc_endpoints]
goerli = "https://eth-goerli.g.alchemy.com/v2/${ALCHEMY_KEY}"
mainnet = "https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}"
# for optimism, since we are just using this for deployment/fork testing,
# we can use these since they're lower volume.
base = "https://base-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}"
base_goerli = "https://base-goerli.g.alchemy.com/v2/${ALCHEMY_KEY}"
optimism = "https://opt-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}"
optimism_goerli = "https://opt-goerli.g.alchemy.com/v2/${ALCHEMY_KEY}"
pgn = "https://rpc.publicgoods.network"
pgn_sepolia = "https://sepolia.publicgoods.network"
zora = "https://rpc.zora.energy"
zora_goerli = "https://testnet.rpc.zora.energy"

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
Loading

0 comments on commit 3c1992b

Please sign in to comment.