Skip to content

Commit

Permalink
Update Polygon cross-chain config to support Amoy testnet
Browse files Browse the repository at this point in the history
It was unclear which testnet will replace the Mumbai testnet after the
deprecation of the underlying Goerli testnet. Now we know the new L2 testnet on
Polygon will be called `amoy` and will use the `80002` chain id. We can update
our config accordingly.
Read more:
maticnetwork/heimdall#1096
maticnetwork/bor#1072
  • Loading branch information
michalinacienciala committed Nov 29, 2023
1 parent 46d63ac commit 2494e2b
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 13 deletions.
1 change: 1 addition & 0 deletions cross-chain/polygon/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
!/deployments/mainnet/
!/deployments/polygon/
!/deployments/mumbai/
!/deployments/amoy/

# OZ
/.openzeppelin/unknown-*.json
5 changes: 3 additions & 2 deletions cross-chain/polygon/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Wormhole-specific tBTC representation into the canonical `PolygonTBTC` token.

The deployment scripts are responsible for managing updates of the tBTC gateway
addresses across various chains. These addresses are stored in the `external/`
directory for a specific network, such as `mumbai/ArbitrumWormholeGateway.json.`
directory for a specific network, such as `amoy/ArbitrumWormholeGateway.json.`
It is important to note that these addresses should remain constant for the
mainnet network. However, there may be instances where a new version of a
cross-chain module is deployed to the testing network, which would require a
Expand All @@ -42,7 +42,8 @@ yarn deploy --network <network>

Supported networks:
- `hardhat` - for local development
- `mumbai` - testing network
- `mumbai` - testing network (will become deprecated with the end of 2023)
- `amoy` - testing network
- `polygon` - mainnet

