diff --git a/.changeset/dirty-pillows-agree.md b/.changeset/dirty-pillows-agree.md new file mode 100644 index 000000000..1d43d795f --- /dev/null +++ b/.changeset/dirty-pillows-agree.md @@ -0,0 +1,7 @@ +--- +"create-eth": patch +--- + +- **Optimism and base networks verification (https://github.com/scaffold-eth/scaffold-eth-2/pull/996)** +- **move 99_deployScript as hardhat task (https://github.com/scaffold-eth/scaffold-eth-2/pull/1005)** +- **feat: use current yarn version in vercel on deploy via cli (https://github.com/scaffold-eth/scaffold-eth-2/pull/1007)** diff --git a/templates/base/packages/nextjs/package.json b/templates/base/packages/nextjs/package.json index ed0bc1656..ad77e085f 100644 --- a/templates/base/packages/nextjs/package.json +++ b/templates/base/packages/nextjs/package.json @@ -10,8 +10,8 @@ "lint": "next lint", "format": "prettier --write . '!(node_modules|.next|contracts)/**/*'", "check-types": "tsc --noEmit --incremental", - "vercel": "vercel", - "vercel:yolo": "vercel --build-env NEXT_PUBLIC_IGNORE_BUILD_ERROR=true" + "vercel": "vercel --build-env YARN_ENABLE_IMMUTABLE_INSTALLS=false --build-env ENABLE_EXPERIMENTAL_COREPACK=1", + "vercel:yolo": "vercel --build-env YARN_ENABLE_IMMUTABLE_INSTALLS=false --build-env ENABLE_EXPERIMENTAL_COREPACK=1 --build-env NEXT_PUBLIC_IGNORE_BUILD_ERROR=true" }, "dependencies": { "@heroicons/react": "~2.1.5", @@ -51,6 +51,7 @@ "tailwindcss": "~3.4.11", "type-fest": "~4.26.1", "typescript": "<5.6.0", - "vercel": "~37.4.2" - } + "vercel": "~39.1.3" + }, + "packageManager": "yarn@3.2.3" } diff --git a/templates/solidity-frameworks/hardhat/packages/hardhat/.env.example b/templates/solidity-frameworks/hardhat/packages/hardhat/.env.example index a9ccb0860..86614fe5e 100644 --- a/templates/solidity-frameworks/hardhat/packages/hardhat/.env.example +++ b/templates/solidity-frameworks/hardhat/packages/hardhat/.env.example @@ -8,4 +8,4 @@ # To access the values stored in this .env file you can use: process.env.VARIABLENAME ALCHEMY_API_KEY= DEPLOYER_PRIVATE_KEY= -ETHERSCAN_API_KEY= +ETHERSCAN_MAINNET_API_KEY= diff --git a/templates/solidity-frameworks/hardhat/packages/hardhat/hardhat.config.ts.template.mjs b/templates/solidity-frameworks/hardhat/packages/hardhat/hardhat.config.ts.template.mjs index 43da177f0..134e8d39c 100644 --- a/templates/solidity-frameworks/hardhat/packages/hardhat/hardhat.config.ts.template.mjs +++ b/templates/solidity-frameworks/hardhat/packages/hardhat/hardhat.config.ts.template.mjs @@ -28,6 +28,8 @@ import "solidity-coverage"; import "@nomicfoundation/hardhat-verify"; import "hardhat-deploy"; import "hardhat-deploy-ethers"; +import { task } from "hardhat/config"; +import generateTsAbis from "./scripts/generateTsAbis"; ${imports.filter(Boolean).join("\n")} // If not set, it uses ours Alchemy's default API key. @@ -36,8 +38,10 @@ const providerApiKey = process.env.ALCHEMY_API_KEY || "oKxs-03sij-U_N0iOlrSsZFr2 // If not set, it uses the hardhat account 0 private key. const deployerPrivateKey = process.env.DEPLOYER_PRIVATE_KEY ?? "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"; -// If not set, it uses ours Etherscan default API key. -const etherscanApiKey = process.env.ETHERSCAN_API_KEY || "DNXJA8RX2Q3VZ4URQIWP7Z68CJXQZSC6AW"; +// If not set, it uses our block explorers default API keys. +const etherscanApiKey = process.env.ETHERSCAN_MAINNET_API_KEY || "DNXJA8RX2Q3VZ4URQIWP7Z68CJXQZSC6AW"; +const etherscanOptimisticApiKey = process.env.ETHERSCAN_OPTIMISTIC_API_KEY || "RM62RDISS1RH448ZY379NX625ASG1N633R"; +const basescanApiKey = process.env.BASESCAN_API_KEY || "ZZZEIPMT1MNJ8526VV2Y744CA7TNZR64G6"; const config: HardhatUserConfig = { solidity: { @@ -79,10 +83,22 @@ const config: HardhatUserConfig = { optimism: { url: \`https://opt-mainnet.g.alchemy.com/v2/\${providerApiKey}\`, accounts: [deployerPrivateKey], + verify: { + etherscan: { + apiUrl: "https://api-optimistic.etherscan.io", + apiKey: etherscanOptimisticApiKey, + }, + }, }, optimismSepolia: { url: \`https://opt-sepolia.g.alchemy.com/v2/\${providerApiKey}\`, accounts: [deployerPrivateKey], + verify: { + etherscan: { + apiUrl: "https://api-sepolia-optimistic.etherscan.io", + apiKey: etherscanOptimisticApiKey, + }, + }, }, polygon: { url: \`https://polygon-mainnet.g.alchemy.com/v2/\${providerApiKey}\`, @@ -111,10 +127,22 @@ const config: HardhatUserConfig = { base: { url: "https://mainnet.base.org", accounts: [deployerPrivateKey], + verify: { + etherscan: { + apiUrl: "https://api.basescan.org", + apiKey: basescanApiKey, + }, + }, }, baseSepolia: { url: "https://sepolia.base.org", accounts: [deployerPrivateKey], + verify: { + etherscan: { + apiUrl: "https://api-sepolia.basescan.org", + apiKey: basescanApiKey, + }, + }, }, scrollSepolia: { url: "https://sepolia-rpc.scroll.io", @@ -156,6 +184,14 @@ const config: HardhatUserConfig = { }, }; +// Extend the deploy task +task("deploy").setAction(async (args, hre, runSuper) => { + // Run the original deploy task + await runSuper(args); + // Force run the generateTsAbis script + await generateTsAbis(hre); +}); + export default config;` }; diff --git a/templates/solidity-frameworks/hardhat/packages/hardhat/deploy/99_generateTsAbis.ts b/templates/solidity-frameworks/hardhat/packages/hardhat/scripts/generateTsAbis.ts similarity index 93% rename from templates/solidity-frameworks/hardhat/packages/hardhat/deploy/99_generateTsAbis.ts rename to templates/solidity-frameworks/hardhat/packages/hardhat/scripts/generateTsAbis.ts index b916d1b26..b794e1add 100644 --- a/templates/solidity-frameworks/hardhat/packages/hardhat/deploy/99_generateTsAbis.ts +++ b/templates/solidity-frameworks/hardhat/packages/hardhat/scripts/generateTsAbis.ts @@ -87,7 +87,7 @@ function getContractDataFromDeployments() { const { abi, address, metadata } = JSON.parse( fs.readFileSync(`${DEPLOYMENTS_DIR}/${chainName}/${contractName}.json`).toString(), ); - const inheritedFunctions = getInheritedFunctions(JSON.parse(metadata).sources, contractName); + const inheritedFunctions = metadata ? getInheritedFunctions(JSON.parse(metadata).sources, contractName) : {}; contracts[contractName] = { address, abi, inheritedFunctions }; } output[chainId] = contracts; @@ -125,9 +125,3 @@ const generateTsAbis: DeployFunction = async function () { }; export default generateTsAbis; - -// Tags are useful if you have multiple deploy files and only want to run one of them. -// e.g. yarn deploy --tags generateTsAbis -generateTsAbis.tags = ["generateTsAbis"]; - -generateTsAbis.runAtTheEnd = true;