fix: repair deploy script, per-network env vars, add .env.example#14
Open
PragyaTripathi990 wants to merge 1 commit into
Open
fix: repair deploy script, per-network env vars, add .env.example#14PragyaTripathi990 wants to merge 1 commit into
PragyaTripathi990 wants to merge 1 commit into
Conversation
deploy.js had PPTToken deployment commented out and hardcoded the MedInvoiceContract's token address. Restored both deployments in sequence so PPTToken is always deployed first and its address passed automatically. Added contract verification for non-local networks with error handling. hardhat.config.js used a single RPC_URL for all 6 networks, making it impossible to deploy to more than one without editing the file. Replaced with per-network env vars (CALIBNET_RPC_URL, OP_SEPOLIA_RPC_URL, etc.) and per-explorer API keys. Accounts and URLs default to empty string/array so hardhat doesn't throw on startup when variables are not set. Added .env.example documenting all required environment variables with links to where API keys can be obtained for each network. Closes seetadev#3
78bd31c to
5d3080a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three related issues with the development setup, all fixed together:
1.
scripts/deploy.js— PPTToken deployment was entirely commented out, so the script deployedMedInvoiceContractwith a hardcoded token address. This means a fresh deployment on any new network would point to the wrong contract. Restored both deployments in correct sequence (PPTToken first, then MedInvoiceContract using that address). Added contract verification for non-local networks with graceful error handling.2.
hardhat.config.js— All 6 networks shared a singleRPC_URLenv var, making it impossible to have multiple networks configured simultaneously. Replaced with per-network vars (CALIBNET_RPC_URL,OP_SEPOLIA_RPC_URL, etc.) and per-explorer API keys. URLs/accounts default to empty so hardhat doesn't crash on startup when env vars are unset (previouslyhardhat testwas broken locally without a.env).3.
.env.example(new file) — The repo had no.env.example. Added one documenting every required variable with descriptions and links to where each API key can be obtained.Test plan
cp .env.example .envthennpx hardhat test→ tests run without config errorsnpx hardhat run scripts/deploy.js --network calibnetdeploys both contracts and prints addressesCloses #3
🤖 Generated with Claude Code