Skip to content

Commit

Permalink
Adding Chiado as second testnet.
Browse files Browse the repository at this point in the history
Scripts for contracts deployment and verification.
  • Loading branch information
martillansky committed Mar 27, 2024
1 parent 6099584 commit 4826270
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 14 deletions.
23 changes: 22 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@ const config: HardhatUserConfig = {
solidity: { version: "0.8.20", settings: { optimizer: { enabled: true, runs: 3200 }, viaIR: true } },
networks: {
hardhat: { chainId: 1, allowUnlimitedContractSize: true },
mainnet : {
chainId: 1,
url: ``,
accounts: [process.env.PRIVATE_KEY!],
},
gnosis: {
chainId: 100,
url: `https://rpc.gnosischain.com/`,
accounts: [process.env.PRIVATE_KEY!],
},
chiado: {
chainId: 10200,
url: `https://rpc.chiado.gnosis.gateway.fm`,
accounts: [process.env.PRIVATE_KEY!],
},
sepolia: {
chainId: 11155111,
url: `https://sepolia.infura.io/v3/${process.env.INFURA_API_KEY!}`,
Expand All @@ -38,7 +48,18 @@ const config: HardhatUserConfig = {
apiKey: {
sepolia: `${process.env.ETHERSCAN_API_KEY!}`,
xdai: `${process.env.XDAI_API_KEY!}`,
}
chiado: `${process.env.CHIADO_API_KEY!}`,
},
customChains: [
{
network: "chiado",
chainId: 10200,
urls: {
apiURL: `https://gnosis-chiado.blockscout.com/api`,
browserURL: `https://blockscout.chiadochain.net`,
},
}
]
}
};

Expand Down
40 changes: 35 additions & 5 deletions scripts/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ interface AddressSet {
export enum Chain {
GNOSIS = 100,
SEPOLIA = 11155111,
CHIADO = 10200,
MAINNET = 1,
}

export const Addresses: Record<number, AddressSet> = {
Expand All @@ -24,26 +26,54 @@ export const Addresses: Record<number, AddressSet> = {
POH_Implementation: "0x2CfF45C3C5A5ACbA63a9BA4979de05c27dd2AC0d",
CROSS_CHAIN: "0x2C692919Da3B5471F9Ac6ae1C9D1EE54F8111f76",
CC_Implementation: "0x8363709987bbfbe241f9900eb449dcf517a80e74",
GATEWAY: "0x0142424ce8ce5E0999e3AB794A0b608511EF90dF", //"0x01E429B428fC06E3577E33E42EE69560E38420C3",
MESSENGER: "0x6E260AF12b708853d7A7e9A2E9124873c7B0C25F", //"0x", //"0x7EB9D435CEc5A254F1033a63c474a97cBBCDF01A",
GATEWAY: "0x0142424ce8ce5E0999e3AB794A0b608511EF90dF",
MESSENGER: "0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59",
LEGACY: "0x",
ARBITRATOR: "0x9C1dA9A04925bDfDedf0f6421bC7EEa8305F9002",
W_NATIVE: "0xe91d153e0b41518a2ce8dd3d7944fa863463a97d",
},
[Chain.CHIADO]: {
POH: "0x2505C87AA36d9ed18514Ea7473Ac58aeDeb50849",
POH_Implementation: "0x2CfF45C3C5A5ACbA63a9BA4979de05c27dd2AC0d",
CROSS_CHAIN: "0xBEd896A3DEa0E065F05Ba83Fa63322c7b9d67838",
CC_Implementation: "0x4a594f0e73223c9a1CE0EfC16da92fFaA193a612",
GATEWAY: "0x56350e6827263B8521192d4979D341dA7582A996",
MESSENGER: "0x8448E15d0e706C0298dECA99F0b4744030e59d7d",
LEGACY: "0x",
ARBITRATOR: "0x34E520dc1d2Db660113b64724e14CEdCD01Ee879",
W_NATIVE: "0x014A442480DbAD767b7615E55E271799889FA1a7",
//PROXY_ADMIN: "0x856B71a157377dd43CCAC11430fe50d0912a46b4",
},
[Chain.SEPOLIA]: {
POH: "0x29defF3DbEf6f79ef20d3fe4f9CFa0547acCeC0D",
POH_Implementation: "0xa59974FDc4728178D6CdEa305228D4482146f2FD",
CROSS_CHAIN: "0xd134748B972A320a73EfDe3AfF7a68718F6bA92c",
CC_Implementation: "0x1b1938b88f98aac56ae6d5beeb72abd6b858061c",
GATEWAY: "0xfE5DB6640a1AE41176c025F6D32cf37Bd7e43898", //"0xEbC60f7e5F5cD3c98f43F29167E2630491Ba4571",
MESSENGER: "0xd6E5dB0de4219684E247a570501cDC51E993CDF9", //"0x", //"0x8C2858b87D98262fa79c7b10a47840a81E057B85",
GATEWAY: "0x3787Aa5c2c03A1AC49555F84750e9503ba9A9043",
MESSENGER: "0xf2546D6648BD2af6a008A7e7C1542BB240329E11",
LEGACY: "0x08Db8FD559cb4e3668f994553871c7eBa7c3941a",
ARBITRATOR: "0x90992fb4E15ce0C59aEFfb376460Fda4Ee19C879",
W_NATIVE: "0x7b79995e5f793a07bc00c21412e50ecae098e7f9",
},
[Chain.MAINNET]: {
POH: "0x",
POH_Implementation: "0x",
CROSS_CHAIN: "0x",
CC_Implementation: "0x",
GATEWAY: "0x",
MESSENGER: "0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e",
LEGACY: "0x",
ARBITRATOR: "0x",
W_NATIVE: "0x",
},
};

export const SUPPORTED_NETWORKS = [Chain.SEPOLIA, Chain.GNOSIS];
export const SUPPORTED_NETWORKS = [
Chain.SEPOLIA,
Chain.GNOSIS,
Chain.CHIADO,
Chain.MAINNET
];

export const supported = async () => {
const [deployer] = await ethers.getSigners();
Expand Down
19 changes: 13 additions & 6 deletions scripts/deploy/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,19 @@ async function main() {
const [deployer] = await ethers.getSigners();
const chainId = +(await getChainId()) as Chain;

const FOREIGN_CC_PROXY =
chainId === Chain.GNOSIS ? Addresses[Chain.SEPOLIA].CROSS_CHAIN : Addresses[Chain.GNOSIS].CROSS_CHAIN;

var messengerAddress = Addresses[chainId].MESSENGER;
// If the messenger was deployed before we must have its corresponding address in Addresses[chainId].MESSENGER,
// otherwise we need to do a deployment of the messenger and use that address for deploying the bridge.
const FOREIGN_CC_PROXY =
(chainId === Chain.CHIADO) ?
Addresses[Chain.SEPOLIA].CROSS_CHAIN :
(chainId === Chain.SEPOLIA) ?
Addresses[Chain.CHIADO].CROSS_CHAIN :
(chainId === Chain.GNOSIS) ?
Addresses[Chain.MAINNET].CROSS_CHAIN :
//(chainId === Chain.ETH) ?
Addresses[Chain.GNOSIS].CROSS_CHAIN;

var messengerAddress = Addresses[chainId].MESSENGER;
// Address of the AMB mediator (ETH-GNO only) specified in Addresses[chainId].MESSENGER
// If no address is found the centralized AMB (Mock) will be deployed and its address used for deploying the AMB bridge afterwards.
if (Addresses[chainId].MESSENGER === "0x") {
const amb = await new CentralizedAMB__factory(deployer).deploy();
messengerAddress = await amb.getAddress();
Expand Down
2 changes: 1 addition & 1 deletion scripts/verify/ccpoh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ async function main() {
const chainId = +(await getChainId());
await run("verify:verify",
{
address: Addresses[chainId].CC_Implementation
address: Addresses[chainId].CROSS_CHAIN
}
)

Expand Down
3 changes: 3 additions & 0 deletions scripts/verify/messenger.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { getChainId, run } from "hardhat";
import { Addresses } from "../consts";

// Shouldn't be used unless verifying MockAMB.
// AMB mediators should provide the corresponding contract addresses

async function main() {
const chainId = +(await getChainId());

Expand Down
2 changes: 1 addition & 1 deletion scripts/verify/poh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ async function main() {
const chainId = +(await getChainId());
await run("verify:verify",
{
address: Addresses[chainId].POH_Implementation
address: Addresses[chainId].POH
}
)

Expand Down

0 comments on commit 4826270

Please sign in to comment.