Currently, this module does not deploy any contracts on L1. All the existing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
// Contracts can be verified on Polygonscan in a similar way as we
// do it on L1 Etherscan
if (hre.network.tags.polygonscan) {
if (hre.network.name === "mumbai") {
if (hre.network.name === "mumbai" || hre.network.name === "amoy") {
// Polygonscan might not include the recently added proxy transaction right
// after deployment. We need to wait some time so that transaction is
// visible on Polygonscan.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
// Contracts can be verified on Polygonscan in a similar way as we
// do it on L1 Etherscan
if (hre.network.tags.polygonscan) {
if (hre.network.name === "mumbai") {
if (hre.network.name === "mumbai" || hre.network.name === "amoy") {
// Polygonscan might not include the recently added proxy transaction right
// after deployment. We need to wait some time so that transaction is
// visible on Polygonscan.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

// See https://book.wormhole.com/reference/contracts.html
// This ID is valid for both Polygon Testnet (Mumbai) and Mainnet
// TODO: check ID for the new L2 Polygon testnet once it's annunced and supported by Wormhole
// TODO: check ID for the Amoy testnet once it's supported by Wormhole.
const wormholeChainID = 5

const polygonWormholeGateway = await deployments.get("PolygonWormholeGateway")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
// Contracts can be verified on L2 Polygonscan in a similar way as we do it on
// L1 Etherscan
if (hre.network.tags.polygonscan) {
if (hre.network.name === "mumbai") {
if (hre.network.name === "mumbai" || hre.network.name === "amoy") {
// Polygonscan might not include the recently added proxy transaction right
// after deployment. We need to wait some time so that transaction is
// visible on Polygonscan.
Expand Down
42 changes: 35 additions & 7 deletions cross-chain/polygon/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,19 @@ const config: HardhatUserConfig = {
// parentchain: "goerli",
// },
},
// TODO: add new L2 Polygon testnet once it's annunced
// https://www.alchemy.com/overviews/migrate-to-sepolia#sepolia-testnets-on-alchemy
amoy: {
url: process.env.SIDECHAIN_API_URL || "",
chainId: 80002,
deploy: ["deploy_sidechain"],
accounts: process.env.SIDECHAIN_ACCOUNTS_PRIVATE_KEYS
? process.env.SIDECHAIN_ACCOUNTS_PRIVATE_KEYS.split(",")
: undefined,
// Uncomment once Polygonscan supports Amoy testnet.
// tags: ["polygonscan"],
// companionNetworks: {
// parentchain: "goerli",
// },
},
polygon: {
url: process.env.SIDECHAIN_API_URL || "",
chainId: 137,
Expand All @@ -96,7 +107,7 @@ const config: HardhatUserConfig = {
sepolia: ["./external/sepolia"],
mainnet: ["./external/mainnet"],
mumbai: ["./external/mumbai"],
// TODO: add new L2 Polygon testnet once it's annunced
amoy: ["./external/amoy"],
polygon: ["./external/polygon"],
},
},
Expand All @@ -106,7 +117,7 @@ const config: HardhatUserConfig = {
sepolia: "artifacts/parentchain",
mainnet: "artifacts/parentchain",
mumbai: "artifacts/sidechain",
// TODO: add new L2 Polygon testnet once it's annunced
amoy: "artifacts/sidechain",
polygon: "artifacts/sidechain",
},

Expand All @@ -116,9 +127,26 @@ const config: HardhatUserConfig = {
sepolia: process.env.ETHERSCAN_API_KEY,
mainnet: process.env.ETHERSCAN_API_KEY,
polygonMumbai: process.env.POLYGONSCAN_API_KEY,
// TODO: add new L2 Polygon testnet once it's annunced
// TODO: uncomment once Amoy testnet is live and supported by Polygonscan.
// polygonAmoy: process.env.POLYGONSCAN_API_KEY,
polygon: process.env.POLYGONSCAN_API_KEY,
},
// TODO: Uncomment once Amoy testnet is live and supported by Polygonscan.
// The custom config will not be needed if `polygonAmoy` will be added to
// https://github.com/NomicFoundation/hardhat/blame/main/packages/hardhat-verify/src/internal/chain-config.ts.
// In that case we'll need to update `hardhat-verify` dependency.
// customChains: [
// {
// networkName: "polygonAmoy",
// chainId: 80002,
// urls: {
// // Check below values in https://docs.polygonscan.com/getting-started/endpoint-urls
// // once Polygonscan supports Amoy testnet.
// apiURL: "https://api-testnet.polygonscan.com/api",
// browserURL: "https://amoy.polygonscan.com/",
// }
// }
// ]
},

namedAccounts: {
Expand All @@ -127,7 +155,7 @@ const config: HardhatUserConfig = {
goerli: 0,
sepolia: 0,
mumbai: 0,
// TODO: add new L2 Polygon testnet once it's annunced
amoy: 0,
mainnet: "0x123694886DBf5Ac94DDA07135349534536D14cAf",
polygon: "0x123694886DBf5Ac94DDA07135349534536D14cAf",
},
Expand All @@ -136,7 +164,7 @@ const config: HardhatUserConfig = {
goerli: 0,
sepolia: 0,
mumbai: 0,
// TODO: add new L2 Polygon testnet once it's annunced
amoy: 0,
mainnet: "0x9f6e831c8f8939dc0c830c6e492e7cef4f9c2f5f",
polygon: "0x9f6e831c8f8939dc0c830c6e492e7cef4f9c2f5f",
},
Expand Down
1 change: 1 addition & 0 deletions cross-chain/polygon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"lint:config:fix": "prettier --write '**/*.@(json|yaml)'",
"prepack": "tsc -p tsconfig.export.json && hardhat export-artifacts export/artifacts",
"export-artifacts:goerli": "yarn hardhat export-deployment-artifacts --network mumbai",
"export-artifacts:sepolia": "yarn hardhat export-deployment-artifacts --network amoy",
"export-artifacts:mainnet": "yarn hardhat export-deployment-artifacts --network polygon",
"prepublishOnly": "npm run export-artifacts:$npm_config_network",
"test": "hardhat test"
Expand Down

0 comments on commit 2494e2b

Please sign in to comment.