fix: deploy script contract mismatch#48
fix: deploy script contract mismatch#48dhruvi-16-me wants to merge 1 commit intoStabilityNexus:mainfrom
Conversation
📝 WalkthroughWalkthroughThe deployment script now uses a configurable Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
Verify each finding against the current code and only fix it if needed.
In `@deploy/deploy.script.ts`:
- Around line 18-27: The default branch currently calls
Contract.deploy(deployerAddress) which passes an EOA where auction contracts
expect a ProtocolParameters contract address; update the deployment logic so the
protocol-parameters address is explicit and validated instead of using
deployerAddress: introduce a configurable constant (e.g.
PROTOCOL_PARAMETERS_ADDRESS) or require CONTRACT_TO_DEPLOY to be
'ProtocolParameters' before using deployerAddress, then call
Contract.deploy(PROTOCOL_PARAMETERS_ADDRESS) (or deploy a ProtocolParameters
contract when none provided) and throw or exit if PROTOCOL_PARAMETERS_ADDRESS is
missing; update any references to Contract.deploy in this file so
ProtocolParameters addresses are supplied, and log/validate the address before
deploying auction contracts.
- Around line 28-30: The console.log reads contract.target immediately after
deploy; update the deploy flow to await the contract being mined by calling
await contract.waitForDeployment() after deploy() and before accessing
contract.target so the deployment is confirmed (use the existing contract
variable returned by deploy(), and call waitForDeployment on it prior to the
console.log).
🧹 Nitpick comments (1)
🤖 Fix all nitpicks with AI agents
Verify each finding against the current code and only fix it if needed. In `@deploy/deploy.script.ts`: - Around line 28-30: The console.log reads contract.target immediately after deploy; update the deploy flow to await the contract being mined by calling await contract.waitForDeployment() after deploy() and before accessing contract.target so the deployment is confirmed (use the existing contract variable returned by deploy(), and call waitForDeployment on it prior to the console.log).deploy/deploy.script.ts (1)
28-30: Addawait contract.waitForDeployment()before accessingcontract.target.In ethers v6,
deploy()resolves before the contract is actually deployed on-chain. While the address is deterministic and available immediately, the contract code won't exist until the transaction is mined. On Hardhat's local network transactions are mined immediately, but on testnets and mainnet this becomes a real issue if the script is extended to call contract methods. Following the ethers v6 best practice, useawait contract.waitForDeployment()to ensure the deployment is confirmed before proceeding.Proposed fix
+ await contract.waitForDeployment(); console.log(`${CONTRACT_TO_DEPLOY} deployed to address:`, contract.target);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@deploy/deploy.script.ts` around lines 28 - 30, The console.log reads contract.target immediately after deploy; update the deploy flow to await the contract being mined by calling await contract.waitForDeployment() after deploy() and before accessing contract.target so the deployment is confirmed (use the existing contract variable returned by deploy(), and call waitForDeployment on it prior to the console.log).
Addressed Issues:
Fixes #47
Screenshots/Recordings:
Additional Notes:
Changes
auctionNamevariable.getContractFactory(CONTRACT_TO_DEPLOY).CONTRACT_TO_DEPLOYis deployed.Checklist
We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.
Summary by CodeRabbit