From 3d619aabe735f1e845622e61566d5744c980df5e Mon Sep 17 00:00:00 2001 From: root Date: Mon, 2 Sep 2024 11:28:48 +0200 Subject: [PATCH] deleted sensible defaul info --- packages/hardhat/hardhat.config.ts | 15 +- .../nextjs/contracts/deployedContracts.ts | 224 ------------------ packages/nextjs/scaffold.config.ts | 6 +- 3 files changed, 10 insertions(+), 235 deletions(-) diff --git a/packages/hardhat/hardhat.config.ts b/packages/hardhat/hardhat.config.ts index f14ca99..19f3fb9 100644 --- a/packages/hardhat/hardhat.config.ts +++ b/packages/hardhat/hardhat.config.ts @@ -10,14 +10,13 @@ import "@nomicfoundation/hardhat-verify"; import "hardhat-deploy"; import "hardhat-deploy-ethers"; -// If not set, it uses ours Alchemy's default API key. -// You can get your own at https://dashboard.alchemyapi.io -const providerApiKey = process.env.ALCHEMY_API_KEY || "oKxs-03sij-U_N0iOlrSsZFr29-IqbuF"; -// If not set, it uses the hardhat account 0 private key. +const providerApiKey = process.env.ALCHEMY_API_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"; + process.env.DEPLOYER_PRIVATE_KEY; +if (!deployerPrivateKey) { + throw new Error("DEPLOYER_PRIVATE_KEY environment variable is not set"); +} +const etherscanApiKey = process.env.ETHERSCAN_API_KEY; const config: HardhatUserConfig = { solidity: { @@ -30,7 +29,7 @@ const config: HardhatUserConfig = { }, }, }, - defaultNetwork: "sepolia", + defaultNetwork: "hardhat", namedAccounts: { deployer: { // By default, it will take the first Hardhat account as the deployer diff --git a/packages/nextjs/contracts/deployedContracts.ts b/packages/nextjs/contracts/deployedContracts.ts index 47ee80d..1470fb4 100644 --- a/packages/nextjs/contracts/deployedContracts.ts +++ b/packages/nextjs/contracts/deployedContracts.ts @@ -5,230 +5,6 @@ import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; const deployedContracts = { - 31337: { - DiceGame: { - address: "0x2bdCC0de6bE1f7D2ee689a0342D76F52E8EFABa3", - abi: [ - { - inputs: [], - stateMutability: "payable", - type: "constructor", - }, - { - inputs: [], - name: "NotEnoughEther", - type: "error", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "player", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - { - indexed: false, - internalType: "uint256", - name: "roll", - type: "uint256", - }, - ], - name: "Roll", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "winner", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "Winner", - type: "event", - }, - { - inputs: [], - name: "nonce", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "prize", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "rollTheDice", - outputs: [], - stateMutability: "payable", - type: "function", - }, - { - stateMutability: "payable", - type: "receive", - }, - ], - inheritedFunctions: {}, - }, - RiggedRoll: { - address: "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0", - abi: [ - { - inputs: [ - { - internalType: "address payable", - name: "diceGameAddress", - type: "address", - }, - ], - stateMutability: "payable", - type: "constructor", - }, - { - inputs: [], - name: "NotEnoughEther", - type: "error", - }, - { - inputs: [], - name: "RollBiggerThanFive", - type: "error", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "previousOwner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "OwnershipTransferred", - type: "event", - }, - { - inputs: [], - name: "diceGame", - outputs: [ - { - internalType: "contract DiceGame", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "owner", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "renounceOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "riggedRoll", - outputs: [], - stateMutability: "payable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "transferOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_addr", - type: "address", - }, - { - internalType: "uint256", - name: "_amount", - type: "uint256", - }, - ], - name: "withdraw", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - stateMutability: "payable", - type: "receive", - }, - ], - inheritedFunctions: { - owner: "@openzeppelin/contracts/access/Ownable.sol", - renounceOwnership: "@openzeppelin/contracts/access/Ownable.sol", - transferOwnership: "@openzeppelin/contracts/access/Ownable.sol", - }, - }, - }, 11155111: { DiceGame: { address: "0x7285bf14271775b777Bc619bD4af9F6E5edcDeA1", diff --git a/packages/nextjs/scaffold.config.ts b/packages/nextjs/scaffold.config.ts index b00a22e..ff32096 100644 --- a/packages/nextjs/scaffold.config.ts +++ b/packages/nextjs/scaffold.config.ts @@ -10,7 +10,7 @@ export type ScaffoldConfig = { const scaffoldConfig = { // The networks on which your DApp is live - targetNetworks: [chains.sepolia], + targetNetworks: [chains.hardhat], // The interval at which your front-end polls the RPC servers for new data // it has no effect if you only target the local network (default is 4000) @@ -20,13 +20,13 @@ const scaffoldConfig = { // You can get your own at https://dashboard.alchemyapi.io // It's recommended to store it in an env variable: // .env.local for local testing, and in the Vercel/system env config for live apps. - alchemyApiKey: process.env.NEXT_PUBLIC_ALCHEMY_API_KEY || "oKxs-03sij-U_N0iOlrSsZFr29-IqbuF", + alchemyApiKey: process.env.NEXT_PUBLIC_ALCHEMY_API_KEY ?? (() => { throw new Error("Alchemy API Key is required") })(), // This is ours WalletConnect's default project ID. // You can get your own at https://cloud.walletconnect.com // It's recommended to store it in an env variable: // .env.local for local testing, and in the Vercel/system env config for live apps. - walletConnectProjectId: process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID || "3a8170812b534d0ff9d794f19a901d64", + walletConnectProjectId: process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID ?? (() => { throw new Error("WalletConnect Project ID is required") })(), // Only show the Burner Wallet when running on hardhat network onlyLocalBurnerWallet: true,