Skip to content

Nonce-Specific Deployment Task for Cross-Chain Address Matching#9

Merged
Maar-io merged 5 commits into
mainfrom
deploy/optimism
Jun 19, 2025
Merged

Nonce-Specific Deployment Task for Cross-Chain Address Matching#9
Maar-io merged 5 commits into
mainfrom
deploy/optimism

Conversation

@Maar-io

@Maar-io Maar-io commented Jun 18, 2025

Copy link
Copy Markdown
Contributor

This PR adds a Hardhat task deployAtNonce that deploys an upgradeable AstarToken contract at a specific nonce to ensure address consistency across multiple chains. The script:

  • Deploys the implementation contract at nonce N-1
  • Deploys the proxy contract precisely at nonce N (default 15)
  • Fast-forwards transactions if needed to reach the target nonce
  • Verifies the proxy contract address matches the expected address from Soneium network
  • Includes optional contract verification on block explorers

Why This Approach
This approach was necessary because the original Astar token on Soneium was deployed using the standard CREATE opcode (not CREATE2), and specifically at nonce 15 of the deployer account. Since Ethereum contract addresses are deterministically generated from keccak256(rlp([deployer_address, deployer_nonce])), the only way to achieve the same contract address on Optimism is to:

  • Use the identical deployer address
  • Ensure deployment happens at exactly the same nonce (15)

This ensures token address consistency across chains, which is critical for cross-chain bridging protocols and provides a seamless user experience.

@Maar-io
Maar-io requested a review from a team as a code owner June 18, 2025 13:19
@Maar-io
Maar-io requested a review from gtg7784 June 18, 2025 13:19
@Maar-io Maar-io self-assigned this Jun 18, 2025
Comment thread config/networks.ts Outdated
@@ -1,21 +1,20 @@
import { Chains, EtherscanConfig, Networks } from "./types";
import configData from "./config.json";
// require("@chainlink/env-enc").config();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we use this env-enc ? any reason for removing this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, reverted

@Maar-io
Maar-io merged commit bd0c300 into main Jun 19, 2025
1 check passed
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.

2 participants