Skip to content

Conversation

@HimanshuS2212
Copy link
Contributor

@HimanshuS2212 HimanshuS2212 commented Dec 10, 2025

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the deployV1FactoryContracts.ts deployment script from ethers v5 to ethers v6, updating all API calls to use the new ethers v6 syntax. The script was tested on opBNB testnet.

Key Changes:

  • Updated from BigNumber arithmetic to native bigint operations for gas price calculations
  • Migrated contract deployment and address retrieval methods to ethers v6 APIs
  • Added fallback logic for signer selection when a second signer is unavailable

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


const gasParams = {
gasPrice: feeData.gasPrice.mul(2) // Use BigNumber arithmetic for ethers v5
gasPrice: (feeData.gasPrice ?? 0n) * 2n // Use bigint arithmetic for ethers v6
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fallback value of 0n for gasPrice could cause transactions to fail. If feeData.gasPrice is null or undefined, multiplying 0n by 2n will result in a gasPrice of 0n, which would make transactions not get mined. Consider throwing an error or using a more appropriate fallback strategy when gasPrice is unavailable.

Copilot uses AI. Check for mistakes.
Comment on lines 19 to 21
const gasParams = {
gasPrice: feeData.gasPrice.mul(2) // Use BigNumber arithmetic for ethers v5
gasPrice: (feeData.gasPrice ?? 0n) * 2n // Use bigint arithmetic for ethers v6
};
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gasPrice parameter is being set as a bigint value, but ethers v6 typically expects gas parameters to be in standard number format or properly formatted. Verify that the gasParams object with bigint gasPrice is compatible with the deploy and sendTransaction methods in ethers v6, as this may cause type errors or transaction failures.

Copilot uses AI. Check for mistakes.
Comment on lines +48 to +51
output.walletImplementation = await walletImplementation.getAddress(); // ethers v6
console.log(
`${walletImplementationContractName} deployed at ` +
walletImplementation.address // ethers v5
(await walletImplementation.getAddress()) // ethers v6
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant async call: the address is fetched twice - once on line 48 for assignment and again on line 51 for logging. Consider storing the address in a variable to avoid the duplicate async call.

Copilot uses AI. Check for mistakes.
console.log(
`${walletFactoryContractName} deployed at ` + walletFactory.address // ethers v5
`${walletFactoryContractName} deployed at ` +
(await walletFactory.getAddress()) // ethers v6
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant async call: the address is fetched twice - once on line 63 for assignment and again on line 66 for logging. Consider reusing the address stored in output.walletFactory to avoid the duplicate async call.

Suggested change
(await walletFactory.getAddress()) // ethers v6
output.walletFactory // ethers v6

Copilot uses AI. Check for mistakes.
console.log(
`${forwarderImplementationContractName} deployed at ` +
forwarderImplementation.address // ethers v5
(await forwarderImplementation.getAddress()) // ethers v6
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant async call: the address is fetched twice - once on line 99 for assignment and again on line 103 for logging. Consider reusing the address stored in output.forwarderImplementation to avoid the duplicate async call.

Suggested change
(await forwarderImplementation.getAddress()) // ethers v6
output.forwarderImplementation // ethers v6

Copilot uses AI. Check for mistakes.
console.log(
`${forwarderFactoryContractName} deployed at ` + forwarderFactory.address // ethers v5
`${forwarderFactoryContractName} deployed at ` +
(await forwarderFactory.getAddress()) // ethers v6
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant async call: the address is fetched twice - once on line 117 for assignment and again on line 120 for logging. Consider reusing the address stored in output.forwarderFactory to avoid the duplicate async call.

Suggested change
(await forwarderFactory.getAddress()) // ethers v6
output.forwarderFactory // ethers v6

Copilot uses AI. Check for mistakes.
@HimanshuS2212 HimanshuS2212 merged commit cde2936 into master Dec 16, 2025
10 checks passed
@HimanshuS2212 HimanshuS2212 deleted the COIN-6850 branch December 16, 2025 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants